HPlogo HP-UX IPv6 Porting Guide: HP-UX 11i v2 September 2004

Chapter 11 Testing for Scope and Type of IPv6 addresses using Macros

» 

Technical documentation

Complete book in PDF

 » Table of Contents

Use the following macros to verify IPv6 address types. The first seven macros return true if the address is of the specified type, or false otherwise. The last five macros return true if the address is a multicast address of the specified scope, or return false if the address is either not a multicast address or not of the specified scope.

NOTE: IN6_IS_ADDR_LINKLOCAL and IN6_IS_ADDR_SITELOCAL return true only for the link-local scope or site-local scope IPv6 unicast addresses. These two macros do not return true for IPv6 multicast addresses of either link-local scope or site-local scope.
int  IN6_IS_ADDR_UNSPECIFIED (const struct in6_addr *);
int IN6_IS_ADDR_LOOPBACK (const struct in6_addr *);
int IN6_IS_ADDR_MULTICAST (const struct in6_addr *);
int IN6_IS_ADDR_LINKLOCAL (const struct in6_addr *);
int IN6_IS_ADDR_SITELOCAL (const struct in6_addr *);
int IN6_IS_ADDR_V4MAPPED (const struct in6_addr *);
int IN6_IS_ADDR_V4COMPAT (const struct in6_addr *);

These macros test the scope of IPv6multicast addresses:

int  IN6_IS_ADDR_MC_NODELOCAL(const struct in6_addr *);
int IN6_IS_ADDR_MC_LINKLOCAL(const struct in6_addr *);
int IN6_IS_ADDR_MC_SITELOCAL(const struct in6_addr *);
int IN6_IS_ADDR_MC_ORGLOCAL (const struct in6_addr *);
int IN6_IS_ADDR_MC_GLOBAL (const struct in6_addr *);
© 2004 Hewlett-Packard Development Company, L.P.