23 MACAddress() { memset(m_bytes, 0,
sizeof(m_bytes)); }
29 void set_lo(uint32_t value);
30 void set_hi(uint16_t value);
35 inline void randomize()
37 for (
int i = 0; i < 6; ++i) {
40 m_bytes[0] &= ~((uint8_t)1);
43 bool set_from_str(
const std::string& s);
46 bool operator==(
const MACAddress& other)
const {
return memcmp(m_bytes, other.m_bytes, 6) == 0; }
48 bool operator!=(
const MACAddress& other)
const {
return !this->operator==(other); }
50 bool operator<(
const MACAddress& other)
const {
return memcmp(m_bytes, other.m_bytes, 6) < 0; }
52 bool operator>(
const MACAddress& other)
const {
return memcmp(m_bytes, other.m_bytes, 6) > 0; }
54 bool operator<=(
const MACAddress& other)
const {
return memcmp(m_bytes, other.m_bytes, 6) <= 0; }
56 bool operator>=(
const MACAddress& other)
const {
return memcmp(m_bytes, other.m_bytes, 6) >= 0; }
58 uint8_t operator[](
int i)
const {
return (i < 6) ? m_bytes[i] : 0; }