Skip to main content

FopMachine

Struct FopMachine 

Source
pub struct FopMachine<const WIN: usize, const BUF: usize> { /* private fields */ }
Expand description

FOP-1 state machine.

Implements the sender side of COP-1 go-back-N ARQ. Completely synchronous — no I/O, no async.

§Type Parameters

  • WIN — Maximum sent queue depth (sliding window).
  • BUF — Total FDU buffer size in bytes.

Implementations§

Source§

impl<const WIN: usize, const BUF: usize> FopMachine<WIN, BUF>

Source

pub fn new(config: FopConfig) -> Self

Create a new FOP-1 state machine in the Initial (S6) state.

Source

pub fn state(&self) -> FopState

Current FOP-1 state.

Source

pub fn vs(&self) -> u8

Current V(S).

Source

pub fn get_fdu(&self, seq: u8) -> Option<&[u8]>

Get FDU payload for a given sequence number.

Source

pub fn get_bd_fdu(&self) -> Option<&[u8]>

Get the pending BD FDU payload (if any).

Source

pub fn sent_count(&self) -> usize

Number of frames in the sent queue.

Source

pub fn handle(&mut self, event: FopEvent<'_>, actions: &mut FopActions)

Process an event and emit actions.

Auto Trait Implementations§

§

impl<const WIN: usize, const BUF: usize> Freeze for FopMachine<WIN, BUF>

§

impl<const WIN: usize, const BUF: usize> RefUnwindSafe for FopMachine<WIN, BUF>

§

impl<const WIN: usize, const BUF: usize> Send for FopMachine<WIN, BUF>

§

impl<const WIN: usize, const BUF: usize> Sync for FopMachine<WIN, BUF>

§

impl<const WIN: usize, const BUF: usize> Unpin for FopMachine<WIN, BUF>

§

impl<const WIN: usize, const BUF: usize> UnsafeUnpin for FopMachine<WIN, BUF>

§

impl<const WIN: usize, const BUF: usize> UnwindSafe for FopMachine<WIN, BUF>

Blanket Implementations§

Source§

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

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

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

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

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

Source§

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

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

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

Source§

fn into(self) -> U

Calls U::from(self).

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

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

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

Source§

type Error = Infallible

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

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

Performs the conversion.
Source§

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

Source§

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

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

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

Performs the conversion.