mqtt_cpp
include
mqtt
connect_return_code.hpp
Go to the documentation of this file.
1
// Copyright Takatoshi Kondo 2015
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(MQTT_CONNECT_RETURN_CODE_HPP)
8
#define MQTT_CONNECT_RETURN_CODE_HPP
9
10
#include <cstdint>
11
#include <ostream>
12
13
#include <
mqtt/namespace.hpp
>
14
15
namespace
MQTT_NS
{
16
17
enum class
connect_return_code
: std::uint8_t {
18
19
accepted
= 0,
20
unacceptable_protocol_version
= 1,
21
identifier_rejected
= 2,
22
server_unavailable
= 3,
23
bad_user_name_or_password
= 4,
24
not_authorized
= 5,
25
26
};
27
28
constexpr
29
char
const
*
connect_return_code_to_str
(
connect_return_code
v) {
30
char
const
*
const
str[] = {
31
"accepted"
,
32
"unacceptable_protocol_version"
,
33
"identifier_rejected"
,
34
"server_unavailable"
,
35
"bad_user_name_or_password"
,
36
"not_authorized"
37
};
38
if
(
static_cast<
std::uint8_t
>
(v) <
sizeof
(str))
return
str[
static_cast<
std::uint8_t
>
(v)];
39
return
"unknown_connect_return_code"
;
40
}
41
42
inline
43
std::ostream&
operator<<
(std::ostream& os,
connect_return_code
val)
44
{
45
os <<
connect_return_code_to_str
(val);
46
return
os;
47
}
48
49
}
// namespace MQTT_NS
50
51
#endif
// MQTT_CONNECT_RETURN_CODE_HPP
MQTT_NS
Definition:
any.hpp:27
MQTT_NS::connect_return_code_to_str
constexpr char const * connect_return_code_to_str(connect_return_code v)
Definition:
connect_return_code.hpp:29
MQTT_NS::connect_return_code
connect_return_code
Definition:
connect_return_code.hpp:17
MQTT_NS::connect_return_code::accepted
@ accepted
MQTT_NS::connect_return_code::identifier_rejected
@ identifier_rejected
MQTT_NS::connect_return_code::not_authorized
@ not_authorized
MQTT_NS::connect_return_code::unacceptable_protocol_version
@ unacceptable_protocol_version
MQTT_NS::connect_return_code::bad_user_name_or_password
@ bad_user_name_or_password
MQTT_NS::connect_return_code::server_unavailable
@ server_unavailable
MQTT_NS::operator<<
std::ostream & operator<<(std::ostream &os, connect_return_code val)
Definition:
connect_return_code.hpp:43
namespace.hpp
Generated by
1.9.1