source: Daodan/MSYS2/mingw32/i686-w64-mingw32/include/ws2ipdef.h@ 1166

Last change on this file since 1166 was 1166, checked in by rossy, 3 years ago

Daodan: Replace MinGW build env with an up-to-date MSYS2 env

File size: 7.0 KB
RevLine 
[1166]1/**
2 * This file is part of the mingw-w64 runtime package.
3 * No warranty is given; refer to the file DISCLAIMER within this package.
4 */
5#ifndef _WS2IPDEF_
6#define _WS2IPDEF_
7
8#include <_mingw_unicode.h>
9#include <winapifamily.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 <in6addr.h>
18
19#ifdef __cplusplus
20extern "C" {
21#endif
22
23/* options at IPPROTO_IP level */
24#define IP_OPTIONS 1
25#define IP_HDRINCL 2
26#define IP_TOS 3
27#define IP_TTL 4
28#define IP_MULTICAST_IF 9
29#define IP_MULTICAST_TTL 10
30#define IP_MULTICAST_LOOP 11
31#define IP_ADD_MEMBERSHIP 12
32#define IP_DROP_MEMBERSHIP 13
33#define IP_DONTFRAGMENT 14
34#define IP_ADD_SOURCE_MEMBERSHIP 15
35#define IP_DROP_SOURCE_MEMBERSHIP 16
36#define IP_BLOCK_SOURCE 17
37#define IP_UNBLOCK_SOURCE 18
38#define IP_PKTINFO 19
39#define IP_HOPLIMIT 21
40#define IP_RECVTTL 21
41#define IP_RECEIVE_BROADCAST 22
42#define IP_RECVIF 24
43#define IP_RECVDSTADDR 25
44#define IP_IFLIST 28
45#define IP_ADD_IFLIST 29
46#define IP_DEL_IFLIST 30
47#define IP_UNICAST_IF 31
48#define IP_RTHDR 32
49#define IP_GET_IFLIST 33
50#define IP_RECVRTHDR 38
51#define IP_TCLASS 39
52#define IP_RECVTCLASS 40
53#define IP_RECVTOS 40
54#define IP_ORIGINAL_ARRIVAL_IF 47
55#define IP_ECN 50
56#define IP_PKTINFO_EX 51
57#define IP_WFP_REDIRECT_RECORDS 60
58#define IP_WFP_REDIRECT_CONTEXT 70
59#define IP_MTU_DISCOVER 71
60#define IP_MTU 73
61#define IP_NRT_INTERFACE 74
62#define IP_RECVERR 75
63#define IP_USER_MTU 76
64
65#define IP_UNSPECIFIED_TYPE_OF_SERVICE -1
66#define IP_UNSPECIFIED_USER_MTU MAXULONG
67
68#define IPV6_ADDRESS_BITS RTL_BITS_OF(IN6_ADDR)
69
70/* options at IPPROTO_IPV6 level */
71#define IPV6_HOPOPTS 1
72#define IPV6_HDRINCL 2
73#define IPV6_UNICAST_HOPS 4
74#define IPV6_MULTICAST_IF 9
75#define IPV6_MULTICAST_HOPS 10
76#define IPV6_MULTICAST_LOOP 11
77#define IPV6_ADD_MEMBERSHIP 12
78#define IPV6_JOIN_GROUP IPV6_ADD_MEMBERSHIP
79#define IPV6_DROP_MEMBERSHIP 13
80#define IPV6_LEAVE_GROUP IPV6_DROP_MEMBERSHIP
81#define IPV6_DONTFRAG 14
82#define IPV6_PKTINFO 19
83#define IPV6_HOPLIMIT 21
84#define IPV6_PROTECTION_LEVEL 23
85#define IPV6_RECVIF 24
86#define IPV6_RECVDSTADDR 25
87#define IPV6_CHECKSUM 26
88#define IPV6_V6ONLY 27
89#define IPV6_IFLIST 28
90#define IPV6_ADD_IFLIST 29
91#define IPV6_DEL_IFLIST 30
92#define IPV6_UNICAST_IF 31
93#define IPV6_RTHDR 32
94#define IPV6_GET_IFLIST 33
95#define IPV6_RECVRTHDR 38
96#define IPV6_TCLASS 39
97#define IPV6_RECVTCLASS 40
98#define IPV6_ECN 50
99#define IPV6_PKTINFO_EX 51
100#define IPV6_WFP_REDIRECT_RECORDS 60
101#define IPV6_WFP_REDIRECT_CONTEXT 70
102#define IPV6_MTU_DISCOVER 71
103#define IPV6_MTU 72
104#define IPV6_NRT_INTERFACE 74
105#define IPV6_RECVERR 75
106#define IPV6_USER_MTU 76
107
108#define IP_UNSPECIFIED_HOP_LIMIT -1
109
110#define IP_PROTECTION_LEVEL IPV6_PROTECTION_LEVEL
111
112#define PROTECTION_LEVEL_UNRESTRICTED 10
113#define PROTECTION_LEVEL_EDGERESTRICTED 20
114#define PROTECTION_LEVEL_RESTRICTED 30
115
116#if NTDDI_VERSION < NTDDI_VISTA
117#define PROTECTION_LEVEL_DEFAULT PROTECTION_LEVEL_EDGERESTRICTED
118#else
119#define PROTECTION_LEVEL_DEFAULT ((UINT)-1)
120#endif
121
122typedef struct ipv6_mreq {
123 struct in6_addr ipv6mr_multiaddr;
124 unsigned int ipv6mr_interface;
125} IPV6_MREQ;
126
127struct sockaddr_in6_old {
128 short sin6_family;
129 u_short sin6_port;
130 u_long sin6_flowinfo;
131 struct in6_addr sin6_addr;
132};
133
134typedef union sockaddr_gen {
135 struct sockaddr Address;
136 struct sockaddr_in AddressIn;
137 struct sockaddr_in6_old AddressIn6;
138} sockaddr_gen;
139
140struct sockaddr_in6 {
141 short sin6_family;
142 u_short sin6_port;
143 u_long sin6_flowinfo;
144 struct in6_addr sin6_addr;
145 __C89_NAMELESS union {
146 u_long sin6_scope_id;
147 SCOPE_ID sin6_scope_struct;
148 };
149};
150
151typedef struct sockaddr_in6 SOCKADDR_IN6;
152typedef struct sockaddr_in6 *PSOCKADDR_IN6;
153typedef struct sockaddr_in6 *LPSOCKADDR_IN6;
154
155typedef struct _INTERFACE_INFO {
156 u_long iiFlags;
157 sockaddr_gen iiAddress;
158 sockaddr_gen iiBroadcastAddress;
159 sockaddr_gen iiNetmask;
160} INTERFACE_INFO,*LPINTERFACE_INFO;
161
162typedef struct _INTERFACE_INFO_EX {
163 u_long iiFlags;
164 SOCKET_ADDRESS iiAddress;
165 SOCKET_ADDRESS iiBroadcastAddress;
166 SOCKET_ADDRESS iiNetmask;
167} INTERFACE_INFO_EX, *LPINTERFACE_INFO_EX;
168
169#define IFF_UP 0x00000001
170#define IFF_BROADCAST 0x00000002
171#define IFF_LOOPBACK 0x00000004
172#define IFF_POINTTOPOINT 0x00000008
173#define IFF_MULTICAST 0x00000010
174
175typedef enum _PMTUD_STATE {
176 IP_PMTUDISC_NOT_SET,
177 IP_PMTUDISC_DO,
178 IP_PMTUDISC_DONT,
179 IP_PMTUDISC_PROBE,
180 IP_PMTUDISC_MAX
181} PMTUD_STATE, *PPMTUD_STATE;
182
183#define MCAST_JOIN_GROUP 41
184#define MCAST_LEAVE_GROUP 42
185#define MCAST_BLOCK_SOURCE 43
186#define MCAST_UNBLOCK_SOURCE 44
187#define MCAST_JOIN_SOURCE_GROUP 45
188#define MCAST_LEAVE_SOURCE_GROUP 46
189
190typedef enum _MULTICAST_MODE_TYPE {
191 MCAST_INCLUDE = 0,
192 MCAST_EXCLUDE
193} MULTICAST_MODE_TYPE;
194
195typedef struct ip_mreq_source {
196 IN_ADDR imr_multiaddr;
197 IN_ADDR imr_sourceaddr;
198 IN_ADDR imr_interface;
199} IP_MREQ_SOURCE, *PIP_MREQ_SOURCE;
200
201typedef struct ip_msfilter {
202 IN_ADDR imsf_multiaddr;
203 IN_ADDR imsf_interface;
204 MULTICAST_MODE_TYPE imsf_fmode;
205 ULONG imsf_numsrc;
206 IN_ADDR imsf_slist[1];
207} IP_MSFILTER, *PIP_MSFILTER;
208
209#define IP_MSFILTER_SIZE(NumSources) (sizeof(IP_MSFILTER) - sizeof(IN_ADDR) + (NumSources) * sizeof(IN_ADDR))
210
211typedef struct _sockaddr_in6_pair {
212 PSOCKADDR_IN6 SourceAddress;
213 PSOCKADDR_IN6 DestinationAddress;
214} SOCKADDR_IN6_PAIR, *PSOCKADDR_IN6_PAIR;
215
216typedef union _SOCKADDR_INET {
217 SOCKADDR_IN Ipv4;
218 SOCKADDR_IN6 Ipv6;
219 ADDRESS_FAMILY si_family;
220} SOCKADDR_INET, *PSOCKADDR_INET;
221
222typedef struct group_filter {
223 ULONG gf_interface;
224 SOCKADDR_STORAGE gf_group;
225 MULTICAST_MODE_TYPE gf_fmode;
226 ULONG gf_numsrc;
227 SOCKADDR_STORAGE gf_slist[1];
228} GROUP_FILTER, *PGROUP_FILTER;
229
230typedef struct group_req {
231 ULONG gr_interface;
232 SOCKADDR_STORAGE gr_group;
233} GROUP_REQ, *PGROUP_REQ;
234
235typedef struct group_source_req {
236 ULONG gsr_interface;
237 SOCKADDR_STORAGE gsr_group;
238 SOCKADDR_STORAGE gsr_source;
239} GROUP_SOURCE_REQ, *PGROUP_SOURCE_REQ;
240
241#define WS2TCPIP_INLINE __CRT_INLINE
242
243int IN6_ADDR_EQUAL(const struct in6_addr *,const struct in6_addr *);
244WS2TCPIP_INLINE int IN6_ADDR_EQUAL(const struct in6_addr *a, const struct in6_addr *b) {
245 return !memcmp(a, b, sizeof(struct in6_addr));
246}
247
248#define IN6_ARE_ADDR_EQUAL IN6_ADDR_EQUAL
249
250#ifdef __cplusplus
251}
252#endif
253
254#ifdef __LP64__
255#pragma pop_macro("u_long")
256#endif
257
258#endif /*_WS2IPDEF_ */
Note: See TracBrowser for help on using the repository browser.