async_mqtt 9.0.1
Loading...
Searching...
No Matches
v5_pingreq.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_PINGREQ_HPP)
8#define ASYNC_MQTT_PACKET_V5_PINGREQ_HPP
9
10#include <async_mqtt/buffer_to_packet_variant.hpp>
11#include <async_mqtt/error.hpp>
12
13#include <async_mqtt/packet/control_packet_type.hpp>
14
15#include <async_mqtt/util/buffer.hpp>
16#include <async_mqtt/util/move.hpp>
17#include <async_mqtt/util/static_vector.hpp>
18
19
25namespace async_mqtt::v5 {
26
27namespace as = boost::asio;
28
51public:
52
56 explicit pingreq_packet();
57
62 static constexpr control_packet_type type() {
64 }
65
71 std::vector<as::const_buffer> const_buffer_sequence() const;
72
77 std::size_t size() const;
78
83 static constexpr std::size_t num_of_const_buffer_sequence() {
84 return 1; // all
85 }
86
87private:
88
89 template <std::size_t PacketIdBytesArg>
92
93#if defined(ASYNC_MQTT_UNIT_TEST_FOR_PACKET)
94 friend struct ::ut_packet::v5_pingreq;
95 friend struct ::ut_packet::v5_pingreq_error;
96#endif // defined(ASYNC_MQTT_UNIT_TEST_FOR_PACKET)
97
98 // private constructor for internal use
99 explicit pingreq_packet(buffer buf, error_code& ec);
100
101private:
102 static_vector<char, 2> all_;
103};
104
117bool operator<(pingreq_packet const& lhs, pingreq_packet const& rhs);
118
131bool operator==(pingreq_packet const& lhs, pingreq_packet const& rhs);
132
145std::ostream& operator<<(std::ostream& o, pingreq_packet const& v);
146
147} // namespace async_mqtt::v5
148
149#if !defined(ASYNC_MQTT_SEPARATE_COMPILATION)
150#include <async_mqtt/packet/impl/v5_pingreq.ipp>
151#endif // !defined(ASYNC_MQTT_SEPARATE_COMPILATION)
152
153#endif // ASYNC_MQTT_PACKET_V5_PINGREQ_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 PINGREQ packet (v5)
Definition v5_pingreq.hpp:50
std::ostream & operator<<(std::ostream &o, pingreq_packet const &v)
stream output operator
static constexpr std::size_t num_of_const_buffer_sequence()
Get number of element of const_buffer_sequence.
Definition v5_pingreq.hpp:83
std::vector< as::const_buffer > const_buffer_sequence() const
Create const buffer sequence it is for boost asio APIs.
bool operator<(pingreq_packet const &lhs, pingreq_packet const &rhs)
less than operator
std::size_t size() const
Get packet size.
bool operator==(pingreq_packet const &lhs, pingreq_packet const &rhs)
equal operator
static constexpr control_packet_type type()
Get MQTT control packet type.
Definition v5_pingreq.hpp:62
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