async_mqtt 9.0.1
Loading...
Searching...
No Matches
v3_1_1_connack.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_CONNACK_HPP)
8#define ASYNC_MQTT_PACKET_V3_1_1_CONNACK_HPP
9
10
11#include <async_mqtt/error.hpp>
12#include <async_mqtt/buffer_to_packet_variant.hpp>
13#include <async_mqtt/util/buffer.hpp>
14
15#include <async_mqtt/util/static_vector.hpp>
16
17#include <async_mqtt/packet/control_packet_type.hpp>
18
24namespace async_mqtt::v3_1_1 {
25
26namespace as = boost::asio;
27
45public:
55 bool session_present,
56 connect_return_code return_code
57 );
58
63 static constexpr control_packet_type type() {
65 }
66
72 std::vector<as::const_buffer> const_buffer_sequence() const;
73
78 std::size_t size() const;
79
84 static std::size_t num_of_const_buffer_sequence() {
85 return 1; // all
86 }
87
92 bool session_present() const;
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_connack;
108 friend struct ::ut_packet::v311_connack_error;
109#endif // defined(ASYNC_MQTT_UNIT_TEST_FOR_PACKET)
110
111 // private constructor for internal use
112 explicit connack_packet(buffer buf, error_code& ec);
113
114private:
115 static_vector<char, 4> all_;
116};
117
130bool operator<(connack_packet const& lhs, connack_packet const& rhs);
131
144bool operator==(connack_packet const& lhs, connack_packet const& rhs);
145
158std::ostream& operator<<(std::ostream& o, connack_packet const& v);
159
160} // namespace async_mqtt::v3_1_1
161
162#if !defined(ASYNC_MQTT_SEPARATE_COMPILATION)
163#include <async_mqtt/packet/impl/v3_1_1_connack.ipp>
164#endif // !defined(ASYNC_MQTT_SEPARATE_COMPILATION)
165
166#endif // ASYNC_MQTT_PACKET_V3_1_1_CONNACK_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 CONNACK packet (v3.1.1)
Definition v3_1_1_connack.hpp:44
static constexpr control_packet_type type()
Get MQTT control packet type.
Definition v3_1_1_connack.hpp:63
bool operator<(connack_packet const &lhs, connack_packet const &rhs)
less than operator
static std::size_t num_of_const_buffer_sequence()
Get number of element of const_buffer_sequence.
Definition v3_1_1_connack.hpp:84
bool session_present() const
Get session_present.
bool operator==(connack_packet const &lhs, connack_packet const &rhs)
equal operator
std::size_t size() const
Get packet size.
connect_return_code code() const
Get connect_return_code.
std::ostream & operator<<(std::ostream &o, connack_packet const &v)
stream output operator
connack_packet(bool session_present, connect_return_code return_code)
constructor
std::vector< as::const_buffer > const_buffer_sequence() const
Create const buffer sequence. it is for boost asio APIs.
connect_return_code
connect return code See https://docs.oasis-open.org/mqtt/mqtt/v3.1.1/os/mqtt-v3.1....
Definition error.hpp:194
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