xref: /reactos/sdk/include/psdk/iptypes.h (revision 9476baf6)
1 /* WINE iptypes.h
2  * Copyright (C) 2003 Juan Lang
3  *
4  * This library is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Lesser General Public
6  * License as published by the Free Software Foundation; either
7  * version 2.1 of the License, or (at your option) any later version.
8  *
9  * This library is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12  * Lesser General Public License for more details.
13  *
14  * You should have received a copy of the GNU Lesser General Public
15  * License along with this library; if not, write to the Free Software
16  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
17  */
18 
19 #ifndef WINE_IPTYPES_H_
20 #define WINE_IPTYPES_H_
21 
22 #include <time.h>
23 #include <ifdef.h>
24 #include <nldef.h>
25 
26 #define MAX_ADAPTER_DESCRIPTION_LENGTH  128
27 #define MAX_ADAPTER_NAME_LENGTH         256
28 #define MAX_ADAPTER_ADDRESS_LENGTH      8
29 #define DEFAULT_MINIMUM_ENTITIES        32
30 #define MAX_HOSTNAME_LEN                128
31 #define MAX_DOMAIN_NAME_LEN             128
32 #define MAX_SCOPE_ID_LEN                256
33 #define MAX_DHCPV6_DUID_LENGTH          130
34 #define MAX_DNS_SUFFIX_STRING_LENGTH    256
35 
36 #define BROADCAST_NODETYPE              1
37 #define PEER_TO_PEER_NODETYPE           2
38 #define MIXED_NODETYPE                  4
39 #define HYBRID_NODETYPE                 8
40 
41 typedef struct {
42     char String[4 * 4];
43 } IP_ADDRESS_STRING, *PIP_ADDRESS_STRING, IP_MASK_STRING, *PIP_MASK_STRING;
44 
45 typedef struct _IP_ADDR_STRING {
46     struct _IP_ADDR_STRING* Next;
47     IP_ADDRESS_STRING IpAddress;
48     IP_MASK_STRING IpMask;
49     DWORD Context;
50 } IP_ADDR_STRING, *PIP_ADDR_STRING;
51 
52 typedef struct _IP_ADAPTER_INFO {
53     struct _IP_ADAPTER_INFO* Next;
54     DWORD ComboIndex;
55     char AdapterName[MAX_ADAPTER_NAME_LENGTH + 4];
56     char Description[MAX_ADAPTER_DESCRIPTION_LENGTH + 4];
57     UINT AddressLength;
58     BYTE Address[MAX_ADAPTER_ADDRESS_LENGTH];
59     DWORD Index;
60     UINT Type;
61     UINT DhcpEnabled;
62     PIP_ADDR_STRING CurrentIpAddress;
63     IP_ADDR_STRING IpAddressList;
64     IP_ADDR_STRING GatewayList;
65     IP_ADDR_STRING DhcpServer;
66     BOOL HaveWins;
67     IP_ADDR_STRING PrimaryWinsServer;
68     IP_ADDR_STRING SecondaryWinsServer;
69     time_t LeaseObtained;
70     time_t LeaseExpires;
71 } IP_ADAPTER_INFO, *PIP_ADAPTER_INFO;
72 
73 typedef struct _IP_PER_ADAPTER_INFO {
74     UINT AutoconfigEnabled;
75     UINT AutoconfigActive;
76     PIP_ADDR_STRING CurrentDnsServer;
77     IP_ADDR_STRING DnsServerList;
78 } IP_PER_ADAPTER_INFO, *PIP_PER_ADAPTER_INFO;
79 
80 typedef struct {
81     char HostName[MAX_HOSTNAME_LEN + 4] ;
82     char DomainName[MAX_DOMAIN_NAME_LEN + 4];
83     PIP_ADDR_STRING CurrentDnsServer;
84     IP_ADDR_STRING DnsServerList;
85     UINT NodeType;
86     char ScopeId[MAX_SCOPE_ID_LEN + 4];
87     UINT EnableRouting;
88     UINT EnableProxy;
89     UINT EnableDns;
90 } FIXED_INFO, *PFIXED_INFO;
91 
92 typedef NL_PREFIX_ORIGIN IP_PREFIX_ORIGIN;
93 typedef NL_SUFFIX_ORIGIN IP_SUFFIX_ORIGIN;
94 typedef NL_DAD_STATE IP_DAD_STATE;
95 
96 /* ReactOS */
97 #if (NTDDI_VERSION >= NTDDI_WIN2KSP1)
98 typedef struct _IP_INTERFACE_NAME_INFO {
99     ULONG Index;
100     ULONG MediaType;
101     UCHAR ConnectionType;
102     UCHAR AccessType;
103     GUID DeviceGuid;
104     GUID InterfaceGuid;
105 } IP_INTERFACE_NAME_INFO, *PIP_INTERFACE_NAME_INFO;
106 #endif
107 
108 #ifdef _WINSOCK2API_
109 
110 typedef struct _IP_ADAPTER_UNICAST_ADDRESS {
111     union {
112         struct {
113             ULONG Length;
114             DWORD Flags;
115         } DUMMYSTRUCTNAME;
116     } DUMMYUNIONNAME;
117     struct _IP_ADAPTER_UNICAST_ADDRESS *Next;
118     SOCKET_ADDRESS                      Address;
119     IP_PREFIX_ORIGIN                    PrefixOrigin;
120     IP_SUFFIX_ORIGIN                    SuffixOrigin;
121     IP_DAD_STATE                        DadState;
122     ULONG                               ValidLifetime;
123     ULONG                               PreferredLifetime;
124     ULONG                               LeaseLifetime;
125 } IP_ADAPTER_UNICAST_ADDRESS, *PIP_ADAPTER_UNICAST_ADDRESS;
126 
127 typedef struct _IP_ADAPTER_ANYCAST_ADDRESS {
128     union {
129         ULONGLONG Alignment;
130         struct {
131             ULONG Length;
132             DWORD Flags;
133         } DUMMYSTRUCTNAME;
134     } DUMMYUNIONNAME;
135     struct _IP_ADAPTER_ANYCAST_ADDRESS *Next;
136     SOCKET_ADDRESS                      Address;
137 } IP_ADAPTER_ANYCAST_ADDRESS, *PIP_ADAPTER_ANYCAST_ADDRESS;
138 
139 typedef struct _IP_ADAPTER_MULTICAST_ADDRESS {
140     union {
141         ULONGLONG Alignment;
142         struct {
143             ULONG Length;
144             DWORD Flags;
145         } DUMMYSTRUCTNAME;
146     } DUMMYUNIONNAME;
147     struct _IP_ADAPTER_MULTICAST_ADDRESS *Next;
148     SOCKET_ADDRESS                       Address;
149 } IP_ADAPTER_MULTICAST_ADDRESS, *PIP_ADAPTER_MULTICAST_ADDRESS;
150 
151 typedef struct _IP_ADAPTER_DNS_SERVER_ADDRESS {
152     union {
153         ULONGLONG Alignment;
154         struct {
155             ULONG Length;
156             DWORD Reserved;
157         } DUMMYSTRUCTNAME;
158     } DUMMYUNIONNAME;
159     struct _IP_ADAPTER_DNS_SERVER_ADDRESS *Next;
160     SOCKET_ADDRESS                         Address;
161 } IP_ADAPTER_DNS_SERVER_ADDRESS, *PIP_ADAPTER_DNS_SERVER_ADDRESS;
162 
163 typedef struct _IP_ADAPTER_PREFIX {
164     union {
165         ULONGLONG Alignment;
166         struct {
167             ULONG Length;
168             DWORD Flags;
169         } DUMMYSTRUCTNAME;
170     } DUMMYUNIONNAME;
171     struct _IP_ADAPTER_PREFIX *Next;
172     SOCKET_ADDRESS             Address;
173     ULONG                      PrefixLength;
174 } IP_ADAPTER_PREFIX, *PIP_ADAPTER_PREFIX;
175 
176 typedef struct _IP_ADAPTER_WINS_SERVER_ADDRESS_LH {
177     union {
178         ULONGLONG Alignment;
179         struct {
180             ULONG Length;
181             DWORD Reserved;
182         } DUMMYSTRUCTNAME;
183     } DUMMYUNIONNAME;
184     struct _IP_ADAPTER_WINS_SERVER_ADDRESS_LH *Next;
185     SOCKET_ADDRESS Address;
186 } IP_ADAPTER_WINS_SERVER_ADDRESS_LH, *PIP_ADAPTER_WINS_SERVER_ADDRESS_LH;
187 typedef IP_ADAPTER_WINS_SERVER_ADDRESS_LH IP_ADAPTER_WINS_SERVER_ADDRESS;
188 typedef IP_ADAPTER_WINS_SERVER_ADDRESS_LH *PIP_ADAPTER_WINS_SERVER_ADDRESS;
189 
190 typedef struct _IP_ADAPTER_GATEWAY_ADDRESS_LH {
191     union {
192         ULONGLONG Alignment;
193         struct {
194             ULONG Length;
195             DWORD Reserved;
196         } DUMMYSTRUCTNAME;
197     } DUMMYUNIONNAME;
198     struct _IP_ADAPTER_GATEWAY_ADDRESS_LH *Next;
199     SOCKET_ADDRESS Address;
200 } IP_ADAPTER_GATEWAY_ADDRESS_LH, *PIP_ADAPTER_GATEWAY_ADDRESS_LH;
201 typedef IP_ADAPTER_GATEWAY_ADDRESS_LH IP_ADAPTER_GATEWAY_ADDRESS;
202 typedef IP_ADAPTER_GATEWAY_ADDRESS_LH *PIP_ADAPTER_GATEWAY_ADDRESS;
203 
204 typedef struct _IP_ADAPTER_DNS_SUFFIX {
205     struct _IP_ADAPTER_DNS_SUFFIX *Next;
206     WCHAR String[MAX_DNS_SUFFIX_STRING_LENGTH];
207 } IP_ADAPTER_DNS_SUFFIX, *PIP_ADAPTER_DNS_SUFFIX;
208 
209 #define IP_ADAPTER_DDNS_ENABLED               0x1
210 #define IP_ADAPTER_REGISTER_ADAPTER_SUFFIX    0x2
211 #define IP_ADAPTER_DHCP_ENABLED               0x4
212 #define IP_ADAPTER_RECEIVE_ONLY               0x8
213 #define IP_ADAPTER_NO_MULTICAST               0x10
214 #define IP_ADAPTER_IPV6_OTHER_STATEFUL_CONFIG 0x20
215 #define IP_ADAPTER_NETBIOS_OVER_TCPIP_ENABLED 0x40
216 #define IP_ADAPTER_IPV4_ENABLED               0x80
217 #define IP_ADAPTER_IPV6_ENABLED               0x100
218 #define IP_ADAPTER_IPV6_MANAGE_ADDRESS_CONFIG 0x200
219 
220 typedef struct _IP_ADAPTER_ADDRESSES_LH {
221     union {
222         ULONGLONG Alignment;
223         struct {
224             ULONG Length;
225             DWORD IfIndex;
226         } DUMMYSTRUCTNAME;
227     } DUMMYUNIONNAME;
228     struct _IP_ADAPTER_ADDRESSES_LH *Next;
229     PCHAR                           AdapterName;
230     PIP_ADAPTER_UNICAST_ADDRESS     FirstUnicastAddress;
231     PIP_ADAPTER_ANYCAST_ADDRESS     FirstAnycastAddress;
232     PIP_ADAPTER_MULTICAST_ADDRESS   FirstMulticastAddress;
233     PIP_ADAPTER_DNS_SERVER_ADDRESS  FirstDnsServerAddress;
234     PWCHAR                          DnsSuffix;
235     PWCHAR                          Description;
236     PWCHAR                          FriendlyName;
237     BYTE                            PhysicalAddress[MAX_ADAPTER_ADDRESS_LENGTH];
238     DWORD                           PhysicalAddressLength;
239     union {
240         DWORD                       Flags;
241         struct {
242             DWORD                   DdnsEnabled : 1;
243             DWORD                   RegisterAdapterSuffix : 1;
244             DWORD                   Dhcpv4Enabled : 1;
245             DWORD                   ReceiveOnly : 1;
246             DWORD                   NoMulticast : 1;
247             DWORD                   Ipv6OtherStatefulConfig : 1;
248             DWORD                   NetbiosOverTcpipEnabled : 1;
249             DWORD                   Ipv4Enabled : 1;
250             DWORD                   Ipv6Enabled : 1;
251             DWORD                   Ipv6ManagedAddressConfigurationSupported : 1;
252         } DUMMYSTRUCTNAME1;
253     } DUMMYUNIONNAME1;
254     DWORD                           Mtu;
255     DWORD                           IfType;
256     IF_OPER_STATUS                  OperStatus;
257     DWORD                           Ipv6IfIndex;
258     DWORD                           ZoneIndices[16];
259     PIP_ADAPTER_PREFIX              FirstPrefix;
260     ULONG64                         TransmitLinkSpeed;
261     ULONG64                         ReceiveLinkSpeed;
262     PIP_ADAPTER_WINS_SERVER_ADDRESS_LH FirstWinsServerAddress;
263     PIP_ADAPTER_GATEWAY_ADDRESS_LH  FirstGatewayAddress;
264     ULONG                           Ipv4Metric;
265     ULONG                           Ipv6Metric;
266     IF_LUID                         Luid;
267     SOCKET_ADDRESS                  Dhcpv4Server;
268     NET_IF_COMPARTMENT_ID           CompartmentId;
269     NET_IF_NETWORK_GUID             NetworkGuid;
270     NET_IF_CONNECTION_TYPE          ConnectionType;
271     TUNNEL_TYPE                     TunnelType;
272     SOCKET_ADDRESS                  Dhcpv6Server;
273     BYTE                            Dhcpv6ClientDuid[MAX_DHCPV6_DUID_LENGTH];
274     ULONG                           Dhcpv6ClientDuidLength;
275     ULONG                           Dhcpv6Iaid;
276     PIP_ADAPTER_DNS_SUFFIX          FirstDnsSuffix;
277 } IP_ADAPTER_ADDRESSES_LH, *PIP_ADAPTER_ADDRESSES_LH;
278 
279 typedef struct _IP_ADAPTER_ADDRESSES_XP {
280     union {
281         ULONGLONG Alignment;
282         struct {
283             ULONG Length;
284             DWORD IfIndex;
285         } DUMMYSTRUCTNAME;
286     } DUMMYUNIONNAME;
287     struct _IP_ADAPTER_ADDRESSES_XP *Next;
288     PCHAR                           AdapterName;
289     PIP_ADAPTER_UNICAST_ADDRESS     FirstUnicastAddress;
290     PIP_ADAPTER_ANYCAST_ADDRESS     FirstAnycastAddress;
291     PIP_ADAPTER_MULTICAST_ADDRESS   FirstMulticastAddress;
292     PIP_ADAPTER_DNS_SERVER_ADDRESS  FirstDnsServerAddress;
293     PWCHAR                          DnsSuffix;
294     PWCHAR                          Description;
295     PWCHAR                          FriendlyName;
296     BYTE                            PhysicalAddress[MAX_ADAPTER_ADDRESS_LENGTH];
297     DWORD                           PhysicalAddressLength;
298     DWORD                           Flags;
299     DWORD                           Mtu;
300     DWORD                           IfType;
301     IF_OPER_STATUS                  OperStatus;
302     DWORD                           Ipv6IfIndex;
303     DWORD                           ZoneIndices[16];
304     PIP_ADAPTER_PREFIX              FirstPrefix;
305 } IP_ADAPTER_ADDRESSES_XP, *PIP_ADAPTER_ADDRESSES_XP;
306 
307 /* ReactOS */
308 #if (NTDDI_VERSION >= NTDDI_VISTA)
309 typedef IP_ADAPTER_ADDRESSES_LH IP_ADAPTER_ADDRESSES;
310 typedef IP_ADAPTER_ADDRESSES_LH *PIP_ADAPTER_ADDRESSES;
311 #else
312 typedef IP_ADAPTER_ADDRESSES_XP IP_ADAPTER_ADDRESSES;
313 typedef IP_ADAPTER_ADDRESSES_XP *PIP_ADAPTER_ADDRESSES;
314 #endif
315 
316 #define GAA_FLAG_SKIP_UNICAST                0x00000001
317 #define GAA_FLAG_SKIP_ANYCAST                0x00000002
318 #define GAA_FLAG_SKIP_MULTICAST              0x00000004
319 #define GAA_FLAG_SKIP_DNS_SERVER             0x00000008
320 #define GAA_FLAG_INCLUDE_PREFIX              0x00000010
321 #define GAA_FLAG_SKIP_FRIENDLY_NAME          0x00000020
322 #define GAA_FLAG_INCLUDE_WINS_INFO           0x00000040
323 #define GAA_FLAG_INCLUDE_ALL_GATEWAYS        0x00000080
324 #define GAA_FLAG_INCLUDE_ALL_INTERFACES      0x00000100
325 #define GAA_FLAG_INCLUDE_ALL_COMPARTMENTS    0x00000200
326 #define GAA_FLAG_INCLUDE_TUNNEL_BINDINGORDER 0x00000400
327 
328 #endif /* _WINSOCK2API_ */
329 
330 #endif /* WINE_IPTYPES_H_*/
331