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 Names to Addresses
getipnodebyname(3N)
Chapter 6 35
getipnodebyname(3N)
An application program calls the getipnodebyname() function to performs lookups for
IPv4/IPv6 hosts.
NOTE Starting with HP-UX 11i v2, the getipnodebyname() function is entering
OBSOLESCENCE, and will be OBSOLETED in a future HP-UX release.
Therefore, it is recommended the getnameinfo() function be used instead.
Syntax
Host_ptr=getipnodebyname(const char *name, int addr_family, int flags, int *error_num);
Parameters
*name
: A pointer to a node name or numeric string, such as an IPv4 dotted-decimal address or
an IPv6 hexadecimal address.
Addr_family
: An integer that sets the address-type searched-for and returned-by the
function.
Addr_family
is either AF_INET (IPv4) or AF_INET6 (IPv6).
flags
: An integer that specifies the conditions for returning an address, such as IPv6-only,
IPv4-mapped if no IPv6 address found, or return an address only if the remote node name has
at least one IP address configured.
*error_num
: A pointer to the error code returned by the getipnodebyname() function.
Host_ptr
: The struct
hostent
returned by the
getipnodebyname()
function, containing one
or more IP address for
name
.
The
hostent
structure comprises the following fields:
char
*h_name
: A pointer to the canonical name (Fully Qualified Name) of host name.
char
**h_alias
: A pointer to an array of pointers-to-aliases for the host name.
int
h_addrtype
: The type of address returned within the hostent structure: either AF_INET
for IPv4 addresses or AF_INET6 for IPv6 addresses.
int
h_length
: The length of the IP address pointed-to by
name
, either 4 octets (IPv4) or 16
octets (IPv6)*.
char
**h_addr_list[0]
: Pointer to an array of pointers-to-IPv4-or-IPv6-addresses for the
host name.