mirror of
https://github.com/boostorg/mqtt5.git
synced 2025-10-04 12:50:54 +02:00
Validate control packet size
Summary: resolves T13332 Reviewers: ivica Reviewed By: ivica Subscribers: miljen, iljazovic Maniphest Tasks: T13332 Differential Revision: https://repo.mireo.local/D27000
This commit is contained in:
@@ -24,6 +24,12 @@ namespace asio = boost::asio;
|
||||
* the stream of bytes between the Client and the Broker. The transport must be
|
||||
* ordered and lossless.
|
||||
* \tparam \__TlsContext\__ Type of the context object used in TLS/SSL connections.
|
||||
*
|
||||
* \par Thread safety
|
||||
* ['Distinct objects]: safe. \n
|
||||
* ['Shared objects]: unsafe. \n
|
||||
* This class is [*not thread-safe].
|
||||
* The application must also ensure that all asynchronous operations are performed within the same implicit or explicit strand.
|
||||
*/
|
||||
template <
|
||||
typename StreamType,
|
||||
@@ -174,30 +180,6 @@ public:
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Retrieves the value of a specific property from the last \__CONNACK\__ packet received.
|
||||
*
|
||||
* \details The return type varies according to the property requested.
|
||||
* For all properties, the return type will be `std::optional` of their respective value type.
|
||||
* For `async_mqtt5::prop::user_property`, the return type is `std::vector<std::string>`.
|
||||
*
|
||||
* \param prop The \__CONNACK\__ property value to retrieve.
|
||||
*
|
||||
* \par Example
|
||||
* \code
|
||||
* std::optional<std::string> auth_method = client.connection_property(async_mqtt5::prop::authentication_method); // ok
|
||||
* std::optional<std::string> c_type = client.connection_property(async_mqtt5::prop::content_type); // does not compile!
|
||||
* \endcode
|
||||
*
|
||||
* \see See \__CONNACK_PROPS\__ for all eligible properties.
|
||||
*/
|
||||
template <prop::property_type p>
|
||||
decltype(auto) connection_property(
|
||||
std::integral_constant<prop::property_type, p> prop
|
||||
) {
|
||||
return _svc_ptr->connack_prop(prop);
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Assign a \ref will Message.
|
||||
*
|
||||
@@ -302,6 +284,30 @@ public:
|
||||
detail::re_auth_op { _svc_ptr }.perform();
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Retrieves the value of a specific property from the last \__CONNACK\__ packet received.
|
||||
*
|
||||
* \details The return type varies according to the property requested.
|
||||
* For all properties, the return type will be `std::optional` of their respective value type.
|
||||
* For `async_mqtt5::prop::user_property`, the return type is `std::vector<std::string>`.
|
||||
*
|
||||
* \param prop The \__CONNACK\__ property value to retrieve.
|
||||
*
|
||||
* \par Example
|
||||
* \code
|
||||
* std::optional<std::string> auth_method = client.connection_property(async_mqtt5::prop::authentication_method); // ok
|
||||
* std::optional<std::string> c_type = client.connection_property(async_mqtt5::prop::content_type); // does not compile!
|
||||
* \endcode
|
||||
*
|
||||
* \see See \__CONNACK_PROPS\__ for all eligible properties.
|
||||
*/
|
||||
template <prop::property_type p>
|
||||
const auto& connection_property(
|
||||
std::integral_constant<prop::property_type, p> prop
|
||||
) const {
|
||||
return _svc_ptr->connack_prop(prop);
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Send a \__PUBLISH\__ packet to Broker to transport an
|
||||
* Application Message.
|
||||
@@ -362,6 +368,7 @@ public:
|
||||
* - `boost::asio::error::operation_aborted` \n
|
||||
* - `boost::asio::error::no_recovery` \n
|
||||
* - \link async_mqtt5::client::error::malformed_packet \endlink
|
||||
* - \link async_mqtt5::client::error::packet_too_large \endlink
|
||||
* - \link async_mqtt5::client::error::pid_overrun \endlink
|
||||
* - \link async_mqtt5::client::error::qos_not_supported \endlink
|
||||
* - \link async_mqtt5::client::error::retain_not_available \endlink
|
||||
@@ -438,6 +445,7 @@ public:
|
||||
* - `boost::asio::error::no_recovery` \n
|
||||
* - `boost::asio::error::operation_aborted` \n
|
||||
* - \link async_mqtt5::client::error::malformed_packet \endlink
|
||||
* - \link async_mqtt5::client::error::packet_too_large \endlink
|
||||
* - \link async_mqtt5::client::error::pid_overrun \endlink
|
||||
* - \link async_mqtt5::client::error::invalid_topic \endlink
|
||||
* - \link async_mqtt5::client::error::wildcard_subscription_not_available \endlink
|
||||
@@ -509,6 +517,7 @@ public:
|
||||
* - `boost::asio::error::no_recovery` \n
|
||||
* - `boost::asio::error::operation_aborted` \n
|
||||
* - \link async_mqtt5::client::error::malformed_packet \endlink
|
||||
* - \link async_mqtt5::client::error::packet_too_large \endlink
|
||||
* - \link async_mqtt5::client::error::pid_overrun \endlink
|
||||
* - \link async_mqtt5::client::error::invalid_topic \endlink
|
||||
* - \link async_mqtt5::client::error::wildcard_subscription_not_available \endlink
|
||||
@@ -568,6 +577,7 @@ public:
|
||||
* - `boost::asio::error::no_recovery` \n
|
||||
* - `boost::asio::error::operation_aborted` \n
|
||||
* - \link async_mqtt5::client::error::malformed_packet \endlink
|
||||
* - \link async_mqtt5::client::error::packet_too_large \endlink
|
||||
* - \link async_mqtt5::client::error::pid_overrun \endlink
|
||||
* - \link async_mqtt5::client::error::invalid_topic \endlink
|
||||
*
|
||||
@@ -635,6 +645,7 @@ public:
|
||||
* - `boost::asio::error::no_recovery` \n
|
||||
* - `boost::asio::error::operation_aborted` \n
|
||||
* - \link async_mqtt5::client::error::malformed_packet \endlink
|
||||
* - \link async_mqtt5::client::error::packet_too_large \endlink
|
||||
* - \link async_mqtt5::client::error::pid_overrun \endlink
|
||||
* - \link async_mqtt5::client::error::invalid_topic \endlink
|
||||
*
|
||||
|
Reference in New Issue
Block a user