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 } eui64_t;
60 
68 static inline void eui64_set_local(eui64_t *addr)
69 {
70  addr->uint8[0] |= EUI64_LOCAL_FLAG;
71 }
72 
81 static inline void eui64_clear_group(eui64_t *addr)
82 {
83  addr->uint8[0] &= ~EUI64_GROUP_FLAG;
84 }
85 
86 #ifdef __cplusplus
87 }
88 #endif
89 
90 #endif /* NET_EUI64_H */
91 
#define EUI64_GROUP_FLAG
Group type address.
Definition: eui64.h:49
A 16 bit integer in big endian aka network byte order.
Definition: byteorder.h:76
uint8_t uint8[8]
split into 8 8-bit words.
Definition: eui64.h:57
#define EUI64_LOCAL_FLAG
Locally administered address.
Definition: eui64.h:44
Functions to work with different byte orders.
static void eui64_clear_group(eui64_t *addr)
Clear the group address bit to signal the address as individual address.
Definition: eui64.h:81
static void eui64_set_local(eui64_t *addr)
Set the locally administrated bit in the EUI-64 address.
Definition: eui64.h:68
Data type to represent an EUI-64.
Definition: eui64.h:55
network_uint64_t uint64
represented as 64 bit value
Definition: eui64.h:56
A 64 bit integer in big endian aka network byte order.
Definition: byteorder.h:98