1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216
|
//
// detail/old_win_sdk_compat.hpp
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
// Copyright (c) 2003-2012 Christopher M. Kohlhoff (chris at kohlhoff dot com)
//
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
//
#ifndef BOOST_ASIO_DETAIL_OLD_WIN_SDK_COMPAT_HPP
#define BOOST_ASIO_DETAIL_OLD_WIN_SDK_COMPAT_HPP
#if defined(_MSC_VER) && (_MSC_VER >= 1200)
# pragma once
#endif // defined(_MSC_VER) && (_MSC_VER >= 1200)
#include <boost/asio/detail/config.hpp>
#if defined(BOOST_WINDOWS) || defined(__CYGWIN__)
// Guess whether we are building against on old Platform SDK.
#if !defined(IN6ADDR_ANY_INIT)
#define BOOST_ASIO_HAS_OLD_WIN_SDK 1
#endif // !defined(IN6ADDR_ANY_INIT)
#if defined(BOOST_ASIO_HAS_OLD_WIN_SDK)
// Emulation of types that are missing from old Platform SDKs.
//
// N.B. this emulation is also used if building for a Windows 2000 target with
// a recent (i.e. Vista or later) SDK, as the SDK does not provide IPv6 support
// in that case.
#include <boost/asio/detail/push_options.hpp>
namespace boost {
namespace asio {
namespace detail {
enum
{
sockaddr_storage_maxsize = 128, // Maximum size.
sockaddr_storage_alignsize = (sizeof(__int64)), // Desired alignment.
sockaddr_storage_pad1size = (sockaddr_storage_alignsize - sizeof(short)),
sockaddr_storage_pad2size = (sockaddr_storage_maxsize -
(sizeof(short) + sockaddr_storage_pad1size + sockaddr_storage_alignsize))
};
struct sockaddr_storage_emulation
{
short ss_family;
char __ss_pad1[sockaddr_storage_pad1size];
__int64 __ss_align;
char __ss_pad2[sockaddr_storage_pad2size];
};
struct in6_addr_emulation
{
union
{
u_char Byte[16];
u_short Word[8];
} u;
};
#if !defined(s6_addr)
# define _S6_un u
# define _S6_u8 Byte
# define s6_addr _S6_un._S6_u8
#endif // !defined(s6_addr)
struct sockaddr_in6_emulation
{
short sin6_family;
u_short sin6_port;
u_long sin6_flowinfo;
in6_addr_emulation sin6_addr;
u_long sin6_scope_id;
};
struct ipv6_mreq_emulation
{
in6_addr_emulation ipv6mr_multiaddr;
unsigned int ipv6mr_interface;
};
struct addrinfo_emulation
{
int ai_flags;
int ai_family;
int ai_socktype;
int ai_protocol;
size_t ai_addrlen;
char* ai_canonname;
sockaddr* ai_addr;
addrinfo_emulation* ai_next;
};
#if !defined(AI_PASSIVE)
# define AI_PASSIVE 0x1
#endif
#if !defined(AI_CANONNAME)
# define AI_CANONNAME 0x2
#endif
#if !defined(AI_NUMERICHOST)
# define AI_NUMERICHOST 0x4
#endif
#if !defined(EAI_AGAIN)
# define EAI_AGAIN WSATRY_AGAIN
#endif
#if !defined(EAI_BADFLAGS)
# define EAI_BADFLAGS WSAEINVAL
#endif
#if !defined(EAI_FAIL)
# define EAI_FAIL WSANO_RECOVERY
#endif
#if !defined(EAI_FAMILY)
# define EAI_FAMILY WSAEAFNOSUPPORT
#endif
#if !defined(EAI_MEMORY)
# define EAI_MEMORY WSA_NOT_ENOUGH_MEMORY
#endif
#if !defined(EAI_NODATA)
# define EAI_NODATA WSANO_DATA
#endif
#if !defined(EAI_NONAME)
# define EAI_NONAME WSAHOST_NOT_FOUND
#endif
#if !defined(EAI_SERVICE)
# define EAI_SERVICE WSATYPE_NOT_FOUND
#endif
#if !defined(EAI_SOCKTYPE)
# define EAI_SOCKTYPE WSAESOCKTNOSUPPORT
#endif
#if !defined(NI_NOFQDN)
# define NI_NOFQDN 0x01
#endif
#if !defined(NI_NUMERICHOST)
# define NI_NUMERICHOST 0x02
#endif
#if !defined(NI_NAMEREQD)
# define NI_NAMEREQD 0x04
#endif
#if !defined(NI_NUMERICSERV)
# define NI_NUMERICSERV 0x08
#endif
#if !defined(NI_DGRAM)
# define NI_DGRAM 0x10
#endif
#if !defined(IPPROTO_IPV6)
# define IPPROTO_IPV6 41
#endif
#if !defined(IPV6_UNICAST_HOPS)
# define IPV6_UNICAST_HOPS 4
#endif
#if !defined(IPV6_MULTICAST_IF)
# define IPV6_MULTICAST_IF 9
#endif
#if !defined(IPV6_MULTICAST_HOPS)
# define IPV6_MULTICAST_HOPS 10
#endif
#if !defined(IPV6_MULTICAST_LOOP)
# define IPV6_MULTICAST_LOOP 11
#endif
#if !defined(IPV6_JOIN_GROUP)
# define IPV6_JOIN_GROUP 12
#endif
#if !defined(IPV6_LEAVE_GROUP)
# define IPV6_LEAVE_GROUP 13
#endif
} // namespace detail
} // namespace asio
} // namespace boost
#include <boost/asio/detail/pop_options.hpp>
#endif // defined(BOOST_ASIO_HAS_OLD_WIN_SDK)
// Even newer Platform SDKs that support IPv6 may not define IPV6_V6ONLY.
#if !defined(IPV6_V6ONLY)
# define IPV6_V6ONLY 27
#endif
// Some SDKs (e.g. Windows CE) don't define IPPROTO_ICMPV6.
#if !defined(IPPROTO_ICMPV6)
# define IPPROTO_ICMPV6 58
#endif
#endif // defined(BOOST_WINDOWS) || defined(__CYGWIN__)
#endif // BOOST_ASIO_DETAIL_OLD_WIN_SDK_COMPAT_HPP
|