16 #ifndef included_ip46_address_h 17 #define included_ip46_address_h 30 #define IP46_N_TYPES (IP46_TYPE_IP6+2) 32 #define FOREACH_IP46_TYPE(_type) \ 33 for (_type = IP46_TYPE_IP4; _type <= IP46_TYPE_IP6; _type++) 52 #define ip46_address_initializer {{{ 0 }}} 57 return (((ip46)->
pad[0] | (ip46)->
pad[1] | (ip46)->
pad[2]) == 0);
63 ((ip46)->
pad[0] = (ip46)->pad[1] = (ip46)->
pad[2] = 0);
76 ip46->as_u64[0] = ip46->as_u64[1] = 0;
81 const ip46_address_t * ip46_2)
83 return (memcmp (ip46_1, ip46_2,
sizeof (*ip46_1)));
89 return (ip46->as_u64[0] == 0 && ip46->as_u64[1] == 0);
94 const ip46_address_t * ip46_2)
96 return ((ip46_1->as_u64[0] == ip46_2->as_u64[0]) &&
97 (ip46_1->as_u64[1] == ip46_2->as_u64[1]));
111 return (ip46->ip4.as_u32 == ip4->
as_u32);
118 return ((ip46->ip6.as_u64[0] == ip6->
as_u64[0]) &&
119 (ip46->ip6.as_u64[1] == ip6->
as_u64[1]));
125 dst->as_u64[0] = src->as_u64[0];
126 dst->as_u64[1] = src->as_u64[1];
132 dst->as_u64[0] = src->
as_u64[0];
133 dst->as_u64[1] = src->
as_u64[1];
u8 pad[3]
log2 (size of the packing page block)
static_always_inline int ip4_address_is_equal(const ip4_address_t *ip4_1, const ip4_address_t *ip4_2)
static uword ip46_address_is_multicast(const ip46_address_t *a)
static void ip46_address_mask_ip4(ip46_address_t *ip46)
void ip6_address_increment(ip6_address_t *i)
void ip46_address_increment(ip46_type_t type, ip46_address_t *ip)
static_always_inline void ip46_address_set_ip6(ip46_address_t *dst, const ip6_address_t *src)
static ip46_type_t ip46_address_get_type(const ip46_address_t *ip)
static uword ip4_address_is_multicast(const ip4_address_t *a)
static u8 ip46_address_is_ip4(const ip46_address_t *ip46)
static_always_inline int ip46_address_is_equal_v6(const ip46_address_t *ip46, const ip6_address_t *ip6)
static void ip46_address_reset(ip46_address_t *ip46)
#define static_always_inline
static int ip46_address_cmp(const ip46_address_t *ip46_1, const ip46_address_t *ip46_2)
static_always_inline void ip46_address_copy(ip46_address_t *dst, const ip46_address_t *src)
static u8 ip46_address_is_zero(const ip46_address_t *ip46)
void ip4_address_increment(ip4_address_t *i)
static u8 ip46_address_is_equal(const ip46_address_t *ip46_1, const ip46_address_t *ip46_2)
format_function_t format_ip46_address
u8 * format_ip46_type(u8 *s, va_list *args)
static uword ip6_address_is_multicast(const ip6_address_t *a)
static ip46_address_t to_ip46(u32 is_ipv6, u8 *buf)
static_always_inline int ip46_address_is_equal_v4(const ip46_address_t *ip46, const ip4_address_t *ip4)
typedef CLIB_PACKED(union ip46_address_t_ { struct { u32 pad[3];ip4_address_t ip4;};ip6_address_t ip6;u8 as_u8[16];u64 as_u64[2];}) ip46_address_t
static void ip46_address_set_ip4(ip46_address_t *ip46, const ip4_address_t *ip)