xref: /netbsd-src/external/bsd/libbind/dist/doc/getnameinfo.man3 (revision 5bbd2a12505d72a8177929a37b5cee489d0a1cfd)
1*b5677b36Schristos.\" Copyright (c) 2004 by Internet Systems Consortium, Inc. ("ISC")
2*b5677b36Schristos.\" Copyright (c) 1998,1999 by Internet Software Consortium
3*b5677b36Schristos.\"
4*b5677b36Schristos.\" Permission to use, copy, modify, and distribute this software for any
5*b5677b36Schristos.\" purpose with or without fee is hereby granted, provided that the above
6*b5677b36Schristos.\" copyright notice and this permission notice appear in all copies.
7*b5677b36Schristos.\"
8*b5677b36Schristos.\" THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES
9*b5677b36Schristos.\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10*b5677b36Schristos.\" MERCHANTABILITY AND FITNESS.  IN NO EVENT SHALL ISC BE LIABLE FOR
11*b5677b36Schristos.\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
12*b5677b36Schristos.\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
13*b5677b36Schristos.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
14*b5677b36Schristos.\" OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
15*b5677b36Schristos.\"
16*b5677b36Schristos.\" Id: getnameinfo.man3,v 1.3 2009/02/21 01:31:39 jreed Exp
17*b5677b36Schristos.\"
18*b5677b36Schristos.Dd January 11, 1999
19*b5677b36Schristos.Dt GETNAMEINFO 3
20*b5677b36Schristos.Sh NAME
21*b5677b36Schristos.Nm getnameinfo
22*b5677b36Schristos.Nd address-to-name translation in protocol-independent manner
23*b5677b36Schristos.Sh SYNOPSIS
24*b5677b36Schristos.Fd #include <sys/socket.h>
25*b5677b36Schristos.Fd #include <netdb.h>
26*b5677b36Schristos.Ft int
27*b5677b36Schristos.Fn getnameinfo "const struct sockaddr *sa" "socklen_t salen" \
28*b5677b36Schristos"char *host" "size_t hostlen" "char *serv" "size_t servlen" "int flags"
29*b5677b36Schristos.Sh DESCRIPTION
30*b5677b36SchristosThe
31*b5677b36Schristos.Fn getnameinfo
32*b5677b36Schristosfunction is defined for protocol-independent address-to-nodename translation.
33*b5677b36SchristosIt performs functionality of
34*b5677b36Schristos.Xr gethostbyaddr 3
35*b5677b36Schristosand
36*b5677b36Schristos.Xr getservbyport 3
37*b5677b36Schristosin more sophisticated manner.
38*b5677b36Schristos.Pp
39*b5677b36SchristosThe
40*b5677b36Schristos.Fa sa
41*b5677b36Schristosarguement is a pointer to a generic socket address structure of size
42*b5677b36Schristos.Fa salen .
43*b5677b36SchristosThe arguements
44*b5677b36Schristos.Fa host
45*b5677b36Schristosand
46*b5677b36Schristos.Fa serv
47*b5677b36Schristosare pointers to buffers to hold the return values.
48*b5677b36SchristosTheir sizes are specified by
49*b5677b36Schristos.Fa hostlen
50*b5677b36Schristosand
51*b5677b36Schristos.Fa servlen
52*b5677b36Schristosrepectively.
53*b5677b36SchristosEither
54*b5677b36Schristos.Fa host
55*b5677b36Schristosor
56*b5677b36Schristos.Fa serv
57*b5677b36Schristosmay be
58*b5677b36Schristos.Dv NULL
59*b5677b36Schristosif the hostname  or service name is not required.
60*b5677b36Schristos.Pp
61*b5677b36SchristosThe
62*b5677b36Schristos.Fa flags
63*b5677b36Schristosarguement modifies the behaviour of
64*b5677b36Schristos.Fn getnameinfo
65*b5677b36Schristosas follows:
66*b5677b36Schristos.Pp
67*b5677b36SchristosIf
68*b5677b36Schristos.Dv NI_NOFQDN
69*b5677b36Schristosis set only the unqualified hostname is returned for local fully
70*b5677b36Schristosqualified names.
71*b5677b36Schristos.Pp
72*b5677b36SchristosIf
73*b5677b36Schristos.Dv NI_NUMERICHOST
74*b5677b36Schristosis set then the numeric form of the hostname is returned.
75*b5677b36Schristos.Pp
76*b5677b36SchristosIf
77*b5677b36Schristos.Dv NI_NAMEREQD
78*b5677b36Schristosis set, then a error is returned if the hostname cannot be looked up.
79*b5677b36Schristos.Pp
80*b5677b36SchristosIf
81*b5677b36Schristos.Dv NI_NUMERICSERV
82*b5677b36Schristosis set then the service is returned in numeric form.
83*b5677b36Schristos.Pp
84*b5677b36SchristosIf
85*b5677b36Schristos.Dv NI_DGRAM
86*b5677b36Schristosis set then the service is UDP based rather than TCP based.
87*b5677b36Schristos.Sh SEE ALSO
88*b5677b36Schristos.Xr getaddrinfo 3 ,
89*b5677b36Schristos.Xr gethostbyaddr 3 ,
90*b5677b36Schristos.Xr getservbyport 3 ,
91*b5677b36Schristos.Xr hosts 5 ,
92*b5677b36Schristos.Xr services 5 ,
93*b5677b36Schristos.Xr hostname 7 ,
94*b5677b36Schristos.Pp
95*b5677b36SchristosR. Gilligan, S.  Thomson, J. Bound, and W. Stevens,
96*b5677b36Schristos``Basic Socket Interface Extensions for IPv6,'' RFC2133, April 1997.
97*b5677b36Schristos.Sh STANDARDS
98*b5677b36SchristosThe
99*b5677b36Schristos.Fn getaddrinfo
100*b5677b36Schristosfunction is defined IEEE POSIX 1003.1g draft specification,
101*b5677b36Schristosand documented in ``Basic Socket Interface Extensions for IPv6''
102*b5677b36Schristos(RFC2133).
103