stun_codec_blazh/rfc5245/
errors.rs

1//! Error codes that are defined in [RFC 5389 -- 15.6 ERROR-CODE].
2//!
3//! [RFC 5389 -- 15.6 ERROR-CODE]: https://tools.ietf.org/html/rfc5389#section-15.6
4use crate::rfc5389::attributes::ErrorCode;
5
6/// `487`: "Role Conflict".
7///
8/// > The client asserted an ICE role (controlling or
9/// > controlled) that is in conflict with the role of the server.
10/// >
11/// > [RFC 5245 -- 21.3.  STUN Error Responses]
12///
13/// [RFC 5245 -- 21.3.  STUN Error Responses]: https://tools.ietf.org/html/rfc5245#section-21.3
14#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
15pub struct RoleConflict;
16impl RoleConflict {
17    /// The codepoint of the error.
18    pub const CODEPOINT: u16 = 487;
19}
20impl From<RoleConflict> for ErrorCode {
21    fn from(_: RoleConflict) -> Self {
22        ErrorCode::new(RoleConflict::CODEPOINT, "Role Conflict".to_string()).expect("never fails")
23    }
24}