| 1 | /** | 
 
 
 
 
 | 2 | * This file has no copyright assigned and is placed in the Public Domain. | 
 
 
 
 
 | 3 | * This file is part of the mingw-w64 runtime package. | 
 
 
 
 
 | 4 | * No warranty is given; refer to the file DISCLAIMER.PD within this package. | 
 
 
 
 
 | 5 | */ | 
 
 
 
 
 | 6 | #ifndef _WS2TCPIP_H_ | 
 
 
 
 
 | 7 | #define _WS2TCPIP_H_ | 
 
 
 
 
 | 8 |  | 
 
 
 
 
 | 9 | #include <_mingw_unicode.h> | 
 
 
 
 
 | 10 |  | 
 
 
 
 
 | 11 | #ifdef __LP64__ | 
 
 
 
 
 | 12 | #pragma push_macro("u_long") | 
 
 
 
 
 | 13 | #undef u_long | 
 
 
 
 
 | 14 | #define u_long __ms_u_long | 
 
 
 
 
 | 15 | #endif | 
 
 
 
 
 | 16 |  | 
 
 
 
 
 | 17 | #include <winsock2.h> | 
 
 
 
 
 | 18 | #include <ws2ipdef.h> | 
 
 
 
 
 | 19 | #include <psdk_inc/_ip_mreq1.h> | 
 
 
 
 
 | 20 | #include <winapifamily.h> | 
 
 
 
 
 | 21 |  | 
 
 
 
 
 | 22 | #define SIO_GET_INTERFACE_LIST _IOR('t',127,u_long) | 
 
 
 
 
 | 23 |  | 
 
 
 
 
 | 24 | #define SIO_GET_INTERFACE_LIST_EX _IOR('t',126,u_long) | 
 
 
 
 
 | 25 | #define SIO_SET_MULTICAST_FILTER _IOW('t',125,u_long) | 
 
 
 
 
 | 26 | #define SIO_GET_MULTICAST_FILTER _IOW('t',124 | IOC_IN,u_long) | 
 
 
 
 
 | 27 |  | 
 
 
 
 
 | 28 | #define UDP_NOCHECKSUM 1 | 
 
 
 
 
 | 29 | #define UDP_CHECKSUM_COVERAGE 20 | 
 
 
 
 
 | 30 |  | 
 
 
 
 
 | 31 | #define TCP_EXPEDITED_1122 0x0002 | 
 
 
 
 
 | 32 |  | 
 
 
 
 
 | 33 |  | 
 
 
 
 
 | 34 | #include <ws2ipdef.h> | 
 
 
 
 
 | 35 |  | 
 
 
 
 
 | 36 |  | 
 
 
 
 
 | 37 | #define SS_PORT(ssp) (((struct sockaddr_in*)(ssp))->sin_port) | 
 
 
 
 
 | 38 |  | 
 
 
 
 
 | 39 | #define IN6ADDR_ANY_INIT { { { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 } } } | 
 
 
 
 
 | 40 | #define IN6ADDR_LOOPBACK_INIT { { { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1 } } } | 
 
 
 
 
 | 41 |  | 
 
 
 
 
 | 42 | #ifdef __cplusplus | 
 
 
 
 
 | 43 | extern "C" { | 
 
 
 
 
 | 44 | #endif | 
 
 
 
 
 | 45 |  | 
 
 
 
 
 | 46 | extern const struct in6_addr in6addr_any; | 
 
 
 
 
 | 47 | extern const struct in6_addr in6addr_loopback; | 
 
 
 
 
 | 48 |  | 
 
 
 
 
 | 49 | int IN6_IS_ADDR_UNSPECIFIED(const struct in6_addr *); | 
 
 
 
 
 | 50 | int IN6_IS_ADDR_LOOPBACK(const struct in6_addr *); | 
 
 
 
 
 | 51 | int IN6_IS_ADDR_MULTICAST(const struct in6_addr *); | 
 
 
 
 
 | 52 | int IN6_IS_ADDR_LINKLOCAL(const struct in6_addr *); | 
 
 
 
 
 | 53 | int IN6_IS_ADDR_SITELOCAL(const struct in6_addr *); | 
 
 
 
 
 | 54 | int IN6_IS_ADDR_V4MAPPED(const struct in6_addr *); | 
 
 
 
 
 | 55 | int IN6_IS_ADDR_V4COMPAT(const struct in6_addr *); | 
 
 
 
 
 | 56 | int IN6_IS_ADDR_MC_NODELOCAL(const struct in6_addr *); | 
 
 
 
 
 | 57 | int IN6_IS_ADDR_MC_LINKLOCAL(const struct in6_addr *); | 
 
 
 
 
 | 58 | int IN6_IS_ADDR_MC_SITELOCAL(const struct in6_addr *); | 
 
 
 
 
 | 59 | int IN6_IS_ADDR_MC_ORGLOCAL(const struct in6_addr *); | 
 
 
 
 
 | 60 | int IN6_IS_ADDR_MC_GLOBAL(const struct in6_addr *); | 
 
 
 
 
 | 61 | int IN6ADDR_ISANY(const struct sockaddr_in6 *); | 
 
 
 
 
 | 62 | int IN6ADDR_ISLOOPBACK(const struct sockaddr_in6 *); | 
 
 
 
 
 | 63 | void IN6_SET_ADDR_UNSPECIFIED(struct in6_addr *); | 
 
 
 
 
 | 64 | void IN6_SET_ADDR_LOOPBACK(struct in6_addr *); | 
 
 
 
 
 | 65 | void IN6ADDR_SETANY(struct sockaddr_in6 *); | 
 
 
 
 
 | 66 | void IN6ADDR_SETLOOPBACK(struct sockaddr_in6 *); | 
 
 
 
 
 | 67 |  | 
 
 
 
 
 | 68 | WS2TCPIP_INLINE int IN6_IS_ADDR_UNSPECIFIED(const struct in6_addr *a) { return ((a->s6_words[0]==0) && (a->s6_words[1]==0) && (a->s6_words[2]==0) && (a->s6_words[3]==0) && (a->s6_words[4]==0) && (a->s6_words[5]==0) && (a->s6_words[6]==0) && (a->s6_words[7]==0)); } | 
 
 
 
 
 | 69 | WS2TCPIP_INLINE int IN6_IS_ADDR_LOOPBACK(const struct in6_addr *a) { return ((a->s6_words[0]==0) && (a->s6_words[1]==0) && (a->s6_words[2]==0) && (a->s6_words[3]==0) && (a->s6_words[4]==0) && (a->s6_words[5]==0) && (a->s6_words[6]==0) && (a->s6_words[7]==0x0100)); } | 
 
 
 
 
 | 70 | WS2TCPIP_INLINE int IN6_IS_ADDR_MULTICAST(const struct in6_addr *a) { return (a->s6_bytes[0]==0xff); } | 
 
 
 
 
 | 71 | WS2TCPIP_INLINE int IN6_IS_ADDR_LINKLOCAL(const struct in6_addr *a) { return ((a->s6_bytes[0]==0xfe) && ((a->s6_bytes[1] & 0xc0)==0x80)); } | 
 
 
 
 
 | 72 | WS2TCPIP_INLINE int IN6_IS_ADDR_SITELOCAL(const struct in6_addr *a) { return ((a->s6_bytes[0]==0xfe) && ((a->s6_bytes[1] & 0xc0)==0xc0)); } | 
 
 
 
 
 | 73 | WS2TCPIP_INLINE int IN6_IS_ADDR_V4MAPPED(const struct in6_addr *a) { return ((a->s6_words[0]==0) && (a->s6_words[1]==0) && (a->s6_words[2]==0) && (a->s6_words[3]==0) && (a->s6_words[4]==0) && (a->s6_words[5]==0xffff)); } | 
 
 
 
 
 | 74 | WS2TCPIP_INLINE int IN6_IS_ADDR_V4COMPAT(const struct in6_addr *a) { return ((a->s6_words[0]==0) && (a->s6_words[1]==0) && (a->s6_words[2]==0) && (a->s6_words[3]==0) && (a->s6_words[4]==0) && (a->s6_words[5]==0) && !((a->s6_words[6]==0) && (a->s6_addr[14]==0) && ((a->s6_addr[15]==0) || (a->s6_addr[15]==1)))); } | 
 
 
 
 
 | 75 | WS2TCPIP_INLINE int IN6_IS_ADDR_MC_NODELOCAL(const struct in6_addr *a) { return IN6_IS_ADDR_MULTICAST(a) && ((a->s6_bytes[1] & 0xf)==1); } | 
 
 
 
 
 | 76 | WS2TCPIP_INLINE int IN6_IS_ADDR_MC_LINKLOCAL(const struct in6_addr *a) { return IN6_IS_ADDR_MULTICAST(a) && ((a->s6_bytes[1] & 0xf)==2); } | 
 
 
 
 
 | 77 | WS2TCPIP_INLINE int IN6_IS_ADDR_MC_SITELOCAL(const struct in6_addr *a) { return IN6_IS_ADDR_MULTICAST(a) && ((a->s6_bytes[1] & 0xf)==5); } | 
 
 
 
 
 | 78 | WS2TCPIP_INLINE int IN6_IS_ADDR_MC_ORGLOCAL(const struct in6_addr *a) { return IN6_IS_ADDR_MULTICAST(a) && ((a->s6_bytes[1] & 0xf)==8); } | 
 
 
 
 
 | 79 | WS2TCPIP_INLINE int IN6_IS_ADDR_MC_GLOBAL(const struct in6_addr *a) { return IN6_IS_ADDR_MULTICAST(a) && ((a->s6_bytes[1] & 0xf)==0xe); } | 
 
 
 
 
 | 80 | WS2TCPIP_INLINE int IN6ADDR_ISANY(const struct sockaddr_in6 *a) { return ((a->sin6_family==AF_INET6) && IN6_IS_ADDR_UNSPECIFIED(&a->sin6_addr)); } | 
 
 
 
 
 | 81 | WS2TCPIP_INLINE int IN6ADDR_ISLOOPBACK(const struct sockaddr_in6 *a) { return ((a->sin6_family==AF_INET6) && IN6_IS_ADDR_LOOPBACK(&a->sin6_addr)); } | 
 
 
 
 
 | 82 | WS2TCPIP_INLINE void IN6_SET_ADDR_UNSPECIFIED(struct in6_addr *a) { memset(a->s6_bytes,0,sizeof(struct in6_addr)); } | 
 
 
 
 
 | 83 | WS2TCPIP_INLINE void IN6_SET_ADDR_LOOPBACK(struct in6_addr *a) { | 
 
 
 
 
 | 84 | memset(a->s6_bytes,0,sizeof(struct in6_addr)); | 
 
 
 
 
 | 85 | a->s6_bytes[15] = 1; | 
 
 
 
 
 | 86 | } | 
 
 
 
 
 | 87 | WS2TCPIP_INLINE void IN6ADDR_SETANY(struct sockaddr_in6 *a) { | 
 
 
 
 
 | 88 | a->sin6_family = AF_INET6; | 
 
 
 
 
 | 89 | a->sin6_port = 0; | 
 
 
 
 
 | 90 | a->sin6_flowinfo = 0; | 
 
 
 
 
 | 91 | IN6_SET_ADDR_UNSPECIFIED(&a->sin6_addr); | 
 
 
 
 
 | 92 | a->sin6_scope_id = 0; | 
 
 
 
 
 | 93 | } | 
 
 
 
 
 | 94 | WS2TCPIP_INLINE void IN6ADDR_SETLOOPBACK(struct sockaddr_in6 *a) { | 
 
 
 
 
 | 95 | a->sin6_family = AF_INET6; | 
 
 
 
 
 | 96 | a->sin6_port = 0; | 
 
 
 
 
 | 97 | a->sin6_flowinfo = 0; | 
 
 
 
 
 | 98 | IN6_SET_ADDR_LOOPBACK(&a->sin6_addr); | 
 
 
 
 
 | 99 | a->sin6_scope_id = 0; | 
 
 
 
 
 | 100 | } | 
 
 
 
 
 | 101 |  | 
 
 
 
 
 | 102 | /* Those declarations are mandatory for Open Group Base spec */ | 
 
 
 
 
 | 103 | #define IN6_IS_ADDR_UNSPECIFIED IN6_IS_ADDR_UNSPECIFIED | 
 
 
 
 
 | 104 | #define IN6_IS_ADDR_LOOPBACK IN6_IS_ADDR_LOOPBACK | 
 
 
 
 
 | 105 | #define IN6_IS_ADDR_MULTICAST IN6_IS_ADDR_MULTICAST | 
 
 
 
 
 | 106 | #define IN6_IS_ADDR_LINKLOCAL IN6_IS_ADDR_LINKLOCAL | 
 
 
 
 
 | 107 | #define IN6_IS_ADDR_SITELOCAL IN6_IS_ADDR_SITELOCAL | 
 
 
 
 
 | 108 | #define IN6_IS_ADDR_V4MAPPED IN6_IS_ADDR_V4MAPPED | 
 
 
 
 
 | 109 | #define IN6_IS_ADDR_V4COMPAT IN6_IS_ADDR_V4COMPAT | 
 
 
 
 
 | 110 | #define IN6_IS_ADDR_MC_NODELOCAL IN6_IS_ADDR_MC_NODELOCAL | 
 
 
 
 
 | 111 | #define IN6_IS_ADDR_MC_LINKLOCAL IN6_IS_ADDR_MC_LINKLOCAL | 
 
 
 
 
 | 112 | #define IN6_IS_ADDR_MC_SITELOCAL IN6_IS_ADDR_MC_SITELOCAL | 
 
 
 
 
 | 113 | #define IN6_IS_ADDR_MC_ORGLOCAL IN6_IS_ADDR_MC_ORGLOCAL | 
 
 
 
 
 | 114 | #define IN6_IS_ADDR_MC_GLOBAL IN6_IS_ADDR_MC_GLOBAL | 
 
 
 
 
 | 115 |  | 
 
 
 
 
 | 116 | #ifdef __cplusplus | 
 
 
 
 
 | 117 | } | 
 
 
 
 
 | 118 | #endif | 
 
 
 
 
 | 119 |  | 
 
 
 
 
 | 120 | typedef struct in_pktinfo { | 
 
 
 
 
 | 121 | IN_ADDR ipi_addr; | 
 
 
 
 
 | 122 | UINT ipi_ifindex; | 
 
 
 
 
 | 123 | } IN_PKTINFO; | 
 
 
 
 
 | 124 |  | 
 
 
 
 
 | 125 | C_ASSERT(sizeof(IN_PKTINFO)==8); | 
 
 
 
 
 | 126 |  | 
 
 
 
 
 | 127 | typedef struct in6_pktinfo { | 
 
 
 
 
 | 128 | IN6_ADDR ipi6_addr; | 
 
 
 
 
 | 129 | UINT ipi6_ifindex; | 
 
 
 
 
 | 130 | } IN6_PKTINFO; | 
 
 
 
 
 | 131 |  | 
 
 
 
 
 | 132 | C_ASSERT(sizeof(IN6_PKTINFO)==20); | 
 
 
 
 
 | 133 |  | 
 
 
 
 
 | 134 | #define EAI_AGAIN WSATRY_AGAIN | 
 
 
 
 
 | 135 | #define EAI_BADFLAGS WSAEINVAL | 
 
 
 
 
 | 136 | #define EAI_FAIL WSANO_RECOVERY | 
 
 
 
 
 | 137 | #define EAI_FAMILY WSAEAFNOSUPPORT | 
 
 
 
 
 | 138 | #define EAI_MEMORY WSA_NOT_ENOUGH_MEMORY | 
 
 
 
 
 | 139 |  | 
 
 
 
 
 | 140 | #define EAI_NONAME WSAHOST_NOT_FOUND | 
 
 
 
 
 | 141 | #define EAI_SERVICE WSATYPE_NOT_FOUND | 
 
 
 
 
 | 142 | #define EAI_SOCKTYPE WSAESOCKTNOSUPPORT | 
 
 
 
 
 | 143 |  | 
 
 
 
 
 | 144 | #define EAI_NODATA 11004 /* WSANO_DATA */ | 
 
 
 
 
 | 145 |  | 
 
 
 
 
 | 146 | typedef struct addrinfo { | 
 
 
 
 
 | 147 | int ai_flags; | 
 
 
 
 
 | 148 | int ai_family; | 
 
 
 
 
 | 149 | int ai_socktype; | 
 
 
 
 
 | 150 | int ai_protocol; | 
 
 
 
 
 | 151 | size_t ai_addrlen; | 
 
 
 
 
 | 152 | char *ai_canonname; | 
 
 
 
 
 | 153 | struct sockaddr *ai_addr; | 
 
 
 
 
 | 154 | struct addrinfo *ai_next; | 
 
 
 
 
 | 155 | } ADDRINFOA,*PADDRINFOA; | 
 
 
 
 
 | 156 |  | 
 
 
 
 
 | 157 | typedef struct addrinfoW { | 
 
 
 
 
 | 158 | int ai_flags; | 
 
 
 
 
 | 159 | int ai_family; | 
 
 
 
 
 | 160 | int ai_socktype; | 
 
 
 
 
 | 161 | int ai_protocol; | 
 
 
 
 
 | 162 | size_t ai_addrlen; | 
 
 
 
 
 | 163 | PWSTR ai_canonname; | 
 
 
 
 
 | 164 | struct sockaddr *ai_addr; | 
 
 
 
 
 | 165 | struct addrinfoW *ai_next; | 
 
 
 
 
 | 166 | } ADDRINFOW,*PADDRINFOW; | 
 
 
 
 
 | 167 |  | 
 
 
 
 
 | 168 | typedef __MINGW_NAME_AW(ADDRINFO) ADDRINFOT,*PADDRINFOT; | 
 
 
 
 
 | 169 |  | 
 
 
 
 
 | 170 | typedef ADDRINFOA ADDRINFO,*LPADDRINFO; | 
 
 
 
 
 | 171 |  | 
 
 
 
 
 | 172 | #define AI_PASSIVE                  0x00000001 | 
 
 
 
 
 | 173 | #define AI_CANONNAME                0x00000002 | 
 
 
 
 
 | 174 | #define AI_NUMERICHOST              0x00000004 | 
 
 
 
 
 | 175 | #if (_WIN32_WINNT >= 0x0600) | 
 
 
 
 
 | 176 | #define AI_NUMERICSERV              0x00000008 | 
 
 
 
 
 | 177 | #define AI_ALL                      0x00000100 | 
 
 
 
 
 | 178 | #define AI_ADDRCONFIG               0x00000400 | 
 
 
 
 
 | 179 | #define AI_V4MAPPED                 0x00000800 | 
 
 
 
 
 | 180 | #define AI_NON_AUTHORITATIVE        0x00004000 | 
 
 
 
 
 | 181 | #define AI_SECURE                   0x00008000 | 
 
 
 
 
 | 182 | #define AI_RETURN_PREFERRED_NAMES   0x00010000 | 
 
 
 
 
 | 183 | #endif | 
 
 
 
 
 | 184 | #if (_WIN32_WINNT >= 0x0601) | 
 
 
 
 
 | 185 | #define AI_FQDN                     0x00020000 | 
 
 
 
 
 | 186 | #define AI_FILESERVER               0x00040000 | 
 
 
 
 
 | 187 | #endif | 
 
 
 
 
 | 188 | #if (_WIN32_WINNT >= 0x0602) | 
 
 
 
 
 | 189 | #define AI_DISABLE_IDN_ENCODING     0x00080000 | 
 
 
 
 
 | 190 | #endif | 
 
 
 
 
 | 191 |  | 
 
 
 
 
 | 192 | #ifdef __cplusplus | 
 
 
 
 
 | 193 | extern "C" { | 
 
 
 
 
 | 194 | #endif | 
 
 
 
 
 | 195 |  | 
 
 
 
 
 | 196 | #define GetAddrInfo __MINGW_NAME_AW(GetAddrInfo) | 
 
 
 
 
 | 197 |  | 
 
 
 
 
 | 198 | WINSOCK_API_LINKAGE int WSAAPI getaddrinfo(const char *nodename,const char *servname,const struct addrinfo *hints,struct addrinfo **res); | 
 
 
 
 
 | 199 | WINSOCK_API_LINKAGE int WSAAPI GetAddrInfoW(PCWSTR pNodeName,PCWSTR pServiceName,const ADDRINFOW *pHints,PADDRINFOW *ppResult); | 
 
 
 
 
 | 200 |  | 
 
 
 
 
 | 201 | #define GetAddrInfoA getaddrinfo | 
 
 
 
 
 | 202 |  | 
 
 
 
 
 | 203 | #if INCL_WINSOCK_API_TYPEDEFS | 
 
 
 
 
 | 204 | typedef int (WSAAPI *LPFN_GETADDRINFO)(const char *nodename,const char *servname,const struct addrinfo *hints,struct addrinfo **res); | 
 
 
 
 
 | 205 | typedef int (WSAAPI *LPFN_GETADDRINFOW)(PCWSTR pNodeName,PCWSTR pServiceName,const ADDRINFOW *pHints,PADDRINFOW *ppResult); | 
 
 
 
 
 | 206 |  | 
 
 
 
 
 | 207 | #define LPFN_GETADDRINFOA LPFN_GETADDRINFO | 
 
 
 
 
 | 208 |  | 
 
 
 
 
 | 209 | #define LPFN_GETADDRINFOT __MINGW_NAME_AW(LPFN_GETADDRINFO) | 
 
 
 
 
 | 210 | #endif | 
 
 
 
 
 | 211 |  | 
 
 
 
 
 | 212 | #define FreeAddrInfo __MINGW_NAME_AW(FreeAddrInfo) | 
 
 
 
 
 | 213 |  | 
 
 
 
 
 | 214 | WINSOCK_API_LINKAGE void WSAAPI freeaddrinfo(LPADDRINFO pAddrInfo); | 
 
 
 
 
 | 215 | WINSOCK_API_LINKAGE void WSAAPI FreeAddrInfoW(PADDRINFOW pAddrInfo); | 
 
 
 
 
 | 216 |  | 
 
 
 
 
 | 217 | #define FreeAddrInfoA freeaddrinfo | 
 
 
 
 
 | 218 |  | 
 
 
 
 
 | 219 | #if INCL_WINSOCK_API_TYPEDEFS | 
 
 
 
 
 | 220 | typedef void (WSAAPI *LPFN_FREEADDRINFO)(struct addrinfo *ai); | 
 
 
 
 
 | 221 | typedef void (WSAAPI *LPFN_FREEADDRINFOW)(PADDRINFOW pAddrInfo); | 
 
 
 
 
 | 222 |  | 
 
 
 
 
 | 223 | #define LPFN_FREEADDRINFOA LPFN_FREEADDRINFO | 
 
 
 
 
 | 224 |  | 
 
 
 
 
 | 225 | #define LPFN_FREEADDRINFOT __MINGW_NAME_AW(LPFN_FREEADDRINFO) | 
 
 
 
 
 | 226 | #endif | 
 
 
 
 
 | 227 |  | 
 
 
 
 
 | 228 | typedef int socklen_t; | 
 
 
 
 
 | 229 |  | 
 
 
 
 
 | 230 | #define GetNameInfo __MINGW_NAME_AW(GetNameInfo) | 
 
 
 
 
 | 231 |  | 
 
 
 
 
 | 232 | WINSOCK_API_LINKAGE int WSAAPI getnameinfo(const struct sockaddr *sa,socklen_t salen,char *host,DWORD hostlen,char *serv,DWORD servlen,int flags); | 
 
 
 
 
 | 233 | WINSOCK_API_LINKAGE INT WSAAPI GetNameInfoW(const SOCKADDR *pSockaddr,socklen_t SockaddrLength,PWCHAR pNodeBuffer,DWORD NodeBufferSize,PWCHAR pServiceBuffer,DWORD ServiceBufferSize,INT Flags); | 
 
 
 
 
 | 234 |  | 
 
 
 
 
 | 235 | #define GetNameInfoA getnameinfo | 
 
 
 
 
 | 236 |  | 
 
 
 
 
 | 237 | #if INCL_WINSOCK_API_TYPEDEFS | 
 
 
 
 
 | 238 | typedef int (WSAAPI *LPFN_GETNAMEINFO)(const struct sockaddr *sa,socklen_t salen,char *host,DWORD hostlen,char *serv,DWORD servlen,int flags); | 
 
 
 
 
 | 239 | typedef INT (WSAAPI *LPFN_GETNAMEINFOW)(const SOCKADDR *pSockaddr,socklen_t SockaddrLength,PWCHAR pNodeBuffer,DWORD NodeBufferSize,PWCHAR pServiceBuffer,DWORD ServiceBufferSize,INT Flags); | 
 
 
 
 
 | 240 |  | 
 
 
 
 
 | 241 | #define LPFN_GETNAMEINFOA LPFN_GETNAMEINFO | 
 
 
 
 
 | 242 |  | 
 
 
 
 
 | 243 | #define LPFN_GETNAMEINFOT __MINGW_NAME_AW(LPFN_GETNAMEINFO) | 
 
 
 
 
 | 244 | #endif | 
 
 
 
 
 | 245 |  | 
 
 
 
 
 | 246 | #define gai_strerror __MINGW_NAME_AW(gai_strerror) | 
 
 
 
 
 | 247 |  | 
 
 
 
 
 | 248 | #define GAI_STRERROR_BUFFER_SIZE 1024 | 
 
 
 
 
 | 249 |  | 
 
 
 
 
 | 250 | char *gai_strerrorA (int); | 
 
 
 
 
 | 251 | WCHAR *gai_strerrorW(int); | 
 
 
 
 
 | 252 |  | 
 
 
 
 
 | 253 | #define NI_MAXHOST 1025 | 
 
 
 
 
 | 254 | #define NI_MAXSERV 32 | 
 
 
 
 
 | 255 |  | 
 
 
 
 
 | 256 | #define INET_ADDRSTRLEN 22 | 
 
 
 
 
 | 257 | #define INET6_ADDRSTRLEN 65 | 
 
 
 
 
 | 258 |  | 
 
 
 
 
 | 259 | #define NI_NOFQDN 0x01 | 
 
 
 
 
 | 260 | #define NI_NUMERICHOST 0x02 | 
 
 
 
 
 | 261 | #define NI_NAMEREQD 0x04 | 
 
 
 
 
 | 262 | #define NI_NUMERICSERV 0x08 | 
 
 
 
 
 | 263 | #define NI_DGRAM 0x10 | 
 
 
 
 
 | 264 |  | 
 
 
 
 
 | 265 | #include <mstcpip.h> | 
 
 
 
 
 | 266 |  | 
 
 
 
 
 | 267 | #if (_WIN32_WINNT >= 0x0600) | 
 
 
 
 
 | 268 | #define addrinfoEx __MINGW_NAME_AW(addrinfoEx) | 
 
 
 
 
 | 269 | #define PADDRINFOEX __MINGW_NAME_AW(PADDRINFOEX) | 
 
 
 
 
 | 270 | #define GetAddrInfoEx __MINGW_NAME_AW(GetAddrInfoEx) | 
 
 
 
 
 | 271 | #define SetAddrInfoEx __MINGW_NAME_AW(SetAddrInfoEx) | 
 
 
 
 
 | 272 |  | 
 
 
 
 
 | 273 | typedef struct addrinfoExA { | 
 
 
 
 
 | 274 | int                ai_flags; | 
 
 
 
 
 | 275 | int                ai_family; | 
 
 
 
 
 | 276 | int                ai_socktype; | 
 
 
 
 
 | 277 | int                ai_protocol; | 
 
 
 
 
 | 278 | size_t             ai_addrlen; | 
 
 
 
 
 | 279 | LPCSTR             ai_canonname; | 
 
 
 
 
 | 280 | struct sockaddr    *ai_addr; | 
 
 
 
 
 | 281 | void               *ai_blob; | 
 
 
 
 
 | 282 | size_t             ai_bloblen; | 
 
 
 
 
 | 283 | LPGUID             ai_provider; | 
 
 
 
 
 | 284 | struct addrinfoexA *ai_next; | 
 
 
 
 
 | 285 | } ADDRINFOEXA, *PADDRINFOEXA; | 
 
 
 
 
 | 286 |  | 
 
 
 
 
 | 287 | typedef struct addrinfoExW { | 
 
 
 
 
 | 288 | int                ai_flags; | 
 
 
 
 
 | 289 | int                ai_family; | 
 
 
 
 
 | 290 | int                ai_socktype; | 
 
 
 
 
 | 291 | int                ai_protocol; | 
 
 
 
 
 | 292 | size_t             ai_addrlen; | 
 
 
 
 
 | 293 | LPCWSTR            ai_canonname; | 
 
 
 
 
 | 294 | struct sockaddr    *ai_addr; | 
 
 
 
 
 | 295 | void               *ai_blob; | 
 
 
 
 
 | 296 | size_t             ai_bloblen; | 
 
 
 
 
 | 297 | LPGUID             ai_provider; | 
 
 
 
 
 | 298 | struct addrinfoexW *ai_next; | 
 
 
 
 
 | 299 | } ADDRINFOEXW, *PADDRINFOEXW; | 
 
 
 
 
 | 300 |  | 
 
 
 
 
 | 301 | typedef PVOID LPLOOKUPSERVICE_COMPLETION_ROUTINE; /*reserved*/ | 
 
 
 
 
 | 302 |  | 
 
 
 
 
 | 303 | WINSOCK_API_LINKAGE int WSAAPI GetAddrInfoExA(PCSTR pName, PCSTR pServiceName, DWORD dwNameSpace, | 
 
 
 
 
 | 304 | LPGUID lpNspId,const ADDRINFOEXA *pHints,PADDRINFOEXA *ppResult, | 
 
 
 
 
 | 305 | PTIMEVAL timeout,LPOVERLAPPED lpOverlapped, | 
 
 
 
 
 | 306 | LPLOOKUPSERVICE_COMPLETION_ROUTINE lpCompletionRoutine, | 
 
 
 
 
 | 307 | LPHANDLE lpNameHandle); | 
 
 
 
 
 | 308 | WINSOCK_API_LINKAGE int WSAAPI GetAddrInfoExW(PCWSTR pName,PCWSTR pServiceName,DWORD dwNameSpace, | 
 
 
 
 
 | 309 | LPGUID lpNspId,const ADDRINFOEXW *pHints,PADDRINFOEXW *ppResult, | 
 
 
 
 
 | 310 | PTIMEVAL timeout,LPOVERLAPPED lpOverlapped, | 
 
 
 
 
 | 311 | LPLOOKUPSERVICE_COMPLETION_ROUTINE lpCompletionRoutine, | 
 
 
 
 
 | 312 | LPHANDLE lpNameHandle); | 
 
 
 
 
 | 313 |  | 
 
 
 
 
 | 314 | WINSOCK_API_LINKAGE int WSAAPI SetAddrInfoExA(PCSTR pName, PCSTR pServiceName, SOCKET_ADDRESS *pAddresses, | 
 
 
 
 
 | 315 | DWORD dwAddressCount,LPBLOB lpBlob,DWORD dwFlags,DWORD dwNameSpace, | 
 
 
 
 
 | 316 | LPGUID lpNspId,PTIMEVAL timeout,LPOVERLAPPED lpOverlapped, | 
 
 
 
 
 | 317 | LPLOOKUPSERVICE_COMPLETION_ROUTINE lpCompletionRoutine, | 
 
 
 
 
 | 318 | LPHANDLE lpNameHandle); | 
 
 
 
 
 | 319 | WINSOCK_API_LINKAGE int WSAAPI SetAddrInfoExW(PCWSTR pName,PCWSTR pServiceName,SOCKET_ADDRESS *pAddresses, | 
 
 
 
 
 | 320 | DWORD dwAddressCount,LPBLOB lpBlob,DWORD dwFlags,DWORD dwNameSpace, | 
 
 
 
 
 | 321 | LPGUID lpNspId,PTIMEVAL timeout,LPOVERLAPPED lpOverlapped, | 
 
 
 
 
 | 322 | LPLOOKUPSERVICE_COMPLETION_ROUTINE lpCompletionRoutine, | 
 
 
 
 
 | 323 | LPHANDLE lpNameHandle); | 
 
 
 
 
 | 324 |  | 
 
 
 
 
 | 325 | WINSOCK_API_LINKAGE void WSAAPI FreeAddrInfoEx(PADDRINFOEXA pAddrInfo); | 
 
 
 
 
 | 326 | WINSOCK_API_LINKAGE void WSAAPI FreeAddrInfoExW(PADDRINFOEXW pAddrInfo); | 
 
 
 
 
 | 327 |  | 
 
 
 
 
 | 328 | #define FreeAddrInfoExA FreeAddrInfoEx | 
 
 
 
 
 | 329 | #ifdef UNICODE | 
 
 
 
 
 | 330 | #  define FreeAddrInfoEx FreeAddrInfoExW | 
 
 
 
 
 | 331 | #endif  /* UNICODE */ | 
 
 
 
 
 | 332 |  | 
 
 
 
 
 | 333 | #if INCL_WINSOCK_API_TYPEDEFS | 
 
 
 
 
 | 334 | #define LPFN_GETADDRINFOEX __MINGW_NAME_AW(LPFN_GETADDRINFOEX) | 
 
 
 
 
 | 335 | typedef int (WSAAPI *LPFN_GETADDRINFOEXA)(PCSTR pName, PCSTR pServiceName, DWORD dwNameSpace, | 
 
 
 
 
 | 336 | LPGUID lpNspId,const ADDRINFOEXA *pHints,PADDRINFOEXA *ppResult, | 
 
 
 
 
 | 337 | PTIMEVAL timeout,LPOVERLAPPED lpOverlapped, | 
 
 
 
 
 | 338 | LPLOOKUPSERVICE_COMPLETION_ROUTINE lpCompletionRoutine, | 
 
 
 
 
 | 339 | LPHANDLE lpNameHandle); | 
 
 
 
 
 | 340 | typedef int (WSAAPI *LPFN_GETADDRINFOEXW)(PCWSTR pName,PCWSTR pServiceName,DWORD dwNameSpace, | 
 
 
 
 
 | 341 | LPGUID lpNspId,const ADDRINFOEXW *pHints,PADDRINFOEXW *ppResult, | 
 
 
 
 
 | 342 | PTIMEVAL timeout,LPOVERLAPPED lpOverlapped, | 
 
 
 
 
 | 343 | LPLOOKUPSERVICE_COMPLETION_ROUTINE lpCompletionRoutine, | 
 
 
 
 
 | 344 | LPHANDLE lpNameHandle); | 
 
 
 
 
 | 345 |  | 
 
 
 
 
 | 346 | #define LPFN_SETADDRINFOEX __MINGW_NAME_AW(LPFN_SETADDRINFOEX) | 
 
 
 
 
 | 347 | typedef int (WSAAPI *LPFN_SETADDRINFOEXA)(PCSTR pName, PCSTR pServiceName, SOCKET_ADDRESS *pAddresses, | 
 
 
 
 
 | 348 | DWORD dwAddressCount,LPBLOB lpBlob,DWORD dwFlags,DWORD dwNameSpace, | 
 
 
 
 
 | 349 | LPGUID lpNspId,PTIMEVAL timeout,LPOVERLAPPED lpOverlapped, | 
 
 
 
 
 | 350 | LPLOOKUPSERVICE_COMPLETION_ROUTINE lpCompletionRoutine, | 
 
 
 
 
 | 351 | LPHANDLE lpNameHandle); | 
 
 
 
 
 | 352 | typedef int (WSAAPI *LPFN_SETADDRINFOEXW)(PCWSTR pName,PCWSTR pServiceName,SOCKET_ADDRESS *pAddresses, | 
 
 
 
 
 | 353 | DWORD dwAddressCount,LPBLOB lpBlob,DWORD dwFlags,DWORD dwNameSpace, | 
 
 
 
 
 | 354 | LPGUID lpNspId,PTIMEVAL timeout,LPOVERLAPPED lpOverlapped, | 
 
 
 
 
 | 355 | LPLOOKUPSERVICE_COMPLETION_ROUTINE lpCompletionRoutine, | 
 
 
 
 
 | 356 | LPHANDLE lpNameHandle); | 
 
 
 
 
 | 357 |  | 
 
 
 
 
 | 358 | #define LPFN_FREEADDRINFOEX __MINGW_NAME_AW(LPFN_FREEADDRINFOEX) | 
 
 
 
 
 | 359 | typedef void (WSAAPI *LPFN_FREEADDRINFOEXA)(PADDRINFOEXA pAddrInfo); | 
 
 
 
 
 | 360 | typedef void (WSAAPI *LPFN_FREEADDRINFOEXW)(PADDRINFOEXW pAddrInfo); | 
 
 
 
 
 | 361 | #endif /* INCL_WINSOCK_API_TYPEDEFS */ | 
 
 
 
 
 | 362 |  | 
 
 
 
 
 | 363 |  | 
 
 
 
 
 | 364 | WINSOCK_API_LINKAGE int WSAAPI WSAImpersonateSocketPeer( | 
 
 
 
 
 | 365 | SOCKET Socket, | 
 
 
 
 
 | 366 | const struct sockaddr *PeerAddress, | 
 
 
 
 
 | 367 | ULONG peerAddressLen | 
 
 
 
 
 | 368 | ); | 
 
 
 
 
 | 369 |  | 
 
 
 
 
 | 370 | WINSOCK_API_LINKAGE int WSAAPI WSAQuerySocketSecurity( | 
 
 
 
 
 | 371 | SOCKET Socket, | 
 
 
 
 
 | 372 | const SOCKET_SECURITY_QUERY_TEMPLATE *SecurityQueryTemplate, | 
 
 
 
 
 | 373 | ULONG SecurityQueryTemplateLen, | 
 
 
 
 
 | 374 | SOCKET_SECURITY_QUERY_INFO *SecurityQueryInfo, | 
 
 
 
 
 | 375 | ULONG *SecurityQueryInfoLen, | 
 
 
 
 
 | 376 | LPWSAOVERLAPPED Overlapped, | 
 
 
 
 
 | 377 | LPWSAOVERLAPPED_COMPLETION_ROUTINE CompletionRoutine | 
 
 
 
 
 | 378 | ); | 
 
 
 
 
 | 379 |  | 
 
 
 
 
 | 380 | WINSOCK_API_LINKAGE int WSAAPI WSARevertImpersonation(void); | 
 
 
 
 
 | 381 |  | 
 
 
 
 
 | 382 | WINSOCK_API_LINKAGE int WSAAPI WSASetSocketPeerTargetName( | 
 
 
 
 
 | 383 | SOCKET Socket, | 
 
 
 
 
 | 384 | const SOCKET_PEER_TARGET_NAME *PeerTargetName, | 
 
 
 
 
 | 385 | ULONG PeerTargetNameLen, | 
 
 
 
 
 | 386 | LPWSAOVERLAPPED Overlapped, | 
 
 
 
 
 | 387 | LPWSAOVERLAPPED_COMPLETION_ROUTINE CompletionRoutine | 
 
 
 
 
 | 388 | ); | 
 
 
 
 
 | 389 |  | 
 
 
 
 
 | 390 | WINSOCK_API_LINKAGE int WSAAPI WSASetSocketSecurity( | 
 
 
 
 
 | 391 | SOCKET Socket, | 
 
 
 
 
 | 392 | const SOCKET_SECURITY_SETTINGS *SecuritySettings, | 
 
 
 
 
 | 393 | ULONG SecuritySettingsLen, | 
 
 
 
 
 | 394 | LPWSAOVERLAPPED Overlapped, | 
 
 
 
 
 | 395 | LPWSAOVERLAPPED_COMPLETION_ROUTINE CompletionRoutine | 
 
 
 
 
 | 396 | ); | 
 
 
 
 
 | 397 |  | 
 
 
 
 
 | 398 | #define InetNtopA inet_ntop | 
 
 
 
 
 | 399 |  | 
 
 
 
 
 | 400 | WINSOCK_API_LINKAGE LPCWSTR WSAAPI InetNtopW(INT Family, LPCVOID pAddr, LPWSTR pStringBuf, size_t StringBufSIze); | 
 
 
 
 
 | 401 | WINSOCK_API_LINKAGE LPCSTR WSAAPI InetNtopA(INT Family, LPCVOID pAddr, LPSTR pStringBuf, size_t StringBufSize); | 
 
 
 
 
 | 402 |  | 
 
 
 
 
 | 403 | #define InetNtop __MINGW_NAME_AW(InetNtop) | 
 
 
 
 
 | 404 |  | 
 
 
 
 
 | 405 | #define InetPtonA inet_pton | 
 
 
 
 
 | 406 |  | 
 
 
 
 
 | 407 | WINSOCK_API_LINKAGE INT WSAAPI InetPtonW(INT Family, LPCWSTR pStringBuf, PVOID pAddr); | 
 
 
 
 
 | 408 | WINSOCK_API_LINKAGE INT WSAAPI InetPtonA(INT Family, LPCSTR pStringBuf, PVOID pAddr); | 
 
 
 
 
 | 409 |  | 
 
 
 
 
 | 410 | #define InetPton __MINGW_NAME_AW(InetPton) | 
 
 
 
 
 | 411 |  | 
 
 
 
 
 | 412 | #endif /*(_WIN32_WINNT >= 0x0600)*/ | 
 
 
 
 
 | 413 |  | 
 
 
 
 
 | 414 | #ifdef __cplusplus | 
 
 
 
 
 | 415 | } | 
 
 
 
 
 | 416 | #endif | 
 
 
 
 
 | 417 |  | 
 
 
 
 
 | 418 | #ifdef __LP64__ | 
 
 
 
 
 | 419 | #pragma pop_macro("u_long") | 
 
 
 
 
 | 420 | #endif | 
 
 
 
 
 | 421 |  | 
 
 
 
 
 | 422 | #endif /* _WS2TCPIP_H_ */ |