#[derive(Debug, PartialEq)]
#[repr(u8)]
pub enum HTypes {
Ethernet,
ExperimentalEthernet,
AmateurRadio,
ProteonTokenRing,
Chaos,
IEEE802,
ARCNET,
Hyperchannel,
Lanstar,
AutonetShortAddress,
LocalTalk,
LocalNet,
UltraLink,
SMDS,
FrameRelay,
ATM16,
HDLC,
FibreChannel,
ATM19,
SerialLine,
ATM21,
MILSTD188220,
Metricom,
IEEE13941995,
MAPOS,
Twinaxial,
EUI64,
HIPARP,
IPARPISO78163,
ARPSec,
IPsecTunnel,
InfiniBand,
CommonAirInterface,
WiegandInterface,
PureIP,
HWEXP1,
HFI,
UnifiedBus,
Other(u8),
}
impl From<&HTypes> for u8 {
fn from(htypes: &HTypes) -> Self {
match htypes {
HTypes::Ethernet => 1,
HTypes::ExperimentalEthernet => 2,
HTypes::AmateurRadio => 3,
HTypes::ProteonTokenRing => 4,
HTypes::Chaos => 5,
HTypes::IEEE802 => 6,
HTypes::ARCNET => 7,
HTypes::Hyperchannel => 8,
HTypes::Lanstar => 9,
HTypes::AutonetShortAddress => 10,
HTypes::LocalTalk => 11,
HTypes::LocalNet => 12,
HTypes::UltraLink => 13,
HTypes::SMDS => 14,
HTypes::FrameRelay => 15,
HTypes::ATM16 => 16,
HTypes::HDLC => 17,
HTypes::FibreChannel => 18,
HTypes::ATM19 => 19,
HTypes::SerialLine => 20,
HTypes::ATM21 => 21,
HTypes::MILSTD188220 => 22,
HTypes::Metricom => 23,
HTypes::IEEE13941995 => 24,
HTypes::MAPOS => 25,
HTypes::Twinaxial => 26,
HTypes::EUI64 => 27,
HTypes::HIPARP => 28,
HTypes::IPARPISO78163 => 29,
HTypes::ARPSec => 30,
HTypes::IPsecTunnel => 31,
HTypes::InfiniBand => 32,
HTypes::CommonAirInterface => 33,
HTypes::WiegandInterface => 34,
HTypes::PureIP => 35,
HTypes::HWEXP1 => 36,
HTypes::HFI => 37,
HTypes::UnifiedBus => 38,
HTypes::Other(x) => *x,
}
}
}
impl From<u8> for HTypes {
fn from(byte: u8) -> Self {
match byte {
1 => Self::Ethernet,
2 => Self::ExperimentalEthernet,
3 => Self::AmateurRadio,
4 => Self::ProteonTokenRing,
5 => Self::Chaos,
6 => Self::IEEE802,
7 => Self::ARCNET,
8 => Self::Hyperchannel,
9 => Self::Lanstar,
10 => Self::AutonetShortAddress,
11 => Self::LocalTalk,
12 => Self::LocalNet,
13 => Self::UltraLink,
14 => Self::SMDS,
15 => Self::FrameRelay,
16 => Self::ATM16,
17 => Self::HDLC,
18 => Self::FibreChannel,
19 => Self::ATM19,
20 => Self::SerialLine,
21 => Self::ATM21,
22 => Self::MILSTD188220,
23 => Self::Metricom,
24 => Self::IEEE13941995,
25 => Self::MAPOS,
26 => Self::Twinaxial,
27 => Self::EUI64,
28 => Self::HIPARP,
29 => Self::IPARPISO78163,
30 => Self::ARPSec,
31 => Self::IPsecTunnel,
32 => Self::InfiniBand,
33 => Self::CommonAirInterface,
34 => Self::WiegandInterface,
35 => Self::PureIP,
36 => Self::HWEXP1,
37 => Self::HFI,
38 => Self::UnifiedBus,
_ => Self::Other(byte),
}
}
}