lwres_gethostent.docbook revision 83a28ca274521e15086fc39febde507bcc4e145e
f743002678eb67b99bbc29fee116b65d9530fec0wrowe<!DOCTYPE book [
80833bb9a1bf25dcf19e814438a4b311d2e1f4cffuankg<!ENTITY mdash "&#8212;">]>
6736c640e65e06990ef33af71ee81fac4df4ff5fjim<!--
1dd5136d67e0164e4afd723a471b86a1b7eb1874sf - Copyright (C) 2001, 2004, 2005, 2007, 2014-2016 Internet Systems Consortium, Inc. ("ISC")
1dd5136d67e0164e4afd723a471b86a1b7eb1874sf -
1dd5136d67e0164e4afd723a471b86a1b7eb1874sf - This Source Code Form is subject to the terms of the Mozilla Public
1dd5136d67e0164e4afd723a471b86a1b7eb1874sf - License, v. 2.0. If a copy of the MPL was not distributed with this
e39eb98e3ad3fbf5c34b2fa1d16861f95143e22esf - file, You can obtain one at http://mozilla.org/MPL/2.0/.
e39eb98e3ad3fbf5c34b2fa1d16861f95143e22esf-->
e39eb98e3ad3fbf5c34b2fa1d16861f95143e22esf
d6fc66efa723db8b3ee5e9fd32579bed884e4e58sf<!-- Converted by db4-upgrade version 1.0 -->
d6fc66efa723db8b3ee5e9fd32579bed884e4e58sf<refentry xmlns:db="http://docbook.org/ns/docbook" version="5.0">
d6fc66efa723db8b3ee5e9fd32579bed884e4e58sf <info>
d6fc66efa723db8b3ee5e9fd32579bed884e4e58sf <date>2007-06-18</date>
f00cb80197f824c3ff00dd4fdff3b2c267a519d1kbrand </info>
f00cb80197f824c3ff00dd4fdff3b2c267a519d1kbrand <refentryinfo>
f00cb80197f824c3ff00dd4fdff3b2c267a519d1kbrand <corpname>ISC</corpname>
f00cb80197f824c3ff00dd4fdff3b2c267a519d1kbrand <corpauthor>Internet Systems Consortium, Inc.</corpauthor>
85eacfc96a04547ef25aabbc06440039715084c2jorton </refentryinfo>
85eacfc96a04547ef25aabbc06440039715084c2jorton
85eacfc96a04547ef25aabbc06440039715084c2jorton <refmeta>
1d8d7e58e1d31d7b6fb7a518e09649a4dbb315e9trawick <refentrytitle>lwres_gethostent</refentrytitle>
1d8d7e58e1d31d7b6fb7a518e09649a4dbb315e9trawick <manvolnum>3</manvolnum>
1d8d7e58e1d31d7b6fb7a518e09649a4dbb315e9trawick <refmiscinfo>BIND9</refmiscinfo>
f34da68471f256dca0ff770257c3e1f982f74cf1trawick </refmeta>
f34da68471f256dca0ff770257c3e1f982f74cf1trawick
f34da68471f256dca0ff770257c3e1f982f74cf1trawick <docinfo>
8b645fd3c950da73513b546366c7cfa7476c5c06jim <copyright>
8b645fd3c950da73513b546366c7cfa7476c5c06jim <year>2001</year>
8b645fd3c950da73513b546366c7cfa7476c5c06jim <year>2004</year>
8b645fd3c950da73513b546366c7cfa7476c5c06jim <year>2005</year>
193f0bb6057d67593ed652fbf58f043def51c642jim <year>2007</year>
193f0bb6057d67593ed652fbf58f043def51c642jim <year>2014</year>
193f0bb6057d67593ed652fbf58f043def51c642jim <year>2015</year>
68ba377fc3b124baa759662077c48077ebadb186minfrin <year>2016</year>
68ba377fc3b124baa759662077c48077ebadb186minfrin <holder>Internet Systems Consortium, Inc. ("ISC")</holder>
68ba377fc3b124baa759662077c48077ebadb186minfrin </copyright>
68ba377fc3b124baa759662077c48077ebadb186minfrin </docinfo>
00566fb187849626180724394a21ddcd28419fb2minfrin
00566fb187849626180724394a21ddcd28419fb2minfrin <refnamediv>
00566fb187849626180724394a21ddcd28419fb2minfrin <refname>lwres_gethostbyname</refname>
00566fb187849626180724394a21ddcd28419fb2minfrin <refname>lwres_gethostbyname2</refname>
d776b0a2d2889ce1d13494873368f34327a2e1bbtrawick <refname>lwres_gethostbyaddr</refname>
d776b0a2d2889ce1d13494873368f34327a2e1bbtrawick <refname>lwres_gethostent</refname>
f4ca9f6f002fece336168a16355434ca966f96a9trawick <refname>lwres_sethostent</refname>
57db302f0875a6c93a79333b8941cea4c1827272jim <refname>lwres_endhostent</refname>
57db302f0875a6c93a79333b8941cea4c1827272jim <refname>lwres_gethostbyname_r</refname>
57db302f0875a6c93a79333b8941cea4c1827272jim <refname>lwres_gethostbyaddr_r</refname>
57db302f0875a6c93a79333b8941cea4c1827272jim <refname>lwres_gethostent_r</refname>
92b1631880b0bf43fe8b2663a03c8571eb04e433jim <refname>lwres_sethostent_r</refname>
92b1631880b0bf43fe8b2663a03c8571eb04e433jim <refname>lwres_endhostent_r</refname>
92b1631880b0bf43fe8b2663a03c8571eb04e433jim <refpurpose>lightweight resolver get network host entry</refpurpose>
89225e8e84d38b07a8335922497997e83d872e75jim </refnamediv>
89225e8e84d38b07a8335922497997e83d872e75jim <refsynopsisdiv>
89225e8e84d38b07a8335922497997e83d872e75jim <funcsynopsis>
78f94f1d06c4e6828ce04d618221e0fcecb57849humbedooh<funcsynopsisinfo>#include &lt;lwres/netdb.h&gt;</funcsynopsisinfo>
78f94f1d06c4e6828ce04d618221e0fcecb57849humbedooh<funcprototype>
78f94f1d06c4e6828ce04d618221e0fcecb57849humbedooh <funcdef>
f5e28c78424d2f71c61ba457009f100bba38bc68chrisdstruct hostent *
f5e28c78424d2f71c61ba457009f100bba38bc68chrisd<function>lwres_gethostbyname</function></funcdef>
f5e28c78424d2f71c61ba457009f100bba38bc68chrisd <paramdef>const char *<parameter>name</parameter></paramdef>
f4a715f904b014060ea6237fe29481ed21f5c7d0jorton </funcprototype>
f4a715f904b014060ea6237fe29481ed21f5c7d0jorton<funcprototype>
f4a715f904b014060ea6237fe29481ed21f5c7d0jorton <funcdef>
536d2e7cd1fdec1255b8c3bdf41fdc714c506a54trawickstruct hostent *
536d2e7cd1fdec1255b8c3bdf41fdc714c506a54trawick<function>lwres_gethostbyname2</function></funcdef>
536d2e7cd1fdec1255b8c3bdf41fdc714c506a54trawick <paramdef>const char *<parameter>name</parameter></paramdef>
536d2e7cd1fdec1255b8c3bdf41fdc714c506a54trawick <paramdef>int <parameter>af</parameter></paramdef>
70caa242e6b90e0d6f0fabb56b8c5c2fb51717b3jorton </funcprototype>
985a4368b93c3e9171a57897ad9454c8dbf4cdf6jorton<funcprototype>
70caa242e6b90e0d6f0fabb56b8c5c2fb51717b3jorton <funcdef>
70caa242e6b90e0d6f0fabb56b8c5c2fb51717b3jortonstruct hostent *
109e2a09790de3fb315d36d6232a14ab66c8eb0ahumbedooh<function>lwres_gethostbyaddr</function></funcdef>
109e2a09790de3fb315d36d6232a14ab66c8eb0ahumbedooh <paramdef>const char *<parameter>addr</parameter></paramdef>
109e2a09790de3fb315d36d6232a14ab66c8eb0ahumbedooh <paramdef>int <parameter>len</parameter></paramdef>
4be250c774bdac977eef29a02183ca78de29fb41rjung <paramdef>int <parameter>type</parameter></paramdef>
4be250c774bdac977eef29a02183ca78de29fb41rjung </funcprototype>
4be250c774bdac977eef29a02183ca78de29fb41rjung<funcprototype>
12b5dc9afa1844df5ac8acab98fb538432a2fa1crjung <funcdef>
12b5dc9afa1844df5ac8acab98fb538432a2fa1crjungstruct hostent *
12b5dc9afa1844df5ac8acab98fb538432a2fa1crjung<function>lwres_gethostent</function></funcdef>
12b5dc9afa1844df5ac8acab98fb538432a2fa1crjung <paramdef>void</paramdef>
74e7a30182af5e68f14ccb8d57918b22b982db8bhumbedooh </funcprototype>
74e7a30182af5e68f14ccb8d57918b22b982db8bhumbedooh<funcprototype>
74e7a30182af5e68f14ccb8d57918b22b982db8bhumbedooh <funcdef>
10961a2f60207cb873d889bb28b1f0ef707a4311humbedoohvoid
10961a2f60207cb873d889bb28b1f0ef707a4311humbedooh<function>lwres_sethostent</function></funcdef>
10961a2f60207cb873d889bb28b1f0ef707a4311humbedooh <paramdef>int <parameter>stayopen</parameter></paramdef>
0448378b899e8df0c060360f17c0af692adf17bchumbedooh </funcprototype>
0448378b899e8df0c060360f17c0af692adf17bchumbedooh<funcprototype>
0448378b899e8df0c060360f17c0af692adf17bchumbedooh <funcdef>
60a765cccbd3f3b5997b65b0034220c79f78369etrawickvoid
60a765cccbd3f3b5997b65b0034220c79f78369etrawick<function>lwres_endhostent</function></funcdef>
60a765cccbd3f3b5997b65b0034220c79f78369etrawick <paramdef>void</paramdef>
e7ca863b04ee2a7aea7738cadbf51ce5e6c5245dhumbedooh </funcprototype>
e7ca863b04ee2a7aea7738cadbf51ce5e6c5245dhumbedooh<funcprototype>
e7ca863b04ee2a7aea7738cadbf51ce5e6c5245dhumbedooh <funcdef>
e7ca863b04ee2a7aea7738cadbf51ce5e6c5245dhumbedoohstruct hostent *
91654e263480f0fdc2a03d782ff23f8dad07cf79humbedooh<function>lwres_gethostbyname_r</function></funcdef>
91814c869ca39ce45dfe147307d2a831cac6ecbehumbedooh <paramdef>const char *<parameter>name</parameter></paramdef>
91654e263480f0fdc2a03d782ff23f8dad07cf79humbedooh <paramdef>struct hostent *<parameter>resbuf</parameter></paramdef>
79c5787b92ac5f0e1cc82393816c77a006399316trawick <paramdef>char *<parameter>buf</parameter></paramdef>
79c5787b92ac5f0e1cc82393816c77a006399316trawick <paramdef>int <parameter>buflen</parameter></paramdef>
79c5787b92ac5f0e1cc82393816c77a006399316trawick <paramdef>int *<parameter>error</parameter></paramdef>
79c5787b92ac5f0e1cc82393816c77a006399316trawick </funcprototype>
79c5787b92ac5f0e1cc82393816c77a006399316trawick<funcprototype>
79c5787b92ac5f0e1cc82393816c77a006399316trawick <funcdef>
79c5787b92ac5f0e1cc82393816c77a006399316trawickstruct hostent *
79c5787b92ac5f0e1cc82393816c77a006399316trawick<function>lwres_gethostbyaddr_r</function></funcdef>
79c5787b92ac5f0e1cc82393816c77a006399316trawick <paramdef>const char *<parameter>addr</parameter></paramdef>
12b987b969f03ef98d9175a53d849ab62f5684fecovener <paramdef>int <parameter>len</parameter></paramdef>
12b987b969f03ef98d9175a53d849ab62f5684fecovener <paramdef>int <parameter>type</parameter></paramdef>
099c357f282d4aebf2b32264f7dce6ffc0497c37sf <paramdef>struct hostent *<parameter>resbuf</parameter></paramdef>
099c357f282d4aebf2b32264f7dce6ffc0497c37sf <paramdef>char *<parameter>buf</parameter></paramdef>
099c357f282d4aebf2b32264f7dce6ffc0497c37sf <paramdef>int <parameter>buflen</parameter></paramdef>
099c357f282d4aebf2b32264f7dce6ffc0497c37sf <paramdef>int *<parameter>error</parameter></paramdef>
50f8c80eb4d3989ebf3f1341aeef4d2d302af162sf </funcprototype>
50f8c80eb4d3989ebf3f1341aeef4d2d302af162sf<funcprototype>
4bb0a88a01fb7b494bb02a8b881b5eab0308bda6sf <funcdef>
50f8c80eb4d3989ebf3f1341aeef4d2d302af162sfstruct hostent *
7b395e4e878c28a4784919cfd2e704ddd14a3390jorton<function>lwres_gethostent_r</function></funcdef>
7b395e4e878c28a4784919cfd2e704ddd14a3390jorton <paramdef>struct hostent *<parameter>resbuf</parameter></paramdef>
7b395e4e878c28a4784919cfd2e704ddd14a3390jorton <paramdef>char *<parameter>buf</parameter></paramdef>
7b395e4e878c28a4784919cfd2e704ddd14a3390jorton <paramdef>int <parameter>buflen</parameter></paramdef>
536e48c08d674acac5d44929318f2ad928edc361jorton <paramdef>int *<parameter>error</parameter></paramdef>
536e48c08d674acac5d44929318f2ad928edc361jorton </funcprototype>
e81785da447b469da66f218b3f0244aab507958djorton<funcprototype>
e81785da447b469da66f218b3f0244aab507958djorton <funcdef>
3e4e54d4e3fc0123c63d57aa84ac7ad7a8c73ff8jortonvoid
3e4e54d4e3fc0123c63d57aa84ac7ad7a8c73ff8jorton<function>lwres_sethostent_r</function></funcdef>
3e4e54d4e3fc0123c63d57aa84ac7ad7a8c73ff8jorton <paramdef>int <parameter>stayopen</parameter></paramdef>
459eaf0826f995b73a0dc066f59ea10d2824e72dsf </funcprototype>
459eaf0826f995b73a0dc066f59ea10d2824e72dsf<funcprototype>
459eaf0826f995b73a0dc066f59ea10d2824e72dsf <funcdef>
459eaf0826f995b73a0dc066f59ea10d2824e72dsfvoid
53e9b27aba029b18be814df40bcf6f0428771d1efuankg<function>lwres_endhostent_r</function></funcdef>
53e9b27aba029b18be814df40bcf6f0428771d1efuankg <paramdef>void</paramdef>
53e9b27aba029b18be814df40bcf6f0428771d1efuankg </funcprototype>
53e9b27aba029b18be814df40bcf6f0428771d1efuankg</funcsynopsis>
53e9b27aba029b18be814df40bcf6f0428771d1efuankg </refsynopsisdiv>
6bb524f1895f30265a1431afc460977d391cb36bsf
6bb524f1895f30265a1431afc460977d391cb36bsf <refsection><info><title>DESCRIPTION</title></info>
ca61ccd0c306c2c72df153688ba1b49f3eceed80sf
6bb524f1895f30265a1431afc460977d391cb36bsf <para>
e6dd71992459d05a676b98b7963423dc5dc1e24aminfrin These functions provide hostname-to-address and
e6dd71992459d05a676b98b7963423dc5dc1e24aminfrin address-to-hostname lookups by means of the lightweight resolver.
e6dd71992459d05a676b98b7963423dc5dc1e24aminfrin They are similar to the standard
e6dd71992459d05a676b98b7963423dc5dc1e24aminfrin <citerefentry>
23f1535d6a60817d2846bac0aea230ea475d7dccminfrin <refentrytitle>gethostent</refentrytitle><manvolnum>3</manvolnum>
23f1535d6a60817d2846bac0aea230ea475d7dccminfrin </citerefentry>
23f1535d6a60817d2846bac0aea230ea475d7dccminfrin functions provided by most operating systems.
23f1535d6a60817d2846bac0aea230ea475d7dccminfrin They use a
ec7520b24cd80d34d82bbcaca153cbb23cc04bc0rjung <type>struct hostent</type>
ec7520b24cd80d34d82bbcaca153cbb23cc04bc0rjung which is usually defined in
ec7520b24cd80d34d82bbcaca153cbb23cc04bc0rjung <filename>&lt;namedb.h&gt;</filename>.
ec7520b24cd80d34d82bbcaca153cbb23cc04bc0rjung </para>
ec7520b24cd80d34d82bbcaca153cbb23cc04bc0rjung <para><programlisting>
ec7520b24cd80d34d82bbcaca153cbb23cc04bc0rjungstruct hostent {
ec7520b24cd80d34d82bbcaca153cbb23cc04bc0rjung char *h_name; /* official name of host */
ec7520b24cd80d34d82bbcaca153cbb23cc04bc0rjung char **h_aliases; /* alias list */
6249dfa569d3b4f1f539665b979a80c6e335d93etrawick int h_addrtype; /* host address type */
6249dfa569d3b4f1f539665b979a80c6e335d93etrawick int h_length; /* length of address */
0827cb14e550f6f65018431c22c2c913631c8f25kbrand char **h_addr_list; /* list of addresses from name server */
6249dfa569d3b4f1f539665b979a80c6e335d93etrawick};
ae600ca541efc686b34f8b1f21bd3d0741d37674covener#define h_addr h_addr_list[0] /* address, for backward compatibility */
6249dfa569d3b4f1f539665b979a80c6e335d93etrawick</programlisting>
cfa64348224b66dd1c9979b809406c4d15b1c137fielding </para>
74499a117b3b2cd9666715a14f90c0e5d1a4ee8ajim <para>
cfa64348224b66dd1c9979b809406c4d15b1c137fielding The members of this structure are:
74499a117b3b2cd9666715a14f90c0e5d1a4ee8ajim <variablelist>
cfa64348224b66dd1c9979b809406c4d15b1c137fielding <varlistentry>
74499a117b3b2cd9666715a14f90c0e5d1a4ee8ajim <term><constant>h_name</constant></term>
cfa64348224b66dd1c9979b809406c4d15b1c137fielding <listitem>
74499a117b3b2cd9666715a14f90c0e5d1a4ee8ajim <para>
cfa64348224b66dd1c9979b809406c4d15b1c137fielding The official (canonical) name of the host.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><constant>h_aliases</constant></term>
<listitem>
<para>
A NULL-terminated array of alternate names (nicknames) for the
host.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><constant>h_addrtype</constant></term>
<listitem>
<para>
The type of address being returned &mdash;
<type>PF_INET</type>
or
<type>PF_INET6</type>.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><constant>h_length</constant></term>
<listitem>
<para>
The length of the address in bytes.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><constant>h_addr_list</constant></term>
<listitem>
<para>
A <type>NULL</type>
terminated array of network addresses for the host.
Host addresses are returned in network byte order.
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
<para>
For backward compatibility with very old software,
<constant>h_addr</constant>
is the first address in
<constant>h_addr_list.</constant>
</para>
<para><function>lwres_gethostent()</function>,
<function>lwres_sethostent()</function>,
<function>lwres_endhostent()</function>,
<function>lwres_gethostent_r()</function>,
<function>lwres_sethostent_r()</function>
and
<function>lwres_endhostent_r()</function>
provide iteration over the known host entries on systems that
provide such functionality through facilities like
<filename>/etc/hosts</filename>
or NIS. The lightweight resolver does not currently implement
these functions; it only provides them as stub functions that always
return failure.
</para>
<para><function>lwres_gethostbyname()</function>
and <function>lwres_gethostbyname2()</function> look up the
hostname <parameter>name</parameter>.
<function>lwres_gethostbyname()</function> always looks for an
IPv4 address while <function>lwres_gethostbyname2()</function>
looks for an address of protocol family
<parameter>af</parameter>: either <type>PF_INET</type> or
<type>PF_INET6</type> &mdash; IPv4 or IPV6 addresses
respectively. Successful calls of the functions return a
<type>struct hostent</type>for the name that was looked up.
<type>NULL</type> is returned if the lookups by
<function>lwres_gethostbyname()</function> or
<function>lwres_gethostbyname2()</function> fail.
</para>
<para>
Reverse lookups of addresses are performed by
<function>lwres_gethostbyaddr()</function>.
<parameter>addr</parameter> is an address of length
<parameter>len</parameter> bytes and protocol family
<parameter>type</parameter> &mdash; <type>PF_INET</type> or
<type>PF_INET6</type>.
<function>lwres_gethostbyname_r()</function> is a
thread-safe function
for forward lookups. If an error occurs, an error code is returned in
<parameter>*error</parameter>.
<parameter>resbuf</parameter> is a pointer to a
<type>struct hostent</type> which is initialised by a successful call to
<function>lwres_gethostbyname_r()</function>.
<parameter>buf</parameter> is a buffer of length
<parameter>len</parameter> bytes which is used to store the
<constant>h_name</constant>, <constant>h_aliases</constant>, and
<constant>h_addr_list</constant> elements of the
<type>struct hostent</type> returned in <parameter>resbuf</parameter>.
Successful calls to <function>lwres_gethostbyname_r()</function>
return <parameter>resbuf</parameter>,
which is a pointer to the <type>struct hostent</type> it created.
</para>
<para><function>lwres_gethostbyaddr_r()</function>
is a thread-safe function
that performs a reverse lookup of address <parameter>addr</parameter>
which is <parameter>len</parameter> bytes long and is of
protocol
family <parameter>type</parameter> &mdash; <type>PF_INET</type> or
<type>PF_INET6</type>. If an error occurs, the error code is returned
in <parameter>*error</parameter>. The other function
parameters are
identical to those in <function>lwres_gethostbyname_r()</function>.
<parameter>resbuf</parameter> is a pointer to a
<type>struct hostent</type> which is initialised by a successful call to
<function>lwres_gethostbyaddr_r()</function>.
<parameter>buf</parameter> is a buffer of length
<parameter>len</parameter> bytes which is used to store the
<constant>h_name</constant>, <constant>h_aliases</constant>, and
<constant>h_addr_list</constant> elements of the
<type>struct hostent</type> returned in <parameter>resbuf</parameter>.
Successful calls to <function>lwres_gethostbyaddr_r()</function> return
<parameter>resbuf</parameter>, which is a pointer to the
<function>struct hostent()</function> it created.
</para>
</refsection>
<refsection><info><title>RETURN VALUES</title></info>
<para>
The functions
<function>lwres_gethostbyname()</function>,
<function>lwres_gethostbyname2()</function>,
<function>lwres_gethostbyaddr()</function>,
and
<function>lwres_gethostent()</function>
return NULL to indicate an error. In this case the global variable
<type>lwres_h_errno</type>
will contain one of the following error codes defined in
<filename>&lt;lwres/netdb.h&gt;</filename>:
<variablelist>
<varlistentry>
<term><constant>HOST_NOT_FOUND</constant></term>
<listitem>
<para>
The host or address was not found.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><constant>TRY_AGAIN</constant></term>
<listitem>
<para>
A recoverable error occurred, e.g., a timeout.
Retrying the lookup may succeed.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><constant>NO_RECOVERY</constant></term>
<listitem>
<para>
A non-recoverable error occurred.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><constant>NO_DATA</constant></term>
<listitem>
<para>
The name exists, but has no address information
associated with it (or vice versa in the case
of a reverse lookup). The code NO_ADDRESS
is accepted as a synonym for NO_DATA for backwards
compatibility.
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
<para><citerefentry>
<refentrytitle>lwres_hstrerror</refentrytitle><manvolnum>3</manvolnum>
</citerefentry>
translates these error codes to suitable error messages.
</para>
<para><function>lwres_gethostent()</function>
and <function>lwres_gethostent_r()</function>
always return <type>NULL</type>.
</para>
<para>
Successful calls to <function>lwres_gethostbyname_r()</function> and
<function>lwres_gethostbyaddr_r()</function> return
<parameter>resbuf</parameter>, a pointer to the
<type>struct hostent</type> that was initialised by these functions. They return
<type>NULL</type> if the lookups fail or if <parameter>buf</parameter>
was too small to hold the list of addresses and names referenced by
the <constant>h_name</constant>, <constant>h_aliases</constant>, and
<constant>h_addr_list</constant> elements of the
<type>struct hostent</type>.
If <parameter>buf</parameter> was too small, both
<function>lwres_gethostbyname_r()</function> and
<function>lwres_gethostbyaddr_r()</function> set the global
variable
<type>errno</type> to <errorcode>ERANGE</errorcode>.
</para>
</refsection>
<refsection><info><title>SEE ALSO</title></info>
<para><citerefentry>
<refentrytitle>gethostent</refentrytitle><manvolnum>3</manvolnum>
</citerefentry>,
<citerefentry>
<refentrytitle>lwres_getipnode</refentrytitle><manvolnum>3</manvolnum>
</citerefentry>,
<citerefentry>
<refentrytitle>lwres_hstrerror</refentrytitle><manvolnum>3</manvolnum>
</citerefentry>
</para>
</refsection>
<refsection><info><title>BUGS</title></info>
<para><function>lwres_gethostbyname()</function>,
<function>lwres_gethostbyname2()</function>,
<function>lwres_gethostbyaddr()</function>
and
<function>lwres_endhostent()</function>
are not thread safe; they return pointers to static data and
provide error codes through a global variable.
Thread-safe versions for name and address lookup are provided by
<function>lwres_gethostbyname_r()</function>,
and
<function>lwres_gethostbyaddr_r()</function>
respectively.
</para>
<para>
The resolver daemon does not currently support any non-DNS
name services such as
<filename>/etc/hosts</filename>
or
<type>NIS</type>,
consequently the above functions don't, either.
</para>
</refsection>
</refentry>