async_mqtt 9.0.1
Loading...
Searching...
No Matches
v5_pingresp.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_V5_PINGRESP_HPP)
8#define ASYNC_MQTT_PACKET_V5_PINGRESP_HPP
9
10#include <utility>
11#include <numeric>
12
13#include <boost/numeric/conversion/cast.hpp>
14
15#include <async_mqtt/buffer_to_packet_variant.hpp>
16#include <async_mqtt/error.hpp>
17
18#include <async_mqtt/packet/control_packet_type.hpp>
19
20#include <async_mqtt/util/buffer.hpp>
21#include <async_mqtt/util/move.hpp>
22#include <async_mqtt/util/static_vector.hpp>
23#include <async_mqtt/util/endian_convert.hpp>
24
25
31namespace async_mqtt::v5 {
32
33namespace as = boost::asio;
34
58public:
59
63 explicit pingresp_packet();
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
94private:
95
96 template <std::size_t PacketIdBytesArg>
99
100#if defined(ASYNC_MQTT_UNIT_TEST_FOR_PACKET)
101 friend struct ::ut_packet::v5_pingresp;
102 friend struct ::ut_packet::v5_pingresp_error;
103#endif // defined(ASYNC_MQTT_UNIT_TEST_FOR_PACKET)
104
105 // private constructor for internal use
106 explicit pingresp_packet(buffer buf, error_code& ec);
107
108private:
109 static_vector<char, 2> all_;
110};
111
124bool operator<(pingresp_packet const& lhs, pingresp_packet const& rhs);
125
138bool operator==(pingresp_packet const& lhs, pingresp_packet const& rhs);
139
152std::ostream& operator<<(std::ostream& o, pingresp_packet const& v);
153
154} // namespace async_mqtt::v5
155
156#if !defined(ASYNC_MQTT_SEPARATE_COMPILATION)
157#include <async_mqtt/packet/impl/v5_pingresp.ipp>
158#endif // !defined(ASYNC_MQTT_SEPARATE_COMPILATION)
159
160#endif // ASYNC_MQTT_PACKET_V5_PINGRESP_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 PINGRESP packet (v5)
Definition v5_pingresp.hpp:57
std::size_t size() const
Get packet size.
bool operator==(pingresp_packet const &lhs, pingresp_packet const &rhs)
equal operator
static constexpr control_packet_type type()
Get MQTT control packet type.
Definition v5_pingresp.hpp:69
static constexpr std::size_t num_of_const_buffer_sequence()
Get number of element of const_buffer_sequence.
Definition v5_pingresp.hpp:90
bool operator<(pingresp_packet const &lhs, pingresp_packet const &rhs)
less than operator
std::ostream & operator<<(std::ostream &o, pingresp_packet const &v)
stream output operator
std::vector< as::const_buffer > const_buffer_sequence() const
Create const buffer sequence it is for boost asio APIs.
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