16 #ifndef __MAC_ADDRESS_H__ 17 #define __MAC_ADDRESS_H__ 35 "MAC address must represent the on wire format");
42 return (((
u64) a[0] << (
u64) (5 * 8))
43 | ((
u64) a[1] << (
u64) (4 * 8))
44 | ((
u64) a[2] << (
u64) (3 * 8))
45 | ((
u64) a[3] << (
u64) (2 * 8))
46 | ((
u64) a[4] << (
u64) (1 * 8)) | ((
u64) a[5] << (
u64) (0 * 8)));
54 for (ii = 5; ii >= 0; ii--)
64 return (a & (1ULL << (5 * 8))) != 0;
70 return ((*((
u32 *) mac) == 0) && (*((
u16 *) (mac + 4)) == 0));
79 memcpy (mac + 2, &rnd,
sizeof (rnd));
87 return ((*((
u32 *) a) == (*((
u32 *) b))) &&
88 (*((
u16 *) (a + 4)) == (*((
u16 *) (b + 4)))));
108 return (0 == mac->
u.first_4 && 0 == mac->
u.last_2);
142 return (a->
u.last_2 == b->
u.last_2 && a->
u.first_4 == b->
u.first_4);
STATIC_ASSERT((sizeof(mac_address_t)==6), "MAC address must represent the on wire format")
#define clib_memcpy_fast(a, b, c)
static int ethernet_mac_address_is_multicast_u64(u64 a)
void mac_address_increment(mac_address_t *mac)
static u64 clib_cpu_time_now(void)
static_always_inline void mac_address_copy(mac_address_t *dst, const mac_address_t *src)
static_always_inline int mac_address_is_zero(const mac_address_t *mac)
static_always_inline void mac_address_set_zero(mac_address_t *mac)
#define clib_memcpy(d, s, n)
const mac_address_t ZERO_MAC_ADDRESS
#define static_always_inline
static_always_inline void mac_address_to_bytes(const mac_address_t *mac, u8 *bytes)
static_always_inline void mac_address_from_bytes(mac_address_t *mac, const u8 *bytes)
struct mac_address_t_::@298::@300 u
static_always_inline void mac_address_from_u64(mac_address_t *mac, u64 u)
static_always_inline int mac_address_equal(const mac_address_t *a, const mac_address_t *b)
static void ethernet_mac_address_from_u64(u64 u, u8 *a)
static int ethernet_mac_address_equal(const u8 *a, const u8 *b)
static_always_inline int mac_address_n_bits_set(const mac_address_t *a)
struct mac_address_t_ mac_address_t
static u64 ethernet_mac_address_u64(const u8 *a)
static_always_inline u64 mac_address_as_u64(const mac_address_t *mac)
static void ethernet_mac_address_generate(u8 *mac)
static u32 random_u32(u32 *seed)
32-bit random number generator
static int ethernet_mac_address_is_zero(const u8 *mac)
static uword count_set_bits(uword x)
static_always_inline int mac_address_cmp(const mac_address_t *a, const mac_address_t *b)
u8 * format_mac_address_t(u8 *s, va_list *args)
uword unformat_mac_address_t(unformat_input_t *input, va_list *args)