mirror of
https://github.com/cesanta/mongoose.git
synced 2026-11-01 13:10:43 +00:00
Refactor JSON and RPC API
This commit is contained in:
1 parent
a4b003b7ac
commit
54d6bad5e5
11 files changed
+703
-694
No files matched your search
@@ -4,16 +4,18 @@
|
||||
|
||||
// JSON-RPC request descriptor
|
||||
struct mg_rpc_req {
|
||||
struct mg_str frame; // Request, e.g. {"id":1,"method":"add","params":[1,2]}
|
||||
void **head; // List of all RPC handlers
|
||||
mg_pfn_t pfn; // Response printing function
|
||||
void *pfn_data; // Response printing function data
|
||||
void *fn_data; // Endpoint handler data
|
||||
void *handler_data; // Endpoint handler data
|
||||
void *process_data; // Arbitrary user data
|
||||
struct mg_str frame; // Request, e.g. {"id":1,"method":"add","params":[1,2]}
|
||||
};
|
||||
|
||||
void mg_rpc_add(void **head, struct mg_str method_pattern,
|
||||
void (*handler)(struct mg_rpc_req *), void *handler_data);
|
||||
void mg_rpc_free(void **head);
|
||||
void mg_rpc_process(void **head, struct mg_str json, mg_pfn_t pfn, void *pfnd);
|
||||
void mg_rpc_process(struct mg_rpc_req *);
|
||||
|
||||
// Helper functions to print result or error frame
|
||||
void mg_rpc_ok(struct mg_rpc_req *, const char *fmt, ...);
|
||||
|
||||
Reference in new issue
Block a user