f7b6c4d1ccd857d998828fa51b0ee02770f752d8
[reactos.git] / reactos / include / psdk / ws2ipdef.h
1 #pragma once
2
3 #define _WS2IPDEF_
4
5 #ifdef __cplusplus
6 extern "C" {
7 #endif
8
9 #ifndef WS2IPDEF_ASSERT
10 #define WS2IPDEF_ASSERT(exp) ((VOID) 0)
11 #endif
12
13 #ifdef _MSC_VER
14 #define WS2TCPIP_INLINE __inline
15 #else
16 #define WS2TCPIP_INLINE extern inline
17 #endif
18
19 #include <in6addr.h>
20
21 #define IFF_UP 0x00000001
22 #define IFF_BROADCAST 0x00000002
23 #define IFF_LOOPBACK 0x00000004
24 #define IFF_POINTTOPOINT 0x00000008
25 #define IFF_MULTICAST 0x00000010
26
27 #define IP_OPTIONS 1
28 #define IP_HDRINCL 2
29 #define IP_TOS 3
30 #define IP_TTL 4
31 #define IP_MULTICAST_IF 9
32 #define IP_MULTICAST_TTL 10
33 #define IP_MULTICAST_LOOP 11
34 #define IP_ADD_MEMBERSHIP 12
35 #define IP_DROP_MEMBERSHIP 13
36 #define IP_DONTFRAGMENT 14
37 #define IP_ADD_SOURCE_MEMBERSHIP 15
38 #define IP_DROP_SOURCE_MEMBERSHIP 16
39 #define IP_BLOCK_SOURCE 17
40 #define IP_UNBLOCK_SOURCE 18
41 #define IP_PKTINFO 19
42 #define IP_HOPLIMIT 21
43 #define IP_RECEIVE_BROADCAST 22
44 #define IP_RECVIF 24
45 #define IP_RECVDSTADDR 25
46 #define IP_IFLIST 28
47 #define IP_ADD_IFLIST 29
48 #define IP_DEL_IFLIST 30
49 #define IP_UNICAST_IF 31
50 #define IP_RTHDR 32
51 #define IP_RECVRTHDR 38
52 #define IP_TCLASS 39
53 #define IP_RECVTCLASS 40
54 #define IP_ORIGINAL_ARRIVAL_IF 47
55
56 #define IP_UNSPECIFIED_TYPE_OF_SERVICE -1
57
58 #define IPV6_ADDRESS_BITS RTL_BITS_OF(IN6_ADDR)
59
60 #define SS_PORT(ssp) (((PSOCKADDR_IN)(ssp))->sin_port)
61
62 #define SIO_GET_INTERFACE_LIST _IOR('t', 127, ULONG)
63 #define SIO_GET_INTERFACE_LIST_EX _IOR('t', 126, ULONG)
64 #define SIO_SET_MULTICAST_FILTER _IOW('t', 125, ULONG)
65 #define SIO_GET_MULTICAST_FILTER _IOW('t', 124 | IOC_IN, ULONG)
66 #define SIOCSIPMSFILTER SIO_SET_MULTICAST_FILTER
67 #define SIOCGIPMSFILTER SIO_GET_MULTICAST_FILTER
68
69 #define SIOCSMSFILTER _IOW('t', 126, ULONG)
70 #define SIOCGMSFILTER _IOW('t', 127 | IOC_IN, ULONG)
71
72 #if (NTDDI_VERSION >= NTDDI_VISTASP1)
73
74 #define IDEAL_SEND_BACKLOG_IOCTLS
75
76 #define SIO_IDEAL_SEND_BACKLOG_QUERY _IOR('t', 123, ULONG)
77 #define SIO_IDEAL_SEND_BACKLOG_CHANGE _IO('t', 122)
78
79 #endif /* (NTDDI_VERSION >= NTDDI_VISTASP1) */
80
81 #define MCAST_JOIN_GROUP 41
82 #define MCAST_LEAVE_GROUP 42
83 #define MCAST_BLOCK_SOURCE 43
84 #define MCAST_UNBLOCK_SOURCE 44
85 #define MCAST_JOIN_SOURCE_GROUP 45
86 #define MCAST_LEAVE_SOURCE_GROUP 46
87
88 #define IP_MSFILTER_SIZE(NumSources) \
89 (sizeof(IP_MSFILTER) - sizeof(IN_ADDR) + (NumSources) * sizeof(IN_ADDR))
90
91 #define IPV6_HOPOPTS 1
92 #define IPV6_HDRINCL 2
93 #define IPV6_UNICAST_HOPS 4
94 #define IPV6_MULTICAST_IF 9
95 #define IPV6_MULTICAST_HOPS 10
96 #define IPV6_MULTICAST_LOOP 11
97 #define IPV6_ADD_MEMBERSHIP 12
98 #define IPV6_JOIN_GROUP IPV6_ADD_MEMBERSHIP
99 #define IPV6_DROP_MEMBERSHIP 13
100 #define IPV6_LEAVE_GROUP IPV6_DROP_MEMBERSHIP
101 #define IPV6_DONTFRAG 14
102 #define IPV6_PKTINFO 19
103 #define IPV6_HOPLIMIT 21
104 #define IPV6_PROTECTION_LEVEL 23
105 #define IPV6_RECVIF 24
106 #define IPV6_RECVDSTADDR 25
107 #define IPV6_CHECKSUM 26
108 #define IPV6_V6ONLY 27
109 #define IPV6_IFLIST 28
110 #define IPV6_ADD_IFLIST 29
111 #define IPV6_DEL_IFLIST 30
112 #define IPV6_UNICAST_IF 31
113 #define IPV6_RTHDR 32
114 #define IPV6_RECVRTHDR 38
115 #define IPV6_TCLASS 39
116 #define IPV6_RECVTCLASS 40
117
118 #define IP_UNSPECIFIED_HOP_LIMIT -1
119
120 #define IP_PROTECTION_LEVEL IPV6_PROTECTION_LEVEL
121 #define PROTECTION_LEVEL_UNRESTRICTED 10
122 #define PROTECTION_LEVEL_EDGERESTRICTED 20
123 #define PROTECTION_LEVEL_RESTRICTED 30
124
125 #if (NTDDI_VERSION < NTDDI_VISTA)
126 #define PROTECTION_LEVEL_DEFAULT PROTECTION_LEVEL_EDGERESTRICTED
127 #else
128 #define PROTECTION_LEVEL_DEFAULT ((UINT)-1)
129 #endif
130
131 #define INET_ADDRSTRLEN 22
132 #define INET6_ADDRSTRLEN 65
133
134 #define TCP_OFFLOAD_NO_PREFERENCE 0
135 #define TCP_OFFLOAD_NOT_PREFERRED 1
136 #define TCP_OFFLOAD_PREFERRED 2
137
138 #define TCP_EXPEDITED_1122 0x0002
139 #define TCP_KEEPALIVE 3
140 #define TCP_MAXSEG 4
141 #define TCP_MAXRT 5
142 #define TCP_STDURG 6
143 #define TCP_NOURG 7
144 #define TCP_ATMARK 8
145 #define TCP_NOSYNRETRIES 9
146 #define TCP_TIMESTAMPS 10
147 #define TCP_OFFLOAD_PREFERENCE 11
148 #define TCP_CONGESTION_ALGORITHM 12
149 #define TCP_DELAY_FIN_ACK 13
150
151 struct sockaddr_in6_old {
152 SHORT sin6_family;
153 USHORT sin6_port;
154 ULONG sin6_flowinfo;
155 IN6_ADDR sin6_addr;
156 };
157
158 typedef union sockaddr_gen {
159 struct sockaddr Address;
160 struct sockaddr_in AddressIn;
161 struct sockaddr_in6_old AddressIn6;
162 } sockaddr_gen;
163
164 typedef struct _INTERFACE_INFO {
165 ULONG iiFlags;
166 sockaddr_gen iiAddress;
167 sockaddr_gen iiBroadcastAddress;
168 sockaddr_gen iiNetmask;
169 } INTERFACE_INFO, FAR *LPINTERFACE_INFO;
170
171 typedef struct _INTERFACE_INFO_EX {
172 ULONG iiFlags;
173 SOCKET_ADDRESS iiAddress;
174 SOCKET_ADDRESS iiBroadcastAddress;
175 SOCKET_ADDRESS iiNetmask;
176 } INTERFACE_INFO_EX, FAR *LPINTERFACE_INFO_EX;
177
178 typedef struct sockaddr_in6 {
179 ADDRESS_FAMILY sin6_family;
180 USHORT sin6_port;
181 ULONG sin6_flowinfo;
182 IN6_ADDR sin6_addr;
183 union {
184 ULONG sin6_scope_id;
185 SCOPE_ID sin6_scope_struct;
186 };
187 } SOCKADDR_IN6_LH, *PSOCKADDR_IN6_LH, FAR *LPSOCKADDR_IN6_LH;
188
189 typedef struct sockaddr_in6_w2ksp1 {
190 short sin6_family;
191 USHORT sin6_port;
192 ULONG sin6_flowinfo;
193 struct in6_addr sin6_addr;
194 ULONG sin6_scope_id;
195 } SOCKADDR_IN6_W2KSP1, *PSOCKADDR_IN6_W2KSP1, FAR *LPSOCKADDR_IN6_W2KSP1;
196
197 #if (NTDDI_VERSION >= NTDDI_VISTA)
198
199 typedef SOCKADDR_IN6_LH SOCKADDR_IN6;
200 typedef SOCKADDR_IN6_LH *PSOCKADDR_IN6;
201 typedef SOCKADDR_IN6_LH FAR *LPSOCKADDR_IN6;
202
203 #elif(NTDDI_VERSION >= NTDDI_WIN2KSP1)
204
205 typedef SOCKADDR_IN6_W2KSP1 SOCKADDR_IN6;
206 typedef SOCKADDR_IN6_W2KSP1 *PSOCKADDR_IN6;
207 typedef SOCKADDR_IN6_W2KSP1 FAR *LPSOCKADDR_IN6;
208
209 #else
210
211 typedef SOCKADDR_IN6_LH SOCKADDR_IN6;
212 typedef SOCKADDR_IN6_LH *PSOCKADDR_IN6;
213 typedef SOCKADDR_IN6_LH FAR *LPSOCKADDR_IN6;
214
215 #endif /* (NTDDI_VERSION >= NTDDI_VISTA) */
216
217 typedef union _SOCKADDR_INET {
218 SOCKADDR_IN Ipv4;
219 SOCKADDR_IN6 Ipv6;
220 ADDRESS_FAMILY si_family;
221 } SOCKADDR_INET, *PSOCKADDR_INET;
222
223 typedef struct _sockaddr_in6_pair {
224 PSOCKADDR_IN6 SourceAddress;
225 PSOCKADDR_IN6 DestinationAddress;
226 } SOCKADDR_IN6_PAIR, *PSOCKADDR_IN6_PAIR;
227
228 #if (NTDDI_VERSION >= NTDDI_WIN2KSP1)
229
230 #define IN6ADDR_ANY_INIT {0}
231 #define IN6ADDR_LOOPBACK_INIT {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1}
232 #define IN6ADDR_ALLNODESONNODE_INIT {0xff, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01}
233 #define IN6ADDR_ALLNODESONLINK_INIT {0xff, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01}
234 #define IN6ADDR_ALLROUTERSONLINK_INIT {0xff, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02}
235 #define IN6ADDR_ALLMLDV2ROUTERSONLINK_INIT {0xff, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x16}
236 #define IN6ADDR_TEREDOINITIALLINKLOCALADDRESS_INIT {0xfe, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfe}
237 #define IN6ADDR_TEREDOOLDLINKLOCALADDRESSXP_INIT {0xfe, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 'T', 'E', 'R', 'E', 'D', 'O'}
238 #define IN6ADDR_TEREDOOLDLINKLOCALADDRESSVISTA_INIT {0xfe, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff}
239 #define IN6ADDR_LINKLOCALPREFIX_INIT {0xfe, 0x80, }
240 #define IN6ADDR_MULTICASTPREFIX_INIT {0xff, 0x00, }
241 #define IN6ADDR_SOLICITEDNODEMULTICASTPREFIX_INIT {0xff, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0xff, }
242 #define IN6ADDR_V4MAPPEDPREFIX_INIT {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, }
243 #define IN6ADDR_6TO4PREFIX_INIT {0x20, 0x02, }
244 #define IN6ADDR_TEREDOPREFIX_INIT {0x20, 0x01, 0x00, 0x00, }
245 #define IN6ADDR_TEREDOPREFIX_INIT_OLD {0x3f, 0xfe, 0x83, 0x1f, }
246
247 #define IN6ADDR_LINKLOCALPREFIX_LENGTH 64
248 #define IN6ADDR_MULTICASTPREFIX_LENGTH 8
249 #define IN6ADDR_SOLICITEDNODEMULTICASTPREFIX_LENGTH 104
250 #define IN6ADDR_V4MAPPEDPREFIX_LENGTH 96
251 #define IN6ADDR_6TO4PREFIX_LENGTH 16
252 #define IN6ADDR_TEREDOPREFIX_LENGTH 32
253
254 extern CONST SCOPE_ID scopeid_unspecified;
255
256 extern CONST IN_ADDR in4addr_any;
257 extern CONST IN_ADDR in4addr_loopback;
258 extern CONST IN_ADDR in4addr_broadcast;
259 extern CONST IN_ADDR in4addr_allnodesonlink;
260 extern CONST IN_ADDR in4addr_allroutersonlink;
261 extern CONST IN_ADDR in4addr_alligmpv3routersonlink;
262 extern CONST IN_ADDR in4addr_allteredohostsonlink;
263 extern CONST IN_ADDR in4addr_linklocalprefix;
264 extern CONST IN_ADDR in4addr_multicastprefix;
265
266 extern CONST IN6_ADDR in6addr_any;
267 extern CONST IN6_ADDR in6addr_loopback;
268 extern CONST IN6_ADDR in6addr_allnodesonnode;
269 extern CONST IN6_ADDR in6addr_allnodesonlink;
270 extern CONST IN6_ADDR in6addr_allroutersonlink;
271 extern CONST IN6_ADDR in6addr_allmldv2routersonlink;
272 extern CONST IN6_ADDR in6addr_teredoinitiallinklocaladdress;
273 extern CONST IN6_ADDR in6addr_linklocalprefix;
274 extern CONST IN6_ADDR in6addr_multicastprefix;
275 extern CONST IN6_ADDR in6addr_solicitednodemulticastprefix;
276 extern CONST IN6_ADDR in6addr_v4mappedprefix;
277 extern CONST IN6_ADDR in6addr_6to4prefix;
278 extern CONST IN6_ADDR in6addr_teredoprefix;
279 extern CONST IN6_ADDR in6addr_teredoprefix_old;
280
281 #ifndef __midl
282
283 WS2TCPIP_INLINE
284 BOOLEAN
285 IN6_ADDR_EQUAL(CONST IN6_ADDR *x, CONST IN6_ADDR *y) {
286 __int64 UNALIGNED *a;
287 __int64 UNALIGNED *b;
288
289 a = (__int64 UNALIGNED *)x;
290 b = (__int64 UNALIGNED *)y;
291 return (BOOLEAN)((a[1] == b[1]) && (a[0] == b[0]));
292 }
293
294 #define IN6_ARE_ADDR_EQUAL IN6_ADDR_EQUAL
295
296 WS2TCPIP_INLINE
297 BOOLEAN
298 IN6_IS_ADDR_UNSPECIFIED(CONST IN6_ADDR *a) {
299 return (BOOLEAN)((a->s6_words[0] == 0) &&
300 (a->s6_words[1] == 0) &&
301 (a->s6_words[2] == 0) &&
302 (a->s6_words[3] == 0) &&
303 (a->s6_words[4] == 0) &&
304 (a->s6_words[5] == 0) &&
305 (a->s6_words[6] == 0) &&
306 (a->s6_words[7] == 0));
307 }
308
309 WS2TCPIP_INLINE
310 BOOLEAN
311 IN6_IS_ADDR_LOOPBACK(CONST IN6_ADDR *a) {
312 return (BOOLEAN)((a->s6_words[0] == 0) &&
313 (a->s6_words[1] == 0) &&
314 (a->s6_words[2] == 0) &&
315 (a->s6_words[3] == 0) &&
316 (a->s6_words[4] == 0) &&
317 (a->s6_words[5] == 0) &&
318 (a->s6_words[6] == 0) &&
319 (a->s6_words[7] == 0x0100));
320 }
321
322 WS2TCPIP_INLINE
323 BOOLEAN
324 IN6_IS_ADDR_MULTICAST(CONST IN6_ADDR *a) {
325 return (BOOLEAN)(a->s6_bytes[0] == 0xff);
326 }
327
328 WS2TCPIP_INLINE
329 BOOLEAN
330 IN6_IS_ADDR_EUI64(CONST IN6_ADDR *a) {
331 return (BOOLEAN)(((a->s6_bytes[0] & 0xe0) != 0) &&
332 !IN6_IS_ADDR_MULTICAST(a));
333 }
334
335 WS2TCPIP_INLINE
336 BOOLEAN
337 IN6_IS_ADDR_SUBNET_ROUTER_ANYCAST(CONST IN6_ADDR *a) {
338 return (BOOLEAN)(IN6_IS_ADDR_EUI64(a) &&
339 (a->s6_words[4] == 0) &&
340 (a->s6_words[5] == 0) &&
341 (a->s6_words[6] == 0) &&
342 (a->s6_words[7] == 0));
343 }
344
345 WS2TCPIP_INLINE
346 BOOLEAN
347 IN6_IS_ADDR_SUBNET_RESERVED_ANYCAST(CONST IN6_ADDR *a) {
348 return (BOOLEAN)(IN6_IS_ADDR_EUI64(a) &&
349 (a->s6_words[4] == 0xfffd) &&
350 (a->s6_words[5] == 0xffff) &&
351 (a->s6_words[6] == 0xffff) &&
352 ((a->s6_words[7] & 0x80ff) == 0x80ff));
353 }
354
355 WS2TCPIP_INLINE
356 BOOLEAN
357 IN6_IS_ADDR_ANYCAST(CONST IN6_ADDR *a) {
358 return (IN6_IS_ADDR_SUBNET_RESERVED_ANYCAST(a) ||
359 IN6_IS_ADDR_SUBNET_ROUTER_ANYCAST(a));
360 }
361
362 WS2TCPIP_INLINE
363 BOOLEAN
364 IN6_IS_ADDR_LINKLOCAL(CONST IN6_ADDR *a) {
365 return (BOOLEAN)((a->s6_bytes[0] == 0xfe) &&
366 ((a->s6_bytes[1] & 0xc0) == 0x80));
367 }
368
369 WS2TCPIP_INLINE
370 BOOLEAN
371 IN6_IS_ADDR_SITELOCAL(CONST IN6_ADDR *a) {
372 return (BOOLEAN)((a->s6_bytes[0] == 0xfe) &&
373 ((a->s6_bytes[1] & 0xc0) == 0xc0));
374 }
375
376 WS2TCPIP_INLINE
377 BOOLEAN
378 IN6_IS_ADDR_GLOBAL(CONST IN6_ADDR *a) {
379 ULONG High = (a->s6_bytes[0] & 0xf0);
380 return (BOOLEAN)((High != 0) && (High != 0xf0));
381 }
382
383 WS2TCPIP_INLINE
384 BOOLEAN
385 IN6_IS_ADDR_V4MAPPED(CONST IN6_ADDR *a) {
386 return (BOOLEAN)((a->s6_words[0] == 0) &&
387 (a->s6_words[1] == 0) &&
388 (a->s6_words[2] == 0) &&
389 (a->s6_words[3] == 0) &&
390 (a->s6_words[4] == 0) &&
391 (a->s6_words[5] == 0xffff));
392 }
393
394 WS2TCPIP_INLINE
395 BOOLEAN
396 IN6_IS_ADDR_V4COMPAT(CONST IN6_ADDR *a) {
397 return (BOOLEAN)((a->s6_words[0] == 0) &&
398 (a->s6_words[1] == 0) &&
399 (a->s6_words[2] == 0) &&
400 (a->s6_words[3] == 0) &&
401 (a->s6_words[4] == 0) &&
402 (a->s6_words[5] == 0) &&
403 !((a->s6_words[6] == 0) &&
404 (a->s6_addr[14] == 0) &&
405 ((a->s6_addr[15] == 0) || (a->s6_addr[15] == 1))));
406 }
407
408 WS2TCPIP_INLINE
409 BOOLEAN
410 IN6_IS_ADDR_V4TRANSLATED(CONST IN6_ADDR *a) {
411 return (BOOLEAN)((a->s6_words[0] == 0) &&
412 (a->s6_words[1] == 0) &&
413 (a->s6_words[2] == 0) &&
414 (a->s6_words[3] == 0) &&
415 (a->s6_words[4] == 0xffff) &&
416 (a->s6_words[5] == 0));
417 }
418
419 WS2TCPIP_INLINE
420 BOOLEAN
421 IN6_IS_ADDR_MC_NODELOCAL(CONST IN6_ADDR *a) {
422 return (BOOLEAN)(IN6_IS_ADDR_MULTICAST(a) &&
423 ((a->s6_bytes[1] & 0xf) == 1));
424 }
425
426 WS2TCPIP_INLINE
427 BOOLEAN
428 IN6_IS_ADDR_MC_LINKLOCAL(CONST IN6_ADDR *a) {
429 return (BOOLEAN)(IN6_IS_ADDR_MULTICAST(a) &&
430 ((a->s6_bytes[1] & 0xf) == 2));
431 }
432
433 WS2TCPIP_INLINE
434 BOOLEAN
435 IN6_IS_ADDR_MC_SITELOCAL(CONST IN6_ADDR *a) {
436 return (BOOLEAN)(IN6_IS_ADDR_MULTICAST(a) &&
437 ((a->s6_bytes[1] & 0xf) == 5));
438 }
439
440 WS2TCPIP_INLINE
441 BOOLEAN
442 IN6_IS_ADDR_MC_ORGLOCAL(CONST IN6_ADDR *a) {
443 return (BOOLEAN)(IN6_IS_ADDR_MULTICAST(a) &&
444 ((a->s6_bytes[1] & 0xf) == 8));
445 }
446
447 WS2TCPIP_INLINE
448 BOOLEAN
449 IN6_IS_ADDR_MC_GLOBAL(CONST IN6_ADDR *a) {
450 return (BOOLEAN)(IN6_IS_ADDR_MULTICAST(a) &&
451 ((a->s6_bytes[1] & 0xf) == 0xe));
452 }
453
454 WS2TCPIP_INLINE
455 VOID
456 IN6_SET_ADDR_UNSPECIFIED(PIN6_ADDR a) {
457 memset(a->s6_bytes, 0, sizeof(IN6_ADDR));
458 }
459
460 WS2TCPIP_INLINE
461 VOID
462 IN6_SET_ADDR_LOOPBACK(PIN6_ADDR a) {
463 memset(a->s6_bytes, 0, sizeof(IN6_ADDR));
464 a->s6_bytes[15] = 1;
465 }
466
467 WS2TCPIP_INLINE
468 VOID
469 IN6ADDR_SETANY(PSOCKADDR_IN6 a) {
470 a->sin6_family = AF_INET6;
471 a->sin6_port = 0;
472 a->sin6_flowinfo = 0;
473 IN6_SET_ADDR_UNSPECIFIED(&a->sin6_addr);
474 a->sin6_scope_id = 0;
475 }
476
477 WS2TCPIP_INLINE
478 VOID
479 IN6ADDR_SETLOOPBACK(PSOCKADDR_IN6 a) {
480 a->sin6_family = AF_INET6;
481 a->sin6_port = 0;
482 a->sin6_flowinfo = 0;
483 IN6_SET_ADDR_LOOPBACK(&a->sin6_addr);
484 a->sin6_scope_id = 0;
485 }
486
487 WS2TCPIP_INLINE
488 BOOLEAN
489 IN6ADDR_ISANY(CONST SOCKADDR_IN6 *a) {
490 WS2IPDEF_ASSERT(a->sin6_family == AF_INET6);
491 return IN6_IS_ADDR_UNSPECIFIED(&a->sin6_addr);
492 }
493
494 WS2TCPIP_INLINE
495 BOOLEAN
496 IN6ADDR_ISLOOPBACK(CONST SOCKADDR_IN6 *a) {
497 WS2IPDEF_ASSERT(a->sin6_family == AF_INET6);
498 return IN6_IS_ADDR_LOOPBACK(&a->sin6_addr);
499 }
500
501 WS2TCPIP_INLINE
502 BOOLEAN
503 IN6ADDR_ISEQUAL(CONST SOCKADDR_IN6 *a, CONST SOCKADDR_IN6 *b) {
504 WS2IPDEF_ASSERT(a->sin6_family == AF_INET6);
505 return (BOOLEAN)(a->sin6_scope_id == b->sin6_scope_id &&
506 IN6_ADDR_EQUAL(&a->sin6_addr, &b->sin6_addr));
507 }
508
509 WS2TCPIP_INLINE
510 BOOLEAN
511 IN6ADDR_ISUNSPECIFIED(CONST SOCKADDR_IN6 *a) {
512 WS2IPDEF_ASSERT(a->sin6_family == AF_INET6);
513 return (BOOLEAN)(a->sin6_scope_id == 0 &&
514 IN6_IS_ADDR_UNSPECIFIED(&a->sin6_addr));
515 }
516
517 #endif /* __midl */
518
519 #endif /* (NTDDI_VERSION >= NTDDI_WIN2KSP1) */
520
521 typedef enum _MULTICAST_MODE_TYPE {
522 MCAST_INCLUDE = 0,
523 MCAST_EXCLUDE
524 } MULTICAST_MODE_TYPE;
525
526 typedef struct ip_mreq {
527 IN_ADDR imr_multiaddr;
528 IN_ADDR imr_interface;
529 } IP_MREQ, *PIP_MREQ;
530
531 typedef struct ip_mreq_source {
532 IN_ADDR imr_multiaddr;
533 IN_ADDR imr_sourceaddr;
534 IN_ADDR imr_interface;
535 } IP_MREQ_SOURCE, *PIP_MREQ_SOURCE;
536
537 typedef struct ip_msfilter {
538 IN_ADDR imsf_multiaddr;
539 IN_ADDR imsf_interface;
540 MULTICAST_MODE_TYPE imsf_fmode;
541 ULONG imsf_numsrc;
542 IN_ADDR imsf_slist[1];
543 } IP_MSFILTER, *PIP_MSFILTER;
544
545 typedef struct ipv6_mreq {
546 IN6_ADDR ipv6mr_multiaddr;
547 ULONG ipv6mr_interface;
548 } IPV6_MREQ, *PIPV6_MREQ;
549
550 #if (NTDDI_VERSION >= NTDDI_WINXP)
551
552 typedef struct group_req {
553 ULONG gr_interface;
554 SOCKADDR_STORAGE gr_group;
555 } GROUP_REQ, *PGROUP_REQ;
556
557 typedef struct group_source_req {
558 ULONG gsr_interface;
559 SOCKADDR_STORAGE gsr_group;
560 SOCKADDR_STORAGE gsr_source;
561 } GROUP_SOURCE_REQ, *PGROUP_SOURCE_REQ;
562
563 typedef struct group_filter {
564 ULONG gf_interface;
565 SOCKADDR_STORAGE gf_group;
566 MULTICAST_MODE_TYPE gf_fmode;
567 ULONG gf_numsrc;
568 SOCKADDR_STORAGE gf_slist[1];
569 } GROUP_FILTER, *PGROUP_FILTER;
570
571 #define GROUP_FILTER_SIZE(numsrc) \
572 (sizeof(GROUP_FILTER) - sizeof(SOCKADDR_STORAGE) \
573 + (numsrc) * sizeof(SOCKADDR_STORAGE))
574
575 #endif /* (NTDDI_VERSION >= NTDDI_WINXP) */
576
577 typedef struct in_pktinfo {
578 IN_ADDR ipi_addr;
579 ULONG ipi_ifindex;
580 } IN_PKTINFO, *PIN_PKTINFO;
581
582 C_ASSERT(sizeof(IN_PKTINFO) == 8);
583
584 typedef struct in6_pktinfo {
585 IN6_ADDR ipi6_addr;
586 ULONG ipi6_ifindex;
587 } IN6_PKTINFO, *PIN6_PKTINFO;
588
589 C_ASSERT(sizeof(IN6_PKTINFO) == 20);
590
591 #ifdef __cplusplus
592 }
593 #endif