lwres_getipnode.html revision cedb0bd0c1e3c461b7e479a16d3adfd5b150f1f4
6c3e745a94ef6b25a4ef9f018d350a7535aa45afTed Gould - Copyright (C) 2004, 2005 Internet Systems Consortium, Inc. ("ISC")
70eb1fc448cb08acf3468f80fa2296c03b32afd2cilix - Copyright (C) 2000, 2001, 2003 Internet Software Consortium.
6c3e745a94ef6b25a4ef9f018d350a7535aa45afTed Gould - Permission to use, copy, modify, and distribute this software for any
6c3e745a94ef6b25a4ef9f018d350a7535aa45afTed Gould - purpose with or without fee is hereby granted, provided that the above
70eb1fc448cb08acf3468f80fa2296c03b32afd2cilix - copyright notice and this permission notice appear in all copies.
70eb1fc448cb08acf3468f80fa2296c03b32afd2cilix - THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
70eb1fc448cb08acf3468f80fa2296c03b32afd2cilix - REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
70eb1fc448cb08acf3468f80fa2296c03b32afd2cilix - AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
70eb1fc448cb08acf3468f80fa2296c03b32afd2cilix - INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
70eb1fc448cb08acf3468f80fa2296c03b32afd2cilix - LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
70eb1fc448cb08acf3468f80fa2296c03b32afd2cilix - OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
70eb1fc448cb08acf3468f80fa2296c03b32afd2cilix - PERFORMANCE OF THIS SOFTWARE.
70eb1fc448cb08acf3468f80fa2296c03b32afd2cilix<!-- $Id: lwres_getipnode.html,v 1.20 2005/10/13 03:14:02 marka Exp $ -->
70eb1fc448cb08acf3468f80fa2296c03b32afd2cilix<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
70eb1fc448cb08acf3468f80fa2296c03b32afd2cilix<meta name="generator" content="DocBook XSL Stylesheets V1.69.1">
70eb1fc448cb08acf3468f80fa2296c03b32afd2cilix<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="refentry" lang="en">
36285e420d3124dfe8cd2c5a8ac5a76bf7cdd4c6cilix<p>lwres_getipnodebyname, lwres_getipnodebyaddr, lwres_freehostent — lightweight resolver nodename / address translation API</p>
5b20351508dc029f37f23fb7add6d0b43bf47f20johanengelen<pre class="funcsynopsisinfo">#include <lwres/netdb.h></pre>
5b20351508dc029f37f23fb7add6d0b43bf47f20johanengelen<table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0" style="padding-bottom: 1em">
36285e420d3124dfe8cd2c5a8ac5a76bf7cdd4c6cilixstruct hostent *
36285e420d3124dfe8cd2c5a8ac5a76bf7cdd4c6cilix<b class="fsfunc">lwres_getipnodebyname</b>(</code></td>
70eb1fc448cb08acf3468f80fa2296c03b32afd2cilix<var class="pdparam">error_num</var><code>)</code>;</td>
70eb1fc448cb08acf3468f80fa2296c03b32afd2cilix<table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0" style="padding-bottom: 1em">
70eb1fc448cb08acf3468f80fa2296c03b32afd2cilixstruct hostent *
70eb1fc448cb08acf3468f80fa2296c03b32afd2cilix<b class="fsfunc">lwres_getipnodebyaddr</b>(</code></td>
70eb1fc448cb08acf3468f80fa2296c03b32afd2cilix<var class="pdparam">error_num</var><code>)</code>;</td>
70eb1fc448cb08acf3468f80fa2296c03b32afd2cilix<table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0"><tr>
70eb1fc448cb08acf3468f80fa2296c03b32afd2cilix These functions perform thread safe, protocol independent
70eb1fc448cb08acf3468f80fa2296c03b32afd2cilix nodename-to-address and address-to-nodename
70eb1fc448cb08acf3468f80fa2296c03b32afd2cilix translation as defined in RFC2553.
70eb1fc448cb08acf3468f80fa2296c03b32afd2cilix which is defined in
70eb1fc448cb08acf3468f80fa2296c03b32afd2cilixstruct hostent {
70eb1fc448cb08acf3468f80fa2296c03b32afd2cilix char *h_name; /* official name of host */
70eb1fc448cb08acf3468f80fa2296c03b32afd2cilix char **h_aliases; /* alias list */
70eb1fc448cb08acf3468f80fa2296c03b32afd2cilix int h_addrtype; /* host address type */
70eb1fc448cb08acf3468f80fa2296c03b32afd2cilix int h_length; /* length of address */
70eb1fc448cb08acf3468f80fa2296c03b32afd2cilix char **h_addr_list; /* list of addresses from name server */
70eb1fc448cb08acf3468f80fa2296c03b32afd2cilix#define h_addr h_addr_list[0] /* address, for backward compatibility */
70eb1fc448cb08acf3468f80fa2296c03b32afd2cilix The members of this structure are:
70eb1fc448cb08acf3468f80fa2296c03b32afd2cilix<dt><span class="term"><code class="constant">h_name</code></span></dt>
70eb1fc448cb08acf3468f80fa2296c03b32afd2cilix The official (canonical) name of the host.
70eb1fc448cb08acf3468f80fa2296c03b32afd2cilix<dt><span class="term"><code class="constant">h_aliases</code></span></dt>
70eb1fc448cb08acf3468f80fa2296c03b32afd2cilix A NULL-terminated array of alternate names (nicknames) for the
70eb1fc448cb08acf3468f80fa2296c03b32afd2cilix<dt><span class="term"><code class="constant">h_addrtype</code></span></dt>
36285e420d3124dfe8cd2c5a8ac5a76bf7cdd4c6cilix The type of address being returned - usually
36285e420d3124dfe8cd2c5a8ac5a76bf7cdd4c6cilix<dt><span class="term"><code class="constant">h_length</code></span></dt>
36285e420d3124dfe8cd2c5a8ac5a76bf7cdd4c6cilix The length of the address in bytes.
36285e420d3124dfe8cd2c5a8ac5a76bf7cdd4c6cilix<dt><span class="term"><code class="constant">h_addr_list</code></span></dt>
36285e420d3124dfe8cd2c5a8ac5a76bf7cdd4c6cilix terminated array of network addresses for the host.
5b20351508dc029f37f23fb7add6d0b43bf47f20johanengelen Host addresses are returned in network byte order.
36285e420d3124dfe8cd2c5a8ac5a76bf7cdd4c6cilix<p><code class="function">lwres_getipnodebyname()</code>
5b20351508dc029f37f23fb7add6d0b43bf47f20johanengelen looks up addresses of protocol family <em class="parameter"><code>af</code></em>
947fb2f89245c19c5bad9dbefb9fd44c2aaed2eccilix for the hostname <em class="parameter"><code>name</code></em>. The
c3521f69a168bb569f01c674683489ea8e98f7f5johanengelen <em class="parameter"><code>flags</code></em> parameter contains ORed flag bits
c3521f69a168bb569f01c674683489ea8e98f7f5johanengelen to specify the types of addresses that are searched for, and the
36285e420d3124dfe8cd2c5a8ac5a76bf7cdd4c6cilix types of addresses that are returned. The flag bits are:
36285e420d3124dfe8cd2c5a8ac5a76bf7cdd4c6cilix<dt><span class="term"><code class="constant">AI_V4MAPPED</code></span></dt>
36285e420d3124dfe8cd2c5a8ac5a76bf7cdd4c6cilix This is used with an
36285e420d3124dfe8cd2c5a8ac5a76bf7cdd4c6cilix of AF_INET6, and causes IPv4 addresses to be returned as
36285e420d3124dfe8cd2c5a8ac5a76bf7cdd4c6cilix IPv4-mapped
36285e420d3124dfe8cd2c5a8ac5a76bf7cdd4c6cilix IPv6 addresses.
36285e420d3124dfe8cd2c5a8ac5a76bf7cdd4c6cilix<dt><span class="term"><code class="constant">AI_ALL</code></span></dt>
70eb1fc448cb08acf3468f80fa2296c03b32afd2cilix This is used with an
70eb1fc448cb08acf3468f80fa2296c03b32afd2cilix of AF_INET6, and causes all known addresses (IPv6 and IPv4) to
70eb1fc448cb08acf3468f80fa2296c03b32afd2cilix be returned.
70eb1fc448cb08acf3468f80fa2296c03b32afd2cilix If AI_V4MAPPED is also set, the IPv4 addresses are return as
70eb1fc448cb08acf3468f80fa2296c03b32afd2cilix IPv6 addresses.
70eb1fc448cb08acf3468f80fa2296c03b32afd2cilix<dt><span class="term"><code class="constant">AI_ADDRCONFIG</code></span></dt>
70eb1fc448cb08acf3468f80fa2296c03b32afd2cilix Only return an IPv6 or IPv4 address if here is an active network
70eb1fc448cb08acf3468f80fa2296c03b32afd2cilix interface of that type. This is not currently implemented
6c3e745a94ef6b25a4ef9f018d350a7535aa45afTed Gould in the BIND 9 lightweight resolver, and the flag is ignored.