cygwin finally ships with ws2tcpip.h, so we need to get rid of some duplicated definitions.
extern struct hostent *getipnodebyname (const char *, int, int, int *);
extern int inet_pton (int, const char *, void *);
extern const char *inet_ntop (int, const void *, char *, size_t);
+#else
+
+#ifndef EAI_BADHINTS
+#define EAI_BADHINTS 12
+#endif
+
+#ifndef EAI_PROTOCOL
+#define EAI_PROTOCOL 13
+#endif
+
+#ifndef EAI_MAX
+#define EAI_MAX 14
+#endif
+
+#ifndef NETDB_INTERNAL
+#define NETDB_INTERNAL -1 /* see errno */
+#endif
+
+#ifndef AI_MASK
+/* valid flags for addrinfo */
+#define AI_MASK (AI_PASSIVE | AI_CANONNAME | AI_NUMERICHOST)
+#endif
+
#endif /* HAVE_ADDRINFO */
/*
#ifndef NI_DGRAM
#define NI_DGRAM 0x00000010
#endif
+
#include <winsock2.h>
-#ifndef __MINGW32__
#include <ws2tcpip.h>
-#endif /* __MINGW32__ */
#ifndef __MINGW32__
#define IN_MULTICAST(a) IN_CLASSD(a)
#define IN_LOOPBACKNET 127
-#ifdef __MINGW32__
+#if defined(__MINGW32__) && defined(DEFINE_ADDITIONAL_IPV6_STUFF)
/* IPv6 address */
struct in6_addr
{
#endif /* __MINGW32__ */
-#if (defined WIN32) || (defined __MINGW32__)
+#if (defined _MSC_VER) || (defined(__MINGW32__) && defined(DEFINE_ADDITIONAL_IPV6_STUFF))
typedef unsigned short sa_family_t;
#endif
-#ifdef __MINGW32__
+#if defined(__MINGW32__) && defined(DEFINE_ADDITIONAL_IPV6_STUFF)
#define __SOCKADDR_COMMON(sa_prefix) \
sa_family_t sa_prefix##family
#define IP6OPT_MUTABLE 0x20
-#ifdef __MINGW32__
+#if defined(__MINGW32__) && defined(DEFINE_ADDITIONAL_IPV6_STUFF)
#ifndef EAI_ADDRFAMILY
struct addrinfo {
int ai_flags; /* AI_PASSIVE, AI_CANONNAME */
#define MATCH(x, y, w) \
((x) == (y) || ((w) && ((x) == ANY || (y) == ANY)))
+#if defined(DEFINE_ADDITIONAL_IPV6_STUFF)
char *
gai_strerror(ecode)
int ecode;
ecode = EAI_MAX;
return ai_errlist[ecode];
}
+#endif
void
freeaddrinfo(ai)