include: Undefine the nameless union/struct macros to avoid conflicts with mingw.
[wine] / include / iptypes.h
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
25 #define MAX_ADAPTER_DESCRIPTION_LENGTH  128
26 #define MAX_ADAPTER_NAME_LENGTH         256
27 #define MAX_ADAPTER_ADDRESS_LENGTH      8
28 #define MAX_HOSTNAME_LEN                128
29 #define MAX_DOMAIN_NAME_LEN             128
30 #define MAX_SCOPE_ID_LEN                256
31 #define MAX_DHCPV6_DUID_LENGTH          130
32 #define MAX_DNS_SUFFIX_STRING_LENGTH    256
33
34 #define BROADCAST_NODETYPE              1
35 #define PEER_TO_PEER_NODETYPE           2
36 #define MIXED_NODETYPE                  4
37 #define HYBRID_NODETYPE                 8
38
39 typedef struct {
40     char String[4 * 4];
41 } IP_ADDRESS_STRING, *PIP_ADDRESS_STRING, IP_MASK_STRING, *PIP_MASK_STRING;
42
43 typedef struct _IP_ADDR_STRING {
44     struct _IP_ADDR_STRING* Next;
45     IP_ADDRESS_STRING IpAddress;
46     IP_MASK_STRING IpMask;
47     DWORD Context;
48 } IP_ADDR_STRING, *PIP_ADDR_STRING;
49
50 typedef struct _IP_ADAPTER_INFO {
51     struct _IP_ADAPTER_INFO* Next;
52     DWORD ComboIndex;
53     char AdapterName[MAX_ADAPTER_NAME_LENGTH + 4];
54     char Description[MAX_ADAPTER_DESCRIPTION_LENGTH + 4];
55     UINT AddressLength;
56     BYTE Address[MAX_ADAPTER_ADDRESS_LENGTH];
57     DWORD Index;
58     UINT Type;
59     UINT DhcpEnabled;
60     PIP_ADDR_STRING CurrentIpAddress;
61     IP_ADDR_STRING IpAddressList;
62     IP_ADDR_STRING GatewayList;
63     IP_ADDR_STRING DhcpServer;
64     BOOL HaveWins;
65     IP_ADDR_STRING PrimaryWinsServer;
66     IP_ADDR_STRING SecondaryWinsServer;
67     time_t LeaseObtained;
68     time_t LeaseExpires;
69 } IP_ADAPTER_INFO, *PIP_ADAPTER_INFO;
70
71 typedef struct _IP_PER_ADAPTER_INFO {
72     UINT AutoconfigEnabled;
73     UINT AutoconfigActive;
74     PIP_ADDR_STRING CurrentDnsServer;
75     IP_ADDR_STRING DnsServerList;
76 } IP_PER_ADAPTER_INFO, *PIP_PER_ADAPTER_INFO;
77
78 typedef struct {
79     char HostName[MAX_HOSTNAME_LEN + 4] ;
80     char DomainName[MAX_DOMAIN_NAME_LEN + 4];
81     PIP_ADDR_STRING CurrentDnsServer;
82     IP_ADDR_STRING DnsServerList;
83     UINT NodeType;
84     char ScopeId[MAX_SCOPE_ID_LEN + 4];
85     UINT EnableRouting;
86     UINT EnableProxy;
87     UINT EnableDns;
88 } FIXED_INFO, *PFIXED_INFO;
89
90 typedef enum {
91     IpPrefixOriginOther = 0,
92     IpPrefixOriginManual,
93     IpPrefixOriginWellKnown,
94     IpPrefixOriginDhcp,
95     IpPrefixOriginRouterAdvertisement,
96     IpPrefixOriginUnchanged = 16
97 } IP_PREFIX_ORIGIN;
98
99 typedef enum {
100     IpSuffixOriginOther = 0,
101     IpSuffixOriginManual,
102     IpSuffixOriginWellKnown,
103     IpSuffixOriginDhcp,
104     IpSuffixOriginLinkLayerAddress,
105     IpSuffixOriginRandom,
106     IpSuffixOriginUnchanged = 16
107 } IP_SUFFIX_ORIGIN;
108
109 typedef enum {
110     IpDadStateInvalid = 0,
111     IpDadStateTentative,
112     IpDadStateDuplicate,
113     IpDadStateDeprecated,
114     IpDadStatePreferred
115 } IP_DAD_STATE;
116
117 #ifdef _WINSOCK2API_
118
119 typedef struct _IP_ADAPTER_UNICAST_ADDRESS {
120     union {
121         struct {
122             ULONG Length;
123             DWORD Flags;
124         } DUMMYSTRUCTNAME;
125     } DUMMYUNIONNAME;
126     struct _IP_ADAPTER_UNICAST_ADDRESS *Next;
127     SOCKET_ADDRESS                      Address;
128     IP_PREFIX_ORIGIN                    PrefixOrigin;
129     IP_SUFFIX_ORIGIN                    SuffixOrigin;
130     IP_DAD_STATE                        DadState;
131     ULONG                               ValidLifetime;
132     ULONG                               PreferredLifetime;
133     ULONG                               LeaseLifetime;
134 } IP_ADAPTER_UNICAST_ADDRESS, *PIP_ADAPTER_UNICAST_ADDRESS;
135
136 typedef struct _IP_ADAPTER_ANYCAST_ADDRESS {
137     union {
138         ULONGLONG Alignment;
139         struct {
140             ULONG Length;
141             DWORD Flags;
142         } DUMMYSTRUCTNAME;
143     } DUMMYUNIONNAME;
144     struct _IP_ADAPTER_ANYCAST_ADDRESS *Next;
145     SOCKET_ADDRESS                      Address;
146 } IP_ADAPTER_ANYCAST_ADDRESS, *PIP_ADAPTER_ANYCAST_ADDRESS;
147
148 typedef struct _IP_ADAPTER_MULTICAST_ADDRESS {
149     union {
150         ULONGLONG Alignment;
151         struct {
152             ULONG Length;
153             DWORD Flags;
154         } DUMMYSTRUCTNAME;
155     } DUMMYUNIONNAME;
156     struct _IP_ADAPTER_MULTICAST_ADDRESS *Next;
157     SOCKET_ADDRESS                       Address;
158 } IP_ADAPTER_MULTICAST_ADDRESS, *PIP_ADAPTER_MULTICAST_ADDRESS;
159
160 typedef struct _IP_ADAPTER_DNS_SERVER_ADDRESS {
161     union {
162         ULONGLONG Alignment;
163         struct {
164             ULONG Length;
165             DWORD Reserved;
166         } DUMMYSTRUCTNAME;
167     } DUMMYUNIONNAME;
168     struct _IP_ADAPTER_DNS_SERVER_ADDRESS *Next;
169     SOCKET_ADDRESS                         Address;
170 } IP_ADAPTER_DNS_SERVER_ADDRESS, *PIP_ADAPTER_DNS_SERVER_ADDRESS;
171
172 typedef struct _IP_ADAPTER_PREFIX {
173     union {
174         ULONGLONG Alignment;
175         struct {
176             ULONG Length;
177             DWORD Flags;
178         } DUMMYSTRUCTNAME;
179     } DUMMYUNIONNAME;
180     struct _IP_ADAPTER_PREFIX *Next;
181     SOCKET_ADDRESS             Address;
182     ULONG                      PrefixLength;
183 } IP_ADAPTER_PREFIX, *PIP_ADAPTER_PREFIX;
184
185 typedef struct _IP_ADAPTER_WINS_SERVER_ADDRESS_LH {
186     union {
187         ULONGLONG Alignment;
188         struct {
189             ULONG Length;
190             DWORD Reserved;
191         } DUMMYSTRUCTNAME;
192     } DUMMYUNIONNAME;
193     struct _IP_ADAPTER_WINS_SERVER_ADDRESS_LH *Next;
194     SOCKET_ADDRESS Address;
195 } IP_ADAPTER_WINS_SERVER_ADDRESS_LH, *PIP_ADAPTER_WINS_SERVER_ADDRESS_LH;
196 typedef IP_ADAPTER_WINS_SERVER_ADDRESS_LH IP_ADAPTER_WINS_SERVER_ADDRESS;
197 typedef IP_ADAPTER_WINS_SERVER_ADDRESS_LH *PIP_ADAPTER_WINS_SERVER_ADDRESS;
198
199 typedef struct _IP_ADAPTER_GATEWAY_ADDRESS_LH {
200     union {
201         ULONGLONG Alignment;
202         struct {
203             ULONG Length;
204             DWORD Reserved;
205         } DUMMYSTRUCTNAME;
206     } DUMMYUNIONNAME;
207     struct _IP_ADAPTER_GATEWAY_ADDRESS_LH *Next;
208     SOCKET_ADDRESS Address;
209 } IP_ADAPTER_GATEWAY_ADDRESS_LH, *PIP_ADAPTER_GATEWAY_ADDRESS_LH;
210 typedef IP_ADAPTER_GATEWAY_ADDRESS_LH IP_ADAPTER_GATEWAY_ADDRESS;
211 typedef IP_ADAPTER_GATEWAY_ADDRESS_LH *PIP_ADAPTER_GATEWAY_ADDRESS;
212
213 #define IP_ADAPTER_DDNS_ENABLED               0x1
214 #define IP_ADAPTER_REGISTER_ADAPTER_SUFFIX    0x2
215 #define IP_ADAPTER_DHCP_ENABLED               0x4
216 #define IP_ADAPTER_RECEIVE_ONLY               0x8
217 #define IP_ADAPTER_NO_MULTICAST               0x10
218 #define IP_ADAPTER_IPV6_OTHER_STATEFUL_CONFIG 0x20
219 #define IP_ADAPTER_NETBIOS_OVER_TCPIP_ENABLED 0x40
220 #define IP_ADAPTER_IPV4_ENABLED               0x80
221 #define IP_ADAPTER_IPV6_ENABLED               0x100
222 #define IP_ADAPTER_IPV6_MANAGE_ADDRESS_CONFIG 0x200
223
224 typedef struct _IP_ADAPTER_ADDRESSES {
225     union {
226         ULONGLONG Alignment;
227         struct {
228             ULONG Length;
229             DWORD IfIndex;
230         } DUMMYSTRUCTNAME;
231     } DUMMYUNIONNAME;
232     struct _IP_ADAPTER_ADDRESSES   *Next;
233     PCHAR                           AdapterName;
234     PIP_ADAPTER_UNICAST_ADDRESS     FirstUnicastAddress;
235     PIP_ADAPTER_ANYCAST_ADDRESS     FirstAnycastAddress;
236     PIP_ADAPTER_MULTICAST_ADDRESS   FirstMulticastAddress;
237     PIP_ADAPTER_DNS_SERVER_ADDRESS  FirstDnsServerAddress;
238     PWCHAR                          DnsSuffix;
239     PWCHAR                          Description;
240     PWCHAR                          FriendlyName;
241     BYTE                            PhysicalAddress[MAX_ADAPTER_ADDRESS_LENGTH];
242     DWORD                           PhysicalAddressLength;
243     DWORD                           Flags;
244     DWORD                           Mtu;
245     DWORD                           IfType;
246     IF_OPER_STATUS                  OperStatus;
247     DWORD                           Ipv6IfIndex;
248     DWORD                           ZoneIndices[16];
249     PIP_ADAPTER_PREFIX              FirstPrefix;
250     ULONG64                         TransmitLinkSpeed;
251     ULONG64                         ReceiveLinkSpeed;
252     PIP_ADAPTER_WINS_SERVER_ADDRESS_LH FirstWinsServerAddress;
253     PIP_ADAPTER_GATEWAY_ADDRESS_LH  FirstGatewayAddress;
254     ULONG                           Ipv4Metric;
255     ULONG                           Ipv6Metric;
256     IF_LUID                         Luid;
257     SOCKET_ADDRESS                  Dhcpv4Server;
258     NET_IF_COMPARTMENT_ID           CompartmentId;
259     NET_IF_NETWORK_GUID             NetworkGuid;
260     NET_IF_CONNECTION_TYPE          ConnectionType;
261     TUNNEL_TYPE                     TunnelType;
262     SOCKET_ADDRESS                  Dhcpv6Server;
263     BYTE                            Dhcpv6ClientDuid[MAX_DHCPV6_DUID_LENGTH];
264     ULONG                           Dhcpv6ClientDuidLength;
265     ULONG                           Dhcpv6Iaid;
266 } IP_ADAPTER_ADDRESSES, *PIP_ADAPTER_ADDRESSES;
267
268 #define GAA_FLAG_SKIP_UNICAST                0x00000001
269 #define GAA_FLAG_SKIP_ANYCAST                0x00000002
270 #define GAA_FLAG_SKIP_MULTICAST              0x00000004
271 #define GAA_FLAG_SKIP_DNS_SERVER             0x00000008
272 #define GAA_FLAG_INCLUDE_PREFIX              0x00000010
273 #define GAA_FLAG_SKIP_FRIENDLY_NAME          0x00000020
274 #define GAA_FLAG_INCLUDE_WINS_INFO           0x00000040
275 #define GAA_FLAG_INCLUDE_ALL_GATEWAYS        0x00000080
276 #define GAA_FLAG_INCLUDE_ALL_INTERFACES      0x00000100
277 #define GAA_FLAG_INCLUDE_ALL_COMPARTMENTS    0x00000200
278 #define GAA_FLAG_INCLUDE_TUNNEL_BINDINGORDER 0x00000400
279
280 #endif /* _WINSOCK2API_ */
281
282 #endif /* WINE_IPTYPES_H_*/