7#if !defined(ASYNC_MQTT_PACKET_PROPERTY_HPP)
8#define ASYNC_MQTT_PACKET_PROPERTY_HPP
18#include <boost/asio/buffer.hpp>
19#include <boost/numeric/conversion/cast.hpp>
20#include <boost/container/static_vector.hpp>
21#include <boost/operators.hpp>
23#include <async_mqtt/util/json_like_out.hpp>
25#include <async_mqtt/packet/qos.hpp>
26#include <async_mqtt/packet/detail/base_property.hpp>
40namespace as = boost::asio;
43class property_variant;
44enum class property_location;
45property_variant make_property_variant(buffer& buf, property_location loc,
error_code& ec);
136static constexpr std::uint32_t packet_size_no_limit =
139 128 * 128 * 128 * 128;
169 static constexpr detail::ostream_format
const of_ = detail::ostream_format::binary_string;
176 template <
typename It,
typename End>
205 std::uint32_t
val()
const;
211 template <
typename It,
typename End>
235#if defined(GENERATING_DOCUMENTATION)
265 constexpr std::string
val()
const;
279 friend bool operator<(binary_property
const& lhs, binary_property
const& rhs);
287 friend bool operator==(binary_property
const& lhs, binary_property
const& rhs);
297 std::enable_if_t<std::is_same_v<Buffer, buffer>, std::nullptr_t> =
nullptr
322#if defined(GENERATING_DOCUMENTATION)
352 constexpr std::string
val()
const;
366 friend bool operator<(binary_property
const& lhs, binary_property
const& rhs);
374 friend bool operator==(binary_property
const& lhs, binary_property
const& rhs);
384 std::enable_if_t<std::is_same_v<Buffer, buffer>, std::nullptr_t> =
nullptr
409#if defined(GENERATING_DOCUMENTATION)
439 constexpr std::string
val()
const;
453 friend bool operator<(binary_property
const& lhs, binary_property
const& rhs);
461 friend bool operator==(binary_property
const& lhs, binary_property
const& rhs);
471 std::enable_if_t<std::is_same_v<Buffer, buffer>, std::nullptr_t> =
nullptr
526 std::uint32_t
val()
const;
532 template <
typename It>
556#if defined(GENERATING_DOCUMENTATION)
586 constexpr std::string
val()
const;
600 friend bool operator<(binary_property
const& lhs, binary_property
const& rhs);
608 friend bool operator==(binary_property
const& lhs, binary_property
const& rhs);
618 std::enable_if_t<std::is_same_v<Buffer, buffer>, std::nullptr_t> =
nullptr
647 std::uint16_t
val()
const;
653 template <
typename It,
typename End>
677#if defined(GENERATING_DOCUMENTATION)
707 constexpr std::string
val()
const;
721 friend bool operator<(binary_property
const& lhs, binary_property
const& rhs);
729 friend bool operator==(binary_property
const& lhs, binary_property
const& rhs);
739 std::enable_if_t<std::is_same_v<Buffer, buffer>, std::nullptr_t> =
nullptr
764#if defined(GENERATING_DOCUMENTATION)
794 constexpr std::string
val()
const;
808 friend bool operator<(binary_property
const& lhs, binary_property
const& rhs);
816 friend bool operator==(binary_property
const& lhs, binary_property
const& rhs);
826 std::enable_if_t<std::is_same_v<Buffer, buffer>, std::nullptr_t> =
nullptr
861 template <
typename It,
typename End>
889 std::uint32_t
val()
const;
895 template <
typename It,
typename End>
929 template <
typename It,
typename End>
953#if defined(GENERATING_DOCUMENTATION)
983 constexpr std::string
val()
const;
997 friend bool operator<(binary_property
const& lhs, binary_property
const& rhs);
1005 friend bool operator==(binary_property
const& lhs, binary_property
const& rhs);
1015 std::enable_if_t<std::is_same_v<Buffer, buffer>, std::nullptr_t> =
nullptr
1040#if defined(GENERATING_DOCUMENTATION)
1070 constexpr std::string
val()
const;
1084 friend bool operator<(binary_property
const& lhs, binary_property
const& rhs);
1092 friend bool operator==(binary_property
const& lhs, binary_property
const& rhs);
1102 std::enable_if_t<std::is_same_v<Buffer, buffer>, std::nullptr_t> =
nullptr
1127#if defined(GENERATING_DOCUMENTATION)
1157 constexpr std::string
val()
const;
1171 friend bool operator<(binary_property
const& lhs, binary_property
const& rhs);
1179 friend bool operator==(binary_property
const& lhs, binary_property
const& rhs);
1189 std::enable_if_t<std::is_same_v<Buffer, buffer>, std::nullptr_t> =
nullptr
1224 template <
typename It,
typename End>
1259 template <
typename It,
typename End>
1294 template <
typename It,
typename End>
1324 static constexpr const detail::ostream_format of_ = detail::ostream_format::int_cast;
1330 template <
typename It,
typename End>
1364 template <
typename It,
typename End>
1439 return std::tie(lhs.id_, lhs.key_.buf, lhs.val_.buf) < std::tie(rhs.id_, rhs.key_.buf, rhs.val_.buf);
1443 return std::tie(lhs.id_, lhs.key_.buf, lhs.val_.buf) == std::tie(rhs.id_, rhs.key_.buf, rhs.val_.buf);
1446 static constexpr detail::ostream_format
const of_ = detail::ostream_format::key_val;
1454 std::enable_if_t<std::is_same_v<Buffer, buffer>, std::nullptr_t> =
nullptr
1460 detail::len_str key_;
1461 detail::len_str val_;
1494 template <
typename It,
typename End>
1529 template <
typename It,
typename End>
1564 template <
typename It,
typename End>
1599 template <
typename It,
typename End>
1615template <
typename Property>
1617 Property::of_ == detail::ostream_format::direct,
1620operator<<(std::ostream& o, Property
const& v);
1634template <
typename Property>
1636 Property::of_ == detail::ostream_format::int_cast,
1639operator<<(std::ostream& o, Property
const& v);
1653template <
typename Property>
1655 Property::of_ == detail::ostream_format::key_val,
1658operator<<(std::ostream& o, Property
const& v);
1672template <
typename Property>
1674 Property::of_ == detail::ostream_format::binary_string,
1677operator<<(std::ostream& o, Property
const& v);
1691template <
typename Property>
1693 Property::of_ == detail::ostream_format::json_like,
1696operator<<(std::ostream& o, Property
const& v);
1702#include <async_mqtt/packet/impl/property.hpp>
buffer that has string_view interface and shared ownership This class is only for advanced usecase su...
Definition buffer.hpp:46
assigned_client_identifier property
Definition property.hpp:548
property::id id() const
Get property::id.
constexpr std::string val() const
Get value.
std::vector< as::const_buffer > const_buffer_sequence() const
Add const buffer sequence into the given buffer.
std::size_t size() const
Get property size.
static constexpr std::size_t num_of_const_buffer_sequence()
Get number of element of const_buffer_sequence.
friend bool operator==(binary_property const &lhs, binary_property const &rhs)
equal operator
friend bool operator<(binary_property const &lhs, binary_property const &rhs)
less than operator
assigned_client_identifier(std::string val)
constructor
constexpr buffer const & val_as_buffer() const
Get value.
authentication_data property
Definition property.hpp:756
constexpr buffer const & val_as_buffer() const
Get value.
property::id id() const
Get property::id.
std::size_t size() const
Get property size.
static constexpr std::size_t num_of_const_buffer_sequence()
Get number of element of const_buffer_sequence.
constexpr std::string val() const
Get value.
friend bool operator==(binary_property const &lhs, binary_property const &rhs)
equal operator
friend bool operator<(binary_property const &lhs, binary_property const &rhs)
less than operator
std::vector< as::const_buffer > const_buffer_sequence() const
Add const buffer sequence into the given buffer.
authentication_data(std::string val)
constructor
authentication_method property
Definition property.hpp:669
std::vector< as::const_buffer > const_buffer_sequence() const
Add const buffer sequence into the given buffer.
static constexpr std::size_t num_of_const_buffer_sequence()
Get number of element of const_buffer_sequence.
std::size_t size() const
Get property size.
authentication_method(std::string val)
constructor
friend bool operator==(binary_property const &lhs, binary_property const &rhs)
equal operator
friend bool operator<(binary_property const &lhs, binary_property const &rhs)
less than operator
property::id id() const
Get property::id.
constexpr buffer const & val_as_buffer() const
Get value.
constexpr std::string val() const
Get value.
content_type property
Definition property.hpp:227
std::size_t size() const
Get property size.
constexpr std::string val() const
Get value.
static constexpr std::size_t num_of_const_buffer_sequence()
Get number of element of const_buffer_sequence.
constexpr buffer const & val_as_buffer() const
Get value.
property::id id() const
Get property::id.
friend bool operator==(binary_property const &lhs, binary_property const &rhs)
equal operator
friend bool operator<(binary_property const &lhs, binary_property const &rhs)
less than operator
std::vector< as::const_buffer > const_buffer_sequence() const
Add const buffer sequence into the given buffer.
content_type(std::string val)
constructor
correlation_data property
Definition property.hpp:401
static constexpr std::size_t num_of_const_buffer_sequence()
Get number of element of const_buffer_sequence.
correlation_data(std::string val)
constructor
constexpr buffer const & val_as_buffer() const
Get value.
constexpr std::string val() const
Get value.
friend bool operator==(binary_property const &lhs, binary_property const &rhs)
equal operator
friend bool operator<(binary_property const &lhs, binary_property const &rhs)
less than operator
std::vector< as::const_buffer > const_buffer_sequence() const
Add const buffer sequence into the given buffer.
std::size_t size() const
Get property size.
property::id id() const
Get property::id.
maximum_packet_size property
Definition property.hpp:1476
maximum_packet_size(std::uint32_t val)
constructor
std::uint32_t val() const
Get value.
maximum_qos property
Definition property.hpp:1310
qos val() const
Get value.
maximum_qos(qos value)
constructor
message_expiry_interval property
Definition property.hpp:193
message_expiry_interval(std::uint32_t val)
constructor
std::uint32_t val() const
Get value.
reason_string property
Definition property.hpp:1119
std::size_t size() const
Get property size.
constexpr buffer const & val_as_buffer() const
Get value.
static constexpr std::size_t num_of_const_buffer_sequence()
Get number of element of const_buffer_sequence.
constexpr std::string val() const
Get value.
reason_string(std::string val)
constructor
friend bool operator==(binary_property const &lhs, binary_property const &rhs)
equal operator
friend bool operator<(binary_property const &lhs, binary_property const &rhs)
less than operator
std::vector< as::const_buffer > const_buffer_sequence() const
Add const buffer sequence into the given buffer.
property::id id() const
Get property::id.
receive_maximum property
Definition property.hpp:1206
receive_maximum(std::uint16_t val)
constructor
std::uint16_t val() const
Get value.
response_topic property
Definition property.hpp:314
static constexpr std::size_t num_of_const_buffer_sequence()
Get number of element of const_buffer_sequence.
std::size_t size() const
Get property size.
std::vector< as::const_buffer > const_buffer_sequence() const
Add const buffer sequence into the given buffer.
response_topic(std::string val)
constructor
property::id id() const
Get property::id.
friend bool operator==(binary_property const &lhs, binary_property const &rhs)
equal operator
friend bool operator<(binary_property const &lhs, binary_property const &rhs)
less than operator
constexpr std::string val() const
Get value.
constexpr buffer const & val_as_buffer() const
Get value.
retain_available property
Definition property.hpp:1346
bool val() const
Get value.
retain_available(bool value)
constructor
server_keep_alive property
Definition property.hpp:635
server_keep_alive(std::uint16_t val)
constructor
std::uint16_t val() const
Get value.
server_reference property
Definition property.hpp:1032
static constexpr std::size_t num_of_const_buffer_sequence()
Get number of element of const_buffer_sequence.
constexpr buffer const & val_as_buffer() const
Get value.
server_reference(std::string val)
constructor
std::vector< as::const_buffer > const_buffer_sequence() const
Add const buffer sequence into the given buffer.
friend bool operator==(binary_property const &lhs, binary_property const &rhs)
equal operator
friend bool operator<(binary_property const &lhs, binary_property const &rhs)
less than operator
constexpr std::string val() const
Get value.
property::id id() const
Get property::id.
std::size_t size() const
Get property size.
session_expiry_interval property
Definition property.hpp:514
std::uint32_t val() const
Get value.
session_expiry_interval(std::uint32_t val)
constructor
shared_subscription_available property
Definition property.hpp:1581
bool val() const
Get value.
shared_subscription_available(bool value)
constructor
subscription_identifier_available property
Definition property.hpp:1546
bool val() const
Get value.
subscription_identifier_available(bool value)
constructor
subscription_identifier property
Definition property.hpp:488
subscription_identifier(std::uint32_t val)
constructor
topic_alias_maximum property
Definition property.hpp:1241
topic_alias_maximum(std::uint16_t val)
constructor
std::uint16_t val() const
Get value.
topic_alias property
Definition property.hpp:1276
std::uint16_t val() const
Get value.
topic_alias(std::uint16_t val)
constructor
user property
Definition property.hpp:1381
user_property(std::string key, std::string val)
constructor
constexpr buffer const & val_as_buffer() const
Get value as buffer.
std::size_t size() const
Get property size.
constexpr buffer const & key_as_buffer() const
Get key as buffer.
std::vector< as::const_buffer > const_buffer_sequence() const
Add const buffer sequence into the given buffer.
static constexpr std::size_t num_of_const_buffer_sequence()
Get number of element of const_buffer_sequence.
std::string key() const
Get key.
std::string val() const
Get value.
property::id id() const
Get property::id.
wildcard_subscription_available property
Definition property.hpp:1511
bool val() const
Get value.
wildcard_subscription_available(bool value)
constructor
will_delay_interval property
Definition property.hpp:877
will_delay_interval(std::uint32_t val)
constructor
std::uint32_t val() const
Get value.
property variant
Definition property_variant.hpp:74
sys::error_code error_code
sys is a namespace alias of boost::sytem.
Definition error.hpp:56
std::uint16_t receive_maximum_type
type of the receive maximum value
Definition property.hpp:92
std::uint32_t session_expiry_interval_type
type of the session expiry interval (seconds)
Definition property.hpp:70
payload_format
payload_format
Definition property.hpp:56
id
MQTT property identifier.
Definition property_id.hpp:28
std::uint16_t topic_alias_type
type of the topic alias value
Definition property.hpp:81
std::enable_if_t< Property::of_==detail::ostream_format::direct, std::ostream & > operator<<(std::ostream &o, Property const &v)
stream output operator
@ subscription_identifier
Subscription Identifier.
@ request_problem_information
Request Problem Information.
@ reason_string
Reason String.
@ server_reference
Server Reference.
@ maximum_qos
Maximum QoS.
@ response_topic
Response Topic.
@ retain_available
Retain Available.
@ message_expiry_interval
Message Expiry Interval.
@ shared_subscription_available
Shared Subscription Available.
@ request_response_information
Request Response Information.
@ authentication_data
Authentication Data.
@ session_expiry_interval
Session Expiry Interval.
@ receive_maximum
Receive Maximum.
@ assigned_client_identifier
Assigned Client Identifier.
@ server_keep_alive
Server Keep Alive.
@ topic_alias
Topic Alias.
@ topic_alias_maximum
Topic Alias Maximum.
@ authentication_method
Authentication Method.
@ subscription_identifier_available
Subscription Identifier Available.
@ user_property
User Property.
@ payload_format_indicator
Payload Format Indicator.
@ will_delay_interval
Will Delay Interval.
@ wildcard_subscription_available
Wildcard Subscription Available.
@ maximum_packet_size
Maximum Packet Size.
@ content_type
Content Type.
@ correlation_data
Correlation Data.
@ response_information
Response Information.
qos
MQTT QoS.
Definition qos.hpp:35