[ Previous | Next | Contents | Glossary | Home | Search ]
AIX Version 4.3 Base Operating System and Extensions Technical Reference, Volume 1

if_nameindex Subroutine

Purpose

Retrieves index and name information for all interfaces.

Library

Library (libinet.a)

Syntax

#include <net/if.h>

struct if_nameindex {
unsigned int if_index; /* 1, 2, ... */
char * if_name; /* null terminated name: "le0", ... */
};
struct if_nameindex *if_nameindex (void); 

Description

The final function of four for interface identification. The if_nameindex subroutine returns an array of if_nameindex structures, one structure per interface.

Note: The memory used for this array of structures along with the interface names pointed to by the if_name members is obtained dynamically. Use if_freenameindex to free memory allocated by if_nameindex.

Return Values

If successful, the end of the array of structures is indicated by a structure with an if_index of 0 and an if_name of NULL. The function returns a NULL pointer upon an error.

Related Information

The if_nametoindex subroutine, if_indextoname subroutine, and if_freenameindex subroutine.

Subroutines Overview in AIX Version 4 General Programming Concepts: Writing and Debugging Programs.


[ Previous | Next | Contents | Glossary | Home | Search ]