lwres_getnameinfo.docbook revision 14a656f94b1fd0ababd84a772228dfa52276ba15
673N/A<!--
673N/A - Copyright (C) 2004, 2005, 2007, 2014 Internet Systems Consortium, Inc. ("ISC")
673N/A - Copyright (C) 2000, 2001 Internet Software Consortium.
673N/A -
673N/A - Permission to use, copy, modify, and/or distribute this software for any
673N/A - purpose with or without fee is hereby granted, provided that the above
673N/A - copyright notice and this permission notice appear in all copies.
673N/A -
673N/A - THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
673N/A - REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
673N/A - AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
673N/A - INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
673N/A - LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
673N/A - OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
673N/A - PERFORMANCE OF THIS SOFTWARE.
673N/A-->
673N/A<!-- Converted by db4-upgrade version 1.0 -->
673N/A<refentry xmlns="http://docbook.org/ns/docbook" version="5.0">
873N/A <info>
673N/A <date>2007-06-18</date>
673N/A </info>
673N/A <refentryinfo>
673N/A <corpname>ISC</corpname>
673N/A <corpauthor>Internet Systems Consortium, Inc.</corpauthor>
3215N/A </refentryinfo>
6022N/A
673N/A <refmeta>
673N/A <refentrytitle>lwres_getnameinfo</refentrytitle>
673N/A <manvolnum>3</manvolnum>
673N/A <refmiscinfo>BIND9</refmiscinfo>
673N/A </refmeta>
673N/A
673N/A <docinfo>
673N/A <copyright>
673N/A <year>2004</year>
673N/A <year>2005</year>
673N/A <year>2007</year>
673N/A <year>2014</year>
673N/A <holder>Internet Systems Consortium, Inc. ("ISC")</holder>
673N/A </copyright>
673N/A <copyright>
673N/A <year>2000</year>
673N/A <year>2001</year>
673N/A <holder>Internet Software Consortium.</holder>
673N/A </copyright>
673N/A </docinfo>
673N/A
673N/A <refnamediv>
2095N/A <refname>lwres_getnameinfo</refname>
2095N/A <refpurpose>lightweight resolver socket address structure to hostname and
2095N/A service name
2095N/A </refpurpose>
2095N/A </refnamediv>
673N/A <refsynopsisdiv>
673N/A <funcsynopsis>
673N/A<funcsynopsisinfo>#include &lt;lwres/netdb.h&gt;</funcsynopsisinfo>
673N/A<funcprototype>
673N/A <funcdef>
673N/Aint
673N/A<function>lwres_getnameinfo</function></funcdef>
673N/A <paramdef>const struct sockaddr *<parameter>sa</parameter></paramdef>
673N/A <paramdef>size_t <parameter>salen</parameter></paramdef>
673N/A <paramdef>char *<parameter>host</parameter></paramdef>
673N/A <paramdef>size_t <parameter>hostlen</parameter></paramdef>
673N/A <paramdef>char *<parameter>serv</parameter></paramdef>
673N/A <paramdef>size_t <parameter>servlen</parameter></paramdef>
673N/A <paramdef>int <parameter>flags</parameter></paramdef>
673N/A </funcprototype>
673N/A</funcsynopsis>
673N/A </refsynopsisdiv>
673N/A
673N/A <refsection><info><title>DESCRIPTION</title></info>
673N/A
673N/A
673N/A <para>
673N/A This function is equivalent to the
673N/A <citerefentry>
673N/A <refentrytitle>getnameinfo</refentrytitle><manvolnum>3</manvolnum>
673N/A </citerefentry> function defined in RFC2133.
673N/A <function>lwres_getnameinfo()</function> returns the
673N/A hostname for the
673N/A <type>struct sockaddr</type> <parameter>sa</parameter> which
673N/A is
673N/A <parameter>salen</parameter> bytes long. The hostname is of
673N/A length
673N/A <parameter>hostlen</parameter> and is returned via
673N/A <parameter>*host.</parameter> The maximum length of the
673N/A hostname is
673N/A 1025 bytes: <constant>NI_MAXHOST</constant>.
673N/A </para>
673N/A
6022N/A <para> The name of the service associated with the port number in
6022N/A <parameter>sa</parameter> is returned in <parameter>*serv.</parameter>
6022N/A It is <parameter>servlen</parameter> bytes long. The
6022N/A maximum length
6022N/A of the service name is <constant>NI_MAXSERV</constant> - 32
6022N/A bytes.
6022N/A </para>
6022N/A
6022N/A <para>
673N/A The <parameter>flags</parameter> argument sets the
6022N/A following
6022N/A bits:
6022N/A <variablelist>
6022N/A <varlistentry>
6022N/A <term><constant>NI_NOFQDN</constant></term>
6022N/A <listitem>
673N/A <para>
6022N/A A fully qualified domain name is not required for local hosts.
673N/A The local part of the fully qualified domain name is returned
673N/A instead.
673N/A </para>
</listitem>
</varlistentry>
<varlistentry>
<term><constant>NI_NUMERICHOST</constant></term>
<listitem>
<para>
Return the address in numeric form, as if calling inet_ntop(),
instead of a host name.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><constant>NI_NAMEREQD</constant></term>
<listitem>
<para>
A name is required. If the hostname cannot be found in the DNS
and
this flag is set, a non-zero error code is returned.
If the hostname is not found and the flag is not set, the
address is returned in numeric form.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><constant>NI_NUMERICSERV</constant></term>
<listitem>
<para>
The service name is returned as a digit string representing the
port number.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><constant>NI_DGRAM</constant></term>
<listitem>
<para>
Specifies that the service being looked up is a datagram
service, and causes getservbyport() to be called with a second
argument of "udp" instead of its default of "tcp". This is
required
for the few ports (512-514) that have different services for UDP
and
TCP.
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
</refsection>
<refsection><info><title>RETURN VALUES</title></info>
<para><function>lwres_getnameinfo()</function>
returns 0 on success or a non-zero error code if an error occurs.
</para>
</refsection>
<refsection><info><title>SEE ALSO</title></info>
<para><citerefentry>
<refentrytitle>RFC2133</refentrytitle>
</citerefentry>,
<citerefentry>
<refentrytitle>getservbyport</refentrytitle><manvolnum>3</manvolnum>
</citerefentry>,
<citerefentry>
<refentrytitle>lwres</refentrytitle><manvolnum>3</manvolnum>
</citerefentry>,
<citerefentry>
<refentrytitle>lwres_getnameinfo</refentrytitle><manvolnum>3</manvolnum>
</citerefentry>,
<citerefentry>
<refentrytitle>lwres_getnamebyaddr</refentrytitle><manvolnum>3</manvolnum>
</citerefentry>.
<citerefentry>
<refentrytitle>lwres_net_ntop</refentrytitle><manvolnum>3</manvolnum>
</citerefentry>.
</para>
</refsection>
<refsection><info><title>BUGS</title></info>
<para>
RFC2133 fails to define what the nonzero return values of
<citerefentry>
<refentrytitle>getnameinfo</refentrytitle><manvolnum>3</manvolnum>
</citerefentry>
are.
</para>
</refsection>
</refentry>