Add more interface types from net-tools.

This commit is contained in:
Matthew Kent 2009-08-10 00:29:23 -07:00
parent c007175b21
commit ea3fcd5b45
2 changed files with 89 additions and 2 deletions

View File

@ -363,8 +363,30 @@ int sigar_get_iftype(const char *name, int *type, int *inst);
#endif
#define SIGAR_NIC_LOOPBACK "Local Loopback"
#define SIGAR_NIC_UNSPEC "UNSPEC"
#define SIGAR_NIC_SLIP "Serial Line IP"
#define SIGAR_NIC_CSLIP "VJ Serial Line IP"
#define SIGAR_NIC_SLIP6 "6-bit Serial Line IP"
#define SIGAR_NIC_CSLIP6 "VJ 6-bit Serial Line IP"
#define SIGAR_NIC_ADAPTIVE "Adaptive Serial Line IP"
#define SIGAR_NIC_ETHERNET "Ethernet"
#define SIGAR_NIC_ASH "Ash"
#define SIGAR_NIC_FDDI "Fiber Distributed Data Interface"
#define SIGAR_NIC_HIPPI "HIPPI"
#define SIGAR_NIC_AX25 "AMPR AX.25"
#define SIGAR_NIC_ROSE "AMPR ROSE"
#define SIGAR_NIC_NETROM "AMPR NET/ROM"
#define SIGAR_NIC_X25 "generic X.25"
#define SIGAR_NIC_TUNNEL "IPIP Tunnel"
#define SIGAR_NIC_PPP "Point-to-Point Protocol"
#define SIGAR_NIC_HDLC "(Cisco)-HDLC"
#define SIGAR_NIC_LAPB "LAPB"
#define SIGAR_NIC_ARCNET "ARCnet"
#define SIGAR_NIC_DLCI "Frame Relay DLCI"
#define SIGAR_NIC_FRAD "Frame Relay Access Device"
#define SIGAR_NIC_SIT "IPv6-in-IPv4"
#define SIGAR_NIC_IRDA "IrLAP"
#define SIGAR_NIC_EC "Econet"
#ifndef WIN32
#include <netdb.h>

View File

@ -1499,12 +1499,77 @@ static void get_interface_type(sigar_net_interface_config_t *ifconfig,
char *type;
switch (family) {
case ARPHRD_SLIP:
type = SIGAR_NIC_SLIP;
break;
case ARPHRD_CSLIP:
type = SIGAR_NIC_CSLIP;
break;
case ARPHRD_SLIP6:
type = SIGAR_NIC_SLIP6;
break;
case ARPHRD_CSLIP6:
type = SIGAR_NIC_CSLIP6;
break;
case ARPHRD_ADAPT:
type = SIGAR_NIC_ADAPTIVE;
break;
case ARPHRD_ETHER:
type = SIGAR_NIC_ETHERNET;
break;
case ARPHRD_ASH:
type = SIGAR_NIC_ASH;
break;
case ARPHRD_FDDI:
type = SIGAR_NIC_FDDI;
break;
case ARPHRD_HIPPI:
type = SIGAR_NIC_HIPPI;
break;
case ARPHRD_AX25:
type = SIGAR_NIC_AX25;
break;
case ARPHRD_ROSE:
type = SIGAR_NIC_ROSE;
break;
case ARPHRD_NETROM:
type = SIGAR_NIC_NETROM;
break;
/* XXX more */
case ARPHRD_X25:
type = SIGAR_NIC_X25;
break;
case ARPHRD_TUNNEL:
type = SIGAR_NIC_TUNNEL;
break;
case ARPHRD_PPP:
type = SIGAR_NIC_PPP;
break;
case ARPHRD_CISCO:
type = SIGAR_NIC_HDLC;
break;
case ARPHRD_LAPB:
type = SIGAR_NIC_LAPB;
break;
case ARPHRD_ARCNET:
type = SIGAR_NIC_ARCNET;
break;
case ARPHRD_DLCI:
type = SIGAR_NIC_DLCI;
break;
case ARPHRD_FRAD:
type = SIGAR_NIC_FRAD;
break;
case ARPHRD_SIT:
type = SIGAR_NIC_SIT;
break;
case ARPHRD_IRDA:
type = SIGAR_NIC_IRDA;
break;
case ARPHRD_ECONET:
type = SIGAR_NIC_EC;
break;
default:
type = SIGAR_NIC_ETHERNET;
type = SIGAR_NIC_UNSPEC;
break;
}