if_nameindex - Return an array of all interface names and
indexes
#include <net/if.h>
struct if_nameindex *if_nameindex(
void );
Standard C Library (libc)
The if_nameindex() function dynamically allocates memory
for an array of if_nameindex structures, one structure for
each interface. A structure with a zero (0) if_index value
and a NULL if_name value indicates the end of the array.
You must define the following if_nameindex structure prior
to a call to if_nameindex():
struct if_nameindex {
unsigned int if_index;
char *if_name;
};
To free memory allocated by this function, use the
if_freenameindex() function.
Upon successful conversion, the if_nameindex() function
returns a pointer to the first structure in the array of
if_nameindex structures.
Functions: if_freenameindex(3), if_indextoname(3),
if_nametoindex(3).
if_nameindex(3)
[ Back ] |