pub struct PayloadChain<'a> {
pub headers: Vec<ExtensionHeader>,
pub final_type: TypeField,
pub pdu: &'a [u8],
}Expand description
The decoded payload area of an SNDU (RFC 4326 §5): a chain of extension
headers terminated by a final TypeField (an EtherType, or the
introducing Type of a trailing Mandatory header) and the opaque PDU bytes.
Fields§
§headers: Vec<ExtensionHeader>Zero or more optional extension headers, in wire order.
A Mandatory header is always last and is represented by final_type
being a Next-Header plus the PDU being its body, so this list only ever
holds Optional headers in the typed-chain model.
final_type: TypeFieldThe Type field that terminates the optional-header chain: either an
EtherType naming the PDU, or a Next-Header introducing a final Mandatory
header (whose body is pdu).
pdu: &'a [u8]The opaque PDU bytes (or the Mandatory header’s body).
Implementations§
Source§impl<'a> PayloadChain<'a>
impl<'a> PayloadChain<'a>
Sourcepub fn parse(first_type: TypeField, data: &'a [u8]) -> Result<Self>
pub fn parse(first_type: TypeField, data: &'a [u8]) -> Result<Self>
Parse a payload chain: walk the optional extension headers, then read the final Type field and treat everything after it as the PDU.
first_type is the SNDU base header’s Type field; data is the SNDU
payload area between the base header (+NPA) and the CRC.
Sourcepub fn serialized_len(&self) -> usize
pub fn serialized_len(&self) -> usize
Wire length of the chain excluding the SNDU base header’s Type field (which the SNDU serializer writes), i.e. the bytes from the first optional-header body onward, including intervening Type fields, the final Type field, and the PDU.
Sourcepub fn base_type(&self) -> TypeField
pub fn base_type(&self) -> TypeField
The Type field the SNDU base header must carry to introduce this chain:
the first optional header’s Type, or final_type when there are no
optional headers.
Sourcepub fn serialize_into(&self, out: &mut [u8]) -> Result<usize>
pub fn serialize_into(&self, out: &mut [u8]) -> Result<usize>
Serialize the chain into out, starting after the base header’s Type
field. Returns the number of bytes written.
Trait Implementations§
Source§impl<'a> Clone for PayloadChain<'a>
impl<'a> Clone for PayloadChain<'a>
Source§fn clone(&self) -> PayloadChain<'a>
fn clone(&self) -> PayloadChain<'a>
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl<'a> Debug for PayloadChain<'a>
impl<'a> Debug for PayloadChain<'a>
impl<'a> Eq for PayloadChain<'a>
Source§impl<'a> PartialEq for PayloadChain<'a>
impl<'a> PartialEq for PayloadChain<'a>
Source§fn eq(&self, other: &PayloadChain<'a>) -> bool
fn eq(&self, other: &PayloadChain<'a>) -> bool
self and other values to be equal, and is used by ==.