Class that writes the JSON-RPC response byte string.
More...
#include "nn/nlib/msgpack/jsonrpc/JsonRpcResponse.h"
Class that writes the JSON-RPC response byte string.
- Description
- This class is used on the server side of JSON-RPC.
The send process after converting to a byte string must be written by the user.
Not required when using JsonRpcServerExec
for server processing. It is used within JsonRpcServerExec
.
Definition at line 78 of file JsonRpcResponse.h.
§ JsonRpcResponseWriter()
nn::nlib::msgpack::jsonrpc::JsonRpcResponseWriter::JsonRpcResponseWriter |
( |
bool |
msgpack | ) |
|
|
inlineexplicitnoexcept |
Creates a msgpack
byte string when true
is specified as the argument.
- Parameters
-
[in] | msgpack | Set to true if creating a msgpack byte string. |
Definition at line 82 of file JsonRpcResponse.h.
§ BeginWriteResponse()
nn::nlib::msgpack::jsonrpc::JsonRpcResponseWriter::BeginWriteResponse |
( |
uint32_t |
n | ) |
|
|
noexcept |
Called once before writing the JSON-RPC response.
- Parameters
-
[in] | n | Number of responses (n >= 2 for responses to a batch request). |
- Return values
-
0 | Success. |
ENOMEM | memory allocation failed. |
§ EndWriteResponse()
Finishes writing the JSON-RPC response.
- Parameters
-
[out] | ptr | Pointer to the byte string. |
[out] | n | Pointer where the byte count of the data is written to. |
- Return values
-
0 | Success. |
EINVAL | ptr or n is NULL . |
ERANGE | The response count does not match the number specified in BeginWriteRequest . |
ENOMEM | memory allocation failed. |
- Description
- When successful, n byte data is set to the ptr parameter. The server side process is completed by sending this data to the client.
§ WriteResponse()
nn::nlib::msgpack::jsonrpc::JsonRpcResponseWriter::WriteResponse |
( |
JsonRpcResponse * |
result | ) |
|
|
noexcept |
Writes the JSON-RPC response.
- Parameters
-
- Return values
-
0 | Success. |
EINVAL | Indicates that result is NULL . |
ERANGE | The request count is larger than the number specified in BeginWriteRequest . |
ENOMEM | memory allocation failed. |
An | error occurred. Another JSON/msgpack write operation failed. |
- Description
- In some cases the object that result points to is altered.
The documentation for this class was generated from the following files: