add sigar_net_scope_to_string

This commit is contained in:
Doug MacEachern 2009-07-29 16:07:09 -07:00
parent 64fd05c615
commit 75b83e6cf5
2 changed files with 20 additions and 1 deletions

View File

@ -49,8 +49,9 @@ SIGAR_DECLARE(int) sigar_net_address_to_string(sigar_t *sigar,
sigar_net_address_t *address,
char *addr_str);
SIGAR_DECLARE(sigar_uint32_t) sigar_net_address_hash(sigar_net_address_t *address);
SIGAR_DECLARE(const char *)sigar_net_scope_to_string(int type);
SIGAR_DECLARE(sigar_uint32_t) sigar_net_address_hash(sigar_net_address_t *address);
SIGAR_DECLARE(const char *)sigar_net_connection_type_get(int type);

View File

@ -406,6 +406,24 @@ SIGAR_DECLARE(int) sigar_net_address_to_string(sigar_t *sigar,
}
}
SIGAR_DECLARE(const char *)sigar_net_scope_to_string(int type)
{
switch (type) {
case SIGAR_IPV6_ADDR_ANY:
return "Global";
case SIGAR_IPV6_ADDR_LOOPBACK:
return "Host";
case SIGAR_IPV6_ADDR_LINKLOCAL:
return "Link";
case SIGAR_IPV6_ADDR_SITELOCAL:
return "Site";
case SIGAR_IPV6_ADDR_COMPATv4:
return "Compat";
default:
return "Unknown";
}
}
SIGAR_DECLARE(sigar_uint32_t) sigar_net_address_hash(sigar_net_address_t *address)
{
sigar_uint32_t hash = 0;