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

IPv6 Addressing
IPv6 Address Types
Chapter 2 13
NOTE Only use the constant during initialization.
• For assignment, use the global variable named in6addr_any, of the type in6_addr
structure. For example:
Header file
<netinet/in.h>
extern const struct in6_addr in6addr_any;
struct sockaddr_in6 sin6;
…
sin6.sin6_addr = in6addr_any; /* structure assignment */
…
if (bind(s, (struct sockaddr *) &sin6, sizeof(sin6)) == -1)
IPv6 Loopback Addresses
The IPv4 loopback address is an integer type INADDR_LOOPBACK. The IPv6 loopback address is
an in6_addr structure defined in <netinet/in.h>. For example:
Header file
<netinet/in.h>
sin6.sin6_addr = in6addr_loopback; /* structure assignment */
The symbolic constant named IN6ADDR_LOOPBACK_INIT is defined in <netinet/in.h>. Use it
only when declaring a sockaddr_in6 struct. For example:
struct in6_addr loopbackaddr = IN6ADDR_LOOPBACK_INIT
NOTE IPv4 defines INADDR_* constants in IPv4 host byte order. However, IPv6
defines IN6ADDR_* and in6addr* constants in network byte order.