#[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), } } }