pub struct Sndu<'a> {
pub dest_address: Option<[u8; 6]>,
pub payload: PayloadChain<'a>,
}Expand description
A parsed/owned SubNetwork Data Unit (RFC 4326 §4).
Holds typed header fields plus a borrowed view of the PDU. Length and the
CRC are not stored: both are recomputed on serialize, so the round-trip is
driven entirely from the typed fields (no raw passthrough).
The base-header Type field is derived from the payload chain (via
PayloadChain::base_type) and is not stored as a separate field — the
chain is the single source of truth so the two can never diverge. Use
Sndu::type_field to read it.
Fields§
§dest_address: Option<[u8; 6]>The 6-byte Receiver Destination NPA address (§4.5), present iff D = 0.
D is derived from Some/None: D = 0 ⇔ Some.
payload: PayloadChain<'a>Decoded extension-header chain + PDU (§5). The base-header Type field is
derived from the chain’s base_type() on serialize.
Implementations§
Source§impl<'a> Sndu<'a>
impl<'a> Sndu<'a>
Sourcepub fn new(
type_field: TypeField,
dest_address: Option<[u8; 6]>,
pdu: &'a [u8],
) -> Sndu<'a>
pub fn new( type_field: TypeField, dest_address: Option<[u8; 6]>, pdu: &'a [u8], ) -> Sndu<'a>
Construct an SNDU from a Type field, optional NPA address, and an opaque PDU (no extension headers).
Sourcepub fn type_field(&self) -> TypeField
pub fn type_field(&self) -> TypeField
The base-header Type field (§4.4): derived from the payload chain’s
PayloadChain::base_type. This is the value that appears on the wire
at bytes [2..4] of the SNDU.
Sourcepub fn length_field(&self) -> usize
pub fn length_field(&self) -> usize
The Length field as it appears on the wire: bytes counted from the
byte after the Type field, up to and including the CRC (§4.2).
= NPA (if D=0) + extension-chain content + PDU + CRC.
Sourcepub fn serialized_len(&self) -> usize
pub fn serialized_len(&self) -> usize
Total serialized size in bytes (base header + everything the Length
field counts).