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
32 /* for addrinfo calls */
33 typedef struct WS(addrinfo
)
41 struct WS(sockaddr
)* ai_addr
;
42 struct WS(addrinfo
)* ai_next
;
43 } ADDRINFOA
, *PADDRINFOA
;
45 typedef struct WS(addrinfoW
)
53 struct WS(sockaddr
)* ai_addr
;
54 struct WS(addrinfoW
)* ai_next
;
55 } ADDRINFOW
, *PADDRINFOW
;
57 #ifndef WINE_NO_UNICODE_MACROS
58 typedef WINELIB_NAME_AW(ADDRINFO
) ADDRINFOT
, *PADDRINFOT
;
62 typedef int WS_socklen_t
;
64 #define socklen_t int /* avoid conflicts with the system's socklen_t typedef */
67 typedef ADDRINFOA ADDRINFO
, *LPADDRINFO
;
69 /* Possible Windows flags for getaddrinfo() */
71 # define AI_PASSIVE 0x00000001
72 # define AI_CANONNAME 0x00000002
73 # define AI_NUMERICHOST 0x00000004
74 # define AI_NUMERICSERV 0x00000008
75 # define AI_ADDRCONFIG 0x00000400
76 # define AI_V4MAPPED 0x00000800
77 # define AI_NON_AUTHORITATIVE 0x00004000
78 # define AI_SECURE 0x00008000
79 # define AI_RETURN_PREFERRED_NAMES 0x00010000
80 # define AI_DISABLE_IDN_ENCODING 0x00080000
81 /* getaddrinfo error codes */
82 # define EAI_AGAIN WSATRY_AGAIN
83 # define EAI_BADFLAGS WSAEINVAL
84 # define EAI_FAIL WSANO_RECOVERY
85 # define EAI_FAMILY WSAEAFNOSUPPORT
86 # define EAI_MEMORY WSA_NOT_ENOUGH_MEMORY
87 # define EAI_NODATA EAI_NONAME
88 # define EAI_NONAME WSAHOST_NOT_FOUND
89 # define EAI_SERVICE WSATYPE_NOT_FOUND
90 # define EAI_SOCKTYPE WSAESOCKTNOSUPPORT
92 # define WS_AI_PASSIVE 0x00000001
93 # define WS_AI_CANONNAME 0x00000002
94 # define WS_AI_NUMERICHOST 0x00000004
95 # define WS_AI_NUMERICSERV 0x00000008
96 # define WS_AI_ADDRCONFIG 0x00000400
97 # define WS_AI_V4MAPPED 0x00000800
98 # define WS_AI_NON_AUTHORITATIVE 0x00004000
99 # define WS_AI_SECURE 0x00008000
100 # define WS_AI_RETURN_PREFERRED_NAMES 0x00010000
101 # define WS_AI_DISABLE_IDN_ENCODING 0x00080000
102 /* getaddrinfo error codes */
103 # define WS_EAI_AGAIN WSATRY_AGAIN
104 # define WS_EAI_BADFLAGS WSAEINVAL
105 # define WS_EAI_FAIL WSANO_RECOVERY
106 # define WS_EAI_FAMILY WSAEAFNOSUPPORT
107 # define WS_EAI_MEMORY WSA_NOT_ENOUGH_MEMORY
108 # define WS_EAI_NODATA WS_EAI_NONAME
109 # define WS_EAI_NONAME WSAHOST_NOT_FOUND
110 # define WS_EAI_SERVICE WSATYPE_NOT_FOUND
111 # define WS_EAI_SOCKTYPE WSAESOCKTNOSUPPORT
114 #ifndef USE_WS_PREFIX
115 # define NI_MAXHOST 1025
116 # define NI_MAXSERV 32
118 # define WS_NI_MAXHOST 1025
119 # define WS_NI_MAXSERV 32
122 /* Possible Windows flags for getnameinfo() */
123 #ifndef USE_WS_PREFIX
124 # define NI_NOFQDN 0x01
125 # define NI_NUMERICHOST 0x02
126 # define NI_NAMEREQD 0x04
127 # define NI_NUMERICSERV 0x08
128 # define NI_DGRAM 0x10
130 # define WS_NI_NOFQDN 0x01
131 # define WS_NI_NUMERICHOST 0x02
132 # define WS_NI_NAMEREQD 0x04
133 # define WS_NI_NUMERICSERV 0x08
134 # define WS_NI_DGRAM 0x10
142 #define GAI_STRERROR_BUFFER_SIZE 1024
144 static inline char *gai_strerrorA(int errcode
)
146 static char buffer
[GAI_STRERROR_BUFFER_SIZE
+ 1];
148 /* FIXME: should format message from system, ignoring inserts in neutral
155 static inline WCHAR
*gai_strerrorW(int errcode
)
157 static WCHAR buffer
[GAI_STRERROR_BUFFER_SIZE
+ 1];
159 /* FIXME: should format message from system, ignoring inserts in neutral
167 # define WS_gai_strerror WINELIB_NAME_AW(gai_strerror)
168 #elif defined(WINE_NO_UNICODE_MACROS)
169 # define gai_strerror gai_strerrorA
171 # define gai_strerror WINELIB_NAME_AW(gai_strerror)
174 typedef void (CALLBACK
*LPLOOKUPSERVICE_COMPLETION_ROUTINE
)(DWORD
,DWORD
,WSAOVERLAPPED
*);
176 void WINAPI
WS(freeaddrinfo
)(LPADDRINFO
);
177 #define FreeAddrInfoA WS(freeaddrinfo)
178 void WINAPI
FreeAddrInfoW(PADDRINFOW
);
179 #define FreeAddrInfo WINELIB_NAME_AW(FreeAddrInfo)
180 void WINAPI
FreeAddrInfoExW(ADDRINFOEXW
*);
181 int WINAPI
WS(getaddrinfo
)(const char*,const char*,const struct WS(addrinfo
)*,struct WS(addrinfo
)**);
182 #define GetAddrInfoA WS(getaddrinfo)
183 int WINAPI
GetAddrInfoW(PCWSTR
,PCWSTR
,const ADDRINFOW
*,PADDRINFOW
*);
184 #define GetAddrInfo WINELIB_NAME_AW(GetAddrInfo)
185 int WINAPI
GetAddrInfoExA(const char*,const char*,DWORD
,GUID
*,const ADDRINFOEXA
*,ADDRINFOEXA
**,struct WS(timeval
)*,
186 OVERLAPPED
*,LPLOOKUPSERVICE_COMPLETION_ROUTINE
,HANDLE
*);
187 int WINAPI
GetAddrInfoExW(const WCHAR
*,const WCHAR
*,DWORD
,GUID
*, const ADDRINFOEXW
*,ADDRINFOEXW
**,struct WS(timeval
)*,
188 OVERLAPPED
*,LPLOOKUPSERVICE_COMPLETION_ROUTINE
,HANDLE
*);
189 #define GetAddrInfoEx WINELIB_NAME_AW(GetAddrInfoExW)
190 int WINAPI
GetAddrInfoExOverlappedResult(OVERLAPPED
*);
191 int WINAPI
GetAddrInfoExCancel(HANDLE
*);
192 int WINAPI
WS(getnameinfo
)(const SOCKADDR
*,WS(socklen_t
),PCHAR
,DWORD
,PCHAR
,DWORD
,INT
);
193 #define GetNameInfoA WS(getnameinfo)
194 INT WINAPI
GetNameInfoW(const SOCKADDR
*,WS(socklen_t
),PWCHAR
,DWORD
,PWCHAR
,DWORD
,INT
);
195 #define GetNameInfo WINELIB_NAME_AW(GetNameInfo)
196 PCSTR WINAPI
WS(inet_ntop
)(INT
,PVOID
,PSTR
,SIZE_T
);
197 #define InetNtopA WS(inet_ntop)
198 PCWSTR WINAPI
InetNtopW(INT
,PVOID
,PWSTR
,SIZE_T
);
199 #define InetNtop WINELIB_NAME_AW(InetNtop)
200 int WINAPI
WS(inet_pton
)(INT
,PCSTR
,PVOID
);
201 #define InetPtonA WS(inet_pton)
202 int WINAPI
InetPtonW(INT
,PCWSTR
,PVOID
);
203 #define InetPton WINELIB_NAME_AW(InetPton)
206 * Ws2tcpip Function Typedefs
208 * Remember to keep this section in sync with the
211 #if INCL_WINSOCK_API_TYPEDEFS
213 typedef void (WINAPI
*LPFN_FREEADDRINFO
)(LPADDRINFO
);
214 #define LPFN_FREEADDRINFOA LPFN_FREEADDRINFO
215 typedef void (WINAPI
*LPFN_FREEADDRINFOW
)(PADDRINFOW
);
216 #define LPFN_FREEADDRINFOT WINELIB_NAME_AW(LPFN_FREEADDRINFO)
217 typedef int (WINAPI
*LPFN_GETADDRINFO
)(const char*,const char*,const struct WS(addrinfo
)*,struct WS(addrinfo
)**);
218 #define LPFN_GETADDRINFOA LPFN_GETADDRINFO
219 typedef int (WINAPI
*LPFN_GETADDRINFOW
)(PCWSTR
,PCWSTR
,const ADDRINFOW
*,PADDRINFOW
*);
220 #define LPFN_GETADDRINFOT WINELIB_NAME_AW(LPFN_GETADDRINFO)
221 typedef int (WINAPI
*LPFN_GETNAMEINFO
)(const struct sockaddr
*,socklen_t
,char*,DWORD
,char*,DWORD
,int);
222 #define LPFN_GETNAMEINFOA LPFN_GETNAMEINFO
223 typedef int (WINAPI
*LPFN_GETNAMEINFOW
)(const SOCKADDR
*,socklen_t
,PWCHAR
,DWORD
,PWCHAR
,DWORD
,INT
);
224 #define LPFN_GETNAMEINFOT WINELIB_NAME_AW(LPFN_GETNAMEINFO)
232 #endif /* __WS2TCPIP__ */