]> git.proxmox.com Git - ceph.git/blame - ceph/src/boost/boost/asio/ssl/impl/error.ipp
import new upstream nautilus stable release 14.2.8
[ceph.git] / ceph / src / boost / boost / asio / ssl / impl / error.ipp
CommitLineData
7c673cae
FG
1//
2// ssl/impl/error.ipp
3// ~~~~~~~~~~~~~~~~~~
4//
92f5a8d4 5// Copyright (c) 2003-2019 Christopher M. Kohlhoff (chris at kohlhoff dot com)
7c673cae
FG
6//
7// Distributed under the Boost Software License, Version 1.0. (See accompanying
8// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
9//
10
11#ifndef BOOST_ASIO_SSL_IMPL_ERROR_IPP
12#define BOOST_ASIO_SSL_IMPL_ERROR_IPP
13
14#if defined(_MSC_VER) && (_MSC_VER >= 1200)
15# pragma once
16#endif // defined(_MSC_VER) && (_MSC_VER >= 1200)
17
18#include <boost/asio/detail/config.hpp>
19#include <boost/asio/ssl/error.hpp>
20#include <boost/asio/ssl/detail/openssl_init.hpp>
21
22#include <boost/asio/detail/push_options.hpp>
23
24namespace boost {
25namespace asio {
26namespace error {
27namespace detail {
28
29class ssl_category : public boost::system::error_category
30{
31public:
32 const char* name() const BOOST_ASIO_ERROR_CATEGORY_NOEXCEPT
33 {
34 return "asio.ssl";
35 }
36
37 std::string message(int value) const
38 {
39 const char* s = ::ERR_reason_error_string(value);
40 return s ? s : "asio.ssl error";
41 }
42};
43
44} // namespace detail
45
46const boost::system::error_category& get_ssl_category()
47{
48 static detail::ssl_category instance;
49 return instance;
50}
51
52} // namespace error
53namespace ssl {
54namespace error {
55
56#if (OPENSSL_VERSION_NUMBER < 0x10100000L) && !defined(OPENSSL_IS_BORINGSSL)
57
58const boost::system::error_category& get_stream_category()
59{
60 return boost::asio::error::get_ssl_category();
61}
62
63#else
64
65namespace detail {
66
67class stream_category : public boost::system::error_category
68{
69public:
70 const char* name() const BOOST_ASIO_ERROR_CATEGORY_NOEXCEPT
71 {
72 return "asio.ssl.stream";
73 }
74
75 std::string message(int value) const
76 {
77 switch (value)
78 {
79 case stream_truncated: return "stream truncated";
92f5a8d4
TL
80 case unspecified_system_error: return "unspecified system error";
81 case unexpected_result: return "unexpected result";
7c673cae
FG
82 default: return "asio.ssl.stream error";
83 }
84 }
85};
86
87} // namespace detail
88
89const boost::system::error_category& get_stream_category()
90{
91 static detail::stream_category instance;
92 return instance;
93}
94
95#endif
96
97} // namespace error
98} // namespace ssl
99} // namespace asio
100} // namespace boost
101
102#include <boost/asio/detail/pop_options.hpp>
103
104#endif // BOOST_ASIO_SSL_IMPL_ERROR_IPP