123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384 |
- #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: \
- sp_dbg_info("begin process info type %s", #t); \
- handle(server, epid, svc_id, call_type, info_pkt); \
- sp_dbg_info("end process info type %s", #t); \
- break;
- #define END_INFO_MAP() \
- default: \
- sp_dbg_warn("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: \
- /*sp_dbg_info("begin process req type %s", #t);*/ \
- ans_pkt = handle(server, epid, svc_id, rpc_id, call_type, req_pkt); \
- /*sp_dbg_info("end process req type %s", #t);*/ \
- break;
- #define END_REQ_MAP() \
- default: \
- sp_dbg_warn("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) { \
- sp_dbg_warn("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);
- //
- // 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);
- #endif //__SVC_H__
|