[ Next Article | Previous Article | Book Contents | Library Home | Legal | Search ]
Base Operating System and Extensions Technical Reference, Volume 1

if_indextoname Subroutine

Purpose

Determines the interface name associated with a particular index. The second of four functions, if_indextoname maps an interface index into its corresponding name.

Library

Library (libinet.a)

Syntax

#include <net/if.h>>
char *
if_indextoname (index, ifname)
unsigned int index;
char *ifname;

Description

The second of four functions for Interface Identification. The first argument is the interface index whose name is to be retrieved. The second argument is a buffer of at least IFNAMSIZ bytes, into which the name is to be copied.

Note: The if_indextoname argument must point to a buffer of at least IFNAMESIZ bytes into which the interface name corresponding to the specified index is returned. IFNAMSIZ is also defined in <net/if.h> and its value includes a terminating null byte at the end of the interface name.

Return Values

If successful, if_indextoname returns a pointer to a valid name corresponding to the specified index. A null pointer is returned if no interface name corresponds to the specified index.

Related Information

The if_nametoindex subroutine, if_nameindex subroutine, and if_freenameindex subroutine.

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


[ Next Article | Previous Article | Book Contents | Library Home | Legal | Search ]