pub struct Stream { /* private fields */ }
Expand description
Stream represents an SCTP stream
Implementations§
Source§impl Stream
impl Stream
Sourcepub fn stream_identifier(&self) -> u16
pub fn stream_identifier(&self) -> u16
stream_identifier returns the Stream identifier associated to the stream.
Sourcepub fn set_default_payload_type(
&self,
default_payload_type: PayloadProtocolIdentifier,
)
pub fn set_default_payload_type( &self, default_payload_type: PayloadProtocolIdentifier, )
set_default_payload_type sets the default payload type used by write.
Sourcepub fn set_reliability_params(
&self,
unordered: bool,
rel_type: ReliabilityType,
rel_val: u32,
)
pub fn set_reliability_params( &self, unordered: bool, rel_type: ReliabilityType, rel_val: u32, )
set_reliability_params sets reliability parameters for this stream.
Sourcepub async fn read(&self, p: &mut [u8]) -> Result<usize, Error>
pub async fn read(&self, p: &mut [u8]) -> Result<usize, Error>
read reads a packet of len(p) bytes, dropping the Payload Protocol Identifier. Returns EOF when the stream is reset or an error if the stream is closed otherwise.
Sourcepub async fn read_sctp(
&self,
p: &mut [u8],
) -> Result<(usize, PayloadProtocolIdentifier), Error>
pub async fn read_sctp( &self, p: &mut [u8], ) -> Result<(usize, PayloadProtocolIdentifier), Error>
read_sctp reads a packet of len(p) bytes and returns the associated Payload Protocol Identifier. Returns EOF when the stream is reset or an error if the stream is closed otherwise.
Sourcepub async fn write(&self, p: &Bytes) -> Result<usize, Error>
pub async fn write(&self, p: &Bytes) -> Result<usize, Error>
write writes len(p) bytes from p with the default Payload Protocol Identifier
Sourcepub async fn write_sctp(
&self,
p: &Bytes,
ppi: PayloadProtocolIdentifier,
) -> Result<usize, Error>
pub async fn write_sctp( &self, p: &Bytes, ppi: PayloadProtocolIdentifier, ) -> Result<usize, Error>
write_sctp writes len(p) bytes from p to the DTLS connection
Sourcepub async fn close(&self) -> Result<(), Error>
pub async fn close(&self) -> Result<(), Error>
Close closes the write-direction of the stream. Future calls to write are not permitted after calling Close.
Sourcepub fn buffered_amount(&self) -> usize
pub fn buffered_amount(&self) -> usize
buffered_amount returns the number of bytes of data currently queued to be sent over this stream.
Sourcepub fn buffered_amount_low_threshold(&self) -> usize
pub fn buffered_amount_low_threshold(&self) -> usize
buffered_amount_low_threshold returns the number of bytes of buffered outgoing data that is considered “low.” Defaults to 0.
Sourcepub fn set_buffered_amount_low_threshold(&self, th: usize)
pub fn set_buffered_amount_low_threshold(&self, th: usize)
set_buffered_amount_low_threshold is used to update the threshold. See buffered_amount_low_threshold().
Sourcepub async fn on_buffered_amount_low(&self, f: OnBufferedAmountLowFn)
pub async fn on_buffered_amount_low(&self, f: OnBufferedAmountLowFn)
on_buffered_amount_low sets the callback handler which would be called when the number of bytes of outgoing data buffered is lower than the threshold.