Open System Services Library Calls Reference Manual (G06.28+, H06.05+)

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
H-series OSS processes: /G/system/zdllnnn/zinetdll
SYNOPSIS
#include <netdb.h>
int getnameinfo(
const struct sockaddr *sa,
socklen_t salen,
char *host,
size_t hostlen,
char *serv,
size_t servlen,
int ags
);
PARAMETERS
sa Points to the sockaddr_in or sockaddr_in6 struct containing the IP address and
port number.
salen Species 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 ags value of
NI_NUMERICHOST is used).
hostlen Species 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 t the specied 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 ags
value of NI_NUMERICSERV is used).
servlen Species 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 t the specied buffer.
flags Species one or more of the following as a logically ORed value:
NI_DGRAM Return only ports congured for UDP service. This ag 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-qualied domain
name. If you omit this ag, this function returns the hosts
fully-qualied (canonical) domain name.
527187-007 Hewlett-Packard Company 347