blob: 0d728f36c7dd0dd9b57ef14f10a48d49cdefb8e2 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
|
#[derive(Copy, Clone, Debug, PartialEq)]
pub enum EtherType {
/// The frame type is IEEE 802.3 and this is it's length
Length(u16),
IPv4,
IPv6,
Unknown(u16),
}
impl EtherType {
//TODO: check ethertype is correct
pub fn new(n: u16) -> Self {
match n {
n if n <= 1500 => Self::Length(n),
0x0800 => Self::IPv4,
0x86DD => Self::IPv6,
n => Self::Unknown(n),
}
}
}
|