app_manager.h 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. /*
  2. * Copyright (C) 2019 Intel Corporation. All rights reserved.
  3. * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
  4. */
  5. #ifndef APP_MANAGER_H
  6. #define APP_MANAGER_H
  7. #include "bh_platform.h"
  8. #include "app_manager_export.h"
  9. #include "native_interface.h"
  10. #include "bi-inc/shared_utils.h"
  11. #ifdef __cplusplus
  12. extern "C" {
  13. #endif
  14. #define APP_MGR_MALLOC wasm_runtime_malloc
  15. #define APP_MGR_FREE wasm_runtime_free
  16. /* os_printf is defined in each platform */
  17. #define app_manager_printf os_printf
  18. #define SEND_ERR_RESPONSE(mid, err_msg) \
  19. do { \
  20. app_manager_printf("%s\n", err_msg); \
  21. send_error_response_to_host(mid, INTERNAL_SERVER_ERROR_5_00, err_msg); \
  22. } while (0)
  23. extern module_interface *g_module_interfaces[Module_Max];
  24. /* Lock of the module data list */
  25. extern korp_mutex module_data_list_lock;
  26. /* Module data list */
  27. extern module_data *module_data_list;
  28. void
  29. app_manager_add_module_data(module_data *m_data);
  30. void
  31. app_manager_del_module_data(module_data *m_data);
  32. bool
  33. module_data_list_init();
  34. void
  35. module_data_list_destroy();
  36. bool
  37. app_manager_is_interrupting_module(uint32 module_type, void *module_inst);
  38. void
  39. release_module(module_data *m_data);
  40. void
  41. module_data_list_remove(module_data *m_data);
  42. void *
  43. app_manager_timer_create(void (*timer_callback)(void *),
  44. watchdog_timer *wd_timer);
  45. void
  46. app_manager_timer_destroy(void *timer);
  47. void
  48. app_manager_timer_start(void *timer, int timeout);
  49. void
  50. app_manager_timer_stop(void *timer);
  51. watchdog_timer *
  52. app_manager_get_wd_timer_from_timer_handle(void *timer);
  53. int
  54. app_manager_signature_verify(const uint8_t *file, unsigned int file_len,
  55. const uint8_t *signature, unsigned int sig_size);
  56. void
  57. targeted_app_request_handler(request_t *request, void *unused);
  58. #ifdef __cplusplus
  59. } /* end of extern "C" */
  60. #endif
  61. #endif