Struct s2n_quic_transport::path::Manager
source · pub struct Manager<Config: Config> { /* private fields */ }
Expand description
The PathManager handles paths for a specific connection. It will handle path validation operations, and track the active path for a connection.
Implementations§
source§impl<Config: Config> Manager<Config>
impl<Config: Config> Manager<Config>
pub fn new(initial_path: Path<Config>, peer_id_registry: PeerIdRegistry) -> Self
sourcepub fn active_path(&self) -> &Path<Config>
pub fn active_path(&self) -> &Path<Config>
Return the active path
sourcepub fn active_path_mut(&mut self) -> &mut Path<Config>
pub fn active_path_mut(&mut self) -> &mut Path<Config>
Return a mutable reference to the active path
sourcepub fn active_path_id(&self) -> Id
pub fn active_path_id(&self) -> Id
Return the Id of the active path
pub fn check_active_path_is_synced(&self)
sourcepub fn path(&self, handle: &Config::PathHandle) -> Option<(Id, &Path<Config>)>
pub fn path(&self, handle: &Config::PathHandle) -> Option<(Id, &Path<Config>)>
Returns the Path for the provided address if the PathManager knows about it
sourcepub fn path_mut(
&mut self,
handle: &Config::PathHandle
) -> Option<(Id, &mut Path<Config>)>
pub fn path_mut( &mut self, handle: &Config::PathHandle ) -> Option<(Id, &mut Path<Config>)>
Returns the Path for the provided address if the PathManager knows about it
sourcepub fn paths_pending_validation(&mut self) -> PathsPendingValidation<'_, Config>
pub fn paths_pending_validation(&mut self) -> PathsPendingValidation<'_, Config>
Returns an iterator over all paths pending path_challenge or path_response transmission.
sourcepub fn on_datagram_received<Pub: ConnectionPublisher>(
&mut self,
path_handle: &Config::PathHandle,
datagram: &DatagramInfo,
handshake_confirmed: bool,
congestion_controller_endpoint: &mut Config::CongestionControllerEndpoint,
migration_validator: &mut Config::PathMigrationValidator,
mtu_config: Config,
limits: &Limits,
publisher: &mut Pub
) -> Result<(Id, AmplificationOutcome), DatagramDropReason>
pub fn on_datagram_received<Pub: ConnectionPublisher>( &mut self, path_handle: &Config::PathHandle, datagram: &DatagramInfo, handshake_confirmed: bool, congestion_controller_endpoint: &mut Config::CongestionControllerEndpoint, migration_validator: &mut Config::PathMigrationValidator, mtu_config: Config, limits: &Limits, publisher: &mut Pub ) -> Result<(Id, AmplificationOutcome), DatagramDropReason>
Called when a datagram is received on a connection
Upon success, returns a (Id, AmplificationOutcome)
containing the path ID and an
AmplificationOutcome
value that indicates if the path had been amplification limited
prior to receiving the datagram and is now no longer amplification limited.
This function is called prior to packet authentication. If possible add business
logic to Self::on_processed_packet
, which is called after the packet has been
authenticated.
sourcepub fn valid_initial_received(&self) -> bool
pub fn valid_initial_received(&self) -> bool
Returns true if a valid initial packet has been received
sourcepub fn on_transmit<W: WriteContext>(&mut self, context: &mut W)
pub fn on_transmit<W: WriteContext>(&mut self, context: &mut W)
Writes any frames the path manager wishes to transmit to the given context
sourcepub fn on_packet_ack<A: Set>(&mut self, ack_set: &A)
pub fn on_packet_ack<A: Set>(&mut self, ack_set: &A)
Called when packets are acknowledged
sourcepub fn on_packet_loss<A: Set>(&mut self, ack_set: &A)
pub fn on_packet_loss<A: Set>(&mut self, ack_set: &A)
Called when packets are lost
pub fn on_path_challenge(&mut self, path_id: Id, challenge: &PathChallenge<'_>)
pub fn on_path_response<Pub: ConnectionPublisher>( &mut self, response: &PathResponse<'_>, publisher: &mut Pub ) -> AmplificationOutcome
sourcepub fn on_processed_packet<Pub: ConnectionPublisher>(
&mut self,
path_id: Id,
source_connection_id: Option<PeerId>,
path_validation_probing: Probe,
random_generator: &mut dyn Generator,
publisher: &mut Pub
) -> Result<AmplificationOutcome, Error>
pub fn on_processed_packet<Pub: ConnectionPublisher>( &mut self, path_id: Id, source_connection_id: Option<PeerId>, path_validation_probing: Probe, random_generator: &mut dyn Generator, publisher: &mut Pub ) -> Result<AmplificationOutcome, Error>
Process a packet and update internal state.
Check if the packet is a non-probing (path validation) packet and attempt to update the active path for the connection.
Returns Ok(true)
if the packet caused the active path to change from a path
blocked by amplification limits to a path not blocked by amplification limits.
pub fn on_connection_id_retire(&self, _connection_id: &LocalId)
sourcepub fn on_new_connection_id<Pub: ConnectionPublisher>(
&mut self,
connection_id: &PeerId,
sequence_number: u32,
retire_prior_to: u32,
stateless_reset_token: &Token,
publisher: &mut Pub
) -> Result<(), Error>
pub fn on_new_connection_id<Pub: ConnectionPublisher>( &mut self, connection_id: &PeerId, sequence_number: u32, retire_prior_to: u32, stateless_reset_token: &Token, publisher: &mut Pub ) -> Result<(), Error>
Called when a NEW_CONNECTION_ID frame is received from the peer
sourcepub fn on_timeout<Pub: ConnectionPublisher>(
&mut self,
timestamp: Timestamp,
random_generator: &mut dyn Generator,
publisher: &mut Pub
) -> Result<AmplificationOutcome, Error>
pub fn on_timeout<Pub: ConnectionPublisher>( &mut self, timestamp: Timestamp, random_generator: &mut dyn Generator, publisher: &mut Pub ) -> Result<AmplificationOutcome, Error>
Called when the connection timer expired
Returns Ok(true)
if the timeout caused the active path to change from a path
blocked by amplification limits to a path not blocked by amplification limits.
This can occur if the active path was amplification limited and failed path validation.
sourcepub fn is_amplification_limited(&self) -> bool
pub fn is_amplification_limited(&self) -> bool
true if ALL paths are amplification_limited
sourcepub fn can_transmit(&self, interest: Interest) -> bool
pub fn can_transmit(&self, interest: Interest) -> bool
true if ANY of the paths can transmit
pub fn transmission_constraint(&self) -> Constraint
Trait Implementations§
source§impl<Config: Config> Provider for Manager<Config>
impl<Config: Config> Provider for Manager<Config>
fn transmission_interest<Q: Query>(&self, query: &mut Q) -> Result
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 Manager<Config>
impl<Config: Config> Provider for Manager<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