Skip to main content

ReplayDetector

Trait ReplayDetector 

Source
pub trait ReplayDetector: Send + Sync {
    // Required methods
    fn check(&mut self, seq: u64) -> bool;
    fn accept(&mut self);
}
Expand description

Tracks which sequence numbers have already been seen, so replayed packets can be dropped.

Both DTLS and SRTP require this: an attacker who captures a packet must not be able to have it accepted a second time.

Required Methods§

Source

fn check(&mut self, seq: u64) -> bool

Returns true if seq has not been seen before and is inside the window.

This only tests; call Self::accept afterwards to record the packet as received.

Source

fn accept(&mut self)

Commits the sequence number from the preceding Self::check call as received.

Split from check so a caller can validate a packet’s authenticity first and only then record it — a forged packet must not advance the window.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§