Caution: This version of this document is no longer maintained. For the latest documentation, see http://www.qnx.com/developers/docs.

if_nameindex()

Return a list of interfaces

Synopsis:

#include <net/if.h>

struct if_nameindex * if_nameindex( void );

Library:

libsocket

Use the -l socket option to qcc to link against this library.

Description:

The if_nameindex() function returns an array of if_nameindex structures, with one structure per interface, as defined in the include file <net/if.h>. The if_nameindex structure contains at least the following members:

unsigned int if_index
The index of the interface (1, 2, …).
char *if_name
A null-terminated name (e.g. le0).

The end of the array of structures is indicated by an entry with an if_index of 0 and an if_name of NULL.

Returns:

A valid array of if_nameindex structures, or NULL if and error occurred while using getifaddrs() to retrieve the list, or there wasn't enough memory available.

Classification:

POSIX 1003.1

Safety:
Cancellation point Yes
Interrupt handler No
Signal handler No
Thread Yes

See also:

getifaddrs(), if_freenameindex(), if_indextoname(), if_nametoindex()