constify nic types

This commit is contained in:
Doug MacEachern 2005-11-18 19:54:23 +00:00
parent bb478479b2
commit ab3c15d2e7
2 changed files with 12 additions and 5 deletions

View File

@ -234,4 +234,8 @@ int sigar_group_name_get(sigar_t *sigar, int gid, char *buf, int buflen);
int sigar_get_iftype(const char *name, int *type, int *inst); int sigar_get_iftype(const char *name, int *type, int *inst);
#endif #endif
#define SIGAR_NIC_LOOPBACK "Local Loopback"
#define SIGAR_NIC_ETHERNET "Ethernet"
#define SIGAR_NIC_NETROM "AMPR NET/ROM"
#endif #endif

View File

@ -1172,11 +1172,11 @@ static void get_interface_type(sigar_net_interface_config_t *ifconfig,
switch (family) { switch (family) {
case ARPHRD_NETROM: case ARPHRD_NETROM:
type = "AMPR NET/ROM"; type = SIGAR_NIC_NETROM;
break; break;
/* XXX more */ /* XXX more */
default: default:
type = "Ethernet"; type = SIGAR_NIC_ETHERNET;
break; break;
} }
@ -1244,7 +1244,8 @@ int sigar_net_interface_config_get(sigar_t *sigar, const char *name,
ifconfig->destination = ifconfig->address; ifconfig->destination = ifconfig->address;
ifconfig->broadcast = 0; ifconfig->broadcast = 0;
sigar_hwaddr_set_null(ifconfig); sigar_hwaddr_set_null(ifconfig);
SIGAR_SSTRCPY(ifconfig->type, "Local Loopback"); SIGAR_SSTRCPY(ifconfig->type,
SIGAR_NIC_LOOPBACK);
} }
else { else {
if (!ioctl(sock, SIOCGIFDSTADDR, &ifr)) { if (!ioctl(sock, SIOCGIFDSTADDR, &ifr)) {
@ -1263,10 +1264,12 @@ int sigar_net_interface_config_get(sigar_t *sigar, const char *name,
} }
#elif defined(_AIX) || defined(__osf__) #elif defined(_AIX) || defined(__osf__)
hwaddr_aix_lookup(sigar, ifconfig); hwaddr_aix_lookup(sigar, ifconfig);
SIGAR_SSTRCPY(ifconfig->type, "Ethernet"); SIGAR_SSTRCPY(ifconfig->type,
SIGAR_NIC_ETHERNET);
#else #else
hwaddr_arp_lookup(ifconfig, sock); hwaddr_arp_lookup(ifconfig, sock);
SIGAR_SSTRCPY(ifconfig->type, "Ethernet"); SIGAR_SSTRCPY(ifconfig->type,
SIGAR_NIC_ETHERNET);
#endif #endif
} }