1#[derive(Debug, Copy, Clone, Eq, PartialEq, Hash)]
6pub struct Protocol(pub u8);
7
8impl Protocol {
9 pub const ICMP: Protocol = Protocol(1);
10 pub const TCP: Protocol = Protocol(6);
11 pub const UDP: Protocol = Protocol(17);
12 pub const RESERVED: Protocol = Protocol(255);
13
14 #[inline]
16 pub fn value(&self) -> u8 {
17 self.0
18 }
19
20 pub fn is_unassigned(&self) -> bool {
21 self.0 >= 143 && self.0 <= 252
22 }
23
24 pub fn is_experimental(&self) -> bool {
25 self.0 >= 253 && self.0 <= 254
26 }
27}