mirror of
https://github.com/cesanta/mongoose.git
synced 2026-11-01 13:10:43 +00:00
Ditch JSON-RPC from mongoose
PUBLISHED_FROM=89b978c02be2f10eb930ff13673d45249fd67763
This commit is contained in:
1 parent
421b420a0c
commit
b7a0748312
30 files changed
+14
-2323
No files matched your search
@@ -3,7 +3,6 @@ items:
|
||||
- { type: dir, name: mbuf.h }
|
||||
- { type: dir, name: net.h }
|
||||
- { type: dir, name: http.h }
|
||||
- { type: dir, name: json-rpc.h }
|
||||
- { type: dir, name: dns.h }
|
||||
- { type: dir, name: dns-server.h }
|
||||
- { type: dir, name: mqtt.h }
|
||||
|
||||
@@ -1,18 +0,0 @@
|
||||
---
|
||||
title: "JSON-RPC"
|
||||
symbol_kind: "intro"
|
||||
decl_name: "json-rpc.h"
|
||||
items:
|
||||
- { type: file, name: mg_rpc_parse_reply.md }
|
||||
- { type: file, name: mg_rpc_create_request.md }
|
||||
- { type: file, name: mg_rpc_create_reply.md }
|
||||
- { type: file, name: mg_rpc_create_error.md }
|
||||
- { type: file, name: mg_rpc_create_std_error.md }
|
||||
- { type: file, name: mg_rpc_dispatch.md }
|
||||
- { type: file, name: struct_mg_rpc_request.md }
|
||||
- { type: file, name: struct_mg_rpc_reply.md }
|
||||
- { type: file, name: struct_mg_rpc_error.md }
|
||||
---
|
||||
|
||||
|
||||
|
||||
@@ -1,16 +0,0 @@
|
||||
---
|
||||
title: "mg_rpc_create_error()"
|
||||
decl_name: "mg_rpc_create_error"
|
||||
symbol_kind: "func"
|
||||
signature: |
|
||||
int mg_rpc_create_error(char *buf, int len, struct mg_rpc_request *req,
|
||||
int code, const char *message, const char *fmt, ...);
|
||||
---
|
||||
|
||||
Create JSON-RPC error reply in a given buffer.
|
||||
|
||||
Return length of the error, which
|
||||
can be larger then `len` that indicates an overflow.
|
||||
`fmt` format string should conform to `json_emit()` API,
|
||||
see https://github.com/cesanta/frozen
|
||||
|
||||
@@ -1,16 +0,0 @@
|
||||
---
|
||||
title: "mg_rpc_create_reply()"
|
||||
decl_name: "mg_rpc_create_reply"
|
||||
symbol_kind: "func"
|
||||
signature: |
|
||||
int mg_rpc_create_reply(char *buf, int len, const struct mg_rpc_request *req,
|
||||
const char *result_fmt, ...);
|
||||
---
|
||||
|
||||
Create JSON-RPC reply in a given buffer.
|
||||
|
||||
Return length of the reply, which
|
||||
can be larger then `len` that indicates an overflow.
|
||||
`result_fmt` format string should conform to `json_emit()` API,
|
||||
see https://github.com/cesanta/frozen
|
||||
|
||||
@@ -1,16 +0,0 @@
|
||||
---
|
||||
title: "mg_rpc_create_request()"
|
||||
decl_name: "mg_rpc_create_request"
|
||||
symbol_kind: "func"
|
||||
signature: |
|
||||
int mg_rpc_create_request(char *buf, int len, const char *method,
|
||||
const char *id, const char *params_fmt, ...);
|
||||
---
|
||||
|
||||
Create JSON-RPC request in a given buffer.
|
||||
|
||||
Return length of the request, which
|
||||
can be larger then `len` that indicates an overflow.
|
||||
`params_fmt` format string should conform to `json_emit()` API,
|
||||
see https://github.com/cesanta/frozen
|
||||
|
||||
@@ -1,22 +0,0 @@
|
||||
---
|
||||
title: "mg_rpc_create_std_error()"
|
||||
decl_name: "mg_rpc_create_std_error"
|
||||
symbol_kind: "func"
|
||||
signature: |
|
||||
int mg_rpc_create_std_error(char *buf, int len, struct mg_rpc_request *req,
|
||||
int code);
|
||||
---
|
||||
|
||||
Create JSON-RPC error in a given buffer.
|
||||
|
||||
Return length of the error, which
|
||||
can be larger then `len` that indicates an overflow. See
|
||||
JSON_RPC_*_ERROR definitions for standard error values:
|
||||
|
||||
- `#define JSON_RPC_PARSE_ERROR (-32700)`
|
||||
- `#define JSON_RPC_INVALID_REQUEST_ERROR (-32600)`
|
||||
- `#define JSON_RPC_METHOD_NOT_FOUND_ERROR (-32601)`
|
||||
- `#define JSON_RPC_INVALID_PARAMS_ERROR (-32602)`
|
||||
- `#define JSON_RPC_INTERNAL_ERROR (-32603)`
|
||||
- `#define JSON_RPC_SERVER_ERROR (-32000)`
|
||||
|
||||
@@ -1,20 +0,0 @@
|
||||
---
|
||||
title: "mg_rpc_dispatch()"
|
||||
decl_name: "mg_rpc_dispatch"
|
||||
symbol_kind: "func"
|
||||
signature: |
|
||||
int mg_rpc_dispatch(const char *buf, int, char *dst, int dst_len,
|
||||
const char **methods, mg_rpc_handler_t *handlers);
|
||||
---
|
||||
|
||||
Dispatches a JSON-RPC request.
|
||||
|
||||
Parses JSON-RPC request contained in `buf`, `len`.
|
||||
Then, dispatches the request to the correct handler method.
|
||||
Valid method names should be specified in NULL
|
||||
terminated array `methods`, and corresponding handlers in `handlers`.
|
||||
Result is put in `dst`, `dst_len`. Return: length of the result, which
|
||||
can be larger then `dst_len` that indicates an overflow.
|
||||
Overflown bytes are not written to the buffer.
|
||||
If method is not found, an error is automatically generated.
|
||||
|
||||
@@ -1,24 +0,0 @@
|
||||
---
|
||||
title: "mg_rpc_parse_reply()"
|
||||
decl_name: "mg_rpc_parse_reply"
|
||||
symbol_kind: "func"
|
||||
signature: |
|
||||
int mg_rpc_parse_reply(const char *buf, int len, struct json_token *toks,
|
||||
int max_toks, struct mg_rpc_reply *,
|
||||
struct mg_rpc_error *);
|
||||
---
|
||||
|
||||
Parse JSON-RPC reply contained in `buf`, `len` into JSON tokens array
|
||||
`toks`, `max_toks`. If buffer contains valid reply, `reply` structure is
|
||||
populated. The result of RPC call is located in `reply.result`. On error,
|
||||
`error` structure is populated. Returns: the result of calling
|
||||
`parse_json(buf, len, toks, max_toks)`:
|
||||
|
||||
On success, an offset inside `json_string` is returned
|
||||
where parsing has finished. On failure, a negative number is
|
||||
returned, one of:
|
||||
|
||||
- `#define JSON_STRING_INVALID -1`
|
||||
- `#define JSON_STRING_INCOMPLETE -2`
|
||||
- `#define JSON_TOKEN_ARRAY_TOO_SMALL -3`
|
||||
|
||||
@@ -1,16 +0,0 @@
|
||||
---
|
||||
title: "struct mg_rpc_error"
|
||||
decl_name: "struct mg_rpc_error"
|
||||
symbol_kind: "struct"
|
||||
signature: |
|
||||
struct mg_rpc_error {
|
||||
struct json_token *message; /* Whole RPC message */
|
||||
struct json_token *id; /* Message ID */
|
||||
struct json_token *error_code; /* error.code */
|
||||
struct json_token *error_message; /* error.message */
|
||||
struct json_token *error_data; /* error.data, can be NULL */
|
||||
};
|
||||
---
|
||||
|
||||
JSON-RPC error
|
||||
|
||||
@@ -1,14 +0,0 @@
|
||||
---
|
||||
title: "struct mg_rpc_reply"
|
||||
decl_name: "struct mg_rpc_reply"
|
||||
symbol_kind: "struct"
|
||||
signature: |
|
||||
struct mg_rpc_reply {
|
||||
struct json_token *message; /* Whole RPC message */
|
||||
struct json_token *id; /* Message ID */
|
||||
struct json_token *result; /* Remote call result */
|
||||
};
|
||||
---
|
||||
|
||||
JSON-RPC response
|
||||
|
||||
@@ -1,15 +0,0 @@
|
||||
---
|
||||
title: "struct mg_rpc_request"
|
||||
decl_name: "struct mg_rpc_request"
|
||||
symbol_kind: "struct"
|
||||
signature: |
|
||||
struct mg_rpc_request {
|
||||
struct json_token *message; /* Whole RPC message */
|
||||
struct json_token *id; /* Message ID */
|
||||
struct json_token *method; /* Method name */
|
||||
struct json_token *params; /* Method params */
|
||||
};
|
||||
---
|
||||
|
||||
JSON-RPC request
|
||||
|
||||
Reference in new issue
Block a user