ws2tcpip.h revision 589fd26cedb2b4ebbed14f2964cad03cc8ebbca2
/*
* Copyright (C) 2001 Francois Gouget
*
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
/*
* Sun LGPL Disclaimer: For the avoidance of doubt, except that if any license choice
* other than GPL or LGPL is available it will apply instead, Sun elects to use only
* the Lesser General Public License version 2.1 (LGPLv2) at this time for any software where
* a choice of LGPL license versions is made available with the language indicating
* that LGPLv2 or any later version may be used, or where a choice of which version
* of the LGPL is applied is otherwise unspecified.
*/
#ifndef __WS2TCPIP__
#define __WS2TCPIP__
#include <winsock2.h>
#include <ws2ipdef.h>
#include <limits.h>
#ifdef USE_WS_PREFIX
#else
#define WS(x) x
#endif
/* for addrinfo calls */
{
int ai_flags;
int ai_family;
int ai_socktype;
int ai_protocol;
char * ai_canonname;
} ADDRINFOA, *PADDRINFOA;
{
int ai_flags;
int ai_family;
int ai_socktype;
int ai_protocol;
} ADDRINFOW, *PADDRINFOW;
/* Possible Windows flags for getaddrinfo() */
#ifndef USE_WS_PREFIX
# define AI_PASSIVE 0x0001
# define AI_CANONNAME 0x0002
# define AI_NUMERICHOST 0x0004
/* getaddrinfo error codes */
# define EAI_AGAIN WSATRY_AGAIN
# define EAI_BADFLAGS WSAEINVAL
# define EAI_FAIL WSANO_RECOVERY
# define EAI_FAMILY WSAEAFNOSUPPORT
# define EAI_MEMORY WSA_NOT_ENOUGH_MEMORY
# define EAI_NODATA EAI_NONAME
# define EAI_NONAME WSAHOST_NOT_FOUND
# define EAI_SERVICE WSATYPE_NOT_FOUND
# define EAI_SOCKTYPE WSAESOCKTNOSUPPORT
#else
# define WS_AI_PASSIVE 0x0001
# define WS_AI_CANONNAME 0x0002
# define WS_AI_NUMERICHOST 0x0004
/* getaddrinfo error codes */
# define WS_EAI_AGAIN WSATRY_AGAIN
# define WS_EAI_BADFLAGS WSAEINVAL
# define WS_EAI_FAIL WSANO_RECOVERY
# define WS_EAI_FAMILY WSAEAFNOSUPPORT
# define WS_EAI_MEMORY WSA_NOT_ENOUGH_MEMORY
# define WS_EAI_NODATA WS_EAI_NONAME
# define WS_EAI_NONAME WSAHOST_NOT_FOUND
# define WS_EAI_SERVICE WSATYPE_NOT_FOUND
# define WS_EAI_SOCKTYPE WSAESOCKTNOSUPPORT
#endif
#ifndef USE_WS_PREFIX
# define NI_MAXHOST 1025
# define NI_MAXSERV 32
#else
# define WS_NI_MAXHOST 1025
# define WS_NI_MAXSERV 32
#endif
/* Possible Windows flags for getnameinfo() */
#ifndef USE_WS_PREFIX
# define NI_NOFQDN 0x01
# define NI_NUMERICHOST 0x02
# define NI_NAMEREQD 0x04
# define NI_NUMERICSERV 0x08
# define NI_DGRAM 0x10
#else
# define WS_NI_NOFQDN 0x01
# define WS_NI_NUMERICHOST 0x02
# define WS_NI_NAMEREQD 0x04
# define WS_NI_NUMERICSERV 0x08
# define WS_NI_DGRAM 0x10
#endif
#ifdef __cplusplus
extern "C" {
#endif
#define GAI_STRERROR_BUFFER_SIZE 1024
static inline char *gai_strerrorA(int errcode)
{
/* FIXME: should format message from system, ignoring inserts in neutral
* language */
buffer[0] = '\0';
return buffer;
}
{
/* FIXME: should format message from system, ignoring inserts in neutral
* language */
buffer[0] = '\0';
return buffer;
}
#ifdef USE_WS_PREFIX
#elif defined(WINE_NO_UNICODE_MACROS)
# define gai_strerror gai_strerrorA
#else
#endif
int WINAPI WS(getaddrinfo)(const char*,const char*,const struct WS(addrinfo)*,struct WS(addrinfo)**);
/*
* Ws2tcpip Function Typedefs
*
* Remember to keep this section in sync with the
* prototypes above.
*/
#define LPFN_FREEADDRINFOA LPFN_FREEADDRINFO
typedef int (WINAPI *LPFN_GETADDRINFO)(const char*,const char*,const struct WS(addrinfo)*,struct WS(addrinfo)**);
#define LPFN_GETADDRINFOA LPFN_GETADDRINFO
typedef int (WINAPI *LPFN_GETNAMEINFO)(const struct sockaddr*,socklen_t,char*,DWORD,char*,DWORD,int);
#define LPFN_GETNAMEINFOA LPFN_GETNAMEINFO
#endif
#ifdef __cplusplus
}
#endif
#endif /* __WS2TCPIP__ */