1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00

net/eui48: reorder code

Move eui48_set_local() and eui48_clear_group() to the top so we can
use it later in the file.
This commit is contained in:
Benjamin Valentin 2020-09-30 11:16:47 +02:00
parent ab15d67e80
commit d7943a49aa

View File

@ -36,6 +36,49 @@ typedef struct {
uint8_t uint8[6]; /**< split into 6 8-bit words. */
} eui48_t;
/**
* @name EUI-48 bit flags contained in the first octet
*
* @see IEEE 802-2001 section 9.2
* @{
*/
/**
* @brief Locally administered address.
*/
#define EUI48_LOCAL_FLAG 0x02
/**
* @brief Group type address.
*/
#define EUI48_GROUP_FLAG 0x01
/** @} */
/**
* @brief Set the locally administrated bit in the EUI-48 address.
*
* @see IEEE 802-2001 section 9.2
*
* @param addr ethernet address
*/
static inline void eui48_set_local(eui48_t *addr)
{
addr->uint8[0] |= EUI48_LOCAL_FLAG;
}
/**
* @brief Clear the group address bit to signal the address as individual
* address
*
* @see IEEE 802-2001 section 9.2
*
* @param addr ethernet address
*/
static inline void eui48_clear_group(eui48_t *addr)
{
addr->uint8[0] &= ~EUI48_GROUP_FLAG;
}
/**
* @brief Generates an EUI-64 from a 48-bit device address
*
@ -56,24 +99,6 @@ static inline void eui48_to_eui64(eui64_t *eui64, const eui48_t *addr)
eui64->uint8[7] = addr->uint8[5];
}
/**
* @name EUI-48 bit flags contained in the first octet
*
* @see IEEE 802-2001 section 9.2
* @{
*/
/**
* @brief Locally administered address.
*/
#define EUI48_LOCAL_FLAG 0x02
/**
* @brief Group type address.
*/
#define EUI48_GROUP_FLAG 0x01
/** @} */
/**
* @brief Generates an IPv6 interface identifier from a 48-bit device address
*
@ -106,32 +131,6 @@ static inline void eui48_from_ipv6_iid(eui48_t *addr, const eui64_t *iid)
addr->uint8[5] = iid->uint8[7];
}
/**
* @brief Set the locally administrated bit in the EUI-48 address.
*
* @see IEEE 802-2001 section 9.2
*
* @param addr ethernet address
*/
static inline void eui48_set_local(eui48_t *addr)
{
addr->uint8[0] |= EUI48_LOCAL_FLAG;
}
/**
* @brief Clear the group address bit to signal the address as individual
* address
*
* @see IEEE 802-2001 section 9.2
*
* @param addr ethernet address
*/
static inline void eui48_clear_group(eui48_t *addr)
{
addr->uint8[0] &= ~EUI48_GROUP_FLAG;
}
#ifdef __cplusplus
}
#endif