pub struct ErrorCode { /* private fields */ }Expand description
The ErrorCode Attribute
Implementations§
Source§impl ErrorCode
impl ErrorCode
Sourcepub const TRY_ALTERNATE: u16 = 301u16
pub const TRY_ALTERNATE: u16 = 301u16
Try an alternate server. The
AlternateServer or
AlternateDomain contains the location of
where to forward this request.
Sourcepub const BAD_REQUEST: u16 = 400u16
pub const BAD_REQUEST: u16 = 400u16
The request was malformed and could not be processed.
Sourcepub const UNAUTHORIZED: u16 = 401u16
pub const UNAUTHORIZED: u16 = 401u16
The required credentials were not found or did not match.
Sourcepub const UNKNOWN_ATTRIBUTE: u16 = 420u16
pub const UNKNOWN_ATTRIBUTE: u16 = 420u16
An unknown comprehension required attribute was present. The UnknownAttributes
contains the specific attribute/s.
Sourcepub const ALLOCATION_MISMATCH: u16 = 437u16
pub const ALLOCATION_MISMATCH: u16 = 437u16
The allocation already exists on this server.
Sourcepub const STALE_NONCE: u16 = 438u16
pub const STALE_NONCE: u16 = 438u16
The nonce is no longer valid.
Sourcepub const ADDRESS_FAMILY_NOT_SUPPORTED: u16 = 440u16
pub const ADDRESS_FAMILY_NOT_SUPPORTED: u16 = 440u16
The address family (IPv4, IPv6) is not supported.
Sourcepub const WRONG_CREDENTIALS: u16 = 441u16
pub const WRONG_CREDENTIALS: u16 = 441u16
Incorrect credentials provided.
Sourcepub const UNSUPPORTED_TRANSPORT_PROTOCOL: u16 = 442u16
pub const UNSUPPORTED_TRANSPORT_PROTOCOL: u16 = 442u16
The transport protocol (UDP, TCP) is not supported.
Sourcepub const PEER_ADDRESS_FAMILY_MISMATCH: u16 = 443u16
pub const PEER_ADDRESS_FAMILY_MISMATCH: u16 = 443u16
The peer address family does not match the TURN allocation.
Sourcepub const ALLOCATION_QUOTA_REACHED: u16 = 486u16
pub const ALLOCATION_QUOTA_REACHED: u16 = 486u16
This username has reached its limit of allocations currently allowed.
Sourcepub const ROLE_CONFLICT: u16 = 487u16
pub const ROLE_CONFLICT: u16 = 487u16
Requestor must switch ICE roles.
Sourcepub const SERVER_ERROR: u16 = 500u16
pub const SERVER_ERROR: u16 = 500u16
An unspecificed error has occurred.
Sourcepub const INSUFFICIENT_CAPACITY: u16 = 508u16
pub const INSUFFICIENT_CAPACITY: u16 = 508u16
The server does not have capacity to handle this request.
Sourcepub fn code(&self) -> u16
pub fn code(&self) -> u16
The error code value
§Examples
let error = ErrorCode::new (400, "bad error").unwrap();
assert_eq!(error.code(), 400);Sourcepub fn reason(&self) -> &str
pub fn reason(&self) -> &str
The error code reason string
§Examples
let error = ErrorCode::new (400, "bad error").unwrap();
assert_eq!(error.reason(), "bad error");Sourcepub fn default_reason_for_code(code: u16) -> &'static str
pub fn default_reason_for_code(code: u16) -> &'static str
Return some default reason strings for some error code values
Currently the following are supported.
- 301 -> Try Alternate
- 400 -> Bad Request
- 401 -> Unauthorized
- 403 -> Forbidden
- 420 -> Unknown Attribute
- 437 -> Allocation Mismatch
- 438 -> Stale Nonce
- 440 -> Address Family Not Supported
- 441 -> Wrong Credentials
- 442 -> Supported Transport Protocol
- 443 -> Peer Address Family Mismatch
- 486 -> Allocation Quota Reached
- 487 -> Role Conflict
- 500 -> Server Error
- 508 -> Insufficient Capacity
Trait Implementations§
Source§impl AttributeFromRaw<'_> for ErrorCode
impl AttributeFromRaw<'_> for ErrorCode
Source§fn from_raw_ref(raw: &RawAttribute<'_>) -> Result<Self, StunParseError>where
Self: Sized,
fn from_raw_ref(raw: &RawAttribute<'_>) -> Result<Self, StunParseError>where
Self: Sized,
Attribute from a RawAttributeSource§fn from_raw(raw: RawAttribute<'a>) -> Result<Self, StunParseError>where
Self: Sized,
fn from_raw(raw: RawAttribute<'a>) -> Result<Self, StunParseError>where
Self: Sized,
Attribute from a RawAttributeSource§impl AttributeStaticType for ErrorCode
impl AttributeStaticType for ErrorCode
Source§const TYPE: AttributeType
const TYPE: AttributeType
AttributeTypeSource§impl AttributeWrite for ErrorCode
impl AttributeWrite for ErrorCode
Source§fn to_raw(&self) -> RawAttribute<'_>
fn to_raw(&self) -> RawAttribute<'_>
RawAttribute from this AttributeSource§fn write_into_unchecked(&self, dest: &mut [u8])
fn write_into_unchecked(&self, dest: &mut [u8])
Source§impl TryFrom<&RawAttribute<'_>> for ErrorCode
impl TryFrom<&RawAttribute<'_>> for ErrorCode
Source§type Error = StunParseError
type Error = StunParseError
impl Eq for ErrorCode
impl StructuralPartialEq for ErrorCode
Auto Trait Implementations§
impl Freeze for ErrorCode
impl RefUnwindSafe for ErrorCode
impl Send for ErrorCode
impl Sync for ErrorCode
impl Unpin for ErrorCode
impl UnwindSafe for ErrorCode
Blanket Implementations§
Source§impl<A> AttributeExt for A
impl<A> AttributeExt for A
Source§fn padded_len(&self) -> usize
fn padded_len(&self) -> usize
Message
including any padding and the attribute header.