summaryrefslogtreecommitdiffstats
path: root/src/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/core/app-mgr/app-manager/app_manager.h
blob: ce83bd170c79e66ce468794bed4d1dd16f8c51f9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
/*
 * Copyright (C) 2019 Intel Corporation.  All rights reserved.
 * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 */

#ifndef APP_MANAGER_H
#define APP_MANAGER_H

#include "bh_platform.h"
#include "app_manager_export.h"
#include "native_interface.h"
#include "bi-inc/shared_utils.h"

#ifdef __cplusplus
extern "C" {
#endif

#define APP_MGR_MALLOC wasm_runtime_malloc
#define APP_MGR_FREE wasm_runtime_free

/* os_printf is defined in each platform */
#define app_manager_printf os_printf

#define SEND_ERR_RESPONSE(mid, err_msg)                                        \
    do {                                                                       \
        app_manager_printf("%s\n", err_msg);                                   \
        send_error_response_to_host(mid, INTERNAL_SERVER_ERROR_5_00, err_msg); \
    } while (0)

extern module_interface *g_module_interfaces[Module_Max];

/* Lock of the module data list */
extern korp_mutex module_data_list_lock;

/* Module data list */
extern module_data *module_data_list;

void
app_manager_add_module_data(module_data *m_data);

void
app_manager_del_module_data(module_data *m_data);

bool
module_data_list_init();

void
module_data_list_destroy();

bool
app_manager_is_interrupting_module(uint32 module_type, void *module_inst);

void
release_module(module_data *m_data);

void
module_data_list_remove(module_data *m_data);

void *
app_manager_timer_create(void (*timer_callback)(void *),
                         watchdog_timer *wd_timer);

void
app_manager_timer_destroy(void *timer);

void
app_manager_timer_start(void *timer, int timeout);

void
app_manager_timer_stop(void *timer);

watchdog_timer *
app_manager_get_wd_timer_from_timer_handle(void *timer);

int
app_manager_signature_verify(const uint8_t *file, unsigned int file_len,
                             const uint8_t *signature, unsigned int sig_size);

void
targeted_app_request_handler(request_t *request, void *unused);

#ifdef __cplusplus
} /* end of extern "C" */
#endif

#endif