]> CyberLeo.Net >> Repos - FreeBSD/stable/9.git/blob - contrib/bind9/lib/lwres/man/lwres_getnameinfo.html
MFC r363988:
[FreeBSD/stable/9.git] / contrib / bind9 / lib / lwres / man / lwres_getnameinfo.html
1 <!--
2  - Copyright (C) 2004, 2005, 2007, 2014, 2015 Internet Systems Consortium, Inc. ("ISC")
3  - Copyright (C) 2000, 2001 Internet Software Consortium.
4  - 
5  - Permission to use, copy, modify, and/or 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 <html>
18 <head>
19 <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
20 <title>lwres_getnameinfo</title>
21 <meta name="generator" content="DocBook XSL Stylesheets V1.78.1">
22 </head>
23 <body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="refentry">
24 <a name="id-1"></a><div class="titlepage"></div>
25 <div class="refnamediv">
26 <h2>Name</h2>
27 <p>lwres_getnameinfo &#8212; lightweight resolver socket address structure to hostname and
28       service name
29     </p>
30 </div>
31 <div class="refsynopsisdiv">
32 <h2>Synopsis</h2>
33 <div class="funcsynopsis">
34 <pre class="funcsynopsisinfo">#include &lt;lwres/netdb.h&gt;</pre>
35 <table border="0" class="funcprototype-table" summary="Function synopsis" style="cellspacing: 0; cellpadding: 0;">
36 <tr>
37 <td><code class="funcdef">
38 int
39 <b class="fsfunc">lwres_getnameinfo</b>(</code></td>
40 <td>const struct sockaddr *<var class="pdparam">sa</var>, </td>
41 </tr>
42 <tr>
43 <td> </td>
44 <td>size_t <var class="pdparam">salen</var>, </td>
45 </tr>
46 <tr>
47 <td> </td>
48 <td>char *<var class="pdparam">host</var>, </td>
49 </tr>
50 <tr>
51 <td> </td>
52 <td>size_t <var class="pdparam">hostlen</var>, </td>
53 </tr>
54 <tr>
55 <td> </td>
56 <td>char *<var class="pdparam">serv</var>, </td>
57 </tr>
58 <tr>
59 <td> </td>
60 <td>size_t <var class="pdparam">servlen</var>, </td>
61 </tr>
62 <tr>
63 <td> </td>
64 <td>int <var class="pdparam">flags</var><code>)</code>;</td>
65 </tr>
66 </table>
67 <div class="funcprototype-spacer"> </div>
68 </div>
69 </div>
70 <div class="refsection">
71 <a name="id-1.7"></a><h2>DESCRIPTION</h2>
72 <p>
73        This function is equivalent to the
74       <span class="citerefentry"><span class="refentrytitle">getnameinfo</span>(3)</span> function defined in RFC2133.
75       <code class="function">lwres_getnameinfo()</code> returns the
76       hostname for the
77       <span class="type">struct sockaddr</span> <em class="parameter"><code>sa</code></em> which
78       is
79       <em class="parameter"><code>salen</code></em> bytes long.  The hostname is of
80       length
81       <em class="parameter"><code>hostlen</code></em> and is returned via
82       <em class="parameter"><code>*host.</code></em> The maximum length of the
83       hostname is
84       1025 bytes: <code class="constant">NI_MAXHOST</code>.
85     </p>
86 <p> The name of the service associated with the port number in
87       <em class="parameter"><code>sa</code></em> is returned in <em class="parameter"><code>*serv.</code></em>
88       It is <em class="parameter"><code>servlen</code></em> bytes long.  The
89       maximum length
90       of the service name is <code class="constant">NI_MAXSERV</code> - 32
91       bytes.
92     </p>
93 <p>
94        The <em class="parameter"><code>flags</code></em> argument sets the
95       following
96       bits:
97       </p>
98 <div class="variablelist"><dl class="variablelist">
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
103               instead.
104             </p></dd>
105 <dt><span class="term"><code class="constant">NI_NUMERICHOST</code></span></dt>
106 <dd><p>
107               Return the address in numeric form, as if calling inet_ntop(),
108               instead of a host name.
109             </p></dd>
110 <dt><span class="term"><code class="constant">NI_NAMEREQD</code></span></dt>
111 <dd><p>
112               A name is required. If the hostname cannot be found in the DNS
113               and
114               this flag is set, a non-zero error code is returned.
115               If the hostname is not found and the flag is not set, the
116               address is returned in numeric form.
117             </p></dd>
118 <dt><span class="term"><code class="constant">NI_NUMERICSERV</code></span></dt>
119 <dd><p>
120               The service name is returned as a digit string representing the
121               port number.
122             </p></dd>
123 <dt><span class="term"><code class="constant">NI_DGRAM</code></span></dt>
124 <dd><p>
125               Specifies that the service being looked up is a datagram
126               service,  and causes getservbyport() to be called with a second
127               argument of "udp" instead of its default of "tcp".  This is
128               required
129               for the few ports (512-514) that have different services for UDP
130               and
131               TCP.
132             </p></dd>
133 </dl></div>
134 <p>
135     </p>
136 </div>
137 <div class="refsection">
138 <a name="id-1.8"></a><h2>RETURN VALUES</h2>
139 <p><code class="function">lwres_getnameinfo()</code>
140       returns 0 on success or a non-zero error code if an error occurs.
141     </p>
142 </div>
143 <div class="refsection">
144 <a name="id-1.9"></a><h2>SEE ALSO</h2>
145 <p><span class="citerefentry"><span class="refentrytitle">RFC2133</span></span>,
146       <span class="citerefentry"><span class="refentrytitle">getservbyport</span>(3)</span>,
147       <span class="citerefentry"><span class="refentrytitle">lwres</span>(3)</span>,
148       <span class="citerefentry"><span class="refentrytitle">lwres_getnameinfo</span>(3)</span>,
149       <span class="citerefentry"><span class="refentrytitle">lwres_getnamebyaddr</span>(3)</span>.
150       <span class="citerefentry"><span class="refentrytitle">lwres_net_ntop</span>(3)</span>.
151     </p>
152 </div>
153 <div class="refsection">
154 <a name="id-1.10"></a><h2>BUGS</h2>
155 <p>
156       RFC2133 fails to define what the nonzero return values of
157       <span class="citerefentry"><span class="refentrytitle">getnameinfo</span>(3)</span>
158       are.
159     </p>
160 </div>
161 </div></body>
162 </html>