advapi32: ConvertStringSecurityDescriptorToSecurityDescriptor - more tests (pass).
[wine] / include / ws2tcpip.h
1 /*
2  * Copyright (C) 2001 Francois Gouget
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 __WS2TCPIP__
20 #define __WS2TCPIP__
21
22 #include <winsock2.h>
23 /* FIXME: #include <ws2ipdef.h> */
24 #include <limits.h>
25
26 #ifdef USE_WS_PREFIX
27 #define WS(x)    WS_##x
28 #else
29 #define WS(x)    x
30 #endif
31
32 /* FIXME: This gets defined by some Unix (Linux) header and messes things */
33 #undef s6_addr
34
35 /* for addrinfo calls */
36 typedef struct WS(addrinfo)
37 {
38     int                ai_flags;
39     int                ai_family;
40     int                ai_socktype;
41     int                ai_protocol;
42     size_t             ai_addrlen;
43     char *             ai_canonname;
44     struct WS(sockaddr)*   ai_addr;
45     struct WS(addrinfo)*   ai_next;
46 } ADDRINFOA, *PADDRINFOA;
47
48 typedef struct WS(addrinfoW)
49 {
50     int                ai_flags;
51     int                ai_family;
52     int                ai_socktype;
53     int                ai_protocol;
54     size_t             ai_addrlen;
55     PWSTR              ai_canonname;
56     struct WS(sockaddr)*   ai_addr;
57     struct WS(addrinfoW)*   ai_next;
58 } ADDRINFOW, *PADDRINFOW;
59
60 typedef int WS(socklen_t);
61
62 typedef ADDRINFOA ADDRINFO, *LPADDRINFO;
63
64 /*
65  * Multicast group information
66  */
67
68 struct WS(ip_mreq)
69 {
70     struct WS(in_addr) imr_multiaddr;
71     struct WS(in_addr) imr_interface;
72 };
73
74 struct WS(ip_mreq_source) {
75     struct WS(in_addr) imr_multiaddr;
76     struct WS(in_addr) imr_sourceaddr;
77     struct WS(in_addr) imr_interface;
78 };
79
80 struct WS(ip_msfilter) {
81     struct WS(in_addr) imsf_multiaddr;
82     struct WS(in_addr) imsf_interface;
83     WS(u_long)         imsf_fmode;
84     WS(u_long)         imsf_numsrc;
85     struct WS(in_addr) imsf_slist[1];
86 };
87
88 typedef struct WS(in_addr6)
89 {
90    WS(u_char) s6_addr[16]; /* IPv6 address */
91 } IN6_ADDR, *PIN6_ADDR, *LPIN6_ADDR;
92
93 typedef struct WS(sockaddr_in6)
94 {
95    short   sin6_family;            /* AF_INET6 */
96    WS(u_short) sin6_port;          /* Transport level port number */
97    WS(u_long) sin6_flowinfo;       /* IPv6 flow information */
98    struct  WS(in_addr6) sin6_addr; /* IPv6 address */
99    WS(u_long) sin6_scope_id;       /* IPv6 scope id */
100 } SOCKADDR_IN6,*PSOCKADDR_IN6, *LPSOCKADDR_IN6;
101
102 typedef struct WS(sockaddr_in6_old)
103 {
104    short   sin6_family;            /* AF_INET6 */
105    WS(u_short) sin6_port;              /* Transport level port number */
106    WS(u_long) sin6_flowinfo;          /* IPv6 flow information */
107    struct  WS(in_addr6) sin6_addr; /* IPv6 address */
108 } SOCKADDR_IN6_OLD,*PSOCKADDR_IN6_OLD, *LPSOCKADDR_IN6_OLD;
109
110 typedef union sockaddr_gen
111 {
112    struct WS(sockaddr) Address;
113    struct WS(sockaddr_in)  AddressIn;
114    struct WS(sockaddr_in6_old) AddressIn6;
115 } WS(sockaddr_gen);
116
117 /* Structure to keep interface specific information */
118 typedef struct _INTERFACE_INFO
119 {
120     WS(u_long)        iiFlags;             /* Interface flags */
121     WS(sockaddr_gen)  iiAddress;           /* Interface address */
122     WS(sockaddr_gen)  iiBroadcastAddress;  /* Broadcast address */
123     WS(sockaddr_gen)  iiNetmask;           /* Network mask */
124 } INTERFACE_INFO, * LPINTERFACE_INFO;
125
126 /* Possible flags for the  iiFlags - bitmask  */
127 #ifndef USE_WS_PREFIX
128 #define IFF_UP                0x00000001 /* Interface is up */
129 #define IFF_BROADCAST         0x00000002 /* Broadcast is  supported */
130 #define IFF_LOOPBACK          0x00000004 /* this is loopback interface */
131 #define IFF_POINTTOPOINT      0x00000008 /* this is point-to-point interface */
132 #define IFF_MULTICAST         0x00000010 /* multicast is supported */
133 #else
134 #define WS_IFF_UP             0x00000001 /* Interface is up */
135 #define WS_IFF_BROADCAST      0x00000002 /* Broadcast is  supported */
136 #define WS_IFF_LOOPBACK       0x00000004 /* this is loopback interface */
137 #define WS_IFF_POINTTOPOINT   0x00000008 /* this is point-to-point interface */
138 #define WS_IFF_MULTICAST      0x00000010 /* multicast is supported */
139 #endif /* USE_WS_PREFIX */
140
141 #ifndef USE_WS_PREFIX
142 #define IP_OPTIONS                      1
143 #define IP_HDRINCL                      2
144 #define IP_TOS                          3
145 #define IP_TTL                          4
146 #define IP_MULTICAST_IF                 9
147 #define IP_MULTICAST_TTL                10
148 #define IP_MULTICAST_LOOP               11
149 #define IP_ADD_MEMBERSHIP               12
150 #define IP_DROP_MEMBERSHIP              13
151 #define IP_DONTFRAGMENT                 14
152 #define IP_ADD_SOURCE_MEMBERSHIP        15
153 #define IP_DROP_SOURCE_MEMBERSHIP       16
154 #define IP_BLOCK_SOURCE                 17
155 #define IP_UNBLOCK_SOURCE               18
156 #define IP_PKTINFO                      19
157 #define IP_RECEIVE_BROADCAST            22
158 #else
159 #define WS_IP_OPTIONS                   1
160 #define WS_IP_HDRINCL                   2
161 #define WS_IP_TOS                       3
162 #define WS_IP_TTL                       4
163 #define WS_IP_MULTICAST_IF              9
164 #define WS_IP_MULTICAST_TTL             10
165 #define WS_IP_MULTICAST_LOOP            11
166 #define WS_IP_ADD_MEMBERSHIP            12
167 #define WS_IP_DROP_MEMBERSHIP           13
168 #define WS_IP_DONTFRAGMENT              14
169 #define WS_IP_ADD_SOURCE_MEMBERSHIP     15
170 #define WS_IP_DROP_SOURCE_MEMBERSHIP    16
171 #define WS_IP_BLOCK_SOURCE              17
172 #define WS_IP_UNBLOCK_SOURCE            18
173 #define WS_IP_PKTINFO                   19
174 #define WS_IP_RECEIVE_BROADCAST         22
175 #endif /* USE_WS_PREFIX */
176
177 /* Possible Windows flags for getaddrinfo() */
178 #ifndef USE_WS_PREFIX
179 # define AI_PASSIVE     0x0001
180 # define AI_CANONNAME   0x0002
181 # define AI_NUMERICHOST 0x0004
182 /* getaddrinfo error codes */
183 # define EAI_AGAIN      WSATRY_AGAIN
184 # define EAI_BADFLAGS   WSAEINVAL
185 # define EAI_FAIL       WSANO_RECOVERY
186 # define EAI_FAMILY     WSAEAFNOSUPPORT
187 # define EAI_MEMORY     WSA_NOT_ENOUGH_MEMORY
188 # define EAI_NODATA     EAI_NONAME
189 # define EAI_NONAME     WSAHOST_NOT_FOUND
190 # define EAI_SERVICE    WSATYPE_NOT_FOUND
191 # define EAI_SOCKTYPE   WSAESOCKTNOSUPPORT
192 #else
193 # define WS_AI_PASSIVE     0x0001
194 # define WS_AI_CANONNAME   0x0002
195 # define WS_AI_NUMERICHOST 0x0004
196 /* getaddrinfo error codes */
197 # define WS_EAI_AGAIN   WSATRY_AGAIN
198 # define WS_EAI_BADFLAGS        WSAEINVAL
199 # define WS_EAI_FAIL    WSANO_RECOVERY
200 # define WS_EAI_FAMILY  WSAEAFNOSUPPORT
201 # define WS_EAI_MEMORY  WSA_NOT_ENOUGH_MEMORY
202 # define WS_EAI_NODATA  WS_EAI_NONAME
203 # define WS_EAI_NONAME  WSAHOST_NOT_FOUND
204 # define WS_EAI_SERVICE WSATYPE_NOT_FOUND
205 # define WS_EAI_SOCKTYPE        WSAESOCKTNOSUPPORT
206 #endif
207
208 /* Possible Windows flags for getnameinfo() */
209 #ifndef USE_WS_PREFIX
210 # define NI_NOFQDN          0x01
211 # define NI_NUMERICHOST     0x02
212 # define NI_NAMEREQD        0x04
213 # define NI_NUMERICSERV     0x08
214 # define NI_DGRAM           0x10
215 #else
216 # define WS_NI_NOFQDN       0x01
217 # define WS_NI_NUMERICHOST  0x02
218 # define WS_NI_NAMEREQD     0x04
219 # define WS_NI_NUMERICSERV  0x08
220 # define WS_NI_DGRAM        0x10
221 #endif
222
223
224 #ifdef __cplusplus
225 extern "C" {
226 #endif
227
228 void WINAPI WS(freeaddrinfo)(LPADDRINFO);
229 #define     FreeAddrInfoA WS(freeaddrinfo)
230 void WINAPI FreeAddrInfoW(PADDRINFOW);
231 #define     FreeAddrInfo WINELIB_NAME_AW(FreeAddrInfo)
232 int WINAPI  WS(getaddrinfo)(const char*,const char*,const struct WS(addrinfo)*,struct WS(addrinfo)**);
233 #define     GetAddrInfoA WS(getaddrinfo)
234 int WINAPI  GetAddrInfoW(PCWSTR,PCWSTR,const ADDRINFOW*,PADDRINFOW*);
235 #define     GetAddrInfo WINELIB_NAME_AW(GetAddrInfo)
236 int WINAPI  WS(getnameinfo)(const SOCKADDR*,WS(socklen_t),PCHAR,DWORD,PCHAR,DWORD,INT);
237 #define     GetNameInfoA WS(getnameinfo)
238 INT WINAPI  GetNameInfoW(const SOCKADDR*,WS(socklen_t),PWCHAR,DWORD,PWCHAR,DWORD,INT);
239 #define     GetNameInfo WINELIB_NAME_AW(GetNameInfo)
240
241 /*
242  * Ws2tcpip Function Typedefs
243  *
244  * Remember to keep this section in sync with the
245  * prototypes above.
246  */
247 #if INCL_WINSOCK_API_TYPEDEFS
248
249 typedef void (WINAPI *LPFN_FREEADDRINFO)(LPADDRINFO);
250 #define LPFN_FREEADDRINFOA LPFN_FREEADDRINFO
251 typedef void (WINAPI *LPFN_FREEADDRINFOW)(PADDRINFOW);
252 #define LPFN_FREEADDRINFOT WINELIB_NAME_AW(LPFN_FREEADDRINFO)
253 typedef int (WINAPI *LPFN_GETADDRINFO)(const char*,const char*,const struct WS(addrinfo)*,struct WS(addrinfo)**);
254 #define LPFN_GETADDRINFOA LPFN_GETADDRINFO
255 typedef int (WINAPI *LPFN_GETADDRINFOW)(PCWSTR,PCWSTR,const ADDRINFOW*,PADDRINFOW*);
256 #define LPFN_GETADDRINFOT WINELIB_NAME_AW(LPFN_GETADDRINFO)
257 typedef int (WINAPI *LPFN_GETNAMEINFO)(const struct sockaddr*,socklen_t,char*,DWORD,char*,DWORD,int);
258 #define LPFN_GETNAMEINFOA LPFN_GETNAMEINFO
259 typedef int (WINAPI *LPFN_GETNAMEINFOW)(const SOCKADDR*,socklen_t,PWCHAR,DWORD,PWCHAR,DWORD,INT);
260 #define LPFN_GETNAMEINFOT WINELIB_NAME_AW(LPFN_GETNAMEINFO)
261
262 #endif
263
264 #ifdef __cplusplus
265 }
266 #endif
267
268 #endif /* __WS2TCPIP__ */