if_nameindex(3) — Subroutines
NAME
if_nameindex − Return an array of all interface names and indexes
SYNOPSIS
#include <net/if.h>
struct if_nameindex ∗if_nameindex(
void );
LIBRARY
Standard C Library (libc)
DESCRIPTION
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.
RETURN VALUES
Upon successful conversion, the if_nameindex() function returns a pointer to the first structure in the array of if_nameindex structures.
SEE ALSO
Functions: if_freenameindex(3), if_indextoname(3), if_nametoindex(3).