Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:29:02

0001 //
0002 // ssl/error.hpp
0003 // ~~~~~~~~~~~~~
0004 //
0005 // Copyright (c) 2003-2023 Christopher M. Kohlhoff (chris at kohlhoff dot com)
0006 //
0007 // Distributed under the Boost Software License, Version 1.0. (See accompanying
0008 // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
0009 //
0010 
0011 #ifndef BOOST_ASIO_SSL_ERROR_HPP
0012 #define BOOST_ASIO_SSL_ERROR_HPP
0013 
0014 #if defined(_MSC_VER) && (_MSC_VER >= 1200)
0015 # pragma once
0016 #endif // defined(_MSC_VER) && (_MSC_VER >= 1200)
0017 
0018 #include <boost/asio/detail/config.hpp>
0019 #include <boost/system/error_code.hpp>
0020 #include <boost/asio/ssl/detail/openssl_types.hpp>
0021 
0022 #include <boost/asio/detail/push_options.hpp>
0023 
0024 namespace boost {
0025 namespace asio {
0026 namespace error {
0027 
0028 enum ssl_errors
0029 {
0030   // Error numbers are those produced by openssl.
0031 };
0032 
0033 extern BOOST_ASIO_DECL
0034 const boost::system::error_category& get_ssl_category();
0035 
0036 static const boost::system::error_category&
0037   ssl_category BOOST_ASIO_UNUSED_VARIABLE
0038   = boost::asio::error::get_ssl_category();
0039 
0040 } // namespace error
0041 namespace ssl {
0042 namespace error {
0043 
0044 enum stream_errors
0045 {
0046 #if defined(GENERATING_DOCUMENTATION)
0047   /// The underlying stream closed before the ssl stream gracefully shut down.
0048   stream_truncated,
0049 
0050   /// The underlying SSL library returned a system error without providing
0051   /// further information.
0052   unspecified_system_error,
0053 
0054   /// The underlying SSL library generated an unexpected result from a function
0055   /// call.
0056   unexpected_result
0057 #else // defined(GENERATING_DOCUMENTATION)
0058 # if (OPENSSL_VERSION_NUMBER < 0x10100000L) \
0059     && !defined(OPENSSL_IS_BORINGSSL) \
0060     && !defined(BOOST_ASIO_USE_WOLFSSL)
0061   stream_truncated = ERR_PACK(ERR_LIB_SSL, 0, SSL_R_SHORT_READ),
0062 # else
0063   stream_truncated = 1,
0064 # endif
0065   unspecified_system_error = 2,
0066   unexpected_result = 3
0067 #endif // defined(GENERATING_DOCUMENTATION)
0068 };
0069 
0070 extern BOOST_ASIO_DECL
0071 const boost::system::error_category& get_stream_category();
0072 
0073 static const boost::system::error_category&
0074   stream_category BOOST_ASIO_UNUSED_VARIABLE
0075   = boost::asio::ssl::error::get_stream_category();
0076 
0077 } // namespace error
0078 } // namespace ssl
0079 } // namespace asio
0080 } // namespace boost
0081 
0082 namespace boost {
0083 namespace system {
0084 
0085 template<> struct is_error_code_enum<boost::asio::error::ssl_errors>
0086 {
0087   static const bool value = true;
0088 };
0089 
0090 template<> struct is_error_code_enum<boost::asio::ssl::error::stream_errors>
0091 {
0092   static const bool value = true;
0093 };
0094 
0095 } // namespace system
0096 } // namespace boost
0097 
0098 namespace boost {
0099 namespace asio {
0100 namespace error {
0101 
0102 inline boost::system::error_code make_error_code(ssl_errors e)
0103 {
0104   return boost::system::error_code(
0105       static_cast<int>(e), get_ssl_category());
0106 }
0107 
0108 } // namespace error
0109 namespace ssl {
0110 namespace error {
0111 
0112 inline boost::system::error_code make_error_code(stream_errors e)
0113 {
0114   return boost::system::error_code(
0115       static_cast<int>(e), get_stream_category());
0116 }
0117 
0118 } // namespace error
0119 } // namespace ssl
0120 } // namespace asio
0121 } // namespace boost
0122 
0123 #include <boost/asio/detail/pop_options.hpp>
0124 
0125 #if defined(BOOST_ASIO_HEADER_ONLY)
0126 # include <boost/asio/ssl/impl/error.ipp>
0127 #endif // defined(BOOST_ASIO_HEADER_ONLY)
0128 
0129 #endif // BOOST_ASIO_SSL_ERROR_HPP