initial commit

This commit is contained in:
2025-08-05 15:53:44 +08:00
commit 09dc02ae52
553 changed files with 137665 additions and 0 deletions

22
third_party/libhv/examples/jsonrpc/router.h vendored Executable file
View File

@@ -0,0 +1,22 @@
#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_