Open System Services Library Calls Reference Manual (G06.27+, H06.04+)
OSS Library Calls (g - h) getipnodebyaddr(3)
NAME
getipnodebyaddr - Gets a network host entry by address (protocol-independent)
LIBRARY
G-series native OSS processes: /G/system/sysnn/zinetsrl
H-series OSS processes: /G/system/zdllnnn/zinetdll
SYNOPSIS
#include <sys/socket.h>
#include <netdb.h>
struct hostent *getipnodebyaddr(
const void *src,
size_t len,
int addr_family,
int *error_num
);
PARAMETERS
src Specifies the IP address for which the host name should be returned; the address
specified should be in binary format and network order
len Specifies the length of the IP address in octets:
4ForAF_INET addresses
16 For AF_INET6 addresses
addr_family Specifies the address family of the socket (either AF_INET or AF_INET6)
error_num Returns an error code if the call fails
DESCRIPTION
The getipnodebyaddr() function searches host entries until a match with the src parameter is
found.
The getipnodebyaddr() function returns a pointer to a hostent struct whose members specify
data from a name server specified in the /etc/resolv.conf file or the /etc/hosts network hostname
database file. getipnodebyaddr( ) first attempts to search /etc/resolv.conf, but when the name
server is not running, the getipnodebyaddr( ) function searches the hosts name file. The hostent
structure is defined in the netdb.h header file.
NOTES
This function provides the same information as gethostbyname() but is protocol-independent.
The getipnodebyaddr() function processes IPv4-compatible IPv6 addresses as follows:
1. When addr_family is AF_INET6, len is 16, and the IPv6 address is an IPv4-mapped
IPv6 address or an IPv4-compatible IPv6 address, the function:
a. Skips the first 12 bytes of the IPv6 address
b. Sets the value of addr_family to AF_INET
c. Uses a value for len of 4 instead of 16
527187-004 Hewlett-Packard Company 3−41