#include <net/if.h> unsigned int if_nametoindex(const char *ifname);Service Program Name: QSOSRV2
The if_nametoindex() function returns the interface index corresponding to name ifname.
No authorization is required.
if_nametoindex() returns an unsigned integer. Possible values are:
When if_nametoindex() fails, errno can be set to one of the following:
See Code disclaimer information for information pertaining to code examples.
The following example shows how if_nametoindex() is used:
#include <net/if.h> #include <sys/types.h> #include <errno.h> void main() { unsigned int interfaceIndex = if_nametoindex("MYETH"); if (interfaceIndex == 0) { printf("if_nametoindex() failed with errno = %d %s \n", errno,strerror(errno)); return; } ... }
Top | UNIX-Type APIs | APIs by category |