HP-UX IPv6 Porting Guide (September 2004)
Table Of Contents
- About This Document
- 1 Introduction
- 2 IPv6 Addressing
- 3 Data Structure Changes
- 4 Migrating Applications from IPv4 to IPv6
- 5 Overview of IPv4 and IPv6 Call Set-up
- 6 Function Calls Converting Names to Addresses
- 7 Function Calls Converting IP addresses to Names
- 8 Reading Error Messages
- 9 Freeing Memory
- 10 Converting Binary and Text Addresses
- 11 Testing for Scope and Type of IPv6 addresses using Macros
- 12 Identifying Local Interface Names and Indexes
- 13 Configuring or Querying an Interface using IPv6 ioctl() Function Calls
- 14 Verifying IPv6 Installation
- 15 Sample Client/Server Programs
- A IPv4 to IPv6 Quick Reference Guide

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 */