lwres_gethostent.docbook revision 19c7b1a0293498a3e36692c59646ed6e15ffc8d0
11e9368a226272085c337e9e74b79808c16fbdbaTinderbox User<!ENTITY mdash "—">]>
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews - Copyright (C) 2004, 2005, 2007, 2014, 2015 Internet Systems Consortium, Inc. ("ISC")
4a14ce5ba00ab7bc55c99ffdcf59c7a4ab902721Automatic Updater - Copyright (C) 2001 Internet Software Consortium.
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 - 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<!-- Converted by db4-upgrade version 1.0 -->
fd2597f75693a2279fdf588bd40dfe2407c42028Tinderbox User<refentry xmlns="http://docbook.org/ns/docbook" version="5.0">
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews <refentryinfo>
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews <corpauthor>Internet Systems Consortium, Inc.</corpauthor>
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews </refentryinfo>
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews <refentrytitle>lwres_gethostent</refentrytitle>
fd2597f75693a2279fdf588bd40dfe2407c42028Tinderbox User <holder>Internet Systems Consortium, Inc. ("ISC")</holder>
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews </copyright>
fd2597f75693a2279fdf588bd40dfe2407c42028Tinderbox User <holder>Internet Software Consortium.</holder>
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews </copyright>
b2f07642fd712c8fda81a116bcdde229ab291f33Tinderbox User <refpurpose>lightweight resolver get network host entry</refpurpose>
b2f07642fd712c8fda81a116bcdde229ab291f33Tinderbox User </refnamediv>
b2f07642fd712c8fda81a116bcdde229ab291f33Tinderbox User <refsynopsisdiv>
14a656f94b1fd0ababd84a772228dfa52276ba15Evan Hunt <funcsynopsis>
b2f07642fd712c8fda81a116bcdde229ab291f33Tinderbox User<funcsynopsisinfo>#include <lwres/netdb.h></funcsynopsisinfo>
b2f07642fd712c8fda81a116bcdde229ab291f33Tinderbox User<funcprototype>
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>
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 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>
fd2597f75693a2279fdf588bd40dfe2407c42028Tinderbox Userstruct hostent *
659d063f23a35d77ad5826e6556d3137672bb937Tinderbox User </funcprototype>
659d063f23a35d77ad5826e6556d3137672bb937Tinderbox User<funcprototype>
fd2597f75693a2279fdf588bd40dfe2407c42028Tinderbox User <paramdef>int <parameter>stayopen</parameter></paramdef>
659d063f23a35d77ad5826e6556d3137672bb937Tinderbox User </funcprototype>
659d063f23a35d77ad5826e6556d3137672bb937Tinderbox User<funcprototype>
659d063f23a35d77ad5826e6556d3137672bb937Tinderbox User<function>lwres_endhostent</function></funcdef>
659d063f23a35d77ad5826e6556d3137672bb937Tinderbox User </funcprototype>
fd2597f75693a2279fdf588bd40dfe2407c42028Tinderbox User<funcprototype>
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>
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>
14a656f94b1fd0ababd84a772228dfa52276ba15Evan Huntstruct hostent *
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>
659d063f23a35d77ad5826e6556d3137672bb937Tinderbox User<function>lwres_sethostent_r</function></funcdef>
659d063f23a35d77ad5826e6556d3137672bb937Tinderbox User <paramdef>int <parameter>stayopen</parameter></paramdef>
659d063f23a35d77ad5826e6556d3137672bb937Tinderbox User </funcprototype>
659d063f23a35d77ad5826e6556d3137672bb937Tinderbox User<funcprototype>
659d063f23a35d77ad5826e6556d3137672bb937Tinderbox User<function>lwres_endhostent_r</function></funcdef>
659d063f23a35d77ad5826e6556d3137672bb937Tinderbox User </funcprototype>
659d063f23a35d77ad5826e6556d3137672bb937Tinderbox User</funcsynopsis>
659d063f23a35d77ad5826e6556d3137672bb937Tinderbox User </refsynopsisdiv>
659d063f23a35d77ad5826e6556d3137672bb937Tinderbox User <refsection><info><title>DESCRIPTION</title></info>
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.
fd2597f75693a2279fdf588bd40dfe2407c42028Tinderbox User which is usually defined in
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#define h_addr h_addr_list[0] /* address, for backward compatibility */
395c95214142142854509945adf3293c0270e1c5Tinderbox User</programlisting>
395c95214142142854509945adf3293c0270e1c5Tinderbox User The members of this structure are:
fd2597f75693a2279fdf588bd40dfe2407c42028Tinderbox User <variablelist>
395c95214142142854509945adf3293c0270e1c5Tinderbox User <varlistentry>
395c95214142142854509945adf3293c0270e1c5Tinderbox User The official (canonical) name of the host.
14a656f94b1fd0ababd84a772228dfa52276ba15Evan Hunt </varlistentry>
395c95214142142854509945adf3293c0270e1c5Tinderbox User <varlistentry>
fd2597f75693a2279fdf588bd40dfe2407c42028Tinderbox User A NULL-terminated array of alternate names (nicknames) for the
395c95214142142854509945adf3293c0270e1c5Tinderbox User </varlistentry>
fd2597f75693a2279fdf588bd40dfe2407c42028Tinderbox User <varlistentry>
395c95214142142854509945adf3293c0270e1c5Tinderbox User The type of address being returned —
fd2597f75693a2279fdf588bd40dfe2407c42028Tinderbox User </varlistentry>
395c95214142142854509945adf3293c0270e1c5Tinderbox User <varlistentry>
395c95214142142854509945adf3293c0270e1c5Tinderbox User The length of the address in bytes.
395c95214142142854509945adf3293c0270e1c5Tinderbox User </varlistentry>
395c95214142142854509945adf3293c0270e1c5Tinderbox User <varlistentry>
395c95214142142854509945adf3293c0270e1c5Tinderbox User <term><constant>h_addr_list</constant></term>
14a656f94b1fd0ababd84a772228dfa52276ba15Evan Hunt terminated array of network addresses for the host.
395c95214142142854509945adf3293c0270e1c5Tinderbox User Host addresses are returned in network byte order.
14a656f94b1fd0ababd84a772228dfa52276ba15Evan Hunt </varlistentry>
395c95214142142854509945adf3293c0270e1c5Tinderbox User </variablelist>
395c95214142142854509945adf3293c0270e1c5Tinderbox User For backward compatibility with very old software,
395c95214142142854509945adf3293c0270e1c5Tinderbox User is the first address in
395c95214142142854509945adf3293c0270e1c5Tinderbox User provide iteration over the known host entries on systems that
395c95214142142854509945adf3293c0270e1c5Tinderbox User provide such functionality through facilities like
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><function>lwres_gethostbyname()</function>
fd2597f75693a2279fdf588bd40dfe2407c42028Tinderbox User and <function>lwres_gethostbyname2()</function> look up the
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> — 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 Reverse lookups of addresses are performed by
395c95214142142854509945adf3293c0270e1c5Tinderbox User <parameter>addr</parameter> is an address of length
395c95214142142854509945adf3293c0270e1c5Tinderbox User <parameter>len</parameter> bytes and protocol family
395c95214142142854509945adf3293c0270e1c5Tinderbox User <parameter>type</parameter> — <type>PF_INET</type> or
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
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>
14a656f94b1fd0ababd84a772228dfa52276ba15Evan Hunt which is a pointer to the <type>struct hostent</type> it created.
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
0ccb0e98c77a9b9636a036f8f64f5679a430aaf4Tinderbox User family <parameter>type</parameter> — <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 </refsection>
fd2597f75693a2279fdf588bd40dfe2407c42028Tinderbox User <refsection><info><title>RETURN VALUES</title></info>
659d063f23a35d77ad5826e6556d3137672bb937Tinderbox User The functions
659d063f23a35d77ad5826e6556d3137672bb937Tinderbox User return NULL to indicate an error. In this case the global variable
659d063f23a35d77ad5826e6556d3137672bb937Tinderbox User will contain one of the following error codes defined in
0ccb0e98c77a9b9636a036f8f64f5679a430aaf4Tinderbox User <variablelist>
fd2597f75693a2279fdf588bd40dfe2407c42028Tinderbox User <varlistentry>
395c95214142142854509945adf3293c0270e1c5Tinderbox User <term><constant>HOST_NOT_FOUND</constant></term>
395c95214142142854509945adf3293c0270e1c5Tinderbox User The host or address was not found.
395c95214142142854509945adf3293c0270e1c5Tinderbox User </varlistentry>
395c95214142142854509945adf3293c0270e1c5Tinderbox User <varlistentry>
395c95214142142854509945adf3293c0270e1c5Tinderbox User A recoverable error occurred, e.g., a timeout.
14a656f94b1fd0ababd84a772228dfa52276ba15Evan Hunt Retrying the lookup may succeed.
395c95214142142854509945adf3293c0270e1c5Tinderbox User </varlistentry>
395c95214142142854509945adf3293c0270e1c5Tinderbox User <varlistentry>
395c95214142142854509945adf3293c0270e1c5Tinderbox User <term><constant>NO_RECOVERY</constant></term>
395c95214142142854509945adf3293c0270e1c5Tinderbox User A non-recoverable error occurred.
fd2597f75693a2279fdf588bd40dfe2407c42028Tinderbox User </varlistentry>
14a656f94b1fd0ababd84a772228dfa52276ba15Evan Hunt <varlistentry>
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.
659d063f23a35d77ad5826e6556d3137672bb937Tinderbox User </varlistentry>
fd2597f75693a2279fdf588bd40dfe2407c42028Tinderbox User </variablelist>
61ab11c0ec845606f85452b2c9f2e223772aae00Tinderbox User <refentrytitle>lwres_hstrerror</refentrytitle><manvolnum>3</manvolnum>
61ab11c0ec845606f85452b2c9f2e223772aae00Tinderbox User </citerefentry>
61ab11c0ec845606f85452b2c9f2e223772aae00Tinderbox User translates these error codes to suitable error messages.
f5c27ecceb6dcba6ad8b75172fe5f9823d7a6d42Tinderbox User <para><function>lwres_gethostent()</function>
fd2597f75693a2279fdf588bd40dfe2407c42028Tinderbox User and <function>lwres_gethostent_r()</function>
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 <function>lwres_gethostbyname_r()</function> and
659d063f23a35d77ad5826e6556d3137672bb937Tinderbox User <function>lwres_gethostbyaddr_r()</function> set the global
659d063f23a35d77ad5826e6556d3137672bb937Tinderbox User <type>errno</type> to <errorcode>ERANGE</errorcode>.
659d063f23a35d77ad5826e6556d3137672bb937Tinderbox User </refsection>
659d063f23a35d77ad5826e6556d3137672bb937Tinderbox User <refsection><info><title>SEE ALSO</title></info>
659d063f23a35d77ad5826e6556d3137672bb937Tinderbox User <refentrytitle>gethostent</refentrytitle><manvolnum>3</manvolnum>
659d063f23a35d77ad5826e6556d3137672bb937Tinderbox User </citerefentry>,
659d063f23a35d77ad5826e6556d3137672bb937Tinderbox User <citerefentry>
fd2597f75693a2279fdf588bd40dfe2407c42028Tinderbox User <refentrytitle>lwres_getipnode</refentrytitle><manvolnum>3</manvolnum>
659d063f23a35d77ad5826e6556d3137672bb937Tinderbox User </citerefentry>,
659d063f23a35d77ad5826e6556d3137672bb937Tinderbox User <citerefentry>
fd2597f75693a2279fdf588bd40dfe2407c42028Tinderbox User <refentrytitle>lwres_hstrerror</refentrytitle><manvolnum>3</manvolnum>
659d063f23a35d77ad5826e6556d3137672bb937Tinderbox User </citerefentry>
659d063f23a35d77ad5826e6556d3137672bb937Tinderbox User </refsection>
659d063f23a35d77ad5826e6556d3137672bb937Tinderbox User <para><function>lwres_gethostbyname()</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>,
659d063f23a35d77ad5826e6556d3137672bb937Tinderbox User respectively.
659d063f23a35d77ad5826e6556d3137672bb937Tinderbox User The resolver daemon does not currently support any non-DNS
659d063f23a35d77ad5826e6556d3137672bb937Tinderbox User name services such as
659d063f23a35d77ad5826e6556d3137672bb937Tinderbox User consequently the above functions don't, either.
395c95214142142854509945adf3293c0270e1c5Tinderbox User </refsection>