diff options
Diffstat (limited to 'ext/socket/addrinfo.h')
| -rw-r--r-- | ext/socket/addrinfo.h | 79 |
1 files changed, 48 insertions, 31 deletions
diff --git a/ext/socket/addrinfo.h b/ext/socket/addrinfo.h index a22615ee00..eb9eb8ae0e 100644 --- a/ext/socket/addrinfo.h +++ b/ext/socket/addrinfo.h @@ -1,7 +1,7 @@ /* * Copyright (C) 1995, 1996, 1997, 1998, and 1999 WIDE Project. * All rights reserved. - * + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: @@ -13,7 +13,7 @@ * 3. Neither the name of the project nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. - * + * * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE @@ -29,7 +29,6 @@ #ifndef ADDR_INFO_H #define ADDR_INFO_H -#ifndef HAVE_GETADDRINFO /* special compatibility hack */ #undef EAI_ADDRFAMILY @@ -50,6 +49,7 @@ #undef AI_PASSIVE #undef AI_CANONNAME #undef AI_NUMERICHOST +#undef AI_NUMERICSERV #undef AI_ALL #undef AI_ADDRCONFIG #undef AI_V4MAPPED @@ -61,12 +61,6 @@ #undef NI_NUMERICSERV #undef NI_DGRAM -#define addrinfo addrinfo__compat -#define getaddrinfo getaddrinfo__compat -#define getnameinfo getnameinfo__compat -#define freehostent freehostent__compat -#define freeaddrinfo freeaddrinfo__compat - #ifndef __P # ifdef HAVE_PROTOTYPES # define __P(args) args @@ -102,8 +96,12 @@ #define AI_PASSIVE 0x00000001 /* get address to use bind() */ #define AI_CANONNAME 0x00000002 /* fill ai_canonname */ #define AI_NUMERICHOST 0x00000004 /* prevent name resolution */ +#define AI_NUMERICSERV 0x00000008 /* prevent service name resolution */ /* valid flags for addrinfo */ -#define AI_MASK (AI_PASSIVE | AI_CANONNAME | AI_NUMERICHOST) +#ifndef __HAIKU__ +#undef AI_MASK +#define AI_MASK (AI_PASSIVE | AI_CANONNAME | AI_NUMERICHOST | AI_NUMERICSERV) +#endif #define AI_ALL 0x00000100 /* IPv6 and IPv4-mapped (with AI_V4MAPPED) */ #define AI_V4MAPPED_CFG 0x00000200 /* accept IPv4-mapped if kernel supports */ @@ -129,37 +127,57 @@ #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 */ - int ai_socktype; /* SOCK_xxx */ - int ai_protocol; /* 0 or IPPROTO_xxx for IPv4 and IPv6 */ - size_t ai_addrlen; /* length of ai_addr */ - char *ai_canonname; /* canonical name for hostname */ - struct sockaddr *ai_addr; /* binary address */ - struct addrinfo *ai_next; /* next structure in linked list */ + int ai_flags; /* AI_PASSIVE, AI_CANONNAME */ + int ai_family; /* PF_xxx */ + int ai_socktype; /* SOCK_xxx */ + int ai_protocol; /* 0 or IPPROTO_xxx for IPv4 and IPv6 */ + size_t ai_addrlen; /* length of ai_addr */ + char *ai_canonname; /* canonical name for hostname */ + 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, - const struct addrinfo *hints, - struct addrinfo **res)); + const char *hostname, const char *servname, + const struct addrinfo *hints, + struct addrinfo **res)); extern int getnameinfo __P(( - const struct sockaddr *sa, - size_t salen, - char *host, - size_t hostlen, - char *serv, - size_t servlen, - int flags)); + const struct sockaddr *sa, + socklen_t salen, + char *host, + socklen_t hostlen, + char *serv, + 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 -extern char *gai_strerror __P((int)); +char *gai_strerror __P((int)); /* In case there is no definition of offsetof() provided - though any proper Standard C system should have one. */ @@ -169,4 +187,3 @@ Standard C system should have one. */ #endif #endif -#endif |
