PacketContext

Struct PacketContext 

Source
pub struct PacketContext {
    pub raw_bytes: Bytes,
    pub face_id: FaceId,
    pub name: Option<Arc<Name>>,
    pub packet: DecodedPacket,
    pub pit_token: Option<PitToken>,
    pub lp_pit_token: Option<Bytes>,
    pub out_faces: SmallVec<[FaceId; 4]>,
    pub cs_hit: bool,
    pub verified: bool,
    pub arrival: u64,
    pub tags: AnyMap,
}
Expand description

Per-packet state passed by value through pipeline stages.

Passing by value (rather than &mut) makes ownership explicit: a stage that short-circuits simply does not return the context, so Rust’s ownership system prevents use-after-hand-off at compile time.

Fields§

§raw_bytes: Bytes

Wire-format bytes of the original packet.

§face_id: FaceId

Face the packet arrived on.

§name: Option<Arc<Name>>

Decoded name — hoisted to top level because every stage needs it. None until TlvDecodeStage runs.

§packet: DecodedPacket

Decoded packet — starts as Raw, transitions after TlvDecodeStage.

§pit_token: Option<PitToken>

PIT token — written by PitCheckStage, None before that stage runs.

§lp_pit_token: Option<Bytes>

NDNLPv2 PIT token (opaque, 1-32 bytes) from the incoming LP header. Distinct from the internal pit_token hash — this is the wire-protocol hop-by-hop token that must be echoed in Data/Nack responses.

§out_faces: SmallVec<[FaceId; 4]>

Faces selected for forwarding by the strategy stage.

§cs_hit: bool

Set to true by CsLookupStage on a cache hit.

§verified: bool

Set to true by the security validation stage.

§arrival: u64

Arrival time in nanoseconds since the Unix epoch (set by the face task).

§tags: AnyMap

Escape hatch for inter-stage communication not covered by explicit fields. Use sparingly; prefer explicit fields for anything the core pipeline touches.

Implementations§

Source§

impl PacketContext

Source

pub fn new(raw_bytes: Bytes, face_id: FaceId, arrival: u64) -> Self

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.

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.