summaryrefslogtreecommitdiffstats
path: root/contrib/bind9/lib/lwres/getaddrinfo.c
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/bind9/lib/lwres/getaddrinfo.c')
-rw-r--r--contrib/bind9/lib/lwres/getaddrinfo.c54
1 files changed, 27 insertions, 27 deletions
diff --git a/contrib/bind9/lib/lwres/getaddrinfo.c b/contrib/bind9/lib/lwres/getaddrinfo.c
index 6056f24..fc53e63 100644
--- a/contrib/bind9/lib/lwres/getaddrinfo.c
+++ b/contrib/bind9/lib/lwres/getaddrinfo.c
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2004-2007 Internet Systems Consortium, Inc. ("ISC")
+ * Copyright (C) 2004-2007, 2009 Internet Systems Consortium, Inc. ("ISC")
* Copyright (C) 1999-2001 Internet Software Consortium.
*
* This code is derived from software contributed to ISC by
@@ -18,7 +18,7 @@
* IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: getaddrinfo.c,v 1.43.18.8 2007/09/13 23:46:26 tbox Exp $ */
+/* $Id: getaddrinfo.c,v 1.52.254.2 2009/03/31 23:47:16 tbox Exp $ */
/*! \file */
@@ -31,10 +31,10 @@
* string: a dotted decimal IPv4 address or an IPv6 address. servname is
* either a decimal port number or a service name as listed in
* /etc/services.
- *
+ *
* If the operating system does not provide a struct addrinfo, the
* following structure is used:
- *
+ *
* \code
* struct addrinfo {
* int ai_flags; // AI_PASSIVE, AI_CANONNAME
@@ -47,29 +47,29 @@
* struct addrinfo *ai_next; // next structure in linked list
* };
* \endcode
- *
- *
+ *
+ *
* hints is an optional pointer to a struct addrinfo. This structure can
* be used to provide hints concerning the type of socket that the caller
* supports or wishes to use. The caller can supply the following
* structure elements in *hints:
- *
+ *
* <ul>
* <li>ai_family:
* The protocol family that should be used. When ai_family is set
* to PF_UNSPEC, it means the caller will accept any protocol
* family supported by the operating system.</li>
- *
+ *
* <li>ai_socktype:
* denotes the type of socket -- SOCK_STREAM, SOCK_DGRAM or
* SOCK_RAW -- that is wanted. When ai_socktype is zero the caller
* will accept any socket type.</li>
- *
+ *
* <li>ai_protocol:
* indicates which transport protocol is wanted: IPPROTO_UDP or
* IPPROTO_TCP. If ai_protocol is zero the caller will accept any
* protocol.</li>
- *
+ *
* <li>ai_flags:
* Flag bits. If the AI_CANONNAME bit is set, a successful call to
* lwres_getaddrinfo() will return a null-terminated string
@@ -81,7 +81,7 @@
* address portion of the socket address structure will be set to
* INADDR_ANY for an IPv4 address or IN6ADDR_ANY_INIT for an IPv6
* address.<br /><br />
- *
+ *
* When ai_flags does not set the AI_PASSIVE bit, the returned
* socket address structure will be ready for use in a call to
* connect(2) for a connection-oriented protocol or connect(2),
@@ -89,18 +89,18 @@
* chosen. The IP address portion of the socket address structure
* will be set to the loopback address if hostname is a NULL
* pointer and AI_PASSIVE is not set in ai_flags.<br /><br />
- *
+ *
* If ai_flags is set to AI_NUMERICHOST it indicates that hostname
* should be treated as a numeric string defining an IPv4 or IPv6
* address and no name resolution should be attempted.
* </li></ul>
- *
+ *
* All other elements of the struct addrinfo passed via hints must be
* zero.
- *
+ *
* A hints of NULL is treated as if the caller provided a struct addrinfo
* initialized to zero with ai_familyset to PF_UNSPEC.
- *
+ *
* After a successful call to lwres_getaddrinfo(), *res is a pointer to a
* linked list of one or more addrinfo structures. Each struct addrinfo
* in this list cn be processed by following the ai_next pointer, until a
@@ -109,7 +109,7 @@
* corresponding arguments for a call to socket(2). For each addrinfo
* structure in the list, the ai_addr member points to a filled-in socket
* address structure of length ai_addrlen.
- *
+ *
* All of the information returned by lwres_getaddrinfo() is dynamically
* allocated: the addrinfo structures, and the socket address structures
* and canonical host name strings pointed to by the addrinfostructures.
@@ -117,15 +117,15 @@
* successful call to lwres_getaddrinfo() is released by
* lwres_freeaddrinfo(). ai is a pointer to a struct addrinfo created by
* a call to lwres_getaddrinfo().
- *
+ *
* \section lwresreturn RETURN VALUES
- *
+ *
* lwres_getaddrinfo() returns zero on success or one of the error codes
* listed in gai_strerror() if an error occurs. If both hostname and
* servname are NULL lwres_getaddrinfo() returns #EAI_NONAME.
- *
+ *
* \section lwressee SEE ALSO
- *
+ *
* lwres(3), lwres_getaddrinfo(), lwres_freeaddrinfo(),
* lwres_gai_strerror(), RFC2133, getservbyname(3), connect(2),
* sendto(2), sendmsg(2), socket(2).
@@ -145,7 +145,7 @@
#define SA(addr) ((struct sockaddr *)(addr))
#define SIN(addr) ((struct sockaddr_in *)(addr))
#define SIN6(addr) ((struct sockaddr_in6 *)(addr))
-#define SUN(addr) ((struct sockaddr_un *)(addr))
+#define SLOCAL(addr) ((struct sockaddr_un *)(addr))
/*! \struct addrinfo
*/
@@ -162,7 +162,7 @@ static int add_ipv4(const char *hostname, int flags, struct addrinfo **aip,
static int add_ipv6(const char *hostname, int flags, struct addrinfo **aip,
int socktype, int port);
static void set_order(int, int (**)(const char *, int, struct addrinfo **,
- int, int));
+ int, int));
#define FOUND_IPV4 0x1
#define FOUND_IPV6 0x2
@@ -384,7 +384,7 @@ lwres_getaddrinfo(const char *hostname, const char *servname,
scopeid = 0;
#endif
- if (lwres_net_pton(AF_INET, hostname, (struct in_addr *)abuf)
+ if (lwres_net_pton(AF_INET, hostname, (struct in_addr *)abuf)
== 1)
{
if (family == AF_INET6) {
@@ -709,17 +709,17 @@ lwres_freeaddrinfo(struct addrinfo *ai) {
static int
get_local(const char *name, int socktype, struct addrinfo **res) {
struct addrinfo *ai;
- struct sockaddr_un *sun;
+ struct sockaddr_un *slocal;
if (socktype == 0)
return (EAI_SOCKTYPE);
- ai = ai_alloc(AF_LOCAL, sizeof(*sun));
+ ai = ai_alloc(AF_LOCAL, sizeof(*slocal));
if (ai == NULL)
return (EAI_MEMORY);
- sun = SUN(ai->ai_addr);
- strncpy(sun->sun_path, name, sizeof(sun->sun_path));
+ slocal = SLOCAL(ai->ai_addr);
+ strncpy(slocal->sun_path, name, sizeof(slocal->sun_path));
ai->ai_socktype = socktype;
/*
OpenPOWER on IntegriCloud