Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:28:55

0001 //
0002 // impl/error.ipp
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_IMPL_ERROR_IPP
0012 #define BOOST_ASIO_IMPL_ERROR_IPP
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 <string>
0020 #include <boost/asio/error.hpp>
0021 
0022 #include <boost/asio/detail/push_options.hpp>
0023 
0024 namespace boost {
0025 namespace asio {
0026 namespace error {
0027 
0028 #if !defined(BOOST_ASIO_WINDOWS) && !defined(__CYGWIN__)
0029 
0030 namespace detail {
0031 
0032 class netdb_category : public boost::system::error_category
0033 {
0034 public:
0035   const char* name() const noexcept
0036   {
0037     return "asio.netdb";
0038   }
0039 
0040   std::string message(int value) const
0041   {
0042     if (value == error::host_not_found)
0043       return "Host not found (authoritative)";
0044     if (value == error::host_not_found_try_again)
0045       return "Host not found (non-authoritative), try again later";
0046     if (value == error::no_data)
0047       return "The query is valid, but it does not have associated data";
0048     if (value == error::no_recovery)
0049       return "A non-recoverable error occurred during database lookup";
0050     return "asio.netdb error";
0051   }
0052 };
0053 
0054 } // namespace detail
0055 
0056 const boost::system::error_category& get_netdb_category()
0057 {
0058   static detail::netdb_category instance;
0059   return instance;
0060 }
0061 
0062 namespace detail {
0063 
0064 class addrinfo_category : public boost::system::error_category
0065 {
0066 public:
0067   const char* name() const noexcept
0068   {
0069     return "asio.addrinfo";
0070   }
0071 
0072   std::string message(int value) const
0073   {
0074     if (value == error::service_not_found)
0075       return "Service not found";
0076     if (value == error::socket_type_not_supported)
0077       return "Socket type not supported";
0078     return "asio.addrinfo error";
0079   }
0080 };
0081 
0082 } // namespace detail
0083 
0084 const boost::system::error_category& get_addrinfo_category()
0085 {
0086   static detail::addrinfo_category instance;
0087   return instance;
0088 }
0089 
0090 #endif // !defined(BOOST_ASIO_WINDOWS) && !defined(__CYGWIN__)
0091 
0092 namespace detail {
0093 
0094 class misc_category : public boost::system::error_category
0095 {
0096 public:
0097   const char* name() const noexcept
0098   {
0099     return "asio.misc";
0100   }
0101 
0102   std::string message(int value) const
0103   {
0104     if (value == error::already_open)
0105       return "Already open";
0106     if (value == error::eof)
0107       return "End of file";
0108     if (value == error::not_found)
0109       return "Element not found";
0110     if (value == error::fd_set_failure)
0111       return "The descriptor does not fit into the select call's fd_set";
0112     return "asio.misc error";
0113   }
0114 };
0115 
0116 } // namespace detail
0117 
0118 const boost::system::error_category& get_misc_category()
0119 {
0120   static detail::misc_category instance;
0121   return instance;
0122 }
0123 
0124 } // namespace error
0125 } // namespace asio
0126 } // namespace boost
0127 
0128 #include <boost/asio/detail/pop_options.hpp>
0129 
0130 #endif // BOOST_ASIO_IMPL_ERROR_IPP