HP-UX Reference (11i v1 05/09) - 3 Library Functions A-M (vol 6)

g
getipnodebyname(3N) getipnodebyname(3N)
RETURN VALUE
If successful, getipnodebyname()
and getipnodebyaddr()
return a pointer to the requested
hostent structure.
getipnodebyname()
and getipnodebyaddr()
return NULL if their host or src parameters,
respectively, cannot be found in the database. If
/etc/hosts is being used, they return NULL if they
are unable to open
/etc/hosts .
getipnodebyaddr()
returns NULL if either its src or len parameter is invalid.
The table below shows the values returned by
getipnodebyname()
for a few combinations of flags
and af arguments.
getipnodebyname() and getipnodebyddr() Usage
flags Address Returns
Values Family
IPv4 addresses alone are returned.
0 AF_INET Length of the address returned is 4;
ie. ’A’ records alone are returned.
NULL is returned if no A records are found.
IPv6 addresses alone are returned.
0 AF_INET6 Length of the address returned is 16;
ie. AAAA records alone are returned. NULL
is returned if no AAAA records are found.
IPv4-mapped IPv6 address is returned.
AI_V4MAPPED AF_INET6 If no AAAA records are found then
’A records, if found, are returned, as
IPv4-mapped IPv6 records. Length of the
address returned is 16. NULL is returned
if both AAAA and A records are not found.
logical OR IPv6 and IPv4-mapped IPv6 addresses are
returned. Length of the addresses returned
AI_ALL is 16;
| AF_INET6 ie AAAA and A (IPv4-mapped IPv6) records
AI_V4MAPPED are returned.
IPv4 addresses are returned only if
AI_ADDRCONFIG AF_INET at least one IPv4 address is
configured.
logical OR If at least one IPv6 address source is
configured :
AI_ADDRCONFIG AF_INET6 IPv6 addresses are returned only if
| if no IPv6 source addresses are configured,
AI_V4MAPPED but at least one IPv4 address sources is
configured :
IPv4-Mapped IPv6 addresses are returned.
ERRORS
If the name server is being used and getipnodebyname() or getipnodebyaddr()
returns a
NULL pointer, the pointer
error_num contains one of the following values:
HOST_NOT_FOUND No such host is known.
TRY_AGAIN This is usually a temporary error. The local server did not receive a response
from an authoritative server. A retry at some later time may succeed.
NO_RECOVERY This is a non-recoverable error.
NO_ADDRESS The requested name is valid but does not have an IP address; this is not a tem-
porary error. This means another type of request to the name server will
result in an answer.
WARNINGS
Programs that use the interfaces described in this manpage cannot be linked statically because the imple-
mentations of these functions employ dynamic loading and linking of shared objects at run time.
Section 3336 Hewlett-Packard Company 3 HP-UX 11i Version 1: September 2005