2 - Copyright (C) 2004, 2005 Internet Systems Consortium, Inc. ("ISC")
3 - Copyright (C) 2000, 2001 Internet Software Consortium.
5 - Permission to use, copy, modify, and distribute this software for any
6 - purpose with or without fee is hereby granted, provided that the above
7 - copyright notice and this permission notice appear in all copies.
9 - THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
10 - REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
11 - AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
12 - INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
13 - LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
14 - OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
15 - PERFORMANCE OF THIS SOFTWARE.
17 <!-- $Id: lwres_getnameinfo.html,v 1.5.2.1.4.9 2005/10/13 02:33:56 marka Exp $ -->
20 <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
21 <title>lwres_getnameinfo</title>
22 <meta name="generator" content="DocBook XSL Stylesheets V1.69.1">
24 <body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="refentry" lang="en">
25 <a name="id2463721"></a><div class="titlepage"></div>
26 <div class="refnamediv">
28 <p>lwres_getnameinfo — lightweight resolver socket address structure to hostname and service name</p>
30 <div class="refsynopsisdiv">
32 <div class="funcsynopsis">
33 <pre class="funcsynopsisinfo">#include <lwres/netdb.h></pre>
34 <table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0">
36 <td><code class="funcdef">
38 <b class="fsfunc">lwres_getnameinfo</b>(</code></td>
76 <div class="refsect1" lang="en">
77 <a name="id2525862"></a><h2>DESCRIPTION</h2>
78 <p> This function is equivalent to the <span class="citerefentry"><span class="refentrytitle">getnameinfo</span>(3)</span> function defined in RFC2133.
79 <code class="function">lwres_getnameinfo()</code> returns the hostname for the
80 <span class="type">struct sockaddr</span> <em class="parameter"><code>sa</code></em> which is
81 <em class="parameter"><code>salen</code></em> bytes long. The hostname is of length
82 <em class="parameter"><code>hostlen</code></em> and is returned via
83 <em class="parameter"><code>*host.</code></em> The maximum length of the hostname is
84 1025 bytes: <code class="constant">NI_MAXHOST</code>.</p>
85 <p> The name of the service associated with the port number in
86 <em class="parameter"><code>sa</code></em> is returned in <em class="parameter"><code>*serv.</code></em>
87 It is <em class="parameter"><code>servlen</code></em> bytes long. The maximum length
88 of the service name is <code class="constant">NI_MAXSERV</code> - 32 bytes.
90 <p> The <em class="parameter"><code>flags</code></em> argument sets the following
93 <div class="variablelist"><dl>
94 <dt><span class="term"><code class="constant">NI_NOFQDN</code></span></dt>
96 A fully qualified domain name is not required for local hosts.
97 The local part of the fully qualified domain name is returned instead.
99 <dt><span class="term"><code class="constant">NI_NUMERICHOST</code></span></dt>
101 Return the address in numeric form, as if calling inet_ntop(),
102 instead of a host name.
104 <dt><span class="term"><code class="constant">NI_NAMEREQD</code></span></dt>
106 A name is required. If the hostname cannot be found in the DNS and
107 this flag is set, a non-zero error code is returned.
108 If the hostname is not found and the flag is not set, the
109 address is returned in numeric form.
111 <dt><span class="term"><code class="constant">NI_NUMERICSERV</code></span></dt>
113 The service name is returned as a digit string representing the port number.
115 <dt><span class="term"><code class="constant">NI_DGRAM</code></span></dt>
117 Specifies that the service being looked up is a datagram
118 service, and causes getservbyport() to be called with a second
119 argument of "udp" instead of its default of "tcp". This is required
120 for the few ports (512-514) that have different services for UDP and
127 <div class="refsect1" lang="en">
128 <a name="id2525988"></a><h2>RETURN VALUES</h2>
130 <code class="function">lwres_getnameinfo()</code>
131 returns 0 on success or a non-zero error code if an error occurs.
134 <div class="refsect1" lang="en">
135 <a name="id2526001"></a><h2>SEE ALSO</h2>
137 <span class="citerefentry"><span class="refentrytitle">RFC2133</span></span>,
138 <span class="citerefentry"><span class="refentrytitle">getservbyport</span>(3)</span>,
139 <span class="citerefentry"><span class="refentrytitle">lwres</span>(3)</span>,
140 <span class="citerefentry"><span class="refentrytitle">lwres_getnameinfo</span>(3)</span>,
141 <span class="citerefentry"><span class="refentrytitle">lwres_getnamebyaddr</span>(3)</span>.
142 <span class="citerefentry"><span class="refentrytitle">lwres_net_ntop</span>(3)</span>.
145 <div class="refsect1" lang="en">
146 <a name="id2526059"></a><h2>BUGS</h2>
148 RFC2133 fails to define what the nonzero return values of
149 <span class="citerefentry"><span class="refentrytitle">getnameinfo</span>(3)</span>