#[non_exhaustive]pub enum Error {
NotStun,
Truncated,
UnsupportedMethod(u16),
MalformedAttribute(u16),
ReservedAttribute(u16),
Fingerprint,
TooLong,
}Expand description
What a datagram that was not a STUN message this profile understands turned out to be.
Every variant is a dropped datagram. None of them is a panic, and none of them moves any state: an off-path attacker who can reach the media port can produce all of them at will.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
NotStun
Not STUN at all — the first two bits or the magic cookie say so (RFC 5389 §7.3).
Truncated
The message ends inside its own header, an attribute, or the length it claims.
UnsupportedMethod(u16)
A method other than Binding. ICE uses no others (RFC 8445 §7).
MalformedAttribute(u16)
A known attribute whose value is the wrong length, not UTF-8, or out of range.
ReservedAttribute(u16)
An Attribute::Unknown naming a type this module computes for itself.
Encoding only, and only from a caller that assembled the message by hand: the two integrity values must be the last two attributes and must be derived from everything before them, so a hand-supplied copy of either is refused rather than emitted.
Fingerprint
FINGERPRINT is present and does not match the message (RFC 5389 §15.5).
TooLong
More bytes than the 16-bit length field can describe. Unreachable from any credential
Credentials admits; it exists so that no encoding path has to panic or truncate.
Trait Implementations§
Source§impl Error for Error
impl Error for Error
1.30.0 · 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()
impl Copy for Error
impl Eq for Error
impl StructuralPartialEq for Error
Auto Trait Implementations§
impl Freeze for Error
impl RefUnwindSafe for Error
impl Send for Error
impl Sync for Error
impl Unpin for Error
impl UnsafeUnpin for Error
impl UnwindSafe for Error
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more