socket_types.hpp
Go to the documentation of this file.
00001 //
00002 // socket_types.hpp
00003 // ~~~~~~~~~~~~~~~~
00004 //
00005 // Copyright (c) 2003-2008 Christopher M. Kohlhoff (chris at kohlhoff dot com)
00006 //
00007 // Distributed under the Boost Software License, Version 1.0. (See accompanying
00008 // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
00009 //
00010 
00011 #ifndef ASIO_DETAIL_SOCKET_TYPES_HPP
00012 #define ASIO_DETAIL_SOCKET_TYPES_HPP
00013 
00014 #if defined(_MSC_VER) && (_MSC_VER >= 1200)
00015 # pragma once
00016 #endif // defined(_MSC_VER) && (_MSC_VER >= 1200)
00017 
00018 #include "asio/detail/push_options.hpp"
00019 
00020 #include "asio/detail/push_options.hpp"
00021 #include <boost/config.hpp>
00022 #include "asio/detail/pop_options.hpp"
00023 
00024 #include "asio/detail/push_options.hpp"
00025 #if defined(BOOST_WINDOWS) || defined(__CYGWIN__)
00026 # if defined(_WINSOCKAPI_) && !defined(_WINSOCK2API_)
00027 #  error WinSock.h has already been included
00028 # endif // defined(_WINSOCKAPI_) && !defined(_WINSOCK2API_)
00029 # if !defined(_WIN32_WINNT) && !defined(_WIN32_WINDOWS)
00030 #  if defined(_MSC_VER) || defined(__BORLANDC__)
00031 #   pragma message("Please define _WIN32_WINNT or _WIN32_WINDOWS appropriately")
00032 #   pragma message("Assuming _WIN32_WINNT=0x0501 (i.e. Windows XP target)")
00033 #  else // defined(_MSC_VER) || defined(__BORLANDC__)
00034 #   warning Please define _WIN32_WINNT or _WIN32_WINDOWS appropriately
00035 #   warning Assuming _WIN32_WINNT=0x0501 (i.e. Windows XP target)
00036 #  endif // defined(_MSC_VER) || defined(__BORLANDC__)
00037 #  define _WIN32_WINNT 0x0501
00038 # endif // !defined(_WIN32_WINNT) && !defined(_WIN32_WINDOWS)
00039 # if defined(_MSC_VER)
00040 #  if defined(_WIN32) && !defined(WIN32)
00041 #   if !defined(_WINSOCK2API_)
00042 #    define WIN32 // Needed for correct types in winsock2.h
00043 #   else // !defined(_WINSOCK2API_)
00044 #    error Please define the macro WIN32 in your compiler options
00045 #   endif // !defined(_WINSOCK2API_)
00046 #  endif // defined(_WIN32) && !defined(WIN32)
00047 # endif // defined(_MSC_VER)
00048 # if defined(__BORLANDC__)
00049 #  include <stdlib.h> // Needed for __errno
00050 #  if defined(__WIN32__) && !defined(WIN32)
00051 #   if !defined(_WINSOCK2API_)
00052 #    define WIN32 // Needed for correct types in winsock2.h
00053 #   else // !defined(_WINSOCK2API_)
00054 #    error Please define the macro WIN32 in your compiler options
00055 #   endif // !defined(_WINSOCK2API_)
00056 #  endif // defined(__WIN32__) && !defined(WIN32)
00057 #  if !defined(_WSPIAPI_H_)
00058 #   define _WSPIAPI_H_
00059 #   define ASIO_WSPIAPI_H_DEFINED
00060 #  endif // !defined(_WSPIAPI_H_)
00061 # endif // defined(__BORLANDC__)
00062 # if !defined(ASIO_NO_WIN32_LEAN_AND_MEAN)
00063 #  if !defined(WIN32_LEAN_AND_MEAN)
00064 #   define WIN32_LEAN_AND_MEAN
00065 #  endif // !defined(WIN32_LEAN_AND_MEAN)
00066 # endif // !defined(ASIO_NO_WIN32_LEAN_AND_MEAN)
00067 # if defined(__CYGWIN__)
00068 #  if !defined(__USE_W32_SOCKETS)
00069 #   error You must add -D__USE_W32_SOCKETS to your compiler options.
00070 #  endif // !defined(__USE_W32_SOCKETS)
00071 #  if !defined(NOMINMAX)
00072 #   define NOMINMAX 1
00073 #  endif // !defined(NOMINMAX)
00074 # endif // defined(__CYGWIN__)
00075 # include <winsock2.h>
00076 # include <ws2tcpip.h>
00077 # include <mswsock.h>
00078 # if defined(ASIO_WSPIAPI_H_DEFINED)
00079 #  undef _WSPIAPI_H_
00080 #  undef ASIO_WSPIAPI_H_DEFINED
00081 # endif // defined(ASIO_WSPIAPI_H_DEFINED)
00082 # if !defined(ASIO_NO_DEFAULT_LINKED_LIBS)
00083 #  if defined(UNDER_CE)
00084 #   pragma comment(lib, "ws2.lib")
00085 #  elif defined(_MSC_VER) || defined(__BORLANDC__)
00086 #   pragma comment(lib, "ws2_32.lib")
00087 #   pragma comment(lib, "mswsock.lib")
00088 #  endif // defined(_MSC_VER) || defined(__BORLANDC__)
00089 # endif // !defined(ASIO_NO_DEFAULT_LINKED_LIBS)
00090 # include "asio/detail/old_win_sdk_compat.hpp"
00091 #else
00092 # include <sys/ioctl.h>
00093 # include <sys/poll.h>
00094 # include <sys/types.h>
00095 # if defined(__hpux) && !defined(__HP_aCC)
00096 #  include <sys/time.h>
00097 # else
00098 #  include <sys/select.h>
00099 # endif
00100 # include <sys/socket.h>
00101 # include <sys/uio.h>
00102 # include <sys/un.h>
00103 # include <netinet/in.h>
00104 # include <netinet/tcp.h>
00105 # include <arpa/inet.h>
00106 # include <netdb.h>
00107 # include <net/if.h>
00108 # include <limits.h>
00109 # if defined(__sun)
00110 #  include <sys/filio.h>
00111 #  include <sys/sockio.h>
00112 # endif
00113 #endif
00114 #include "asio/detail/pop_options.hpp"
00115 
00116 namespace asio {
00117 namespace detail {
00118 
00119 #if defined(BOOST_WINDOWS) || defined(__CYGWIN__)
00120 typedef SOCKET socket_type;
00121 const SOCKET invalid_socket = INVALID_SOCKET;
00122 const int socket_error_retval = SOCKET_ERROR;
00123 const int max_addr_v4_str_len = 256;
00124 const int max_addr_v6_str_len = 256;
00125 typedef sockaddr socket_addr_type;
00126 typedef in_addr in4_addr_type;
00127 typedef ip_mreq in4_mreq_type;
00128 typedef sockaddr_in sockaddr_in4_type;
00129 # if defined(ASIO_HAS_OLD_WIN_SDK)
00130 typedef in6_addr_emulation in6_addr_type;
00131 typedef ipv6_mreq_emulation in6_mreq_type;
00132 typedef sockaddr_in6_emulation sockaddr_in6_type;
00133 typedef sockaddr_storage_emulation sockaddr_storage_type;
00134 typedef addrinfo_emulation addrinfo_type;
00135 # else
00136 typedef in6_addr in6_addr_type;
00137 typedef ipv6_mreq in6_mreq_type;
00138 typedef sockaddr_in6 sockaddr_in6_type;
00139 typedef sockaddr_storage sockaddr_storage_type;
00140 typedef addrinfo addrinfo_type;
00141 # endif
00142 typedef unsigned long ioctl_arg_type;
00143 typedef u_long u_long_type;
00144 typedef u_short u_short_type;
00145 const int shutdown_receive = SD_RECEIVE;
00146 const int shutdown_send = SD_SEND;
00147 const int shutdown_both = SD_BOTH;
00148 const int message_peek = MSG_PEEK;
00149 const int message_out_of_band = MSG_OOB;
00150 const int message_do_not_route = MSG_DONTROUTE;
00151 # if defined (_WIN32_WINNT)
00152 const int max_iov_len = 64;
00153 # else
00154 const int max_iov_len = 16;
00155 # endif
00156 #else
00157 typedef int socket_type;
00158 const int invalid_socket = -1;
00159 const int socket_error_retval = -1;
00160 const int max_addr_v4_str_len = INET_ADDRSTRLEN;
00161 const int max_addr_v6_str_len = INET6_ADDRSTRLEN + 1 + IF_NAMESIZE;
00162 typedef sockaddr socket_addr_type;
00163 typedef in_addr in4_addr_type;
00164 # if defined(__hpux)
00165 // HP-UX doesn't provide ip_mreq when _XOPEN_SOURCE_EXTENDED is defined.
00166 struct in4_mreq_type
00167 {
00168   struct in_addr imr_multiaddr;
00169   struct in_addr imr_interface;
00170 };
00171 # else
00172 typedef ip_mreq in4_mreq_type;
00173 # endif
00174 typedef sockaddr_in sockaddr_in4_type;
00175 typedef in6_addr in6_addr_type;
00176 typedef ipv6_mreq in6_mreq_type;
00177 typedef sockaddr_in6 sockaddr_in6_type;
00178 typedef sockaddr_storage sockaddr_storage_type;
00179 typedef sockaddr_un sockaddr_un_type;
00180 typedef addrinfo addrinfo_type;
00181 typedef int ioctl_arg_type;
00182 typedef uint32_t u_long_type;
00183 typedef uint16_t u_short_type;
00184 const int shutdown_receive = SHUT_RD;
00185 const int shutdown_send = SHUT_WR;
00186 const int shutdown_both = SHUT_RDWR;
00187 const int message_peek = MSG_PEEK;
00188 const int message_out_of_band = MSG_OOB;
00189 const int message_do_not_route = MSG_DONTROUTE;
00190 # if defined(IOV_MAX)
00191 const int max_iov_len = IOV_MAX;
00192 # else
00193 // POSIX platforms are not required to define IOV_MAX.
00194 const int max_iov_len = 16;
00195 # endif
00196 #endif
00197 const int custom_socket_option_level = 0xA5100000;
00198 const int enable_connection_aborted_option = 1;
00199 const int always_fail_option = 2;
00200 
00201 } // namespace detail
00202 } // namespace asio
00203 
00204 #include "asio/detail/pop_options.hpp"
00205 
00206 #endif // ASIO_DETAIL_SOCKET_TYPES_HPP
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines


Castor
Author(s): Carpe Noctem
autogenerated on Fri Nov 8 2013 11:05:39