comparison fuhtark_test/include/winapi/ws2tcpip.h @ 1500:91c8c3b7cbf0

add: futhark tests for generating vulkan api
author sam <sam@basx.dev>
date Wed, 26 Nov 2025 21:36:48 +0700
parents
children
comparison
equal deleted inserted replaced
1499:1f58458b7ef7 1500:91c8c3b7cbf0
1 /**
2 * This file has no copyright assigned and is placed in the Public Domain.
3 * This file is part of the w64 mingw-runtime package.
4 * No warranty is given; refer to the file DISCLAIMER within this package.
5 */
6 #ifndef _WS2TCPIP_H
7 #define _WS2TCPIP_H
8
9 #if __GNUC__ >=3
10 #pragma GCC system_header
11 #endif
12
13 #include <ws2ipdef.h>
14
15 struct ip_msfilter {
16 struct in_addr imsf_multiaddr;
17 struct in_addr imsf_interface;
18 u_long imsf_fmode;
19 u_long imsf_numsrc;
20 struct in_addr imsf_slist[1];
21 };
22
23 #define IP_MSFILTER_SIZE(numsrc) (sizeof(struct ip_msfilter)-sizeof(struct in_addr) + (numsrc)*sizeof(struct in_addr))
24
25 #define MCAST_INCLUDE 0
26 #define MCAST_EXCLUDE 1
27
28 #define SIO_GET_INTERFACE_LIST _IOR('t',127,u_long)
29
30 #define SIO_GET_INTERFACE_LIST_EX _IOR('t',126,u_long)
31 #define SIO_SET_MULTICAST_FILTER _IOW('t',125,u_long)
32 #define SIO_GET_MULTICAST_FILTER _IOW('t',124 | IOC_IN,u_long)
33
34 #define IP_OPTIONS 1
35 #define IP_HDRINCL 2
36 #define IP_TOS 3
37 #define IP_TTL 4
38 #define IP_MULTICAST_IF 9
39 #define IP_MULTICAST_TTL 10
40 #define IP_MULTICAST_LOOP 11
41 #define IP_ADD_MEMBERSHIP 12
42 #define IP_DROP_MEMBERSHIP 13
43 #define IP_DONTFRAGMENT 14
44 #define IP_ADD_SOURCE_MEMBERSHIP 15
45 #define IP_DROP_SOURCE_MEMBERSHIP 16
46 #define IP_BLOCK_SOURCE 17
47 #define IP_UNBLOCK_SOURCE 18
48 #define IP_PKTINFO 19
49 #define IP_RECEIVE_BROADCAST 22
50
51 #define IPV6_HDRINCL 2
52 #define IPV6_UNICAST_HOPS 4
53 #define IPV6_MULTICAST_IF 9
54 #define IPV6_MULTICAST_HOPS 10
55 #define IPV6_MULTICAST_LOOP 11
56 #define IPV6_ADD_MEMBERSHIP 12
57 #define IPV6_DROP_MEMBERSHIP 13
58 #define IPV6_JOIN_GROUP IPV6_ADD_MEMBERSHIP
59 #define IPV6_LEAVE_GROUP IPV6_DROP_MEMBERSHIP
60 #define IPV6_PKTINFO 19
61 #define IPV6_HOPLIMIT 21
62 #define IPV6_PROTECTION_LEVEL 23
63
64 #define PROTECTION_LEVEL_UNRESTRICTED 10
65 #define PROTECTION_LEVEL_DEFAULT 20
66 #define PROTECTION_LEVEL_RESTRICTED 30
67
68 #define UDP_NOCHECKSUM 1
69 #define UDP_CHECKSUM_COVERAGE 20
70
71 #define TCP_EXPEDITED_1122 0x0002
72
73 #ifndef s6_addr
74
75 struct in6_addr {
76 __MINGW_EXTENSION union {
77 u_char Byte[16];
78 u_short Word[8];
79 } u;
80 };
81
82 #define in_addr6 in6_addr
83
84 #define _S6_un u
85 #define _S6_u8 Byte
86 #define s6_addr _S6_un._S6_u8
87
88 #define s6_bytes u.Byte
89 #define s6_words u.Word
90 #endif
91
92 typedef struct ipv6_mreq {
93 struct in6_addr ipv6mr_multiaddr;
94 unsigned int ipv6mr_interface;
95 } IPV6_MREQ;
96
97 struct sockaddr_in6_old {
98 short sin6_family;
99 u_short sin6_port;
100 u_long sin6_flowinfo;
101 struct in6_addr sin6_addr;
102 };
103
104 struct sockaddr_in6 {
105 short sin6_family;
106 u_short sin6_port;
107 u_long sin6_flowinfo;
108 struct in6_addr sin6_addr;
109 u_long sin6_scope_id;
110 };
111
112 typedef struct in6_addr IN6_ADDR;
113 typedef struct in6_addr *PIN6_ADDR;
114 typedef struct in6_addr *LPIN6_ADDR;
115
116 typedef struct sockaddr_in6 SOCKADDR_IN6;
117 typedef struct sockaddr_in6 *PSOCKADDR_IN6;
118 typedef struct sockaddr_in6 *LPSOCKADDR_IN6;
119
120 #define SS_PORT(ssp) (((struct sockaddr_in*)(ssp))->sin_port)
121
122 #define IN6ADDR_ANY_INIT { 0 }
123 #define IN6ADDR_LOOPBACK_INIT { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1 }
124
125 #ifdef __cplusplus
126 extern "C" {
127 #endif
128
129 extern const struct in6_addr in6addr_any;
130 extern const struct in6_addr in6addr_loopback;
131
132 #ifdef __cplusplus
133 }
134 #endif
135
136 #define WS2TCPIP_INLINE __CRT_INLINE
137
138 int IN6_ADDR_EQUAL(const struct in6_addr *,const struct in6_addr *);
139 int IN6_IS_ADDR_UNSPECIFIED(const struct in6_addr *);
140 int IN6_IS_ADDR_LOOPBACK(const struct in6_addr *);
141 int IN6_IS_ADDR_MULTICAST(const struct in6_addr *);
142 int IN6_IS_ADDR_LINKLOCAL(const struct in6_addr *);
143 int IN6_IS_ADDR_SITELOCAL(const struct in6_addr *);
144 int IN6_IS_ADDR_V4MAPPED(const struct in6_addr *);
145 int IN6_IS_ADDR_V4COMPAT(const struct in6_addr *);
146 int IN6_IS_ADDR_MC_NODELOCAL(const struct in6_addr *);
147 int IN6_IS_ADDR_MC_LINKLOCAL(const struct in6_addr *);
148 int IN6_IS_ADDR_MC_SITELOCAL(const struct in6_addr *);
149 int IN6_IS_ADDR_MC_ORGLOCAL(const struct in6_addr *);
150 int IN6_IS_ADDR_MC_GLOBAL(const struct in6_addr *);
151 int IN6ADDR_ISANY(const struct sockaddr_in6 *);
152 int IN6ADDR_ISLOOPBACK(const struct sockaddr_in6 *);
153 void IN6_SET_ADDR_UNSPECIFIED(struct in6_addr *);
154 void IN6_SET_ADDR_LOOPBACK(struct in6_addr *);
155 void IN6ADDR_SETANY(struct sockaddr_in6 *);
156 void IN6ADDR_SETLOOPBACK(struct sockaddr_in6 *);
157
158 #ifndef __CRT__NO_INLINE
159 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); }
160 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)); }
161 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)); }
162 WS2TCPIP_INLINE int IN6_IS_ADDR_MULTICAST(const struct in6_addr *a) { return (a->s6_bytes[0]==0xff); }
163 WS2TCPIP_INLINE int IN6_IS_ADDR_LINKLOCAL(const struct in6_addr *a) { return ((a->s6_bytes[0]==0xfe) && ((a->s6_bytes[1] & 0xc0)==0x80)); }
164 WS2TCPIP_INLINE int IN6_IS_ADDR_SITELOCAL(const struct in6_addr *a) { return ((a->s6_bytes[0]==0xfe) && ((a->s6_bytes[1] & 0xc0)==0xc0)); }
165 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)); }
166 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)))); }
167 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); }
168 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); }
169 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); }
170 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); }
171 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); }
172 WS2TCPIP_INLINE int IN6ADDR_ISANY(const struct sockaddr_in6 *a) { return ((a->sin6_family==AF_INET6) && IN6_IS_ADDR_UNSPECIFIED(&a->sin6_addr)); }
173 WS2TCPIP_INLINE int IN6ADDR_ISLOOPBACK(const struct sockaddr_in6 *a) { return ((a->sin6_family==AF_INET6) && IN6_IS_ADDR_LOOPBACK(&a->sin6_addr)); }
174 WS2TCPIP_INLINE void IN6_SET_ADDR_UNSPECIFIED(struct in6_addr *a) { memset(a->s6_bytes,0,sizeof(struct in6_addr)); }
175 WS2TCPIP_INLINE void IN6_SET_ADDR_LOOPBACK(struct in6_addr *a) {
176 memset(a->s6_bytes,0,sizeof(struct in6_addr));
177 a->s6_bytes[15] = 1;
178 }
179 WS2TCPIP_INLINE void IN6ADDR_SETANY(struct sockaddr_in6 *a) {
180 a->sin6_family = AF_INET6;
181 a->sin6_port = 0;
182 a->sin6_flowinfo = 0;
183 IN6_SET_ADDR_UNSPECIFIED(&a->sin6_addr);
184 a->sin6_scope_id = 0;
185 }
186 WS2TCPIP_INLINE void IN6ADDR_SETLOOPBACK(struct sockaddr_in6 *a) {
187 a->sin6_family = AF_INET6;
188 a->sin6_port = 0;
189 a->sin6_flowinfo = 0;
190 IN6_SET_ADDR_LOOPBACK(&a->sin6_addr);
191 a->sin6_scope_id = 0;
192 }
193 #endif /* !__CRT__NO_INLINE */
194
195 typedef union sockaddr_gen {
196 struct sockaddr Address;
197 struct sockaddr_in AddressIn;
198 struct sockaddr_in6_old AddressIn6;
199 } sockaddr_gen;
200
201 typedef struct _INTERFACE_INFO {
202 u_long iiFlags;
203 sockaddr_gen iiAddress;
204 sockaddr_gen iiBroadcastAddress;
205 sockaddr_gen iiNetmask;
206 } INTERFACE_INFO,*LPINTERFACE_INFO;
207
208 typedef struct _INTERFACE_INFO_EX {
209 u_long iiFlags;
210 SOCKET_ADDRESS iiAddress;
211 SOCKET_ADDRESS iiBroadcastAddress;
212 SOCKET_ADDRESS iiNetmask;
213 } INTERFACE_INFO_EX,*LPINTERFACE_INFO_EX;
214
215 #define IFF_UP 0x00000001
216 #define IFF_BROADCAST 0x00000002
217 #define IFF_LOOPBACK 0x00000004
218 #define IFF_POINTTOPOINT 0x00000008
219 #define IFF_MULTICAST 0x00000010
220
221 typedef struct in_pktinfo {
222 IN_ADDR ipi_addr;
223 UINT ipi_ifindex;
224 } IN_PKTINFO;
225
226 C_ASSERT(sizeof(IN_PKTINFO)==8);
227
228 typedef struct in6_pktinfo {
229 IN6_ADDR ipi6_addr;
230 UINT ipi6_ifindex;
231 } IN6_PKTINFO;
232
233 C_ASSERT(sizeof(IN6_PKTINFO)==20);
234
235 #define EAI_AGAIN WSATRY_AGAIN
236 #define EAI_BADFLAGS WSAEINVAL
237 #define EAI_FAIL WSANO_RECOVERY
238 #define EAI_FAMILY WSAEAFNOSUPPORT
239 #define EAI_MEMORY WSA_NOT_ENOUGH_MEMORY
240
241 #define EAI_NONAME WSAHOST_NOT_FOUND
242 #define EAI_SERVICE WSATYPE_NOT_FOUND
243 #define EAI_SOCKTYPE WSAESOCKTNOSUPPORT
244
245 #define EAI_NODATA EAI_NONAME
246
247 typedef struct addrinfo {
248 int ai_flags;
249 int ai_family;
250 int ai_socktype;
251 int ai_protocol;
252 size_t ai_addrlen;
253 char *ai_canonname;
254 struct sockaddr *ai_addr;
255 struct addrinfo *ai_next;
256 } ADDRINFOA,*PADDRINFOA;
257
258 typedef struct addrinfoW {
259 int ai_flags;
260 int ai_family;
261 int ai_socktype;
262 int ai_protocol;
263 size_t ai_addrlen;
264 PWSTR ai_canonname;
265 struct sockaddr *ai_addr;
266 struct addrinfoW *ai_next;
267 } ADDRINFOW,*PADDRINFOW;
268
269 #ifdef UNICODE
270 typedef ADDRINFOW ADDRINFOT,*PADDRINFOT;
271 #else
272 typedef ADDRINFOA ADDRINFOT,*PADDRINFOT;
273 #endif
274
275 typedef ADDRINFOA ADDRINFO,*LPADDRINFO;
276
277 #define AI_PASSIVE 0x1
278 #define AI_CANONNAME 0x2
279 #define AI_NUMERICHOST 0x4
280
281 #ifdef __cplusplus
282 extern "C" {
283 #endif
284
285 #ifdef UNICODE
286 #define GetAddrInfo GetAddrInfoW
287 #else
288 #define GetAddrInfo GetAddrInfoA
289 #endif
290
291 WINSOCK_API_LINKAGE int WSAAPI getaddrinfo(const char *nodename,const char *servname,const struct addrinfo *hints,struct addrinfo **res);
292 WINSOCK_API_LINKAGE int WSAAPI GetAddrInfoW(PCWSTR pNodeName,PCWSTR pServiceName,const ADDRINFOW *pHints,PADDRINFOW *ppResult);
293
294 #define GetAddrInfoA getaddrinfo
295
296 #if INCL_WINSOCK_API_TYPEDEFS
297 typedef int (WSAAPI *LPFN_GETADDRINFO)(const char *nodename,const char *servname,const struct addrinfo *hints,struct addrinfo **res);
298 typedef int (WSAAPI *LPFN_GETADDRINFOW)(PCWSTR pNodeName,PCWSTR pServiceName,const ADDRINFOW *pHints,PADDRINFOW *ppResult);
299
300 #define LPFN_GETADDRINFOA LPFN_GETADDRINFO
301
302 #ifdef UNICODE
303 #define LPFN_GETADDRINFOT LPFN_GETADDRINFOW
304 #else
305 #define LPFN_GETADDRINFOT LPFN_GETADDRINFOA
306 #endif
307 #endif
308
309 #ifdef UNICODE
310 #define FreeAddrInfo FreeAddrInfoW
311 #else
312 #define FreeAddrInfo FreeAddrInfoA
313 #endif
314
315 WINSOCK_API_LINKAGE void WSAAPI freeaddrinfo(LPADDRINFO pAddrInfo);
316 WINSOCK_API_LINKAGE void WSAAPI FreeAddrInfoW(PADDRINFOW pAddrInfo);
317
318 #define FreeAddrInfoA freeaddrinfo
319
320 #if INCL_WINSOCK_API_TYPEDEFS
321 typedef void (WSAAPI *LPFN_FREEADDRINFO)(struct addrinfo *ai);
322 typedef void (WSAAPI *LPFN_FREEADDRINFOW)(PADDRINFOW pAddrInfo);
323
324 #define LPFN_FREEADDRINFOA LPFN_FREEADDRINFO
325
326 #ifdef UNICODE
327 #define LPFN_FREEADDRINFOT LPFN_FREEADDRINFOW
328 #else
329 #define LPFN_FREEADDRINFOT LPFN_FREEADDRINFOA
330 #endif
331 #endif
332
333 #pragma push_macro("socklen_t")
334 #undef socklen_t
335
336 typedef int socklen_t;
337
338 #ifdef UNICODE
339 #define GetNameInfo GetNameInfoW
340 #else
341 #define GetNameInfo GetNameInfoA
342 #endif
343
344 WINSOCK_API_LINKAGE int WSAAPI getnameinfo(const struct sockaddr *sa,socklen_t salen,char *host,DWORD hostlen,char *serv,DWORD servlen,int flags);
345 WINSOCK_API_LINKAGE INT WSAAPI GetNameInfoW(const SOCKADDR *pSockaddr,socklen_t SockaddrLength,PWCHAR pNodeBuffer,DWORD NodeBufferSize,PWCHAR pServiceBuffer,DWORD ServiceBufferSize,INT Flags);
346
347 #define GetNameInfoA getnameinfo
348
349 #if INCL_WINSOCK_API_TYPEDEFS
350 typedef int (WSAAPI *LPFN_GETNAMEINFO)(const struct sockaddr *sa,socklen_t salen,char *host,DWORD hostlen,char *serv,DWORD servlen,int flags);
351 typedef INT (WSAAPI *LPFN_GETNAMEINFOW)(const SOCKADDR *pSockaddr,socklen_t SockaddrLength,PWCHAR pNodeBuffer,DWORD NodeBufferSize,PWCHAR pServiceBuffer,DWORD ServiceBufferSize,INT Flags);
352
353 #define LPFN_GETNAMEINFOA LPFN_GETNAMEINFO
354
355 #ifdef UNICODE
356 #define LPFN_GETNAMEINFOT LPFN_GETNAMEINFOW
357 #else
358 #define LPFN_GETNAMEINFOT LPFN_GETNAMEINFOA
359 #endif
360 #endif
361
362 #pragma pop_macro("socklen_t")
363
364 #ifdef UNICODE
365 #define gai_strerror gai_strerrorW
366 #else
367 #define gai_strerror gai_strerrorA
368 #endif
369
370 #define GAI_STRERROR_BUFFER_SIZE 1024
371
372 char *gai_strerrorA (int);
373 WCHAR *gai_strerrorW(int);
374
375 #define NI_MAXHOST 1025
376 #define NI_MAXSERV 32
377
378 #define INET_ADDRSTRLEN 22
379 #define INET6_ADDRSTRLEN 65
380
381 #define NI_NOFQDN 0x01
382 #define NI_NUMERICHOST 0x02
383 #define NI_NAMEREQD 0x04
384 #define NI_NUMERICSERV 0x08
385 #define NI_DGRAM 0x10
386
387 #ifdef __cplusplus
388 }
389 #endif
390
391 #endif