|
mjsonrpc 1.0
A lightweight JSON-RPC 2.0 message parser and generator based on cJSON
|
Functions for creating JSON-RPC responses. More...
Functions | |
| cJSON * | mjrpc_response_ok (cJSON *result, cJSON *id) |
| Build a successful JSON-RPC response with result. | |
| cJSON * | mjrpc_response_error (int code, char *message, cJSON *id) |
| Build an error JSON-RPC response. | |
Functions for creating JSON-RPC responses.
| cJSON * mjrpc_response_error | ( | int | code, |
| char * | message, | ||
| cJSON * | id | ||
| ) |
Build an error JSON-RPC response.
Creates a JSON-RPC 2.0 error response object with the specified error code, message, and request ID.
| code | Error code (standard JSON-RPC codes or custom codes) |
| message | Error message (will be freed automatically, can be NULL) |
| id | Client request ID (will be owned by response) |
| NULL | If an error occurred (message and id will be released) |
| cJSON * mjrpc_response_ok | ( | cJSON * | result, |
| cJSON * | id | ||
| ) |
Build a successful JSON-RPC response with result.
Creates a JSON-RPC 2.0 response object containing the specified result and request ID.
| result | Result data to be returned (will be owned by response) |
| id | Client request ID (will be owned by response) |
| NULL | If an error occurred (result and id will be released) |