⚠️ VeridianOS Kernel Documentation - This is low-level kernel code. All functions are unsafe unless explicitly marked otherwise. no_std

SackScoreboard

Struct SackScoreboard 

Source
pub struct SackScoreboard { /* private fields */ }
Expand description

Tracks selectively acknowledged ranges for a TCP connection.

Maintains a sorted, non-overlapping list of SACK blocks representing data the remote receiver has confirmed receiving out of order.

Implementations§

Source§

impl SackScoreboard

Source

pub fn new() -> Self

Create an empty scoreboard.

Source

pub fn block_count(&self) -> usize

Returns the number of tracked SACK blocks.

Source

pub fn blocks(&self) -> &[SackBlock]

Returns a slice of all current SACK blocks.

Source

pub fn is_sacked(&self, seq: u32) -> bool

Returns true if the given sequence number falls within a SACKed range.

Source

pub fn mark_sacked(&mut self, left: u32, right: u32)

Mark a range [left, right) as selectively acknowledged.

Merges with any overlapping or adjacent existing blocks to maintain the invariant that blocks are sorted and non-overlapping.

Source

pub fn clear_below(&mut self, ack: u32)

Remove all blocks (or portions) below the cumulative ACK.

Data below ack has been cumulatively acknowledged, so SACK blocks covering that range are no longer needed.

Source

pub fn highest_sacked(&self) -> Option<u32>

Returns the highest SACKed sequence number, or None if empty.

Source

pub fn next_retransmit(&self, snd_una: u32) -> Option<(u32, u32)>

Returns the next hole (gap) that needs retransmission.

Starting from snd_una (send unacknowledged), finds the first gap between SACK blocks. Returns (start_seq, length) of the hole.

Source

pub fn holes(&self, snd_una: u32) -> Vec<(u32, u32)>

Returns all holes (gaps) between snd_una and the highest SACKed byte.

Each hole is represented as (start_seq, length).

Trait Implementations§

Source§

impl Default for SackScoreboard

Available on crate feature alloc only.
Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

§

impl Freeze for SackScoreboard

§

impl RefUnwindSafe for SackScoreboard

§

impl Send for SackScoreboard

§

impl Sync for SackScoreboard

§

impl Unpin for SackScoreboard

§

impl UnwindSafe for SackScoreboard

Blanket Implementations§

§

impl<T> Any for T
where T: 'static + ?Sized,

§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
§

impl<T> Borrow<T> for T
where T: ?Sized,

§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
§

impl<T> BorrowMut<T> for T
where T: ?Sized,

§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<T> From<T> for T

§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T, U> Into<U> for T
where U: From<T>,

§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of [From]<T> for U chooses to do.

§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.