]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - contrib/bind9/lib/lwres/man/lwres_getnameinfo.docbook
This commit was generated by cvs2svn to compensate for changes in r164219,
[FreeBSD/FreeBSD.git] / contrib / bind9 / lib / lwres / man / lwres_getnameinfo.docbook
1 <!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.0//EN"
2                "http://www.oasis-open.org/docbook/xml/4.0/docbookx.dtd"
3                [<!ENTITY mdash "&#8212;">]>
4 <!--
5  - Copyright (C) 2004, 2005  Internet Systems Consortium, Inc. ("ISC")
6  - Copyright (C) 2000, 2001  Internet Software Consortium.
7  -
8  - Permission to use, copy, modify, and 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.3.206.3 2005/05/12 21:36:15 sra Exp $ -->
22
23 <refentry>
24
25 <refentryinfo>
26 <date>Jun 30, 2000</date>
27 </refentryinfo>
28
29 <refmeta>
30 <refentrytitle>lwres_getnameinfo</refentrytitle>
31 <manvolnum>3</manvolnum>
32 <refmiscinfo>BIND9</refmiscinfo>
33 </refmeta>
34
35   <docinfo>
36     <copyright>
37       <year>2004</year>
38       <year>2005</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 service name</refpurpose>
51 </refnamediv>
52 <refsynopsisdiv>
53 <funcsynopsis>
54 <funcsynopsisinfo>#include &lt;lwres/netdb.h&gt;</funcsynopsisinfo>
55 <funcprototype>
56 <funcdef>
57 int
58 <function>lwres_getnameinfo</function></funcdef>
59 <paramdef>const struct sockaddr *sa</paramdef>
60 <paramdef>size_t salen</paramdef>
61 <paramdef>char *host</paramdef>
62 <paramdef>size_t hostlen</paramdef>
63 <paramdef>char *serv</paramdef>
64 <paramdef>size_t servlen</paramdef>
65 <paramdef>int flags</paramdef>
66 </funcprototype>
67 </funcsynopsis>
68 </refsynopsisdiv>
69
70 <refsect1>
71 <title>DESCRIPTION</title>
72
73 <para> This function is equivalent to the <citerefentry>
74 <refentrytitle>getnameinfo</refentrytitle><manvolnum>3</manvolnum>
75 </citerefentry> function defined in RFC2133.
76 <function>lwres_getnameinfo()</function> returns the hostname for the
77 <type>struct sockaddr</type> <parameter>sa</parameter> which is
78 <parameter>salen</parameter> bytes long.  The hostname is of length
79 <parameter>hostlen</parameter> and is returned via
80 <parameter>*host.</parameter> The maximum length of the hostname is
81 1025 bytes: <constant>NI_MAXHOST</constant>.</para>
82
83 <para> The name of the service associated with the port number in
84 <parameter>sa</parameter> is returned in <parameter>*serv.</parameter>
85 It is <parameter>servlen</parameter> bytes long.  The maximum length
86 of the service name is <constant>NI_MAXSERV</constant> - 32 bytes.
87 </para>
88
89 <para> The <parameter>flags</parameter> argument sets the following
90 bits:
91 <variablelist>
92 <varlistentry><term><constant>NI_NOFQDN</constant></term>
93 <listitem>
94 <para>
95 A fully qualified domain name is not required for local hosts.
96 The local part of the fully qualified domain name is returned instead.
97 </para></listitem></varlistentry>
98 <varlistentry><term><constant>NI_NUMERICHOST</constant></term>
99 <listitem>
100 <para>
101 Return the address in numeric form, as if calling inet_ntop(),
102 instead of a host name.
103 </para></listitem></varlistentry>
104 <varlistentry><term><constant>NI_NAMEREQD</constant></term>
105 <listitem>
106 <para>
107 A name is required. If the hostname cannot be found in the DNS and
108 this flag is set, a non-zero error code is returned.
109 If the hostname is not found and the flag is not set, the 
110 address is returned in numeric form.
111 </para></listitem></varlistentry>
112 <varlistentry><term><constant>NI_NUMERICSERV</constant></term>
113 <listitem>
114 <para>
115 The service name is returned as a digit string representing the port number.
116 </para></listitem></varlistentry>
117 <varlistentry><term><constant>NI_DGRAM</constant></term>
118 <listitem>
119 <para>
120 Specifies that the service being looked up is a datagram
121 service,  and causes getservbyport() to be called with a second
122 argument of "udp" instead of its default of "tcp".  This is required
123 for the few ports (512-514) that have different services for UDP and
124 TCP.
125 </para></listitem></varlistentry>
126 </variablelist>
127 </para>
128 </refsect1>
129
130 <refsect1>
131 <title>RETURN VALUES</title>
132 <para>
133 <function>lwres_getnameinfo()</function>
134 returns 0 on success or a non-zero error code if an error occurs.
135 </para>
136 </refsect1>
137 <refsect1>
138 <title>SEE ALSO</title>
139 <para>
140 <citerefentry>
141 <refentrytitle>RFC2133</refentrytitle>
142 </citerefentry>,
143 <citerefentry>
144 <refentrytitle>getservbyport</refentrytitle><manvolnum>3</manvolnum>
145 </citerefentry>,
146 <citerefentry>
147 <refentrytitle>lwres</refentrytitle><manvolnum>3</manvolnum>
148 </citerefentry>,
149 <citerefentry>
150 <refentrytitle>lwres_getnameinfo</refentrytitle><manvolnum>3</manvolnum>
151 </citerefentry>,
152 <citerefentry>
153 <refentrytitle>lwres_getnamebyaddr</refentrytitle><manvolnum>3</manvolnum>
154 </citerefentry>.
155 <citerefentry>
156 <refentrytitle>lwres_net_ntop</refentrytitle><manvolnum>3</manvolnum>
157 </citerefentry>.
158 </para>
159 </refsect1>
160 <refsect1>
161 <title>BUGS</title>
162 <para>
163 RFC2133 fails to define what the nonzero return values of
164 <citerefentry>
165 <refentrytitle>getnameinfo</refentrytitle><manvolnum>3</manvolnum>
166 </citerefentry>
167 are.
168 </para>
169 </refsect1>
170 </refentry>