3 #ifndef INCLUDE_NN_NLIB_MSGPACK_JSONRPC_JSONRPCREQUEST_H_
4 #define INCLUDE_NN_NLIB_MSGPACK_JSONRPC_JSONRPCREQUEST_H_
9 #include "nn/nlib/Swap.h"
17 #if defined(_MSC_VER) && defined(nx_msgpack_EXPORTS)
18 #undef NLIB_VIS_PUBLIC
19 #define NLIB_VIS_PUBLIC NLIB_WINEXPORT
27 class JsonRpcErrorRequestTest;
37 reqid_t
GetId()
const {
return m_Id; }
38 const char*
GetMethod()
const {
return m_Method.get(); }
42 void SetId(reqid_t
id) { m_Id = id; }
60 JsonRpcResponse m_Response;
64 friend class JsonRpcRequestReader;
65 friend class fortest::JsonRpcErrorRequestTest;
73 : m_IsMsgpack(use_msgpack), m_Cur(0), m_Count(0) {}
77 return WriteRequest(method, 0, params);
101 static errno_t ReadRequest(
const void* p,
size_t n, ListType* request_list);
105 ListType* request_list);
107 ListType* request_list);
117 #if defined(_MSC_VER) && defined(nx_msgpack_EXPORTS)
118 #undef NLIB_VIS_PUBLIC
119 #define NLIB_VIS_PUBLIC NLIB_WINIMPORT
122 #endif // INCLUDE_NN_NLIB_MSGPACK_JSONRPC_JSONRPCREQUEST_H_
Class for representing the JSON-RPC response.
#define NLIB_FINAL
Defines final if it is available for use. If not, holds an empty string.
#define NLIB_DISALLOW_COPY_AND_ASSIGN(TypeName)
Prohibits use of the copy constructor and assignment operator for the class specified by TypeName...
Class to serialize and write the JSON-RPC request to memory.
The class for output streams written to memory expanded using nlib_realloc or another realloc functio...
Defines that class that is corresponding to std::unique_ptr.
Object created when MessagePack or JSON is read.
reqid_t GetId() const
Get the id of the request. If 0, the request is a notification.
const char * GetMethod() const
Gets the method name of the request.
void swap(MpObject &rhs) noexcept
Swaps the content of the object.
Class that reads the JSON-RPC request.
Class for representing a JSON-RPC request.
void MoveParamsFrom(MpObject ¶ms)
Sets the JSON-RPC parameters.
Object created when MessagePack, JSON, or CSV is read.
errno_t WriteNotification(const char *method, const MpObject ¶ms)
Writes the JSON-RPC notification.
JsonRpcRequestWriter(bool use_msgpack)
Sets the use of msgpack instead of JSON as the JSON description method.
Nlist< JsonRpcRequest > ListType
Type used to store the JSON-RPC request sequence restored from the byte string.
A file that contains the configuration information for each development environment.
const MpObject & GetParams() const
Gets the parameter of the request.
uint32_t reqid_t
id type for the JSON-RPC request.
A container-like class similar to std::vector that can store objects that do not have copy constructo...
Wraps functions like strlen and strcpy so they can be safely used.
MpObject & GetParams()
Gets the parameter of the request.
Quickly accesses MessagePack expanded in memory.
JsonRpcRequestWriter()
Instantiates the object with default parameters (default constructor).
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.
errno_t WriteRequest(const JsonRpcRequest &req)
Writes the JSON-RPC request.
void SetId(reqid_t id)
Sets the request ID.
Defines the class for reading MessagePack at high speed.
JsonRpcRequest()
Instantiates the object with default parameters (default constructor).