Retrieves index and name information for all interfaces.
Library (libinet.a)
#include <net/if.h> struct if_nameindex { unsigned int if_index; /* 1, 2, ... */ char * if_name; /* null terminated name: "le0", ... */ }; struct if_nameindex *if_nameindex (void);
The final function of four for interface identification. The if_nameindex subroutine returns an array of if_nameindex structures, one structure per interface.
Note: The memory used for this array of structures along with the interface names pointed to by the if_name members is obtained dynamically. Use if_freenameindex to free memory allocated by if_nameindex.
If successful, the end of the array of structures is indicated by a structure with an if_index of 0 and an if_name of NULL. The function returns a NULL pointer upon an error.
The if_nametoindex subroutine, if_indextoname subroutine, and if_freenameindex subroutine.
Subroutines Overview in AIX Version 4 General Programming Concepts: Writing and Debugging Programs.