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>
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.
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>
pub fn remote_address(&self) -> RemoteAddress
pub fn local_address(&self) -> LocalAddress
pub fn set_challenge(&mut self, challenge: Challenge)
pub fn abandon_challenge<Pub: ConnectionPublisher>( &mut self, publisher: &mut Pub, path_id: u64 )
pub fn is_active(&self) -> bool
sourcepub fn on_bytes_transmitted(&mut self, bytes: usize)
pub fn on_bytes_transmitted(&mut self, bytes: usize)
Called when bytes have been transmitted on this path
sourcepub fn on_bytes_received(&mut self, bytes: usize) -> AmplificationOutcome
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
pub fn on_timeout<Pub: ConnectionPublisher>( &mut self, timestamp: Timestamp, path_id: Id, random_generator: &mut dyn Generator, publisher: &mut Pub )
sourcepub fn can_transmit(&self, timestamp: Timestamp) -> bool
pub fn can_transmit(&self, timestamp: Timestamp) -> bool
Returns true if this path is able to transmit packets at the given timestamp
sourcepub fn on_transmit<W: WriteContext>(&mut self, context: &mut W)
pub fn on_transmit<W: WriteContext>(&mut self, context: &mut W)
Only PATH_CHALLENGE and PATH_RESPONSE frames should be transmitted here.
sourcepub fn failed_validation(&self) -> bool
pub fn failed_validation(&self) -> bool
Check if path validation was attempted and failed.
pub fn is_challenge_pending(&self) -> bool
pub fn is_response_pending(&self) -> bool
pub fn on_path_challenge(&mut self, response: &[u8; 8])
sourcepub fn on_path_response(&mut self, response: &[u8]) -> bool
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.
sourcepub fn on_handshake_packet(&mut self)
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
sourcepub fn on_process_local_connection_id<Pub: ConnectionPublisher>(
&mut self,
path_id: Id,
packet: &CleartextShort<'_>,
local_connection_id: &LocalId,
publisher: &mut Pub
)
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).
sourcepub fn is_validated(&self) -> bool
pub fn is_validated(&self) -> bool
Returns whether this path has passed address validation
sourcepub fn on_activated(&mut self)
pub fn on_activated(&mut self)
The path received a non-path-validation-probing packet so mark it as activated.
sourcepub fn is_activated(&self) -> bool
pub fn is_activated(&self) -> bool
Returns if the path is currently or at some point been an active path.
sourcepub fn on_peer_validated(&mut self)
pub fn on_peer_validated(&mut self)
Marks the path as peer validated
sourcepub fn is_peer_validated(&self) -> bool
pub fn is_peer_validated(&self) -> bool
Returns whether this path has been validated by the peer
pub fn max_datagram_size(&self, transmission_mode: Mode) -> usize
sourcepub fn clamp_datagram_size(
&self,
requested_size: usize,
transmission_mode: Mode
) -> usize
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
pub fn transmission_constraint(&self) -> Constraint
sourcepub fn at_amplification_limit(&self) -> bool
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.
sourcepub fn pto_period(&self, space: PacketNumberSpace) -> Duration
pub fn pto_period(&self, space: PacketNumberSpace) -> Duration
Returns the current PTO period
sourcepub fn reset_pto_backoff(&mut self)
pub fn reset_pto_backoff(&mut self)
Resets the PTO backoff to the initial value
pub fn max_mtu(&self) -> MaxMtu
sourcepub fn is_congestion_limited(&self, bytes_sent: usize) -> bool
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> Provider for Path<Config>
impl<Config: Config> Provider for Path<Config>
source§fn transmission_interest<Q: Query>(&self, query: &mut Q) -> Result
fn transmission_interest<Q: Query>(&self, query: &mut Q) -> Result
Indicate if the path is interested in transmitting PATH_CHALLENGE or PATH_RESPONSE frames.
fn get_transmission_interest(&self) -> Interest
fn has_transmission_interest(&self) -> bool
fn can_transmit(&self, constraint: Constraint) -> bool
source§impl<Config: Config> Provider for Path<Config>
impl<Config: Config> Provider for Path<Config>
source§fn timers<Q: Query>(&self, query: &mut Q) -> Result
fn timers<Q: Query>(&self, query: &mut Q) -> Result
source§fn next_expiration(&self) -> Option<Timestamp>
fn next_expiration(&self) -> Option<Timestamp>
Timestamp
at which the earliest timer is armed in the provider