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