Home | History | Annotate | Download | only in include
      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 #include <winsock2.h>
     12 #include <psdk_inc/_ip_mreq1.h>
     13 
     14 struct ip_mreq_source {
     15   struct in_addr imr_multiaddr;
     16   struct in_addr imr_sourceaddr;
     17   struct in_addr imr_interface;
     18 };
     19 
     20 struct ip_msfilter {
     21   struct in_addr imsf_multiaddr;
     22   struct in_addr imsf_interface;
     23   u_long imsf_fmode;
     24   u_long imsf_numsrc;
     25   struct in_addr imsf_slist[1];
     26 };
     27 
     28 #define IP_MSFILTER_SIZE(numsrc) (sizeof(struct ip_msfilter)-sizeof(struct in_addr) + (numsrc)*sizeof(struct in_addr))
     29 
     30 #define SIO_GET_INTERFACE_LIST _IOR('t',127,u_long)
     31 
     32 #define SIO_GET_INTERFACE_LIST_EX _IOR('t',126,u_long)
     33 #define SIO_SET_MULTICAST_FILTER _IOW('t',125,u_long)
     34 #define SIO_GET_MULTICAST_FILTER _IOW('t',124 | IOC_IN,u_long)
     35 
     36 #define IP_OPTIONS 1
     37 #define IP_HDRINCL 2
     38 #define IP_TOS 3
     39 #define IP_TTL 4
     40 #define IP_MULTICAST_IF 9
     41 #define IP_MULTICAST_TTL 10
     42 #define IP_MULTICAST_LOOP 11
     43 #define IP_ADD_MEMBERSHIP 12
     44 #define IP_DROP_MEMBERSHIP 13
     45 #define IP_DONTFRAGMENT 14
     46 #define IP_ADD_SOURCE_MEMBERSHIP 15
     47 #define IP_DROP_SOURCE_MEMBERSHIP 16
     48 #define IP_BLOCK_SOURCE 17
     49 #define IP_UNBLOCK_SOURCE 18
     50 #define IP_PKTINFO 19
     51 #define IP_RECEIVE_BROADCAST 22
     52 
     53 #define PROTECTION_LEVEL_UNRESTRICTED 10
     54 #define PROTECTION_LEVEL_DEFAULT 20
     55 #define PROTECTION_LEVEL_RESTRICTED 30
     56 
     57 #define UDP_NOCHECKSUM 1
     58 #define UDP_CHECKSUM_COVERAGE 20
     59 
     60 #define TCP_EXPEDITED_1122 0x0002
     61 
     62 
     63 #include <ws2ipdef.h>
     64 
     65 
     66 #define SS_PORT(ssp) (((struct sockaddr_in*)(ssp))->sin_port)
     67 
     68 #define IN6ADDR_ANY_INIT { 0 }
     69 #define IN6ADDR_LOOPBACK_INIT { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1 }
     70 
     71 #ifdef __cplusplus
     72 extern "C" {
     73 #endif
     74 
     75   extern const struct in6_addr in6addr_any;
     76   extern const struct in6_addr in6addr_loopback;
     77 
     78 #define WS2TCPIP_INLINE __CRT_INLINE
     79 
     80 int IN6_ADDR_EQUAL(const struct in6_addr *,const struct in6_addr *);
     81 int IN6_IS_ADDR_UNSPECIFIED(const struct in6_addr *);
     82 int IN6_IS_ADDR_LOOPBACK(const struct in6_addr *);
     83 int IN6_IS_ADDR_MULTICAST(const struct in6_addr *);
     84 int IN6_IS_ADDR_LINKLOCAL(const struct in6_addr *);
     85 int IN6_IS_ADDR_SITELOCAL(const struct in6_addr *);
     86 int IN6_IS_ADDR_V4MAPPED(const struct in6_addr *);
     87 int IN6_IS_ADDR_V4COMPAT(const struct in6_addr *);
     88 int IN6_IS_ADDR_MC_NODELOCAL(const struct in6_addr *);
     89 int IN6_IS_ADDR_MC_LINKLOCAL(const struct in6_addr *);
     90 int IN6_IS_ADDR_MC_SITELOCAL(const struct in6_addr *);
     91 int IN6_IS_ADDR_MC_ORGLOCAL(const struct in6_addr *);
     92 int IN6_IS_ADDR_MC_GLOBAL(const struct in6_addr *);
     93 int IN6ADDR_ISANY(const struct sockaddr_in6 *);
     94 int IN6ADDR_ISLOOPBACK(const struct sockaddr_in6 *);
     95 void IN6_SET_ADDR_UNSPECIFIED(struct in6_addr *);
     96 void IN6_SET_ADDR_LOOPBACK(struct in6_addr *);
     97 void IN6ADDR_SETANY(struct sockaddr_in6 *);
     98 void IN6ADDR_SETLOOPBACK(struct sockaddr_in6 *);
     99 
    100 WS2TCPIP_INLINE int IN6_ADDR_EQUAL(const struct in6_addr *a,const struct in6_addr *b) { return (memcmp(a,b,sizeof(struct in6_addr))==0); }
    101 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)); }
    102 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)); }
    103 WS2TCPIP_INLINE int IN6_IS_ADDR_MULTICAST(const struct in6_addr *a) { return (a->s6_bytes[0]==0xff); }
    104 WS2TCPIP_INLINE int IN6_IS_ADDR_LINKLOCAL(const struct in6_addr *a) { return ((a->s6_bytes[0]==0xfe) && ((a->s6_bytes[1] & 0xc0)==0x80)); }
    105 WS2TCPIP_INLINE int IN6_IS_ADDR_SITELOCAL(const struct in6_addr *a) { return ((a->s6_bytes[0]==0xfe) && ((a->s6_bytes[1] & 0xc0)==0xc0)); }
    106 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)); }
    107 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)))); }
    108 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); }
    109 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); }
    110 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); }
    111 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); }
    112 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); }
    113 WS2TCPIP_INLINE int IN6ADDR_ISANY(const struct sockaddr_in6 *a) { return ((a->sin6_family==AF_INET6) && IN6_IS_ADDR_UNSPECIFIED(&a->sin6_addr)); }
    114 WS2TCPIP_INLINE int IN6ADDR_ISLOOPBACK(const struct sockaddr_in6 *a) { return ((a->sin6_family==AF_INET6) && IN6_IS_ADDR_LOOPBACK(&a->sin6_addr)); }
    115 WS2TCPIP_INLINE void IN6_SET_ADDR_UNSPECIFIED(struct in6_addr *a) { memset(a->s6_bytes,0,sizeof(struct in6_addr)); }
    116 WS2TCPIP_INLINE void IN6_SET_ADDR_LOOPBACK(struct in6_addr *a) {
    117   memset(a->s6_bytes,0,sizeof(struct in6_addr));
    118   a->s6_bytes[15] = 1;
    119 }
    120 WS2TCPIP_INLINE void IN6ADDR_SETANY(struct sockaddr_in6 *a) {
    121   a->sin6_family = AF_INET6;
    122   a->sin6_port = 0;
    123   a->sin6_flowinfo = 0;
    124   IN6_SET_ADDR_UNSPECIFIED(&a->sin6_addr);
    125   a->sin6_scope_id = 0;
    126 }
    127 WS2TCPIP_INLINE void IN6ADDR_SETLOOPBACK(struct sockaddr_in6 *a) {
    128   a->sin6_family = AF_INET6;
    129   a->sin6_port = 0;
    130   a->sin6_flowinfo = 0;
    131   IN6_SET_ADDR_LOOPBACK(&a->sin6_addr);
    132   a->sin6_scope_id = 0;
    133 }
    134 
    135 #ifdef __cplusplus
    136 }
    137 #endif
    138 
    139 typedef struct _INTERFACE_INFO_EX {
    140   u_long iiFlags;
    141   SOCKET_ADDRESS iiAddress;
    142   SOCKET_ADDRESS iiBroadcastAddress;
    143   SOCKET_ADDRESS iiNetmask;
    144 } INTERFACE_INFO_EX,*LPINTERFACE_INFO_EX;
    145 
    146 #define IFF_UP 0x00000001
    147 #define IFF_BROADCAST 0x00000002
    148 #define IFF_LOOPBACK 0x00000004
    149 #define IFF_POINTTOPOINT 0x00000008
    150 #define IFF_MULTICAST 0x00000010
    151 
    152 typedef struct in_pktinfo {
    153   IN_ADDR ipi_addr;
    154   UINT ipi_ifindex;
    155 } IN_PKTINFO;
    156 
    157 C_ASSERT(sizeof(IN_PKTINFO)==8);
    158 
    159 typedef struct in6_pktinfo {
    160   IN6_ADDR ipi6_addr;
    161   UINT ipi6_ifindex;
    162 } IN6_PKTINFO;
    163 
    164 C_ASSERT(sizeof(IN6_PKTINFO)==20);
    165 
    166 #define EAI_AGAIN WSATRY_AGAIN
    167 #define EAI_BADFLAGS WSAEINVAL
    168 #define EAI_FAIL WSANO_RECOVERY
    169 #define EAI_FAMILY WSAEAFNOSUPPORT
    170 #define EAI_MEMORY WSA_NOT_ENOUGH_MEMORY
    171 
    172 #define EAI_NONAME WSAHOST_NOT_FOUND
    173 #define EAI_SERVICE WSATYPE_NOT_FOUND
    174 #define EAI_SOCKTYPE WSAESOCKTNOSUPPORT
    175 
    176 #define EAI_NODATA 11004 /* WSANO_DATA */
    177 
    178 typedef struct addrinfo {
    179   int ai_flags;
    180   int ai_family;
    181   int ai_socktype;
    182   int ai_protocol;
    183   size_t ai_addrlen;
    184   char *ai_canonname;
    185   struct sockaddr *ai_addr;
    186   struct addrinfo *ai_next;
    187 } ADDRINFOA,*PADDRINFOA;
    188 
    189 typedef struct addrinfoW {
    190   int ai_flags;
    191   int ai_family;
    192   int ai_socktype;
    193   int ai_protocol;
    194   size_t ai_addrlen;
    195   PWSTR ai_canonname;
    196   struct sockaddr *ai_addr;
    197   struct addrinfoW *ai_next;
    198 } ADDRINFOW,*PADDRINFOW;
    199 
    200 typedef __MINGW_NAME_AW(ADDRINFO) ADDRINFOT,*PADDRINFOT;
    201 
    202 typedef ADDRINFOA ADDRINFO,*LPADDRINFO;
    203 
    204 #define AI_PASSIVE 0x1
    205 #define AI_CANONNAME 0x2
    206 #define AI_NUMERICHOST 0x4
    207 #if (_WIN32_WINNT >= 0x0600)
    208 #define AI_ADDRCONFIG             0x0400
    209 #define AI_NON_AUTHORITATIVE      0x04000
    210 #define AI_SECURE                 0x08000
    211 #define AI_RETURN_PREFERRED_NAMES 0x010000
    212 #endif
    213 
    214 #ifdef __cplusplus
    215 extern "C" {
    216 #endif
    217 
    218 #define GetAddrInfo __MINGW_NAME_AW(GetAddrInfo)
    219 
    220   WINSOCK_API_LINKAGE int WSAAPI getaddrinfo(const char *nodename,const char *servname,const struct addrinfo *hints,struct addrinfo **res);
    221   WINSOCK_API_LINKAGE int WSAAPI GetAddrInfoW(PCWSTR pNodeName,PCWSTR pServiceName,const ADDRINFOW *pHints,PADDRINFOW *ppResult);
    222 
    223 #define GetAddrInfoA getaddrinfo
    224 
    225 #if INCL_WINSOCK_API_TYPEDEFS
    226   typedef int (WSAAPI *LPFN_GETADDRINFO)(const char *nodename,const char *servname,const struct addrinfo *hints,struct addrinfo **res);
    227   typedef int (WSAAPI *LPFN_GETADDRINFOW)(PCWSTR pNodeName,PCWSTR pServiceName,const ADDRINFOW *pHints,PADDRINFOW *ppResult);
    228 
    229 #define LPFN_GETADDRINFOA LPFN_GETADDRINFO
    230 
    231 #define LPFN_GETADDRINFOT __MINGW_NAME_AW(LPFN_GETADDRINFO)
    232 #endif
    233 
    234 #define FreeAddrInfo __MINGW_NAME_AW(FreeAddrInfo)
    235 
    236   WINSOCK_API_LINKAGE void WSAAPI freeaddrinfo(LPADDRINFO pAddrInfo);
    237   WINSOCK_API_LINKAGE void WSAAPI FreeAddrInfoW(PADDRINFOW pAddrInfo);
    238 
    239 #define FreeAddrInfoA freeaddrinfo
    240 
    241 #if INCL_WINSOCK_API_TYPEDEFS
    242   typedef void (WSAAPI *LPFN_FREEADDRINFO)(struct addrinfo *ai);
    243   typedef void (WSAAPI *LPFN_FREEADDRINFOW)(PADDRINFOW pAddrInfo);
    244 
    245 #define LPFN_FREEADDRINFOA LPFN_FREEADDRINFO
    246 
    247 #define LPFN_FREEADDRINFOT __MINGW_NAME_AW(LPFN_FREEADDRINFO)
    248 #endif
    249 
    250   typedef int socklen_t;
    251 
    252 #define GetNameInfo __MINGW_NAME_AW(GetNameInfo)
    253 
    254   WINSOCK_API_LINKAGE int WSAAPI getnameinfo(const struct sockaddr *sa,socklen_t salen,char *host,DWORD hostlen,char *serv,DWORD servlen,int flags);
    255   WINSOCK_API_LINKAGE INT WSAAPI GetNameInfoW(const SOCKADDR *pSockaddr,socklen_t SockaddrLength,PWCHAR pNodeBuffer,DWORD NodeBufferSize,PWCHAR pServiceBuffer,DWORD ServiceBufferSize,INT Flags);
    256 
    257 #define GetNameInfoA getnameinfo
    258 
    259 #if INCL_WINSOCK_API_TYPEDEFS
    260   typedef int (WSAAPI *LPFN_GETNAMEINFO)(const struct sockaddr *sa,socklen_t salen,char *host,DWORD hostlen,char *serv,DWORD servlen,int flags);
    261   typedef INT (WSAAPI *LPFN_GETNAMEINFOW)(const SOCKADDR *pSockaddr,socklen_t SockaddrLength,PWCHAR pNodeBuffer,DWORD NodeBufferSize,PWCHAR pServiceBuffer,DWORD ServiceBufferSize,INT Flags);
    262 
    263 #define LPFN_GETNAMEINFOA LPFN_GETNAMEINFO
    264 
    265 #define LPFN_GETNAMEINFOT __MINGW_NAME_AW(LPFN_GETNAMEINFO)
    266 #endif
    267 
    268 #define gai_strerror __MINGW_NAME_AW(gai_strerror)
    269 
    270 #define GAI_STRERROR_BUFFER_SIZE 1024
    271 
    272 char *gai_strerrorA (int);
    273 WCHAR *gai_strerrorW(int);
    274 
    275 #define NI_MAXHOST 1025
    276 #define NI_MAXSERV 32
    277 
    278 #define INET_ADDRSTRLEN 22
    279 #define INET6_ADDRSTRLEN 65
    280 
    281 #define NI_NOFQDN 0x01
    282 #define NI_NUMERICHOST 0x02
    283 #define NI_NAMEREQD 0x04
    284 #define NI_NUMERICSERV 0x08
    285 #define NI_DGRAM 0x10
    286 
    287 #include <mstcpip.h>
    288 
    289 #if (_WIN32_WINNT >= 0x0600)
    290 #define addrinfoEx __MINGW_NAME_AW(addrinfoEx)
    291 #define PADDRINFOEX __MINGW_NAME_AW(PADDRINFOEX)
    292 #define GetAddrInfoEx __MINGW_NAME_AW(GetAddrInfoEx)
    293 #define SetAddrInfoEx __MINGW_NAME_AW(SetAddrInfoEx)
    294 #define FreeAddrInfoEx __MINGW_NAME_AW(FreeAddrInfoEx)
    295 
    296   typedef struct addrinfoExA {
    297     int                ai_flags;
    298     int                ai_family;
    299     int                ai_socktype;
    300     int                ai_protocol;
    301     size_t             ai_addrlen;
    302     LPCSTR             ai_canonname;
    303     struct sockaddr    *ai_addr;
    304     void               *ai_blob;
    305     size_t             ai_bloblen;
    306     LPGUID             ai_provider;
    307     struct addrinfoexA *ai_next;
    308   } ADDRINFOEXA, *PADDRINFOEXA;
    309 
    310   typedef struct addrinfoExW {
    311     int                ai_flags;
    312     int                ai_family;
    313     int                ai_socktype;
    314     int                ai_protocol;
    315     size_t             ai_addrlen;
    316     LPCWSTR            ai_canonname;
    317     struct sockaddr    *ai_addr;
    318     void               *ai_blob;
    319     size_t             ai_bloblen;
    320     LPGUID             ai_provider;
    321     struct addrinfoexW *ai_next;
    322   } ADDRINFOEXW, *PADDRINFOEXW;
    323 
    324 typedef PVOID LPLOOKUPSERVICE_COMPLETION_ROUTINE; /*reserved*/
    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 FreeAddrInfoExA(PADDRINFOEXA pAddrInfo);
    349 WINSOCK_API_LINKAGE void WSAAPI FreeAddrInfoExW(PADDRINFOEXW pAddrInfo);
    350 
    351 #if INCL_WINSOCK_API_TYPEDEFS
    352 #define LPFN_GETADDRINFOEX __MINGW_NAME_AW(LPFN_GETADDRINFOEX)
    353   typedef int (WSAAPI *LPFN_GETADDRINFOEXA)(PCSTR pName, PCSTR pServiceName, DWORD dwNameSpace,
    354 					    LPGUID lpNspId,const ADDRINFOEXA *pHints,PADDRINFOEXA *ppResult,
    355 					    PTIMEVAL timeout,LPOVERLAPPED lpOverlapped,
    356 					    LPLOOKUPSERVICE_COMPLETION_ROUTINE lpCompletionRoutine,
    357 					    LPHANDLE lpNameHandle);
    358   typedef int (WSAAPI *LPFN_GETADDRINFOEXW)(PCWSTR pName,PCWSTR pServiceName,DWORD dwNameSpace,
    359 					    LPGUID lpNspId,const ADDRINFOEXW *pHints,PADDRINFOEXW *ppResult,
    360 					    PTIMEVAL timeout,LPOVERLAPPED lpOverlapped,
    361 					    LPLOOKUPSERVICE_COMPLETION_ROUTINE lpCompletionRoutine,
    362 					    LPHANDLE lpNameHandle);
    363 
    364 #define LPFN_SETADDRINFOEX __MINGW_NAME_AW(LPFN_SETADDRINFOEX)
    365   typedef int (WSAAPI *LPFN_SETADDRINFOEXA)(PCSTR pName, PCSTR pServiceName, SOCKET_ADDRESS *pAddresses,
    366 					    DWORD dwAddressCount,LPBLOB lpBlob,DWORD dwFlags,DWORD dwNameSpace,
    367 					    LPGUID lpNspId,PTIMEVAL timeout,LPOVERLAPPED lpOverlapped,
    368 					    LPLOOKUPSERVICE_COMPLETION_ROUTINE lpCompletionRoutine,
    369 					    LPHANDLE lpNameHandle);
    370   typedef int (WSAAPI *LPFN_SETADDRINFOEXW)(PCWSTR pName,PCWSTR 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 
    376 #define LPFN_FREEADDRINFOEX __MINGW_NAME_AW(LPFN_FREEADDRINFOEX)
    377   typedef void (WSAAPI *LPFN_FREEADDRINFOEXA)(PADDRINFOEXA pAddrInfo);
    378   typedef void (WSAAPI *LPFN_FREEADDRINFOEXW)(PADDRINFOEXW pAddrInfo);
    379 #endif /* INCL_WINSOCK_API_TYPEDEFS */
    380 
    381 
    382 WINSOCK_API_LINKAGE int WSAAPI WSAImpersonateSocketPeer(
    383   SOCKET Socket,
    384   const struct sockaddr *PeerAddress,
    385   ULONG peerAddressLen
    386 );
    387 
    388 WINSOCK_API_LINKAGE int WSAAPI WSAQuerySocketSecurity(
    389   SOCKET Socket,
    390   const SOCKET_SECURITY_QUERY_TEMPLATE *SecurityQueryTemplate,
    391   ULONG SecurityQueryTemplateLen,
    392   SOCKET_SECURITY_QUERY_INFO *SecurityQueryInfo,
    393   ULONG *SecurityQueryInfoLen,
    394   LPWSAOVERLAPPED Overlapped,
    395   LPWSAOVERLAPPED_COMPLETION_ROUTINE CompletionRoutine
    396 );
    397 
    398 WINSOCK_API_LINKAGE int WSAAPI WSARevertImpersonation(void);
    399 
    400 WINSOCK_API_LINKAGE int WSAAPI WSASetSocketPeerTargetName(
    401   SOCKET Socket,
    402   const SOCKET_PEER_TARGET_NAME *PeerTargetName,
    403   ULONG PeerTargetNameLen,
    404   LPWSAOVERLAPPED Overlapped,
    405   LPWSAOVERLAPPED_COMPLETION_ROUTINE CompletionRoutine
    406 );
    407 
    408 WINSOCK_API_LINKAGE int WSAAPI WSASetSocketSecurity(
    409   SOCKET Socket,
    410   const SOCKET_SECURITY_SETTINGS *SecuritySettings,
    411   ULONG SecuritySettingsLen,
    412   LPWSAOVERLAPPED Overlapped,
    413   LPWSAOVERLAPPED_COMPLETION_ROUTINE CompletionRoutine
    414 );
    415 
    416 #define InetNtopA inet_ntop
    417 
    418 WINSOCK_API_LINKAGE LPCWSTR WSAAPI InetNtopW(INT Family, PVOID pAddr, LPWSTR pStringBuf, size_t StringBufSIze);
    419 WINSOCK_API_LINKAGE LPCSTR WSAAPI InetNtopA(INT Family, PVOID pAddr, LPSTR pStringBuf, size_t StringBufSize);
    420 
    421 #define InetNtop __MINGW_NAME_AW(InetNtop)
    422 
    423 #define InetPtonA inet_pton
    424 
    425 WINSOCK_API_LINKAGE INT WSAAPI InetPtonW(INT Family, LPCWSTR pStringBuf, PVOID pAddr);
    426 WINSOCK_API_LINKAGE INT WSAAPI InetPtonA(INT Family, LPCSTR pStringBuf, PVOID pAddr);
    427 
    428 #define InetPton __MINGW_NAME_AW(InetPton)
    429 
    430 #endif /*(_WIN32_WINNT >= 0x0600)*/
    431 
    432 #ifdef __cplusplus
    433 }
    434 #endif
    435 
    436 #endif /* _WS2TCPIP_H_ */
    437