LpPacket

Struct LpPacket 

Source
pub struct LpPacket {
Show 14 fields pub fragment: Option<Bytes>, pub nack: Option<NackReason>, pub congestion_mark: Option<u64>, pub sequence: Option<u64>, pub frag_index: Option<u64>, pub frag_count: Option<u64>, pub acks: Vec<u64>, pub pit_token: Option<Bytes>, pub incoming_face_id: Option<u64>, pub next_hop_face_id: Option<u64>, pub cache_policy: Option<CachePolicyType>, pub tx_sequence: Option<u64>, pub non_discovery: bool, pub prefix_announcement: Option<Bytes>,
}
Expand description

A decoded NDNLPv2 LpPacket.

Fields§

§fragment: Option<Bytes>

The network-layer fragment (Interest or Data wire bytes). None for bare Ack-only packets (no payload).

§nack: Option<NackReason>

Nack header — present when this LpPacket carries a Nack.

§congestion_mark: Option<u64>

Hop-by-hop congestion mark (0 = no congestion).

§sequence: Option<u64>

Fragment sequence number (for reassembly ordering).

§frag_index: Option<u64>

Zero-based index of this fragment within the original packet.

§frag_count: Option<u64>

Total number of fragments the original packet was split into.

§acks: Vec<u64>

Piggybacked Ack TxSequences (NDNLPv2 reliability).

§pit_token: Option<Bytes>

PIT token (opaque, 1-32 bytes).

§incoming_face_id: Option<u64>

Incoming face ID (local control header).

§next_hop_face_id: Option<u64>

Next-hop face ID (local control header).

§cache_policy: Option<CachePolicyType>

Cache policy.

§tx_sequence: Option<u64>

Reliability TxSequence (0x0348) — distinct from fragmentation Sequence (0x51).

§non_discovery: bool

NonDiscovery flag (presence = true).

§prefix_announcement: Option<Bytes>

Prefix announcement (raw Data bytes).

Implementations§

Source§

impl LpPacket

Source

pub fn decode(raw: Bytes) -> Result<Self, PacketError>

Decode an LpPacket from raw wire bytes.

The input must start with TLV type 0x64 (LP_PACKET).

Source§

impl LpPacket

Source

pub fn is_fragmented(&self) -> bool

Returns true if this LpPacket is a fragment of a larger packet.

Source

pub fn is_ack_only(&self) -> bool

Returns true if this LpPacket is a bare Ack (no payload fragment).

Trait Implementations§

Source§

impl Debug for LpPacket

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

§

impl<T> Pointable for T

§

const ALIGN: usize

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.