async_mqtt 9.0.1
Loading...
Searching...
No Matches
v3_1_1_puback.hpp
1// Copyright Takatoshi Kondo 2022
2//
3// Distributed under the Boost Software License, Version 1.0.
4// (See accompanying file LICENSE_1_0.txt or copy at
5// http://www.boost.org/LICENSE_1_0.txt)
6
7#if !defined(ASYNC_MQTT_PACKET_V3_1_1_PUBACK_HPP)
8#define ASYNC_MQTT_PACKET_V3_1_1_PUBACK_HPP
9
10#include <async_mqtt/buffer_to_packet_variant.hpp>
11
12#include <async_mqtt/packet/control_packet_type.hpp>
13#include <async_mqtt/packet/packet_id_type.hpp>
14
15#include <async_mqtt/util/buffer.hpp>
16#include <async_mqtt/util/static_vector.hpp>
17
18
29namespace async_mqtt::v3_1_1 {
30
31namespace as = boost::asio;
32
53template <std::size_t PacketIdBytes>
55public:
56
63 );
64
69 static constexpr control_packet_type type() {
71 }
72
78 std::vector<as::const_buffer> const_buffer_sequence() const;
79
84 std::size_t size() const;
85
90 static constexpr std::size_t num_of_const_buffer_sequence() {
91 return 1; // all
92 }
93
99
100private:
101
102 template <std::size_t PacketIdBytesArg>
105
106#if defined(ASYNC_MQTT_UNIT_TEST_FOR_PACKET)
107 friend struct ::ut_packet::v311_puback;
108 friend struct ::ut_packet::v311_puback_pid4;
109 friend struct ::ut_packet::v311_puback_error;
110#endif // defined(ASYNC_MQTT_UNIT_TEST_FOR_PACKET)
111
112 // private constructor for internal use
113 explicit basic_puback_packet(buffer buf, error_code& ec);
114
115private:
116 static_vector<char, 2 + PacketIdBytes> all_;
117};
118
131template <std::size_t PacketIdBytes>
133
146template <std::size_t PacketIdBytes>
148
161template <std::size_t PacketIdBytes>
162std::ostream& operator<<(std::ostream& o, basic_puback_packet<PacketIdBytes> const& v);
163
175
176} // namespace async_mqtt::v3_1_1
177
178#if !defined(ASYNC_MQTT_SEPARATE_COMPILATION)
179#include <async_mqtt/packet/impl/v3_1_1_puback.ipp>
180#endif // !defined(ASYNC_MQTT_SEPARATE_COMPILATION)
181
182#endif // ASYNC_MQTT_PACKET_V3_1_1_PUBACK_HPP
The varaint type of all packets and system_error.
Definition packet_variant_fwd.hpp:37
buffer that has string_view interface and shared ownership This class is only for advanced usecase su...
Definition buffer.hpp:46
MQTT PUBACK packet (v3.1.1)
Definition v3_1_1_puback.hpp:54
bool operator<(basic_puback_packet< PacketIdBytes > const &lhs, basic_puback_packet< PacketIdBytes > const &rhs)
less than operator
basic_puback_packet(typename basic_packet_id_type< PacketIdBytes >::type packet_id)
constructor
static constexpr std::size_t num_of_const_buffer_sequence()
Get number of element of const_buffer_sequence.
Definition v3_1_1_puback.hpp:90
basic_packet_id_type< PacketIdBytes >::type packet_id() const
Get packet_id.
std::vector< as::const_buffer > const_buffer_sequence() const
Create const buffer sequence it is for boost asio APIs.
std::ostream & operator<<(std::ostream &o, basic_puback_packet< PacketIdBytes > const &v)
stream output operator
std::size_t size() const
Get packet size.
static constexpr control_packet_type type()
Get MQTT control packet type.
Definition v3_1_1_puback.hpp:69
bool operator==(basic_puback_packet< PacketIdBytes > const &lhs, basic_puback_packet< PacketIdBytes > const &rhs)
equal operator
sys::error_code error_code
sys is a namespace alias of boost::sytem.
Definition error.hpp:56
protocol_version
MQTT protocol version.
Definition protocol_version.hpp:29
basic_packet_variant< PacketIdBytes > buffer_to_basic_packet_variant(buffer buf, protocol_version ver, error_code &ec)
create basic_packet_variant from the buffer
control_packet_type
MQTT control packet type.
Definition control_packet_type.hpp:26
packet idenfitifer type class template
Definition packet_id_type.hpp:25