1LWRES_GETNAMEINFO(3) BIND9 LWRES_GETNAMEINFO(3)
2
3
4
6 lwres_getnameinfo - lightweight resolver socket address structure to
7 hostname and service name
8
10 #include <lwres/netdb.h>
11
12 int lwres_getnameinfo(const struct sockaddr *sa, size_t salen,
13 char *host, size_t hostlen, char *serv,
14 size_t servlen, int flags);
15
17 This function is equivalent to the getnameinfo(3) function defined in
18 RFC2133. lwres_getnameinfo() returns the hostname for the struct
19 sockaddrsa which is salen bytes long. The hostname is of length hostlen
20 and is returned via *host. The maximum length of the hostname is 1025
21 bytes: NI_MAXHOST.
22
23 The name of the service associated with the port number in sa is
24 returned in *serv. It is servlen bytes long. The maximum length of the
25 service name is NI_MAXSERV - 32 bytes.
26
27 The flags argument sets the following bits:
28
29 NI_NOFQDN
30 A fully qualified domain name is not required for local hosts. The
31 local part of the fully qualified domain name is returned instead.
32
33 NI_NUMERICHOST
34 Return the address in numeric form, as if calling inet_ntop(),
35 instead of a host name.
36
37 NI_NAMEREQD
38 A name is required. If the hostname cannot be found in the DNS and
39 this flag is set, a non-zero error code is returned. If the
40 hostname is not found and the flag is not set, the address is
41 returned in numeric form.
42
43 NI_NUMERICSERV
44 The service name is returned as a digit string representing the
45 port number.
46
47 NI_DGRAM
48 Specifies that the service being looked up is a datagram service,
49 and causes getservbyport() to be called with a second argument of
50 "udp" instead of its default of "tcp". This is required for the few
51 ports (512-514) that have different services for UDP and TCP.
52
54 lwres_getnameinfo() returns 0 on success or a non-zero error code if an
55 error occurs.
56
58 RFC2133(), getservbyport(3), lwres(3), lwres_getnameinfo(3),
59 lwres_getnamebyaddr(3). lwres_net_ntop(3).
60
62 RFC2133 fails to define what the nonzero return values of
63 getnameinfo(3) are.
64
66 Internet Systems Consortium, Inc.
67
69 Copyright © 2000, 2001, 2004, 2005, 2007, 2014-2016, 2018 Internet
70 Systems Consortium, Inc. ("ISC")
71
72
73
74ISC 2007-06-18 LWRES_GETNAMEINFO(3)