This function dynamically allocates memory for an array of
if_nameindex structures, one structure for each interface. A
structure with an if_index value of 0 and a NULL if_name value
indicates the end of the array.
The following if_nameindex structure must also be defined
by including the IF.H header file prior to the call to if_
nameindex():
struct if_nameindex {
unsigned int if_index;
char *if_name;
};
To free the memory allocated by this function, use the if_
freenameindex() function. If an error occurs, the function
returns a NULL pointer and sets errno to an appropriate value.