if nametoindex

Jump to: navigation, search

Table of Contents >> IPv6 Programmer's Reference


#include <trsocket.h>


unsigned int if_nametoindex (const char * ifname);


Function Description

This function supports both IPv4 and IPv6. Refer to [RFC 2553]. Maps an interface name into its corresponding interface index.


Parameters

  • ifname
    Interface name


Returns

  • 0
    Failed. Call tfGetSocketError() for the specific error code.
  • >0
    Interface index


If if_nametoindex fails, the error code can be retrieved with tfGetSocketError() which will return one of the following:

  • TM_ENXIO
    The specified interface name does not exist.
  • TM_EINVAL
    Bad parameter value.


Table of Contents >> IPv6 Programmer's Reference