Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:28:42

0001 //
0002 // detail/old_win_sdk_compat.hpp
0003 // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
0004 //
0005 // Copyright (c) 2003-2023 Christopher M. Kohlhoff (chris at kohlhoff dot com)
0006 //
0007 // Distributed under the Boost Software License, Version 1.0. (See accompanying
0008 // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
0009 //
0010 
0011 #ifndef BOOST_ASIO_DETAIL_OLD_WIN_SDK_COMPAT_HPP
0012 #define BOOST_ASIO_DETAIL_OLD_WIN_SDK_COMPAT_HPP
0013 
0014 #if defined(_MSC_VER) && (_MSC_VER >= 1200)
0015 # pragma once
0016 #endif // defined(_MSC_VER) && (_MSC_VER >= 1200)
0017 
0018 #include <boost/asio/detail/config.hpp>
0019 
0020 #if defined(BOOST_ASIO_WINDOWS) || defined(__CYGWIN__)
0021 
0022 // Guess whether we are building against on old Platform SDK.
0023 #if !defined(IN6ADDR_ANY_INIT)
0024 #define BOOST_ASIO_HAS_OLD_WIN_SDK 1
0025 #endif // !defined(IN6ADDR_ANY_INIT)
0026 
0027 #if defined(BOOST_ASIO_HAS_OLD_WIN_SDK)
0028 
0029 // Emulation of types that are missing from old Platform SDKs.
0030 //
0031 // N.B. this emulation is also used if building for a Windows 2000 target with
0032 // a recent (i.e. Vista or later) SDK, as the SDK does not provide IPv6 support
0033 // in that case.
0034 
0035 #include <boost/asio/detail/push_options.hpp>
0036 
0037 namespace boost {
0038 namespace asio {
0039 namespace detail {
0040 
0041 enum
0042 {
0043   sockaddr_storage_maxsize = 128, // Maximum size.
0044   sockaddr_storage_alignsize = (sizeof(__int64)), // Desired alignment.
0045   sockaddr_storage_pad1size = (sockaddr_storage_alignsize - sizeof(short)),
0046   sockaddr_storage_pad2size = (sockaddr_storage_maxsize -
0047       (sizeof(short) + sockaddr_storage_pad1size + sockaddr_storage_alignsize))
0048 };
0049 
0050 struct sockaddr_storage_emulation
0051 {
0052   short ss_family;
0053   char __ss_pad1[sockaddr_storage_pad1size];
0054   __int64 __ss_align;
0055   char __ss_pad2[sockaddr_storage_pad2size];
0056 };
0057 
0058 struct in6_addr_emulation
0059 {
0060   union
0061   {
0062     u_char Byte[16];
0063     u_short Word[8];
0064   } u;
0065 };
0066 
0067 #if !defined(s6_addr)
0068 # define _S6_un u
0069 # define _S6_u8 Byte
0070 # define s6_addr _S6_un._S6_u8
0071 #endif // !defined(s6_addr)
0072 
0073 struct sockaddr_in6_emulation
0074 {
0075   short sin6_family;
0076   u_short sin6_port;
0077   u_long sin6_flowinfo;
0078   in6_addr_emulation sin6_addr;
0079   u_long sin6_scope_id;
0080 };
0081 
0082 struct ipv6_mreq_emulation
0083 {
0084   in6_addr_emulation ipv6mr_multiaddr;
0085   unsigned int ipv6mr_interface;
0086 };
0087 
0088 struct addrinfo_emulation
0089 {
0090   int ai_flags;
0091   int ai_family;
0092   int ai_socktype;
0093   int ai_protocol;
0094   size_t ai_addrlen;
0095   char* ai_canonname;
0096   sockaddr* ai_addr;
0097   addrinfo_emulation* ai_next;
0098 };
0099 
0100 #if !defined(AI_PASSIVE)
0101 # define AI_PASSIVE 0x1
0102 #endif
0103 
0104 #if !defined(AI_CANONNAME)
0105 # define AI_CANONNAME 0x2
0106 #endif
0107 
0108 #if !defined(AI_NUMERICHOST)
0109 # define AI_NUMERICHOST 0x4
0110 #endif
0111 
0112 #if !defined(EAI_AGAIN)
0113 # define EAI_AGAIN WSATRY_AGAIN
0114 #endif
0115 
0116 #if !defined(EAI_BADFLAGS)
0117 # define EAI_BADFLAGS WSAEINVAL
0118 #endif
0119 
0120 #if !defined(EAI_FAIL)
0121 # define EAI_FAIL WSANO_RECOVERY
0122 #endif
0123 
0124 #if !defined(EAI_FAMILY)
0125 # define EAI_FAMILY WSAEAFNOSUPPORT
0126 #endif
0127 
0128 #if !defined(EAI_MEMORY)
0129 # define EAI_MEMORY WSA_NOT_ENOUGH_MEMORY
0130 #endif
0131 
0132 #if !defined(EAI_NODATA)
0133 # define EAI_NODATA WSANO_DATA
0134 #endif
0135 
0136 #if !defined(EAI_NONAME)
0137 # define EAI_NONAME WSAHOST_NOT_FOUND
0138 #endif
0139 
0140 #if !defined(EAI_SERVICE)
0141 # define EAI_SERVICE WSATYPE_NOT_FOUND
0142 #endif
0143 
0144 #if !defined(EAI_SOCKTYPE)
0145 # define EAI_SOCKTYPE WSAESOCKTNOSUPPORT
0146 #endif
0147 
0148 #if !defined(NI_NOFQDN)
0149 # define NI_NOFQDN 0x01
0150 #endif
0151 
0152 #if !defined(NI_NUMERICHOST)
0153 # define NI_NUMERICHOST 0x02
0154 #endif
0155 
0156 #if !defined(NI_NAMEREQD)
0157 # define NI_NAMEREQD 0x04
0158 #endif
0159 
0160 #if !defined(NI_NUMERICSERV)
0161 # define NI_NUMERICSERV 0x08
0162 #endif
0163 
0164 #if !defined(NI_DGRAM)
0165 # define NI_DGRAM 0x10
0166 #endif
0167 
0168 #if !defined(IPPROTO_IPV6)
0169 # define IPPROTO_IPV6 41
0170 #endif
0171 
0172 #if !defined(IPV6_UNICAST_HOPS)
0173 # define IPV6_UNICAST_HOPS 4
0174 #endif
0175 
0176 #if !defined(IPV6_MULTICAST_IF)
0177 # define IPV6_MULTICAST_IF 9
0178 #endif
0179 
0180 #if !defined(IPV6_MULTICAST_HOPS)
0181 # define IPV6_MULTICAST_HOPS 10
0182 #endif
0183 
0184 #if !defined(IPV6_MULTICAST_LOOP)
0185 # define IPV6_MULTICAST_LOOP 11
0186 #endif
0187 
0188 #if !defined(IPV6_JOIN_GROUP)
0189 # define IPV6_JOIN_GROUP 12
0190 #endif
0191 
0192 #if !defined(IPV6_LEAVE_GROUP)
0193 # define IPV6_LEAVE_GROUP 13
0194 #endif
0195 
0196 } // namespace detail
0197 } // namespace asio
0198 } // namespace boost
0199 
0200 #include <boost/asio/detail/pop_options.hpp>
0201 
0202 #endif // defined(BOOST_ASIO_HAS_OLD_WIN_SDK)
0203 
0204 // Even newer Platform SDKs that support IPv6 may not define IPV6_V6ONLY.
0205 #if !defined(IPV6_V6ONLY)
0206 # define IPV6_V6ONLY 27
0207 #endif
0208 
0209 // Some SDKs (e.g. Windows CE) don't define IPPROTO_ICMPV6.
0210 #if !defined(IPPROTO_ICMPV6)
0211 # define IPPROTO_ICMPV6 58
0212 #endif
0213 
0214 #endif // defined(BOOST_ASIO_WINDOWS) || defined(__CYGWIN__)
0215 
0216 #endif // BOOST_ASIO_DETAIL_OLD_WIN_SDK_COMPAT_HPP