]> git.proxmox.com Git - ceph.git/blame - ceph/src/boost/boost/asio/ssl/impl/error.ipp
bump version to 18.2.4-pve3
[ceph.git] / ceph / src / boost / boost / asio / ssl / impl / error.ipp
CommitLineData
7c673cae
FG
1//
2// ssl/impl/error.ipp
3// ~~~~~~~~~~~~~~~~~~
4//
1e59de90 5// Copyright (c) 2003-2022 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 {
1e59de90
TL
39 const char* reason = ::ERR_reason_error_string(value);
40 if (reason)
41 {
42 const char* lib = ::ERR_lib_error_string(value);
43#if (OPENSSL_VERSION_NUMBER < 0x30000000L)
44 const char* func = ::ERR_func_error_string(value);
45#else // (OPENSSL_VERSION_NUMBER < 0x30000000L)
46 const char* func = 0;
47#endif // (OPENSSL_VERSION_NUMBER < 0x30000000L)
48 std::string result(reason);
49 if (lib || func)
50 {
51 result += " (";
52 if (lib)
53 result += lib;
54 if (lib && func)
55 result += ", ";
56 if (func)
57 result += func;
58 result += ")";
59 }
60 return result;
61 }
62 return "asio.ssl error";
7c673cae
FG
63 }
64};
65
66} // namespace detail
67
68const boost::system::error_category& get_ssl_category()
69{
70 static detail::ssl_category instance;
71 return instance;
72}
73
74} // namespace error
75namespace ssl {
76namespace error {
77
78#if (OPENSSL_VERSION_NUMBER < 0x10100000L) && !defined(OPENSSL_IS_BORINGSSL)
79
80const boost::system::error_category& get_stream_category()
81{
82 return boost::asio::error::get_ssl_category();
83}
84
85#else
86
87namespace detail {
88
89class stream_category : public boost::system::error_category
90{
91public:
92 const char* name() const BOOST_ASIO_ERROR_CATEGORY_NOEXCEPT
93 {
94 return "asio.ssl.stream";
95 }
96
97 std::string message(int value) const
98 {
99 switch (value)
100 {
101 case stream_truncated: return "stream truncated";
92f5a8d4
TL
102 case unspecified_system_error: return "unspecified system error";
103 case unexpected_result: return "unexpected result";
7c673cae
FG
104 default: return "asio.ssl.stream error";
105 }
106 }
107};
108
109} // namespace detail
110
111const boost::system::error_category& get_stream_category()
112{
113 static detail::stream_category instance;
114 return instance;
115}
116
117#endif
118
119} // namespace error
120} // namespace ssl
121} // namespace asio
122} // namespace boost
123
124#include <boost/asio/detail/pop_options.hpp>
125
126#endif // BOOST_ASIO_SSL_IMPL_ERROR_IPP