lwres_getnameinfo.3 revision 23bfeb8bb16cd223f54dc1b05fbc5644249c3c70
Copyright (C) 2000 Internet Software Consortium.

Permission to use, copy, modify, and distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.

THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM
DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
INTERNET SOFTWARE CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT,
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING
FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.

$Id: lwres_getnameinfo.3,v 1.5 2000/09/28 22:36:30 gson Exp $

.Dd Jun 30, 2000 .Dt LWRES_GETNAMEINFO 3 .Os BIND9 9 .Sh NAME .Nm lwres_getnameinfo .Nd lightweight resolver socket address structure to hostname and service name .Sh SYNOPSIS .Fd #include <lwres/netdb.h> .Fd .Ft int .Fo lwres_getnameinfo .Fa "const struct sockaddr *sa" .Fa "size_t salen" .Fa "char *host" .Fa "size_t hostlen" .Fa "char *serv" .Fa "size_t servlen" .Fa "int flags" .Fc .Sh DESCRIPTION

p This function is equivalent to the .Xr getnameinfo 3 function defined in RFC2133. .Fn lwres_getnameinfo returns the hostname for the .Dv "struct sockaddr" .Fa sa which is .Fa salen bytes long. The hostname is of length .Fa hostlen and is returned via .Fa *host. The maximum length of the hostname is 1025 bytes: .Li NI_MAXHOST .

p The name of the service associated with the port number in .Fa sa is returned in .Fa *serv. It is .Fa servlen bytes long. The maximum length of the service name is .Li NI_MAXSERV - 32 bytes.

p The .Fa flags argument sets the following bits: l -tag -width NI_NUMERICSERV t Li NI_NOFQDN A fully qualified domain name is not required for local hosts. The local part of the fully qualified domain name is returned instead. t Li NI_NUMERICHOST Return the address in numeric form, as if calling inet_ntop(), instead of a host name. t Li NI_NAMEREQD A name is required. If the hostname cannot be found in the DNS and this flag is set, a non-zero error code is returned. If the hostname is not found and the flag is not set, the address is returned in numeric form. t Li NI_NUMERICSERV The service name is returned as a digit string representing the port number. t Li NI_DGRAM Specifies that the service being looked up is a datagram service, and causes getservbyport() to be called with a second argument of "udp" instead of its default of "tcp". This is required for the few ports (512-514) that have different services for UDP and TCP. .El

p .Sh RETURN VALUES .Fn lwres_getnameinfo returns 0 on success or a non-zero error code if an error occurs.
The error codes below were invented by the ISC/Nominum. They
should be defined in RFC2133 before getting documented here.
XXXJR 28/6/00
The error codes are:
Bl -tag -width ENI_NOSERVNAME
It Li ENI_NOSOCKET
there was no socket in
Fa sa
It Li ENI_NOSERVNAME
no service name was found
It Li ENI_NOHOSTNAME
no hostname was found
It Li ENI_MEMORY
memory could not be allocated
It Li ENI_SYSTEM
a system error occurred
It Li ENI_FAMILY
an unsupported protocol family was requested
It Li ENI_SALEN
Fa salen
is the wrong number of bytes for the address in
Fa sa .
.Sh SEE ALSO .Xr RFC2133 , .Xr getservbyport 3 , .Xr lwres 3 , .Xr lwres_getnameinfo 3 , .Xr lwres_getnamebyaddr 3, .Xr lwres_net_ntop 3 . .Sh BUGS RFC2133 fails to define what the nonzero return values of .Xr getnameinfo 3 are.