HP-UX IPv6 Porting Guide (September 2004)

Table Of Contents
Function Calls Converting IP addresses to Names
getipnodebyaddr(3N)
Chapter 7 41
getipnodebyaddr(3N)
The IPv6 getipnodebyaddr() function call improves upon the IPv4 gethostbyaddr() by
adding an error number parameter.
NOTE Starting with the HP-UX 11i v2 release, the getipnodebyaddr() function is
entering OBSOLESCENCE, and will be OBSOLETED in a future HP-UX
release. Therefore, it is recommended the getaddrinfo() function be used
instead.
Header Files
#include <sys/socket.h>
#include <netdb.h>
Syntax
name_ptr =getipnodebyaddr(const void *src, size_t len,int af, int *error_num);
Parameters
*src
: A pointer to the structure containing the IP address searched.
len
: The length of the IP address: four octets for AF_INET or sixteen octets for AF_INET6.
af
: Address family AF_INET or AF_INET6.
*error_num
:
*error_num
is a pointer to the integer containing an error code, if any.
name_ptr
: A pointer to the struct
hostent
returned by the function, containing the host
name.
Data Structures
struct hostent {
char *h_name; /* Canonical name of host name such as grace.hp.com*/
char **h_alias; /* Pointer to an array of pointers to alias names */
int h_addrtype; /* AF_INET (for IPv4 addresses)AF_INET6 (for IPv6)*/
int h_length; /* 4 octets (IPv6) or 16 octets (IPv6) */
char **h_addr_list[0]; /* Pointer to an array of pointers to IPv4 */
} /* addresses or IPv6 addresses */