]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/boost/asio/ssl/impl/error.ipp
update sources to v12.2.3
[ceph.git] / ceph / src / boost / boost / asio / ssl / impl / error.ipp
1 //
2 // ssl/impl/error.ipp
3 // ~~~~~~~~~~~~~~~~~~
4 //
5 // Copyright (c) 2003-2017 Christopher M. Kohlhoff (chris at kohlhoff dot com)
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
24 namespace boost {
25 namespace asio {
26 namespace error {
27 namespace detail {
28
29 class ssl_category : public boost::system::error_category
30 {
31 public:
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
46 const boost::system::error_category& get_ssl_category()
47 {
48 static detail::ssl_category instance;
49 return instance;
50 }
51
52 } // namespace error
53 namespace ssl {
54 namespace error {
55
56 #if (OPENSSL_VERSION_NUMBER < 0x10100000L) && !defined(OPENSSL_IS_BORINGSSL)
57
58 const boost::system::error_category& get_stream_category()
59 {
60 return boost::asio::error::get_ssl_category();
61 }
62
63 #else
64
65 namespace detail {
66
67 class stream_category : public boost::system::error_category
68 {
69 public:
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";
80 default: return "asio.ssl.stream error";
81 }
82 }
83 };
84
85 } // namespace detail
86
87 const boost::system::error_category& get_stream_category()
88 {
89 static detail::stream_category instance;
90 return instance;
91 }
92
93 #endif
94
95 } // namespace error
96 } // namespace ssl
97 } // namespace asio
98 } // namespace boost
99
100 #include <boost/asio/detail/pop_options.hpp>
101
102 #endif // BOOST_ASIO_SSL_IMPL_ERROR_IPP