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