eui64.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2015 Freie Universität Berlin
3  *
4  * This file is subject to the terms and conditions of the GNU Lesser
5  * General Public License v2.1. See the file LICENSE in the top level
6  * directory for more details.
7  */
8 
24 #ifndef NET_EUI64_H
25 #define NET_EUI64_H
26 
27 #include <stdint.h>
28 #include "byteorder.h"
29 
30 #ifdef __cplusplus
31 extern "C" {
32 #endif
33 
44 #define EUI64_LOCAL_FLAG 0x02
45 
49 #define EUI64_GROUP_FLAG 0x01
50 
55 typedef union {
57  uint8_t uint8[8];
58  network_uint16_t uint16[4];
59  network_uint32_t uint32[2];
60 } eui64_t;
61 
69 static inline void eui64_set_local(eui64_t *addr)
70 {
71  addr->uint8[0] |= EUI64_LOCAL_FLAG;
72 }
73 
82 static inline void eui64_clear_group(eui64_t *addr)
83 {
84  addr->uint8[0] &= ~EUI64_GROUP_FLAG;
85 }
86 
87 #ifdef __cplusplus
88 }
89 #endif
90 
91 #endif /* NET_EUI64_H */
92 
eui64_t::uint8
uint8_t uint8[8]
split into 8 8-bit words.
Definition: eui64.h:57
eui64_t::uint64
network_uint64_t uint64
represented as 64 bit value
Definition: eui64.h:56
be_uint32_t
A 32 bit integer in big endian aka network byte order.
Definition: byteorder.h:87
byteorder.h
Functions to work with different byte orders.
be_uint16_t
A 16 bit integer in big endian aka network byte order.
Definition: byteorder.h:77
EUI64_LOCAL_FLAG
#define EUI64_LOCAL_FLAG
Locally administered address.
Definition: eui64.h:44
eui64_clear_group
static void eui64_clear_group(eui64_t *addr)
Clear the group address bit to signal the address as individual address.
Definition: eui64.h:82
eui64_set_local
static void eui64_set_local(eui64_t *addr)
Set the locally administrated bit in the EUI-64 address.
Definition: eui64.h:69
eui64_t
Data type to represent an EUI-64.
Definition: eui64.h:55
be_uint64_t
A 64 bit integer in big endian aka network byte order.
Definition: byteorder.h:99
EUI64_GROUP_FLAG
#define EUI64_GROUP_FLAG
Group type address.
Definition: eui64.h:49