HPlogo HP-UX IPv6 Porting Guide: HP-UX 11i v2 September 2004 > Chapter 12  Identifying Local Interface Names and Indexes

Index-to-Name

» 

Technical documentation

Complete book in PDF

 » Table of Contents

The second function maps an interface index into its corresponding name.

Header Files

#include <net/if.h>

Syntax

char  *if_indextoname(unsigned int ifindex, char *ifname);

The ifname parameter must point to a buffer at least IF_NAMESIZE bytes large. The function returns to ifname the interface name of the specified index. (IF_NAMESIZE is also defined in <net/if.h> and its value includes a terminating NULL byte at the end of the interface name.) The pointer to if_indextoname also returns the value of the function. If no interface corresponds to the specified index, the function returns NULL, and sets errno to ENXIO. If a system error occurred (such as running out of memory), if_indextoname() returns NULL and sets errno to the proper value (that is, ENOMEM).

© 2004 Hewlett-Packard Development Company, L.P.