Debian Codegraph @

third-party/libhv-v1.3.3/examples/jsonrpc/router.h

raw
1 #ifndef HV_JSON_RPC_ROUTER_H_
2 #define HV_JSON_RPC_ROUTER_H_
3
4 #include "cJSON.h"
5
6 typedef void (*jsonrpc_handler)(cJSON* jreq, cJSON* jres);
7
8 typedef struct {
9 const char* method;
10 jsonrpc_handler handler;
11 } jsonrpc_router;
12
13 void error_response(cJSON* jres, int code, const char* message);
14 void not_found(cJSON* jreq, cJSON* jres);
15 void bad_request(cJSON* jreq, cJSON* jres);
16
17 void calc_add(cJSON* jreq, cJSON* jres);
18 void calc_sub(cJSON* jreq, cJSON* jres);
19 void calc_mul(cJSON* jreq, cJSON* jres);
20 void calc_div(cJSON* jreq, cJSON* jres);
21
22 #endif // HV_JSON_RPC_ROUTER_H_