lwres_gethostent.docbook revision 19c7b1a0293498a3e36692c59646ed6e15ffc8d0
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews<!DOCTYPE book [
11e9368a226272085c337e9e74b79808c16fbdbaTinderbox User<!ENTITY mdash "&#8212;">]>
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews<!--
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews - Copyright (C) 2004, 2005, 2007, 2014, 2015 Internet Systems Consortium, Inc. ("ISC")
4a14ce5ba00ab7bc55c99ffdcf59c7a4ab902721Automatic Updater - Copyright (C) 2001 Internet Software Consortium.
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews -
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews - Permission to use, copy, modify, and/or distribute this software for any
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews - purpose with or without fee is hereby granted, provided that the above
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews - copyright notice and this permission notice appear in all copies.
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews -
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews - THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews - REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews - AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews - INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews - LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews - OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews - PERFORMANCE OF THIS SOFTWARE.
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews-->
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews<!-- Converted by db4-upgrade version 1.0 -->
fd2597f75693a2279fdf588bd40dfe2407c42028Tinderbox User<refentry xmlns="http://docbook.org/ns/docbook" version="5.0">
14a656f94b1fd0ababd84a772228dfa52276ba15Evan Hunt <info>
cd32f419a8a5432fbb139f56ee73cbf68b9350ccTinderbox User <date>2007-06-18</date>
0c6ada0a814f3c5417daa1654129bc2af56ed504Automatic Updater </info>
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews <refentryinfo>
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews <corpname>ISC</corpname>
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews <corpauthor>Internet Systems Consortium, Inc.</corpauthor>
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews </refentryinfo>
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews <refmeta>
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews <refentrytitle>lwres_gethostent</refentrytitle>
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews <manvolnum>3</manvolnum>
0c6ada0a814f3c5417daa1654129bc2af56ed504Automatic Updater <refmiscinfo>BIND9</refmiscinfo>
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews </refmeta>
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews <docinfo>
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews <copyright>
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews <year>2004</year>
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews <year>2005</year>
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews <year>2007</year>
fd2597f75693a2279fdf588bd40dfe2407c42028Tinderbox User <year>2014</year>
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews <year>2015</year>
fd2597f75693a2279fdf588bd40dfe2407c42028Tinderbox User <holder>Internet Systems Consortium, Inc. ("ISC")</holder>
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews </copyright>
fd2597f75693a2279fdf588bd40dfe2407c42028Tinderbox User <copyright>
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews <year>2001</year>
fd2597f75693a2279fdf588bd40dfe2407c42028Tinderbox User <holder>Internet Software Consortium.</holder>
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews </copyright>
fd2597f75693a2279fdf588bd40dfe2407c42028Tinderbox User </docinfo>
fd2597f75693a2279fdf588bd40dfe2407c42028Tinderbox User
fd2597f75693a2279fdf588bd40dfe2407c42028Tinderbox User <refnamediv>
fd2597f75693a2279fdf588bd40dfe2407c42028Tinderbox User <refname>lwres_gethostbyname</refname>
fd2597f75693a2279fdf588bd40dfe2407c42028Tinderbox User <refname>lwres_gethostbyname2</refname>
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews <refname>lwres_gethostbyaddr</refname>
14a656f94b1fd0ababd84a772228dfa52276ba15Evan Hunt <refname>lwres_gethostent</refname>
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews <refname>lwres_sethostent</refname>
14a656f94b1fd0ababd84a772228dfa52276ba15Evan Hunt <refname>lwres_endhostent</refname>
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews <refname>lwres_gethostbyname_r</refname>
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews <refname>lwres_gethostbyaddr_r</refname>
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews <refname>lwres_gethostent_r</refname>
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews <refname>lwres_sethostent_r</refname>
fd2597f75693a2279fdf588bd40dfe2407c42028Tinderbox User <refname>lwres_endhostent_r</refname>
b2f07642fd712c8fda81a116bcdde229ab291f33Tinderbox User <refpurpose>lightweight resolver get network host entry</refpurpose>
b2f07642fd712c8fda81a116bcdde229ab291f33Tinderbox User </refnamediv>
b2f07642fd712c8fda81a116bcdde229ab291f33Tinderbox User <refsynopsisdiv>
14a656f94b1fd0ababd84a772228dfa52276ba15Evan Hunt <funcsynopsis>
b2f07642fd712c8fda81a116bcdde229ab291f33Tinderbox User<funcsynopsisinfo>#include &lt;lwres/netdb.h&gt;</funcsynopsisinfo>
b2f07642fd712c8fda81a116bcdde229ab291f33Tinderbox User<funcprototype>
b2f07642fd712c8fda81a116bcdde229ab291f33Tinderbox User <funcdef>
b2f07642fd712c8fda81a116bcdde229ab291f33Tinderbox Userstruct hostent *
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews<function>lwres_gethostbyname</function></funcdef>
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews <paramdef>const char *<parameter>name</parameter></paramdef>
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews </funcprototype>
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews<funcprototype>
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews <funcdef>
fd2597f75693a2279fdf588bd40dfe2407c42028Tinderbox Userstruct hostent *
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews<function>lwres_gethostbyname2</function></funcdef>
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews <paramdef>const char *<parameter>name</parameter></paramdef>
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews <paramdef>int <parameter>af</parameter></paramdef>
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews </funcprototype>
fd2597f75693a2279fdf588bd40dfe2407c42028Tinderbox User<funcprototype>
fd2597f75693a2279fdf588bd40dfe2407c42028Tinderbox User <funcdef>
fd2597f75693a2279fdf588bd40dfe2407c42028Tinderbox Userstruct hostent *
fd2597f75693a2279fdf588bd40dfe2407c42028Tinderbox User<function>lwres_gethostbyaddr</function></funcdef>
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews <paramdef>const char *<parameter>addr</parameter></paramdef>
fd2597f75693a2279fdf588bd40dfe2407c42028Tinderbox User <paramdef>int <parameter>len</parameter></paramdef>
659d063f23a35d77ad5826e6556d3137672bb937Tinderbox User <paramdef>int <parameter>type</parameter></paramdef>
659d063f23a35d77ad5826e6556d3137672bb937Tinderbox User </funcprototype>
659d063f23a35d77ad5826e6556d3137672bb937Tinderbox User<funcprototype>
659d063f23a35d77ad5826e6556d3137672bb937Tinderbox User <funcdef>
fd2597f75693a2279fdf588bd40dfe2407c42028Tinderbox Userstruct hostent *
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews<function>lwres_gethostent</function></funcdef>
fd2597f75693a2279fdf588bd40dfe2407c42028Tinderbox User <paramdef>void</paramdef>
659d063f23a35d77ad5826e6556d3137672bb937Tinderbox User </funcprototype>
659d063f23a35d77ad5826e6556d3137672bb937Tinderbox User<funcprototype>
659d063f23a35d77ad5826e6556d3137672bb937Tinderbox User <funcdef>
fd2597f75693a2279fdf588bd40dfe2407c42028Tinderbox Uservoid
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews<function>lwres_sethostent</function></funcdef>
fd2597f75693a2279fdf588bd40dfe2407c42028Tinderbox User <paramdef>int <parameter>stayopen</parameter></paramdef>
659d063f23a35d77ad5826e6556d3137672bb937Tinderbox User </funcprototype>
659d063f23a35d77ad5826e6556d3137672bb937Tinderbox User<funcprototype>
659d063f23a35d77ad5826e6556d3137672bb937Tinderbox User <funcdef>
659d063f23a35d77ad5826e6556d3137672bb937Tinderbox Uservoid
659d063f23a35d77ad5826e6556d3137672bb937Tinderbox User<function>lwres_endhostent</function></funcdef>
659d063f23a35d77ad5826e6556d3137672bb937Tinderbox User <paramdef>void</paramdef>
659d063f23a35d77ad5826e6556d3137672bb937Tinderbox User </funcprototype>
fd2597f75693a2279fdf588bd40dfe2407c42028Tinderbox User<funcprototype>
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews <funcdef>
fd2597f75693a2279fdf588bd40dfe2407c42028Tinderbox Userstruct hostent *
659d063f23a35d77ad5826e6556d3137672bb937Tinderbox User<function>lwres_gethostbyname_r</function></funcdef>
659d063f23a35d77ad5826e6556d3137672bb937Tinderbox User <paramdef>const char *<parameter>name</parameter></paramdef>
14a656f94b1fd0ababd84a772228dfa52276ba15Evan Hunt <paramdef>struct hostent *<parameter>resbuf</parameter></paramdef>
659d063f23a35d77ad5826e6556d3137672bb937Tinderbox User <paramdef>char *<parameter>buf</parameter></paramdef>
14a656f94b1fd0ababd84a772228dfa52276ba15Evan Hunt <paramdef>int <parameter>buflen</parameter></paramdef>
659d063f23a35d77ad5826e6556d3137672bb937Tinderbox User <paramdef>int *<parameter>error</parameter></paramdef>
fd2597f75693a2279fdf588bd40dfe2407c42028Tinderbox User </funcprototype>
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews<funcprototype>
fd2597f75693a2279fdf588bd40dfe2407c42028Tinderbox User <funcdef>
659d063f23a35d77ad5826e6556d3137672bb937Tinderbox Userstruct hostent *
659d063f23a35d77ad5826e6556d3137672bb937Tinderbox User<function>lwres_gethostbyaddr_r</function></funcdef>
659d063f23a35d77ad5826e6556d3137672bb937Tinderbox User <paramdef>const char *<parameter>addr</parameter></paramdef>
659d063f23a35d77ad5826e6556d3137672bb937Tinderbox User <paramdef>int <parameter>len</parameter></paramdef>
fd2597f75693a2279fdf588bd40dfe2407c42028Tinderbox User <paramdef>int <parameter>type</parameter></paramdef>
d3ddafd7469d1f3430ccd1b0fe0d13ccbbaf5debTinderbox User <paramdef>struct hostent *<parameter>resbuf</parameter></paramdef>
fd2597f75693a2279fdf588bd40dfe2407c42028Tinderbox User <paramdef>char *<parameter>buf</parameter></paramdef>
659d063f23a35d77ad5826e6556d3137672bb937Tinderbox User <paramdef>int <parameter>buflen</parameter></paramdef>
659d063f23a35d77ad5826e6556d3137672bb937Tinderbox User <paramdef>int *<parameter>error</parameter></paramdef>
fd2597f75693a2279fdf588bd40dfe2407c42028Tinderbox User </funcprototype>
6d45011a65dfc43f476ca15c3fd9ee5227eb968fTinderbox User<funcprototype>
fd2597f75693a2279fdf588bd40dfe2407c42028Tinderbox User <funcdef>
14a656f94b1fd0ababd84a772228dfa52276ba15Evan Huntstruct hostent *
14a656f94b1fd0ababd84a772228dfa52276ba15Evan Hunt<function>lwres_gethostent_r</function></funcdef>
6d45011a65dfc43f476ca15c3fd9ee5227eb968fTinderbox User <paramdef>struct hostent *<parameter>resbuf</parameter></paramdef>
fd2597f75693a2279fdf588bd40dfe2407c42028Tinderbox User <paramdef>char *<parameter>buf</parameter></paramdef>
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews <paramdef>int <parameter>buflen</parameter></paramdef>
fd2597f75693a2279fdf588bd40dfe2407c42028Tinderbox User <paramdef>int *<parameter>error</parameter></paramdef>
659d063f23a35d77ad5826e6556d3137672bb937Tinderbox User </funcprototype>
fd2597f75693a2279fdf588bd40dfe2407c42028Tinderbox User<funcprototype>
c247e3f281613fabe1af362e9f3157e35ebbe52cMark Andrews <funcdef>
fd2597f75693a2279fdf588bd40dfe2407c42028Tinderbox Uservoid
659d063f23a35d77ad5826e6556d3137672bb937Tinderbox User<function>lwres_sethostent_r</function></funcdef>
659d063f23a35d77ad5826e6556d3137672bb937Tinderbox User <paramdef>int <parameter>stayopen</parameter></paramdef>
659d063f23a35d77ad5826e6556d3137672bb937Tinderbox User </funcprototype>
659d063f23a35d77ad5826e6556d3137672bb937Tinderbox User<funcprototype>
14a656f94b1fd0ababd84a772228dfa52276ba15Evan Hunt <funcdef>
659d063f23a35d77ad5826e6556d3137672bb937Tinderbox Uservoid
659d063f23a35d77ad5826e6556d3137672bb937Tinderbox User<function>lwres_endhostent_r</function></funcdef>
14a656f94b1fd0ababd84a772228dfa52276ba15Evan Hunt <paramdef>void</paramdef>
659d063f23a35d77ad5826e6556d3137672bb937Tinderbox User </funcprototype>
659d063f23a35d77ad5826e6556d3137672bb937Tinderbox User</funcsynopsis>
659d063f23a35d77ad5826e6556d3137672bb937Tinderbox User </refsynopsisdiv>
659d063f23a35d77ad5826e6556d3137672bb937Tinderbox User
659d063f23a35d77ad5826e6556d3137672bb937Tinderbox User <refsection><info><title>DESCRIPTION</title></info>
659d063f23a35d77ad5826e6556d3137672bb937Tinderbox User
659d063f23a35d77ad5826e6556d3137672bb937Tinderbox User <para>
fd2597f75693a2279fdf588bd40dfe2407c42028Tinderbox User These functions provide hostname-to-address and
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews address-to-hostname lookups by means of the lightweight resolver.
fd2597f75693a2279fdf588bd40dfe2407c42028Tinderbox User They are similar to the standard
fd2597f75693a2279fdf588bd40dfe2407c42028Tinderbox User <citerefentry>
fd2597f75693a2279fdf588bd40dfe2407c42028Tinderbox User <refentrytitle>gethostent</refentrytitle><manvolnum>3</manvolnum>
fd2597f75693a2279fdf588bd40dfe2407c42028Tinderbox User </citerefentry>
14a656f94b1fd0ababd84a772228dfa52276ba15Evan Hunt functions provided by most operating systems.
14a656f94b1fd0ababd84a772228dfa52276ba15Evan Hunt They use a
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews <type>struct hostent</type>
fd2597f75693a2279fdf588bd40dfe2407c42028Tinderbox User which is usually defined in
0ccb0e98c77a9b9636a036f8f64f5679a430aaf4Tinderbox User <filename>&lt;namedb.h&gt;</filename>.
0ccb0e98c77a9b9636a036f8f64f5679a430aaf4Tinderbox User </para>
fd2597f75693a2279fdf588bd40dfe2407c42028Tinderbox User <para><programlisting>
395c95214142142854509945adf3293c0270e1c5Tinderbox Userstruct hostent {
395c95214142142854509945adf3293c0270e1c5Tinderbox User char *h_name; /* official name of host */
fd2597f75693a2279fdf588bd40dfe2407c42028Tinderbox User char **h_aliases; /* alias list */
395c95214142142854509945adf3293c0270e1c5Tinderbox User int h_addrtype; /* host address type */
395c95214142142854509945adf3293c0270e1c5Tinderbox User int h_length; /* length of address */
14a656f94b1fd0ababd84a772228dfa52276ba15Evan Hunt char **h_addr_list; /* list of addresses from name server */
395c95214142142854509945adf3293c0270e1c5Tinderbox User};
395c95214142142854509945adf3293c0270e1c5Tinderbox User#define h_addr h_addr_list[0] /* address, for backward compatibility */
395c95214142142854509945adf3293c0270e1c5Tinderbox User</programlisting>
395c95214142142854509945adf3293c0270e1c5Tinderbox User </para>
395c95214142142854509945adf3293c0270e1c5Tinderbox User <para>
395c95214142142854509945adf3293c0270e1c5Tinderbox User The members of this structure are:
fd2597f75693a2279fdf588bd40dfe2407c42028Tinderbox User <variablelist>
395c95214142142854509945adf3293c0270e1c5Tinderbox User <varlistentry>
395c95214142142854509945adf3293c0270e1c5Tinderbox User <term><constant>h_name</constant></term>
395c95214142142854509945adf3293c0270e1c5Tinderbox User <listitem>
395c95214142142854509945adf3293c0270e1c5Tinderbox User <para>
395c95214142142854509945adf3293c0270e1c5Tinderbox User The official (canonical) name of the host.
395c95214142142854509945adf3293c0270e1c5Tinderbox User </para>
395c95214142142854509945adf3293c0270e1c5Tinderbox User </listitem>
14a656f94b1fd0ababd84a772228dfa52276ba15Evan Hunt </varlistentry>
395c95214142142854509945adf3293c0270e1c5Tinderbox User <varlistentry>
395c95214142142854509945adf3293c0270e1c5Tinderbox User <term><constant>h_aliases</constant></term>
395c95214142142854509945adf3293c0270e1c5Tinderbox User <listitem>
395c95214142142854509945adf3293c0270e1c5Tinderbox User <para>
fd2597f75693a2279fdf588bd40dfe2407c42028Tinderbox User A NULL-terminated array of alternate names (nicknames) for the
14a656f94b1fd0ababd84a772228dfa52276ba15Evan Hunt host.
395c95214142142854509945adf3293c0270e1c5Tinderbox User </para>
395c95214142142854509945adf3293c0270e1c5Tinderbox User </listitem>
395c95214142142854509945adf3293c0270e1c5Tinderbox User </varlistentry>
fd2597f75693a2279fdf588bd40dfe2407c42028Tinderbox User <varlistentry>
395c95214142142854509945adf3293c0270e1c5Tinderbox User <term><constant>h_addrtype</constant></term>
395c95214142142854509945adf3293c0270e1c5Tinderbox User <listitem>
fd2597f75693a2279fdf588bd40dfe2407c42028Tinderbox User <para>
395c95214142142854509945adf3293c0270e1c5Tinderbox User The type of address being returned &mdash;
395c95214142142854509945adf3293c0270e1c5Tinderbox User <type>PF_INET</type>
395c95214142142854509945adf3293c0270e1c5Tinderbox User or
fd2597f75693a2279fdf588bd40dfe2407c42028Tinderbox User <type>PF_INET6</type>.
14a656f94b1fd0ababd84a772228dfa52276ba15Evan Hunt </para>
395c95214142142854509945adf3293c0270e1c5Tinderbox User </listitem>
fd2597f75693a2279fdf588bd40dfe2407c42028Tinderbox User </varlistentry>
395c95214142142854509945adf3293c0270e1c5Tinderbox User <varlistentry>
395c95214142142854509945adf3293c0270e1c5Tinderbox User <term><constant>h_length</constant></term>
fd2597f75693a2279fdf588bd40dfe2407c42028Tinderbox User <listitem>
395c95214142142854509945adf3293c0270e1c5Tinderbox User <para>
395c95214142142854509945adf3293c0270e1c5Tinderbox User The length of the address in bytes.
fd2597f75693a2279fdf588bd40dfe2407c42028Tinderbox User </para>
6d45011a65dfc43f476ca15c3fd9ee5227eb968fTinderbox User </listitem>
395c95214142142854509945adf3293c0270e1c5Tinderbox User </varlistentry>
395c95214142142854509945adf3293c0270e1c5Tinderbox User <varlistentry>
395c95214142142854509945adf3293c0270e1c5Tinderbox User <term><constant>h_addr_list</constant></term>
395c95214142142854509945adf3293c0270e1c5Tinderbox User <listitem>
395c95214142142854509945adf3293c0270e1c5Tinderbox User <para>
395c95214142142854509945adf3293c0270e1c5Tinderbox User A <type>NULL</type>
14a656f94b1fd0ababd84a772228dfa52276ba15Evan Hunt terminated array of network addresses for the host.
395c95214142142854509945adf3293c0270e1c5Tinderbox User Host addresses are returned in network byte order.
fd2597f75693a2279fdf588bd40dfe2407c42028Tinderbox User </para>
395c95214142142854509945adf3293c0270e1c5Tinderbox User </listitem>
14a656f94b1fd0ababd84a772228dfa52276ba15Evan Hunt </varlistentry>
395c95214142142854509945adf3293c0270e1c5Tinderbox User </variablelist>
395c95214142142854509945adf3293c0270e1c5Tinderbox User </para>
395c95214142142854509945adf3293c0270e1c5Tinderbox User <para>
395c95214142142854509945adf3293c0270e1c5Tinderbox User For backward compatibility with very old software,
395c95214142142854509945adf3293c0270e1c5Tinderbox User <constant>h_addr</constant>
395c95214142142854509945adf3293c0270e1c5Tinderbox User is the first address in
395c95214142142854509945adf3293c0270e1c5Tinderbox User <constant>h_addr_list.</constant>
fd2597f75693a2279fdf588bd40dfe2407c42028Tinderbox User </para>
14a656f94b1fd0ababd84a772228dfa52276ba15Evan Hunt <para><function>lwres_gethostent()</function>,
395c95214142142854509945adf3293c0270e1c5Tinderbox User <function>lwres_sethostent()</function>,
fd2597f75693a2279fdf588bd40dfe2407c42028Tinderbox User <function>lwres_endhostent()</function>,
c0cbdeedb5e119c640f098da1851cb1b9adcc739Tinderbox User <function>lwres_gethostent_r()</function>,
fd2597f75693a2279fdf588bd40dfe2407c42028Tinderbox User <function>lwres_sethostent_r()</function>
395c95214142142854509945adf3293c0270e1c5Tinderbox User and
395c95214142142854509945adf3293c0270e1c5Tinderbox User <function>lwres_endhostent_r()</function>
395c95214142142854509945adf3293c0270e1c5Tinderbox User provide iteration over the known host entries on systems that
395c95214142142854509945adf3293c0270e1c5Tinderbox User provide such functionality through facilities like
395c95214142142854509945adf3293c0270e1c5Tinderbox User <filename>/etc/hosts</filename>
14a656f94b1fd0ababd84a772228dfa52276ba15Evan Hunt or NIS. The lightweight resolver does not currently implement
395c95214142142854509945adf3293c0270e1c5Tinderbox User these functions; it only provides them as stub functions that always
fd2597f75693a2279fdf588bd40dfe2407c42028Tinderbox User return failure.
395c95214142142854509945adf3293c0270e1c5Tinderbox User </para>
fd2597f75693a2279fdf588bd40dfe2407c42028Tinderbox User
395c95214142142854509945adf3293c0270e1c5Tinderbox User <para><function>lwres_gethostbyname()</function>
fd2597f75693a2279fdf588bd40dfe2407c42028Tinderbox User and <function>lwres_gethostbyname2()</function> look up the
395c95214142142854509945adf3293c0270e1c5Tinderbox User hostname <parameter>name</parameter>.
fd2597f75693a2279fdf588bd40dfe2407c42028Tinderbox User <function>lwres_gethostbyname()</function> always looks for an
395c95214142142854509945adf3293c0270e1c5Tinderbox User IPv4 address while <function>lwres_gethostbyname2()</function>
395c95214142142854509945adf3293c0270e1c5Tinderbox User looks for an address of protocol family
395c95214142142854509945adf3293c0270e1c5Tinderbox User <parameter>af</parameter>: either <type>PF_INET</type> or
fd2597f75693a2279fdf588bd40dfe2407c42028Tinderbox User <type>PF_INET6</type> &mdash; IPv4 or IPV6 addresses
395c95214142142854509945adf3293c0270e1c5Tinderbox User respectively. Successful calls of the functions return a
fd2597f75693a2279fdf588bd40dfe2407c42028Tinderbox User <type>struct hostent</type>for the name that was looked up.
395c95214142142854509945adf3293c0270e1c5Tinderbox User <type>NULL</type> is returned if the lookups by
395c95214142142854509945adf3293c0270e1c5Tinderbox User <function>lwres_gethostbyname()</function> or
395c95214142142854509945adf3293c0270e1c5Tinderbox User <function>lwres_gethostbyname2()</function> fail.
fd2597f75693a2279fdf588bd40dfe2407c42028Tinderbox User </para>
395c95214142142854509945adf3293c0270e1c5Tinderbox User
4f9cb7bd58e2c0a7407fee3758ea265aee329ac6Tinderbox User <para>
fd2597f75693a2279fdf588bd40dfe2407c42028Tinderbox User Reverse lookups of addresses are performed by
395c95214142142854509945adf3293c0270e1c5Tinderbox User <function>lwres_gethostbyaddr()</function>.
395c95214142142854509945adf3293c0270e1c5Tinderbox User <parameter>addr</parameter> is an address of length
395c95214142142854509945adf3293c0270e1c5Tinderbox User <parameter>len</parameter> bytes and protocol family
395c95214142142854509945adf3293c0270e1c5Tinderbox User <parameter>type</parameter> &mdash; <type>PF_INET</type> or
395c95214142142854509945adf3293c0270e1c5Tinderbox User <type>PF_INET6</type>.
395c95214142142854509945adf3293c0270e1c5Tinderbox User <function>lwres_gethostbyname_r()</function> is a
395c95214142142854509945adf3293c0270e1c5Tinderbox User thread-safe function
659d063f23a35d77ad5826e6556d3137672bb937Tinderbox User for forward lookups. If an error occurs, an error code is returned in
fd2597f75693a2279fdf588bd40dfe2407c42028Tinderbox User <parameter>*error</parameter>.
14a656f94b1fd0ababd84a772228dfa52276ba15Evan Hunt <parameter>resbuf</parameter> is a pointer to a
659d063f23a35d77ad5826e6556d3137672bb937Tinderbox User <type>struct hostent</type> which is initialised by a successful call to
fd2597f75693a2279fdf588bd40dfe2407c42028Tinderbox User <function>lwres_gethostbyname_r()</function>.
395c95214142142854509945adf3293c0270e1c5Tinderbox User <parameter>buf</parameter> is a buffer of length
0ccb0e98c77a9b9636a036f8f64f5679a430aaf4Tinderbox User <parameter>len</parameter> bytes which is used to store the
fd2597f75693a2279fdf588bd40dfe2407c42028Tinderbox User <constant>h_name</constant>, <constant>h_aliases</constant>, and
395c95214142142854509945adf3293c0270e1c5Tinderbox User <constant>h_addr_list</constant> elements of the
395c95214142142854509945adf3293c0270e1c5Tinderbox User <type>struct hostent</type> returned in <parameter>resbuf</parameter>.
395c95214142142854509945adf3293c0270e1c5Tinderbox User Successful calls to <function>lwres_gethostbyname_r()</function>
395c95214142142854509945adf3293c0270e1c5Tinderbox User return <parameter>resbuf</parameter>,
14a656f94b1fd0ababd84a772228dfa52276ba15Evan Hunt which is a pointer to the <type>struct hostent</type> it created.
14a656f94b1fd0ababd84a772228dfa52276ba15Evan Hunt </para>
395c95214142142854509945adf3293c0270e1c5Tinderbox User
659d063f23a35d77ad5826e6556d3137672bb937Tinderbox User <para><function>lwres_gethostbyaddr_r()</function>
fd2597f75693a2279fdf588bd40dfe2407c42028Tinderbox User is a thread-safe function
14a656f94b1fd0ababd84a772228dfa52276ba15Evan Hunt that performs a reverse lookup of address <parameter>addr</parameter>
659d063f23a35d77ad5826e6556d3137672bb937Tinderbox User which is <parameter>len</parameter> bytes long and is of
fd2597f75693a2279fdf588bd40dfe2407c42028Tinderbox User protocol
0ccb0e98c77a9b9636a036f8f64f5679a430aaf4Tinderbox User family <parameter>type</parameter> &mdash; <type>PF_INET</type> or
0ccb0e98c77a9b9636a036f8f64f5679a430aaf4Tinderbox User <type>PF_INET6</type>. If an error occurs, the error code is returned
fd2597f75693a2279fdf588bd40dfe2407c42028Tinderbox User in <parameter>*error</parameter>. The other function
659d063f23a35d77ad5826e6556d3137672bb937Tinderbox User parameters are
659d063f23a35d77ad5826e6556d3137672bb937Tinderbox User identical to those in <function>lwres_gethostbyname_r()</function>.
659d063f23a35d77ad5826e6556d3137672bb937Tinderbox User <parameter>resbuf</parameter> is a pointer to a
14a656f94b1fd0ababd84a772228dfa52276ba15Evan Hunt <type>struct hostent</type> which is initialised by a successful call to
659d063f23a35d77ad5826e6556d3137672bb937Tinderbox User <function>lwres_gethostbyaddr_r()</function>.
659d063f23a35d77ad5826e6556d3137672bb937Tinderbox User <parameter>buf</parameter> is a buffer of length
659d063f23a35d77ad5826e6556d3137672bb937Tinderbox User <parameter>len</parameter> bytes which is used to store the
659d063f23a35d77ad5826e6556d3137672bb937Tinderbox User <constant>h_name</constant>, <constant>h_aliases</constant>, and
fd2597f75693a2279fdf588bd40dfe2407c42028Tinderbox User <constant>h_addr_list</constant> elements of the
659d063f23a35d77ad5826e6556d3137672bb937Tinderbox User <type>struct hostent</type> returned in <parameter>resbuf</parameter>.
14a656f94b1fd0ababd84a772228dfa52276ba15Evan Hunt Successful calls to <function>lwres_gethostbyaddr_r()</function> return
659d063f23a35d77ad5826e6556d3137672bb937Tinderbox User <parameter>resbuf</parameter>, which is a pointer to the
659d063f23a35d77ad5826e6556d3137672bb937Tinderbox User <function>struct hostent()</function> it created.
659d063f23a35d77ad5826e6556d3137672bb937Tinderbox User </para>
659d063f23a35d77ad5826e6556d3137672bb937Tinderbox User
659d063f23a35d77ad5826e6556d3137672bb937Tinderbox User </refsection>
659d063f23a35d77ad5826e6556d3137672bb937Tinderbox User
fd2597f75693a2279fdf588bd40dfe2407c42028Tinderbox User <refsection><info><title>RETURN VALUES</title></info>
659d063f23a35d77ad5826e6556d3137672bb937Tinderbox User
fd2597f75693a2279fdf588bd40dfe2407c42028Tinderbox User <para>
659d063f23a35d77ad5826e6556d3137672bb937Tinderbox User The functions
659d063f23a35d77ad5826e6556d3137672bb937Tinderbox User <function>lwres_gethostbyname()</function>,
659d063f23a35d77ad5826e6556d3137672bb937Tinderbox User <function>lwres_gethostbyname2()</function>,
659d063f23a35d77ad5826e6556d3137672bb937Tinderbox User <function>lwres_gethostbyaddr()</function>,
659d063f23a35d77ad5826e6556d3137672bb937Tinderbox User and
659d063f23a35d77ad5826e6556d3137672bb937Tinderbox User <function>lwres_gethostent()</function>
659d063f23a35d77ad5826e6556d3137672bb937Tinderbox User return NULL to indicate an error. In this case the global variable
659d063f23a35d77ad5826e6556d3137672bb937Tinderbox User <type>lwres_h_errno</type>
659d063f23a35d77ad5826e6556d3137672bb937Tinderbox User will contain one of the following error codes defined in
fd2597f75693a2279fdf588bd40dfe2407c42028Tinderbox User <filename>&lt;lwres/netdb.h&gt;</filename>:
395c95214142142854509945adf3293c0270e1c5Tinderbox User
0ccb0e98c77a9b9636a036f8f64f5679a430aaf4Tinderbox User <variablelist>
fd2597f75693a2279fdf588bd40dfe2407c42028Tinderbox User <varlistentry>
395c95214142142854509945adf3293c0270e1c5Tinderbox User <term><constant>HOST_NOT_FOUND</constant></term>
395c95214142142854509945adf3293c0270e1c5Tinderbox User <listitem>
14a656f94b1fd0ababd84a772228dfa52276ba15Evan Hunt <para>
395c95214142142854509945adf3293c0270e1c5Tinderbox User The host or address was not found.
14a656f94b1fd0ababd84a772228dfa52276ba15Evan Hunt </para>
395c95214142142854509945adf3293c0270e1c5Tinderbox User </listitem>
395c95214142142854509945adf3293c0270e1c5Tinderbox User </varlistentry>
395c95214142142854509945adf3293c0270e1c5Tinderbox User <varlistentry>
395c95214142142854509945adf3293c0270e1c5Tinderbox User <term><constant>TRY_AGAIN</constant></term>
659d063f23a35d77ad5826e6556d3137672bb937Tinderbox User <listitem>
fd2597f75693a2279fdf588bd40dfe2407c42028Tinderbox User <para>
395c95214142142854509945adf3293c0270e1c5Tinderbox User A recoverable error occurred, e.g., a timeout.
14a656f94b1fd0ababd84a772228dfa52276ba15Evan Hunt Retrying the lookup may succeed.
395c95214142142854509945adf3293c0270e1c5Tinderbox User </para>
395c95214142142854509945adf3293c0270e1c5Tinderbox User </listitem>
395c95214142142854509945adf3293c0270e1c5Tinderbox User </varlistentry>
395c95214142142854509945adf3293c0270e1c5Tinderbox User <varlistentry>
395c95214142142854509945adf3293c0270e1c5Tinderbox User <term><constant>NO_RECOVERY</constant></term>
395c95214142142854509945adf3293c0270e1c5Tinderbox User <listitem>
395c95214142142854509945adf3293c0270e1c5Tinderbox User <para>
395c95214142142854509945adf3293c0270e1c5Tinderbox User A non-recoverable error occurred.
395c95214142142854509945adf3293c0270e1c5Tinderbox User </para>
395c95214142142854509945adf3293c0270e1c5Tinderbox User </listitem>
fd2597f75693a2279fdf588bd40dfe2407c42028Tinderbox User </varlistentry>
14a656f94b1fd0ababd84a772228dfa52276ba15Evan Hunt <varlistentry>
659d063f23a35d77ad5826e6556d3137672bb937Tinderbox User <term><constant>NO_DATA</constant></term>
fd2597f75693a2279fdf588bd40dfe2407c42028Tinderbox User <listitem>
395c95214142142854509945adf3293c0270e1c5Tinderbox User <para>
fd2597f75693a2279fdf588bd40dfe2407c42028Tinderbox User The name exists, but has no address information
395c95214142142854509945adf3293c0270e1c5Tinderbox User associated with it (or vice versa in the case
fd2597f75693a2279fdf588bd40dfe2407c42028Tinderbox User of a reverse lookup). The code NO_ADDRESS
395c95214142142854509945adf3293c0270e1c5Tinderbox User is accepted as a synonym for NO_DATA for backwards
659d063f23a35d77ad5826e6556d3137672bb937Tinderbox User compatibility.
fd2597f75693a2279fdf588bd40dfe2407c42028Tinderbox User </para>
395c95214142142854509945adf3293c0270e1c5Tinderbox User </listitem>
659d063f23a35d77ad5826e6556d3137672bb937Tinderbox User </varlistentry>
fd2597f75693a2279fdf588bd40dfe2407c42028Tinderbox User </variablelist>
14a656f94b1fd0ababd84a772228dfa52276ba15Evan Hunt </para>
659d063f23a35d77ad5826e6556d3137672bb937Tinderbox User
fd2597f75693a2279fdf588bd40dfe2407c42028Tinderbox User <para><citerefentry>
61ab11c0ec845606f85452b2c9f2e223772aae00Tinderbox User <refentrytitle>lwres_hstrerror</refentrytitle><manvolnum>3</manvolnum>
61ab11c0ec845606f85452b2c9f2e223772aae00Tinderbox User </citerefentry>
61ab11c0ec845606f85452b2c9f2e223772aae00Tinderbox User translates these error codes to suitable error messages.
61ab11c0ec845606f85452b2c9f2e223772aae00Tinderbox User </para>
61ab11c0ec845606f85452b2c9f2e223772aae00Tinderbox User
f5c27ecceb6dcba6ad8b75172fe5f9823d7a6d42Tinderbox User <para><function>lwres_gethostent()</function>
fd2597f75693a2279fdf588bd40dfe2407c42028Tinderbox User and <function>lwres_gethostent_r()</function>
659d063f23a35d77ad5826e6556d3137672bb937Tinderbox User always return <type>NULL</type>.
659d063f23a35d77ad5826e6556d3137672bb937Tinderbox User </para>
659d063f23a35d77ad5826e6556d3137672bb937Tinderbox User
659d063f23a35d77ad5826e6556d3137672bb937Tinderbox User <para>
659d063f23a35d77ad5826e6556d3137672bb937Tinderbox User Successful calls to <function>lwres_gethostbyname_r()</function> and
659d063f23a35d77ad5826e6556d3137672bb937Tinderbox User <function>lwres_gethostbyaddr_r()</function> return
659d063f23a35d77ad5826e6556d3137672bb937Tinderbox User <parameter>resbuf</parameter>, a pointer to the
fd2597f75693a2279fdf588bd40dfe2407c42028Tinderbox User <type>struct hostent</type> that was initialised by these functions. They return
659d063f23a35d77ad5826e6556d3137672bb937Tinderbox User <type>NULL</type> if the lookups fail or if <parameter>buf</parameter>
659d063f23a35d77ad5826e6556d3137672bb937Tinderbox User was too small to hold the list of addresses and names referenced by
659d063f23a35d77ad5826e6556d3137672bb937Tinderbox User the <constant>h_name</constant>, <constant>h_aliases</constant>, and
659d063f23a35d77ad5826e6556d3137672bb937Tinderbox User <constant>h_addr_list</constant> elements of the
659d063f23a35d77ad5826e6556d3137672bb937Tinderbox User <type>struct hostent</type>.
14a656f94b1fd0ababd84a772228dfa52276ba15Evan Hunt If <parameter>buf</parameter> was too small, both
659d063f23a35d77ad5826e6556d3137672bb937Tinderbox User <function>lwres_gethostbyname_r()</function> and
659d063f23a35d77ad5826e6556d3137672bb937Tinderbox User <function>lwres_gethostbyaddr_r()</function> set the global
659d063f23a35d77ad5826e6556d3137672bb937Tinderbox User variable
659d063f23a35d77ad5826e6556d3137672bb937Tinderbox User <type>errno</type> to <errorcode>ERANGE</errorcode>.
fd2597f75693a2279fdf588bd40dfe2407c42028Tinderbox User </para>
14a656f94b1fd0ababd84a772228dfa52276ba15Evan Hunt
659d063f23a35d77ad5826e6556d3137672bb937Tinderbox User </refsection>
659d063f23a35d77ad5826e6556d3137672bb937Tinderbox User <refsection><info><title>SEE ALSO</title></info>
659d063f23a35d77ad5826e6556d3137672bb937Tinderbox User
659d063f23a35d77ad5826e6556d3137672bb937Tinderbox User <para><citerefentry>
659d063f23a35d77ad5826e6556d3137672bb937Tinderbox User <refentrytitle>gethostent</refentrytitle><manvolnum>3</manvolnum>
659d063f23a35d77ad5826e6556d3137672bb937Tinderbox User </citerefentry>,
659d063f23a35d77ad5826e6556d3137672bb937Tinderbox User
659d063f23a35d77ad5826e6556d3137672bb937Tinderbox User <citerefentry>
fd2597f75693a2279fdf588bd40dfe2407c42028Tinderbox User <refentrytitle>lwres_getipnode</refentrytitle><manvolnum>3</manvolnum>
659d063f23a35d77ad5826e6556d3137672bb937Tinderbox User </citerefentry>,
659d063f23a35d77ad5826e6556d3137672bb937Tinderbox User
659d063f23a35d77ad5826e6556d3137672bb937Tinderbox User <citerefentry>
fd2597f75693a2279fdf588bd40dfe2407c42028Tinderbox User <refentrytitle>lwres_hstrerror</refentrytitle><manvolnum>3</manvolnum>
659d063f23a35d77ad5826e6556d3137672bb937Tinderbox User </citerefentry>
659d063f23a35d77ad5826e6556d3137672bb937Tinderbox User </para>
659d063f23a35d77ad5826e6556d3137672bb937Tinderbox User </refsection>
659d063f23a35d77ad5826e6556d3137672bb937Tinderbox User
659d063f23a35d77ad5826e6556d3137672bb937Tinderbox User <refsection><info><title>BUGS</title></info>
659d063f23a35d77ad5826e6556d3137672bb937Tinderbox User
659d063f23a35d77ad5826e6556d3137672bb937Tinderbox User <para><function>lwres_gethostbyname()</function>,
659d063f23a35d77ad5826e6556d3137672bb937Tinderbox User <function>lwres_gethostbyname2()</function>,
fd2597f75693a2279fdf588bd40dfe2407c42028Tinderbox User <function>lwres_gethostbyaddr()</function>
659d063f23a35d77ad5826e6556d3137672bb937Tinderbox User and
659d063f23a35d77ad5826e6556d3137672bb937Tinderbox User <function>lwres_endhostent()</function>
659d063f23a35d77ad5826e6556d3137672bb937Tinderbox User are not thread safe; they return pointers to static data and
659d063f23a35d77ad5826e6556d3137672bb937Tinderbox User provide error codes through a global variable.
659d063f23a35d77ad5826e6556d3137672bb937Tinderbox User Thread-safe versions for name and address lookup are provided by
fd2597f75693a2279fdf588bd40dfe2407c42028Tinderbox User <function>lwres_gethostbyname_r()</function>,
14a656f94b1fd0ababd84a772228dfa52276ba15Evan Hunt and
659d063f23a35d77ad5826e6556d3137672bb937Tinderbox User <function>lwres_gethostbyaddr_r()</function>
659d063f23a35d77ad5826e6556d3137672bb937Tinderbox User respectively.
659d063f23a35d77ad5826e6556d3137672bb937Tinderbox User </para>
659d063f23a35d77ad5826e6556d3137672bb937Tinderbox User <para>
659d063f23a35d77ad5826e6556d3137672bb937Tinderbox User The resolver daemon does not currently support any non-DNS
659d063f23a35d77ad5826e6556d3137672bb937Tinderbox User name services such as
659d063f23a35d77ad5826e6556d3137672bb937Tinderbox User <filename>/etc/hosts</filename>
659d063f23a35d77ad5826e6556d3137672bb937Tinderbox User or
659d063f23a35d77ad5826e6556d3137672bb937Tinderbox User <type>NIS</type>,
659d063f23a35d77ad5826e6556d3137672bb937Tinderbox User consequently the above functions don't, either.
fd2597f75693a2279fdf588bd40dfe2407c42028Tinderbox User </para>
395c95214142142854509945adf3293c0270e1c5Tinderbox User </refsection>
395c95214142142854509945adf3293c0270e1c5Tinderbox User</refentry>
395c95214142142854509945adf3293c0270e1c5Tinderbox User