2N/A - Copyright (C) 2004, 2005, 2007, 2014, 2015 Internet Systems Consortium, Inc. ("ISC") 2N/A - Copyright (C) 2000, 2001, 2003 Internet Software Consortium. 2N/A - Permission to use, copy, modify, and/or distribute this software for any 2N/A - purpose with or without fee is hereby granted, provided that the above 2N/A - copyright notice and this permission notice appear in all copies. 2N/A - THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH 2N/A - REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY 2N/A - AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, 2N/A - INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM 2N/A - LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE 2N/A - OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR 2N/A - PERFORMANCE OF THIS SOFTWARE. 2N/A<!-- Converted by db4-upgrade version 1.0 --> 2N/A <
date>2007-06-18</
date>
2N/A <
corpname>ISC</
corpname>
2N/A <
corpauthor>Internet Systems Consortium, Inc.</
corpauthor>
2N/A <
refentrytitle>lwres_getipnode</
refentrytitle>
2N/A <
manvolnum>3</
manvolnum>
2N/A <
refmiscinfo>BIND9</
refmiscinfo>
2N/A <
holder>Internet Systems Consortium, Inc. ("ISC")</
holder>
2N/A <
holder>Internet Software Consortium.</
holder>
2N/A <
refname>lwres_getipnodebyname</
refname>
2N/A <
refname>lwres_getipnodebyaddr</
refname>
2N/A <
refname>lwres_freehostent</
refname>
2N/A <
refpurpose>lightweight resolver nodename / address translation API</
refpurpose>
2N/A<
function>lwres_getipnodebyname</
function></
funcdef>
2N/A <
paramdef>const char *<
parameter>name</
parameter></
paramdef>
2N/A <
paramdef>int <
parameter>af</
parameter></
paramdef>
2N/A <
paramdef>int <
parameter>flags</
parameter></
paramdef>
2N/A <
paramdef>int *<
parameter>error_num</
parameter></
paramdef>
2N/A<
function>lwres_getipnodebyaddr</
function></
funcdef>
2N/A <
paramdef>const void *<
parameter>src</
parameter></
paramdef>
2N/A <
paramdef>size_t <
parameter>len</
parameter></
paramdef>
2N/A <
paramdef>int <
parameter>af</
parameter></
paramdef>
2N/A <
paramdef>int *<
parameter>error_num</
parameter></
paramdef>
2N/A<
function>lwres_freehostent</
function></
funcdef>
2N/A <
paramdef>struct hostent *<
parameter>he</
parameter></
paramdef>
2N/A <
refsection><
info><
title>DESCRIPTION</
title></
info>
2N/A These functions perform thread safe, protocol independent
2N/A nodename-to-address and address-to-nodename
2N/A translation as defined in RFC2553.
2N/A <
type>struct hostent</
type>
2N/A <
para><
programlisting>
2N/A char *h_name; /* official name of host */
2N/A char **h_aliases; /* alias list */
2N/A int h_addrtype; /* host address type */
2N/A int h_length; /* length of address */
2N/A char **h_addr_list; /* list of addresses from name server */
2N/A#define h_addr h_addr_list[0] /* address, for backward compatibility */
2N/A The members of this structure are:
2N/A <
term><
constant>h_name</
constant></
term>
2N/A The official (canonical) name of the host.
2N/A <
term><
constant>h_aliases</
constant></
term>
2N/A A NULL-terminated array of alternate names (nicknames) for the
2N/A <
term><
constant>h_addrtype</
constant></
term>
2N/A The type of address being returned - usually
2N/A <
type>PF_INET</
type>
2N/A <
type>PF_INET6</
type>.
2N/A <
term><
constant>h_length</
constant></
term>
2N/A The length of the address in bytes.
2N/A <
term><
constant>h_addr_list</
constant></
term>
2N/A terminated array of network addresses for the host.
2N/A Host addresses are returned in network byte order.
2N/A <
para><
function>lwres_getipnodebyname()</
function>
2N/A looks up addresses of protocol family <
parameter>af</
parameter>
2N/A for the hostname <
parameter>name</
parameter>. The
2N/A <
parameter>flags</
parameter> parameter contains ORed flag bits
2N/A to specify the types of addresses that are searched for, and the
2N/A types of addresses that are returned. The flag bits are:
2N/A <
term><
constant>AI_V4MAPPED</
constant></
term>
2N/A This is used with an
2N/A <
parameter>af</
parameter>
2N/A of AF_INET6, and causes IPv4 addresses to be returned as
2N/A <
term><
constant>AI_ALL</
constant></
term>
2N/A This is used with an
2N/A <
parameter>af</
parameter>
2N/A of AF_INET6, and causes all known addresses (IPv6 and IPv4) to
2N/A If AI_V4MAPPED is also set, the IPv4 addresses are return as
2N/A <
term><
constant>AI_ADDRCONFIG</
constant></
term>
2N/A Only return an IPv6 or IPv4 address if here is an active network
2N/A interface of that type. This is not currently implemented
2N/A in the BIND 9 lightweight resolver, and the flag is ignored.
2N/A <
term><
constant>AI_DEFAULT</
constant></
term>
2N/A This default sets the
2N/A <
constant>AI_V4MAPPED</
constant>
2N/A <
constant>AI_ADDRCONFIG</
constant>
2N/A <
para><
function>lwres_getipnodebyaddr()</
function>
2N/A performs a reverse lookup of address <
parameter>src</
parameter>
2N/A which is <
parameter>len</
parameter> bytes long.
2N/A <
parameter>af</
parameter> denotes the protocol family, typically
2N/A <
type>PF_INET</
type> or <
type>PF_INET6</
type>.
2N/A <
para><
function>lwres_freehostent()</
function>
2N/A releases all the memory associated with the <
type>struct
2N/A hostent</
type> pointer <
parameter>he</
parameter>. Any memory
2N/A allocated for the <
constant>h_name</
constant>,
2N/A <
constant>h_addr_list</
constant> and
2N/A <
constant>h_aliases</
constant> is freed, as is the memory for
2N/A the <
type>hostent</
type> structure itself.
2N/A <
refsection><
info><
title>RETURN VALUES</
title></
info>
2N/A <
function>lwres_getipnodebyname()</
function>
2N/A <
function>lwres_getipnodebyaddr()</
function>
2N/A <
parameter>*error_num</
parameter>
2N/A to an appropriate error code and the function returns a
2N/A The error codes and their meanings are defined in
2N/A <
term><
constant>HOST_NOT_FOUND</
constant></
term>
2N/A No such host is known.
2N/A <
term><
constant>NO_ADDRESS</
constant></
term>
2N/A The server recognised the request and the name but no address is
2N/A available. Another type of request to the name server for the
2N/A domain might return an answer.
2N/A <
term><
constant>TRY_AGAIN</
constant></
term>
2N/A A temporary and possibly transient error occurred, such as a
2N/A failure of a server to respond. The request may succeed if
2N/A <
term><
constant>NO_RECOVERY</
constant></
term>
2N/A An unexpected failure occurred, and retrying the request
2N/A <
para><
citerefentry>
2N/A <
refentrytitle>lwres_hstrerror</
refentrytitle><
manvolnum>3</
manvolnum>
2N/A translates these error codes to suitable error messages.
2N/A <
refsection><
info><
title>SEE ALSO</
title></
info>
2N/A <
para><
citerefentry>
2N/A <
refentrytitle>RFC2553</
refentrytitle>
2N/A <
refentrytitle>lwres</
refentrytitle><
manvolnum>3</
manvolnum>
2N/A <
refentrytitle>lwres_gethostent</
refentrytitle><
manvolnum>3</
manvolnum>
2N/A <
refentrytitle>lwres_getaddrinfo</
refentrytitle><
manvolnum>3</
manvolnum>
2N/A <
refentrytitle>lwres_getnameinfo</
refentrytitle><
manvolnum>3</
manvolnum>
2N/A <
refentrytitle>lwres_hstrerror</
refentrytitle><
manvolnum>3</
manvolnum>