Struct sctp_proto::Association
source · pub struct Association { /* private fields */ }
Expand description
Association represents an SCTP association
Implementations§
source§impl Association
impl Association
sourcepub fn poll(&mut self) -> Option<Event>
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
sourcepub fn poll_endpoint_event(&mut self) -> Option<EndpointEvent>
pub fn poll_endpoint_event(&mut self) -> Option<EndpointEvent>
Return endpoint-facing event
sourcepub fn poll_timeout(&mut self) -> Option<Instant>
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
returnedSome
- a call was made to
handle_timeout
sourcepub fn poll_transmit(&mut self, now: Instant) -> Option<Transmit>
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
sourcepub fn handle_timeout(&mut self, now: Instant)
pub fn handle_timeout(&mut self, now: Instant)
Process timer expirations
Executes protocol logic, potentially preparing signals (including application Event
s,
EndpointEvent
s 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.
sourcepub fn handle_event(&mut self, event: AssociationEvent)
pub fn handle_event(&mut self, event: AssociationEvent)
Process AssociationEvent
s generated by the associated Endpoint
Will execute protocol logic upon receipt of an association event, in turn preparing signals
(including application Event
s, EndpointEvent
s and outgoing datagrams) that should be
extracted through the relevant methods.
sourcepub fn stats(&self) -> AssociationStats
pub fn stats(&self) -> AssociationStats
Returns Association statistics
sourcepub fn is_handshaking(&self) -> bool
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.
sourcepub fn is_closed(&self) -> bool
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.
sourcepub fn is_drained(&self) -> bool
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.
sourcepub fn remote_addr(&self) -> SocketAddr
pub fn remote_addr(&self) -> SocketAddr
The latest socket address for this Association’s peer
sourcepub fn rtt(&self) -> Duration
pub fn rtt(&self) -> Duration
Current best estimate of this Association’s latency (round-trip-time)
sourcepub fn local_ip(&self) -> Option<IpAddr>
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
.
sourcepub fn shutdown(&mut self) -> Result<(), Error>
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.
sourcepub fn close(&mut self) -> Result<(), Error>
pub fn close(&mut self) -> Result<(), Error>
Close ends the SCTP Association and cleans up any state
sourcepub fn open_stream(
&mut self,
stream_identifier: StreamId,
default_payload_type: PayloadProtocolIdentifier
) -> Result<Stream<'_>, Error>
pub fn open_stream( &mut self, stream_identifier: StreamId, default_payload_type: PayloadProtocolIdentifier ) -> Result<Stream<'_>, Error>
open_stream opens a stream
sourcepub fn accept_stream(&mut self) -> Option<Stream<'_>>
pub fn accept_stream(&mut self) -> Option<Stream<'_>>
accept_stream accepts a stream