Correct two/four byte integer properties' types.

Reviewers: ivica

Reviewed By: ivica

Subscribers: korina

Differential Revision: https://repo.mireo.local/D27901
This commit is contained in:
Bruno Iljazovic
2024-02-14 13:06:43 +01:00
parent cfa2b76176
commit cbe477a701
14 changed files with 57 additions and 62 deletions

View File

@ -7,11 +7,11 @@ This section lists all possible __CONNACK__ Properties and describes their usage
[table:connack_props CONNACK properties [table:connack_props CONNACK properties
[[Identifier] [Value type] [Description]] [[Identifier] [Value type] [Description]]
[[session_expiry_interval] [`int32_t`] [Represents the Session Expiry Internal in seconds.]] [[session_expiry_interval] [`uint32_t`] [Represents the Session Expiry Internal in seconds.]]
[[receive_maximum] [`int16_t`] [The maximum number of QoS 1 and QoS 2 publications that the Server is willing to process concurrently.]] [[receive_maximum] [`uint16_t`] [The maximum number of QoS 1 and QoS 2 publications that the Server is willing to process concurrently.]]
[[maximum_qos] [`uint8_t`] [The highest QoS the Server supports.]] [[maximum_qos] [`uint8_t`] [The highest QoS the Server supports.]]
[[retain_available] [`uint8_t`] [A value of 0 means that retained message are not supported. A value of 1 means they are supported.]] [[retain_available] [`uint8_t`] [A value of 0 means that retained message are not supported. A value of 1 means they are supported.]]
[[maximum_packet_size] [`int32_t`] [The maximum __PACKET_SIZE__ in bytes as defined by the specification that the Server is willing to accept.]] [[maximum_packet_size] [`uint32_t`] [The maximum __PACKET_SIZE__ in bytes as defined by the specification that the Server is willing to accept.]]
[[assigned_client_identifier] [`std::string`] [The Client Identifier which was assigned by the Server because a zero length Client Identifier was found in the __CONNECT__ packet]] [[assigned_client_identifier] [`std::string`] [The Client Identifier which was assigned by the Server because a zero length Client Identifier was found in the __CONNECT__ packet]]
[[topic_alias_maximum] [`uint16_t`] [The highest value that the Server will accept as a Topic Alias sent by the Client.]] [[topic_alias_maximum] [`uint16_t`] [The highest value that the Server will accept as a Topic Alias sent by the Client.]]
[[reason_string] [`std::string`] [A UTF-8 Encoded String representing the reason associated with this response.]] [[reason_string] [`std::string`] [A UTF-8 Encoded String representing the reason associated with this response.]]
@ -23,7 +23,7 @@ This section lists all possible __CONNACK__ Properties and describes their usage
A value of 1 means they are supported. If not present, they are supported.]] A value of 1 means they are supported. If not present, they are supported.]]
[[shared_subscription_available] [`uint8_t`] [A value of 0 means that Shared Subscriptions are not supported. [[shared_subscription_available] [`uint8_t`] [A value of 0 means that Shared Subscriptions are not supported.
A value of 1 means they are supported. If not present, they are supported.]] A value of 1 means they are supported. If not present, they are supported.]]
[[server_keep_alive] [`int16_t`] [The Keep Alive time assigned by the Server.]] [[server_keep_alive] [`uint16_t`] [The Keep Alive time assigned by the Server.]]
[[response_information] [`std::string`] [A UTF-8 Encoded String which is used as the basis for creating a Response Topic.]] [[response_information] [`std::string`] [A UTF-8 Encoded String which is used as the basis for creating a Response Topic.]]
[[server_reference] [`std::string`] [A UTF-8 Encoded String which can be used by the Client to identfy another Server to use.]] [[server_reference] [`std::string`] [A UTF-8 Encoded String which can be used by the Client to identfy another Server to use.]]
[[authentication_method] [`std::string`] [A UTF-8 Encoded String containing the name of the authentication method used for extended authentication.]] [[authentication_method] [`std::string`] [A UTF-8 Encoded String containing the name of the authentication method used for extended authentication.]]

View File

@ -7,9 +7,9 @@ This section lists all possible __CONNECT__ Properties and describes their usage
[table:connect_props CONNECT properties [table:connect_props CONNECT properties
[[Identifier] [Value type] [Description]] [[Identifier] [Value type] [Description]]
[[session_expiry_interval] [`int32_t`] [Represents the Session Expiry Internal in seconds.]] [[session_expiry_interval] [`uint32_t`] [Represents the Session Expiry Internal in seconds.]]
[[receive_maximum] [`int16_t`] [The maximum number of QoS 1 and QoS 2 publications that the Client is willing to process concurrently.]] [[receive_maximum] [`uint16_t`] [The maximum number of QoS 1 and QoS 2 publications that the Client is willing to process concurrently.]]
[[maximum_packet_size] [`int32_t`] [The maximum __PACKET_SIZE__ in bytes as defined by the specification that the Client is willing to process.]] [[maximum_packet_size] [`uint32_t`] [The maximum __PACKET_SIZE__ in bytes as defined by the specification that the Client is willing to process.]]
[[topic_alias_maximum] [`uint16_t`] [The highest value that the Client will accept as a Topic Alias sent by the Server.]] [[topic_alias_maximum] [`uint16_t`] [The highest value that the Client will accept as a Topic Alias sent by the Server.]]
[[request_response_information] [`uint8_t`] [The value of 0 signals that the Server MUST NOT return Response Information in __CONNACK__. If the value if 1, it MAY return it.]] [[request_response_information] [`uint8_t`] [The value of 0 signals that the Server MUST NOT return Response Information in __CONNACK__. If the value if 1, it MAY return it.]]
[[request_problem_information] [`uint8_t`] [The value of 0 signals that the Server MAY return a Reason String or User Properties on a __CONNACK__ or __DISCONNECT__ packet, [[request_problem_information] [`uint8_t`] [The value of 0 signals that the Server MAY return a Reason String or User Properties on a __CONNACK__ or __DISCONNECT__ packet,
@ -33,7 +33,7 @@ The following example shows how to set a Property value:
[!c++] [!c++]
async_mqtt5::connect_props props; async_mqtt5::connect_props props;
props[async_mqtt5::prop::session_expiry_interval] = 1200; props[async_mqtt5::prop::session_expiry_interval] = 1200;
props[async_mqtt5::prop::receive_maximum] = int16_t(100); props[async_mqtt5::prop::receive_maximum] = uint16_t(100);
The following example shows how to retrieve a Property value: The following example shows how to retrieve a Property value:

View File

@ -7,7 +7,7 @@ This section lists all possible __DISCONNECT__ Properties and describes their us
[table:disconnect_props DISCONNECT properties [table:disconnect_props DISCONNECT properties
[[Identifier] [Value type] [Description]] [[Identifier] [Value type] [Description]]
[[session_expiry_interval] [`int32_t`] [Represents the Session Expiry Internal in seconds. Can only be sent by the Client.]] [[session_expiry_interval] [`uint32_t`] [Represents the Session Expiry Internal in seconds. Can only be sent by the Client.]]
[[reason_string] [`std::string`] [A UTF-8 Encoded String representing the reason associated with this response.]] [[reason_string] [`std::string`] [A UTF-8 Encoded String representing the reason associated with this response.]]
[[user_property] [`std::vector<std::string>`] [A list of name, value pairs (__UTF8_STRING_PAIR__) defining User Properties. [[user_property] [`std::vector<std::string>`] [A list of name, value pairs (__UTF8_STRING_PAIR__) defining User Properties.
This property may be used to provide additional diagnostic or other information. ]] This property may be used to provide additional diagnostic or other information. ]]

View File

@ -8,13 +8,13 @@ This section lists all possible __PUBLISH__ Properties and describes their usage
[table:publish_props PUBLISH properties [table:publish_props PUBLISH properties
[[Identifier] [Value type] [Description]] [[Identifier] [Value type] [Description]]
[[payload_format_indicator] [`uint8_t`] [Value of 0 indicates that the Payload is in unspecified bytes. Value of 1 indicates that the Payload is UTF-8 Encoded Character Data.]] [[payload_format_indicator] [`uint8_t`] [Value of 0 indicates that the Payload is in unspecified bytes. Value of 1 indicates that the Payload is UTF-8 Encoded Character Data.]]
[[message_expiry_interval] [`int32_t`] [The lifetime of the Application Message in seconds.]] [[message_expiry_interval] [`uint32_t`] [The lifetime of the Application Message in seconds.]]
[[topic_alias] [`int16_t`] [Two Byte integer representing the Topic Alias, an integer value that is used to identify the Topic instead of using the Topic Name.]] [[topic_alias] [`uint16_t`] [Two Byte integer representing the Topic Alias, an integer value that is used to identify the Topic instead of using the Topic Name.]]
[[response_topic] [`std::string`] [A UTF-8 Encoded String which is used as the Topic Name for a response message.]] [[response_topic] [`std::string`] [A UTF-8 Encoded String which is used as the Topic Name for a response message.]]
[[correlation_data] [`std::string`] [Binary Data used by the sender of the Request Message to identify which request the Response Message is for when it is received.]] [[correlation_data] [`std::string`] [Binary Data used by the sender of the Request Message to identify which request the Response Message is for when it is received.]]
[[user_property] [`std::vector<std::string>`] [A list of name, value pairs (__UTF8_STRING_PAIR__) defining User Properties. [[user_property] [`std::vector<std::string>`] [A list of name, value pairs (__UTF8_STRING_PAIR__) defining User Properties.
The meaning of these properties is not defined by the specification.]] The meaning of these properties is not defined by the specification.]]
[[subscription_identifier] [`uint32_t`] [Identifier of the Subscription in range of 1 to 268,435,455.]] [[subscription_identifier] [`int32_t`] [Identifier of the Subscription in range of 1 to 268,435,455.]]
[[content_type] [`std::string`] [A UTF-8 Encoded String describing the content of the Application Message.]] [[content_type] [`std::string`] [A UTF-8 Encoded String describing the content of the Application Message.]]
] ]
@ -39,7 +39,7 @@ The following example shows how to retrieve a Property value:
except for `async_mqtt5::prop::user_property`, where it will return an instance of its value type, `std::vector<std::string>`.] except for `async_mqtt5::prop::user_property`, where it will return an instance of its value type, `std::vector<std::string>`.]
[!c++] [!c++]
std::optional<int16_t> topic_alias = props[async_mqtt5::prop::topic_alias]; std::optional<uint16_t> topic_alias = props[async_mqtt5::prop::topic_alias];
if (topic_alias.has_value()) if (topic_alias.has_value())
// topic alias property was previously set // topic alias property was previously set
else else

View File

@ -7,7 +7,7 @@ This section lists all possible __SUBSCRIBE__ Properties and describes their usa
[table:subscribe_props SUBSCRIBE properties [table:subscribe_props SUBSCRIBE properties
[[Identifier] [Value type] [Description]] [[Identifier] [Value type] [Description]]
[[subscription_identifier] [`uint32_t`] [Identifier of the Subscription in range of 1 to 268,435,455.]] [[subscription_identifier] [`int32_t`] [Identifier of the Subscription in range of 1 to 268,435,455.]]
[[user_property] [`std::vector<std::string>`] [A list of name, value pairs (__UTF8_STRING_PAIR__) defining User Properties. [[user_property] [`std::vector<std::string>`] [A list of name, value pairs (__UTF8_STRING_PAIR__) defining User Properties.
This property can be used to send subscription related properties from the Client to the Server. This property can be used to send subscription related properties from the Client to the Server.
The meaning of these properties is not defined by the specification ]] The meaning of these properties is not defined by the specification ]]
@ -24,7 +24,7 @@ The following example shows how to set a Property value:
[!c++] [!c++]
async_mqtt5::subscribe_props props; async_mqtt5::subscribe_props props;
props[async_mqtt5::prop::subscription_identifier] = 1234u; props[async_mqtt5::prop::subscription_identifier] = 1234;
The following example shows how to retrieve a Property value: The following example shows how to retrieve a Property value:
@ -32,7 +32,7 @@ The following example shows how to retrieve a Property value:
except for `async_mqtt5::prop::user_property`, where it will return an instance of its value type, `std::vector<std::string>`.] except for `async_mqtt5::prop::user_property`, where it will return an instance of its value type, `std::vector<std::string>`.]
[!c++] [!c++]
std::optional<uint32_t> sub_id = props[async_mqtt5::prop::subscription_identifier]; std::optional<int32_t> sub_id = props[async_mqtt5::prop::subscription_identifier];
if (sub_id.has_value()) if (sub_id.has_value())
// subscription identifier property was previously set // subscription identifier property was previously set
else else

View File

@ -8,9 +8,9 @@ This section lists all possible [reflink2 will Will] Properties and describes th
[table:will_props Will properties [table:will_props Will properties
[[Identifier] [Value type] [Description]] [[Identifier] [Value type] [Description]]
[[will_delay_interval] [`int32_t`] [The delay in seconds that need to pass before Server publishes the Client's Will Message.]] [[will_delay_interval] [`uint32_t`] [The delay in seconds that need to pass before Server publishes the Client's Will Message.]]
[[payload_format_indicator] [`uint8_t`] [Value of 0 indicates that the Will Message is in unspecified bytes. Value of 1 indicates that the Will Message is UTF-8 Encoded Character Data.]] [[payload_format_indicator] [`uint8_t`] [Value of 0 indicates that the Will Message is in unspecified bytes. Value of 1 indicates that the Will Message is UTF-8 Encoded Character Data.]]
[[message_expiry_interval] [`int32_t`] [The lifetime of the Will Message in seconds. It is send as Publication Expiry Interval when it is published.]] [[message_expiry_interval] [`uint32_t`] [The lifetime of the Will Message in seconds. It is send as Publication Expiry Interval when it is published.]]
[[content_type] [`std::string`] [A UTF-8 Encoded String describing the content of the Will Message.]] [[content_type] [`std::string`] [A UTF-8 Encoded String describing the content of the Will Message.]]
[[response_topic] [`std::string`] [A UTF-8 Encoded String which is used as the Topic Name for a response message.]] [[response_topic] [`std::string`] [A UTF-8 Encoded String which is used as the Topic Name for a response message.]]
[[correlation_data] [`std::string`] [Binary Data used by the sender of the Request Message to identify which request the Response Message is for when it is received.]] [[correlation_data] [`std::string`] [Binary Data used by the sender of the Request Message to identify which request the Response Message is for when it is received.]]

View File

@ -210,7 +210,7 @@ struct verbatim_parser : x3::parser<verbatim_parser> {
constexpr auto verbatim_ = verbatim_parser{}; constexpr auto verbatim_ = verbatim_parser{};
struct varint_parser : x3::parser<varint_parser> { struct varint_parser : x3::parser<varint_parser> {
using attribute_type = uint32_t; using attribute_type = int32_t;
static bool const has_attribute = true; static bool const has_attribute = true;
template <typename It, typename Ctx, typename RCtx, typename Attr> template <typename It, typename Ctx, typename RCtx, typename Attr>
@ -225,7 +225,7 @@ struct varint_parser : x3::parser<varint_parser> {
if (iter == last) if (iter == last)
return false; return false;
uint32_t result = 0; unsigned bit_shift = 0; int32_t result = 0; unsigned bit_shift = 0;
for (; iter != last && bit_shift < sizeof(int32_t) * 7; ++iter) { for (; iter != last && bit_shift < sizeof(int32_t) * 7; ++iter) {
auto val = *iter; auto val = *iter;
@ -361,11 +361,6 @@ bool parse_to_prop(
rv = x3::byte_.parse(iter, last, ctx, rctx, attr); rv = x3::byte_.parse(iter, last, ctx, rctx, attr);
prop = attr; prop = attr;
} }
if constexpr (std::is_same_v<value_type, int16_t>) {
int16_t attr;
rv = x3::big_word.parse(iter, last, ctx, rctx, attr);
prop = attr;
}
if constexpr (std::is_same_v<value_type, uint16_t>) { if constexpr (std::is_same_v<value_type, uint16_t>) {
uint16_t attr; uint16_t attr;
rv = x3::big_word.parse(iter, last, ctx, rctx, attr); rv = x3::big_word.parse(iter, last, ctx, rctx, attr);
@ -373,12 +368,12 @@ bool parse_to_prop(
} }
if constexpr (std::is_same_v<value_type, int32_t>) { if constexpr (std::is_same_v<value_type, int32_t>) {
int32_t attr; int32_t attr;
rv = x3::big_dword.parse(iter, last, ctx, rctx, attr); rv = basic::varint_.parse(iter, last, ctx, rctx, attr);
prop = attr; prop = attr;
} }
if constexpr (std::is_same_v<value_type, uint32_t>) { if constexpr (std::is_same_v<value_type, uint32_t>) {
uint32_t attr; uint32_t attr;
rv = basic::varint_.parse(iter, last, ctx, rctx, attr); rv = x3::big_dword.parse(iter, last, ctx, rctx, attr);
prop = attr; prop = attr;
} }
if constexpr (std::is_same_v<value_type, std::string>) { if constexpr (std::is_same_v<value_type, std::string>) {
@ -420,7 +415,7 @@ public:
if (iter == last) if (iter == last)
return true; return true;
uint32_t props_length; int32_t props_length;
if (!basic::varint_.parse(iter, last, ctx, rctx, props_length)) if (!basic::varint_.parse(iter, last, ctx, rctx, props_length))
return false; return false;

View File

@ -366,29 +366,29 @@ struct prop_encoder_type {
using encoder_types = std::tuple< using encoder_types = std::tuple<
prop_encoder_type<pp::shared_subscription_available_t, basic::int_def<uint8_t>>, prop_encoder_type<pp::shared_subscription_available_t, basic::int_def<uint8_t>>,
prop_encoder_type<pp::payload_format_indicator_t, basic::int_def<uint8_t>>, prop_encoder_type<pp::payload_format_indicator_t, basic::int_def<uint8_t>>,
prop_encoder_type<pp::message_expiry_interval_t, basic::int_def<int32_t>>, prop_encoder_type<pp::message_expiry_interval_t, basic::int_def<uint32_t>>,
prop_encoder_type<pp::content_type_t, basic::utf8_def>, prop_encoder_type<pp::content_type_t, basic::utf8_def>,
prop_encoder_type<pp::response_topic_t, basic::utf8_def>, prop_encoder_type<pp::response_topic_t, basic::utf8_def>,
prop_encoder_type<pp::correlation_data_t, basic::utf8_def>, prop_encoder_type<pp::correlation_data_t, basic::utf8_def>,
prop_encoder_type<pp::subscription_identifier_t, basic::int_def<basic::varint_t>>, prop_encoder_type<pp::subscription_identifier_t, basic::int_def<basic::varint_t>>,
prop_encoder_type<pp::session_expiry_interval_t, basic::int_def<int32_t>>, prop_encoder_type<pp::session_expiry_interval_t, basic::int_def<uint32_t>>,
prop_encoder_type<pp::assigned_client_identifier_t, basic::utf8_def>, prop_encoder_type<pp::assigned_client_identifier_t, basic::utf8_def>,
prop_encoder_type<pp::server_keep_alive_t, basic::int_def<int16_t>>, prop_encoder_type<pp::server_keep_alive_t, basic::int_def<uint16_t>>,
prop_encoder_type<pp::authentication_method_t, basic::utf8_def>, prop_encoder_type<pp::authentication_method_t, basic::utf8_def>,
prop_encoder_type<pp::authentication_data_t, basic::utf8_def>, prop_encoder_type<pp::authentication_data_t, basic::utf8_def>,
prop_encoder_type<pp::request_problem_information_t, basic::int_def<uint8_t>>, prop_encoder_type<pp::request_problem_information_t, basic::int_def<uint8_t>>,
prop_encoder_type<pp::will_delay_interval_t, basic::int_def<int32_t>>, prop_encoder_type<pp::will_delay_interval_t, basic::int_def<uint32_t>>,
prop_encoder_type<pp::request_response_information_t, basic::int_def<uint8_t>>, prop_encoder_type<pp::request_response_information_t, basic::int_def<uint8_t>>,
prop_encoder_type<pp::response_information_t, basic::utf8_def>, prop_encoder_type<pp::response_information_t, basic::utf8_def>,
prop_encoder_type<pp::server_reference_t, basic::utf8_def>, prop_encoder_type<pp::server_reference_t, basic::utf8_def>,
prop_encoder_type<pp::reason_string_t, basic::utf8_def>, prop_encoder_type<pp::reason_string_t, basic::utf8_def>,
prop_encoder_type<pp::receive_maximum_t, basic::int_def<int16_t>>, prop_encoder_type<pp::receive_maximum_t, basic::int_def<uint16_t>>,
prop_encoder_type<pp::topic_alias_maximum_t, basic::int_def<int16_t>>, prop_encoder_type<pp::topic_alias_maximum_t, basic::int_def<uint16_t>>,
prop_encoder_type<pp::topic_alias_t, basic::int_def<int16_t>>, prop_encoder_type<pp::topic_alias_t, basic::int_def<uint16_t>>,
prop_encoder_type<pp::maximum_qos_t, basic::int_def<uint8_t>>, prop_encoder_type<pp::maximum_qos_t, basic::int_def<uint8_t>>,
prop_encoder_type<pp::retain_available_t, basic::int_def<uint8_t>>, prop_encoder_type<pp::retain_available_t, basic::int_def<uint8_t>>,
prop_encoder_type<pp::user_property_t, basic::utf8_def>, prop_encoder_type<pp::user_property_t, basic::utf8_def>,
prop_encoder_type<pp::maximum_packet_size_t, basic::int_def<int32_t>>, prop_encoder_type<pp::maximum_packet_size_t, basic::int_def<uint32_t>>,
prop_encoder_type<pp::wildcard_subscription_available_t, basic::int_def<uint8_t>>, prop_encoder_type<pp::wildcard_subscription_available_t, basic::int_def<uint8_t>>,
prop_encoder_type<pp::subscription_identifier_available_t, basic::int_def<uint8_t>> prop_encoder_type<pp::subscription_identifier_available_t, basic::int_def<uint8_t>>
>; >;

View File

@ -51,29 +51,29 @@ struct property_traits<Pname##_t> { \
constexpr std::integral_constant<property_type, Pname##_t> Pname {}; constexpr std::integral_constant<property_type, Pname##_t> Pname {};
DEF_PROPERTY_TRAIT(payload_format_indicator, std::optional<uint8_t>); DEF_PROPERTY_TRAIT(payload_format_indicator, std::optional<uint8_t>);
DEF_PROPERTY_TRAIT(message_expiry_interval, std::optional<int32_t>); DEF_PROPERTY_TRAIT(message_expiry_interval, std::optional<uint32_t>);
DEF_PROPERTY_TRAIT(content_type, std::optional<std::string>); DEF_PROPERTY_TRAIT(content_type, std::optional<std::string>);
DEF_PROPERTY_TRAIT(response_topic, std::optional<std::string>); DEF_PROPERTY_TRAIT(response_topic, std::optional<std::string>);
DEF_PROPERTY_TRAIT(correlation_data, std::optional<std::string>); DEF_PROPERTY_TRAIT(correlation_data, std::optional<std::string>);
DEF_PROPERTY_TRAIT(subscription_identifier, std::optional<uint32_t>); DEF_PROPERTY_TRAIT(subscription_identifier, std::optional<int32_t>);
DEF_PROPERTY_TRAIT(session_expiry_interval, std::optional<int32_t>); DEF_PROPERTY_TRAIT(session_expiry_interval, std::optional<uint32_t>);
DEF_PROPERTY_TRAIT(assigned_client_identifier, std::optional<std::string>); DEF_PROPERTY_TRAIT(assigned_client_identifier, std::optional<std::string>);
DEF_PROPERTY_TRAIT(server_keep_alive, std::optional<int16_t>); DEF_PROPERTY_TRAIT(server_keep_alive, std::optional<uint16_t>);
DEF_PROPERTY_TRAIT(authentication_method, std::optional<std::string>); DEF_PROPERTY_TRAIT(authentication_method, std::optional<std::string>);
DEF_PROPERTY_TRAIT(authentication_data, std::optional<std::string>); DEF_PROPERTY_TRAIT(authentication_data, std::optional<std::string>);
DEF_PROPERTY_TRAIT(request_problem_information, std::optional<uint8_t>); DEF_PROPERTY_TRAIT(request_problem_information, std::optional<uint8_t>);
DEF_PROPERTY_TRAIT(will_delay_interval, std::optional<int32_t>); DEF_PROPERTY_TRAIT(will_delay_interval, std::optional<uint32_t>);
DEF_PROPERTY_TRAIT(request_response_information, std::optional<uint8_t>); DEF_PROPERTY_TRAIT(request_response_information, std::optional<uint8_t>);
DEF_PROPERTY_TRAIT(response_information, std::optional<std::string>); DEF_PROPERTY_TRAIT(response_information, std::optional<std::string>);
DEF_PROPERTY_TRAIT(server_reference, std::optional<std::string>); DEF_PROPERTY_TRAIT(server_reference, std::optional<std::string>);
DEF_PROPERTY_TRAIT(reason_string, std::optional<std::string>); DEF_PROPERTY_TRAIT(reason_string, std::optional<std::string>);
DEF_PROPERTY_TRAIT(receive_maximum, std::optional<int16_t>); DEF_PROPERTY_TRAIT(receive_maximum, std::optional<uint16_t>);
DEF_PROPERTY_TRAIT(topic_alias_maximum, std::optional<uint16_t>); DEF_PROPERTY_TRAIT(topic_alias_maximum, std::optional<uint16_t>);
DEF_PROPERTY_TRAIT(topic_alias, std::optional<int16_t>); DEF_PROPERTY_TRAIT(topic_alias, std::optional<uint16_t>);
DEF_PROPERTY_TRAIT(maximum_qos, std::optional<uint8_t>); DEF_PROPERTY_TRAIT(maximum_qos, std::optional<uint8_t>);
DEF_PROPERTY_TRAIT(retain_available, std::optional<uint8_t>); DEF_PROPERTY_TRAIT(retain_available, std::optional<uint8_t>);
DEF_PROPERTY_TRAIT(user_property, std::vector<std::string>); DEF_PROPERTY_TRAIT(user_property, std::vector<std::string>);
DEF_PROPERTY_TRAIT(maximum_packet_size, std::optional<int32_t>); DEF_PROPERTY_TRAIT(maximum_packet_size, std::optional<uint32_t>);
DEF_PROPERTY_TRAIT(wildcard_subscription_available, std::optional<uint8_t>); DEF_PROPERTY_TRAIT(wildcard_subscription_available, std::optional<uint8_t>);
DEF_PROPERTY_TRAIT(subscription_identifier_available, std::optional<uint8_t>); DEF_PROPERTY_TRAIT(subscription_identifier_available, std::optional<uint8_t>);
DEF_PROPERTY_TRAIT(shared_subscription_available, std::optional<uint8_t>); DEF_PROPERTY_TRAIT(shared_subscription_available, std::optional<uint8_t>);

View File

@ -117,7 +117,7 @@ BOOST_FIXTURE_TEST_CASE(throttling, shared_test_data) {
int handlers_called = 0; int handlers_called = 0;
connack_props props; connack_props props;
props[prop::receive_maximum] = int16_t(1); props[prop::receive_maximum] = uint16_t(1);
//packets //packets
auto connack_rm = encoders::encode_connack( auto connack_rm = encoders::encode_connack(

View File

@ -110,7 +110,7 @@ BOOST_AUTO_TEST_CASE(client_functions) {
tcp_client.connect_properties(std::move(co_props)); tcp_client.connect_properties(std::move(co_props));
tcp_client.connect_property(prop::session_expiry_interval, 40); tcp_client.connect_property(prop::session_expiry_interval, 40);
tcp_client.connect_property(prop::receive_maximum, int16_t(10123)); tcp_client.connect_property(prop::receive_maximum, uint16_t(10123));
tcp_client.connect_property(prop::maximum_packet_size, 103); tcp_client.connect_property(prop::maximum_packet_size, 103);
tcp_client.connect_property(prop::topic_alias_maximum, uint16_t(12345)); tcp_client.connect_property(prop::topic_alias_maximum, uint16_t(12345));
tcp_client.connect_property(prop::request_response_information, uint8_t(1)); tcp_client.connect_property(prop::request_response_information, uint8_t(1));

View File

@ -20,9 +20,9 @@ BOOST_AUTO_TEST_CASE(test_connect) {
uint16_t keep_alive = 60; uint16_t keep_alive = 60;
bool clean_start = true; bool clean_start = true;
// connect properties // connect properties
int32_t session_expiry_interval = 29; uint32_t session_expiry_interval = 29;
int16_t receive_max = 100; uint16_t receive_max = 100;
int32_t maximum_packet_size = 20000; uint32_t maximum_packet_size = 20000;
uint16_t topic_alias_max = 1200; uint16_t topic_alias_max = 1200;
uint8_t request_response_information = 1; uint8_t request_response_information = 1;
uint8_t request_problem_information = 0; uint8_t request_problem_information = 0;
@ -34,9 +34,9 @@ BOOST_AUTO_TEST_CASE(test_connect) {
std::string will_topic = "will_topic"; std::string will_topic = "will_topic";
std::string will_message = "will_message"; std::string will_message = "will_message";
// will properties // will properties
int32_t will_delay_interval = 200; uint32_t will_delay_interval = 200;
uint8_t will_payload_format_indicator = 0; uint8_t will_payload_format_indicator = 0;
int32_t will_message_expiry_interval = 2000; uint32_t will_message_expiry_interval = 2000;
std::string_view will_content_type = "will content type"; std::string_view will_content_type = "will content type";
std::string_view will_response_topic = "response_topic"; std::string_view will_response_topic = "response_topic";
std::string_view will_correlation_data = "correlation data"; std::string_view will_correlation_data = "correlation data";
@ -124,11 +124,11 @@ BOOST_AUTO_TEST_CASE(test_connack) {
uint8_t session_present = 1; uint8_t session_present = 1;
uint8_t reason_code = reason_codes::server_busy.value(); uint8_t reason_code = reason_codes::server_busy.value();
int32_t session_expiry_interval = 20; uint32_t session_expiry_interval = 20;
int16_t receive_maximum = 2000; uint16_t receive_maximum = 2000;
uint8_t max_qos = 2; uint8_t max_qos = 2;
uint8_t retain_available = 0; uint8_t retain_available = 0;
int32_t maximum_packet_sz = 1024; uint32_t maximum_packet_sz = 1024;
std::string assigned_client_id = "client_id"; std::string assigned_client_id = "client_id";
uint16_t topic_alias_max = 128; uint16_t topic_alias_max = 128;
std::string reason_string = "some reason string"; std::string reason_string = "some reason string";
@ -137,7 +137,7 @@ BOOST_AUTO_TEST_CASE(test_connack) {
uint8_t wildcard_sub = 1; uint8_t wildcard_sub = 1;
uint8_t sub_id = 1; uint8_t sub_id = 1;
uint8_t shared_sub = 0; uint8_t shared_sub = 0;
int16_t server_keep_alive = 25; uint16_t server_keep_alive = 25;
std::string response_information = "info"; std::string response_information = "info";
std::string server_reference = "srv"; std::string server_reference = "srv";
std::string authentication_method = "method"; std::string authentication_method = "method";
@ -206,13 +206,13 @@ BOOST_AUTO_TEST_CASE(test_publish) {
std::string_view payload = "This is some payload I am publishing!"; std::string_view payload = "This is some payload I am publishing!";
uint8_t payload_format_indicator = 1; uint8_t payload_format_indicator = 1;
int32_t message_expiry_interval = 70; uint32_t message_expiry_interval = 70;
int16_t topic_alias = 16; uint16_t topic_alias = 16;
std::string response_topic = "topic/response"; std::string response_topic = "topic/response";
std::string correlation_data = "correlation data"; std::string correlation_data = "correlation data";
std::string publish_prop_1 = "key"; std::string publish_prop_1 = "key";
std::string publish_prop_2 = "val"; std::string publish_prop_2 = "val";
uint32_t subscription_identifier = 123456; int32_t subscription_identifier = 123456;
std::string content_type = "application/octet-stream"; std::string content_type = "application/octet-stream";
publish_props pprops; publish_props pprops;
@ -436,7 +436,7 @@ BOOST_AUTO_TEST_CASE(test_pubcomp) {
BOOST_AUTO_TEST_CASE(test_subscribe) { BOOST_AUTO_TEST_CASE(test_subscribe) {
//testing variables //testing variables
uint32_t sub_id = 1'234'567; int32_t sub_id = 1'234'567;
std::string user_property_1 = "SUBSCRIBE user prop"; std::string user_property_1 = "SUBSCRIBE user prop";
std::string user_property_2 = "SUBSCRIBE user prop val"; std::string user_property_2 = "SUBSCRIBE user prop val";
@ -601,7 +601,7 @@ BOOST_AUTO_TEST_CASE(test_disconnect) {
// testing variables // testing variables
uint8_t reason_code = 0x04; uint8_t reason_code = 0x04;
int32_t session_expiry_interval = 50; uint32_t session_expiry_interval = 50;
std::string reason_string = "a reason"; std::string reason_string = "a reason";
std::string user_property_1 = "DISCONNECT user prop"; std::string user_property_1 = "DISCONNECT user prop";
std::string user_property_2 = "DISCONNECT user prop val"; std::string user_property_2 = "DISCONNECT user prop val";

View File

@ -30,7 +30,7 @@ BOOST_AUTO_TEST_CASE(clear_waiting_on_pubrel) {
svc_ptr->open_stream(); svc_ptr->open_stream();
decoders::publish_message pub_msg = std::make_tuple( decoders::publish_message pub_msg = std::make_tuple(
"topic", int16_t(1), uint8_t(0b0100), publish_props {}, "payload" "topic", uint16_t(1), uint8_t(0b0100), publish_props {}, "payload"
); );
detail::publish_rec_op<client_service_type> { svc_ptr }.perform(pub_msg); detail::publish_rec_op<client_service_type> { svc_ptr }.perform(pub_msg);

View File

@ -164,7 +164,7 @@ BOOST_AUTO_TEST_CASE(large_subscription_id) {
cprops[prop::subscription_identifier_available] = uint8_t(1); cprops[prop::subscription_identifier_available] = uint8_t(1);
subscribe_props sprops; subscribe_props sprops;
sprops[prop::subscription_identifier] = std::numeric_limits<uint32_t>::max(); sprops[prop::subscription_identifier] = std::numeric_limits<int32_t>::max();
run_test(client::error::malformed_packet, "topic", sprops, cprops); run_test(client::error::malformed_packet, "topic", sprops, cprops);
} }