Struct sctp_proto::Stream

source ·
pub struct Stream<'a> { /* private fields */ }
Expand description

Stream represents an SCTP stream

Implementations§

source§

impl<'a> Stream<'a>

source

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.

source

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.

source

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

source

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.

source

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.

source

pub fn write_chunk(&mut self, p: &Bytes) -> Result<usize, Error>

write writes len(p) bytes from p with the default Payload Protocol Identifier

source

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.

source

pub fn is_readable(&self) -> bool

source

pub fn is_writable(&self) -> bool

source

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.

source

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.

source

pub fn stream_identifier(&self) -> StreamId

stream_identifier returns the Stream identifier associated to the stream.

source

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.

source

pub fn get_default_payload_type( &self ) -> Result<PayloadProtocolIdentifier, Error>

get_default_payload_type returns the payload type associated to the stream.

source

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.

source

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.

source

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.

source

pub fn set_buffered_amount_low_threshold( &mut self, th: usize ) -> Result<(), Error>

set_buffered_amount_low_threshold is used to update the threshold. See buffered_amount_low_threshold().

Auto Trait Implementations§

§

impl<'a> Freeze for Stream<'a>

§

impl<'a> !RefUnwindSafe for Stream<'a>

§

impl<'a> Send for Stream<'a>

§

impl<'a> Sync for Stream<'a>

§

impl<'a> Unpin for Stream<'a>

§

impl<'a> !UnwindSafe for Stream<'a>

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