22 #ifndef SATCAT5_VLAN_ENABLE
23 #define SATCAT5_VLAN_ENABLE 1
40 (u8)(x >> 40), (u8)(x >> 32), (u8)(x >> 24),
41 (u8)(x >> 16), (u8)(x >> 8), (u8)(x >> 0)};
45 return 1099511627776ULL *
addr[0]
46 + 4294967296ULL *
addr[1]
47 + 16777216ULL *
addr[2]
56 return 72057594037927936ull *
addr[0]
57 + 281474976710656ull *
addr[1]
58 + 1099511627776ull *
addr[2]
59 + 4294967296ull * 0xFF
116 {wr->write_u16(
value);}
119 {
value = rd->read_u16();
return true;}
135 inline u16
vid()
const {
return ((
value >> 0) & 0xFFF);}
136 inline u16
dei()
const {
return ((
value >> 12) & 0x001);}
137 inline u16
pcp()
const {
return ((
value >> 13) & 0x007);}
140 | ((
dei & 0x001) << 12)
141 | ((
pcp & 0x007) << 13);
157 {wr->write_u16(
value);}
160 {
value = rd->read_u16();
return true;}
193 {{0x00, 0x00, 0x00, 0x00, 0x00, 0x00}};
195 {{0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF}};
197 {{0x01, 0x80, 0xC2, 0x00, 0x00, 0x01}};
199 {{0x01, 0x80, 0xC2, 0x00, 0x00, 0x00}};
201 {{0x01, 0x80, 0xC2, 0x00, 0x01, 0x00}};
203 {{0x01, 0x00, 0x5E, 0x00, 0x00, 0x00}};
206 ETYPE_NONE = {0x0000},
207 ETYPE_IPV4 = {0x0800},
208 ETYPE_ARP = {0x0806},
209 ETYPE_RECOVERY = {0x5252},
210 ETYPE_CFGBUS_CMD = {0x5C01},
211 ETYPE_CFGBUS_ACK = {0x5C02},
212 ETYPE_SLINGSHOT_LOG = {0x5C03},
213 ETYPE_CBOR_TLM = {0x5C04},
214 ETYPE_SWITCH_LOG = {0x5C05},
215 ETYPE_VTAG = {0x8100},
216 ETYPE_FLOWCTRL = {0x8808},
217 ETYPE_MACSEC = {0x88E5},
218 ETYPE_PTP = {0x88F7};
221 VTAG_NONE = {0x0000},
222 VTAG_DEFAULT = {0x0001},
223 VTAG_PRIORITY1 = {0x2000},
224 VTAG_PRIORITY2 = {0x4000},
225 VTAG_PRIORITY3 = {0x6000},
226 VTAG_PRIORITY4 = {0x8000},
227 VTAG_PRIORITY5 = {0xA000},
228 VTAG_PRIORITY6 = {0xC000},
229 VTAG_PRIORITY7 = {0xE000};
232 constexpr u16 VID_NONE = 0;
233 constexpr u16 VID_MIN = 1;
234 constexpr u16 VID_MAX = 4094;
235 constexpr u16 VID_RSVD = 4095;
239 {MACADDR_NONE, MACADDR_NONE, ETYPE_NONE, VTAG_NONE};
Abstract API for reading byte-streams and packets.
virtual bool read_bytes(unsigned nbytes, void *dst)
Read 0 or more bytes into a buffer.
Abstract API for writing byte-streams and packets.
virtual void write_bytes(unsigned nbytes, const void *src)
Write 0 or more bytes from a buffer.
Internal buffer used by the Log class.
I/O interface core definitions.
An Ethernet MAC address (with serializable interface).
constexpr u64 to_ptp_clockid() const
Convert to PTP Clock-ID (IEEE 1588-2008 7.5.2.2.2 Note 2).
static constexpr satcat5::eth::MacAddr from_u64(u64 x)
Convert from u64 to MacAddr.
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 operator!=(const satcat5::eth::MacAddr &other) const
Basic comparisons.
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 operator==(const satcat5::eth::MacAddr &other) const
Basic comparisons.
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.
constexpr u64 to_u64() const
Convert from MacAddr to u64.
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.
bool operator!=(const satcat5::eth::MacType &other) const
Basic comparisons.
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.
bool operator==(const satcat5::eth::MacType &other) const
Basic comparisons.
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.
bool any() const
Accessors for each individual field.
void write_to(satcat5::io::Writeable *wr) const
Write this field to a byte-stream.
bool operator==(const satcat5::eth::VlanTag &other) const
Basic comparisons.
u16 vid() const
Accessors for each individual field.
void set(u16 vid, u16 dei, u16 pcp)
Accessors for each individual field.
bool operator!=(const satcat5::eth::VlanTag &other) const
Basic comparisons.
u16 dei() const
Accessors for each individual field.
Basic type aliases and prototypes used throughout SatCat5.