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