From 320726b83e2096d9431f28208437a738b31d8ad9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Valverde?= Date: Fri, 8 Apr 2016 05:18:13 +0100 Subject: Move IPv6 address utility functions to wsutil MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: Ica8babbf4760b02e4840557fc61241152b2763c5 Reviewed-on: https://code.wireshark.org/review/13025 Petri-Dish: João Valverde Tested-by: Petri Dish Buildbot Reviewed-by: Alexis La Goutte Reviewed-by: João Valverde --- wsutil/inet_ipv6.h | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) (limited to 'wsutil') diff --git a/wsutil/inet_ipv6.h b/wsutil/inet_ipv6.h index 85a09e7105..21543253c4 100644 --- a/wsutil/inet_ipv6.h +++ b/wsutil/inet_ipv6.h @@ -26,4 +26,34 @@ struct e_in6_addr { guint8 bytes[16]; /**< 128 bit IP6 address */ }; +/** + * Unicast Scope + * Note that we must check topmost 10 bits only, not 16 bits (see RFC2373). + */ +#if 0 /* XXX Currently unused */ +static inline gboolean in6_is_addr_link_local(struct e_in6_addr *a) { + if ((a->bytes[0] == 0xfe) && ((a->bytes[1] & 0xc0) == 0x80)) { + return TRUE; + } + return FALSE; +} + +static inline gboolean in6_is_addr_sitelocal(struct e_in6_addr *a) { + if ((a->bytes[0] == 0xfe) && ((a->bytes[1] & 0xc0) == 0xc0)) { + return TRUE; + } + return FALSE; +} +#endif + +/** + * Multicast + */ +static inline gboolean in6_is_addr_multicast(struct e_in6_addr *a) { + if (a->bytes[0] == 0xff) { + return TRUE; + } + return FALSE; +} + #endif -- cgit v1.2.3