pub struct DataChannel { /* private fields */ }Expand description
DataChannel represents a data channel
Implementations§
Source§impl DataChannel
impl DataChannel
Sourcepub fn dial(
config: DataChannelConfig,
association_handle: usize,
stream_id: u16,
) -> Result<Self>
pub fn dial( config: DataChannelConfig, association_handle: usize, stream_id: u16, ) -> Result<Self>
Dial opens a data channels over SCTP
Sourcepub fn accept(
config: DataChannelConfig,
association_handle: usize,
stream_id: u16,
ppi: PayloadProtocolIdentifier,
buf: &[u8],
) -> Result<Self>
pub fn accept( config: DataChannelConfig, association_handle: usize, stream_id: u16, ppi: PayloadProtocolIdentifier, buf: &[u8], ) -> Result<Self>
Accept is used to accept incoming data channels over SCTP
Sourcepub fn messages_sent(&self) -> usize
pub fn messages_sent(&self) -> usize
MessagesSent returns the number of messages sent
Sourcepub fn messages_received(&self) -> usize
pub fn messages_received(&self) -> usize
MessagesReceived returns the number of messages received
Sourcepub fn bytes_sent(&self) -> usize
pub fn bytes_sent(&self) -> usize
BytesSent returns the number of bytes sent
Sourcepub fn bytes_received(&self) -> usize
pub fn bytes_received(&self) -> usize
BytesReceived returns the number of bytes received
Sourcepub fn association_handle(&self) -> usize
pub fn association_handle(&self) -> usize
association_handle returns the association handle
Sourcepub fn stream_identifier(&self) -> u16
pub fn stream_identifier(&self) -> u16
StreamIdentifier returns the Stream identifier associated to the stream.
Sourcepub fn config(&self) -> &DataChannelConfig
pub fn config(&self) -> &DataChannelConfig
The configuration this channel was opened with.
Sourcepub fn set_buffered_amount_high_threshold(
&mut self,
threshold: u32,
) -> Result<()>
pub fn set_buffered_amount_high_threshold( &mut self, threshold: u32, ) -> Result<()>
SetBufferedAmountHighThreshold is used to update the threshold. See BufferedAmountHighThreshold().
Sourcepub fn set_buffered_amount_low_threshold(
&mut self,
threshold: u32,
) -> Result<()>
pub fn set_buffered_amount_low_threshold( &mut self, threshold: u32, ) -> Result<()>
SetBufferedAmountLowThreshold is used to update the threshold. See BufferedAmountLowThreshold().
Sourcepub fn get_reliability_params(
channel_type: ChannelType,
) -> (bool, ReliabilityType)
pub fn get_reliability_params( channel_type: ChannelType, ) -> (bool, ReliabilityType)
Decomposes a ChannelType into the SCTP send parameters it implies.
Returns whether delivery is unordered, together with the reliability type and value SCTP needs for partial reliability.
Sourcepub fn get_channel_type_and_reliability_parameter(
ordered: bool,
max_retransmits: Option<u16>,
max_packet_life_time: Option<u16>,
) -> (ChannelType, u32)
pub fn get_channel_type_and_reliability_parameter( ordered: bool, max_retransmits: Option<u16>, max_packet_life_time: Option<u16>, ) -> (ChannelType, u32)
Derives the ChannelType and reliability parameter from the maxPacketLifeTime /
maxRetransmits pair the W3C API exposes.
The two are mutually exclusive; supplying neither yields a fully reliable channel.
Sourcepub fn get_data_channel_message(
is_string: bool,
data: BytesMut,
) -> DataChannelMessage
pub fn get_data_channel_message( is_string: bool, data: BytesMut, ) -> DataChannelMessage
Builds the payload protocol identifier and payload for a user message.
Empty messages get their own identifiers (StringEmpty/BinaryEmpty) because SCTP
cannot carry a zero-length payload.
Trait Implementations§
Source§impl Clone for DataChannel
impl Clone for DataChannel
Source§fn clone(&self) -> DataChannel
fn clone(&self) -> DataChannel
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for DataChannel
impl Debug for DataChannel
Source§impl Default for DataChannel
impl Default for DataChannel
Source§fn default() -> DataChannel
fn default() -> DataChannel
Source§impl Protocol<DataChannelMessage, DataChannelMessage, ()> for DataChannel
impl Protocol<DataChannelMessage, DataChannelMessage, ()> for DataChannel
Source§fn handle_read(&mut self, msg: DataChannelMessage) -> Result<()>
fn handle_read(&mut self, msg: DataChannelMessage) -> Result<()>
ReadDataChannel reads a packet of len(p) bytes. It returns the number of bytes read and
true if the data read is a string.
Source§fn handle_write(&mut self, msg: DataChannelMessage) -> Result<()>
fn handle_write(&mut self, msg: DataChannelMessage) -> Result<()>
handle_write writes len(p) bytes from p
Source§fn poll_write(&mut self) -> Option<DataChannelMessage>
fn poll_write(&mut self) -> Option<DataChannelMessage>
Returns packets to transmit
Source§fn close(&mut self) -> Result<()>
fn close(&mut self) -> Result<()>
Close closes the DataChannel and the underlying SCTP stream.