Struct s2n_quic_transport::path::Path

source ·
pub struct Path<Config: Config> {
    pub handle: Config::PathHandle,
    pub peer_connection_id: PeerId,
    pub local_connection_id: LocalId,
    pub rtt_estimator: RttEstimator,
    pub congestion_controller: <Config::CongestionControllerEndpoint as Endpoint>::CongestionController,
    pub pto_backoff: u32,
    pub mtu_controller: Controller,
    pub ecn_controller: Controller,
    /* private fields */
}

Fields§

§handle: Config::PathHandle

The peer’s socket address

§peer_connection_id: PeerId

The connection id of the peer

§local_connection_id: LocalId

The local connection id which the peer sends to

§rtt_estimator: RttEstimator

The path owns the roundtrip between peers

§congestion_controller: <Config::CongestionControllerEndpoint as Endpoint>::CongestionController

The congestion controller for the path

§pto_backoff: u32

Probe timeout backoff multiplier

§mtu_controller: Controller

Controller for determining the maximum transmission unit of the path

§ecn_controller: Controller

Controller for determining the ECN capability of the path

Implementations§

source§

impl<Config: Config> Path<Config>

A Path holds the local and peer socket addresses, connection ids, and state. It can be validated or pending validation.

source

pub fn new( handle: Config::PathHandle, peer_connection_id: PeerId, local_connection_id: LocalId, rtt_estimator: RttEstimator, congestion_controller: <Config::CongestionControllerEndpoint as Endpoint>::CongestionController, peer_validated: bool, mtu_config: Config ) -> Path<Config>

source

pub fn remote_address(&self) -> RemoteAddress

source

pub fn local_address(&self) -> LocalAddress

source

pub fn set_challenge(&mut self, challenge: Challenge)

source

pub fn abandon_challenge<Pub: ConnectionPublisher>( &mut self, publisher: &mut Pub, path_id: u64 )

source

pub fn is_active(&self) -> bool

source

pub fn on_bytes_transmitted(&mut self, bytes: usize)

Called when bytes have been transmitted on this path

source

pub fn on_bytes_received(&mut self, bytes: usize) -> AmplificationOutcome

Called when bytes have been received on this path Returns true if receiving these bytes unblocked the path from being amplification limited

source

pub fn on_timeout<Pub: ConnectionPublisher>( &mut self, timestamp: Timestamp, path_id: Id, random_generator: &mut dyn Generator, publisher: &mut Pub )

source

pub fn can_transmit(&self, timestamp: Timestamp) -> bool

Returns true if this path is able to transmit packets at the given timestamp

source

pub fn on_transmit<W: WriteContext>(&mut self, context: &mut W)

Only PATH_CHALLENGE and PATH_RESPONSE frames should be transmitted here.

source

pub fn failed_validation(&self) -> bool

Check if path validation was attempted and failed.

source

pub fn is_challenge_pending(&self) -> bool

source

pub fn is_response_pending(&self) -> bool

source

pub fn on_path_challenge(&mut self, response: &[u8; 8])

source

pub fn on_path_response(&mut self, response: &[u8]) -> bool

Validates the path if the PATH_RESPONSE data matches the PATH_CHALLENGE data and returns if the path was validated.

source

pub fn on_handshake_packet(&mut self)

Called when a handshake packet is received.

Receiving a handshake packet acts as path validation for the initial path

source

pub fn on_process_local_connection_id<Pub: ConnectionPublisher>( &mut self, path_id: Id, packet: &CleartextShort<'_>, local_connection_id: &LocalId, publisher: &mut Pub )

Checks if the peer has started using a different destination Connection Id.

The CleartextShort packet guarantees the packet has been validated (authenticated and de-duped).

source

pub fn is_validated(&self) -> bool

Returns whether this path has passed address validation

source

pub fn on_activated(&mut self)

The path received a non-path-validation-probing packet so mark it as activated.

source

pub fn is_activated(&self) -> bool

Returns if the path is currently or at some point been an active path.

source

pub fn on_peer_validated(&mut self)

Marks the path as peer validated

source

pub fn is_peer_validated(&self) -> bool

Returns whether this path has been validated by the peer

source

pub fn max_datagram_size(&self, transmission_mode: Mode) -> usize

source

pub fn clamp_datagram_size( &self, requested_size: usize, transmission_mode: Mode ) -> usize

Clamps payload sizes to the current max datagram size for the path

§Panics

Panics if this is called when the path is amplification limited

source

pub fn transmission_constraint(&self) -> Constraint

source

pub fn at_amplification_limit(&self) -> bool

Returns whether this path should be limited according to connection establishment amplification limits

Note: As long as the path has any TX credits we don’t consider it to be amplification-limited. This may result in sending slightly more than 3x bytes but networking infrastructure mostly cares about the number of packets rather than bytes.

source

pub fn pto_period(&self, space: PacketNumberSpace) -> Duration

Returns the current PTO period

source

pub fn reset_pto_backoff(&mut self)

Resets the PTO backoff to the initial value

source

pub fn max_mtu(&self) -> MaxMtu

source

pub fn is_congestion_limited(&self, bytes_sent: usize) -> bool

Returns true if the congestion window does not have sufficient space for a packet of the maximum datagram size considering the current bytes in flight and the additional bytes_sent provided

Trait Implementations§

source§

impl<Config: Config> Clone for Path<Config>

source§

fn clone(&self) -> Self

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl<Config: Debug + Config> Debug for Path<Config>

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl<Config: Config> Provider for Path<Config>

source§

fn transmission_interest<Q: Query>(&self, query: &mut Q) -> Result

Indicate if the path is interested in transmitting PATH_CHALLENGE or PATH_RESPONSE frames.

source§

fn get_transmission_interest(&self) -> Interest

source§

fn has_transmission_interest(&self) -> bool

source§

fn can_transmit(&self, constraint: Constraint) -> bool

source§

impl<Config: Config> Provider for Path<Config>

source§

fn timers<Q: Query>(&self, query: &mut Q) -> Result

Notifies the query of any timers owned by the provider Read more
source§

fn next_expiration(&self) -> Option<Timestamp>

Returns the next Timestamp at which the earliest timer is armed in the provider
source§

fn is_armed(&self) -> bool

Returns true if there are any timers armed
source§

fn armed_timer_count(&self) -> usize

Counts the number of armed timers in the provider
source§

fn for_each_timer<F>(&self, f: F)
where F: FnMut(&Timer) -> Result<(), QueryBreak>,

Iterates over each timer in the provider and calls the provided function

Auto Trait Implementations§

§

impl<Config> Freeze for Path<Config>

§

impl<Config> RefUnwindSafe for Path<Config>

§

impl<Config> Send for Path<Config>

§

impl<Config> Sync for Path<Config>

§

impl<Config> Unpin for Path<Config>

§

impl<Config> UnwindSafe for Path<Config>

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> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

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

§

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>,

§

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.
source§

impl<T, U> Upcast<T> for U
where T: UpcastFrom<U>,

source§

fn upcast(self) -> T

source§

impl<T, B> UpcastFrom<Counter<T, B>> for T

source§

fn upcast_from(value: Counter<T, B>) -> T