convert net_interface_config to use sigar_net_address_t

This commit is contained in:
Doug MacEachern 2006-07-04 17:38:40 +00:00
parent c6f8805803
commit 4c0b9565f8
1 changed files with 9 additions and 5 deletions

View File

@ -226,9 +226,12 @@ sigar_net_interface_config_get(sigar_t *sigar,
#define if_s_addr(a) \ #define if_s_addr(a) \
((struct sockaddr_in *)&a)->sin_addr.s_addr ((struct sockaddr_in *)&a)->sin_addr.s_addr
ifconfig->address = if_s_addr(if_info->iiAddress); sigar_net_address_set(ifconfig->address,
ifconfig->broadcast = if_s_addr(if_info->iiBroadcastAddress); if_s_addr(if_info->iiAddress));
ifconfig->netmask = if_s_addr(if_info->iiNetmask); sigar_net_address_set(ifconfig->broadcast,
if_s_addr(if_info->iiBroadcastAddress));
sigar_net_address_set(ifconfig->netmask,
if_s_addr(if_info->iiNetmask));
flags = if_info->iiFlags; flags = if_info->iiFlags;
@ -240,8 +243,9 @@ sigar_net_interface_config_get(sigar_t *sigar,
} }
if (flags & IFF_LOOPBACK) { if (flags & IFF_LOOPBACK) {
ifconfig->flags |= SIGAR_IFF_LOOPBACK; ifconfig->flags |= SIGAR_IFF_LOOPBACK;
ifconfig->destination = ifconfig->address; sigar_net_address_set(ifconfig->destination,
ifconfig->broadcast = 0; ifconfig->address.addr.in);
sigar_net_address_set(ifconfig->broadcast, 0);
SIGAR_SSTRCPY(ifconfig->type, SIGAR_SSTRCPY(ifconfig->type,
SIGAR_NIC_LOOPBACK); SIGAR_NIC_LOOPBACK);
} }