[ Bottom of Page | Previous Page | Next Page | Contents | Index | Library Home | Legal | Search ]

Technical Reference: Communications, Volume 2

if_indextoname Subroutine

Purpose

Maps an interface index into its corresponding name.

Library

Standard C Library <libc.a>

Syntax

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

Description

When the if_indextoname subroutine is called, the ifname parameter points to a buffer of at least IF_NAMESIZE bytes. The if_indextoname subroutine places the name of the interface in this buffer with the ifindex index.

Note
IF_NAMESIZE is also defined in <net/if.h> and its value includes a terminating null byte at the end of the interface name.

If ifindex is an interface index, the if_indextoname Subroutine returns the ifname value, which points to a buffer containing the interface name. Otherwise, it returns a NULL pointer and sets the errno global value to indicate the error.

If there is no interface corresponding to the specified index, the errno global value is set to ENXIO. If a system error occurs (such as insufficient memory), the errno global value is set to the proper value (such as, ENOMEM).

Parameters

ifindex Possible interface index
ifname Possible name of an interface

Error Codes

ENXIO There is no interface corresponding to the specified index
ENOMEM Insufficient memory

Related Information

if_nametoindex Subroutine, if_indextoname Subroutine, and if_nameindex Subroutine.

Subroutines Overview in AIX 5L Version 5.2 General Programming Concepts: Writing and Debugging Programs.

[ Top of Page | Previous Page | Next Page | Contents | Index | Library Home | Legal | Search ]