Index of Section 3 Manual Pages
| Interix / SUA | getnameinfo.3 | Interix / SUA |
getnameinfo(3) getnameinfo(3)
getnameinfo
NAME
getnameinfo - address-to-name translation in protocol-independent manner
SYNOPSIS
#include
#include
int getnameinfo(const struct sockaddr *sa, socklen_t salen, char *host,
size_t
hostlen, char *serv, size_t servlen, int flags);
DESCRIPTION
The getnameinfo() function is defined for protocol-independent address-to-
nodename translation. It performs functionality of gethostbyaddr(3) and
getservbyport(3) in more sophisticated manner.
The sa argument is a pointer to a generic socket address structure of size
salen. The arguments host and serv are pointers to buffers to hold the
return values. Their sizes are specified by hostlen and servlen
respectively. Either host or serv may be NULL if the host name or service
name is not required.
The flags argument modifies the behavior of getnameinfo() as follows:
If NI_NOFQDN is set, only the unqualified host name is returned for local
fully qualified names.
If NI_NUMERICHOST is set, then the numeric form of the host name is
returned.
If NI_NAMEREQD is set, then a error is returned if the host name cannot be
looked up.
If NI_NUMERICSERV is set, then the service is returned in numeric form.
If NI_DGRAM is set, then the service is UDP based rather than TCP based.
SEE ALSO
getaddrinfo(3)
gethostbyaddr(3)
getservbyport(3)
services(5)
R. Gilligan, S. Thomson, J. Bound, and W. Stevens, "Basic Socket Interface
Extensions for IPv6," RFC2133, April 1997.
STANDARDS
The getaddrinfo() function is defined IEEE POSIX 1003.1g draft
specification, and documented in "Basic Socket Interface Extensions for
IPv6" (RFC2133).
USAGE NOTES
The getnameinfo function is not thread safe.
The getnameinfo function is not async-signal safe.