Pulp 1.88.0
Cross-platform audio plugin framework
Loading...
Searching...
No Matches
pulp::runtime::MacAddress Class Reference

48-bit MAC address (IEEE 802 EUI-48). More...

#include <mac_address.hpp>

Public Member Functions

constexpr MacAddress ()=default
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.
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).
const std::array< uint8_t, 6 > & octets () const
 Raw octets in transmission order.
bool is_null () const
 All-zero address — typically used as a sentinel for "unknown".
bool is_multicast () const
 Group bit (LSB of first octet). 0 = unicast, 1 = multicast / broadcast.
bool is_locally_administered () const
 Local-administration bit (bit 1 of first octet).
bool is_broadcast () const
 ff:ff:ff:ff:ff:ff — the L2 broadcast address.
uint32_t oui () const
 Organisationally Unique Identifier — first 3 octets packed big-endian into the low 24 bits of a uint32_t.
bool operator== (const MacAddress &other) const
bool operator!= (const MacAddress &other) const

Static Public Member Functions

static std::optional< MacAddress > parse (std::string_view text)
 Try to parse a MAC address.
static bool is_valid (std::string_view text)
 True if text parses as a valid MAC address.

Detailed Description

48-bit MAC address (IEEE 802 EUI-48).

Stored as 6 octets in transmission order — octets()[0] is the OUI's first byte.

Accepted text forms (case-insensitive):

  • Colon-separated: aa:bb:cc:dd:ee:ff
  • Hyphen-separated: aa-bb-cc-dd-ee-ff
  • Dotted-quad-of-3: aabb.ccdd.eeff (Cisco style)
  • Plain hex: aabbccddeeff

Constructor & Destructor Documentation

◆ MacAddress() [1/2]

pulp::runtime::MacAddress::MacAddress ( )
constexprdefault

◆ MacAddress() [2/2]

pulp::runtime::MacAddress::MacAddress ( uint8_t a,
uint8_t b,
uint8_t c,
uint8_t d,
uint8_t e,
uint8_t f )
inlineconstexpr

Construct from 6 raw octets in transmission order.

Member Function Documentation

◆ is_broadcast()

bool pulp::runtime::MacAddress::is_broadcast ( ) const

ff:ff:ff:ff:ff:ff — the L2 broadcast address.

◆ is_locally_administered()

bool pulp::runtime::MacAddress::is_locally_administered ( ) const
inline

Local-administration bit (bit 1 of first octet).

1 = locally administered, 0 = globally unique OUI-assigned.

◆ is_multicast()

bool pulp::runtime::MacAddress::is_multicast ( ) const
inline

Group bit (LSB of first octet). 0 = unicast, 1 = multicast / broadcast.

◆ is_null()

bool pulp::runtime::MacAddress::is_null ( ) const

All-zero address — typically used as a sentinel for "unknown".

◆ is_valid()

bool pulp::runtime::MacAddress::is_valid ( std::string_view text)
inlinestatic

True if text parses as a valid MAC address.

◆ octets()

const std::array< uint8_t, 6 > & pulp::runtime::MacAddress::octets ( ) const
inline

Raw octets in transmission order.

◆ operator!=()

bool pulp::runtime::MacAddress::operator!= ( const MacAddress & other) const
inline

◆ operator==()

bool pulp::runtime::MacAddress::operator== ( const MacAddress & other) const
inline

◆ oui()

uint32_t pulp::runtime::MacAddress::oui ( ) const
inline

Organisationally Unique Identifier — first 3 octets packed big-endian into the low 24 bits of a uint32_t.

Useful for vendor lookups.

◆ parse()

std::optional< MacAddress > pulp::runtime::MacAddress::parse ( std::string_view text)
static

Try to parse a MAC address.

Returns std::nullopt on malformed input. Whitespace around the value is ignored; embedded whitespace is rejected.

◆ to_string()

std::string pulp::runtime::MacAddress::to_string ( ) const

Canonical colon-separated lowercase form (e.g. aa:bb:cc:dd:ee:ff).

◆ to_string_hyphens()

std::string pulp::runtime::MacAddress::to_string_hyphens ( ) const

Same as to_string() but with hyphens (e.g. aa-bb-cc-dd-ee-ff).


The documentation for this class was generated from the following file:
  • /home/runner/work/pulp/pulp/core/runtime/include/pulp/runtime/mac_address.hpp