ndn_transport/raw_packet.rs
1use crate::FaceId;
2use bytes::Bytes;
3
4/// A raw, undecoded packet as it enters the engine from a face task.
5///
6/// The timestamp is taken at `recv()` time — before the packet is enqueued on
7/// the pipeline channel — so Interest lifetime accounting starts from arrival,
8/// not from when the pipeline runner dequeues it.
9#[derive(Debug, Clone)]
10pub struct RawPacket {
11 /// Wire-format bytes.
12 pub bytes: Bytes,
13 /// Face the packet arrived on.
14 pub face_id: FaceId,
15 /// Arrival time as nanoseconds since the Unix epoch.
16 pub arrival: u64,
17}
18
19impl RawPacket {
20 pub fn new(bytes: Bytes, face_id: FaceId, arrival: u64) -> Self {
21 Self {
22 bytes,
23 face_id,
24 arrival,
25 }
26 }
27}