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
23 /* FIXME: #include <ws2ipdef.h> */
32 /* FIXME: This gets defined by some Unix (Linux) header and messes things */
35 /* for addrinfo calls */
36 typedef struct WS(addrinfo
)
44 struct WS(sockaddr
)* ai_addr
;
45 struct WS(addrinfo
)* ai_next
;
46 } ADDRINFOA
, *PADDRINFOA
;
48 typedef struct WS(addrinfoW
)
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
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
;
85 struct WS(in_addr
) imsf_slist
[1];
88 typedef struct WS(in_addr6
)
90 u_char s6_addr
[16]; /* IPv6 address */
91 } IN6_ADDR
, *PIN6_ADDR
, *LPIN6_ADDR
;
93 /* check for sockaddr_in6 / sockaddr_in6_old madness:
94 * http://msdn.microsoft.com/library/en-us/winsock/winsock/sockaddr_2.asp
96 typedef struct WS(sockaddr_in6
)
98 short sin6_family
; /* AF_INET6 */
99 u_short sin6_port
; /* Transport level port number */
100 u_long sin6_flowinfo
; /* IPv6 flow information */
101 struct WS(in_addr6
) sin6_addr
; /* IPv6 address */
102 u_long sin6_scope_id
; /* IPv6 scope id */
103 } SOCKADDR_IN6
,*PSOCKADDR_IN6
, *LPSOCKADDR_IN6
;
105 typedef struct WS(sockaddr_in6_old
)
107 short sin6_family
; /* AF_INET6 */
108 u_short sin6_port
; /* Transport level port number */
109 u_long sin6_flowinfo
; /* IPv6 flow information */
110 struct WS(in_addr6
) sin6_addr
; /* IPv6 address */
111 } SOCKADDR_IN6_OLD
,*PSOCKADDR_IN6_OLD
, *LPSOCKADDR_IN6_OLD
;
113 typedef union sockaddr_gen
115 struct WS(sockaddr
) Address
;
116 struct WS(sockaddr_in
) AddressIn
;
117 struct WS(sockaddr_in6_old
) AddressIn6
;
120 /* Structure to keep interface specific information */
121 typedef struct _INTERFACE_INFO
123 u_long iiFlags
; /* Interface flags */
124 WS(sockaddr_gen
) iiAddress
; /* Interface address */
125 WS(sockaddr_gen
) iiBroadcastAddress
; /* Broadcast address */
126 WS(sockaddr_gen
) iiNetmask
; /* Network mask */
127 } INTERFACE_INFO
, * LPINTERFACE_INFO
;
129 /* Possible flags for the iiFlags - bitmask */
130 #ifndef USE_WS_PREFIX
131 #define IFF_UP 0x00000001 /* Interface is up */
132 #define IFF_BROADCAST 0x00000002 /* Broadcast is supported */
133 #define IFF_LOOPBACK 0x00000004 /* this is loopback interface */
134 #define IFF_POINTTOPOINT 0x00000008 /* this is point-to-point interface */
135 #define IFF_MULTICAST 0x00000010 /* multicast is supported */
137 #define WS_IFF_UP 0x00000001 /* Interface is up */
138 #define WS_IFF_BROADCAST 0x00000002 /* Broadcast is supported */
139 #define WS_IFF_LOOPBACK 0x00000004 /* this is loopback interface */
140 #define WS_IFF_POINTTOPOINT 0x00000008 /* this is point-to-point interface */
141 #define WS_IFF_MULTICAST 0x00000010 /* multicast is supported */
142 #endif /* USE_WS_PREFIX */
144 #ifndef USE_WS_PREFIX
149 #define IP_MULTICAST_IF 9
150 #define IP_MULTICAST_TTL 10
151 #define IP_MULTICAST_LOOP 11
152 #define IP_ADD_MEMBERSHIP 12
153 #define IP_DROP_MEMBERSHIP 13
154 #define IP_DONTFRAGMENT 14
155 #define IP_ADD_SOURCE_MEMBERSHIP 15
156 #define IP_DROP_SOURCE_MEMBERSHIP 16
157 #define IP_BLOCK_SOURCE 17
158 #define IP_UNBLOCK_SOURCE 18
159 #define IP_PKTINFO 19
160 #define IP_RECEIVE_BROADCAST 22
162 #define WS_IP_OPTIONS 1
163 #define WS_IP_HDRINCL 2
166 #define WS_IP_MULTICAST_IF 9
167 #define WS_IP_MULTICAST_TTL 10
168 #define WS_IP_MULTICAST_LOOP 11
169 #define WS_IP_ADD_MEMBERSHIP 12
170 #define WS_IP_DROP_MEMBERSHIP 13
171 #define WS_IP_DONTFRAGMENT 14
172 #define WS_IP_ADD_SOURCE_MEMBERSHIP 15
173 #define WS_IP_DROP_SOURCE_MEMBERSHIP 16
174 #define WS_IP_BLOCK_SOURCE 17
175 #define WS_IP_UNBLOCK_SOURCE 18
176 #define WS_IP_PKTINFO 19
177 #define WS_IP_RECEIVE_BROADCAST 22
178 #endif /* USE_WS_PREFIX */
180 /* Possible Windows flags for getaddrinfo() */
181 #ifndef USE_WS_PREFIX
182 # define AI_PASSIVE 0x0001
183 # define AI_CANONNAME 0x0002
184 # define AI_NUMERICHOST 0x0004
185 /* getaddrinfo error codes */
186 # define EAI_AGAIN WSATRY_AGAIN
187 # define EAI_BADFLAGS WSAEINVAL
188 # define EAI_FAIL WSANO_RECOVERY
189 # define EAI_FAMILY WSAEAFNOSUPPORT
190 # define EAI_MEMORY WSA_NOT_ENOUGH_MEMORY
191 # define EAI_NODATA EAI_NONAME
192 # define EAI_NONAME WSAHOST_NOT_FOUND
193 # define EAI_SERVICE WSATYPE_NOT_FOUND
194 # define EAI_SOCKTYPE WSAESOCKTNOSUPPORT
196 # define WS_AI_PASSIVE 0x0001
197 # define WS_AI_CANONNAME 0x0002
198 # define WS_AI_NUMERICHOST 0x0004
199 /* getaddrinfo error codes */
200 # define WS_EAI_AGAIN WSATRY_AGAIN
201 # define WS_EAI_BADFLAGS WSAEINVAL
202 # define WS_EAI_FAIL WSANO_RECOVERY
203 # define WS_EAI_FAMILY WSAEAFNOSUPPORT
204 # define WS_EAI_MEMORY WSA_NOT_ENOUGH_MEMORY
205 # define WS_EAI_NODATA WS_EAI_NONAME
206 # define WS_EAI_NONAME WSAHOST_NOT_FOUND
207 # define WS_EAI_SERVICE WSATYPE_NOT_FOUND
208 # define WS_EAI_SOCKTYPE WSAESOCKTNOSUPPORT
211 /* Possible Windows flags for getnameinfo() */
212 #ifndef USE_WS_PREFIX
213 # define NI_NOFQDN 0x01
214 # define NI_NUMERICHOST 0x02
215 # define NI_NAMEREQD 0x04
216 # define NI_NUMERICSERV 0x08
217 # define NI_DGRAM 0x10
219 # define WS_NI_NOFQDN 0x01
220 # define WS_NI_NUMERICHOST 0x02
221 # define WS_NI_NAMEREQD 0x04
222 # define WS_NI_NUMERICSERV 0x08
223 # define WS_NI_DGRAM 0x10
231 void WINAPI
WS(freeaddrinfo
)(LPADDRINFO
);
232 #define FreeAddrInfoA WS(freeaddrinfo)
233 void WINAPI
FreeAddrInfoW(PADDRINFOW
);
234 #define FreeAddrInfo WINELIB_NAME_AW(FreeAddrInfo)
235 int WINAPI
WS(getaddrinfo
)(const char*,const char*,const struct WS(addrinfo
)*,struct WS(addrinfo
)**);
236 #define GetAddrInfoA WS(getaddrinfo)
237 int WINAPI
GetAddrInfoW(PCWSTR
,PCWSTR
,const ADDRINFOW
*,PADDRINFOW
*);
238 #define GetAddrInfo WINELIB_NAME_AW(GetAddrInfo)
239 int WINAPI
WS(getnameinfo
)(const SOCKADDR
*,WS(socklen_t
),PCHAR
,DWORD
,PCHAR
,DWORD
,INT
);
240 #define GetNameInfoA WS(getnameinfo)
241 INT WINAPI
GetNameInfoW(const SOCKADDR
*,WS(socklen_t
),PWCHAR
,DWORD
,PWCHAR
,DWORD
,INT
);
242 #define GetNameInfo WINELIB_NAME_AW(GetNameInfo)
245 * Ws2tcpip Function Typedefs
247 * Remember to keep this section in sync with the
250 #if INCL_WINSOCK_API_TYPEDEFS
252 typedef void (WINAPI
*LPFN_FREEADDRINFO
)(LPADDRINFO
);
253 #define LPFN_FREEADDRINFOA LPFN_FREEADDRINFO
254 typedef void (WINAPI
*LPFN_FREEADDRINFOW
)(PADDRINFOW
);
255 #define LPFN_FREEADDRINFOT WINELIB_NAME_AW(LPFN_FREEADDRINFO)
256 typedef int (WINAPI
*LPFN_GETADDRINFO
)(const char*,const char*,const struct WS(addrinfo
)*,struct WS(addrinfo
)**);
257 #define LPFN_GETADDRINFOA LPFN_GETADDRINFO
258 typedef int (WINAPI
*LPFN_GETADDRINFOW
)(PCWSTR
,PCWSTR
,const ADDRINFOW
*,PADDRINFOW
*);
259 #define LPFN_GETADDRINFOT WINELIB_NAME_AW(LPFN_GETADDRINFO)
260 typedef int (WINAPI
*LPFN_GETNAMEINFO
)(const struct sockaddr
*,socklen_t
,char*,DWORD
,char*,DWORD
,int);
261 #define LPFN_GETNAMEINFOA LPFN_GETNAMEINFO
262 typedef int (WINAPI
*LPFN_GETNAMEINFOW
)(const SOCKADDR
*,socklen_t
,PWCHAR
,DWORD
,PWCHAR
,DWORD
,INT
);
263 #define LPFN_GETNAMEINFOT WINELIB_NAME_AW(LPFN_GETNAMEINFO)
271 #endif /* __WS2TCPIP__ */