Merge from vendor branch ZLIB:
[dragonfly.git] / contrib / bind-9.2.4rc7 / lib / lwres / man / lwres_getnameinfo.3
1 .\" Copyright (C) 2004  Internet Systems Consortium, Inc. ("ISC")
2 .\" Copyright (C) 2000, 2001  Internet Software Consortium.
3 .\"
4 .\" Permission to use, copy, modify, and distribute this software for any
5 .\" purpose with or without fee is hereby granted, provided that the above
6 .\" copyright notice and this permission notice appear in all copies.
7 .\"
8 .\" THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
9 .\" REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
10 .\" AND FITNESS.  IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
11 .\" INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
12 .\" LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
13 .\" OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
14 .\" PERFORMANCE OF THIS SOFTWARE.
15 .\"
16 .\" $Id: lwres_getnameinfo.3,v 1.15.2.2 2004/03/15 04:45:02 marka Exp $
17 .\"
18 .TH "LWRES_GETNAMEINFO" "3" "Jun 30, 2000" "BIND9" ""
19 .SH NAME
20 lwres_getnameinfo \- lightweight resolver socket address structure to hostname and service name
21 .SH SYNOPSIS
22 \fB#include <lwres/netdb.h>
23 .sp
24 .na
25 int
26 lwres_getnameinfo(const struct sockaddr *sa, size_t salen, char *host, size_t hostlen, char *serv, size_t servlen, int flags);
27 .ad
28 \fR
29 .SH "DESCRIPTION"
30 .PP
31 This function is equivalent to the \fBgetnameinfo\fR(3) function defined in RFC2133.
32 \fBlwres_getnameinfo()\fR returns the hostname for the
33 \fBstruct sockaddr\fR \fIsa\fR which is
34 \fIsalen\fR bytes long. The hostname is of length
35 \fIhostlen\fR and is returned via
36 \fI*host.\fR The maximum length of the hostname is
37 1025 bytes: NI_MAXHOST.
38 .PP
39 The name of the service associated with the port number in
40 \fIsa\fR is returned in \fI*serv.\fR
41 It is \fIservlen\fR bytes long. The maximum length
42 of the service name is NI_MAXSERV - 32 bytes.
43 .PP
44 The \fIflags\fR argument sets the following
45 bits:
46 .TP
47 \fBNI_NOFQDN\fR
48 A fully qualified domain name is not required for local hosts.
49 The local part of the fully qualified domain name is returned instead.
50 .TP
51 \fBNI_NUMERICHOST\fR
52 Return the address in numeric form, as if calling inet_ntop(),
53 instead of a host name.
54 .TP
55 \fBNI_NAMEREQD\fR
56 A name is required. If the hostname cannot be found in the DNS and
57 this flag is set, a non-zero error code is returned.
58 If the hostname is not found and the flag is not set, the 
59 address is returned in numeric form.
60 .TP
61 \fBNI_NUMERICSERV\fR
62 The service name is returned as a digit string representing the port number.
63 .TP
64 \fBNI_DGRAM\fR
65 Specifies that the service being looked up is a datagram
66 service, and causes getservbyport() to be called with a second
67 argument of "udp" instead of its default of "tcp". This is required
68 for the few ports (512-514) that have different services for UDP and
69 TCP.
70 .SH "RETURN VALUES"
71 .PP
72 \fBlwres_getnameinfo()\fR
73 returns 0 on success or a non-zero error code if an error occurs.
74 .SH "SEE ALSO"
75 .PP
76 \fBRFC2133\fR,
77 \fBgetservbyport\fR(3),
78 \fBlwres\fR(3),
79 \fBlwres_getnameinfo\fR(3),
80 \fBlwres_getnamebyaddr\fR(3).
81 \fBlwres_net_ntop\fR(3).
82 .SH "BUGS"
83 .PP
84 RFC2133 fails to define what the nonzero return values of
85 \fBgetnameinfo\fR(3)
86 are.