1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
use core::mem;
#[repr(C, packed)]
#[derive(Debug, Copy, Clone)]
pub struct EthHdr {
pub dst_addr: [u8; 6],
pub src_addr: [u8; 6],
pub ether_type: EtherType,
}
impl EthHdr {
pub const LEN: usize = mem::size_of::<EthHdr>();
}
#[repr(u16)]
#[derive(PartialEq, Eq, Debug, Copy, Clone)]
pub enum EtherType {
Loop = 0x0060_u16.to_be(),
Ipv4 = 0x0800_u16.to_be(),
Arp = 0x0806_u16.to_be(),
Ipv6 = 0x86DD_u16.to_be(),
FibreChannel = 0x8906_u16.to_be(),
Infiniband = 0x8915_u16.to_be(),
LoopbackIeee8023 = 0x9000_u16.to_be(),
}