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 typedef int WS(socklen_t
);
59 typedef ADDRINFOA ADDRINFO
, *LPADDRINFO
;
61 /* Possible Windows flags for getaddrinfo() */
63 # define AI_PASSIVE 0x00000001
64 # define AI_CANONNAME 0x00000002
65 # define AI_NUMERICHOST 0x00000004
66 # define AI_ADDRCONFIG 0x00000400
67 # define AI_V4MAPPED 0x00000800
68 # define AI_NON_AUTHORITATIVE 0x00004000
69 # define AI_SECURE 0x00008000
70 # define AI_RETURN_PREFERRED_NAMES 0x00010000
71 /* getaddrinfo error codes */
72 # define EAI_AGAIN WSATRY_AGAIN
73 # define EAI_BADFLAGS WSAEINVAL
74 # define EAI_FAIL WSANO_RECOVERY
75 # define EAI_FAMILY WSAEAFNOSUPPORT
76 # define EAI_MEMORY WSA_NOT_ENOUGH_MEMORY
77 # define EAI_NODATA EAI_NONAME
78 # define EAI_NONAME WSAHOST_NOT_FOUND
79 # define EAI_SERVICE WSATYPE_NOT_FOUND
80 # define EAI_SOCKTYPE WSAESOCKTNOSUPPORT
82 # define WS_AI_PASSIVE 0x00000001
83 # define WS_AI_CANONNAME 0x00000002
84 # define WS_AI_NUMERICHOST 0x00000004
85 # define WS_AI_ADDRCONFIG 0x00000400
86 # define WS_AI_V4MAPPED 0x00000800
87 # define WS_AI_NON_AUTHORITATIVE 0x00004000
88 # define WS_AI_SECURE 0x00008000
89 # define WS_AI_RETURN_PREFERRED_NAMES 0x00010000
90 /* getaddrinfo error codes */
91 # define WS_EAI_AGAIN WSATRY_AGAIN
92 # define WS_EAI_BADFLAGS WSAEINVAL
93 # define WS_EAI_FAIL WSANO_RECOVERY
94 # define WS_EAI_FAMILY WSAEAFNOSUPPORT
95 # define WS_EAI_MEMORY WSA_NOT_ENOUGH_MEMORY
96 # define WS_EAI_NODATA WS_EAI_NONAME
97 # define WS_EAI_NONAME WSAHOST_NOT_FOUND
98 # define WS_EAI_SERVICE WSATYPE_NOT_FOUND
99 # define WS_EAI_SOCKTYPE WSAESOCKTNOSUPPORT
102 #ifndef USE_WS_PREFIX
103 # define NI_MAXHOST 1025
104 # define NI_MAXSERV 32
106 # define WS_NI_MAXHOST 1025
107 # define WS_NI_MAXSERV 32
110 /* Possible Windows flags for getnameinfo() */
111 #ifndef USE_WS_PREFIX
112 # define NI_NOFQDN 0x01
113 # define NI_NUMERICHOST 0x02
114 # define NI_NAMEREQD 0x04
115 # define NI_NUMERICSERV 0x08
116 # define NI_DGRAM 0x10
118 # define WS_NI_NOFQDN 0x01
119 # define WS_NI_NUMERICHOST 0x02
120 # define WS_NI_NAMEREQD 0x04
121 # define WS_NI_NUMERICSERV 0x08
122 # define WS_NI_DGRAM 0x10
130 #define GAI_STRERROR_BUFFER_SIZE 1024
132 static inline char *gai_strerrorA(int errcode
)
134 static char buffer
[GAI_STRERROR_BUFFER_SIZE
+ 1];
136 /* FIXME: should format message from system, ignoring inserts in neutral
143 static inline WCHAR
*gai_strerrorW(int errcode
)
145 static WCHAR buffer
[GAI_STRERROR_BUFFER_SIZE
+ 1];
147 /* FIXME: should format message from system, ignoring inserts in neutral
155 # define WS_gai_strerror WINELIB_NAME_AW(gai_strerror)
156 #elif defined(WINE_NO_UNICODE_MACROS)
157 # define gai_strerror gai_strerrorA
159 # define gai_strerror WINELIB_NAME_AW(gai_strerror)
162 void WINAPI
WS(freeaddrinfo
)(LPADDRINFO
);
163 #define FreeAddrInfoA WS(freeaddrinfo)
164 void WINAPI
FreeAddrInfoW(PADDRINFOW
);
165 #define FreeAddrInfo WINELIB_NAME_AW(FreeAddrInfo)
166 int WINAPI
WS(getaddrinfo
)(const char*,const char*,const struct WS(addrinfo
)*,struct WS(addrinfo
)**);
167 #define GetAddrInfoA WS(getaddrinfo)
168 int WINAPI
GetAddrInfoW(PCWSTR
,PCWSTR
,const ADDRINFOW
*,PADDRINFOW
*);
169 #define GetAddrInfo WINELIB_NAME_AW(GetAddrInfo)
170 int WINAPI
WS(getnameinfo
)(const SOCKADDR
*,WS(socklen_t
),PCHAR
,DWORD
,PCHAR
,DWORD
,INT
);
171 #define GetNameInfoA WS(getnameinfo)
172 INT WINAPI
GetNameInfoW(const SOCKADDR
*,WS(socklen_t
),PWCHAR
,DWORD
,PWCHAR
,DWORD
,INT
);
173 #define GetNameInfo WINELIB_NAME_AW(GetNameInfo)
174 PCSTR WINAPI
WS(inet_ntop
)(INT
,PVOID
,PSTR
,SIZE_T
);
175 #define InetNtopA WS(inet_ntop)
176 PCWSTR WINAPI
InetNtopW(INT
,PVOID
,PWSTR
,SIZE_T
);
177 #define InetNtop WINELIB_NAME_AW(InetNtop)
178 int WINAPI
WS(inet_pton
)(INT
,PCSTR
,PVOID
);
179 #define InetPtonA WS(inet_pton)
180 int WINAPI
InetPtonW(INT
,PCWSTR
,PVOID
);
181 #define InetPton WINELIB_NAME_AW(InetPton)
184 * Ws2tcpip Function Typedefs
186 * Remember to keep this section in sync with the
189 #if INCL_WINSOCK_API_TYPEDEFS
191 typedef void (WINAPI
*LPFN_FREEADDRINFO
)(LPADDRINFO
);
192 #define LPFN_FREEADDRINFOA LPFN_FREEADDRINFO
193 typedef void (WINAPI
*LPFN_FREEADDRINFOW
)(PADDRINFOW
);
194 #define LPFN_FREEADDRINFOT WINELIB_NAME_AW(LPFN_FREEADDRINFO)
195 typedef int (WINAPI
*LPFN_GETADDRINFO
)(const char*,const char*,const struct WS(addrinfo
)*,struct WS(addrinfo
)**);
196 #define LPFN_GETADDRINFOA LPFN_GETADDRINFO
197 typedef int (WINAPI
*LPFN_GETADDRINFOW
)(PCWSTR
,PCWSTR
,const ADDRINFOW
*,PADDRINFOW
*);
198 #define LPFN_GETADDRINFOT WINELIB_NAME_AW(LPFN_GETADDRINFO)
199 typedef int (WINAPI
*LPFN_GETNAMEINFO
)(const struct sockaddr
*,socklen_t
,char*,DWORD
,char*,DWORD
,int);
200 #define LPFN_GETNAMEINFOA LPFN_GETNAMEINFO
201 typedef int (WINAPI
*LPFN_GETNAMEINFOW
)(const SOCKADDR
*,socklen_t
,PWCHAR
,DWORD
,PWCHAR
,DWORD
,INT
);
202 #define LPFN_GETNAMEINFOT WINELIB_NAME_AW(LPFN_GETNAMEINFO)
210 #endif /* __WS2TCPIP__ */