Struct ReplayWindow
pub struct ReplayWindow {
pub last_accepted: u32,
pub last_accepted_time_ms: u64,
pub backward_bitmap: u8,
pub recent_mics: Deque<RecentMic, umsh_crypto::::replay::ReplayWindow::{constant#0}>,
pub last_dup_ack_counter: u32,
pub last_dup_ack_ms: u64,
}Expand description
Replay-detection window for secure traffic from one sender.
Fields§
§last_accepted: u32Highest accepted frame counter.
last_accepted_time_ms: u64Timestamp of the highest accepted frame.
backward_bitmap: u8Occupancy bitmap for the backward counter window.
recent_mics: Deque<RecentMic, umsh_crypto::::replay::ReplayWindow::{constant#0}>Accepted MICs retained for duplicate late-arrival checks.
last_dup_ack_counter: u32Counter of the last duplicate re-acknowledged, paired with
last_dup_ack_ms.
One pair for the whole window, not a stamp per retained MIC: duplicate re-acks pace one packet’s copies, and windows are replicated widely enough (per channel, per tracked sender) that per-entry state is real RAM on the embedded targets — spent, for channel traffic, on packets that are never acknowledged at all.
last_dup_ack_ms: u64When the duplicate carrying
last_dup_ack_counter was last
re-acknowledged, in milliseconds.
Implementations§
§impl ReplayWindow
impl ReplayWindow
pub fn new() -> ReplayWindow
pub fn new() -> ReplayWindow
Create a fresh replay window.
pub fn check(&self, counter: u32, mic: &[u8], now_ms: u64) -> ReplayVerdict
pub fn check(&self, counter: u32, mic: &[u8], now_ms: u64) -> ReplayVerdict
Evaluate whether counter and mic are acceptable at now_ms.
pub fn note_acknowledgeable_duplicate(
&mut self,
counter: u32,
mic: &[u8],
now_ms: u64,
holdoff_ms: u64,
) -> bool
pub fn note_acknowledgeable_duplicate( &mut self, counter: u32, mic: &[u8], now_ms: u64, holdoff_ms: u64, ) -> bool
Return whether this is an exact, recently accepted packet eligible for an idempotent duplicate acknowledgement, and record the acknowledgement when it is.
This deliberately requires both the bounded counter distance and a matching retained MIC. Merely reusing an occupied counter does not prove that the receiver previously accepted this logical packet.
A duplicate is re-acknowledged at most once per holdoff_ms. The
duplicate-acknowledgement window exists so a sender whose ack was
lost can recover by retransmitting — but most duplicates are not
retransmissions, they are flood copies of a single transmission
arriving over different paths, and each already-sent ack covers
all of them. A sender cannot retransmit before its confirmation
window lapses, so a duplicate arriving inside that window proves
nothing was lost yet and earns no fresh ack. Callers pass their
forwarding-confirmation window (or the closest equivalent their
radio timing offers) as holdoff_ms.
Two clocks pace this. Copies of the accepted transmission are
caught by the entry’s acceptance time — the acceptance already
queued their ack. Copies of a retransmission are caught by the
re-ack stamp the first copy leaves behind. A true return
stamps: the caller is expected to queue the acknowledgement it
just asked about.
Trait Implementations§
§impl Clone for ReplayWindow
impl Clone for ReplayWindow
§fn clone(&self) -> ReplayWindow
fn clone(&self) -> ReplayWindow
1.0.0§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more§impl Debug for ReplayWindow
impl Debug for ReplayWindow
§impl Default for ReplayWindow
impl Default for ReplayWindow
§fn default() -> ReplayWindow
fn default() -> ReplayWindow
Auto Trait Implementations§
impl Freeze for ReplayWindow
impl RefUnwindSafe for ReplayWindow
impl Send for ReplayWindow
impl Sync for ReplayWindow
impl Unpin for ReplayWindow
impl UnwindSafe for ReplayWindow
Blanket Implementations§
§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§unsafe fn clone_to_uninit(&self, dest: *mut u8)
unsafe fn clone_to_uninit(&self, dest: *mut u8)
clone_to_uninit)