summaryrefslogtreecommitdiff
path: root/ext/socket/addrinfo.h
diff options
context:
space:
mode:
Diffstat (limited to 'ext/socket/addrinfo.h')
-rw-r--r--ext/socket/addrinfo.h46
1 files changed, 26 insertions, 20 deletions
diff --git a/ext/socket/addrinfo.h b/ext/socket/addrinfo.h
index 171d3c2ce7f..806b00e3684 100644
--- a/ext/socket/addrinfo.h
+++ b/ext/socket/addrinfo.h
@@ -29,7 +29,6 @@
#ifndef ADDR_INFO_H
#define ADDR_INFO_H
-#ifndef HAVE_GETADDRINFO
/* special compatibility hack */
#undef EAI_ADDRFAMILY
@@ -62,17 +61,6 @@
#undef NI_NUMERICSERV
#undef NI_DGRAM
-#undef addrinfo
-#define addrinfo addrinfo__compat
-#undef getaddrinfo
-#define getaddrinfo getaddrinfo__compat
-#undef getnameinfo
-#define getnameinfo getnameinfo__compat
-#undef freehostent
-#define freehostent freehostent__compat
-#undef freeaddrinfo
-#define freeaddrinfo freeaddrinfo__compat
-
#ifndef __P
# ifdef HAVE_PROTOTYPES
# define __P(args) args
@@ -111,6 +99,7 @@
#define AI_NUMERICSERV 0x00000008 /* prevent service name resolution */
/* valid flags for addrinfo */
#ifndef __HAIKU__
+#undef AI_MASK
#define AI_MASK (AI_PASSIVE | AI_CANONNAME | AI_NUMERICHOST | AI_NUMERICSERV)
#endif
@@ -138,6 +127,7 @@
#define NI_NUMERICSERV 0x00000008
#define NI_DGRAM 0x00000010
+#ifndef HAVE_TYPE_STRUCT_ADDRINFO
struct addrinfo {
int ai_flags; /* AI_PASSIVE, AI_CANONNAME */
int ai_family; /* PF_xxx */
@@ -148,6 +138,24 @@ struct addrinfo {
struct sockaddr *ai_addr; /* binary address */
struct addrinfo *ai_next; /* next structure in linked list */
};
+#endif
+
+#ifndef HAVE_GETADDRINFO
+#undef getaddrinfo
+#define getaddrinfo getaddrinfo__compat
+#endif
+#ifndef HAVE_GETNAMEINFO
+#undef getnameinfo
+#define getnameinfo getnameinfo__compat
+#endif
+#ifndef HAVE_FREEHOSTENT
+#undef freehostent
+#define freehostent freehostent__compat
+#endif
+#ifndef HAVE_FREEADDRINFO
+#undef freeaddrinfo
+#define freeaddrinfo freeaddrinfo__compat
+#endif
extern int getaddrinfo __P((
const char *hostname, const char *servname,
@@ -156,21 +164,20 @@ extern int getaddrinfo __P((
extern int getnameinfo __P((
const struct sockaddr *sa,
- size_t salen,
+ socklen_t salen,
char *host,
- size_t hostlen,
+ socklen_t hostlen,
char *serv,
- size_t servlen,
+ socklen_t servlen,
int flags));
extern void freehostent __P((struct hostent *));
extern void freeaddrinfo __P((struct addrinfo *));
-#if defined __UCLIBC__
+extern
+#ifdef GAI_STRERROR_CONST
const
#endif
-#ifndef __HAIKU__
-extern char *gai_strerror __P((int));
-#endif
+char *gai_strerror __P((int));
/* In case there is no definition of offsetof() provided - though any proper
Standard C system should have one. */
@@ -180,4 +187,3 @@ Standard C system should have one. */
#endif
#endif
-#endif