mirror of
https://github.com/cesanta/mongoose.git
synced 2026-12-04 21:58:22 +00:00
Expose rpc guts
This commit is contained in:
1 parent
f02f88f336
commit
581a0698af
6 files changed
+53
-51
No files matched your search
+16
-8
@@ -1364,17 +1364,25 @@ char *mg_json_get_b64(struct mg_str json, const char *path, int *len);
|
||||
|
||||
// JSON-RPC request descriptor
|
||||
struct mg_rpc_req {
|
||||
void **head; // List of all RPC handlers
|
||||
mg_pfn_t pfn; // Response printing function
|
||||
void *pfn_data; // Response printing function 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]}
|
||||
struct mg_rpc **head; // RPC handlers list head
|
||||
struct mg_rpc *rpc; // RPC handler being called
|
||||
mg_pfn_t pfn; // Response printing function
|
||||
void *pfn_data; // Response printing function data
|
||||
void *req_data; // Arbitrary request 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,
|
||||
// JSON-RPC method handler
|
||||
struct mg_rpc {
|
||||
struct mg_rpc *next; // Next in list
|
||||
struct mg_str method; // Method pattern
|
||||
void (*fn)(struct mg_rpc_req *); // Handler function
|
||||
void *fn_data; // Handler function argument
|
||||
};
|
||||
|
||||
void mg_rpc_add(struct mg_rpc **head, struct mg_str method_pattern,
|
||||
void (*handler)(struct mg_rpc_req *), void *handler_data);
|
||||
void mg_rpc_del(void **head, void (*handler)(struct mg_rpc_req *));
|
||||
void mg_rpc_del(struct mg_rpc **head, void (*handler)(struct mg_rpc_req *));
|
||||
void mg_rpc_process(struct mg_rpc_req *);
|
||||
|
||||
// Helper functions to print result or error frame
|
||||
|
||||
Reference in new issue
Block a user