From 68c5584488d7c45bfb23781552c6afce66c24fe2 Mon Sep 17 00:00:00 2001 From: George Oikonomou Date: Fri, 11 Nov 2011 11:34:05 +0000 Subject: [PATCH] New uip_is_addr macros for multicast addresses --- core/net/ip/uip.h | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/core/net/ip/uip.h b/core/net/ip/uip.h index 076734396..c6a50d699 100644 --- a/core/net/ip/uip.h +++ b/core/net/ip/uip.h @@ -2093,6 +2093,35 @@ CCIF extern uip_lladdr_t uip_lladdr; #define uip_is_addr_mcast(a) \ (((a)->u8[0]) == 0xFF) +/** + * \brief is address a global multicast address (FFxE::/16), + * a is of type uip_ip6addr_t* + * */ +#define uip_is_addr_mcast_global(a) \ + ((((a)->u8[0]) == 0xFF) && \ + (((a)->u8[1] & 0x0F) == 0x0E)) + +/** + * \brief is address a non-routable multicast address. + * Scopes 1 (interface-local) and 2 (link-local) are non-routable + * See RFC4291 and draft-ietf-6man-multicast-scopes + * a is of type uip_ip6addr_t* + * */ +#define uip_is_addr_mcast_non_routable(a) \ + ((((a)->u8[0]) == 0xFF) && \ + (((a)->u8[1] & 0x0F) <= 0x02)) + +/** + * \brief is address a routable multicast address. + * Scope 3 (Realm-Local) or higher are routable + * Realm-Local scope is defined in draft-ietf-6man-multicast-scopes + * See RFC4291 and draft-ietf-6man-multicast-scopes + * a is of type uip_ip6addr_t* + * */ +#define uip_is_addr_mcast_routable(a) \ + ((((a)->u8[0]) == 0xFF) && \ + (((a)->u8[1] & 0x0F) > 0x02)) + /** * \brief is group-id of multicast address a * the all nodes group-id