From 54d1ee7cffc193284ed685f2fe6a68409b796e4a Mon Sep 17 00:00:00 2001 From: Doug MacEachern Date: Wed, 29 Jul 2009 15:13:25 -0700 Subject: [PATCH] add some ipv6 related macros --- include/sigar_private.h | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/include/sigar_private.h b/include/sigar_private.h index 06ec8180..fde2465f 100644 --- a/include/sigar_private.h +++ b/include/sigar_private.h @@ -299,6 +299,22 @@ int sigar_net_interface_ipv6_config_get(sigar_t *sigar, const char *name, ifconfig->prefix6_length = 0; \ ifconfig->scope6 = 0 +#define SIGAR_SIN6(s) ((struct sockaddr_in6 *)(s)) + +#define SIGAR_SIN6_ADDR(s) &SIGAR_SIN6(s)->sin6_addr + +#define sigar_net_interface_scope6_set(ifconfig, addr) \ + if (IN6_IS_ADDR_LINKLOCAL(addr)) \ + ifconfig->scope6 = SIGAR_IPV6_ADDR_LINKLOCAL; \ + else if (IN6_IS_ADDR_SITELOCAL(addr)) \ + ifconfig->scope6 = SIGAR_IPV6_ADDR_SITELOCAL; \ + else if (IN6_IS_ADDR_V4COMPAT(addr)) \ + ifconfig->scope6 = SIGAR_IPV6_ADDR_COMPATv4; \ + else if (IN6_IS_ADDR_LOOPBACK(addr)) \ + ifconfig->scope6 = SIGAR_IPV6_ADDR_LOOPBACK; \ + else \ + ifconfig->scope6 = SIGAR_IPV6_ADDR_ANY + int sigar_tcp_curr_estab(sigar_t *sigar, sigar_tcp_t *tcp); int sigar_who_list_create(sigar_who_list_t *wholist);