Statistics
| Revision:

root / tmp / org.txm.statsengine.r.core.win32 / res / win32 / library / BH / include / boost / asio / detail / old_win_sdk_compat.hpp @ 2486

History | View | Annotate | Download (4.4 kB)

1
//
2
// detail/old_win_sdk_compat.hpp
3
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
4
//
5
// Copyright (c) 2003-2015 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_OLD_WIN_SDK_COMPAT_HPP
12
#define BOOST_ASIO_DETAIL_OLD_WIN_SDK_COMPAT_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_ASIO_WINDOWS) || defined(__CYGWIN__)
21

    
22
// Guess whether we are building against on old Platform SDK.
23
#if !defined(IN6ADDR_ANY_INIT)
24
#define BOOST_ASIO_HAS_OLD_WIN_SDK 1
25
#endif // !defined(IN6ADDR_ANY_INIT)
26

    
27
#if defined(BOOST_ASIO_HAS_OLD_WIN_SDK)
28

    
29
// Emulation of types that are missing from old Platform SDKs.
30
//
31
// N.B. this emulation is also used if building for a Windows 2000 target with
32
// a recent (i.e. Vista or later) SDK, as the SDK does not provide IPv6 support
33
// in that case.
34

    
35
#include <boost/asio/detail/push_options.hpp>
36

    
37
namespace boost {
38
namespace asio {
39
namespace detail {
40

    
41
enum
42
{
43
  sockaddr_storage_maxsize = 128, // Maximum size.
44
  sockaddr_storage_alignsize = (sizeof(__int64)), // Desired alignment.
45
  sockaddr_storage_pad1size = (sockaddr_storage_alignsize - sizeof(short)),
46
  sockaddr_storage_pad2size = (sockaddr_storage_maxsize -
47
      (sizeof(short) + sockaddr_storage_pad1size + sockaddr_storage_alignsize))
48
};
49

    
50
struct sockaddr_storage_emulation
51
{
52
  short ss_family;
53
  char __ss_pad1[sockaddr_storage_pad1size];
54
  __int64 __ss_align;
55
  char __ss_pad2[sockaddr_storage_pad2size];
56
};
57

    
58
struct in6_addr_emulation
59
{
60
  union
61
  {
62
    u_char Byte[16];
63
    u_short Word[8];
64
  } u;
65
};
66

    
67
#if !defined(s6_addr)
68
# define _S6_un u
69
# define _S6_u8 Byte
70
# define s6_addr _S6_un._S6_u8
71
#endif // !defined(s6_addr)
72

    
73
struct sockaddr_in6_emulation
74
{
75
  short sin6_family;
76
  u_short sin6_port;
77
  u_long sin6_flowinfo;
78
  in6_addr_emulation sin6_addr;
79
  u_long sin6_scope_id;
80
};
81

    
82
struct ipv6_mreq_emulation
83
{
84
  in6_addr_emulation ipv6mr_multiaddr;
85
  unsigned int ipv6mr_interface;
86
};
87

    
88
struct addrinfo_emulation
89
{
90
  int ai_flags;
91
  int ai_family;
92
  int ai_socktype;
93
  int ai_protocol;
94
  size_t ai_addrlen;
95
  char* ai_canonname;
96
  sockaddr* ai_addr;
97
  addrinfo_emulation* ai_next;
98
};
99

    
100
#if !defined(AI_PASSIVE)
101
# define AI_PASSIVE 0x1
102
#endif
103

    
104
#if !defined(AI_CANONNAME)
105
# define AI_CANONNAME 0x2
106
#endif
107

    
108
#if !defined(AI_NUMERICHOST)
109
# define AI_NUMERICHOST 0x4
110
#endif
111

    
112
#if !defined(EAI_AGAIN)
113
# define EAI_AGAIN WSATRY_AGAIN
114
#endif
115

    
116
#if !defined(EAI_BADFLAGS)
117
# define EAI_BADFLAGS WSAEINVAL
118
#endif
119

    
120
#if !defined(EAI_FAIL)
121
# define EAI_FAIL WSANO_RECOVERY
122
#endif
123

    
124
#if !defined(EAI_FAMILY)
125
# define EAI_FAMILY WSAEAFNOSUPPORT
126
#endif
127

    
128
#if !defined(EAI_MEMORY)
129
# define EAI_MEMORY WSA_NOT_ENOUGH_MEMORY
130
#endif
131

    
132
#if !defined(EAI_NODATA)
133
# define EAI_NODATA WSANO_DATA
134
#endif
135

    
136
#if !defined(EAI_NONAME)
137
# define EAI_NONAME WSAHOST_NOT_FOUND
138
#endif
139

    
140
#if !defined(EAI_SERVICE)
141
# define EAI_SERVICE WSATYPE_NOT_FOUND
142
#endif
143

    
144
#if !defined(EAI_SOCKTYPE)
145
# define EAI_SOCKTYPE WSAESOCKTNOSUPPORT
146
#endif
147

    
148
#if !defined(NI_NOFQDN)
149
# define NI_NOFQDN 0x01
150
#endif
151

    
152
#if !defined(NI_NUMERICHOST)
153
# define NI_NUMERICHOST 0x02
154
#endif
155

    
156
#if !defined(NI_NAMEREQD)
157
# define NI_NAMEREQD 0x04
158
#endif
159

    
160
#if !defined(NI_NUMERICSERV)
161
# define NI_NUMERICSERV 0x08
162
#endif
163

    
164
#if !defined(NI_DGRAM)
165
# define NI_DGRAM 0x10
166
#endif
167

    
168
#if !defined(IPPROTO_IPV6)
169
# define IPPROTO_IPV6 41
170
#endif
171

    
172
#if !defined(IPV6_UNICAST_HOPS)
173
# define IPV6_UNICAST_HOPS 4
174
#endif
175

    
176
#if !defined(IPV6_MULTICAST_IF)
177
# define IPV6_MULTICAST_IF 9
178
#endif
179

    
180
#if !defined(IPV6_MULTICAST_HOPS)
181
# define IPV6_MULTICAST_HOPS 10
182
#endif
183

    
184
#if !defined(IPV6_MULTICAST_LOOP)
185
# define IPV6_MULTICAST_LOOP 11
186
#endif
187

    
188
#if !defined(IPV6_JOIN_GROUP)
189
# define IPV6_JOIN_GROUP 12
190
#endif
191

    
192
#if !defined(IPV6_LEAVE_GROUP)
193
# define IPV6_LEAVE_GROUP 13
194
#endif
195

    
196
} // namespace detail
197
} // namespace asio
198
} // namespace boost
199

    
200
#include <boost/asio/detail/pop_options.hpp>
201

    
202
#endif // defined(BOOST_ASIO_HAS_OLD_WIN_SDK)
203

    
204
// Even newer Platform SDKs that support IPv6 may not define IPV6_V6ONLY.
205
#if !defined(IPV6_V6ONLY)
206
# define IPV6_V6ONLY 27
207
#endif
208

    
209
// Some SDKs (e.g. Windows CE) don't define IPPROTO_ICMPV6.
210
#if !defined(IPPROTO_ICMPV6)
211
# define IPPROTO_ICMPV6 58
212
#endif
213

    
214
#endif // defined(BOOST_ASIO_WINDOWS) || defined(__CYGWIN__)
215

    
216
#endif // BOOST_ASIO_DETAIL_OLD_WIN_SDK_COMPAT_HPP