]> CyberLeo.Net >> Repos - FreeBSD/releng/8.1.git/blob - contrib/bind9/lib/lwres/man/lwres_getnameinfo.docbook
Copy stable/8 to releng/8.1 in preparation for 8.1-RC1.
[FreeBSD/releng/8.1.git] / contrib / bind9 / lib / lwres / man / lwres_getnameinfo.docbook
1 <!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN"
2                "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd"
3                [<!ENTITY mdash "&#8212;">]>
4 <!--
5  - Copyright (C) 2004, 2005, 2007  Internet Systems Consortium, Inc. ("ISC")
6  - Copyright (C) 2000, 2001  Internet Software Consortium.
7  -
8  - Permission to use, copy, modify, and/or distribute this software for any
9  - purpose with or without fee is hereby granted, provided that the above
10  - copyright notice and this permission notice appear in all copies.
11  -
12  - THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
13  - REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
14  - AND FITNESS.  IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
15  - INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
16  - LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
17  - OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
18  - PERFORMANCE OF THIS SOFTWARE.
19 -->
20
21 <!-- $Id: lwres_getnameinfo.docbook,v 1.10 2007/06/18 23:47:51 tbox Exp $ -->
22 <refentry>
23
24   <refentryinfo>
25     <date>Jun 30, 2000</date>
26   </refentryinfo>
27
28   <refmeta>
29     <refentrytitle>lwres_getnameinfo</refentrytitle>
30     <manvolnum>3</manvolnum>
31     <refmiscinfo>BIND9</refmiscinfo>
32   </refmeta>
33
34   <docinfo>
35     <copyright>
36       <year>2004</year>
37       <year>2005</year>
38       <year>2007</year>
39       <holder>Internet Systems Consortium, Inc. ("ISC")</holder>
40     </copyright>
41     <copyright>
42       <year>2000</year>
43       <year>2001</year>
44       <holder>Internet Software Consortium.</holder>
45     </copyright>
46   </docinfo>
47
48   <refnamediv>
49     <refname>lwres_getnameinfo</refname>
50     <refpurpose>lightweight resolver socket address structure to hostname and
51       service name
52     </refpurpose>
53   </refnamediv>
54   <refsynopsisdiv>
55     <funcsynopsis>
56 <funcsynopsisinfo>#include &lt;lwres/netdb.h&gt;</funcsynopsisinfo>
57 <funcprototype>
58         <funcdef>
59 int
60 <function>lwres_getnameinfo</function></funcdef>
61         <paramdef>const struct sockaddr *<parameter>sa</parameter></paramdef>
62         <paramdef>size_t <parameter>salen</parameter></paramdef>
63         <paramdef>char *<parameter>host</parameter></paramdef>
64         <paramdef>size_t <parameter>hostlen</parameter></paramdef>
65         <paramdef>char *<parameter>serv</parameter></paramdef>
66         <paramdef>size_t <parameter>servlen</parameter></paramdef>
67         <paramdef>int <parameter>flags</parameter></paramdef>
68       </funcprototype>
69 </funcsynopsis>
70   </refsynopsisdiv>
71
72   <refsect1>
73     <title>DESCRIPTION</title>
74
75     <para>
76        This function is equivalent to the
77       <citerefentry>
78         <refentrytitle>getnameinfo</refentrytitle><manvolnum>3</manvolnum>
79       </citerefentry> function defined in RFC2133.
80       <function>lwres_getnameinfo()</function> returns the
81       hostname for the
82       <type>struct sockaddr</type> <parameter>sa</parameter> which
83       is
84       <parameter>salen</parameter> bytes long.  The hostname is of
85       length
86       <parameter>hostlen</parameter> and is returned via
87       <parameter>*host.</parameter> The maximum length of the
88       hostname is
89       1025 bytes: <constant>NI_MAXHOST</constant>.
90     </para>
91
92     <para> The name of the service associated with the port number in
93       <parameter>sa</parameter> is returned in <parameter>*serv.</parameter>
94       It is <parameter>servlen</parameter> bytes long.  The
95       maximum length
96       of the service name is <constant>NI_MAXSERV</constant> - 32
97       bytes.
98     </para>
99
100     <para>
101        The <parameter>flags</parameter> argument sets the
102       following
103       bits:
104       <variablelist>
105         <varlistentry>
106           <term><constant>NI_NOFQDN</constant></term>
107           <listitem>
108             <para>
109               A fully qualified domain name is not required for local hosts.
110               The local part of the fully qualified domain name is returned
111               instead.
112             </para>
113           </listitem>
114         </varlistentry>
115         <varlistentry>
116           <term><constant>NI_NUMERICHOST</constant></term>
117           <listitem>
118             <para>
119               Return the address in numeric form, as if calling inet_ntop(),
120               instead of a host name.
121             </para>
122           </listitem>
123         </varlistentry>
124         <varlistentry>
125           <term><constant>NI_NAMEREQD</constant></term>
126           <listitem>
127             <para>
128               A name is required. If the hostname cannot be found in the DNS
129               and
130               this flag is set, a non-zero error code is returned.
131               If the hostname is not found and the flag is not set, the
132               address is returned in numeric form.
133             </para>
134           </listitem>
135         </varlistentry>
136         <varlistentry>
137           <term><constant>NI_NUMERICSERV</constant></term>
138           <listitem>
139             <para>
140               The service name is returned as a digit string representing the
141               port number.
142             </para>
143           </listitem>
144         </varlistentry>
145         <varlistentry>
146           <term><constant>NI_DGRAM</constant></term>
147           <listitem>
148             <para>
149               Specifies that the service being looked up is a datagram
150               service,  and causes getservbyport() to be called with a second
151               argument of "udp" instead of its default of "tcp".  This is
152               required
153               for the few ports (512-514) that have different services for UDP
154               and
155               TCP.
156             </para>
157           </listitem>
158         </varlistentry>
159       </variablelist>
160     </para>
161   </refsect1>
162
163   <refsect1>
164     <title>RETURN VALUES</title>
165     <para><function>lwres_getnameinfo()</function>
166       returns 0 on success or a non-zero error code if an error occurs.
167     </para>
168   </refsect1>
169   <refsect1>
170     <title>SEE ALSO</title>
171     <para><citerefentry>
172         <refentrytitle>RFC2133</refentrytitle>
173       </citerefentry>,
174       <citerefentry>
175         <refentrytitle>getservbyport</refentrytitle><manvolnum>3</manvolnum>
176       </citerefentry>,
177       <citerefentry>
178         <refentrytitle>lwres</refentrytitle><manvolnum>3</manvolnum>
179       </citerefentry>,
180       <citerefentry>
181         <refentrytitle>lwres_getnameinfo</refentrytitle><manvolnum>3</manvolnum>
182       </citerefentry>,
183       <citerefentry>
184         <refentrytitle>lwres_getnamebyaddr</refentrytitle><manvolnum>3</manvolnum>
185       </citerefentry>.
186       <citerefentry>
187         <refentrytitle>lwres_net_ntop</refentrytitle><manvolnum>3</manvolnum>
188       </citerefentry>.
189     </para>
190   </refsect1>
191   <refsect1>
192     <title>BUGS</title>
193     <para>
194       RFC2133 fails to define what the nonzero return values of
195       <citerefentry>
196         <refentrytitle>getnameinfo</refentrytitle><manvolnum>3</manvolnum>
197       </citerefentry>
198       are.
199     </para>
200   </refsect1>
201 </refentry><!--
202  - Local variables:
203  - mode: sgml
204  - End:
205 -->