Chris@16: // Chris@16: // impl/error.ipp Chris@16: // ~~~~~~~~~~~~~~ Chris@16: // Chris@101: // Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com) Chris@16: // Chris@16: // Distributed under the Boost Software License, Version 1.0. (See accompanying Chris@16: // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) Chris@16: // Chris@16: Chris@16: #ifndef BOOST_ASIO_IMPL_ERROR_IPP Chris@16: #define BOOST_ASIO_IMPL_ERROR_IPP Chris@16: Chris@16: #if defined(_MSC_VER) && (_MSC_VER >= 1200) Chris@16: # pragma once Chris@16: #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) Chris@16: Chris@16: #include Chris@101: #include Chris@16: #include Chris@16: Chris@16: #include Chris@16: Chris@16: namespace boost { Chris@16: namespace asio { Chris@16: namespace error { Chris@16: Chris@16: #if !defined(BOOST_ASIO_WINDOWS) && !defined(__CYGWIN__) Chris@16: Chris@16: namespace detail { Chris@16: Chris@16: class netdb_category : public boost::system::error_category Chris@16: { Chris@16: public: Chris@16: const char* name() const BOOST_ASIO_ERROR_CATEGORY_NOEXCEPT Chris@16: { Chris@16: return "asio.netdb"; Chris@16: } Chris@16: Chris@16: std::string message(int value) const Chris@16: { Chris@16: if (value == error::host_not_found) Chris@16: return "Host not found (authoritative)"; Chris@16: if (value == error::host_not_found_try_again) Chris@16: return "Host not found (non-authoritative), try again later"; Chris@16: if (value == error::no_data) Chris@16: return "The query is valid, but it does not have associated data"; Chris@16: if (value == error::no_recovery) Chris@16: return "A non-recoverable error occurred during database lookup"; Chris@16: return "asio.netdb error"; Chris@16: } Chris@16: }; Chris@16: Chris@16: } // namespace detail Chris@16: Chris@16: const boost::system::error_category& get_netdb_category() Chris@16: { Chris@16: static detail::netdb_category instance; Chris@16: return instance; Chris@16: } Chris@16: Chris@16: namespace detail { Chris@16: Chris@16: class addrinfo_category : public boost::system::error_category Chris@16: { Chris@16: public: Chris@16: const char* name() const BOOST_ASIO_ERROR_CATEGORY_NOEXCEPT Chris@16: { Chris@16: return "asio.addrinfo"; Chris@16: } Chris@16: Chris@16: std::string message(int value) const Chris@16: { Chris@16: if (value == error::service_not_found) Chris@16: return "Service not found"; Chris@16: if (value == error::socket_type_not_supported) Chris@16: return "Socket type not supported"; Chris@16: return "asio.addrinfo error"; Chris@16: } Chris@16: }; Chris@16: Chris@16: } // namespace detail Chris@16: Chris@16: const boost::system::error_category& get_addrinfo_category() Chris@16: { Chris@16: static detail::addrinfo_category instance; Chris@16: return instance; Chris@16: } Chris@16: Chris@16: #endif // !defined(BOOST_ASIO_WINDOWS) && !defined(__CYGWIN__) Chris@16: Chris@16: namespace detail { Chris@16: Chris@16: class misc_category : public boost::system::error_category Chris@16: { Chris@16: public: Chris@16: const char* name() const BOOST_ASIO_ERROR_CATEGORY_NOEXCEPT Chris@16: { Chris@16: return "asio.misc"; Chris@16: } Chris@16: Chris@16: std::string message(int value) const Chris@16: { Chris@16: if (value == error::already_open) Chris@16: return "Already open"; Chris@16: if (value == error::eof) Chris@16: return "End of file"; Chris@16: if (value == error::not_found) Chris@16: return "Element not found"; Chris@16: if (value == error::fd_set_failure) Chris@16: return "The descriptor does not fit into the select call's fd_set"; Chris@16: return "asio.misc error"; Chris@16: } Chris@16: }; Chris@16: Chris@16: } // namespace detail Chris@16: Chris@16: const boost::system::error_category& get_misc_category() Chris@16: { Chris@16: static detail::misc_category instance; Chris@16: return instance; Chris@16: } Chris@16: Chris@16: } // namespace error Chris@16: } // namespace asio Chris@16: } // namespace boost Chris@16: Chris@16: #include Chris@16: Chris@16: #endif // BOOST_ASIO_IMPL_ERROR_IPP