pub struct ErrorCode { /* private fields */ }Expand description
The ErrorCode Attribute
Implementations§
Source§impl ErrorCode
impl ErrorCode
Sourcepub const TRY_ALTERNATE: u16 = 300u16
pub const TRY_ALTERNATE: u16 = 300u16
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 CONNECTION_ALREADY_EXISTS: u16 = 446u16
pub const CONNECTION_ALREADY_EXISTS: u16 = 446u16
The connection already exists.
Sourcepub const CONNECTION_TIMEOUT_OR_FAILURE: u16 = 447u16
pub const CONNECTION_TIMEOUT_OR_FAILURE: u16 = 447u16
The connection could not be established due to timeout or another failure.
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.
assert_eq!(ErrorCode::default_reason_for_code(300), "Try Alternate");
assert_eq!(ErrorCode::default_reason_for_code(400), "Bad Request");
assert_eq!(ErrorCode::default_reason_for_code(401), "Unauthorized");
assert_eq!(ErrorCode::default_reason_for_code(403), "Forbidden");
assert_eq!(ErrorCode::default_reason_for_code(420), "Unknown Attribute");
assert_eq!(ErrorCode::default_reason_for_code(437), "Allocation Mismatch");
assert_eq!(ErrorCode::default_reason_for_code(438), "Stale Nonce");
assert_eq!(ErrorCode::default_reason_for_code(440), "Address Family Not Supported");
assert_eq!(ErrorCode::default_reason_for_code(441), "Wrong Credentials");
assert_eq!(ErrorCode::default_reason_for_code(442), "Unsupported Transport Protocol");
assert_eq!(ErrorCode::default_reason_for_code(443), "Peer Address Family Mismatch");
assert_eq!(ErrorCode::default_reason_for_code(446), "Connection Already Exists");
assert_eq!(ErrorCode::default_reason_for_code(447), "Connection Timeout or Failure");
assert_eq!(ErrorCode::default_reason_for_code(486), "Allocation Quota Reached");
assert_eq!(ErrorCode::default_reason_for_code(487), "Role Conflict");
assert_eq!(ErrorCode::default_reason_for_code(500), "Server Error");
assert_eq!(ErrorCode::default_reason_for_code(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 Attribute