async_mqtt 9.0.1
Loading...
Searching...
No Matches
protocol_version.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_PROTOCOL_VERSION_HPP)
8#define ASYNC_MQTT_PROTOCOL_VERSION_HPP
9
10#include <cstdint>
11#include <ostream>
12
18namespace async_mqtt {
19
29enum class protocol_version {
30 undetermined = 0,
31 v3_1_1 = 4,
32 v5 = 5,
33};
34
46constexpr char const* protocol_version_to_str(protocol_version v) {
47 switch(v) {
48 case protocol_version::undetermined: return "undetermined";
49 case protocol_version::v3_1_1: return "v3_1_1";
50 case protocol_version::v5: return "v5";
51 default: return "unknown_protocol_version";
52 }
53}
54
67inline
68std::ostream& operator<<(std::ostream& os, protocol_version val)
69{
70 os << protocol_version_to_str(val);
71 return os;
72}
73
74} // namespace async_mqtt
75
76#endif // ASYNC_MQTT_PROTOCOL_VERSION_HPP
std::ostream & operator<<(std::ostream &o, mqtt_error v)
output to the stream
protocol_version
MQTT protocol version.
Definition protocol_version.hpp:29
constexpr char const * protocol_version_to_str(protocol_version v)
stringize protocol_version
Definition protocol_version.hpp:46
@ undetermined
both v3.1.1 and v5.0 are accepted for broker (server)