nlib
|
Implements JSON-RPC 2.0. More...
Classes | |
class | JsonRpcClient |
Class to manage client side JSON-RPC. More... | |
class | JsonRpcRequest |
Class for representing a JSON-RPC request. More... | |
class | JsonRpcRequestReader |
Class that reads the JSON-RPC request. More... | |
class | JsonRpcRequestWriter |
Class to serialize and write the JSON-RPC request to memory. More... | |
class | JsonRpcResponse |
Class for representing the JSON-RPC response. More... | |
class | JsonRpcResponseReader |
Class that reads the JSON-RPC response byte string. More... | |
class | JsonRpcResponseWriter |
Class that writes the JSON-RPC response byte string. More... | |
Typedefs | |
typedef uint32_t | reqid_t |
id type for the JSON-RPC request. More... | |
typedef JsonRpcServerFuncCallError(* | JsonRpcServerFunc) (MpObject ¶m, JsonRpcResponse &response) |
JSON-RPC method handler. More... | |
Enumerations | |
enum | JsonRpcServerFuncCallError { JSONSERVER_OK = 0, JSONSERVER_PARSE_ERROR = -32700, JSONSERVER_INVALID_REQUEST = -32600, JSONSERVER_METHOD_NOT_FOUND = -32601, JSONSERVER_INVALID_PARAMS = -32602, JSONSERVER_INTERNAL_ERROR = -32603 } |
Return value of the server-side JSON-RPC method handler. More... | |
Functions | |
errno_t | AddJsonRpcServerMethod (const char *method, JsonRpcServerFunc func) |
Sets the JSON-RPC method handler. More... | |
JsonRpcServerFunc | GetJsonRpcServerMethod (const char *method) |
Gets the method handler of the JSON-RPC registered by specifying the method name. More... | |
void | ClearJsonRpcServerMethodTable () |
Deletes all registered JSON-RPC method handlers. | |
size_t | JsonRpcServerExec (const void *p, size_t n, ReallocOutputStream::UniquePtrType *ptr) |
Creates the JSON-RPC response byte string by processing the JSON-RPC request. More... | |
Implements JSON-RPC 2.0.
nlib
can be implemented on both the client and server sides. nlib
has implemented JSON-RPC 2.0 (JSON-RPC 1.0 is not implemented). nlib
can also use msgpack
to communicate instead of JSON. jsonrpc
sample may be used as reference for this part. nlib
JSON-RPC may use msgpack
instead of JSON for higher efficiency. JsonRpcServerFuncCallError(* nn::nlib::msgpack::jsonrpc::JsonRpcServerFunc)(MpObject ¶m, JsonRpcResponse &response) |
JSON-RPC method handler.
[in] | param | JSON-RPC call function parameter. |
[in,out] | response |
0
.JsonRpcServerFuncCallError
as a response, call JsonRpcResponse::SetError
to set an error, and then return JSONSERVER_OK
. Definition at line 32 of file JsonRpcServerExec.h.
uint32_t nn::nlib::msgpack::jsonrpc::reqid_t |
id
type for the JSON-RPC request.
nlib
JSON-RPC can only use positive integers. Generated using JsonRpcClient::GenerateId
. Definition at line 19 of file JsonRpcClient.h.
Return value of the server-side JSON-RPC method handler.
JSONSERVER_OK
. Definition at line 23 of file JsonRpcServerExec.h.
nn::nlib::msgpack::jsonrpc::AddJsonRpcServerMethod | ( | const char * | method, |
JsonRpcServerFunc | func | ||
) |
Sets the JSON-RPC method handler.
[in] | method | Method name. |
[in] | func | JSON-RPC method handler. |
0 | Success. |
EINVAL | method or func is NULL . |
ENOMEM | memory allocation failed. |
nn::nlib::msgpack::jsonrpc::GetJsonRpcServerMethod | ( | const char * | method | ) |
Gets the method handler of the JSON-RPC registered by specifying the method name.
[in] | method | Method name. |
nn::nlib::msgpack::jsonrpc::JsonRpcServerExec | ( | const void * | p, |
size_t | n, | ||
ReallocOutputStream::UniquePtrType * | ptr | ||
) |
Creates the JSON-RPC response byte string by processing the JSON-RPC request.
[in] | p | Pointer to the JSON-RPC request byte string. |
[in] | n | Size of the JSON-RPC request byte string. |
[out] | ptr | Pointer to the JSON-RPC response byte string. |
msgpack
response to msgpack
requests. © 2013, 2014, 2015 Nintendo Co., Ltd. All rights reserved.