pub struct Listener { /* private fields */ }
Expand description
A structure representing a socket that is listening for incoming SCTP Connections.
This structure is created by an Socket
when it is bound to local address(es)
and is waiting for incoming connections by calling the listen
on the socket. The original
Socket
is consumed when this structure is created. See
Socket::listen
for more details.
Implementations§
Source§impl Listener
impl Listener
Sourcepub async fn accept(&self) -> Result<(ConnectedSocket, SocketAddr)>
pub async fn accept(&self) -> Result<(ConnectedSocket, SocketAddr)>
Accept on a given socket (valid only for OneToOne
type sockets).
Sourcepub fn sctp_bindx(&self, addrs: &[SocketAddr], flags: BindxFlags) -> Result<()>
pub fn sctp_bindx(&self, addrs: &[SocketAddr], flags: BindxFlags) -> Result<()>
Binds to one or more local addresses. See: Section 9.1 RFC 6458
It is possible to call sctp_bindx
on an already ‘bound’ (that is ’listen’ing socket.)
Sourcepub fn sctp_peeloff(&self, assoc_id: AssociationId) -> Result<ConnectedSocket>
pub fn sctp_peeloff(&self, assoc_id: AssociationId) -> Result<ConnectedSocket>
Peels off a connected SCTP association from the listening socket. See: Section 9.2 RFC 6458
This call is successful only for UDP style one to many sockets. This is like
[Listener::accept
] where peeled off socket behaves like a stand alone
one-to-one socket.
Sourcepub fn sctp_getpaddrs(&self, assoc_id: AssociationId) -> Result<Vec<SocketAddr>>
pub fn sctp_getpaddrs(&self, assoc_id: AssociationId) -> Result<Vec<SocketAddr>>
Get Peer Address(es) for the given Association ID. See: Section 9.3 RFC 6458
This function is supported on the Listener
because in the case of One to Many
associations that are not peeled off, we are performing IO operations on the listening
socket itself.
Sourcepub fn sctp_getladdrs(&self, assoc_id: AssociationId) -> Result<Vec<SocketAddr>>
pub fn sctp_getladdrs(&self, assoc_id: AssociationId) -> Result<Vec<SocketAddr>>
Get’s the Local Addresses for the association. See: Section 9.4 RFC 6458
Sourcepub async fn sctp_recv(&self) -> Result<NotificationOrData>
pub async fn sctp_recv(&self) -> Result<NotificationOrData>
Receive Data or Notification from the listening socket.
In the case of One-to-many sockets, it is possible to receive on the listening socket, without explicitly ’accept’ing or ‘peeling off’ the socket. The internal API used to receive the data is also the API used to receive notifications. This function returns either the notification (which the user should have subscribed for) or the data.
Sourcepub async fn sctp_send(&self, to: SocketAddr, data: SendData) -> Result<()>
pub async fn sctp_send(&self, to: SocketAddr, data: SendData) -> Result<()>
Send Data and Anciliary data if any on the SCTP Socket.
SCTP supports sending the actual SCTP message together with sending any anciliary data on the SCTP association. The anciliary data is optional.
Sourcepub fn sctp_subscribe_event(
&self,
event: Event,
assoc_id: SubscribeEventAssocId,
) -> Result<()>
👎Deprecated since 0.2.2: use sctp_subscribe_events instead.
pub fn sctp_subscribe_event( &self, event: Event, assoc_id: SubscribeEventAssocId, ) -> Result<()>
Subscribe to a given SCTP Event on the given socket. See section 6.2.1 of RFC6458.
SCTP allows receiving notifications about the changes to SCTP associations etc from the user space. For these notification events to be received, this API is used to subsribe for the events while receiving the data on the SCTP Socket.
Sourcepub fn sctp_unsubscribe_event(
&self,
event: Event,
assoc_id: SubscribeEventAssocId,
) -> Result<()>
👎Deprecated since 0.2.2: use sctp_unsubscribe_events instead.
pub fn sctp_unsubscribe_event( &self, event: Event, assoc_id: SubscribeEventAssocId, ) -> Result<()>
Unsubscribe from a given SCTP Event on the given socket. See section 6.2.1 of RFC6458.
See sctp_subscribe_event
for further details.
Sourcepub fn sctp_subscribe_events(
&self,
events: &[Event],
assoc_id: SubscribeEventAssocId,
) -> Result<()>
pub fn sctp_subscribe_events( &self, events: &[Event], assoc_id: SubscribeEventAssocId, ) -> Result<()>
Subscribe to SCTP Events. See section 6.2.1 of RFC6458.
SCTP allows receiving notifications about the changes to SCTP associations etc from the user space. For these notification events to be received, this API is used to subsribe for the events while receiving the data on the SCTP Socket.
Sourcepub fn sctp_unsubscribe_events(
&self,
events: &[Event],
assoc_id: SubscribeEventAssocId,
) -> Result<()>
pub fn sctp_unsubscribe_events( &self, events: &[Event], assoc_id: SubscribeEventAssocId, ) -> Result<()>
Unsubscribe from a given SCTP Event on the given socket. See section 6.2.1 of RFC6458.
See sctp_subscribe_events
for further details.
Sourcepub fn sctp_setup_init_params(
&self,
ostreams: u16,
istreams: u16,
retries: u16,
timeout: u16,
) -> Result<()>
pub fn sctp_setup_init_params( &self, ostreams: u16, istreams: u16, retries: u16, timeout: u16, ) -> Result<()>
Setup parameters for a new association.
To specify custom parameters for a new association this API is used.
Sourcepub fn sctp_request_rcvinfo(&self, on: bool) -> Result<()>
pub fn sctp_request_rcvinfo(&self, on: bool) -> Result<()>
Request to receive RcvInfo
ancillary data.
SCTP allows receiving ancillary data about the curent data received on the given socket. This API is used to obtain receive side additional info when the data is to be received.
Sourcepub fn sctp_request_nxtinfo(&self, on: bool) -> Result<()>
pub fn sctp_request_nxtinfo(&self, on: bool) -> Result<()>
Request to receive NxtInfo
ancillary data.
SCTP allows receiving ancillary data about the curent data received on the given socket. This API is used to obtain information about the next datagram that will be received.
Sourcepub fn sctp_get_status(&self, assoc_id: AssociationId) -> Result<ConnStatus>
pub fn sctp_get_status(&self, assoc_id: AssociationId) -> Result<ConnStatus>
Get the status of the connection associated with the association ID.