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