embedded-framework/external/libhv/libhv-1.3.2/examples/jsonrpc/router.h
2024-03-08 07:16:14 -08:00

23 lines
583 B
C

#ifndef HV_JSON_RPC_ROUTER_H_
#define HV_JSON_RPC_ROUTER_H_
#include "cJSON.h"
typedef void (*jsonrpc_handler)(cJSON* jreq, cJSON* jres);
typedef struct {
const char* method;
jsonrpc_handler handler;
} jsonrpc_router;
void error_response(cJSON* jres, int code, const char* message);
void not_found(cJSON* jreq, cJSON* jres);
void bad_request(cJSON* jreq, cJSON* jres);
void calc_add(cJSON* jreq, cJSON* jres);
void calc_sub(cJSON* jreq, cJSON* jres);
void calc_mul(cJSON* jreq, cJSON* jres);
void calc_div(cJSON* jreq, cJSON* jres);
#endif // HV_JSON_RPC_ROUTER_H_