[][src]Struct packet_loss_classification::ZigZag

pub struct ZigZag { /* fields omitted */ }

Packet loss classifier based on the ZigZag scheme.

In wireless networks wireless errors are the most common errors. Congestion errors usually come with a higher delay. Intuitively classification can be done with a threshold. The ZigZag scheme uses thresholds that depend on the number of packets that have been lost consecutively.

The more packets lost in a row the higher the threshold for classifying congestion errors. This is because a higher number of lost packets comes with a higher expectation for the ROTT.

The thresholds depend on the standard deviation and the mean value of the ROTT which are calculated on the fly using an exponential average with the exponential decaying factor 1.0 - alpha.

use packet_loss_classification::{ZigZag, PacketLoss};

let mut zigzag = ZigZag::default();
assert_eq!(zigzag.classify(10.0, 1), PacketLoss::Congestion);
assert_eq!(zigzag.classify(10.0, 1), PacketLoss::Congestion);
assert_eq!(zigzag.classify(0.3, 4), PacketLoss::Wireless);

Methods

impl ZigZag[src]

pub fn new(alpha: f64) -> Self[src]

Creates a new packet loss classifier based on the ZigZag scheme.

Arguments

  • 1.0 - alpha: exponential decaying factor that weights the impact of the current rott.

Panics

Panics if alpha is not in [0.0, 1.0].

pub fn classify(&mut self, rott: f64, num_lost_packets: u32) -> PacketLoss[src]

Classifies the reason of packet loss based on the ROTT of the current packet.

This function is called with the ROTT (relative one-way trip time) of the current packet if previous packets were lost

Arguments

  • rott: relative one-way trip time of the current packet.
  • num_lost_packets: the number of packets that have been lost.

Trait Implementations

impl Debug for ZigZag[src]

impl Default for ZigZag[src]

Auto Trait Implementations

impl RefUnwindSafe for ZigZag

impl Send for ZigZag

impl Sync for ZigZag

impl Unpin for ZigZag

impl UnwindSafe for ZigZag

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.