ndn_transport/forwarding.rs
1//! Forwarding action types returned by strategies.
2//!
3//! Lives in `ndn-transport` so that `ndn-strategy` can use these types without
4//! depending on `ndn-engine`, which would create a circular dependency.
5
6use smallvec::SmallVec;
7
8use crate::FaceId;
9
10/// Reason for a Nack.
11#[derive(Clone, Copy, Debug, PartialEq, Eq)]
12pub enum NackReason {
13 NoRoute,
14 Duplicate,
15 Congestion,
16 NotYet,
17}
18
19/// The forwarding decision returned by a `Strategy`.
20pub enum ForwardingAction {
21 /// Forward to these faces immediately.
22 Forward(SmallVec<[FaceId; 4]>),
23 /// Forward to these faces after `delay`.
24 ForwardAfter {
25 faces: SmallVec<[FaceId; 4]>,
26 delay: std::time::Duration,
27 },
28 /// Send a Nack.
29 Nack(NackReason),
30 /// Suppress — do not forward (loop or policy decision).
31 Suppress,
32}