Open System Services Library Calls Reference Manual (G06.29+, H06.08+, J06.03+)

if_nameindex(3) OSS Library Calls Reference Manual
NAME
if_nameindex - Gets all interface names and indexes
LIBRARY
G-series native OSS processes: /G/system/sysnn/zinetsrl
32-bit H-series and J-series OSS processes: /G/system/zdllnnn/zinetdll |
64-bit H-series and J-series OSS processes: /G/system/zdllnnn/yinetdll |
SYNOPSIS
#include <in.h>
#include <netdb.h>
struct if_nameindex *if_nameindex(void);
DESCRIPTION
When an interface (subnet) is created, it is assigned a unique number called an interface index.
The interface index identifies the interface used to send or receive multicast datagrams.
Interface index numbers start with 1.
The if_nameindex( ) function is one of four functions used to manage interface indexes.
EXAMPLES
.
.
.
ifnameindex = if_nameindex();
if (ifnameindex == NULL){
perror("if_nameindex failed");
}
freep = ifnameindex;
while (ifnameindex->if_index){
printf("if_nameindex: index, name: %i, %s\n",
ifnameindex->if_index, ifnameindex->if_name);
ifnameindex++;
}
.
.
.
NOTES
Memory is dynamically allocated for the array of structures returned by this function and for the
interface names pointed to by the if_name members of the structures. Use the
if_freenameindex( ) function to return this memory to the system when it is no longer needed.
RETURN VALUES
Upon successful completion, this function returns an array of if_nameindex structures. The end
of the array is a structure with an if_index value of 0 (zero) and an if_name value of NULL.
Each such structure contains information about one interface (subnet). The format of the
returned structures is defined in the header file in.h.
If an error occurs, this function returns a NULL pointer and sets errno to indicate the error.
ERRORS
If any of these conditions occurs, the function sets errno to the corresponding value:
[EINVAL] A value specified for a parameter is not recognized or inapplicable.
410 Hewlett-Packard Company 527187-017