From ea3fcd5b455a3cda7412610205e8084c0b4a8e2b Mon Sep 17 00:00:00 2001 From: Matthew Kent Date: Mon, 10 Aug 2009 00:29:23 -0700 Subject: [PATCH] Add more interface types from net-tools. --- include/sigar_private.h | 22 +++++++++++++ src/sigar.c | 69 +++++++++++++++++++++++++++++++++++++++-- 2 files changed, 89 insertions(+), 2 deletions(-) diff --git a/include/sigar_private.h b/include/sigar_private.h index fde2465f..b9b657a8 100644 --- a/include/sigar_private.h +++ b/include/sigar_private.h @@ -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 diff --git a/src/sigar.c b/src/sigar.c index 9ab00450..14512778 100644 --- a/src/sigar.c +++ b/src/sigar.c @@ -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; }