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: BytesWire-format bytes of the original packet.
face_id: FaceIdFace the packet arrived on.
name: Option<Arc<Name>>Decoded name — hoisted to top level because every stage needs it.
None until TlvDecodeStage runs.
packet: DecodedPacketDecoded 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: boolSet to true by CsLookupStage on a cache hit.
verified: boolSet to true by the security validation stage.
arrival: u64Arrival time in nanoseconds since the Unix epoch (set by the face task).
Escape hatch for inter-stage communication not covered by explicit fields. Use sparingly; prefer explicit fields for anything the core pipeline touches.