lwres_getnameinfo.docbook revision c651f15b30f1dae5cc2f00878fb5da5b3a35a468
0N/A<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook V4.1//EN">
0N/A<!--
0N/A - Copyright (C) 2004, 2005 Internet Systems Consortium, Inc. ("ISC")
0N/A - Copyright (C) 2000, 2001 Internet Software Consortium.
0N/A -
0N/A - Permission to use, copy, modify, and distribute this software for any
0N/A - purpose with or without fee is hereby granted, provided that the above
0N/A - copyright notice and this permission notice appear in all copies.
0N/A -
0N/A - THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
0N/A - REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
0N/A - AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
0N/A - INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
0N/A - LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
0N/A - OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
0N/A - PERFORMANCE OF THIS SOFTWARE.
0N/A-->
0N/A
873N/A<!-- $Id: lwres_getnameinfo.docbook,v 1.5 2005/04/07 03:50:02 marka Exp $ -->
0N/A
0N/A<refentry>
0N/A
0N/A<refentryinfo>
0N/A<date>Jun 30, 2000</date>
868N/A</refentryinfo>
0N/A
338N/A<refmeta>
2086N/A<refentrytitle>lwres_getnameinfo</refentrytitle>
0N/A<manvolnum>3</manvolnum>
0N/A<refmiscinfo>BIND9</refmiscinfo>
2086N/A</refmeta>
2086N/A
0N/A<refnamediv>
338N/A<refname>lwres_getnameinfo</refname>
338N/A<refpurpose>lightweight resolver socket address structure to hostname and service name</refpurpose>
338N/A</refnamediv>
0N/A<refsynopsisdiv>
2095N/A<funcsynopsis>
2095N/A<funcsynopsisinfo>#include &lt;lwres/netdb.h&gt;</funcsynopsisinfo>
2095N/A<funcprototype>
2095N/A<funcdef>
2095N/Aint
2095N/A<function>lwres_getnameinfo</function></funcdef>
0N/A<paramdef>const struct sockaddr *sa</paramdef>
338N/A<paramdef>size_t salen</paramdef>
338N/A<paramdef>char *host</paramdef>
338N/A<paramdef>size_t hostlen</paramdef>
0N/A<paramdef>char *serv</paramdef>
338N/A<paramdef>size_t servlen</paramdef>
338N/A<paramdef>int flags</paramdef>
2086N/A</funcprototype>
0N/A</funcsynopsis>
338N/A</refsynopsisdiv>
338N/A
2086N/A<refsect1>
0N/A<title>DESCRIPTION</title>
0N/A
0N/A<para> This function is equivalent to the <citerefentry>
0N/A<refentrytitle>getnameinfo</refentrytitle><manvolnum>3</manvolnum>
0N/A</citerefentry> function defined in RFC2133.
0N/A<function>lwres_getnameinfo()</function> returns the hostname for the
338N/A<type>struct sockaddr</type> <parameter>sa</parameter> which is
338N/A<parameter>salen</parameter> bytes long. The hostname is of length
338N/A<parameter>hostlen</parameter> and is returned via
338N/A<parameter>*host.</parameter> The maximum length of the hostname is
338N/A1025 bytes: <constant>NI_MAXHOST</constant>.</para>
338N/A
0N/A<para> The name of the service associated with the port number in
338N/A<parameter>sa</parameter> is returned in <parameter>*serv.</parameter>
2086N/AIt is <parameter>servlen</parameter> bytes long. The maximum length
0N/Aof the service name is <constant>NI_MAXSERV</constant> - 32 bytes.
0N/A</para>
0N/A
2086N/A<para> The <parameter>flags</parameter> argument sets the following
0N/Abits:
0N/A<variablelist>
0N/A<varlistentry><term><constant>NI_NOFQDN</constant></term>
0N/A<listitem>
0N/A<para>
0N/AA fully qualified domain name is not required for local hosts.
0N/AThe local part of the fully qualified domain name is returned instead.
338N/A</para></listitem></varlistentry>
338N/A<varlistentry><term><constant>NI_NUMERICHOST</constant></term>
338N/A<listitem>
338N/A<para>
338N/AReturn the address in numeric form, as if calling inet_ntop(),
338N/Ainstead of a host name.
338N/A</para></listitem></varlistentry>
338N/A<varlistentry><term><constant>NI_NAMEREQD</constant></term>
338N/A<listitem>
338N/A<para>
0N/AA name is required. If the hostname cannot be found in the DNS and
338N/Athis flag is set, a non-zero error code is returned.
2086N/AIf the hostname is not found and the flag is not set, the
2086N/Aaddress is returned in numeric form.
0N/A</para></listitem></varlistentry>
0N/A<varlistentry><term><constant>NI_NUMERICSERV</constant></term>
0N/A<listitem>
0N/A<para>
0N/AThe service name is returned as a digit string representing the port number.
0N/A</para></listitem></varlistentry>
0N/A<varlistentry><term><constant>NI_DGRAM</constant></term>
0N/A<listitem>
0N/A<para>
338N/ASpecifies that the service being looked up is a datagram
338N/Aservice, and causes getservbyport() to be called with a second
0N/Aargument of "udp" instead of its default of "tcp". This is required
338N/Afor the few ports (512-514) that have different services for UDP and
338N/ATCP.
338N/A</para></listitem></varlistentry>
0N/A</variablelist>
2095N/A</para>
0N/A</refsect1>
0N/A
0N/A<refsect1>
0N/A<title>RETURN VALUES</title>
0N/A<para>
0N/A<function>lwres_getnameinfo()</function>
0N/Areturns 0 on success or a non-zero error code if an error occurs.
338N/A</para>
338N/A</refsect1>
0N/A<refsect1>
338N/A<title>SEE ALSO</title>
338N/A<para>
0N/A<citerefentry>
2095N/A<refentrytitle>RFC2133</refentrytitle>
0N/A</citerefentry>,
0N/A<citerefentry>
0N/A<refentrytitle>getservbyport</refentrytitle><manvolnum>3</manvolnum>
0N/A</citerefentry>,
0N/A<citerefentry>
0N/A<refentrytitle>lwres</refentrytitle><manvolnum>3</manvolnum>
0N/A</citerefentry>,
338N/A<citerefentry>
338N/A<refentrytitle>lwres_getnameinfo</refentrytitle><manvolnum>3</manvolnum>
338N/A</citerefentry>,
0N/A<citerefentry>
338N/A<refentrytitle>lwres_getnamebyaddr</refentrytitle><manvolnum>3</manvolnum>
338N/A</citerefentry>.
338N/A<citerefentry>
0N/A<refentrytitle>lwres_net_ntop</refentrytitle><manvolnum>3</manvolnum>
2095N/A</citerefentry>.
0N/A</refsect1>
0N/A<refsect1>
0N/A<title>BUGS</title>
0N/A<para>
0N/ARFC2133 fails to define what the nonzero return values of
0N/A<citerefentry>
0N/A<refentrytitle>getnameinfo</refentrytitle><manvolnum>3</manvolnum>
338N/A</citerefentry>
338N/Aare.
0N/A</para>
338N/A</refsect1>
338N/A</refentry>
0N/A