31 uint8_t d, uint8_t e, uint8_t f)
32 : octets_{a, b, c, d, e, f} {}
37 static std::optional<MacAddress>
parse(std::string_view text);
41 return parse(text).has_value();
51 const std::array<uint8_t, 6>&
octets()
const {
return octets_; }
69 uint32_t
oui()
const {
70 return (uint32_t(octets_[0]) << 16) |
71 (uint32_t(octets_[1]) << 8) |
76 return octets_ ==
other.octets_;
79 return !(*
this ==
other);
83 std::array<uint8_t, 6> octets_{};
bool operator==(const MacAddress &other) const
Definition mac_address.hpp:75
std::string to_string() const
Canonical colon-separated lowercase form (e.g. aa:bb:cc:dd:ee:ff).
std::string to_string_hyphens() const
Same as to_string() but with hyphens (e.g. aa-bb-cc-dd-ee-ff).
constexpr MacAddress()=default
bool is_broadcast() const
ff:ff:ff:ff:ff:ff — the L2 broadcast address.
bool is_locally_administered() const
Local-administration bit (bit 1 of first octet).
Definition mac_address.hpp:61
bool is_null() const
All-zero address — typically used as a sentinel for "unknown".
bool operator!=(const MacAddress &other) const
Definition mac_address.hpp:78
bool is_multicast() const
Group bit (LSB of first octet). 0 = unicast, 1 = multicast / broadcast.
Definition mac_address.hpp:57
const std::array< uint8_t, 6 > & octets() const
Raw octets in transmission order.
Definition mac_address.hpp:51
constexpr MacAddress(uint8_t a, uint8_t b, uint8_t c, uint8_t d, uint8_t e, uint8_t f)
Construct from 6 raw octets in transmission order.
Definition mac_address.hpp:30
uint32_t oui() const
Organisationally Unique Identifier — first 3 octets packed big-endian into the low 24 bits of a uint3...
Definition mac_address.hpp:69
static bool is_valid(std::string_view text)
True if text parses as a valid MAC address.
Definition mac_address.hpp:40
static std::optional< MacAddress > parse(std::string_view text)
Try to parse a MAC address.
Definition generated_event_source.hpp:33
@ other
Definition udev_monitor.hpp:26