pub struct Options {Show 34 fields
pub local_port: u16,
pub remote_port: u16,
pub announced_maximum_incoming_streams: u16,
pub announced_maximum_outgoing_streams: u16,
pub mtu: usize,
pub max_message_size: usize,
pub default_stream_priority: u16,
pub max_receiver_window_buffer_size: usize,
pub max_send_buffer_size: usize,
pub per_stream_send_queue_limit: usize,
pub total_buffered_amount_low_threshold: usize,
pub default_stream_buffered_amount_low_threshold: usize,
pub rtt_max: Duration,
pub rto_initial: Duration,
pub rto_max: Duration,
pub rto_min: Duration,
pub t1_init_timeout: Duration,
pub t1_cookie_timeout: Duration,
pub t2_shutdown_timeout: Duration,
pub max_timer_backoff_duration: Option<Duration>,
pub heartbeat_interval: Duration,
pub delayed_ack_max_timeout: Duration,
pub min_rtt_variance: Duration,
pub cwnd_mtus_initial: usize,
pub cwnd_mtus_min: usize,
pub avoid_fragmentation_cwnd_mtus: usize,
pub max_burst: i32,
pub max_retransmissions: Option<u32>,
pub max_init_retransmits: Option<u32>,
pub enable_partial_reliability: bool,
pub enable_message_interleaving: bool,
pub heartbeat_interval_include_rtt: bool,
pub zero_checksum_alternate_error_detection_method: ZeroChecksumAlternateErrorDetectionMethod,
pub disable_checksum_verification: bool,
}Expand description
User configurable options.
Fields§
§local_port: u16The local port for which the socket is supposed to be bound to. Incoming packets will be verified that they are sent to this port number and all outgoing packets will have this port number as source port.
remote_port: u16The remote port to send packets to. All outgoing packets will have this port number as destination port.
announced_maximum_incoming_streams: u16The announced maximum number of incoming streams. Note that this value is constant and can’t be currently increased in run-time as “Add Incoming Streams Request” in RFC 6525 isn’t supported.
The socket implementation doesn’t have any per-stream fixed costs, which is why the default value is set to be the maximum value.
announced_maximum_outgoing_streams: u16The announced maximum number of outgoing streams. Note that this value is constant and can’t be currently increased in run-time as “Add Outgoing Streams Request” in RFC 6525 isn’t supported.
The socket implementation doesn’t have any per-stream fixed costs, which is why the default value is set to be the maximum value.
mtu: usizeMaximum SCTP packet size. The library will limit the size of generated packets to be less than or equal to this number. This does not include any overhead from DTLS, TURN, UDP or IP headers.
max_message_size: usizeThe largest allowed message payload to be sent. Messages will be rejected if their payload
is larger than this value. Note that this doesn’t affect incoming messages, which may
larger than this value (but smaller than Self::max_receiver_window_buffer_size).
default_stream_priority: u16The default stream priority. It can be overridden by DcSctpSocket::set_stream_priority.
The default value was selected to be compatible with
https://www.w3.org/TR/webrtc-priority/, sections 4.2–4.3.
max_receiver_window_buffer_size: usizeMaximum received window buffer size. This should be a bit larger than the largest sized message you want to be able to receive. This essentially limits the memory usage on the receive side. Note that memory is allocated dynamically, and this represents the maximum amount of buffered data. The actual memory usage of the library will be smaller in normal operation, and will be larger than this due to other allocations and overhead if the buffer is fully utilized.
max_send_buffer_size: usizeSend queue total size limit. It will not be possible to queue more data if the queue size is larger than this number.
per_stream_send_queue_limit: usizePer stream send queue size limit. Similar to Options::max_send_buffer_size, but
limiting the size of individual streams.
total_buffered_amount_low_threshold: usizeA threshold that, when the amount of data in the send buffer goes below this value, will
trigger SocketEvent::OnTotalBufferedAmountLow.
default_stream_buffered_amount_low_threshold: usizeThe default per-stream buffered_amount_low threshold. In WebRTC it is initially zero, see https://w3c.github.io/webrtc-pc/#dom-rtcdatachannel-bufferedamountlowthreshold.
rtt_max: DurationMax allowed RTT value. When the RTT is measured and it’s found to be larger than this value, it will be discarded and not used for e.g. any RTO calculation. The default value is an extreme maximum but can be adapted to better match the environment.
rto_initial: DurationInitial RTO value.
rto_max: DurationMaximum RTO value.
rto_min: DurationMinimum RTO value. This must be larger than an expected peer delayed ack timeout.
t1_init_timeout: DurationT1-init timeout.
T1-cookie timeout.
t2_shutdown_timeout: DurationT2-shutdown timeout.
max_timer_backoff_duration: Option<Duration>For t1-init, t1-cookie, t2-shutdown, t3-rtx, this value, if set, will be the upper bound on
how large the exponentially backed off timeout can become. The lower the duration, the
faster the connection can recover on transient network issues. Setting this value may
require changing Self::max_retransmissions and Self::max_init_retransmits to ensure
that the connection is not closed too quickly.
heartbeat_interval: DurationHeartbeat interval (on idle connections only). Set to zero to disable.
delayed_ack_max_timeout: DurationThe maximum time when a SACK will be sent from the arrival of an unacknowledged packet. Whatever is smallest of RTO/2 and this will be used.
min_rtt_variance: DurationThe minimum limit for the measured RTT variance.
Setting this below the expected delayed ack timeout (+ margin) of the peer might result in unnecessary retransmissions, as the maximum time it takes to ACK a DATA chunk is typically RTT + ATO (delayed ack timeout), and when the SCTP channel is quite idle, and heartbeats dominate the source of RTT measurement, the RTO would converge with the smoothed RTT (SRTT). The default ATO is 200 ms in usrsctp, and a 20 ms (10 %) margin would include the processing time of received packets and the clock granularity when setting the delayed ack timer on the peer.
This is described for TCP in https://datatracker.ietf.org/doc/html/rfc6298#section-4.
cwnd_mtus_initial: usizeThe initial congestion window size, in number of MTUs. See https://datatracker.ietf.org/doc/html/rfc9260#section-7.2.1 which defaults at ~3 and https://research.google/pubs/pub36640/ which argues for at least ten segments.
cwnd_mtus_min: usizeThe minimum congestion window size, in number of MTUs, upon detection of packet loss by SACK. Note that if the retransmission timer expires, the congestion window will be as small as one MTU. See https://datatracker.ietf.org/doc/html/rfc9260#section-7.2.3.
avoid_fragmentation_cwnd_mtus: usizeWhen the congestion window is at or above this number of MTUs, the congestion control algorithm will avoid filling the congestion window fully, if that results in fragmenting large messages into quite small packets. When the congestion window is smaller than this option, it will aim to fill the congestion window as much as it can, even if it results in creating small fragmented packets.
max_burst: i32The number of packets that may be sent at once. This is limited to avoid bursts that too quickly fill the send buffer. Typically in a a socket in its “slow start” phase (when it sends as much as it can), it will send up to three packets for every SACK received, so the default limit is set just above that, and then mostly applicable for (but not limited to) fast retransmission scenarios.
max_retransmissions: Option<u32>Maximum Data Retransmit Attempts (per DATA chunk). Set to None for no limit.
max_init_retransmits: Option<u32>Corresponds to Max.Init.Retransmits from
https://datatracker.ietf.org/doc/html/rfc9260#section-16-2.20.1. Set to None for no
limit.
enable_partial_reliability: boolRFC 3758 Partial Reliability Extension
enable_message_interleaving: boolRFC 8260 Stream Schedulers and User Message Interleaving
heartbeat_interval_include_rtt: boolIf RTO should be added to heartbeat_interval
zero_checksum_alternate_error_detection_method: ZeroChecksumAlternateErrorDetectionMethodRFC 9653 Zero Checksum
To have this enabled, both peers must be configured to use the same explicit alternate error detection method; the method cannot be none.
disable_checksum_verification: boolDisables SCTP packet CRC-32 verification. Must only be used by tests.