svc.h 4.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. #ifndef __SVC_H__
  2. #define __SVC_H__
  3. #pragma once
  4. #include "sp_rpc.h"
  5. // void handle_info(sp_rpc_server_t *server, int epid, int svc_id, int call_type, iobuffer_t **info_pkt)
  6. //
  7. #define BEGIN_INFO_MAP() \
  8. switch (call_type) {
  9. #define HANDLE_INFO(t, handle) \
  10. case t: \
  11. DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM).setAPI(__FUNCTION__)("begin process info type %s", #t); \
  12. handle(server, epid, svc_id, call_type, info_pkt); \
  13. DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM).setAPI(__FUNCTION__)("end process info type %s", #t); \
  14. break;
  15. #define END_INFO_MAP() \
  16. default: \
  17. DbgWithLink(LOG_LEVEL_WARN, LOG_TYPE_SYSTEM).setAPI(__FUNCTION__)("unknown info type!"); \
  18. break; \
  19. }
  20. //
  21. // iobuffer_t handle_req(sp_rpc_server_t *server, int epid, int svc_id, int rpc_id, int call_type, iobuffer_t **req_pkt)
  22. //
  23. #define BEGIG_REQ_MAP() \
  24. { \
  25. iobuffer_t *ans_pkt = NULL; \
  26. switch (call_type) {
  27. #define HANDLE_REQ(t, handle) \
  28. case t: \
  29. /*DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM).setAPI(__FUNCTION__)("begin process req type %s", #t);*/ \
  30. ans_pkt = handle(server, epid, svc_id, rpc_id, call_type, req_pkt); \
  31. /*DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM).setAPI(__FUNCTION__)("end process req type %s", #t);*/ \
  32. break;
  33. #define END_REQ_MAP() \
  34. default: \
  35. DbgWithLink(LOG_LEVEL_WARN, LOG_TYPE_SYSTEM).setAPI(__FUNCTION__)("unknown req type!"); \
  36. break; \
  37. } \
  38. if (ans_pkt) { \
  39. int rc = sp_rpc_server_send_answer(server, epid, svc_id, rpc_id, &ans_pkt); \
  40. if (rc != 0) { \
  41. DbgWithLink(LOG_LEVEL_WARN, LOG_TYPE_SYSTEM).setAPI(__FUNCTION__)("send answer failed!"); \
  42. } \
  43. if (ans_pkt) { \
  44. iobuffer_dec_ref(ans_pkt); \
  45. } \
  46. } \
  47. }
  48. //
  49. // info handlers
  50. //
  51. void on_bluesceen_display(sp_rpc_server_t *server, int epid, int svc_id, int call_type, iobuffer_t **info_pkt);
  52. void on_fatal_error_display(sp_rpc_server_t *server, int epid, int svc_id, int call_type, iobuffer_t **info_pkt);
  53. void on_startup_info_display(sp_rpc_server_t *server, int epid, int svc_id, int call_type, iobuffer_t **info_pkt);
  54. void on_bluesceen_undisplay(sp_rpc_server_t *server, int epid, int svc_id, int call_type, iobuffer_t **info_pkt);
  55. void on_machine_reboot(sp_rpc_server_t *server, int epid, int svc_id, int call_type, iobuffer_t **info_pkt);
  56. void on_entity_quit(sp_rpc_server_t *server, int epid, int svc_id, int call_type, iobuffer_t **info_pkt);
  57. void on_output_console_on(sp_rpc_server_t *server, int epid, int svc_id, int call_type, iobuffer_t **info_pkt);
  58. void on_output_console_off(sp_rpc_server_t *server, int epid, int svc_id, int call_type, iobuffer_t **info_pkt);
  59. void on_terminal_stage_change(sp_rpc_server_t * server, int epid, int svc_id, int call_type, iobuffer_t * *info_pkt);
  60. void on_start_upload_log(sp_rpc_server_t * server, int epid, int svc_id, int call_type, iobuffer_t **info_pkt);
  61. void on_start_update_token(sp_rpc_server_t * server, int epid, int svc_id, int call_type, iobuffer_t * *info_pkt);
  62. void on_fresh_env(sp_rpc_server_t * server, int epid, int svc_id, int call_type, iobuffer_t * *info_pkt);
  63. //
  64. // req handlers
  65. //
  66. iobuffer_t* on_entity_start(int svc_id, int entity_id, const char* cmdline);
  67. iobuffer_t* on_entity_startEx(sp_rpc_server_t* server, int epid, int svc_id, int rpc_id, int call_type, iobuffer_t** req_pkt);
  68. iobuffer_t *on_entity_start(sp_rpc_server_t *server, int epid, int svc_id, int rpc_id, int call_type, iobuffer_t **req_pkt);
  69. iobuffer_t *on_entity_stop(sp_rpc_server_t *server, int epid, int svc_id, int rpc_id, int call_type, iobuffer_t **req_pkt);
  70. iobuffer_t *on_entity_continue(sp_rpc_server_t *server, int epid, int svc_id, int rpc_id, int call_type, iobuffer_t **req_pkt);
  71. iobuffer_t *on_entity_pause(sp_rpc_server_t *server, int epid, int svc_id, int rpc_id, int call_type, iobuffer_t **req_pkt);
  72. iobuffer_t *on_entity_test(sp_rpc_server_t *server, int epid, int svc_id, int rpc_id, int call_type, iobuffer_t **req_pkt);
  73. iobuffer_t *on_entity_termination(sp_rpc_server_t *server, int epid, int svc_id, int rpc_id, int call_type, iobuffer_t **req_pkt);
  74. iobuffer_t *on_get_bcast_receiver(sp_rpc_server_t *server, int epid, int svc_id, int rpc_id, int call_type, iobuffer_t **req_pkt);
  75. iobuffer_t* on_try_update_cfg(sp_rpc_server_t * server, int epid, int svc_id, int rpc_id, int call_type, iobuffer_t * *req_pkt);
  76. iobuffer_t* on_write_terminalNo(sp_rpc_server_t * server, int epid, int svc_id, int rpc_id, int call_type, iobuffer_t * *req_pkt);
  77. iobuffer_t* on_modify_mem_cfg(sp_rpc_server_t * server, int epid, int svc_id, int rpc_id, int call_type, iobuffer_t * *req_pkt);
  78. iobuffer_t* on_try_update_VTMERRMSG(sp_rpc_server_t * server, int epid, int svc_id, int rpc_id, int call_type, iobuffer_t * *req_pkt);
  79. iobuffer_t* on_try_upload_logs_info(sp_rpc_server_t * server, int epid, int svc_id, int rpc_id, int call_type, iobuffer_t * *req_pkt);
  80. int stop_all_stated_entity(void* param);
  81. int KickoffSpRestart(bool bRestart);
  82. int KickoffSpRestartPC(bool bRestart);
  83. #endif //__SVC_H__