Open System Services Library Calls Reference Manual (G06.29+, H06.08+, J06.03+)
getipnodebyname(3) OSS Library Calls Reference Manual
AI_V4MAPPED
Requests the return of all IPv4-mapped IPv6 addresses when the
address family is AF_INET6 and there are no matching IPv6
addresses. This flag is ignored if the address family is
AF_INET.
error_num Returns an error code if the call fails.
DESCRIPTION
The getipnodebyname( ) function searches host entries sequentially until a match with the name
parameter occurs.
The getipnodebyname( ) function returns a pointer to a structure of type hostent whose members
specify data obtained from a name server specified in the /etc/resolv.conf file or from fields of a
record line in the network hostname database file. When the name server is not running and
/etc/resolv.conf cannot be searched, this function searches the network hostname database file.
The netdb.h header file defines the hostent structure.
NOTES
This function provides the same information as the gethostbyname( ) function but is protocol-
independent.
Information returned by getipnodebyname( ) is dynamically allocated; the hostent structure and
the data areas pointed to by the members of the hostent structure are all dynamically allocated.
Use the freehostent( ) function to return memory to the system.
The getipnodebyname( ) function must be used in a thread-safe environment.
RETURN VALUES
Upon successful completion, this function returns a pointer to the hostent structure containing an
IP address. The returned address is in network order and can be used directly in a sockaddr_in
or sockaddr_in6 structure.
If the call fails, a NULL pointer is returned and one of the following nonzero values is returned
for the error_num parameter:
HOST_NOT_FOUND
The specified name is not a valid hostname or alias. This is not a soft error;
another type of name server request might be successful.
NO_ADDRESS
The server recognized the request and the name specified but no address is avail-
able. This is not a soft error; another type of name server request might be suc-
cessful.
NO_RECOVERY
A server failure occurred. This is a nonrecoverable error.
TRY_AGAIN An error occurred that might have been caused by a transient condition. A later
retry might succeed.
ERRORS
This function does not set errno.
RELATED INFORMATION
Functions: freeaddrinfo(3), freehostent(3), gai_strerror(3), getaddrinfo(3), getipnode-
byaddr(3), getnameinfo(3), if_freenameindex(3), if_indextoname(3), if_nameindex(3),
if_nametoindex(3), inet_pton(3), inet_ntop(3).
3−74 Hewlett-Packard Company 527187-017