Struct sctp_proto::Stream
source · pub struct Stream<'a> { /* private fields */ }
Expand description
Stream represents an SCTP stream
Implementations§
source§impl<'a> Stream<'a>
impl<'a> Stream<'a>
sourcepub fn read(&mut self) -> Result<Option<Chunks>, Error>
pub fn read(&mut self) -> Result<Option<Chunks>, 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 fn read_sctp(&mut self) -> Result<Option<Chunks>, Error>
pub fn read_sctp(&mut self) -> Result<Option<Chunks>, 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 fn write_sctp(
&mut self,
p: &Bytes,
ppi: PayloadProtocolIdentifier
) -> Result<usize, Error>
pub fn write_sctp( &mut self, p: &Bytes, ppi: PayloadProtocolIdentifier ) -> Result<usize, Error>
write_sctp writes len(p) bytes from p to the DTLS connection
sourcepub fn write(&mut self, data: &[u8]) -> Result<usize, Error>
pub fn write(&mut self, data: &[u8]) -> Result<usize, Error>
Send data on the given stream.
Uses the deafult payload protocol (PPI).
Returns the number of bytes successfully written.
sourcepub fn write_with_ppi(
&mut self,
data: &[u8],
ppi: PayloadProtocolIdentifier
) -> Result<usize, Error>
pub fn write_with_ppi( &mut self, data: &[u8], ppi: PayloadProtocolIdentifier ) -> Result<usize, Error>
Send data on the given stream, with a specific payload protocol.
Returns the number of bytes successfully written.
sourcepub fn write_chunk(&mut self, p: &Bytes) -> Result<usize, Error>
pub fn write_chunk(&mut self, p: &Bytes) -> Result<usize, Error>
write writes len(p) bytes from p with the default Payload Protocol Identifier
sourcepub fn write_chunks(&mut self, data: &mut [Bytes]) -> Result<usize, Error>
pub fn write_chunks(&mut self, data: &mut [Bytes]) -> Result<usize, Error>
Send data on the given stream
Returns the number of bytes and chunks successfully written. Note that this method might also write a partial chunk. In this case it will not count this chunk as fully written. However the chunk will be advanced and contain only non-written data after the call.
pub fn is_readable(&self) -> bool
pub fn is_writable(&self) -> bool
sourcepub fn stop(&mut self) -> Result<(), Error>
pub fn stop(&mut self) -> Result<(), Error>
stop closes the read-direction of the stream. Future calls to read are not permitted after calling stop.
sourcepub fn finish(&mut self) -> Result<(), Error>
pub fn finish(&mut self) -> Result<(), Error>
finish closes the write-direction of the stream. Future calls to write are not permitted after calling Close.
sourcepub fn stream_identifier(&self) -> StreamId
pub fn stream_identifier(&self) -> StreamId
stream_identifier returns the Stream identifier associated to the stream.
sourcepub fn set_default_payload_type(
&mut self,
default_payload_type: PayloadProtocolIdentifier
) -> Result<(), Error>
pub fn set_default_payload_type( &mut self, default_payload_type: PayloadProtocolIdentifier ) -> Result<(), Error>
set_default_payload_type sets the default payload type used by write.
sourcepub fn get_default_payload_type(
&self
) -> Result<PayloadProtocolIdentifier, Error>
pub fn get_default_payload_type( &self ) -> Result<PayloadProtocolIdentifier, Error>
get_default_payload_type returns the payload type associated to the stream.
sourcepub fn set_reliability_params(
&mut self,
unordered: bool,
rel_type: ReliabilityType,
rel_val: u32
) -> Result<(), Error>
pub fn set_reliability_params( &mut self, unordered: bool, rel_type: ReliabilityType, rel_val: u32 ) -> Result<(), Error>
set_reliability_params sets reliability parameters for this stream.
sourcepub fn buffered_amount(&self) -> Result<usize, Error>
pub fn buffered_amount(&self) -> Result<usize, Error>
buffered_amount returns the number of bytes of data currently queued to be sent over this stream.
sourcepub fn buffered_amount_low_threshold(&self) -> Result<usize, Error>
pub fn buffered_amount_low_threshold(&self) -> Result<usize, Error>
buffered_amount_low_threshold returns the number of bytes of buffered outgoing data that is considered “low.” Defaults to 0.