router.h 510 B

123456789101112131415161718192021
  1. #ifndef HV_JSON_RPC_ROUTER_H_
  2. #define HV_JSON_RPC_ROUTER_H_
  3. #include "cJSON.h"
  4. typedef void (*jsonrpc_handler)(cJSON* jreq, cJSON* jres);
  5. typedef struct {
  6. const char* method;
  7. jsonrpc_handler handler;
  8. } jsonrpc_router;
  9. void not_found(cJSON* jreq, cJSON* jres);
  10. void bad_request(cJSON* jreq, cJSON* jres);
  11. void do_add(cJSON* jreq, cJSON* jres);
  12. void do_sub(cJSON* jreq, cJSON* jres);
  13. void do_mul(cJSON* jreq, cJSON* jres);
  14. void do_div(cJSON* jreq, cJSON* jres);
  15. #endif // HV_JSON_RPC_ROUTER_H_