folly::MacAddress

A 48-bit ethernet MAC address.

Synopsis

Declared in <folly/MacAddress.h>

class MacAddress;

Member Functions

NameDescription
MacAddress [constructor]Constructors
bytes Get a pointer to the MAC address' binary value.
isBroadcast Return true if this is the broadcast MAC address.
isLocallyAdministered Return true if this MAC address is locally administered.
isMulticast Return true if this is a multicast MAC address.
isUnicast Return true if this is a unicast MAC address.
parse Update the current MacAddress object from a human-readable string.
setFromBinary Update the current MacAddress object from a 6-byte binary representation, throwing on failure.
setFromString Update the current MacAddress object from a human-readable string, throwing on failure.
toString Return a human-readable representation of the MAC address.
trySetFromBinary Update the current MacAddress object from a 6-byte binary representation.
trySetFromString Update the current MacAddress object from a human-readable string.
u64HBO Return the address as a uint64_t, in host byte order.
u64NBO Return the address as a uint64_t, in network byte order.
operator== Return true if the two MAC addresses are equal.
operator!= Return true if the two MAC addresses are not equal.
operator<=> Order two MAC addresses by their host-byte-order value.

Static Member Functions

NameDescription
createMulticast Construct the multicast MacAddress for the specified multicast IPv6 address.
fromBinary Construct a MAC address from its 6-byte binary value, throwing on failure.
fromHBO Construct a MacAddress from a uint64_t in host byte order.
fromNBO Construct a MacAddress from a uint64_t in network byte order.
fromString Parse a MacAddress from a human-readable string, throwing on failure.
tryFromBinary Construct a MAC address from its 6-byte binary value
tryFromString Try to parse a MacAddress from a human-readable string.

Static Data Members

NameDescription
BROADCAST The broadcast MAC address (all bytes set to 0xFF).
SIZE Number of bytes in a MAC address.
ZERO The zero MAC address (all bytes set to 0x00).

Non-Member Functions

NameDescription
toAppendDefine toAppend() so to<string> will work