- Copyright (C) 2004, 2005, 2007, 2014, 2015 Internet Systems Consortium, Inc. ("ISC") - Copyright (C) 2000, 2001 Internet Software Consortium. - Permission to use, copy, modify, and/or distribute this software for any - purpose with or without fee is hereby granted, provided that the above - copyright notice and this permission notice appear in all copies. - THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH - REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY - AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, - INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM - LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE - OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - PERFORMANCE OF THIS SOFTWARE. <
meta http-
equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<
title>lwres_getnameinfo</
title>
<
meta name="generator" content="DocBook XSL Stylesheets V1.78.1">
<
body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><
div class="refentry">
<
a name="id-1"></
a><
div class="titlepage"></
div>
<
p>lwres_getnameinfo — lightweight resolver socket address structure to hostname and
<
div class="refsynopsisdiv">
<
div class="funcsynopsis">
<
pre class="funcsynopsisinfo">#include <
lwres/
netdb.h></
pre>
<
table border="0" class="funcprototype-table" summary="Function synopsis" style="cellspacing: 0; cellpadding: 0;">
<
td><
code class="funcdef">
<
b class="fsfunc">lwres_getnameinfo</
b>(</
code></
td>
<
td>const struct sockaddr *<
var class="pdparam">sa</
var>, </
td>
<
td>size_t <
var class="pdparam">salen</
var>, </
td>
<
td>char *<
var class="pdparam">host</
var>, </
td>
<
td>size_t <
var class="pdparam">hostlen</
var>, </
td>
<
td>char *<
var class="pdparam">serv</
var>, </
td>
<
td>size_t <
var class="pdparam">servlen</
var>, </
td>
<
td>int <
var class="pdparam">flags</
var><
code>)</
code>;</
td>
<
div class="funcprototype-spacer">�</
div>
<
a name="id-1.7"></
a><
h2>DESCRIPTION</
h2>
This function is equivalent to the
<
span class="citerefentry"><
span class="refentrytitle">getnameinfo</
span>(3)</
span> function defined in RFC2133.
<
code class="function">lwres_getnameinfo()</
code> returns the
<
span class="type">struct sockaddr</
span> <
em class="parameter"><
code>sa</
code></
em> which
<
em class="parameter"><
code>salen</
code></
em> bytes long. The hostname is of
<
em class="parameter"><
code>hostlen</
code></
em> and is returned via
<
em class="parameter"><
code>*host.</
code></
em> The maximum length of the
1025 bytes: <
code class="constant">NI_MAXHOST</
code>.
<
p> The name of the service associated with the port number in
<
em class="parameter"><
code>sa</
code></
em> is returned in <
em class="parameter"><
code>*serv.</
code></
em>
It is <
em class="parameter"><
code>servlen</
code></
em> bytes long. The
of the service name is <
code class="constant">NI_MAXSERV</
code> - 32
The <
em class="parameter"><
code>flags</
code></
em> argument sets the
<
div class="variablelist"><
dl class="variablelist">
<
dt><
span class="term"><
code class="constant">NI_NOFQDN</
code></
span></
dt>
A fully qualified domain name is not required for local hosts.
The local part of the fully qualified domain name is returned
<
dt><
span class="term"><
code class="constant">NI_NUMERICHOST</
code></
span></
dt>
Return the address in numeric form, as if calling inet_ntop(),
<
dt><
span class="term"><
code class="constant">NI_NAMEREQD</
code></
span></
dt>
A name is required. If the hostname cannot be found in the DNS
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.
<
dt><
span class="term"><
code class="constant">NI_NUMERICSERV</
code></
span></
dt>
The service name is returned as a digit string representing the
<
dt><
span class="term"><
code class="constant">NI_DGRAM</
code></
span></
dt>
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
for the few ports (512-514) that have different services for UDP
<
a name="id-1.8"></
a><
h2>RETURN VALUES</
h2>
<
p><
code class="function">lwres_getnameinfo()</
code>
returns 0 on success or a non-zero error code if an error occurs.
<
a name="id-1.9"></
a><
h2>SEE ALSO</
h2>
<
p><
span class="citerefentry"><
span class="refentrytitle">RFC2133</
span></
span>,
<
span class="citerefentry"><
span class="refentrytitle">getservbyport</
span>(3)</
span>,
<
span class="citerefentry"><
span class="refentrytitle">lwres</
span>(3)</
span>,
<
span class="citerefentry"><
span class="refentrytitle">lwres_getnameinfo</
span>(3)</
span>,
<
span class="citerefentry"><
span class="refentrytitle">lwres_getnamebyaddr</
span>(3)</
span>.
<
span class="citerefentry"><
span class="refentrytitle">lwres_net_ntop</
span>(3)</
span>.
<
a name="id-1.10"></
a><
h2>BUGS</
h2>
RFC2133 fails to define what the nonzero return values of
<
span class="citerefentry"><
span class="refentrytitle">getnameinfo</
span>(3)</
span>