Handle

Trait Handle 

Source
pub trait Handle:
    'static
    + Copy
    + Send
    + Debug {
    // Required methods
    fn from_remote_address(remote_addr: RemoteAddress) -> Self;
    fn remote_address(&self) -> RemoteAddress;
    fn set_remote_address(&mut self, addr: RemoteAddress);
    fn local_address(&self) -> LocalAddress;
    fn set_local_address(&mut self, addr: LocalAddress);
    fn unmapped_eq(&self, other: &Self) -> bool;
    fn strict_eq(&self, other: &Self) -> bool;
    fn maybe_update(&mut self, other: &Self);
}
Expand description

An interface for an object that represents a unique path between two endpoints

Required Methods§

Source

fn from_remote_address(remote_addr: RemoteAddress) -> Self

Creates a Handle from a RemoteAddress

Source

fn remote_address(&self) -> RemoteAddress

Returns the remote address for the given handle

Source

fn set_remote_address(&mut self, addr: RemoteAddress)

Updates the remote address to the given value

Source

fn local_address(&self) -> LocalAddress

Returns the local address for the given handle

Source

fn set_local_address(&mut self, addr: LocalAddress)

Updates the local address to the given value

Source

fn unmapped_eq(&self, other: &Self) -> bool

Returns true if the two handles are equal from a network perspective

This function is used to determine if a connection has migrated to another path.

Source

fn strict_eq(&self, other: &Self) -> bool

Returns true if the two handles are strictly equal to each other, i.e. byte-for-byte.

Source

fn maybe_update(&mut self, other: &Self)

Depending on the current value of self, fields from other may be copied to increase the fidelity of the value.

This is especially useful for clients that initiate a connection only based on the remote IP and port. They likely wouldn’t know the IP address of the local socket. Once a response is received from the server, the IP information will be known at this point and the handle can be updated with the new information.

Implementations should try to limit the cost of updating by checking the current value to see if it needs updating.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

Source§

impl Handle for s2n_quic_core::xdp::path::Tuple

Source§

impl Handle for RemoteAddress

Source§

impl Handle for s2n_quic_core::path::Tuple