PageRenderTime 56ms CodeModel.GetById 30ms RepoModel.GetById 0ms app.codeStats 0ms

/geomcore/tags/gsph0/include/boost/asio/detail/socket_types.hpp

https://bitbucket.org/vrrm/brl-cad-copy-for-fast-history-browsing-in-git
C++ Header | 208 lines | 187 code | 10 blank | 11 comment | 37 complexity | f57317ee895530575d8b5fa027a4d954 MD5 | raw file
Possible License(s): GPL-2.0, LGPL-2.0, LGPL-2.1, Apache-2.0, AGPL-3.0, LGPL-3.0, GPL-3.0, MPL-2.0-no-copyleft-exception, CC-BY-SA-3.0, 0BSD, BSD-3-Clause
  1. //
  2. // socket_types.hpp
  3. // ~~~~~~~~~~~~~~~~
  4. //
  5. // Copyright (c) 2003-2008 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 BOOST_ASIO_DETAIL_SOCKET_TYPES_HPP
  11. #define BOOST_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 <boost/asio/detail/push_options.hpp>
  16. #include <boost/asio/detail/push_options.hpp>
  17. #include <boost/config.hpp>
  18. #include <boost/asio/detail/pop_options.hpp>
  19. #include <boost/asio/detail/push_options.hpp>
  20. #if defined(BOOST_WINDOWS) || defined(__CYGWIN__)
  21. # if defined(_WINSOCKAPI_) && !defined(_WINSOCK2API_)
  22. # error WinSock.h has already been included
  23. # endif // defined(_WINSOCKAPI_) && !defined(_WINSOCK2API_)
  24. # if !defined(_WIN32_WINNT) && !defined(_WIN32_WINDOWS)
  25. # if defined(_MSC_VER) || defined(__BORLANDC__)
  26. # pragma message("Please define _WIN32_WINNT or _WIN32_WINDOWS appropriately")
  27. # pragma message("Assuming _WIN32_WINNT=0x0501 (i.e. Windows XP target)")
  28. # else // defined(_MSC_VER) || defined(__BORLANDC__)
  29. # warning Please define _WIN32_WINNT or _WIN32_WINDOWS appropriately
  30. # warning Assuming _WIN32_WINNT=0x0501 (i.e. Windows XP target)
  31. # endif // defined(_MSC_VER) || defined(__BORLANDC__)
  32. # define _WIN32_WINNT 0x0501
  33. # endif // !defined(_WIN32_WINNT) && !defined(_WIN32_WINDOWS)
  34. # if defined(_MSC_VER)
  35. # if defined(_WIN32) && !defined(WIN32)
  36. # if !defined(_WINSOCK2API_)
  37. # define WIN32 // Needed for correct types in winsock2.h
  38. # else // !defined(_WINSOCK2API_)
  39. # error Please define the macro WIN32 in your compiler options
  40. # endif // !defined(_WINSOCK2API_)
  41. # endif // defined(_WIN32) && !defined(WIN32)
  42. # endif // defined(_MSC_VER)
  43. # if defined(__BORLANDC__)
  44. # include <stdlib.h> // Needed for __errno
  45. # if defined(__WIN32__) && !defined(WIN32)
  46. # if !defined(_WINSOCK2API_)
  47. # define WIN32 // Needed for correct types in winsock2.h
  48. # else // !defined(_WINSOCK2API_)
  49. # error Please define the macro WIN32 in your compiler options
  50. # endif // !defined(_WINSOCK2API_)
  51. # endif // defined(__WIN32__) && !defined(WIN32)
  52. # if !defined(_WSPIAPI_H_)
  53. # define _WSPIAPI_H_
  54. # define BOOST_ASIO_WSPIAPI_H_DEFINED
  55. # endif // !defined(_WSPIAPI_H_)
  56. # endif // defined(__BORLANDC__)
  57. # if !defined(BOOST_ASIO_NO_WIN32_LEAN_AND_MEAN)
  58. # if !defined(WIN32_LEAN_AND_MEAN)
  59. # define WIN32_LEAN_AND_MEAN
  60. # endif // !defined(WIN32_LEAN_AND_MEAN)
  61. # endif // !defined(BOOST_ASIO_NO_WIN32_LEAN_AND_MEAN)
  62. # if defined(__CYGWIN__)
  63. # if !defined(__USE_W32_SOCKETS)
  64. # error You must add -D__USE_W32_SOCKETS to your compiler options.
  65. # endif // !defined(__USE_W32_SOCKETS)
  66. # if !defined(NOMINMAX)
  67. # define NOMINMAX 1
  68. # endif // !defined(NOMINMAX)
  69. # endif // defined(__CYGWIN__)
  70. # include <winsock2.h>
  71. # include <ws2tcpip.h>
  72. # include <mswsock.h>
  73. # if defined(BOOST_ASIO_WSPIAPI_H_DEFINED)
  74. # undef _WSPIAPI_H_
  75. # undef BOOST_ASIO_WSPIAPI_H_DEFINED
  76. # endif // defined(BOOST_ASIO_WSPIAPI_H_DEFINED)
  77. # if !defined(BOOST_ASIO_NO_DEFAULT_LINKED_LIBS)
  78. # if defined(UNDER_CE)
  79. # pragma comment(lib, "ws2.lib")
  80. # elif defined(_MSC_VER) || defined(__BORLANDC__)
  81. # pragma comment(lib, "ws2_32.lib")
  82. # pragma comment(lib, "mswsock.lib")
  83. # endif // defined(_MSC_VER) || defined(__BORLANDC__)
  84. # endif // !defined(BOOST_ASIO_NO_DEFAULT_LINKED_LIBS)
  85. # include <boost/asio/detail/old_win_sdk_compat.hpp>
  86. #else
  87. # include <sys/ioctl.h>
  88. # include <sys/poll.h>
  89. # include <sys/types.h>
  90. # if defined(__hpux) && !defined(__HP_aCC)
  91. # include <sys/time.h>
  92. # else
  93. # include <sys/select.h>
  94. # endif
  95. # include <sys/socket.h>
  96. # include <sys/uio.h>
  97. # include <sys/un.h>
  98. # include <netinet/in.h>
  99. # include <netinet/tcp.h>
  100. # include <arpa/inet.h>
  101. # include <netdb.h>
  102. # include <net/if.h>
  103. # include <limits.h>
  104. # if defined(__sun)
  105. # include <sys/filio.h>
  106. # include <sys/sockio.h>
  107. # endif
  108. #endif
  109. #include <boost/asio/detail/pop_options.hpp>
  110. namespace boost {
  111. namespace asio {
  112. namespace detail {
  113. #if defined(BOOST_WINDOWS) || defined(__CYGWIN__)
  114. typedef SOCKET socket_type;
  115. const SOCKET invalid_socket = INVALID_SOCKET;
  116. const int socket_error_retval = SOCKET_ERROR;
  117. const int max_addr_v4_str_len = 256;
  118. const int max_addr_v6_str_len = 256;
  119. typedef sockaddr socket_addr_type;
  120. typedef in_addr in4_addr_type;
  121. typedef ip_mreq in4_mreq_type;
  122. typedef sockaddr_in sockaddr_in4_type;
  123. # if defined(BOOST_ASIO_HAS_OLD_WIN_SDK)
  124. typedef in6_addr_emulation in6_addr_type;
  125. typedef ipv6_mreq_emulation in6_mreq_type;
  126. typedef sockaddr_in6_emulation sockaddr_in6_type;
  127. typedef sockaddr_storage_emulation sockaddr_storage_type;
  128. typedef addrinfo_emulation addrinfo_type;
  129. # else
  130. typedef in6_addr in6_addr_type;
  131. typedef ipv6_mreq in6_mreq_type;
  132. typedef sockaddr_in6 sockaddr_in6_type;
  133. typedef sockaddr_storage sockaddr_storage_type;
  134. typedef addrinfo addrinfo_type;
  135. # endif
  136. typedef unsigned long ioctl_arg_type;
  137. typedef u_long u_long_type;
  138. typedef u_short u_short_type;
  139. const int shutdown_receive = SD_RECEIVE;
  140. const int shutdown_send = SD_SEND;
  141. const int shutdown_both = SD_BOTH;
  142. const int message_peek = MSG_PEEK;
  143. const int message_out_of_band = MSG_OOB;
  144. const int message_do_not_route = MSG_DONTROUTE;
  145. # if defined (_WIN32_WINNT)
  146. const int max_iov_len = 64;
  147. # else
  148. const int max_iov_len = 16;
  149. # endif
  150. #else
  151. typedef int socket_type;
  152. const int invalid_socket = -1;
  153. const int socket_error_retval = -1;
  154. const int max_addr_v4_str_len = INET_ADDRSTRLEN;
  155. const int max_addr_v6_str_len = INET6_ADDRSTRLEN + 1 + IF_NAMESIZE;
  156. typedef sockaddr socket_addr_type;
  157. typedef in_addr in4_addr_type;
  158. # if defined(__hpux)
  159. // HP-UX doesn't provide ip_mreq when _XOPEN_SOURCE_EXTENDED is defined.
  160. struct in4_mreq_type
  161. {
  162. struct in_addr imr_multiaddr;
  163. struct in_addr imr_interface;
  164. };
  165. # else
  166. typedef ip_mreq in4_mreq_type;
  167. # endif
  168. typedef sockaddr_in sockaddr_in4_type;
  169. typedef in6_addr in6_addr_type;
  170. typedef ipv6_mreq in6_mreq_type;
  171. typedef sockaddr_in6 sockaddr_in6_type;
  172. typedef sockaddr_storage sockaddr_storage_type;
  173. typedef sockaddr_un sockaddr_un_type;
  174. typedef addrinfo addrinfo_type;
  175. typedef int ioctl_arg_type;
  176. typedef uint32_t u_long_type;
  177. typedef uint16_t u_short_type;
  178. const int shutdown_receive = SHUT_RD;
  179. const int shutdown_send = SHUT_WR;
  180. const int shutdown_both = SHUT_RDWR;
  181. const int message_peek = MSG_PEEK;
  182. const int message_out_of_band = MSG_OOB;
  183. const int message_do_not_route = MSG_DONTROUTE;
  184. # if defined(IOV_MAX)
  185. const int max_iov_len = IOV_MAX;
  186. # else
  187. // POSIX platforms are not required to define IOV_MAX.
  188. const int max_iov_len = 16;
  189. # endif
  190. #endif
  191. const int custom_socket_option_level = 0xA5100000;
  192. const int enable_connection_aborted_option = 1;
  193. const int always_fail_option = 2;
  194. } // namespace detail
  195. } // namespace asio
  196. } // namespace boost
  197. #include <boost/asio/detail/pop_options.hpp>
  198. #endif // BOOST_ASIO_DETAIL_SOCKET_TYPES_HPP