10ee85db398be8ea33d67cc42f99a1468cd6c8180François Gaffie//
20ee85db398be8ea33d67cc42f99a1468cd6c8180François Gaffie// error.hpp
30ee85db398be8ea33d67cc42f99a1468cd6c8180François Gaffie// ~~~~~~~~~
40ee85db398be8ea33d67cc42f99a1468cd6c8180François Gaffie//
50ee85db398be8ea33d67cc42f99a1468cd6c8180François Gaffie// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com)
60ee85db398be8ea33d67cc42f99a1468cd6c8180François Gaffie//
70ee85db398be8ea33d67cc42f99a1468cd6c8180François Gaffie// Distributed under the Boost Software License, Version 1.0. (See accompanying
80ee85db398be8ea33d67cc42f99a1468cd6c8180François Gaffie// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
90ee85db398be8ea33d67cc42f99a1468cd6c8180François Gaffie//
100ee85db398be8ea33d67cc42f99a1468cd6c8180François Gaffie
110ee85db398be8ea33d67cc42f99a1468cd6c8180François Gaffie#ifndef ASIO_ERROR_HPP
120ee85db398be8ea33d67cc42f99a1468cd6c8180François Gaffie#define ASIO_ERROR_HPP
130ee85db398be8ea33d67cc42f99a1468cd6c8180François Gaffie
140ee85db398be8ea33d67cc42f99a1468cd6c8180François Gaffie
150ee85db398be8ea33d67cc42f99a1468cd6c8180François Gaffie#include "asio/detail/config.hpp"
160ee85db398be8ea33d67cc42f99a1468cd6c8180François Gaffie#include "asio/error_code.hpp"
170ee85db398be8ea33d67cc42f99a1468cd6c8180François Gaffie#include "asio/system_error.hpp"
180ee85db398be8ea33d67cc42f99a1468cd6c8180François Gaffie# include <cerrno>
190ee85db398be8ea33d67cc42f99a1468cd6c8180François Gaffie# include <netdb.h>
200ee85db398be8ea33d67cc42f99a1468cd6c8180François Gaffie
210ee85db398be8ea33d67cc42f99a1468cd6c8180François Gaffie# define ASIO_NATIVE_ERROR(e) e
220ee85db398be8ea33d67cc42f99a1468cd6c8180François Gaffie# define ASIO_SOCKET_ERROR(e) e
230ee85db398be8ea33d67cc42f99a1468cd6c8180François Gaffie# define ASIO_NETDB_ERROR(e) e
240ee85db398be8ea33d67cc42f99a1468cd6c8180François Gaffie# define ASIO_GETADDRINFO_ERROR(e) e
250ee85db398be8ea33d67cc42f99a1468cd6c8180François Gaffie# define ASIO_WIN_OR_POSIX(e_win, e_posix) e_posix
260ee85db398be8ea33d67cc42f99a1468cd6c8180François Gaffie
270ee85db398be8ea33d67cc42f99a1468cd6c8180François Gaffie#include "asio/detail/push_options.hpp"
280ee85db398be8ea33d67cc42f99a1468cd6c8180François Gaffie
290ee85db398be8ea33d67cc42f99a1468cd6c8180François Gaffienamespace asio {
300ee85db398be8ea33d67cc42f99a1468cd6c8180François Gaffienamespace error {
310ee85db398be8ea33d67cc42f99a1468cd6c8180François Gaffie
320ee85db398be8ea33d67cc42f99a1468cd6c8180François Gaffieenum basic_errors
330ee85db398be8ea33d67cc42f99a1468cd6c8180François Gaffie{
340ee85db398be8ea33d67cc42f99a1468cd6c8180François Gaffie  /// Permission denied.
350ee85db398be8ea33d67cc42f99a1468cd6c8180François Gaffie  access_denied = ASIO_SOCKET_ERROR(EACCES),
360ee85db398be8ea33d67cc42f99a1468cd6c8180François Gaffie
370ee85db398be8ea33d67cc42f99a1468cd6c8180François Gaffie  /// Address family not supported by protocol.
380ee85db398be8ea33d67cc42f99a1468cd6c8180François Gaffie  address_family_not_supported = ASIO_SOCKET_ERROR(EAFNOSUPPORT),
390ee85db398be8ea33d67cc42f99a1468cd6c8180François Gaffie
400ee85db398be8ea33d67cc42f99a1468cd6c8180François Gaffie  /// Address already in use.
410ee85db398be8ea33d67cc42f99a1468cd6c8180François Gaffie  address_in_use = ASIO_SOCKET_ERROR(EADDRINUSE),
420ee85db398be8ea33d67cc42f99a1468cd6c8180François Gaffie
430ee85db398be8ea33d67cc42f99a1468cd6c8180François Gaffie  /// Transport endpoint is already connected.
440ee85db398be8ea33d67cc42f99a1468cd6c8180François Gaffie  already_connected = ASIO_SOCKET_ERROR(EISCONN),
450ee85db398be8ea33d67cc42f99a1468cd6c8180François Gaffie
460ee85db398be8ea33d67cc42f99a1468cd6c8180François Gaffie  /// Operation already in progress.
470ee85db398be8ea33d67cc42f99a1468cd6c8180François Gaffie  already_started = ASIO_SOCKET_ERROR(EALREADY),
480ee85db398be8ea33d67cc42f99a1468cd6c8180François Gaffie
490ee85db398be8ea33d67cc42f99a1468cd6c8180François Gaffie  /// Broken pipe.
500ee85db398be8ea33d67cc42f99a1468cd6c8180François Gaffie  broken_pipe = ASIO_WIN_OR_POSIX(
510ee85db398be8ea33d67cc42f99a1468cd6c8180François Gaffie      ASIO_NATIVE_ERROR(ERROR_BROKEN_PIPE),
520ee85db398be8ea33d67cc42f99a1468cd6c8180François Gaffie      ASIO_NATIVE_ERROR(EPIPE)),
530ee85db398be8ea33d67cc42f99a1468cd6c8180François Gaffie
540ee85db398be8ea33d67cc42f99a1468cd6c8180François Gaffie  /// A connection has been aborted.
550ee85db398be8ea33d67cc42f99a1468cd6c8180François Gaffie  connection_aborted = ASIO_SOCKET_ERROR(ECONNABORTED),
560ee85db398be8ea33d67cc42f99a1468cd6c8180François Gaffie
570ee85db398be8ea33d67cc42f99a1468cd6c8180François Gaffie  /// Connection refused.
580ee85db398be8ea33d67cc42f99a1468cd6c8180François Gaffie  connection_refused = ASIO_SOCKET_ERROR(ECONNREFUSED),
590ee85db398be8ea33d67cc42f99a1468cd6c8180François Gaffie
600ee85db398be8ea33d67cc42f99a1468cd6c8180François Gaffie  /// Connection reset by peer.
610ee85db398be8ea33d67cc42f99a1468cd6c8180François Gaffie  connection_reset = ASIO_SOCKET_ERROR(ECONNRESET),
620ee85db398be8ea33d67cc42f99a1468cd6c8180François Gaffie
630ee85db398be8ea33d67cc42f99a1468cd6c8180François Gaffie  /// Bad file descriptor.
640ee85db398be8ea33d67cc42f99a1468cd6c8180François Gaffie  bad_descriptor = ASIO_SOCKET_ERROR(EBADF),
650ee85db398be8ea33d67cc42f99a1468cd6c8180François Gaffie
660ee85db398be8ea33d67cc42f99a1468cd6c8180François Gaffie  /// Bad address.
670ee85db398be8ea33d67cc42f99a1468cd6c8180François Gaffie  fault = ASIO_SOCKET_ERROR(EFAULT),
680ee85db398be8ea33d67cc42f99a1468cd6c8180François Gaffie
690ee85db398be8ea33d67cc42f99a1468cd6c8180François Gaffie  /// No route to host.
700ee85db398be8ea33d67cc42f99a1468cd6c8180François Gaffie  host_unreachable = ASIO_SOCKET_ERROR(EHOSTUNREACH),
710ee85db398be8ea33d67cc42f99a1468cd6c8180François Gaffie
720ee85db398be8ea33d67cc42f99a1468cd6c8180François Gaffie  /// Operation now in progress.
730ee85db398be8ea33d67cc42f99a1468cd6c8180François Gaffie  in_progress = ASIO_SOCKET_ERROR(EINPROGRESS),
740ee85db398be8ea33d67cc42f99a1468cd6c8180François Gaffie
750ee85db398be8ea33d67cc42f99a1468cd6c8180François Gaffie  /// Interrupted system call.
760ee85db398be8ea33d67cc42f99a1468cd6c8180François Gaffie  interrupted = ASIO_SOCKET_ERROR(EINTR),
770ee85db398be8ea33d67cc42f99a1468cd6c8180François Gaffie
780ee85db398be8ea33d67cc42f99a1468cd6c8180François Gaffie  /// Invalid argument.
790ee85db398be8ea33d67cc42f99a1468cd6c8180François Gaffie  invalid_argument = ASIO_SOCKET_ERROR(EINVAL),
800ee85db398be8ea33d67cc42f99a1468cd6c8180François Gaffie
810ee85db398be8ea33d67cc42f99a1468cd6c8180François Gaffie  /// Message too long.
820ee85db398be8ea33d67cc42f99a1468cd6c8180François Gaffie  message_size = ASIO_SOCKET_ERROR(EMSGSIZE),
830ee85db398be8ea33d67cc42f99a1468cd6c8180François Gaffie
840ee85db398be8ea33d67cc42f99a1468cd6c8180François Gaffie  /// The name was too long.
850ee85db398be8ea33d67cc42f99a1468cd6c8180François Gaffie  name_too_long = ASIO_SOCKET_ERROR(ENAMETOOLONG),
860ee85db398be8ea33d67cc42f99a1468cd6c8180François Gaffie
870ee85db398be8ea33d67cc42f99a1468cd6c8180François Gaffie  /// Network is down.
880ee85db398be8ea33d67cc42f99a1468cd6c8180François Gaffie  network_down = ASIO_SOCKET_ERROR(ENETDOWN),
890ee85db398be8ea33d67cc42f99a1468cd6c8180François Gaffie
900ee85db398be8ea33d67cc42f99a1468cd6c8180François Gaffie  /// Network dropped connection on reset.
910ee85db398be8ea33d67cc42f99a1468cd6c8180François Gaffie  network_reset = ASIO_SOCKET_ERROR(ENETRESET),
920ee85db398be8ea33d67cc42f99a1468cd6c8180François Gaffie
930ee85db398be8ea33d67cc42f99a1468cd6c8180François Gaffie  /// Network is unreachable.
940ee85db398be8ea33d67cc42f99a1468cd6c8180François Gaffie  network_unreachable = ASIO_SOCKET_ERROR(ENETUNREACH),
950ee85db398be8ea33d67cc42f99a1468cd6c8180François Gaffie
960ee85db398be8ea33d67cc42f99a1468cd6c8180François Gaffie  /// Too many open files.
970ee85db398be8ea33d67cc42f99a1468cd6c8180François Gaffie  no_descriptors = ASIO_SOCKET_ERROR(EMFILE),
980ee85db398be8ea33d67cc42f99a1468cd6c8180François Gaffie
990ee85db398be8ea33d67cc42f99a1468cd6c8180François Gaffie  /// No buffer space available.
1000ee85db398be8ea33d67cc42f99a1468cd6c8180François Gaffie  no_buffer_space = ASIO_SOCKET_ERROR(ENOBUFS),
1010ee85db398be8ea33d67cc42f99a1468cd6c8180François Gaffie
1020ee85db398be8ea33d67cc42f99a1468cd6c8180François Gaffie  /// Cannot allocate memory.
1030ee85db398be8ea33d67cc42f99a1468cd6c8180François Gaffie  no_memory = ASIO_WIN_OR_POSIX(
1040ee85db398be8ea33d67cc42f99a1468cd6c8180François Gaffie      ASIO_NATIVE_ERROR(ERROR_OUTOFMEMORY),
1050ee85db398be8ea33d67cc42f99a1468cd6c8180François Gaffie      ASIO_NATIVE_ERROR(ENOMEM)),
1060ee85db398be8ea33d67cc42f99a1468cd6c8180François Gaffie
1070ee85db398be8ea33d67cc42f99a1468cd6c8180François Gaffie  /// Operation not permitted.
1080ee85db398be8ea33d67cc42f99a1468cd6c8180François Gaffie  no_permission = ASIO_WIN_OR_POSIX(
1090ee85db398be8ea33d67cc42f99a1468cd6c8180François Gaffie      ASIO_NATIVE_ERROR(ERROR_ACCESS_DENIED),
1100ee85db398be8ea33d67cc42f99a1468cd6c8180François Gaffie      ASIO_NATIVE_ERROR(EPERM)),
1110ee85db398be8ea33d67cc42f99a1468cd6c8180François Gaffie
1120ee85db398be8ea33d67cc42f99a1468cd6c8180François Gaffie  /// Protocol not available.
1130ee85db398be8ea33d67cc42f99a1468cd6c8180François Gaffie  no_protocol_option = ASIO_SOCKET_ERROR(ENOPROTOOPT),
1140ee85db398be8ea33d67cc42f99a1468cd6c8180François Gaffie
1150ee85db398be8ea33d67cc42f99a1468cd6c8180François Gaffie  /// No such device.
1160ee85db398be8ea33d67cc42f99a1468cd6c8180François Gaffie  no_such_device = ASIO_WIN_OR_POSIX(
1170ee85db398be8ea33d67cc42f99a1468cd6c8180François Gaffie      ASIO_NATIVE_ERROR(ERROR_BAD_UNIT),
1180ee85db398be8ea33d67cc42f99a1468cd6c8180François Gaffie      ASIO_NATIVE_ERROR(ENODEV)),
1190ee85db398be8ea33d67cc42f99a1468cd6c8180François Gaffie
1200ee85db398be8ea33d67cc42f99a1468cd6c8180François Gaffie  /// Transport endpoint is not connected.
1210ee85db398be8ea33d67cc42f99a1468cd6c8180François Gaffie  not_connected = ASIO_SOCKET_ERROR(ENOTCONN),
1220ee85db398be8ea33d67cc42f99a1468cd6c8180François Gaffie
1230ee85db398be8ea33d67cc42f99a1468cd6c8180François Gaffie  /// Socket operation on non-socket.
1240ee85db398be8ea33d67cc42f99a1468cd6c8180François Gaffie  not_socket = ASIO_SOCKET_ERROR(ENOTSOCK),
1250ee85db398be8ea33d67cc42f99a1468cd6c8180François Gaffie
1260ee85db398be8ea33d67cc42f99a1468cd6c8180François Gaffie  /// Operation cancelled.
1270ee85db398be8ea33d67cc42f99a1468cd6c8180François Gaffie  operation_aborted = ASIO_WIN_OR_POSIX(
1280ee85db398be8ea33d67cc42f99a1468cd6c8180François Gaffie      ASIO_NATIVE_ERROR(ERROR_OPERATION_ABORTED),
1290ee85db398be8ea33d67cc42f99a1468cd6c8180François Gaffie      ASIO_NATIVE_ERROR(ECANCELED)),
1300ee85db398be8ea33d67cc42f99a1468cd6c8180François Gaffie
1310ee85db398be8ea33d67cc42f99a1468cd6c8180François Gaffie  /// Operation not supported.
1320ee85db398be8ea33d67cc42f99a1468cd6c8180François Gaffie  operation_not_supported = ASIO_SOCKET_ERROR(EOPNOTSUPP),
1330ee85db398be8ea33d67cc42f99a1468cd6c8180François Gaffie
1340ee85db398be8ea33d67cc42f99a1468cd6c8180François Gaffie  /// Cannot send after transport endpoint shutdown.
1350ee85db398be8ea33d67cc42f99a1468cd6c8180François Gaffie  shut_down = ASIO_SOCKET_ERROR(ESHUTDOWN),
1360ee85db398be8ea33d67cc42f99a1468cd6c8180François Gaffie
1370ee85db398be8ea33d67cc42f99a1468cd6c8180François Gaffie  /// Connection timed out.
1380ee85db398be8ea33d67cc42f99a1468cd6c8180François Gaffie  timed_out = ASIO_SOCKET_ERROR(ETIMEDOUT),
1390ee85db398be8ea33d67cc42f99a1468cd6c8180François Gaffie
1400ee85db398be8ea33d67cc42f99a1468cd6c8180François Gaffie  /// Resource temporarily unavailable.
1410ee85db398be8ea33d67cc42f99a1468cd6c8180François Gaffie  try_again = ASIO_WIN_OR_POSIX(
1420ee85db398be8ea33d67cc42f99a1468cd6c8180François Gaffie      ASIO_NATIVE_ERROR(ERROR_RETRY),
1430ee85db398be8ea33d67cc42f99a1468cd6c8180François Gaffie      ASIO_NATIVE_ERROR(EAGAIN)),
1440ee85db398be8ea33d67cc42f99a1468cd6c8180François Gaffie
1450ee85db398be8ea33d67cc42f99a1468cd6c8180François Gaffie  /// The socket is marked non-blocking and the requested operation would block.
1460ee85db398be8ea33d67cc42f99a1468cd6c8180François Gaffie  would_block = ASIO_SOCKET_ERROR(EWOULDBLOCK)
1470ee85db398be8ea33d67cc42f99a1468cd6c8180François Gaffie};
1480ee85db398be8ea33d67cc42f99a1468cd6c8180François Gaffie
1490ee85db398be8ea33d67cc42f99a1468cd6c8180François Gaffieenum netdb_errors
1500ee85db398be8ea33d67cc42f99a1468cd6c8180François Gaffie{
1510ee85db398be8ea33d67cc42f99a1468cd6c8180François Gaffie  /// Host not found (authoritative).
1520ee85db398be8ea33d67cc42f99a1468cd6c8180François Gaffie  host_not_found = ASIO_NETDB_ERROR(HOST_NOT_FOUND),
1530ee85db398be8ea33d67cc42f99a1468cd6c8180François Gaffie
1540ee85db398be8ea33d67cc42f99a1468cd6c8180François Gaffie  /// Host not found (non-authoritative).
1550ee85db398be8ea33d67cc42f99a1468cd6c8180François Gaffie  host_not_found_try_again = ASIO_NETDB_ERROR(TRY_AGAIN),
1560ee85db398be8ea33d67cc42f99a1468cd6c8180François Gaffie
1570ee85db398be8ea33d67cc42f99a1468cd6c8180François Gaffie  /// The query is valid but does not have associated address data.
1580ee85db398be8ea33d67cc42f99a1468cd6c8180François Gaffie  no_data = ASIO_NETDB_ERROR(NO_DATA),
1590ee85db398be8ea33d67cc42f99a1468cd6c8180François Gaffie
1600ee85db398be8ea33d67cc42f99a1468cd6c8180François Gaffie  /// A non-recoverable error occurred.
1610ee85db398be8ea33d67cc42f99a1468cd6c8180François Gaffie  no_recovery = ASIO_NETDB_ERROR(NO_RECOVERY)
1620ee85db398be8ea33d67cc42f99a1468cd6c8180François Gaffie};
1630ee85db398be8ea33d67cc42f99a1468cd6c8180François Gaffie
1640ee85db398be8ea33d67cc42f99a1468cd6c8180François Gaffieenum addrinfo_errors
1650ee85db398be8ea33d67cc42f99a1468cd6c8180François Gaffie{
1660ee85db398be8ea33d67cc42f99a1468cd6c8180François Gaffie  /// The service is not supported for the given socket type.
1670ee85db398be8ea33d67cc42f99a1468cd6c8180François Gaffie  service_not_found = ASIO_WIN_OR_POSIX(
1680ee85db398be8ea33d67cc42f99a1468cd6c8180François Gaffie      ASIO_NATIVE_ERROR(WSATYPE_NOT_FOUND),
1690ee85db398be8ea33d67cc42f99a1468cd6c8180François Gaffie      ASIO_GETADDRINFO_ERROR(EAI_SERVICE)),
1700ee85db398be8ea33d67cc42f99a1468cd6c8180François Gaffie
1710ee85db398be8ea33d67cc42f99a1468cd6c8180François Gaffie  /// The socket type is not supported.
1720ee85db398be8ea33d67cc42f99a1468cd6c8180François Gaffie  socket_type_not_supported = ASIO_WIN_OR_POSIX(
1730ee85db398be8ea33d67cc42f99a1468cd6c8180François Gaffie      ASIO_NATIVE_ERROR(WSAESOCKTNOSUPPORT),
1740ee85db398be8ea33d67cc42f99a1468cd6c8180François Gaffie      ASIO_GETADDRINFO_ERROR(EAI_SOCKTYPE))
1750ee85db398be8ea33d67cc42f99a1468cd6c8180François Gaffie};
1760ee85db398be8ea33d67cc42f99a1468cd6c8180François Gaffie
1770ee85db398be8ea33d67cc42f99a1468cd6c8180François Gaffieenum misc_errors
1780ee85db398be8ea33d67cc42f99a1468cd6c8180François Gaffie{
1790ee85db398be8ea33d67cc42f99a1468cd6c8180François Gaffie  /// Already open.
1800ee85db398be8ea33d67cc42f99a1468cd6c8180François Gaffie  already_open = 1,
1810ee85db398be8ea33d67cc42f99a1468cd6c8180François Gaffie
1820ee85db398be8ea33d67cc42f99a1468cd6c8180François Gaffie  /// End of file or stream.
1830ee85db398be8ea33d67cc42f99a1468cd6c8180François Gaffie  eof,
1840ee85db398be8ea33d67cc42f99a1468cd6c8180François Gaffie
1850ee85db398be8ea33d67cc42f99a1468cd6c8180François Gaffie  /// Element not found.
1860ee85db398be8ea33d67cc42f99a1468cd6c8180François Gaffie  not_found,
1870ee85db398be8ea33d67cc42f99a1468cd6c8180François Gaffie
1880ee85db398be8ea33d67cc42f99a1468cd6c8180François Gaffie  /// The descriptor cannot fit into the select system call's fd_set.
1890ee85db398be8ea33d67cc42f99a1468cd6c8180François Gaffie  fd_set_failure
1900ee85db398be8ea33d67cc42f99a1468cd6c8180François Gaffie};
1910ee85db398be8ea33d67cc42f99a1468cd6c8180François Gaffie
1920ee85db398be8ea33d67cc42f99a1468cd6c8180François Gaffieinline const asio::error_category& get_system_category()
1930ee85db398be8ea33d67cc42f99a1468cd6c8180François Gaffie{
1940ee85db398be8ea33d67cc42f99a1468cd6c8180François Gaffie  return asio::system_category();
1950ee85db398be8ea33d67cc42f99a1468cd6c8180François Gaffie}
1960ee85db398be8ea33d67cc42f99a1468cd6c8180François Gaffie
1970ee85db398be8ea33d67cc42f99a1468cd6c8180François Gaffie
1980ee85db398be8ea33d67cc42f99a1468cd6c8180François Gaffieextern ASIO_DECL
1990ee85db398be8ea33d67cc42f99a1468cd6c8180François Gaffieconst asio::error_category& get_netdb_category();
2000ee85db398be8ea33d67cc42f99a1468cd6c8180François Gaffie
2010ee85db398be8ea33d67cc42f99a1468cd6c8180François Gaffieextern ASIO_DECL
2020ee85db398be8ea33d67cc42f99a1468cd6c8180François Gaffieconst asio::error_category& get_addrinfo_category();
2030ee85db398be8ea33d67cc42f99a1468cd6c8180François Gaffie
2040ee85db398be8ea33d67cc42f99a1468cd6c8180François Gaffie
2050ee85db398be8ea33d67cc42f99a1468cd6c8180François Gaffieextern ASIO_DECL
2060ee85db398be8ea33d67cc42f99a1468cd6c8180François Gaffieconst asio::error_category& get_misc_category();
2070ee85db398be8ea33d67cc42f99a1468cd6c8180François Gaffie
2080ee85db398be8ea33d67cc42f99a1468cd6c8180François Gaffiestatic const asio::error_category& system_category
2090ee85db398be8ea33d67cc42f99a1468cd6c8180François Gaffie  = asio::error::get_system_category();
2100ee85db398be8ea33d67cc42f99a1468cd6c8180François Gaffiestatic const asio::error_category& netdb_category
2110ee85db398be8ea33d67cc42f99a1468cd6c8180François Gaffie  = asio::error::get_netdb_category();
2120ee85db398be8ea33d67cc42f99a1468cd6c8180François Gaffiestatic const asio::error_category& addrinfo_category
2130ee85db398be8ea33d67cc42f99a1468cd6c8180François Gaffie  = asio::error::get_addrinfo_category();
2140ee85db398be8ea33d67cc42f99a1468cd6c8180François Gaffiestatic const asio::error_category& misc_category
2150ee85db398be8ea33d67cc42f99a1468cd6c8180François Gaffie  = asio::error::get_misc_category();
2160ee85db398be8ea33d67cc42f99a1468cd6c8180François Gaffie
2170ee85db398be8ea33d67cc42f99a1468cd6c8180François Gaffie} // namespace error
2180ee85db398be8ea33d67cc42f99a1468cd6c8180François Gaffie} // namespace asio
2190ee85db398be8ea33d67cc42f99a1468cd6c8180François Gaffie
2200ee85db398be8ea33d67cc42f99a1468cd6c8180François Gaffienamespace std {
2210ee85db398be8ea33d67cc42f99a1468cd6c8180François Gaffie
2220ee85db398be8ea33d67cc42f99a1468cd6c8180François Gaffietemplate<> struct is_error_code_enum<asio::error::basic_errors>
2230ee85db398be8ea33d67cc42f99a1468cd6c8180François Gaffie{
2240ee85db398be8ea33d67cc42f99a1468cd6c8180François Gaffie  static const bool value = true;
2250ee85db398be8ea33d67cc42f99a1468cd6c8180François Gaffie};
2260ee85db398be8ea33d67cc42f99a1468cd6c8180François Gaffie
2270ee85db398be8ea33d67cc42f99a1468cd6c8180François Gaffietemplate<> struct is_error_code_enum<asio::error::netdb_errors>
2280ee85db398be8ea33d67cc42f99a1468cd6c8180François Gaffie{
2290ee85db398be8ea33d67cc42f99a1468cd6c8180François Gaffie  static const bool value = true;
2300ee85db398be8ea33d67cc42f99a1468cd6c8180François Gaffie};
2310ee85db398be8ea33d67cc42f99a1468cd6c8180François Gaffie
2320ee85db398be8ea33d67cc42f99a1468cd6c8180François Gaffietemplate<> struct is_error_code_enum<asio::error::addrinfo_errors>
2330ee85db398be8ea33d67cc42f99a1468cd6c8180François Gaffie{
2340ee85db398be8ea33d67cc42f99a1468cd6c8180François Gaffie  static const bool value = true;
2350ee85db398be8ea33d67cc42f99a1468cd6c8180François Gaffie};
2360ee85db398be8ea33d67cc42f99a1468cd6c8180François Gaffie
2370ee85db398be8ea33d67cc42f99a1468cd6c8180François Gaffietemplate<> struct is_error_code_enum<asio::error::misc_errors>
2380ee85db398be8ea33d67cc42f99a1468cd6c8180François Gaffie{
2390ee85db398be8ea33d67cc42f99a1468cd6c8180François Gaffie  static const bool value = true;
2400ee85db398be8ea33d67cc42f99a1468cd6c8180François Gaffie};
2410ee85db398be8ea33d67cc42f99a1468cd6c8180François Gaffie
2420ee85db398be8ea33d67cc42f99a1468cd6c8180François Gaffie} // namespace std
2430ee85db398be8ea33d67cc42f99a1468cd6c8180François Gaffie
2440ee85db398be8ea33d67cc42f99a1468cd6c8180François Gaffienamespace asio {
2450ee85db398be8ea33d67cc42f99a1468cd6c8180François Gaffienamespace error {
2460ee85db398be8ea33d67cc42f99a1468cd6c8180François Gaffie
2470ee85db398be8ea33d67cc42f99a1468cd6c8180François Gaffieinline asio::error_code make_error_code(basic_errors e)
2480ee85db398be8ea33d67cc42f99a1468cd6c8180François Gaffie{
2490ee85db398be8ea33d67cc42f99a1468cd6c8180François Gaffie  return asio::error_code(
2500ee85db398be8ea33d67cc42f99a1468cd6c8180François Gaffie      static_cast<int>(e), get_system_category());
2510ee85db398be8ea33d67cc42f99a1468cd6c8180François Gaffie}
2520ee85db398be8ea33d67cc42f99a1468cd6c8180François Gaffie
2530ee85db398be8ea33d67cc42f99a1468cd6c8180François Gaffieinline asio::error_code make_error_code(netdb_errors e)
2540ee85db398be8ea33d67cc42f99a1468cd6c8180François Gaffie{
2550ee85db398be8ea33d67cc42f99a1468cd6c8180François Gaffie  return asio::error_code(
2560ee85db398be8ea33d67cc42f99a1468cd6c8180François Gaffie      static_cast<int>(e), get_netdb_category());
2570ee85db398be8ea33d67cc42f99a1468cd6c8180François Gaffie}
2580ee85db398be8ea33d67cc42f99a1468cd6c8180François Gaffie
2590ee85db398be8ea33d67cc42f99a1468cd6c8180François Gaffieinline asio::error_code make_error_code(addrinfo_errors e)
2600ee85db398be8ea33d67cc42f99a1468cd6c8180François Gaffie{
2610ee85db398be8ea33d67cc42f99a1468cd6c8180François Gaffie  return asio::error_code(
2620ee85db398be8ea33d67cc42f99a1468cd6c8180François Gaffie      static_cast<int>(e), get_addrinfo_category());
2630ee85db398be8ea33d67cc42f99a1468cd6c8180François Gaffie}
2640ee85db398be8ea33d67cc42f99a1468cd6c8180François Gaffie
2650ee85db398be8ea33d67cc42f99a1468cd6c8180François Gaffieinline asio::error_code make_error_code(misc_errors e)
2660ee85db398be8ea33d67cc42f99a1468cd6c8180François Gaffie{
2670ee85db398be8ea33d67cc42f99a1468cd6c8180François Gaffie  return asio::error_code(
2680ee85db398be8ea33d67cc42f99a1468cd6c8180François Gaffie      static_cast<int>(e), get_misc_category());
2690ee85db398be8ea33d67cc42f99a1468cd6c8180François Gaffie}
2700ee85db398be8ea33d67cc42f99a1468cd6c8180François Gaffie
2710ee85db398be8ea33d67cc42f99a1468cd6c8180François Gaffie} // namespace error
2720ee85db398be8ea33d67cc42f99a1468cd6c8180François Gaffie} // namespace asio
2730ee85db398be8ea33d67cc42f99a1468cd6c8180François Gaffie
2740ee85db398be8ea33d67cc42f99a1468cd6c8180François Gaffie#include "asio/detail/pop_options.hpp"
2750ee85db398be8ea33d67cc42f99a1468cd6c8180François Gaffie
2760ee85db398be8ea33d67cc42f99a1468cd6c8180François Gaffie#undef ASIO_NATIVE_ERROR
2770ee85db398be8ea33d67cc42f99a1468cd6c8180François Gaffie#undef ASIO_SOCKET_ERROR
2780ee85db398be8ea33d67cc42f99a1468cd6c8180François Gaffie#undef ASIO_NETDB_ERROR
2790ee85db398be8ea33d67cc42f99a1468cd6c8180François Gaffie#undef ASIO_GETADDRINFO_ERROR
2800ee85db398be8ea33d67cc42f99a1468cd6c8180François Gaffie#undef ASIO_WIN_OR_POSIX
2810ee85db398be8ea33d67cc42f99a1468cd6c8180François Gaffie
2820ee85db398be8ea33d67cc42f99a1468cd6c8180François Gaffie# include "asio/impl/error.ipp"
2830ee85db398be8ea33d67cc42f99a1468cd6c8180François Gaffie
2840ee85db398be8ea33d67cc42f99a1468cd6c8180François Gaffie#endif // ASIO_ERROR_HPP
285