s2n_quic_core/transmission/
mode.rs

1// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2// SPDX-License-Identifier: Apache-2.0
3
4#[cfg(any(test, feature = "generator"))]
5use bolero_generator::prelude::*;
6
7#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)]
8#[cfg_attr(any(test, feature = "generator"), derive(TypeGenerator))]
9pub enum Mode {
10    /// Loss recovery probing to detect lost packets
11    LossRecoveryProbing,
12    /// Maximum transmission unit probing to determine the path MTU
13    MtuProbing,
14    /// Path validation to verify peer address reachability
15    PathValidationOnly,
16    /// Normal transmission
17    Normal,
18}
19
20impl Mode {
21    /// Is the transmission a probe for loss recovery
22    pub fn is_loss_recovery_probing(&self) -> bool {
23        matches!(self, Mode::LossRecoveryProbing)
24    }
25
26    /// Is the transmission a probe for path maximum transmission unit discovery
27    pub fn is_mtu_probing(&self) -> bool {
28        matches!(self, Mode::MtuProbing)
29    }
30
31    /// Is the transmission a probe for path validation
32    pub fn is_path_validation(&self) -> bool {
33        matches!(self, Mode::PathValidationOnly)
34    }
35
36    /// Is this transmission not a probe
37    pub fn is_normal(&self) -> bool {
38        matches!(self, Mode::Normal)
39    }
40}