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 /* 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
;
64 /* Possible Windows flags for getaddrinfo() */
66 # define AI_PASSIVE 0x0001
67 # define AI_CANONNAME 0x0002
68 # define AI_NUMERICHOST 0x0004
69 /* getaddrinfo error codes */
70 # define EAI_AGAIN WSATRY_AGAIN
71 # define EAI_BADFLAGS WSAEINVAL
72 # define EAI_FAIL WSANO_RECOVERY
73 # define EAI_FAMILY WSAEAFNOSUPPORT
74 # define EAI_MEMORY WSA_NOT_ENOUGH_MEMORY
75 # define EAI_NODATA EAI_NONAME
76 # define EAI_NONAME WSAHOST_NOT_FOUND
77 # define EAI_SERVICE WSATYPE_NOT_FOUND
78 # define EAI_SOCKTYPE WSAESOCKTNOSUPPORT
80 # define WS_AI_PASSIVE 0x0001
81 # define WS_AI_CANONNAME 0x0002
82 # define WS_AI_NUMERICHOST 0x0004
83 /* getaddrinfo error codes */
84 # define WS_EAI_AGAIN WSATRY_AGAIN
85 # define WS_EAI_BADFLAGS WSAEINVAL
86 # define WS_EAI_FAIL WSANO_RECOVERY
87 # define WS_EAI_FAMILY WSAEAFNOSUPPORT
88 # define WS_EAI_MEMORY WSA_NOT_ENOUGH_MEMORY
89 # define WS_EAI_NODATA WS_EAI_NONAME
90 # define WS_EAI_NONAME WSAHOST_NOT_FOUND
91 # define WS_EAI_SERVICE WSATYPE_NOT_FOUND
92 # define WS_EAI_SOCKTYPE WSAESOCKTNOSUPPORT
96 # define NI_MAXHOST 1025
97 # define NI_MAXSERV 32
99 # define WS_NI_MAXHOST 1025
100 # define WS_NI_MAXSERV 32
103 /* Possible Windows flags for getnameinfo() */
104 #ifndef USE_WS_PREFIX
105 # define NI_NOFQDN 0x01
106 # define NI_NUMERICHOST 0x02
107 # define NI_NAMEREQD 0x04
108 # define NI_NUMERICSERV 0x08
109 # define NI_DGRAM 0x10
111 # define WS_NI_NOFQDN 0x01
112 # define WS_NI_NUMERICHOST 0x02
113 # define WS_NI_NAMEREQD 0x04
114 # define WS_NI_NUMERICSERV 0x08
115 # define WS_NI_DGRAM 0x10
123 #define GAI_STRERROR_BUFFER_SIZE 1024
125 static inline char *gai_strerrorA(int errcode
)
127 static char buffer
[GAI_STRERROR_BUFFER_SIZE
+ 1];
129 /* FIXME: should format message from system, ignoring inserts in neutral
136 static inline WCHAR
*gai_strerrorW(int errcode
)
138 static WCHAR buffer
[GAI_STRERROR_BUFFER_SIZE
+ 1];
140 /* FIXME: should format message from system, ignoring inserts in neutral
148 # define WS_gai_strerror WINELIB_NAME_AW(gai_strerror)
149 #elif defined(WINE_NO_UNICODE_MACROS)
150 # define gai_strerror gai_strerrorA
152 # define gai_strerror WINELIB_NAME_AW(gai_strerror)
155 void WINAPI
WS(freeaddrinfo
)(LPADDRINFO
);
156 #define FreeAddrInfoA WS(freeaddrinfo)
157 void WINAPI
FreeAddrInfoW(PADDRINFOW
);
158 #define FreeAddrInfo WINELIB_NAME_AW(FreeAddrInfo)
159 int WINAPI
WS(getaddrinfo
)(const char*,const char*,const struct WS(addrinfo
)*,struct WS(addrinfo
)**);
160 #define GetAddrInfoA WS(getaddrinfo)
161 int WINAPI
GetAddrInfoW(PCWSTR
,PCWSTR
,const ADDRINFOW
*,PADDRINFOW
*);
162 #define GetAddrInfo WINELIB_NAME_AW(GetAddrInfo)
163 int WINAPI
WS(getnameinfo
)(const SOCKADDR
*,WS(socklen_t
),PCHAR
,DWORD
,PCHAR
,DWORD
,INT
);
164 #define GetNameInfoA WS(getnameinfo)
165 INT WINAPI
GetNameInfoW(const SOCKADDR
*,WS(socklen_t
),PWCHAR
,DWORD
,PWCHAR
,DWORD
,INT
);
166 #define GetNameInfo WINELIB_NAME_AW(GetNameInfo)
167 PCSTR WINAPI
WS(inet_ntop
)(INT
,PVOID
,PSTR
,size_t);
168 #define InetNtopA WS(inet_ntop)
169 PCWSTR WINAPI
InetNtopW(INT
,PVOID
,PWSTR
,size_t);
170 #define InetNtop WINELIB_NAME_AW(InetNtop)
171 int WINAPI
WS(inet_pton
)(INT
,PCSTR
,PVOID
);
172 #define InetPtonA WS(inet_pton)
173 int WINAPI
InetPtonW(INT
,PCWSTR
,PVOID
);
174 #define InetPton WINELIB_NAME_AW(InetPton)
177 * Ws2tcpip Function Typedefs
179 * Remember to keep this section in sync with the
182 #if INCL_WINSOCK_API_TYPEDEFS
184 typedef void (WINAPI
*LPFN_FREEADDRINFO
)(LPADDRINFO
);
185 #define LPFN_FREEADDRINFOA LPFN_FREEADDRINFO
186 typedef void (WINAPI
*LPFN_FREEADDRINFOW
)(PADDRINFOW
);
187 #define LPFN_FREEADDRINFOT WINELIB_NAME_AW(LPFN_FREEADDRINFO)
188 typedef int (WINAPI
*LPFN_GETADDRINFO
)(const char*,const char*,const struct WS(addrinfo
)*,struct WS(addrinfo
)**);
189 #define LPFN_GETADDRINFOA LPFN_GETADDRINFO
190 typedef int (WINAPI
*LPFN_GETADDRINFOW
)(PCWSTR
,PCWSTR
,const ADDRINFOW
*,PADDRINFOW
*);
191 #define LPFN_GETADDRINFOT WINELIB_NAME_AW(LPFN_GETADDRINFO)
192 typedef int (WINAPI
*LPFN_GETNAMEINFO
)(const struct sockaddr
*,socklen_t
,char*,DWORD
,char*,DWORD
,int);
193 #define LPFN_GETNAMEINFOA LPFN_GETNAMEINFO
194 typedef int (WINAPI
*LPFN_GETNAMEINFOW
)(const SOCKADDR
*,socklen_t
,PWCHAR
,DWORD
,PWCHAR
,DWORD
,INT
);
195 #define LPFN_GETNAMEINFOT WINELIB_NAME_AW(LPFN_GETNAMEINFO)
203 #endif /* __WS2TCPIP__ */