#[non_exhaustive]pub enum Error {
Show 20 variants
BufferTooShort(BufferTooShort),
OutputBufferTooSmall(OutputBufferTooSmall),
FieldOverflow(FieldOverflow),
#[non_exhaustive] InvalidAckLength {
len: usize,
},
#[non_exhaustive] InvalidLossList {
reason: &'static str,
},
#[non_exhaustive] ExtensionOverrun {
declared: u16,
remaining: usize,
},
InvalidStreamIdUtf8,
#[non_exhaustive] InvalidKeyMaterial {
field: &'static str,
reason: &'static str,
},
#[non_exhaustive] WrongPacketKind {
expected: &'static str,
},
ReservedBits(ReservedBits),
InvalidField(InvalidField),
#[non_exhaustive] UnexpectedTrailingBytes {
what: &'static str,
extra: usize,
},
#[non_exhaustive] UnexpectedControlPacket {
actual: &'static str,
},
#[non_exhaustive] HandshakeOutOfSequence {
state: &'static str,
reason: &'static str,
},
Rejected(RejectionReason),
#[non_exhaustive] HandshakeTimedOut {
stage: &'static str,
},
#[non_exhaustive] Handshake {
stage: &'static str,
source: Box<Error>,
},
#[non_exhaustive] InvalidConfig {
field: &'static str,
rule: &'static str,
},
Damage(DamageError),
#[non_exhaustive] Io {
kind: ErrorKind,
context: &'static str,
},
}Expand description
An SRT packet parse / serialize error.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
BufferTooShort(BufferTooShort)
Input shorter than required.
OutputBufferTooSmall(OutputBufferTooSmall)
The output buffer passed to serialize_into was too small.
FieldOverflow(FieldOverflow)
A field value did not fit in its wire bit-width.
#[non_exhaustive]InvalidAckLength
The Control Information Field length did not match any known ACK
variant (Full / Small / Light — draft-sharabayko-srt-01 §3.2.4).
Fields
This variant is marked as non-exhaustive
#[non_exhaustive]InvalidLossList
A NAK loss-list (draft-sharabayko-srt-01 Appendix A) was not a whole
number of 4-byte entries, or a range entry’s second word had its top
bit set (which would make it a nested range).
Fields
This variant is marked as non-exhaustive
#[non_exhaustive]ExtensionOverrun
A Handshake Extension block’s declared length (in 4-byte units)
overran the remaining CIF bytes (draft-sharabayko-srt-01 §3.2.1).
Fields
This variant is marked as non-exhaustive
InvalidStreamIdUtf8
The Stream ID extension contents were not valid UTF-8 after undoing the
32-bit little-endian word storage (draft-sharabayko-srt-01 §3.2.1.3).
#[non_exhaustive]InvalidKeyMaterial
A Key Material message (draft-sharabayko-srt-01 §3.2.2) fixed-value
field did not carry its mandated value.
Fields
This variant is marked as non-exhaustive
#[non_exhaustive]WrongPacketKind
A type-specific parse was called on bytes whose F bit (or Control
Type) indicated the other packet kind.
Fields
This variant is marked as non-exhaustive
ReservedBits(ReservedBits)
A field documented as reserved / must-be-zero (draft-sharabayko-srt-01
§3.2, e.g. Subtype on a defined control type, or the header
Type-specific Information word where the packet type does not use
it) carried a non-zero value.
InvalidField(InvalidField)
A general structural constraint (not a bit-width overflow) was violated — e.g. a length that must be a whole number of 4-byte words.
#[non_exhaustive]UnexpectedTrailingBytes
A Control Information Field documented as absent (Keep-Alive, Congestion Warning, Shutdown, ACKACK, Peer Error — §3.2) carried extra bytes.
Fields
This variant is marked as non-exhaustive
#[non_exhaustive]UnexpectedControlPacket
The handshake state machine (crate::caller/crate::listener) was
fed a control packet that is not a Handshake packet
(draft-sharabayko-srt-01 §3.2.1) — only Handshake packets
participate in the exchange modeled there.
Fields
This variant is marked as non-exhaustive
#[non_exhaustive]HandshakeOutOfSequence
A handshake state-machine call happened in a state where the draft’s
flow (draft-sharabayko-srt-01 §4.3.1) does not expect it — a driver
bug (e.g. calling start() twice, or feed() after Connected),
not a peer protocol failure.
Fields
This variant is marked as non-exhaustive
Rejected(RejectionReason)
The peer refused the handshake, with the reason it gave
(draft-sharabayko-srt-01 §4.3, Table 7) — a wrong passphrase
(crate::handshake_sm::RejectionReason::BadSecret) is distinguishable from a refused
stream or a version mismatch.
#[non_exhaustive]HandshakeTimedOut
The handshake got no (complete) answer within its time or retransmission budget.
Fields
This variant is marked as non-exhaustive
#[non_exhaustive]Handshake
A handshake step failed; source is the underlying parse / engine
error and stage names where it happened.
Fields
This variant is marked as non-exhaustive
#[non_exhaustive]InvalidConfig
A caller-supplied configuration value cannot work: refused when the configuration is built or first used, never repaired.
Fields
This variant is marked as non-exhaustive
Damage(DamageError)
The caller’s broadcast_core::damage::DamagePolicy refused a
damage report: the connection ends with the same report inside this
error (crate::io::SrtSocket::recv_event).
#[non_exhaustive]Io
std only.A real-socket I/O failure surfaced by crate::io’s tokio adapter
(feature tokio, which implies std). Carries the OS
std::io::ErrorKind — so e.g. a bind failure (AddrInUse) is
distinguishable from a mid-connection reset (ConnectionReset) — plus
a fixed context naming the failing call site ("bind", "connect",
"recv", "send", …). std::io::Error itself is not
Clone/PartialEq/Eq (this enum derives all three), so only its
kind() is kept rather than the full error.
Fields
This variant is marked as non-exhaustive
Implementations§
Source§impl Error
impl Error
Sourcepub const fn invalid_config(field: &'static str, rule: &'static str) -> Self
pub const fn invalid_config(field: &'static str, rule: &'static str) -> Self
Builds Self::InvalidConfig.
Sourcepub fn handshake_timed_out(stage: &'static str) -> Self
pub fn handshake_timed_out(stage: &'static str) -> Self
Builds Self::HandshakeTimedOut.
Trait Implementations§
impl Eq for Error
Source§impl Error for Error
impl Error for Error
Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
use the Display impl or to_string()