51 const msgpack::object&
object) {
53 const auto val =
object.as<std::uint64_t>();
63 "Invalid message type in a message.");
65 }
catch (
const msgpack::type_error&) {
67 StatusCode::INVALID_MESSAGE,
"Invalid message type in a message.");
78 const msgpack::object&
object) {
81 }
catch (
const msgpack::type_error&) {
83 StatusCode::INVALID_MESSAGE,
"Invalid message ID in a message.");
94 const msgpack::object&
object) {
97 }
catch (
const msgpack::type_error&) {
99 StatusCode::INVALID_MESSAGE,
"Invalid method name in a message.");
110 msgpack::object_handle
object) {
111 constexpr std::uint32_t num_elements_in_root_array = 4;
112 if (object->via.array.size != num_elements_in_root_array) {
114 "Invalid size of the array of a message.");
117 const auto message_id =
122 return ParsedRequest(message_id, method_name, std::move(parameters));
132 msgpack::object_handle
object) {
133 constexpr std::uint32_t num_elements_in_root_array = 4;
134 if (object->via.array.size != num_elements_in_root_array) {
136 "Invalid size of the array of a message.");
139 const auto message_id =
141 const bool has_error = !(
object->via.array.ptr[2].is_nil());
145 object->via.array.ptr[2], std::move(
object.zone())));
149 object->via.array.ptr[3], std::move(
object.zone())));
159 msgpack::object_handle
object) {
160 constexpr std::uint32_t num_elements_in_root_array = 3;
161 if (object->via.array.size != num_elements_in_root_array) {
163 "Invalid size of the array of a message.");
179 msgpack::object_handle
object) {
180 if (object->type != msgpack::type::ARRAY) {
182 StatusCode::INVALID_MESSAGE,
"Invalid type of a message.");
184 constexpr std::uint32_t min_elements_in_root_array = 3;
185 if (object->via.array.size < min_elements_in_root_array) {
187 "Invalid size of the array of a message.");
190 const auto message_type =
192 switch (message_type) {
Definition of CallResult class.
Class of exceptions in cpp-msgpack-rpc library.
static CallResult create_error(msgpack::object object, std::shared_ptr< msgpack::zone > zone)
Create an error result.
static CallResult create_result(msgpack::object object, std::shared_ptr< msgpack::zone > zone)
Create an successful result.
Class of parsed notification.
Class of parsed parameters.
Class of parsed requests.
Class of parsed responses.
Definition of MessageID type.
Definition of MessageType enumeration.
Definition of MethodNameView class.
Definition of MsgpackRPCException class.
Namespace of internal implementations.
MessageID parse_message_id_from_object(const msgpack::object &object)
Parse a message ID from an object in msgpack library.
MethodNameView parse_method_name_from_object(const msgpack::object &object)
Parse a method name from an object in msgpack library.
ParsedNotification parse_notification_from_object(msgpack::object_handle object)
Parse a notification from an object in msgpack library.
ParsedMessage parse_message_from_object(msgpack::object_handle object)
Parse a message from an object in msgpack library.
ParsedResponse parse_response_from_object(msgpack::object_handle object)
Parse a response from an object in msgpack library.
MessageType parse_message_type_from_object(const msgpack::object &object)
Parse a message type from an object in msgpack library.
ParsedRequest parse_request_from_object(msgpack::object_handle object)
Parse a request from an object in msgpack library.
std::variant< ParsedRequest, ParsedResponse, ParsedNotification > ParsedMessage
Type of parsed messages.
MessageType
Enumeration of message types.
@ NOTIFICATION
Notification.
std::uint32_t MessageID
Type of message IDs.
Definition of ParsedMessage type.
Definition of ParsedNotification class.
Definition of ParsedParameters class.
Definition of ParsedRequest class.
Definition of ParsedResponse class.
Definition of StatusCode enumeration.