PageRenderTime 30ms CodeModel.GetById 18ms app.highlight 9ms RepoModel.GetById 1ms app.codeStats 0ms

/Src/Dependencies/Boost/boost/asio/detail/socket_types.hpp

http://hadesmem.googlecode.com/
C++ Header | 178 lines | 157 code | 10 blank | 11 comment | 21 complexity | 623cce0c31f8d386a5b3ae750c817ab6 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
 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
 80namespace boost {
 81namespace asio {
 82namespace detail {
 83
 84#if defined(BOOST_WINDOWS) || defined(__CYGWIN__)
 85typedef SOCKET socket_type;
 86const SOCKET invalid_socket = INVALID_SOCKET;
 87const int socket_error_retval = SOCKET_ERROR;
 88const int max_addr_v4_str_len = 256;
 89const int max_addr_v6_str_len = 256;
 90typedef sockaddr socket_addr_type;
 91typedef in_addr in4_addr_type;
 92typedef ip_mreq in4_mreq_type;
 93typedef sockaddr_in sockaddr_in4_type;
 94# if defined(BOOST_ASIO_HAS_OLD_WIN_SDK)
 95typedef in6_addr_emulation in6_addr_type;
 96typedef ipv6_mreq_emulation in6_mreq_type;
 97typedef sockaddr_in6_emulation sockaddr_in6_type;
 98typedef sockaddr_storage_emulation sockaddr_storage_type;
 99typedef addrinfo_emulation addrinfo_type;
100# else
101typedef in6_addr in6_addr_type;
102typedef ipv6_mreq in6_mreq_type;
103typedef sockaddr_in6 sockaddr_in6_type;
104typedef sockaddr_storage sockaddr_storage_type;
105typedef addrinfo addrinfo_type;
106# endif
107typedef unsigned long ioctl_arg_type;
108typedef u_long u_long_type;
109typedef u_short u_short_type;
110const int shutdown_receive = SD_RECEIVE;
111const int shutdown_send = SD_SEND;
112const int shutdown_both = SD_BOTH;
113const int message_peek = MSG_PEEK;
114const int message_out_of_band = MSG_OOB;
115const int message_do_not_route = MSG_DONTROUTE;
116const int message_end_of_record = 0; // Not supported on Windows.
117# if defined (_WIN32_WINNT)
118const int max_iov_len = 64;
119# else
120const int max_iov_len = 16;
121# endif
122#else
123typedef int socket_type;
124const int invalid_socket = -1;
125const int socket_error_retval = -1;
126const int max_addr_v4_str_len = INET_ADDRSTRLEN;
127#if defined(INET6_ADDRSTRLEN)
128const int max_addr_v6_str_len = INET6_ADDRSTRLEN + 1 + IF_NAMESIZE;
129#else // defined(INET6_ADDRSTRLEN)
130const int max_addr_v6_str_len = 256;
131#endif // defined(INET6_ADDRSTRLEN)
132typedef sockaddr socket_addr_type;
133typedef in_addr in4_addr_type;
134# if defined(__hpux)
135// HP-UX doesn't provide ip_mreq when _XOPEN_SOURCE_EXTENDED is defined.
136struct in4_mreq_type
137{
138  struct in_addr imr_multiaddr;
139  struct in_addr imr_interface;
140};
141# else
142typedef ip_mreq in4_mreq_type;
143# endif
144typedef sockaddr_in sockaddr_in4_type;
145typedef in6_addr in6_addr_type;
146typedef ipv6_mreq in6_mreq_type;
147typedef sockaddr_in6 sockaddr_in6_type;
148typedef sockaddr_storage sockaddr_storage_type;
149typedef sockaddr_un sockaddr_un_type;
150typedef addrinfo addrinfo_type;
151typedef int ioctl_arg_type;
152typedef uint32_t u_long_type;
153typedef uint16_t u_short_type;
154const int shutdown_receive = SHUT_RD;
155const int shutdown_send = SHUT_WR;
156const int shutdown_both = SHUT_RDWR;
157const int message_peek = MSG_PEEK;
158const int message_out_of_band = MSG_OOB;
159const int message_do_not_route = MSG_DONTROUTE;
160const int message_end_of_record = MSG_EOR;
161# if defined(IOV_MAX)
162const int max_iov_len = IOV_MAX;
163# else
164// POSIX platforms are not required to define IOV_MAX.
165const int max_iov_len = 16;
166# endif
167#endif
168const int custom_socket_option_level = 0xA5100000;
169const int enable_connection_aborted_option = 1;
170const 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