Open System Services Library Calls Reference Manual (G06.29+, H06.08+, J06.03+)

OSS Library Calls (g - h) getnameinfo(3)
NAME
getnameinfo - Translates protocol-independent host address to hostname
LIBRARY
G-series native OSS processes: /G/system/sysnn/zinetsrl
32-bit H-series and J-series OSS processes: /G/system/zdllnnn/zinetdll |
64-bit H-series and J-series OSS processes: /G/system/zdllnnn/yinetdll |
SYNOPSIS
#include <netdb.h>
int getnameinfo(
const struct sockaddr *sa,
socklen_t salen,
char *host,
socklen_t hostlen,|
char *serv,
socklen_t servlen,|
int flags);
PARAMETERS
sa Points to the sockaddr_in or sockaddr_in6 struct containing the IP address and
port number.
salen Specifies the length of the sa buffer.
host Upon successful completion of the call, contains either the host name associated
with the IP address or the numeric form of the host address (if the flags value of
NI_NUMERICHOST is used).
hostlen Specifies the size of the host buffer to receive the returned value. If you specify
0 (zero), no value is returned for host. Otherwise, the value returned is truncated
as necessary to fit the specified buffer.
serv Upon successful completion of the call, contains either the service name associ-
ated with the port number or the numeric form of the port number (if the flags
value of NI_NUMERICSERV is used).
servlen Specifies the size of the serv buffer to receive the returned value. If you specify
0 (zero), no value is returned for serv. Otherwise, the value returned is truncated
as necessary to fit the specified buffer.
flags Specifies one or more of the following as a logically ORed value:
NI_DGRAM Return only ports configured for UDP service. This flag is
required for ports that have different services for UDP and TCP.
NI_NAMEREQD
Return an error if the host name cannot be found by a name reso-
lution service.
NI_NOFQDN Return only the hostname part of the fully-qualified domain
name. If you omit this flag, this function returns the hosts
fully-qualified (canonical) domain name.
527187-017 Hewlett-Packard Company 381