|
mjsonrpc 1.0
A lightweight JSON-RPC 2.0 message parser and generator based on cJSON
|
Functions for registering and unregistering RPC methods. More...
Functions | |
| int | mjrpc_add_method (mjrpc_handle_t *handle, mjrpc_func function_pointer, const char *method_name, void *arg2func) |
| Register a new RPC method. | |
| int | mjrpc_del_method (mjrpc_handle_t *handle, const char *method_name) |
| Unregister an RPC method. | |
Functions for registering and unregistering RPC methods.
| int mjrpc_add_method | ( | mjrpc_handle_t * | handle, |
| mjrpc_func | function_pointer, | ||
| const char * | method_name, | ||
| void * | arg2func | ||
| ) |
Register a new RPC method.
Adds a new method to the JSON-RPC handle with the specified callback function, method name, and optional user argument.
| handle | JSON-RPC handle (must not be NULL) |
| function_pointer | Callback function for the method (must not be NULL) |
| method_name | Name of the method (must not be NULL) |
| arg2func | User argument passed to the callback function (can be NULL) |
| MJRPC_RET_OK | If successful |
| MJRPC_RET_ERROR_HANDLE_NOT_INITIALIZED | If handle is NULL |
| MJRPC_RET_ERROR_INVALID_PARAM | If function_pointer or method_name is NULL |
| MJRPC_RET_ERROR_MEM_ALLOC_FAILED | If memory allocation failed |
| int mjrpc_del_method | ( | mjrpc_handle_t * | handle, |
| const char * | method_name | ||
| ) |
Unregister an RPC method.
Removes the specified method from the JSON-RPC handle and frees associated memory.
| handle | JSON-RPC handle (must not be NULL) |
| method_name | Name of the method to remove (must not be NULL) |
| MJRPC_RET_OK | If successful |
| MJRPC_RET_ERROR_INVALID_PARAM | If method_name is NULL |
| MJRPC_RET_ERROR_NOT_FOUND | If method was not found |