eui64.h
Go to the documentation of this file.
1 /*
2  * SPDX-FileCopyrightText: 2015 Freie Universität Berlin
3  * SPDX-License-Identifier: LGPL-2.1-only
4  */
5 
6 #pragma once
7 
24 #include <stdint.h>
25 #include "byteorder.h"
26 
27 #ifdef __cplusplus
28 extern "C" {
29 #endif
30 
41 #define EUI64_LOCAL_FLAG 0x02
42 
46 #define EUI64_GROUP_FLAG 0x01
52 typedef union {
54  uint8_t uint8[8];
55  network_uint16_t uint16[4];
56  network_uint32_t uint32[2];
57 } eui64_t;
58 
66 static inline void eui64_set_local(eui64_t *addr)
67 {
68  addr->uint8[0] |= EUI64_LOCAL_FLAG;
69 }
70 
79 static inline void eui64_clear_group(eui64_t *addr)
80 {
81  addr->uint8[0] &= ~EUI64_GROUP_FLAG;
82 }
83 
84 #ifdef __cplusplus
85 }
86 #endif
87 
Functions to work with different byte orders.
static void eui64_set_local(eui64_t *addr)
Set the locally administrated bit in the EUI-64 address.
Definition: eui64.h:66
#define EUI64_LOCAL_FLAG
Locally administered address.
Definition: eui64.h:41
static void eui64_clear_group(eui64_t *addr)
Clear the group address bit to signal the address as individual address.
Definition: eui64.h:79
#define EUI64_GROUP_FLAG
Group type address.
Definition: eui64.h:46
A 16 bit integer in big endian aka network byte order.
Definition: byteorder.h:70
A 32 bit integer in big endian aka network byte order.
Definition: byteorder.h:80
A 64 bit integer in big endian aka network byte order.
Definition: byteorder.h:92
Data type to represent an EUI-64.
Definition: eui64.h:52
uint8_t uint8[8]
split into 8 8-bit words.
Definition: eui64.h:54
network_uint64_t uint64
represented as 64 bit value
Definition: eui64.h:53