async_mqtt 5.0.0
Loading...
Searching...
No Matches
protocol_version.hpp
Go to the documentation of this file.
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_PROTOCOL_VERSION_HPP)
8#define ASYNC_MQTT_PROTOCOL_VERSION_HPP
9
10#include <cstdint>
11#include <ostream>
12
14
15namespace async_mqtt {
16
20enum class protocol_version {
21 undetermined = 0,
22 v3_1_1 = 4,
23 v5 = 5,
24};
25
30 switch(v) {
31 case protocol_version::undetermined: return "undetermined";
32 case protocol_version::v3_1_1: return "v3_1_1";
33 case protocol_version::v5: return "v5";
34 default: return "unknown_protocol_version";
35 }
36}
37
41inline
42std::ostream& operator<<(std::ostream& os, protocol_version val)
43{
45 return os;
46}
47
48} // namespace async_mqtt
49
50#endif // ASYNC_MQTT_PROTOCOL_VERSION_HPP
Definition packet_variant.hpp:49
protocol_version
MQTT protocol version.
Definition protocol_version.hpp:20
@ undetermined
both v3.1.1 and v5.0 are accepted for broker (server)
constexpr char const * protocol_version_to_str(protocol_version v)
stringize protocol_version
Definition protocol_version.hpp:29