loader: Don't bother checking for pthread.h existence, we require it anyway.
[wine/hacks.git] / include / ws2tcpip.h
bloba38ccdaf01ff935bfc4dc1f7838e958a1109708f
1 /*
2 * Copyright (C) 2001 Francois Gouget
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.
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.
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
19 #ifndef __WS2TCPIP__
20 #define __WS2TCPIP__
22 #include <winsock2.h>
23 /* FIXME: #include <ws2ipdef.h> */
24 #include <limits.h>
26 #ifdef USE_WS_PREFIX
27 #define WS(x) WS_##x
28 #else
29 #define WS(x) x
30 #endif
32 /* FIXME: This gets defined by some Unix (Linux) header and messes things */
33 #undef s6_addr
35 /* for addrinfo calls */
36 typedef struct WS(addrinfo)
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;
48 typedef struct WS(addrinfoW)
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;
60 typedef int WS(socklen_t);
62 typedef ADDRINFOA ADDRINFO, *LPADDRINFO;
65 * Multicast group information
68 struct WS(ip_mreq)
70 struct WS(in_addr) imr_multiaddr;
71 struct WS(in_addr) imr_interface;
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;
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];
88 typedef struct WS(in_addr6)
90 WS(u_char) s6_addr[16]; /* IPv6 address */
91 } IN6_ADDR, *PIN6_ADDR, *LPIN6_ADDR;
93 typedef struct WS(sockaddr_in6)
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;
102 typedef struct WS(sockaddr_in6_old)
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;
110 typedef union sockaddr_gen
112 struct WS(sockaddr) Address;
113 struct WS(sockaddr_in) AddressIn;
114 struct WS(sockaddr_in6_old) AddressIn6;
115 } WS(sockaddr_gen);
117 /* Structure to keep interface specific information */
118 typedef struct _INTERFACE_INFO
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;
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 */
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 */
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
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
224 #ifdef __cplusplus
225 extern "C" {
226 #endif
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 PCSTR WINAPI WS(inet_ntop)(INT,PVOID,PSTR,size_t);
241 #define InetNtopA WS(inet_ntop)
242 PCWSTR WINAPI InetNtopW(INT,PVOID,PWSTR,size_t);
243 #define InetNtop WINELIB_NAME_AW(InetNtop)
244 int WINAPI WS(inet_pton)(INT,PCSTR,PVOID);
245 #define InetPtonA WS(inet_pton)
246 int WINAPI InetPtonW(INT,PCWSTR,PVOID);
247 #define InetPton WINELIB_NAME_AW(InetPton)
250 * Ws2tcpip Function Typedefs
252 * Remember to keep this section in sync with the
253 * prototypes above.
255 #if INCL_WINSOCK_API_TYPEDEFS
257 typedef void (WINAPI *LPFN_FREEADDRINFO)(LPADDRINFO);
258 #define LPFN_FREEADDRINFOA LPFN_FREEADDRINFO
259 typedef void (WINAPI *LPFN_FREEADDRINFOW)(PADDRINFOW);
260 #define LPFN_FREEADDRINFOT WINELIB_NAME_AW(LPFN_FREEADDRINFO)
261 typedef int (WINAPI *LPFN_GETADDRINFO)(const char*,const char*,const struct WS(addrinfo)*,struct WS(addrinfo)**);
262 #define LPFN_GETADDRINFOA LPFN_GETADDRINFO
263 typedef int (WINAPI *LPFN_GETADDRINFOW)(PCWSTR,PCWSTR,const ADDRINFOW*,PADDRINFOW*);
264 #define LPFN_GETADDRINFOT WINELIB_NAME_AW(LPFN_GETADDRINFO)
265 typedef int (WINAPI *LPFN_GETNAMEINFO)(const struct sockaddr*,socklen_t,char*,DWORD,char*,DWORD,int);
266 #define LPFN_GETNAMEINFOA LPFN_GETNAMEINFO
267 typedef int (WINAPI *LPFN_GETNAMEINFOW)(const SOCKADDR*,socklen_t,PWCHAR,DWORD,PWCHAR,DWORD,INT);
268 #define LPFN_GETNAMEINFOT WINELIB_NAME_AW(LPFN_GETNAMEINFO)
270 #endif
272 #ifdef __cplusplus
274 #endif
276 #endif /* __WS2TCPIP__ */