PageRenderTime 65ms CodeModel.GetById 24ms RepoModel.GetById 0ms app.codeStats 0ms

/dep/asio/asio/detail/socket_types.hpp

https://github.com/ratboy2499/evemu_incursion
C++ Header | 176 lines | 155 code | 10 blank | 11 comment | 21 complexity | 03f008846f772a0fc7b62c7ccb22dd5b MD5 | raw file
  1. //
  2. // detail/socket_types.hpp
  3. // ~~~~~~~~~~~~~~~~~~~~~~~
  4. //
  5. // Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com)
  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. #ifndef ASIO_DETAIL_SOCKET_TYPES_HPP
  11. #define ASIO_DETAIL_SOCKET_TYPES_HPP
  12. #if defined(_MSC_VER) && (_MSC_VER >= 1200)
  13. # pragma once
  14. #endif // defined(_MSC_VER) && (_MSC_VER >= 1200)
  15. #include "asio/detail/config.hpp"
  16. #if defined(BOOST_WINDOWS) || defined(__CYGWIN__)
  17. # if defined(_WINSOCKAPI_) && !defined(_WINSOCK2API_)
  18. # error WinSock.h has already been included
  19. # endif // defined(_WINSOCKAPI_) && !defined(_WINSOCK2API_)
  20. # if defined(__BORLANDC__)
  21. # include <stdlib.h> // Needed for __errno
  22. # if !defined(_WSPIAPI_H_)
  23. # define _WSPIAPI_H_
  24. # define ASIO_WSPIAPI_H_DEFINED
  25. # endif // !defined(_WSPIAPI_H_)
  26. # endif // defined(__BORLANDC__)
  27. # include <winsock2.h>
  28. # include <ws2tcpip.h>
  29. # include <mswsock.h>
  30. # if defined(ASIO_WSPIAPI_H_DEFINED)
  31. # undef _WSPIAPI_H_
  32. # undef ASIO_WSPIAPI_H_DEFINED
  33. # endif // defined(ASIO_WSPIAPI_H_DEFINED)
  34. # if !defined(ASIO_NO_DEFAULT_LINKED_LIBS)
  35. # if defined(UNDER_CE)
  36. # pragma comment(lib, "ws2.lib")
  37. # elif defined(_MSC_VER) || defined(__BORLANDC__)
  38. # pragma comment(lib, "ws2_32.lib")
  39. # pragma comment(lib, "mswsock.lib")
  40. # endif // defined(_MSC_VER) || defined(__BORLANDC__)
  41. # endif // !defined(ASIO_NO_DEFAULT_LINKED_LIBS)
  42. # include "asio/detail/old_win_sdk_compat.hpp"
  43. #else
  44. # include <sys/ioctl.h>
  45. # if !defined(__SYMBIAN32__)
  46. # include <sys/poll.h>
  47. # endif
  48. # include <sys/types.h>
  49. # include <sys/stat.h>
  50. # include <fcntl.h>
  51. # if defined(__hpux)
  52. # include <sys/time.h>
  53. # endif
  54. # if !defined(__hpux) || defined(__SELECT)
  55. # include <sys/select.h>
  56. # endif
  57. # include <sys/socket.h>
  58. # include <sys/uio.h>
  59. # include <sys/un.h>
  60. # include <netinet/in.h>
  61. # if !defined(__SYMBIAN32__)
  62. # include <netinet/tcp.h>
  63. # endif
  64. # include <arpa/inet.h>
  65. # include <netdb.h>
  66. # include <net/if.h>
  67. # include <limits.h>
  68. # if defined(__sun)
  69. # include <sys/filio.h>
  70. # include <sys/sockio.h>
  71. # endif
  72. #endif
  73. #include "asio/detail/push_options.hpp"
  74. namespace asio {
  75. namespace detail {
  76. #if defined(BOOST_WINDOWS) || defined(__CYGWIN__)
  77. typedef SOCKET socket_type;
  78. const SOCKET invalid_socket = INVALID_SOCKET;
  79. const int socket_error_retval = SOCKET_ERROR;
  80. const int max_addr_v4_str_len = 256;
  81. const int max_addr_v6_str_len = 256;
  82. typedef sockaddr socket_addr_type;
  83. typedef in_addr in4_addr_type;
  84. typedef ip_mreq in4_mreq_type;
  85. typedef sockaddr_in sockaddr_in4_type;
  86. # if defined(ASIO_HAS_OLD_WIN_SDK)
  87. typedef in6_addr_emulation in6_addr_type;
  88. typedef ipv6_mreq_emulation in6_mreq_type;
  89. typedef sockaddr_in6_emulation sockaddr_in6_type;
  90. typedef sockaddr_storage_emulation sockaddr_storage_type;
  91. typedef addrinfo_emulation addrinfo_type;
  92. # else
  93. typedef in6_addr in6_addr_type;
  94. typedef ipv6_mreq in6_mreq_type;
  95. typedef sockaddr_in6 sockaddr_in6_type;
  96. typedef sockaddr_storage sockaddr_storage_type;
  97. typedef addrinfo addrinfo_type;
  98. # endif
  99. typedef unsigned long ioctl_arg_type;
  100. typedef u_long u_long_type;
  101. typedef u_short u_short_type;
  102. const int shutdown_receive = SD_RECEIVE;
  103. const int shutdown_send = SD_SEND;
  104. const int shutdown_both = SD_BOTH;
  105. const int message_peek = MSG_PEEK;
  106. const int message_out_of_band = MSG_OOB;
  107. const int message_do_not_route = MSG_DONTROUTE;
  108. const int message_end_of_record = 0; // Not supported on Windows.
  109. # if defined (_WIN32_WINNT)
  110. const int max_iov_len = 64;
  111. # else
  112. const int max_iov_len = 16;
  113. # endif
  114. #else
  115. typedef int socket_type;
  116. const int invalid_socket = -1;
  117. const int socket_error_retval = -1;
  118. const int max_addr_v4_str_len = INET_ADDRSTRLEN;
  119. #if defined(INET6_ADDRSTRLEN)
  120. const int max_addr_v6_str_len = INET6_ADDRSTRLEN + 1 + IF_NAMESIZE;
  121. #else // defined(INET6_ADDRSTRLEN)
  122. const int max_addr_v6_str_len = 256;
  123. #endif // defined(INET6_ADDRSTRLEN)
  124. typedef sockaddr socket_addr_type;
  125. typedef in_addr in4_addr_type;
  126. # if defined(__hpux)
  127. // HP-UX doesn't provide ip_mreq when _XOPEN_SOURCE_EXTENDED is defined.
  128. struct in4_mreq_type
  129. {
  130. struct in_addr imr_multiaddr;
  131. struct in_addr imr_interface;
  132. };
  133. # else
  134. typedef ip_mreq in4_mreq_type;
  135. # endif
  136. typedef sockaddr_in sockaddr_in4_type;
  137. typedef in6_addr in6_addr_type;
  138. typedef ipv6_mreq in6_mreq_type;
  139. typedef sockaddr_in6 sockaddr_in6_type;
  140. typedef sockaddr_storage sockaddr_storage_type;
  141. typedef sockaddr_un sockaddr_un_type;
  142. typedef addrinfo addrinfo_type;
  143. typedef int ioctl_arg_type;
  144. typedef uint32_t u_long_type;
  145. typedef uint16_t u_short_type;
  146. const int shutdown_receive = SHUT_RD;
  147. const int shutdown_send = SHUT_WR;
  148. const int shutdown_both = SHUT_RDWR;
  149. const int message_peek = MSG_PEEK;
  150. const int message_out_of_band = MSG_OOB;
  151. const int message_do_not_route = MSG_DONTROUTE;
  152. const int message_end_of_record = MSG_EOR;
  153. # if defined(IOV_MAX)
  154. const int max_iov_len = IOV_MAX;
  155. # else
  156. // POSIX platforms are not required to define IOV_MAX.
  157. const int max_iov_len = 16;
  158. # endif
  159. #endif
  160. const int custom_socket_option_level = 0xA5100000;
  161. const int enable_connection_aborted_option = 1;
  162. const int always_fail_option = 2;
  163. } // namespace detail
  164. } // namespace asio
  165. #include "asio/detail/pop_options.hpp"
  166. #endif // ASIO_DETAIL_SOCKET_TYPES_HPP