add some ipv6 related macros

This commit is contained in:
Doug MacEachern 2009-07-29 15:13:25 -07:00
parent 1c7020c553
commit 54d1ee7cff
1 changed files with 16 additions and 0 deletions

View File

@ -299,6 +299,22 @@ int sigar_net_interface_ipv6_config_get(sigar_t *sigar, const char *name,
ifconfig->prefix6_length = 0; \ ifconfig->prefix6_length = 0; \
ifconfig->scope6 = 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_tcp_curr_estab(sigar_t *sigar, sigar_tcp_t *tcp);
int sigar_who_list_create(sigar_who_list_t *wholist); int sigar_who_list_create(sigar_who_list_t *wholist);