pub fn encode_frame(
destination: [u8; 6],
source: [u8; 6],
bpdu: &[u8],
) -> Result<Vec<u8>>Expand description
Wrap a BPDU body in an 802.3 + LLC frame, padded to the 60-octet minimum.
The length field carries the MAC client data length — LLC header plus BPDU — and
deliberately does not include the padding. A configuration BPDU therefore always shows
00 26 (38) and an RST BPDU 00 27 (39).
Refuses a body that would not fit the length field as a length. Every BPDU this codec
produces is 4, 35 or 36 octets, so no caller here can trip it — but this is a pub fn
taking an arbitrary slice, and narrowing with a bare as u16 would let a future one write
a value of 1536 or more, which IEEE 802.3 reserves for EtherType. The frame would then stop
being 802.3 at all and every receiver would read it as Ethernet II, the BPDU never parsed.
decode_frame already rejects exactly this in the other direction.