26 for (
unsigned a = 0 ; a < 6 ; ++a) {
27 if (
addr[a] < other.
addr[a])
return true;
28 if (
addr[a] > other.
addr[a])
return false;
36 return (*
this == MACADDR_BROADCAST);
43 return (
addr[0] == BASEADDR_L2MULTICAST.
addr[0])
44 && (
addr[1] == BASEADDR_L2MULTICAST.
addr[1])
45 && (
addr[2] == BASEADDR_L2MULTICAST.
addr[2])
52 return (
addr[0] == BASEADDR_L3MULTICAST.
addr[0])
53 && (
addr[1] == BASEADDR_L3MULTICAST.
addr[1])
54 && (
addr[2] == BASEADDR_L3MULTICAST.
addr[2]);
67 return (
addr[0] == BASEADDR_LINKLOCAL.
addr[0])
68 && (
addr[1] == BASEADDR_LINKLOCAL.
addr[1])
69 && (
addr[2] == BASEADDR_LINKLOCAL.
addr[2])
70 && (
addr[3] == BASEADDR_LINKLOCAL.
addr[3])
71 && (
addr[4] == BASEADDR_LINKLOCAL.
addr[4]);
83 return (*
this != MACADDR_NONE);
90 for (
unsigned a = 0 ; a < 6 ; ++a) {
122 satcat5::eth::ETYPE_VTAG.
write_to(wr);
136 if (SATCAT5_VLAN_ENABLE &&
type == ETYPE_VTAG) {
Abstract API for reading byte-streams and packets.
virtual unsigned get_read_ready() const =0
How many bytes can be read without blocking?
Abstract API for writing byte-streams and packets.
Internal buffer used by the Log class.
void wr_h32(u32 val, unsigned nhex=8)
Write an integer (u32) in hexadecimal format.
void wr_str(const char *str)
Write a null-terminated UTF-8 string.
void wr_d32(u32 val, unsigned zpad=0)
Write an unsigned integer (u32) in decimal format.
Diagnostic logging to UART and/or Ethernet ports.
An Ethernet MAC address (with serializable interface).
void write_to(satcat5::io::Writeable *wr) const
Write this field to a byte-stream.
bool operator<(const satcat5::eth::MacAddr &other) const
Basic comparisons.
bool is_l2multicast() const
L2 multicast (01:80:C2:*:*:* except link-local)
bool is_valid() const
Any nonzero address.
bool is_l3multicast() const
L3 multicast (01:00:5E:*:*:*)
bool read_from(satcat5::io::Readable *rd)
Read this field from a byte-stream.
bool is_swcontrol() const
Link-local control (01:80:C2:00:00:*)
u8 addr[6]
Byte array in network order (Index 0 = MSB)
bool is_multicast() const
Broadcast, L2 multicast, or L3 multicast.
bool is_broadcast() const
Broadcast (FF:FF:FF:FF:FF:FF)
void log_to(satcat5::log::LogBuffer &wr) const
Format this field as a human-readable string.
bool is_unicast() const
Any normal single-destination address.
EtherType field (uint16) is used a protocol-ID [1536..65535].
u16 value
The 16-bit value is stored in processor-native order.
void write_to(satcat5::io::Writeable *wr) const
Write this field to a byte-stream.
void log_to(satcat5::log::LogBuffer &wr) const
Format this field as a human-readable string.
bool read_from(satcat5::io::Readable *rd)
Read this field from a byte-stream.
Header contents for an 802.1Q Virtual-LAN tag.
void log_to(satcat5::log::LogBuffer &wr) const
Format this field as a human-readable string.
bool read_from(satcat5::io::Readable *rd)
Read this field from a byte-stream.
u16 pcp() const
Accessors for each individual field.
u16 value
The 16-bit value holds VID, DEI, and PCP fields.
void write_to(satcat5::io::Writeable *wr) const
Write this field to a byte-stream.
u16 vid() const
Accessors for each individual field.
u16 dei() const
Accessors for each individual field.