7 #if !defined(MQTT_V5_MESSAGE_HPP)
8 #define MQTT_V5_MESSAGE_HPP
16 #include <boost/asio/buffer.hpp>
17 #include <boost/optional.hpp>
18 #include <boost/container/static_vector.hpp>
19 #include <boost/numeric/conversion/cast.hpp>
41 #if !defined(MQTT_ALWAYS_SEND_REASON_CODE)
42 #define MQTT_ALWAYS_SEND_REASON_CODE false
68 return {
as::buffer(message_.data(), message_.size()) };
76 return message_.size();
94 return std::string(message_.data(), message_.size());
97 boost::container::static_vector<char, 2> message_;
105 std::uint16_t keep_alive_sec,
109 optional<buffer> user_name,
110 optional<buffer> password,
125 protocol_name_and_level_ { 0x00, 0x04,
'M',
'Q',
'T',
'T', 0x05 },
128 will_property_length_(
131 w.value().props().begin(),
132 w.value().props().end(),
152 return total + v5::size(pv);
157 num_of_const_buffer_sequence_(
169 return total + v5::num_of_const_buffer_sequence(pv);
177 property_length_buf_.push_back(e);
180 remaining_length_ += property_length_buf_.size() + property_length_;
188 add_uint16_t_to_buf(user_name_length_buf_, boost::numeric_cast<std::uint16_t>(user_name_.size()));
190 remaining_length_ += 2 + user_name_.size();
191 num_of_const_buffer_sequence_ += 2;
196 add_uint16_t_to_buf(password_length_buf_, boost::numeric_cast<std::uint16_t>(password_.size()));
198 remaining_length_ += 2 + password_.size();
199 num_of_const_buffer_sequence_ += 2;
208 will_property_length_buf_.push_back(e);
212 will_topic_name_ =
force_move(w.value().topic());
214 will_topic_name_length_buf_,
215 boost::numeric_cast<std::uint16_t>(will_topic_name_.size())
217 if (w.value().message().size() > 0xffffL)
throw will_message_length_error();
218 will_message_ =
force_move(w.value().message());
220 will_message_length_buf_,
221 boost::numeric_cast<std::uint16_t>(will_message_.size()));
224 will_property_length_buf_.size() +
225 will_property_length_ +
226 2 + will_topic_name_.size() + 2 + will_message_.size();
227 num_of_const_buffer_sequence_ +=
233 return total + v5::num_of_const_buffer_sequence(pv);
243 remaining_length_buf_.push_back(e);
253 std::vector<as::const_buffer> ret;
256 ret.emplace_back(
as::buffer(&fixed_header_, 1));
257 ret.emplace_back(
as::buffer(remaining_length_buf_.data(), remaining_length_buf_.size()));
258 ret.emplace_back(
as::buffer(protocol_name_and_level_.data(), protocol_name_and_level_.size()));
259 ret.emplace_back(
as::buffer(&connect_flags_, 1));
260 ret.emplace_back(
as::buffer(keep_alive_buf_.data(), keep_alive_buf_.size()));
262 ret.emplace_back(
as::buffer(property_length_buf_.data(), property_length_buf_.size()));
263 for (
auto const& p : props_) {
267 ret.emplace_back(
as::buffer(client_id_length_buf_.data(), client_id_length_buf_.size()));
271 ret.emplace_back(
as::buffer(will_property_length_buf_.data(), will_property_length_buf_.size()));
272 for (
auto const& p : will_props_) {
275 ret.emplace_back(
as::buffer(will_topic_name_length_buf_.data(), will_topic_name_length_buf_.size()));
276 ret.emplace_back(
as::buffer(will_topic_name_));
277 ret.emplace_back(
as::buffer(will_message_length_buf_.data(), will_message_length_buf_.size()));
282 ret.emplace_back(
as::buffer(user_name_length_buf_.data(), user_name_length_buf_.size()));
287 ret.emplace_back(
as::buffer(password_length_buf_.data(), password_length_buf_.size()));
301 remaining_length_buf_.size() +
310 return num_of_const_buffer_sequence_;
324 ret.push_back(
static_cast<char>(fixed_header_));
325 ret.append(remaining_length_buf_.data(), remaining_length_buf_.size());
326 ret.append(protocol_name_and_level_.data(), protocol_name_and_level_.size());
327 ret.push_back(connect_flags_);
328 ret.append(keep_alive_buf_.data(), keep_alive_buf_.size());
330 ret.append(property_length_buf_.data(), property_length_buf_.size());
333 ret.resize(ret.size() + property_length_);
334 auto end = ret.end();
335 for (
auto const& p : props_) {
337 it +=
static_cast<std::string::difference_type
>(
v5::size(p));
340 ret.append(client_id_length_buf_.data(), client_id_length_buf_.size());
341 ret.append(client_id_.data(), client_id_.size());
344 ret.append(will_property_length_buf_.data(), will_property_length_buf_.size());
346 ret.resize(ret.size() + will_property_length_);
347 auto end = ret.end();
348 for (
auto const& p : will_props_) {
350 it +=
static_cast<std::string::difference_type
>(
v5::size(p));
352 ret.append(will_topic_name_length_buf_.data(), will_topic_name_length_buf_.size());
353 ret.append(will_topic_name_.data(), will_topic_name_.size());
354 ret.append(will_message_length_buf_.data(), will_message_length_buf_.size());
355 ret.append(will_message_.data(), will_message_.size());
359 ret.append(user_name_length_buf_.data(), user_name_length_buf_.size());
360 ret.append(user_name_.data(), user_name_.size());
364 ret.append(password_length_buf_.data(), password_length_buf_.size());
365 ret.append(password_.data(), password_.size());
372 std::uint8_t fixed_header_;
375 std::size_t remaining_length_;
376 boost::container::static_vector<char, 4> remaining_length_buf_;
378 boost::container::static_vector<char, 7> protocol_name_and_level_;
380 boost::container::static_vector<char, 2> client_id_length_buf_;
382 std::size_t will_property_length_;
383 boost::container::static_vector<char, 4> will_property_length_buf_;
387 boost::container::static_vector<char, 2> will_topic_name_length_buf_;
389 boost::container::static_vector<char, 2> will_message_length_buf_;
392 boost::container::static_vector<char, 2> user_name_length_buf_;
394 boost::container::static_vector<char, 2> password_length_buf_;
396 boost::container::static_vector<char, 2> keep_alive_buf_;
398 std::size_t property_length_;
399 boost::container::static_vector<char, 4> property_length_buf_;
402 std::size_t num_of_const_buffer_sequence_;
408 bool session_present,
417 connect_acknowledge_flags_(session_present ? 1 : 0),
418 reason_code_(reason_code),
430 num_of_const_buffer_sequence_(
441 return total + v5::num_of_const_buffer_sequence(pv);
448 property_length_buf_.push_back(e);
451 remaining_length_ += property_length_buf_.size() + property_length_;
454 remaining_length_buf_.push_back(e);
464 std::vector<as::const_buffer> ret;
467 ret.emplace_back(
as::buffer(&fixed_header_, 1));
468 ret.emplace_back(
as::buffer(remaining_length_buf_.data(), remaining_length_buf_.size()));
469 ret.emplace_back(
as::buffer(&connect_acknowledge_flags_, 1));
470 ret.emplace_back(
as::buffer(&reason_code_, 1));
472 ret.emplace_back(
as::buffer(property_length_buf_.data(), property_length_buf_.size()));
473 for (
auto const& p : props_) {
487 remaining_length_buf_.size() +
496 return num_of_const_buffer_sequence_;
510 ret.push_back(
static_cast<char>(fixed_header_));
511 ret.append(remaining_length_buf_.data(), remaining_length_buf_.size());
512 ret.push_back(
static_cast<char>(connect_acknowledge_flags_));
513 ret.push_back(
static_cast<char>(reason_code_));
516 ret.resize(ret.size() + property_length_);
517 auto end = ret.end();
518 for (
auto const& p : props_) {
520 it +=
static_cast<std::string::difference_type
>(
v5::size(p));
527 std::uint8_t fixed_header_;
529 std::size_t remaining_length_;
530 boost::container::static_vector<char, 4> remaining_length_buf_;
532 std::uint8_t connect_acknowledge_flags_;
536 std::size_t property_length_;
537 boost::container::static_vector<char, 4> property_length_buf_;
540 std::size_t num_of_const_buffer_sequence_;
543 template <std::
size_t PacketIdBytes>
547 typename ConstBufferSequence,
548 typename std::enable_if<
549 as::is_const_buffer_sequence<ConstBufferSequence>::value,
555 as::const_buffer topic_name,
556 ConstBufferSequence payloads,
561 topic_name_(topic_name),
581 num_of_const_buffer_sequence_(
593 return total + v5::num_of_const_buffer_sequence(pv);
600 auto num_of_payloads =
static_cast<std::size_t
>(std::distance(b, e));
601 payloads_.reserve(num_of_payloads);
602 for (; b != e; ++b) {
604 remaining_length_ +=
payload.size();
607 num_of_const_buffer_sequence_ += num_of_payloads;
613 property_length_buf_.push_back(e);
616 remaining_length_ += property_length_buf_.size() + property_length_;
620 remaining_length_buf_.push_back(e);
624 packet_id_.reserve(PacketIdBytes);
625 add_packet_id_to_buf<PacketIdBytes>::apply(packet_id_,
packet_id);
631 fixed_header_ =
static_cast<std::uint8_t
>(buf.front());
633 buf.remove_prefix(1);
637 remaining_length_ = std::get<0>(len_consumed);
638 auto consumed = std::get<1>(len_consumed);
642 std::next(buf.begin(),
static_cast<buffer::difference_type
>(consumed)),
643 std::back_inserter(remaining_length_buf_));
644 buf.remove_prefix(consumed);
647 std::copy(buf.begin(), std::next(buf.begin(), 2), std::back_inserter(topic_name_length_buf_));
648 auto topic_name_length =
make_uint16_t(buf.begin(), std::next(buf.begin(), 2));
649 buf.remove_prefix(2);
655 buf.remove_prefix(topic_name_length);
663 std::copy(buf.begin(), std::next(buf.begin(), PacketIdBytes), std::back_inserter(packet_id_));
664 buf.remove_prefix(PacketIdBytes);
675 property_length_ = std::get<0>(len_consume);
676 auto consume = std::get<1>(len_consume);
680 std::next(buf.begin(),
static_cast<buffer::difference_type
>(consume)),
681 std::back_inserter(property_length_buf_)
683 buf.remove_prefix(consume);
687 buf.remove_prefix(property_length_);
691 num_of_const_buffer_sequence_ =
703 return total + v5::num_of_const_buffer_sequence(pv);
715 std::vector<as::const_buffer> ret;
718 ret.emplace_back(
as::buffer(&fixed_header_, 1));
719 ret.emplace_back(
as::buffer(remaining_length_buf_.data(), remaining_length_buf_.size()));
720 ret.emplace_back(topic_name_length_buf_.data(), topic_name_length_buf_.size());
723 if (!packet_id_.empty()) {
724 ret.emplace_back(
as::buffer(packet_id_.data(), packet_id_.size()));
727 ret.emplace_back(
as::buffer(property_length_buf_.data(), property_length_buf_.size()));
728 for (
auto const& p : props_) {
732 std::copy(payloads_.begin(), payloads_.end(), std::back_inserter(ret));
744 remaining_length_buf_.size() +
753 return num_of_const_buffer_sequence_;
767 ret.push_back(
static_cast<char>(fixed_header_));
768 ret.append(remaining_length_buf_.data(), remaining_length_buf_.size());
770 ret.append(topic_name_length_buf_.data(), topic_name_length_buf_.size());
773 ret.append(packet_id_.data(), packet_id_.size());
775 ret.append(property_length_buf_.data(), property_length_buf_.size());
778 ret.resize(ret.size() + property_length_);
779 auto end = ret.end();
780 for (
auto const& p : props_) {
782 it +=
static_cast<std::string::difference_type
>(
v5::size(p));
785 for (
auto const&
payload : payloads_) {
845 std::vector<string_view> ret;
846 ret.reserve(payloads_.size());
847 for (
auto const&
payload : payloads_) {
858 auto size = std::accumulate(
862 [](std::size_t s, as::const_buffer
const&
payload) {
863 return s += payload.size();
870 auto ptr = spa.get();
872 for (
auto const&
payload : payloads_) {
897 property_length_ += add_size;
898 property_length_buf_.clear();
901 property_length_buf_.push_back(e);
904 remaining_length_buf_.clear();
905 remaining_length_ += add_size;
908 remaining_length_buf_.push_back(e);
917 template <
typename Property>
919 std::is_base_of<property::detail::n_bytes_property<1>, Property>::value ||
920 std::is_base_of<property::detail::n_bytes_property<2>, Property>::value ||
921 std::is_base_of<property::detail::n_bytes_property<4>, Property>::value
924 for (
auto& p : props_) {
940 std::size_t removed_size = 0;
941 auto it = props_.begin();
942 auto end = props_.begin();
946 it = props_.erase(it);
953 property_length_ -= removed_size;
954 property_length_buf_.clear();
957 property_length_buf_.push_back(e);
960 remaining_length_buf_.clear();
961 remaining_length_ -= removed_size;
964 remaining_length_buf_.push_back(e);
981 auto prev_topic_name_size =
get_size(topic_name_);
983 topic_name_length_buf_ = boost::container::static_vector<char, 2>{
987 remaining_length_buf_.clear();
988 remaining_length_ = remaining_length_ - prev_topic_name_size +
get_size(topic_name);
991 remaining_length_buf_.push_back(e);
996 std::uint8_t fixed_header_;
997 as::const_buffer topic_name_;
998 boost::container::static_vector<char, 2> topic_name_length_buf_;
999 boost::container::static_vector<char, PacketIdBytes> packet_id_;
1000 std::size_t property_length_;
1001 boost::container::static_vector<char, 4> property_length_buf_;
1003 std::vector<as::const_buffer> payloads_;
1004 std::size_t remaining_length_;
1005 boost::container::static_vector<char, 4> remaining_length_buf_;
1006 std::size_t num_of_const_buffer_sequence_;
1012 template <std::
size_t PacketIdBytes>
1042 [&] () -> std::size_t {
1057 [](std::size_t total, property_variant const& pv) {
1058 return total + v5::num_of_const_buffer_sequence(pv);
1069 add_packet_id_to_buf<PacketIdBytes>::apply(packet_id_, packet_id);
1072 property_length_buf_.push_back(e);
1084 [&] () -> std::size_t {
1088 if (props_.empty()) {
1094 property_length_buf_.size() +
1105 remaining_length_buf_.push_back(e);
1115 std::vector<as::const_buffer> ret;
1118 ret.emplace_back(
as::buffer(&fixed_header_, 1));
1119 ret.emplace_back(
as::buffer(remaining_length_buf_.data(), remaining_length_buf_.size()));
1120 ret.emplace_back(
as::buffer(packet_id_.data(), packet_id_.size()));
1130 ret.emplace_back(
as::buffer(&reason_code_, 1));
1133 if (!props_.empty()) {
1134 ret.emplace_back(
as::buffer(property_length_buf_.data(), property_length_buf_.size()));
1135 for (
auto const& p : props_) {
1150 remaining_length_buf_.size() +
1159 return num_of_const_buffer_sequence_;
1173 ret.push_back(
static_cast<char>(fixed_header_));
1174 ret.append(remaining_length_buf_.data(), remaining_length_buf_.size());
1184 ret.push_back(
static_cast<char>(reason_code_));
1188 if (!props_.empty()) {
1189 ret.append(property_length_buf_.data(), property_length_buf_.size());
1191 auto it = ret.end();
1193 auto end = ret.end();
1194 for (
auto const& p : props_) {
1196 it +=
static_cast<std::string::difference_type
>(
v5::size(p));
1216 template <std::
size_t PacketIdBytes>
1223 reason_code_(reason_code),
1235 num_of_const_buffer_sequence_(
1246 [&] () -> std::size_t {
1250 if (props_.empty()) {
1261 [](std::size_t total, property_variant const& pv) {
1262 return total + v5::num_of_const_buffer_sequence(pv);
1273 add_packet_id_to_buf<PacketIdBytes>::apply(packet_id_, packet_id);
1276 property_length_buf_.push_back(e);
1288 [&] () -> std::size_t {
1292 if (props_.empty()) {
1298 property_length_buf_.size() +
1309 remaining_length_buf_.push_back(e);
1319 std::vector<as::const_buffer> ret;
1322 ret.emplace_back(
as::buffer(&fixed_header_, 1));
1323 ret.emplace_back(
as::buffer(remaining_length_buf_.data(), remaining_length_buf_.size()));
1324 ret.emplace_back(
as::buffer(packet_id_.data(), packet_id_.size()));
1334 ret.emplace_back(
as::buffer(&reason_code_, 1));
1337 if (!props_.empty()) {
1338 ret.emplace_back(
as::buffer(property_length_buf_.data(), property_length_buf_.size()));
1339 for (
auto const& p : props_) {
1354 remaining_length_buf_.size() +
1363 return num_of_const_buffer_sequence_;
1377 ret.push_back(
static_cast<char>(fixed_header_));
1378 ret.append(remaining_length_buf_.data(), remaining_length_buf_.size());
1388 ret.push_back(
static_cast<char>(reason_code_));
1392 if (!props_.empty()) {
1393 ret.append(property_length_buf_.data(), property_length_buf_.size());
1395 auto it = ret.end();
1397 auto end = ret.end();
1398 for (
auto const& p : props_) {
1400 it +=
static_cast<std::string::difference_type
>(
v5::size(p));
1421 template <std::
size_t PacketIdBytes>
1428 reason_code_(reason_code),
1440 num_of_const_buffer_sequence_(
1451 [&] () -> std::size_t {
1455 if (props_.empty()) {
1466 [](std::size_t total, property_variant const& pv) {
1467 return total + v5::num_of_const_buffer_sequence(pv);
1478 add_packet_id_to_buf<PacketIdBytes>::apply(packet_id_, packet_id);
1481 property_length_buf_.push_back(e);
1493 [&] () -> std::size_t {
1497 if (props_.empty()) {
1503 property_length_buf_.size() +
1514 remaining_length_buf_.push_back(e);
1520 fixed_header_ =
static_cast<std::uint8_t
>(buf.front());
1521 buf.remove_prefix(1);
1525 remaining_length_ = std::get<0>(len_consumed);
1526 auto consumed = std::get<1>(len_consumed);
1530 std::next(buf.begin(),
static_cast<buffer::difference_type
>(consumed)),
1531 std::back_inserter(remaining_length_buf_));
1532 buf.remove_prefix(consumed);
1535 std::copy(buf.begin(), std::next(buf.begin(), PacketIdBytes), std::back_inserter(packet_id_));
1536 buf.remove_prefix(PacketIdBytes);
1539 num_of_const_buffer_sequence_ =
1543 reason_code_ = v5::pubrel_reason_code::success;
1548 buf.remove_prefix(1);
1551 property_length_ = 0;
1558 property_length_ = std::get<0>(len_consume);
1559 auto consume = std::get<1>(len_consume);
1563 std::next(buf.begin(),
static_cast<buffer::difference_type
>(consume)),
1564 std::back_inserter(property_length_buf_)
1566 buf.remove_prefix(consume);
1570 buf.remove_prefix(property_length_);
1573 num_of_const_buffer_sequence_ =
1584 [&] () -> std::size_t {
1588 if (props_.empty()) {
1600 return total + v5::num_of_const_buffer_sequence(pv);
1617 std::vector<as::const_buffer> ret;
1620 ret.emplace_back(
as::buffer(&fixed_header_, 1));
1621 ret.emplace_back(
as::buffer(remaining_length_buf_.data(), remaining_length_buf_.size()));
1622 ret.emplace_back(
as::buffer(packet_id_.data(), packet_id_.size()));
1632 ret.emplace_back(
as::buffer(&reason_code_, 1));
1635 if (!props_.empty()) {
1636 ret.emplace_back(
as::buffer(property_length_buf_.data(), property_length_buf_.size()));
1638 for (
auto const& p : props_) {
1653 remaining_length_buf_.size() +
1662 return num_of_const_buffer_sequence_;
1676 ret.push_back(
static_cast<char>(fixed_header_));
1677 ret.append(remaining_length_buf_.data(), remaining_length_buf_.size());
1678 ret.append(packet_id_.data(), packet_id_.size());
1688 ret.push_back(
static_cast<char>(reason_code_));
1692 if (!props_.empty()) {
1693 ret.append(property_length_buf_.data(), property_length_buf_.size());
1695 auto it = ret.end();
1697 auto end = ret.end();
1698 for (
auto const& p : props_) {
1700 it +=
static_cast<std::string::difference_type
>(
v5::size(p));
1711 decltype(
auto) packet_id()
const {
1720 return reason_code_;
1745 template <std::
size_t PacketIdBytes>
1752 reason_code_(reason_code),
1764 num_of_const_buffer_sequence_(
1775 [&] () -> std::size_t {
1779 if (props_.empty()) {
1790 [](std::size_t total, property_variant const& pv) {
1791 return total + v5::num_of_const_buffer_sequence(pv);
1802 add_packet_id_to_buf<PacketIdBytes>::apply(packet_id_, packet_id);
1805 property_length_buf_.push_back(e);
1817 [&] () -> std::size_t {
1821 if (props_.empty()) {
1827 property_length_buf_.size() +
1838 remaining_length_buf_.push_back(e);
1848 std::vector<as::const_buffer> ret;
1851 ret.emplace_back(
as::buffer(&fixed_header_, 1));
1852 ret.emplace_back(
as::buffer(remaining_length_buf_.data(), remaining_length_buf_.size()));
1853 ret.emplace_back(
as::buffer(packet_id_.data(), packet_id_.size()));
1863 ret.emplace_back(
as::buffer(&reason_code_, 1));
1866 if (!props_.empty()) {
1867 ret.emplace_back(
as::buffer(property_length_buf_.data(), property_length_buf_.size()));
1869 for (
auto const& p : props_) {
1884 remaining_length_buf_.size() +
1893 return num_of_const_buffer_sequence_;
1907 ret.push_back(
static_cast<char>(fixed_header_));
1908 ret.append(remaining_length_buf_.data(), remaining_length_buf_.size());
1918 ret.push_back(
static_cast<char>(reason_code_));
1922 if (!props_.empty()) {
1923 ret.append(property_length_buf_.data(), property_length_buf_.size());
1925 auto it = ret.end();
1927 auto end = ret.end();
1928 for (
auto const& p : props_) {
1930 it +=
static_cast<std::string::difference_type
>(
v5::size(p));
1951 template <std::
size_t PacketIdBytes>
1956 : topic_filter_(topic_filter),
1957 topic_filter_length_buf_ {
num_to_2bytes(boost::numeric_cast<std::uint16_t>(topic_filter_.size())) },
1961 as::const_buffer topic_filter_;
1962 boost::container::static_vector<char, 2> topic_filter_length_buf_;
1968 std::vector<std::tuple<as::const_buffer, subscribe_options>> params,
1973 remaining_length_(PacketIdBytes),
1985 num_of_const_buffer_sequence_(
1995 return total + v5::num_of_const_buffer_sequence(pv);
2005 property_length_buf_.push_back(e);
2008 remaining_length_ +=
2009 property_length_buf_.size() +
2013 for (
auto&& e : params) {
2014 as::const_buffer topic_filter = std::get<0>(e);
2018 entries_.reserve(params.size());
2019 for (
auto&& e : params) {
2020 as::const_buffer topic_filter = std::get<0>(e);
2021 size_t size = topic_filter.size();
2023 entries_.emplace_back(topic_filter, std::get<1>(e));
2024 remaining_length_ +=
2032 remaining_length_buf_.push_back(e);
2042 std::vector<as::const_buffer> ret;
2045 ret.emplace_back(
as::buffer(&fixed_header_, 1));
2047 ret.emplace_back(
as::buffer(remaining_length_buf_.data(), remaining_length_buf_.size()));
2049 ret.emplace_back(
as::buffer(packet_id_.data(), packet_id_.size()));
2051 ret.emplace_back(
as::buffer(property_length_buf_.data(), property_length_buf_.size()));
2052 for (
auto const& p : props_) {
2056 for (
auto const& e : entries_) {
2057 ret.emplace_back(
as::buffer(e.topic_filter_length_buf_.data(), e.topic_filter_length_buf_.size()));
2058 ret.emplace_back(
as::buffer(e.topic_filter_));
2059 ret.emplace_back(
as::buffer(&e.options_, 1));
2072 remaining_length_buf_.size() +
2081 return num_of_const_buffer_sequence_;
2093 ret.reserve(
size());
2095 ret.push_back(
static_cast<char>(fixed_header_));
2096 ret.append(remaining_length_buf_.data(), remaining_length_buf_.size());
2098 ret.append(packet_id_.data(), packet_id_.size());
2100 ret.append(property_length_buf_.data(), property_length_buf_.size());
2102 auto it = ret.end();
2103 ret.resize(ret.size() + property_length_);
2104 auto end = ret.end();
2105 for (
auto const& p : props_) {
2107 it +=
static_cast<std::string::difference_type
>(
v5::size(p));
2110 for (
auto const& e : entries_) {
2111 ret.append(e.topic_filter_length_buf_.data(), e.topic_filter_length_buf_.size());
2113 ret.push_back(
static_cast<char>(e.options_.operator std::uint8_t()));
2120 std::uint8_t fixed_header_;
2121 std::vector<entry> entries_;
2122 boost::container::static_vector<char, PacketIdBytes> packet_id_;
2123 std::size_t remaining_length_;
2124 boost::container::static_vector<char, 4> remaining_length_buf_;
2125 std::size_t property_length_;
2126 boost::container::static_vector<char, 4> property_length_buf_;
2128 std::size_t num_of_const_buffer_sequence_;
2133 template <std::
size_t PacketIdBytes>
2137 std::vector<suback_reason_code> reason_codes,
2142 remaining_length_(reason_codes.
size() + PacketIdBytes),
2154 num_of_const_buffer_sequence_(
2164 return total + v5::num_of_const_buffer_sequence(pv);
2174 property_length_buf_.push_back(e);
2177 remaining_length_ +=
2178 property_length_buf_.size() +
2183 remaining_length_buf_.push_back(e);
2185 entries_.reserve(reason_codes.size());
2186 for (
auto e : reason_codes) {
2187 entries_.push_back(
static_cast<char>(e));
2197 std::vector<as::const_buffer> ret;
2200 ret.emplace_back(
as::buffer(&fixed_header_, 1));
2201 ret.emplace_back(
as::buffer(remaining_length_buf_.data(), remaining_length_buf_.size()));
2202 ret.emplace_back(
as::buffer(packet_id_.data(), packet_id_.size()));
2204 ret.emplace_back(
as::buffer(property_length_buf_.data(), property_length_buf_.size()));
2205 for (
auto const& p : props_) {
2221 remaining_length_buf_.size() +
2230 return num_of_const_buffer_sequence_;
2242 ret.reserve(
size());
2244 ret.push_back(
static_cast<char>(fixed_header_));
2245 ret.append(remaining_length_buf_.data(), remaining_length_buf_.size());
2247 ret.append(packet_id_.data(), packet_id_.size());
2249 auto it = ret.end();
2250 ret.resize(ret.size() + property_length_);
2251 auto end = ret.end();
2252 for (
auto const& p : props_) {
2254 it +=
static_cast<std::string::difference_type
>(
v5::size(p));
2257 ret.append(entries_);
2263 std::uint8_t fixed_header_;
2264 std::string entries_;
2265 boost::container::static_vector<char, PacketIdBytes> packet_id_;
2266 std::size_t remaining_length_;
2267 boost::container::static_vector<char, 4> remaining_length_buf_;
2268 std::size_t property_length_;
2269 boost::container::static_vector<char, 4> property_length_buf_;
2271 std::size_t num_of_const_buffer_sequence_;
2276 template <std::
size_t PacketIdBytes>
2280 entry(as::const_buffer topic_filter)
2281 : topic_filter_(topic_filter),
2282 topic_filter_length_buf_ {
num_to_2bytes(boost::numeric_cast<std::uint16_t>(topic_filter.size())) }
2285 as::const_buffer topic_filter_;
2286 boost::container::static_vector<char, 2> topic_filter_length_buf_;
2291 std::vector<as::const_buffer> params,
2296 remaining_length_(PacketIdBytes),
2308 num_of_const_buffer_sequence_(
2318 return total + v5::num_of_const_buffer_sequence(pv);
2328 property_length_buf_.push_back(e);
2331 remaining_length_ +=
2332 property_length_buf_.size() +
2336 for (
auto&& e : params) {
2340 entries_.reserve(params.size());
2341 for (
auto&& e : params) {
2342 auto size = e.size();
2343 entries_.emplace_back(e);
2344 remaining_length_ +=
2350 remaining_length_buf_.push_back(e);
2360 std::vector<as::const_buffer> ret;
2363 ret.emplace_back(
as::buffer(&fixed_header_, 1));
2364 ret.emplace_back(
as::buffer(remaining_length_buf_.data(), remaining_length_buf_.size()));
2366 ret.emplace_back(
as::buffer(packet_id_.data(), packet_id_.size()));
2368 ret.emplace_back(
as::buffer(property_length_buf_.data(), property_length_buf_.size()));
2369 for (
auto const& p : props_) {
2373 for (
auto const& e : entries_) {
2374 ret.emplace_back(
as::buffer(e.topic_filter_length_buf_.data(), e.topic_filter_length_buf_.size()));
2375 ret.emplace_back(
as::buffer(e.topic_filter_));
2388 remaining_length_buf_.size() +
2397 return num_of_const_buffer_sequence_;
2408 ret.reserve(
size());
2410 ret.push_back(
static_cast<char>(fixed_header_));
2412 ret.append(remaining_length_buf_.data(), remaining_length_buf_.size());
2414 ret.append(packet_id_.data(), packet_id_.size());
2416 auto it = ret.end();
2417 ret.resize(ret.size() + property_length_);
2418 auto end = ret.end();
2419 for (
auto const& p : props_) {
2421 it +=
static_cast<std::string::difference_type
>(
v5::size(p));
2424 for (
auto const& e : entries_) {
2425 ret.append(e.topic_filter_length_buf_.data(), e.topic_filter_length_buf_.size());
2433 std::uint8_t fixed_header_;
2434 std::vector<entry> entries_;
2435 boost::container::static_vector<char, PacketIdBytes> packet_id_;
2436 std::size_t remaining_length_;
2437 boost::container::static_vector<char, 4> remaining_length_buf_;
2438 std::size_t property_length_;
2439 boost::container::static_vector<char, 4> property_length_buf_;
2441 std::size_t num_of_const_buffer_sequence_;
2446 template <std::
size_t PacketIdBytes>
2450 std::vector<v5::unsuback_reason_code> reason_codes,
2456 remaining_length_(reason_codes_.
size() + PacketIdBytes),
2468 num_of_const_buffer_sequence_(
2478 return total + v5::num_of_const_buffer_sequence(pv);
2487 property_length_buf_.push_back(e);
2490 remaining_length_ +=
2491 property_length_buf_.size() +
2496 remaining_length_buf_.push_back(e);
2506 std::vector<as::const_buffer> ret;
2509 ret.emplace_back(
as::buffer(&fixed_header_, 1));
2510 ret.emplace_back(
as::buffer(remaining_length_buf_.data(), remaining_length_buf_.size()));
2511 ret.emplace_back(
as::buffer(packet_id_.data(), packet_id_.size()));
2513 ret.emplace_back(
as::buffer(property_length_buf_.data(), property_length_buf_.size()));
2514 for (
auto const& p : props_) {
2518 ret.emplace_back(
as::buffer(
reinterpret_cast<char const*
>(reason_codes_.data()), reason_codes_.size()));
2530 remaining_length_buf_.size() +
2539 return num_of_const_buffer_sequence_;
2551 ret.reserve(
size());
2553 ret.push_back(
static_cast<char>(fixed_header_));
2554 ret.append(remaining_length_buf_.data(), remaining_length_buf_.size());
2556 ret.append(packet_id_.data(), packet_id_.size());
2558 auto it = ret.end();
2559 ret.resize(ret.size() + property_length_);
2560 auto end = ret.end();
2561 for (
auto const& p : props_) {
2563 it +=
static_cast<std::string::difference_type
>(
v5::size(p));
2566 ret.append(
reinterpret_cast<char const*
>(reason_codes_.data()), reason_codes_.size());
2572 std::uint8_t fixed_header_;
2573 std::vector<v5::unsuback_reason_code> reason_codes_;
2574 boost::container::static_vector<char, PacketIdBytes> packet_id_;
2575 std::size_t remaining_length_;
2576 boost::container::static_vector<char, 4> remaining_length_buf_;
2577 std::size_t property_length_;
2578 boost::container::static_vector<char, 4> property_length_buf_;
2580 std::size_t num_of_const_buffer_sequence_;
2603 remaining_length_(0),
2604 reason_code_(reason_code),
2616 num_of_const_buffer_sequence_(
2635 return total + v5::num_of_const_buffer_sequence(pv);
2645 property_length_buf_.push_back(e);
2657 property_length_buf_.size() +
2662 remaining_length_buf_.push_back(e);
2671 std::vector<as::const_buffer> ret;
2674 ret.emplace_back(
as::buffer(&fixed_header_, 1));
2675 ret.emplace_back(
as::buffer(remaining_length_buf_.data(), remaining_length_buf_.size()));
2685 ret.emplace_back(
as::buffer(&reason_code_, 1));
2687 ret.emplace_back(
as::buffer(property_length_buf_.data(), property_length_buf_.size()));
2688 for (
auto const& p : props_) {
2703 remaining_length_buf_.size() +
2712 return num_of_const_buffer_sequence_;
2724 ret.reserve(
size());
2726 ret.push_back(
static_cast<char>(fixed_header_));
2727 ret.append(remaining_length_buf_.data(), remaining_length_buf_.size());
2737 ret.push_back(
static_cast<char>(reason_code_));
2739 auto it = ret.end();
2740 ret.resize(ret.size() + property_length_);
2741 auto end = ret.end();
2742 for (
auto const& p : props_) {
2744 it +=
static_cast<std::string::difference_type
>(
v5::size(p));
2752 std::uint8_t fixed_header_;
2754 std::size_t remaining_length_;
2755 boost::container::static_vector<char, 4> remaining_length_buf_;
2759 std::size_t property_length_;
2760 boost::container::static_vector<char, 4> property_length_buf_;
2762 std::size_t num_of_const_buffer_sequence_;
2771 remaining_length_(0),
2772 reason_code_(reason_code),
2784 num_of_const_buffer_sequence_(
2804 return total + v5::num_of_const_buffer_sequence(pv);
2814 property_length_buf_.push_back(e);
2826 property_length_buf_.size() +
2831 remaining_length_buf_.push_back(e);
2841 std::vector<as::const_buffer> ret;
2844 ret.emplace_back(
as::buffer(&fixed_header_, 1));
2845 ret.emplace_back(
as::buffer(remaining_length_buf_.data(), remaining_length_buf_.size()));
2855 ret.emplace_back(
as::buffer(&reason_code_, 1));
2857 ret.emplace_back(
as::buffer(property_length_buf_.data(), property_length_buf_.size()));
2858 for (
auto const& p : props_) {
2873 remaining_length_buf_.size() +
2882 return num_of_const_buffer_sequence_;
2894 ret.reserve(
size());
2896 ret.push_back(
static_cast<char>(fixed_header_));
2897 ret.append(remaining_length_buf_.data(), remaining_length_buf_.size());
2907 ret.push_back(
static_cast<char>(reason_code_));
2909 auto it = ret.end();
2910 ret.resize(ret.size() + property_length_);
2911 auto end = ret.end();
2912 for (
auto const& p : props_) {
2914 it +=
static_cast<std::string::difference_type
>(
v5::size(p));
2922 std::uint8_t fixed_header_;
2924 std::size_t remaining_length_;
2925 boost::container::static_vector<char, 4> remaining_length_buf_;
2929 std::size_t property_length_;
2930 boost::container::static_vector<char, 4> property_length_buf_;
2932 std::size_t num_of_const_buffer_sequence_;
buffer that has string_view interface This class provides string_view interface. This class hold stri...
Definition: buffer.hpp:30
buffer substr(std::size_t offset, std::size_t length=string_view::npos) const &
get substring The returned buffer ragnge is the same as std::string_view::substr()....
Definition: buffer.hpp:68
Definition: v5_message.hpp:544
void set_topic_name(as::const_buffer topic_name)
Set topic name.
Definition: v5_message.hpp:980
constexpr bool is_retain() const
Check retain flag.
Definition: v5_message.hpp:820
std::vector< as::const_buffer > const_buffer_sequence() const
Create const buffer sequence it is for boost asio APIs.
Definition: v5_message.hpp:714
constexpr void set_dup(bool dup)
Set dup flag.
Definition: v5_message.hpp:972
basic_publish_message(buffer buf)
Definition: v5_message.hpp:629
std::size_t size() const
Get whole size of sequence.
Definition: v5_message.hpp:741
constexpr bool is_dup() const
Check dup flag.
Definition: v5_message.hpp:828
properties const & props() const
Get properties.
Definition: v5_message.hpp:886
packet_id_type< PacketIdBytes >::type packet_id() const
Get packet id.
Definition: v5_message.hpp:796
void remove_prop(v5::property::id id)
Remove property.
Definition: v5_message.hpp:939
std::vector< string_view > payload() const
Get payload.
Definition: v5_message.hpp:844
constexpr std::size_t num_of_const_buffer_sequence() const
Get number of element of const_buffer_sequence.
Definition: v5_message.hpp:752
std::enable_if_t< std::is_base_of< property::detail::n_bytes_property< 1 >, Property >::value||std::is_base_of< property::detail::n_bytes_property< 2 >, Property >::value||std::is_base_of< property::detail::n_bytes_property< 4 >, Property >::value > update_prop(Property update_prop)
Update property Only fixed size property can be updated.
Definition: v5_message.hpp:923
buffer payload_as_buffer() const
Get payload as single buffer.
Definition: v5_message.hpp:857
basic_publish_message(typename packet_id_type< PacketIdBytes >::type packet_id, as::const_buffer topic_name, ConstBufferSequence payloads, publish_options pubopts, properties props)
Definition: v5_message.hpp:553
void add_prop(property_variant p)
Add property.
Definition: v5_message.hpp:894
string_view topic() const
Get topic name.
Definition: v5_message.hpp:836
constexpr publish_options get_options() const
Get publish_options.
Definition: v5_message.hpp:804
std::string continuous_buffer() const
Create one continuours buffer. All sequence of buffers are concatinated. It is useful to store to fil...
Definition: v5_message.hpp:762
constexpr qos get_qos() const
Get qos.
Definition: v5_message.hpp:812
Definition: v5_message.hpp:2134
constexpr std::size_t num_of_const_buffer_sequence() const
Get number of element of const_buffer_sequence.
Definition: v5_message.hpp:2229
basic_suback_message(std::vector< suback_reason_code > reason_codes, typename packet_id_type< PacketIdBytes >::type packet_id, properties props)
Definition: v5_message.hpp:2136
std::string continuous_buffer() const
Create one continuours buffer. All sequence of buffers are concatinated. It is useful to store to fil...
Definition: v5_message.hpp:2239
std::size_t size() const
Get whole size of sequence.
Definition: v5_message.hpp:2218
std::vector< as::const_buffer > const_buffer_sequence() const
Create const buffer sequence it is for boost asio APIs.
Definition: v5_message.hpp:2196
Definition: v5_message.hpp:1952
constexpr std::size_t num_of_const_buffer_sequence() const
Get number of element of const_buffer_sequence.
Definition: v5_message.hpp:2080
std::size_t size() const
Get whole size of sequence.
Definition: v5_message.hpp:2069
std::vector< as::const_buffer > const_buffer_sequence() const
Create const buffer sequence it is for boost asio APIs.
Definition: v5_message.hpp:2041
std::string continuous_buffer() const
Create one continuours buffer. All sequence of buffers are concatinated. It is useful to store to fil...
Definition: v5_message.hpp:2090
basic_subscribe_message(std::vector< std::tuple< as::const_buffer, subscribe_options >> params, typename packet_id_type< PacketIdBytes >::type packet_id, properties props)
Definition: v5_message.hpp:1967
Definition: v5_message.hpp:2447
std::vector< as::const_buffer > const_buffer_sequence() const
Create const buffer sequence it is for boost asio APIs.
Definition: v5_message.hpp:2505
constexpr std::size_t num_of_const_buffer_sequence() const
Get number of element of const_buffer_sequence.
Definition: v5_message.hpp:2538
std::size_t size() const
Get whole size of sequence.
Definition: v5_message.hpp:2527
std::string continuous_buffer() const
Create one continuours buffer. All sequence of buffers are concatinated. It is useful to store to fil...
Definition: v5_message.hpp:2548
basic_unsuback_message(std::vector< v5::unsuback_reason_code > reason_codes, typename packet_id_type< PacketIdBytes >::type packet_id, properties props)
Definition: v5_message.hpp:2449
Definition: v5_message.hpp:2277
std::size_t size() const
Get whole size of sequence.
Definition: v5_message.hpp:2385
std::vector< as::const_buffer > const_buffer_sequence() const
Create const buffer sequence it is for boost asio APIs.
Definition: v5_message.hpp:2359
std::string continuous_buffer() const
Create one continuours buffer. All sequence of buffers are concatinated. It is useful to store to fil...
Definition: v5_message.hpp:2406
constexpr std::size_t num_of_const_buffer_sequence() const
Get number of element of const_buffer_sequence.
Definition: v5_message.hpp:2396
basic_unsubscribe_message(std::vector< as::const_buffer > params, typename packet_id_type< PacketIdBytes >::type packet_id, properties props)
Definition: v5_message.hpp:2290
Definition: v5_message.hpp:405
std::size_t size() const
Get whole size of sequence.
Definition: v5_message.hpp:484
std::vector< as::const_buffer > const_buffer_sequence() const
Create const buffer sequence it is for boost asio APIs.
Definition: v5_message.hpp:463
connack_message(bool session_present, connect_reason_code reason_code, properties props)
Definition: v5_message.hpp:407
constexpr std::size_t num_of_const_buffer_sequence() const
Get number of element of const_buffer_sequence.
Definition: v5_message.hpp:495
std::string continuous_buffer() const
Create one continuours buffer. All sequence of buffers are concatinated. It is useful to store to fil...
Definition: v5_message.hpp:505
Definition: v5_message.hpp:102
std::size_t size() const
Get whole size of sequence.
Definition: v5_message.hpp:298
constexpr std::size_t num_of_const_buffer_sequence() const
Get number of element of const_buffer_sequence.
Definition: v5_message.hpp:309
connect_message(std::uint16_t keep_alive_sec, buffer client_id, bool clean_start, optional< will > w, optional< buffer > user_name, optional< buffer > password, properties props)
Definition: v5_message.hpp:104
std::string continuous_buffer() const
Create one continuours buffer. All sequence of buffers are concatinated. It is useful to store to fil...
Definition: v5_message.hpp:319
std::vector< as::const_buffer > const_buffer_sequence() const
Create const buffer sequence it is for boost asio APIs.
Definition: v5_message.hpp:252
constexpr bool has_password_flag(char v)
Definition: connect_flags.hpp:43
constexpr char const will_retain
Definition: connect_flags.hpp:21
constexpr char const user_name_flag
Definition: connect_flags.hpp:23
constexpr char const will_flag
Definition: connect_flags.hpp:20
constexpr bool has_user_name_flag(char v)
Definition: connect_flags.hpp:47
constexpr char const clean_start
Definition: connect_flags.hpp:19
constexpr void set_will_qos(char &v, qos qos_value)
Definition: connect_flags.hpp:51
constexpr bool has_will_flag(char v)
Definition: connect_flags.hpp:33
constexpr char const password_flag
Definition: connect_flags.hpp:22
constexpr bool is_dup(std::uint8_t v)
Definition: publish.hpp:22
constexpr qos get_qos(std::uint8_t v)
Definition: publish.hpp:26
constexpr void set_dup(std::uint8_t &fixed_header, bool dup)
Definition: publish.hpp:34
constexpr bool is_retain(std::uint8_t v)
Definition: publish.hpp:30
std::vector< property_variant > parse(buffer buf)
Definition: property_parse.hpp:232
id
Definition: property_id.hpp:19
connect_reason_code
Definition: reason_code.hpp:50
std::size_t size(property_variant const &pv)
Definition: property_variant.hpp:117
auth_reason_code
Definition: reason_code.hpp:385
std::size_t num_of_const_buffer_sequence(property_variant const &pv)
Definition: property_variant.hpp:121
void fill(property_variant const &pv, Iterator b, Iterator e)
Definition: property_variant.hpp:127
pubrel_reason_code
Definition: reason_code.hpp:341
puback_reason_code
Definition: reason_code.hpp:269
pubrec_reason_code
Definition: reason_code.hpp:305
pubcomp_reason_code
Definition: reason_code.hpp:363
void add_const_buffer_sequence(std::vector< as::const_buffer > &v, property_variant const &pv)
Definition: property_variant.hpp:109
std::vector< property_variant > properties
Definition: property_variant.hpp:51
disconnect_reason_code
Definition: reason_code.hpp:114
property::id id(property_variant const &pv)
Definition: property_variant.hpp:113
variant< property::payload_format_indicator, property::message_expiry_interval, property::content_type, property::response_topic, property::correlation_data, property::subscription_identifier, property::session_expiry_interval, property::assigned_client_identifier, property::server_keep_alive, property::authentication_method, property::authentication_data, property::request_problem_information, property::will_delay_interval, property::request_response_information, property::response_information, property::server_reference, property::reason_string, property::receive_maximum, property::topic_alias_maximum, property::topic_alias, property::maximum_qos, property::retain_available, property::user_property, property::maximum_packet_size, property::wildcard_subscription_available, property::subscription_identifier_available, property::shared_subscription_available > property_variant
Definition: property_variant.hpp:49
std::string variable_bytes(std::size_t size)
Definition: variable_length.hpp:18
std::string remaining_bytes(std::size_t size)
Definition: remaining_length.hpp:17
boost::string_ref string_view
Definition: string_view.hpp:64
constexpr decltype(auto) visit(Visitor &&vis, Variants &&... vars)
Definition: variant.hpp:60
void utf8string_check(string_view str)
Definition: string_check.hpp:20
constexpr std::tuple< std::size_t, std::size_t > remaining_length(string_view bytes)
Definition: remaining_length.hpp:24
control_packet_type
Definition: control_packet_type.hpp:18
constexpr std::remove_reference_t< T > && force_move(T &&t)
Definition: move.hpp:20
boost::container::static_vector< char, 2 > num_to_2bytes(std::uint16_t val)
Definition: two_byte_util.hpp:20
void add_uint16_t_to_buf(T &buf, std::uint16_t num)
Definition: two_byte_util.hpp:28
dup
Definition: publish.hpp:48
std::size_t num_of_const_buffer_sequence(basic_message_variant< PacketIdBytes > const &mv)
Definition: message_variant.hpp:98
char const * get_pointer(as::const_buffer const &cb)
Definition: const_buffer_util.hpp:17
buffer const * buffer_sequence_end(buffer const &buf)
Definition: buffer.hpp:155
buffer const * buffer_sequence_begin(buffer const &buf)
Definition: buffer.hpp:151
lambda_visitor< Lambdas... > make_lambda_visitor(Lambdas &&... lambdas)
Definition: visitor_util.hpp:37
std::size_t size(basic_message_variant< PacketIdBytes > const &mv)
Definition: message_variant.hpp:93
constexpr std::tuple< std::size_t, std::size_t > variable_length(T const &bytes)
Definition: variable_length.hpp:42
qos
Definition: subscribe_options.hpp:34
constexpr std::uint16_t make_uint16_t(It b, It e)
Definition: two_byte_util.hpp:34
constexpr std::uint8_t make_fixed_header(control_packet_type type, std::uint8_t flags)
Definition: fixed_header.hpp:15
std::size_t get_size(as::const_buffer const &cb)
Definition: const_buffer_util.hpp:21
Definition: buffer.hpp:242
const_buffer buffer(MQTT_NS::buffer const &data)
create boost::asio::const_buffer from the MQTT_NS::buffer boost::asio::const_buffer is a kind of view...
Definition: buffer.hpp:253
Definition: buffer.hpp:241
shared_ptr_array make_shared_ptr_array(std::size_t size)
shared_ptr_array creating function. You can choose the target type.
Definition: two_or_four_byte_util.hpp:52
Definition: two_or_four_byte_util.hpp:33
Definition: exception.hpp:115
Definition: exception.hpp:21
Definition: publish.hpp:53
Definition: exception.hpp:33
Definition: subscribe_options.hpp:40
Definition: v5_message.hpp:2765
auth_message(v5::auth_reason_code reason_code, properties props)
Definition: v5_message.hpp:2766
std::size_t size() const
Get whole size of sequence.
Definition: v5_message.hpp:2870
std::vector< as::const_buffer > const_buffer_sequence() const
Create const buffer sequence it is for boost asio APIs.
Definition: v5_message.hpp:2840
constexpr std::size_t num_of_const_buffer_sequence() const
Get number of element of const_buffer_sequence.
Definition: v5_message.hpp:2881
std::string continuous_buffer() const
Create one continuours buffer. All sequence of buffers are concatinated. It is useful to store to fil...
Definition: v5_message.hpp:2891
Definition: v5_message.hpp:1013
std::string continuous_buffer() const
Create one continuours buffer. All sequence of buffers are concatinated. It is useful to store to fil...
Definition: v5_message.hpp:1168
std::size_t size() const
Get whole size of sequence.
Definition: v5_message.hpp:1147
std::vector< as::const_buffer > const_buffer_sequence() const
Create const buffer sequence it is for boost asio APIs.
Definition: v5_message.hpp:1114
boost::container::static_vector< char, PacketIdBytes > packet_id_
Definition: v5_message.hpp:1206
boost::container::static_vector< char, 4 > property_length_buf_
Definition: v5_message.hpp:1209
constexpr std::size_t num_of_const_buffer_sequence() const
Get number of element of const_buffer_sequence.
Definition: v5_message.hpp:1158
basic_puback_message(typename packet_id_type< PacketIdBytes >::type packet_id, v5::puback_reason_code reason_code, properties props)
Definition: v5_message.hpp:1014
boost::container::static_vector< char, 4 > remaining_length_buf_
Definition: v5_message.hpp:1205
std::size_t remaining_length_
Definition: v5_message.hpp:1204
std::size_t property_length_
Definition: v5_message.hpp:1208
properties props_
Definition: v5_message.hpp:1210
std::size_t num_of_const_buffer_sequence_
Definition: v5_message.hpp:1211
std::uint8_t fixed_header_
Definition: v5_message.hpp:1203
v5::puback_reason_code reason_code_
Definition: v5_message.hpp:1207
Definition: v5_message.hpp:1746
std::size_t num_of_const_buffer_sequence_
Definition: v5_message.hpp:1946
std::uint8_t fixed_header_
Definition: v5_message.hpp:1938
pubcomp_reason_code reason_code_
Definition: v5_message.hpp:1942
basic_pubcomp_message(typename packet_id_type< PacketIdBytes >::type packet_id, pubcomp_reason_code reason_code, properties props)
Definition: v5_message.hpp:1747
boost::container::static_vector< char, PacketIdBytes > packet_id_
Definition: v5_message.hpp:1941
std::size_t property_length_
Definition: v5_message.hpp:1943
std::size_t remaining_length_
Definition: v5_message.hpp:1939
properties props_
Definition: v5_message.hpp:1945
std::vector< as::const_buffer > const_buffer_sequence() const
Create const buffer sequence it is for boost asio APIs.
Definition: v5_message.hpp:1847
std::size_t size() const
Get whole size of sequence.
Definition: v5_message.hpp:1881
boost::container::static_vector< char, 4 > property_length_buf_
Definition: v5_message.hpp:1944
boost::container::static_vector< char, 4 > remaining_length_buf_
Definition: v5_message.hpp:1940
constexpr std::size_t num_of_const_buffer_sequence() const
Get number of element of const_buffer_sequence.
Definition: v5_message.hpp:1892
std::string continuous_buffer() const
Create one continuours buffer. All sequence of buffers are concatinated. It is useful to store to fil...
Definition: v5_message.hpp:1902
Definition: v5_message.hpp:1217
std::uint8_t fixed_header_
Definition: v5_message.hpp:1408
basic_pubrec_message(typename packet_id_type< PacketIdBytes >::type packet_id, pubrec_reason_code reason_code, properties props)
Definition: v5_message.hpp:1218
std::size_t property_length_
Definition: v5_message.hpp:1413
boost::container::static_vector< char, 4 > property_length_buf_
Definition: v5_message.hpp:1414
boost::container::static_vector< char, PacketIdBytes > packet_id_
Definition: v5_message.hpp:1411
std::vector< as::const_buffer > const_buffer_sequence() const
Create const buffer sequence it is for boost asio APIs.
Definition: v5_message.hpp:1318
boost::container::static_vector< char, 4 > remaining_length_buf_
Definition: v5_message.hpp:1410
std::size_t num_of_const_buffer_sequence_
Definition: v5_message.hpp:1416
std::size_t size() const
Get whole size of sequence.
Definition: v5_message.hpp:1351
properties props_
Definition: v5_message.hpp:1415
std::string continuous_buffer() const
Create one continuours buffer. All sequence of buffers are concatinated. It is useful to store to fil...
Definition: v5_message.hpp:1372
constexpr std::size_t num_of_const_buffer_sequence() const
Get number of element of const_buffer_sequence.
Definition: v5_message.hpp:1362
std::size_t remaining_length_
Definition: v5_message.hpp:1409
pubrec_reason_code reason_code_
Definition: v5_message.hpp:1412
Definition: v5_message.hpp:1422
basic_pubrel_message(buffer buf)
Definition: v5_message.hpp:1518
v5::pubrel_reason_code reason_code() const
Get reason_code.
Definition: v5_message.hpp:1719
std::string continuous_buffer() const
Create one continuours buffer. All sequence of buffers are concatinated. It is useful to store to fil...
Definition: v5_message.hpp:1671
std::size_t property_length_
Definition: v5_message.hpp:1736
boost::container::static_vector< char, PacketIdBytes > packet_id_
Definition: v5_message.hpp:1734
boost::container::static_vector< char, 4 > property_length_buf_
Definition: v5_message.hpp:1737
std::size_t size() const
Get whole size of sequence.
Definition: v5_message.hpp:1650
properties const & props() const
Get properties.
Definition: v5_message.hpp:1727
std::vector< as::const_buffer > const_buffer_sequence() const
Create const buffer sequence it is for boost asio APIs.
Definition: v5_message.hpp:1616
boost::container::static_vector< char, 4 > remaining_length_buf_
Definition: v5_message.hpp:1733
constexpr std::size_t num_of_const_buffer_sequence() const
Get number of element of const_buffer_sequence.
Definition: v5_message.hpp:1661
std::size_t remaining_length_
Definition: v5_message.hpp:1732
std::size_t num_of_const_buffer_sequence_
Definition: v5_message.hpp:1739
v5::pubrel_reason_code reason_code_
Definition: v5_message.hpp:1735
basic_pubrel_message(typename packet_id_type< PacketIdBytes >::type packet_id, v5::pubrel_reason_code reason_code, properties props)
Definition: v5_message.hpp:1423
properties props_
Definition: v5_message.hpp:1738
std::uint8_t fixed_header_
Definition: v5_message.hpp:1731
Definition: v5_message.hpp:2597
constexpr std::size_t num_of_const_buffer_sequence() const
Get number of element of const_buffer_sequence.
Definition: v5_message.hpp:2711
disconnect_message(v5::disconnect_reason_code reason_code, properties props)
Definition: v5_message.hpp:2598
std::string continuous_buffer() const
Create one continuours buffer. All sequence of buffers are concatinated. It is useful to store to fil...
Definition: v5_message.hpp:2721
std::size_t size() const
Get whole size of sequence.
Definition: v5_message.hpp:2700
std::vector< as::const_buffer > const_buffer_sequence() const
Create const buffer sequence it is for boost asio APIs.
Definition: v5_message.hpp:2670
Definition: v5_message.hpp:2585
pingreq_message()
Definition: v5_message.hpp:2586
Definition: v5_message.hpp:2591
pingresp_message()
Definition: v5_message.hpp:2592
#define MQTT_ALWAYS_SEND_REASON_CODE
Definition: v5_message.hpp:42