stun_rs/attributes/turn/
dont_fragment.rs

1const DONT_FRAGMENT: u16 = 0x001A;
2
3crate::common::empty_attribute!(
4    /// This attribute is used by the client to request that the server set
5    /// the `DF` (Don't Fragment) bit in the IP header when relaying the
6    /// application data onward to the peer and for determining the server
7    /// capability in Allocate requests
8    ///
9    /// # Examples
10    ///```rust
11    /// # use stun_rs::attributes::{AttributeType, StunAttributeType};
12    /// # use stun_rs::attributes::turn::DontFragment;
13    /// let attr = DontFragment::default();
14    /// assert_eq!(attr.attribute_type(), AttributeType::from(0x001A));
15    ///```
16    DontFragment,
17    DONT_FRAGMENT,
18);
19
20#[cfg(test)]
21mod tests {
22    use super::*;
23    use crate::StunAttribute;
24
25    #[test]
26    fn dont_fragment_stunt_attribute() {
27        let attr = StunAttribute::DontFragment(DontFragment::default());
28        assert!(attr.is_dont_fragment());
29        assert!(attr.as_dont_fragment().is_ok());
30        assert!(attr.as_error_code().is_err());
31
32        assert!(attr.attribute_type().is_comprehension_required());
33        assert!(!attr.attribute_type().is_comprehension_optional());
34
35        let dbg_fmt = format!("{:?}", attr);
36        assert_eq!("DontFragment(DontFragment)", dbg_fmt);
37    }
38}