lwres_getaddrinfo.html revision 2eeb74d1cf5355dd98f6d507a10086e16bb08c4b
040abec2534dadc53ebc8fa378ef03f4feecb7dbvboxsync - Copyright (C) 2004, 2005, 2007, 2014 Internet Systems Consortium, Inc. ("ISC")
040abec2534dadc53ebc8fa378ef03f4feecb7dbvboxsync - Copyright (C) 2000, 2001, 2003 Internet Software Consortium.
040abec2534dadc53ebc8fa378ef03f4feecb7dbvboxsync - Permission to use, copy, modify, and/or distribute this software for any
040abec2534dadc53ebc8fa378ef03f4feecb7dbvboxsync - purpose with or without fee is hereby granted, provided that the above
040abec2534dadc53ebc8fa378ef03f4feecb7dbvboxsync - copyright notice and this permission notice appear in all copies.
040abec2534dadc53ebc8fa378ef03f4feecb7dbvboxsync - THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
040abec2534dadc53ebc8fa378ef03f4feecb7dbvboxsync - REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
040abec2534dadc53ebc8fa378ef03f4feecb7dbvboxsync - AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
040abec2534dadc53ebc8fa378ef03f4feecb7dbvboxsync - INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
040abec2534dadc53ebc8fa378ef03f4feecb7dbvboxsync - LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
040abec2534dadc53ebc8fa378ef03f4feecb7dbvboxsync - OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
040abec2534dadc53ebc8fa378ef03f4feecb7dbvboxsync - PERFORMANCE OF THIS SOFTWARE.
040abec2534dadc53ebc8fa378ef03f4feecb7dbvboxsync<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
040abec2534dadc53ebc8fa378ef03f4feecb7dbvboxsync<meta name="generator" content="DocBook XSL Stylesheets V1.76.1">
040abec2534dadc53ebc8fa378ef03f4feecb7dbvboxsync<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="refentry" title="lwres_getaddrinfo">
040abec2534dadc53ebc8fa378ef03f4feecb7dbvboxsync<a name="idp60785488"></a><div class="titlepage"></div>
040abec2534dadc53ebc8fa378ef03f4feecb7dbvboxsync lwres_getaddrinfo,
040abec2534dadc53ebc8fa378ef03f4feecb7dbvboxsync lwres_freeaddrinfo
040abec2534dadc53ebc8fa378ef03f4feecb7dbvboxsync — socket address structure to host and service name
040abec2534dadc53ebc8fa378ef03f4feecb7dbvboxsync<pre class="funcsynopsisinfo">#include <lwres/netdb.h></pre>
040abec2534dadc53ebc8fa378ef03f4feecb7dbvboxsync<table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0" class="funcprototype-table">
040abec2534dadc53ebc8fa378ef03f4feecb7dbvboxsync<b class="fsfunc">lwres_getaddrinfo</b>(</code></td>
040abec2534dadc53ebc8fa378ef03f4feecb7dbvboxsync<td>const char *<var class="pdparam">hostname</var>, </td>
040abec2534dadc53ebc8fa378ef03f4feecb7dbvboxsync<td>const char *<var class="pdparam">servname</var>, </td>
040abec2534dadc53ebc8fa378ef03f4feecb7dbvboxsync<td>const struct addrinfo *<var class="pdparam">hints</var>, </td>
040abec2534dadc53ebc8fa378ef03f4feecb7dbvboxsync<td>struct addrinfo **<var class="pdparam">res</var><code>)</code>;</td>
040abec2534dadc53ebc8fa378ef03f4feecb7dbvboxsync<table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0" class="funcprototype-table"><tr>
040abec2534dadc53ebc8fa378ef03f4feecb7dbvboxsync<b class="fsfunc">lwres_freeaddrinfo</b>(</code></td>
040abec2534dadc53ebc8fa378ef03f4feecb7dbvboxsync<td>struct addrinfo *<var class="pdparam">ai</var><code>)</code>;</td>
040abec2534dadc53ebc8fa378ef03f4feecb7dbvboxsync If the operating system does not provide a
040abec2534dadc53ebc8fa378ef03f4feecb7dbvboxsync the following structure is used:
040abec2534dadc53ebc8fa378ef03f4feecb7dbvboxsyncstruct addrinfo {
040abec2534dadc53ebc8fa378ef03f4feecb7dbvboxsync int ai_flags; /* AI_PASSIVE, AI_CANONNAME */
040abec2534dadc53ebc8fa378ef03f4feecb7dbvboxsync int ai_family; /* PF_xxx */
040abec2534dadc53ebc8fa378ef03f4feecb7dbvboxsync int ai_socktype; /* SOCK_xxx */
040abec2534dadc53ebc8fa378ef03f4feecb7dbvboxsync int ai_protocol; /* 0 or IPPROTO_xxx for IPv4 and IPv6 */
040abec2534dadc53ebc8fa378ef03f4feecb7dbvboxsync size_t ai_addrlen; /* length of ai_addr */
040abec2534dadc53ebc8fa378ef03f4feecb7dbvboxsync char *ai_canonname; /* canonical name for hostname */
040abec2534dadc53ebc8fa378ef03f4feecb7dbvboxsync struct sockaddr *ai_addr; /* binary address */
040abec2534dadc53ebc8fa378ef03f4feecb7dbvboxsync struct addrinfo *ai_next; /* next structure in linked list */
040abec2534dadc53ebc8fa378ef03f4feecb7dbvboxsync <p><code class="function">lwres_getaddrinfo()</code>
040abec2534dadc53ebc8fa378ef03f4feecb7dbvboxsync is used to get a list of IP addresses and port numbers for host
040abec2534dadc53ebc8fa378ef03f4feecb7dbvboxsync <em class="parameter"><code>hostname</code></em> and service
040abec2534dadc53ebc8fa378ef03f4feecb7dbvboxsync The function is the lightweight resolver's implementation of
040abec2534dadc53ebc8fa378ef03f4feecb7dbvboxsync <code class="function">getaddrinfo()</code> as defined in RFC2133.
040abec2534dadc53ebc8fa378ef03f4feecb7dbvboxsync <em class="parameter"><code>hostname</code></em> and
040abec2534dadc53ebc8fa378ef03f4feecb7dbvboxsync <em class="parameter"><code>servname</code></em> are pointers to null-terminated
040abec2534dadc53ebc8fa378ef03f4feecb7dbvboxsync <em class="parameter"><code>hostname</code></em> is either a host name or a
040abec2534dadc53ebc8fa378ef03f4feecb7dbvboxsync numeric host address string: a dotted decimal IPv4 address or an
040abec2534dadc53ebc8fa378ef03f4feecb7dbvboxsync IPv6 address. <em class="parameter"><code>servname</code></em> is either a
040abec2534dadc53ebc8fa378ef03f4feecb7dbvboxsync decimal port number or a service name as listed in
040abec2534dadc53ebc8fa378ef03f4feecb7dbvboxsync is an optional pointer to a
040abec2534dadc53ebc8fa378ef03f4feecb7dbvboxsync This structure can be used to provide hints concerning the type of
040abec2534dadc53ebc8fa378ef03f4feecb7dbvboxsync that the caller supports or wishes to use.
040abec2534dadc53ebc8fa378ef03f4feecb7dbvboxsync The caller can supply the following structure elements in
040abec2534dadc53ebc8fa378ef03f4feecb7dbvboxsync<dt><span class="term"><code class="constant">ai_family</code></span></dt>
040abec2534dadc53ebc8fa378ef03f4feecb7dbvboxsync The protocol family that should be used.
040abec2534dadc53ebc8fa378ef03f4feecb7dbvboxsync it means the caller will accept any protocol family supported by
040abec2534dadc53ebc8fa378ef03f4feecb7dbvboxsync operating system.
040abec2534dadc53ebc8fa378ef03f4feecb7dbvboxsync<dt><span class="term"><code class="constant">ai_socktype</code></span></dt>
040abec2534dadc53ebc8fa378ef03f4feecb7dbvboxsync denotes the type of socket —
040abec2534dadc53ebc8fa378ef03f4feecb7dbvboxsync — that is wanted.
040abec2534dadc53ebc8fa378ef03f4feecb7dbvboxsync is zero the caller will accept any socket type.
040abec2534dadc53ebc8fa378ef03f4feecb7dbvboxsync<dt><span class="term"><code class="constant">ai_protocol</code></span></dt>