12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697 |
- #ifndef __SVC_H__
- #define __SVC_H__
- #pragma once
- #include "sp_rpc.h"
- // void handle_info(sp_rpc_server_t *server, int epid, int svc_id, int call_type, iobuffer_t **info_pkt)
- //
- #define BEGIN_INFO_MAP() \
- switch (call_type) {
- #define HANDLE_INFO(t, handle) \
- case t: \
- DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM).setAPI(__FUNCTION__)("begin process info type %s", #t); \
- handle(server, epid, svc_id, call_type, info_pkt); \
- DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM).setAPI(__FUNCTION__)("end process info type %s", #t); \
- break;
- #define END_INFO_MAP() \
- default: \
- DbgWithLink(LOG_LEVEL_WARN, LOG_TYPE_SYSTEM).setAPI(__FUNCTION__)("unknown info type!"); \
- break; \
- }
- //
- // iobuffer_t handle_req(sp_rpc_server_t *server, int epid, int svc_id, int rpc_id, int call_type, iobuffer_t **req_pkt)
- //
- #define BEGIG_REQ_MAP() \
- { \
- iobuffer_t *ans_pkt = NULL; \
- switch (call_type) {
- #define HANDLE_REQ(t, handle) \
- case t: \
- /*DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM).setAPI(__FUNCTION__)("begin process req type %s", #t);*/ \
- ans_pkt = handle(server, epid, svc_id, rpc_id, call_type, req_pkt); \
- /*DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM).setAPI(__FUNCTION__)("end process req type %s", #t);*/ \
- break;
- #define END_REQ_MAP() \
- default: \
- DbgWithLink(LOG_LEVEL_WARN, LOG_TYPE_SYSTEM).setAPI(__FUNCTION__)("unknown req type!"); \
- break; \
- } \
- if (ans_pkt) { \
- int rc = sp_rpc_server_send_answer(server, epid, svc_id, rpc_id, &ans_pkt); \
- if (rc != 0) { \
- DbgWithLink(LOG_LEVEL_WARN, LOG_TYPE_SYSTEM).setAPI(__FUNCTION__)("send answer failed!"); \
- } \
- if (ans_pkt) { \
- iobuffer_dec_ref(ans_pkt); \
- } \
- } \
- }
- //
- // info handlers
- //
- void on_bluesceen_display(sp_rpc_server_t *server, int epid, int svc_id, int call_type, iobuffer_t **info_pkt);
- void on_fatal_error_display(sp_rpc_server_t *server, int epid, int svc_id, int call_type, iobuffer_t **info_pkt);
- void on_startup_info_display(sp_rpc_server_t *server, int epid, int svc_id, int call_type, iobuffer_t **info_pkt);
- void on_bluesceen_undisplay(sp_rpc_server_t *server, int epid, int svc_id, int call_type, iobuffer_t **info_pkt);
- void on_machine_reboot(sp_rpc_server_t *server, int epid, int svc_id, int call_type, iobuffer_t **info_pkt);
- void on_entity_quit(sp_rpc_server_t *server, int epid, int svc_id, int call_type, iobuffer_t **info_pkt);
- void on_output_console_on(sp_rpc_server_t *server, int epid, int svc_id, int call_type, iobuffer_t **info_pkt);
- void on_output_console_off(sp_rpc_server_t *server, int epid, int svc_id, int call_type, iobuffer_t **info_pkt);
- void on_terminal_stage_change(sp_rpc_server_t * server, int epid, int svc_id, int call_type, iobuffer_t * *info_pkt);
- void on_start_upload_log(sp_rpc_server_t * server, int epid, int svc_id, int call_type, iobuffer_t **info_pkt);
- void on_start_update_token(sp_rpc_server_t * server, int epid, int svc_id, int call_type, iobuffer_t * *info_pkt);
- void on_fresh_env(sp_rpc_server_t * server, int epid, int svc_id, int call_type, iobuffer_t * *info_pkt);
- //
- // req handlers
- //
- iobuffer_t* on_entity_start(int svc_id, int entity_id, const char* cmdline);
- 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);
- 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);
- 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);
- 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);
- 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);
- 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);
- 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);
- 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);
- 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);
- 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);
- 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);
- 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);
- 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);
- int stop_all_stated_entity(void* param);
- int KickoffSpRestart(bool bRestart);
- int KickoffSpRestartPC(bool bRestart);
- #endif //__SVC_H__
|