Merge from vendor branch BZIP:
[dragonfly.git] / contrib / bind-9.3 / lib / lwres / man / lwres_getnameinfo.html
1 <!--
2  - Copyright (C) 2004, 2005 Internet Systems Consortium, Inc. ("ISC")
3  - Copyright (C) 2000, 2001 Internet Software Consortium.
4  - 
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.
8  - 
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.
16 -->
17 <!-- $Id: lwres_getnameinfo.html,v 1.5.2.1.4.12 2006/06/29 13:02:31 marka Exp $ -->
18 <html>
19 <head>
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.70.1">
23 </head>
24 <body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="refentry" lang="en">
25 <a name="id2482688"></a><div class="titlepage"></div>
26 <div class="refnamediv">
27 <h2>Name</h2>
28 <p>lwres_getnameinfo &#8212; lightweight resolver socket address structure to hostname and service name</p>
29 </div>
30 <div class="refsynopsisdiv">
31 <h2>Synopsis</h2>
32 <div class="funcsynopsis">
33 <pre class="funcsynopsisinfo">#include &lt;lwres/netdb.h&gt;</pre>
34 <table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0">
35 <tr>
36 <td><code class="funcdef">
37 int
38 <b class="fsfunc">lwres_getnameinfo</b>(</code></td>
39 <td> </td>
40 <td>, </td>
41 </tr>
42 <tr>
43 <td> </td>
44 <td> </td>
45 <td>, </td>
46 </tr>
47 <tr>
48 <td> </td>
49 <td> </td>
50 <td>, </td>
51 </tr>
52 <tr>
53 <td> </td>
54 <td> </td>
55 <td>, </td>
56 </tr>
57 <tr>
58 <td> </td>
59 <td> </td>
60 <td>, </td>
61 </tr>
62 <tr>
63 <td> </td>
64 <td> </td>
65 <td>, </td>
66 </tr>
67 <tr>
68 <td> </td>
69 <td> </td>
70 <td>, </td>
71 </tr>
72 <tr>
73 <td> </td>
74 <td> </td>
75 <td>
76 <code>)</code>;</td>
77 </tr>
78 </table>
79 </div>
80 </div>
81 <div class="refsect1" lang="en">
82 <a name="id2549427"></a><h2>DESCRIPTION</h2>
83 <p> This function is equivalent to the <span class="citerefentry"><span class="refentrytitle">getnameinfo</span>(3)</span> function defined in RFC2133.
84 <code class="function">lwres_getnameinfo()</code> returns the hostname for the
85 <span class="type">struct sockaddr</span> <em class="parameter"><code>sa</code></em> which is
86 <em class="parameter"><code>salen</code></em> bytes long.  The hostname is of length
87 <em class="parameter"><code>hostlen</code></em> and is returned via
88 <em class="parameter"><code>*host.</code></em> The maximum length of the hostname is
89 1025 bytes: <code class="constant">NI_MAXHOST</code>.</p>
90 <p> The name of the service associated with the port number in
91 <em class="parameter"><code>sa</code></em> is returned in <em class="parameter"><code>*serv.</code></em>
92 It is <em class="parameter"><code>servlen</code></em> bytes long.  The maximum length
93 of the service name is <code class="constant">NI_MAXSERV</code> - 32 bytes.
94 </p>
95 <p> The <em class="parameter"><code>flags</code></em> argument sets the following
96 bits:
97 </p>
98 <div class="variablelist"><dl>
99 <dt><span class="term"><code class="constant">NI_NOFQDN</code></span></dt>
100 <dd><p>
101 A fully qualified domain name is not required for local hosts.
102 The local part of the fully qualified domain name is returned instead.
103 </p></dd>
104 <dt><span class="term"><code class="constant">NI_NUMERICHOST</code></span></dt>
105 <dd><p>
106 Return the address in numeric form, as if calling inet_ntop(),
107 instead of a host name.
108 </p></dd>
109 <dt><span class="term"><code class="constant">NI_NAMEREQD</code></span></dt>
110 <dd><p>
111 A name is required. If the hostname cannot be found in the DNS and
112 this flag is set, a non-zero error code is returned.
113 If the hostname is not found and the flag is not set, the 
114 address is returned in numeric form.
115 </p></dd>
116 <dt><span class="term"><code class="constant">NI_NUMERICSERV</code></span></dt>
117 <dd><p>
118 The service name is returned as a digit string representing the port number.
119 </p></dd>
120 <dt><span class="term"><code class="constant">NI_DGRAM</code></span></dt>
121 <dd><p>
122 Specifies that the service being looked up is a datagram
123 service,  and causes getservbyport() to be called with a second
124 argument of "udp" instead of its default of "tcp".  This is required
125 for the few ports (512-514) that have different services for UDP and
126 TCP.
127 </p></dd>
128 </dl></div>
129 <p>
130 </p>
131 </div>
132 <div class="refsect1" lang="en">
133 <a name="id2549553"></a><h2>RETURN VALUES</h2>
134 <p>
135 <code class="function">lwres_getnameinfo()</code>
136 returns 0 on success or a non-zero error code if an error occurs.
137 </p>
138 </div>
139 <div class="refsect1" lang="en">
140 <a name="id2549634"></a><h2>SEE ALSO</h2>
141 <p>
142 <span class="citerefentry"><span class="refentrytitle">RFC2133</span></span>,
143 <span class="citerefentry"><span class="refentrytitle">getservbyport</span>(3)</span>,
144 <span class="citerefentry"><span class="refentrytitle">lwres</span>(3)</span>,
145 <span class="citerefentry"><span class="refentrytitle">lwres_getnameinfo</span>(3)</span>,
146 <span class="citerefentry"><span class="refentrytitle">lwres_getnamebyaddr</span>(3)</span>.
147 <span class="citerefentry"><span class="refentrytitle">lwres_net_ntop</span>(3)</span>.
148 </p>
149 </div>
150 <div class="refsect1" lang="en">
151 <a name="id2549692"></a><h2>BUGS</h2>
152 <p>
153 RFC2133 fails to define what the nonzero return values of
154 <span class="citerefentry"><span class="refentrytitle">getnameinfo</span>(3)</span>
155 are.
156 </p>
157 </div>
158 </div></body>
159 </html>