Struct sctp_proto::Association

source ·
pub struct Association { /* private fields */ }
Expand description

Association represents an SCTP association

Implementations§

source§

impl Association

source

pub fn poll(&mut self) -> Option<Event>

Returns application-facing event

Associations should be polled for events after:

  • a call was made to handle_event
  • a call was made to handle_timeout
source

pub fn poll_endpoint_event(&mut self) -> Option<EndpointEvent>

Return endpoint-facing event

source

pub fn poll_timeout(&mut self) -> Option<Instant>

Returns the next time at which handle_timeout should be called

The value returned may change after:

  • the application performed some I/O on the association
  • a call was made to handle_transmit
  • a call to poll_transmit returned Some
  • a call was made to handle_timeout
source

pub fn poll_transmit(&mut self, now: Instant) -> Option<Transmit>

Returns packets to transmit

Associations should be polled for transmit after:

  • the application performed some I/O on the Association
  • a call was made to handle_event
  • a call was made to handle_timeout
source

pub fn handle_timeout(&mut self, now: Instant)

Process timer expirations

Executes protocol logic, potentially preparing signals (including application Events, EndpointEvents and outgoing datagrams) that should be extracted through the relevant methods.

It is most efficient to call this immediately after the system clock reaches the latest Instant that was output by poll_timeout; however spurious extra calls will simply no-op and therefore are safe.

source

pub fn handle_event(&mut self, event: AssociationEvent)

Process AssociationEvents generated by the associated Endpoint

Will execute protocol logic upon receipt of an association event, in turn preparing signals (including application Events, EndpointEvents and outgoing datagrams) that should be extracted through the relevant methods.

source

pub fn stats(&self) -> AssociationStats

Returns Association statistics

source

pub fn is_handshaking(&self) -> bool

Whether the Association is in the process of being established

If this returns false, the Association may be either established or closed, signaled by the emission of a Connected or AssociationLost message respectively.

source

pub fn is_closed(&self) -> bool

Whether the Association is closed

Closed Associations cannot transport any further data. An association becomes closed when either peer application intentionally closes it, or when either transport layer detects an error such as a time-out or certificate validation failure.

A AssociationLost event is emitted with details when the association becomes closed.

source

pub fn is_drained(&self) -> bool

Whether there is no longer any need to keep the association around

Closed associations become drained after a brief timeout to absorb any remaining in-flight packets from the peer. All drained associations have been closed.

source

pub fn side(&self) -> Side

Look up whether we’re the client or server of this Association

source

pub fn remote_addr(&self) -> SocketAddr

The latest socket address for this Association’s peer

source

pub fn rtt(&self) -> Duration

Current best estimate of this Association’s latency (round-trip-time)

source

pub fn local_ip(&self) -> Option<IpAddr>

The local IP address which was used when the peer established the association

This can be different from the address the endpoint is bound to, in case the endpoint is bound to a wildcard address like 0.0.0.0 or ::.

This will return None for clients.

Retrieving the local IP address is currently supported on the following platforms:

  • Linux

On all non-supported platforms the local IP address will not be available, and the method will return None.

source

pub fn shutdown(&mut self) -> Result<(), Error>

Shutdown initiates the shutdown sequence. The method blocks until the shutdown sequence is completed and the association is closed, or until the passed context is done, in which case the context’s error is returned.

source

pub fn close(&mut self) -> Result<(), Error>

Close ends the SCTP Association and cleans up any state

source

pub fn open_stream( &mut self, stream_identifier: StreamId, default_payload_type: PayloadProtocolIdentifier, ) -> Result<Stream<'_>, Error>

open_stream opens a stream

source

pub fn accept_stream(&mut self) -> Option<Stream<'_>>

accept_stream accepts a stream

source

pub fn stream( &mut self, stream_identifier: StreamId, ) -> Result<Stream<'_>, Error>

stream returns a stream

Trait Implementations§

source§

impl Debug for Association

source§

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

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

impl Default for Association

source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

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, 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<V, T> VZip<V> for T
where V: MultiLane<T>,

source§

fn vzip(self) -> V