xenet_packet/
sll2.rs

1//! A Linux cooked-mode capture v2 (LINKTYPE_LINUX_SLL2) packet abstraction.
2
3use alloc::vec::Vec;
4
5use xenet_macro::packet;
6use xenet_macro_helper::types::*;
7
8use super::ethernet::EtherType;
9
10/// Represents an SLL2 packet (LINKTYPE_LINUX_SLL2).
11#[packet]
12pub struct SLL2 {
13    #[construct_with(u16)]
14    pub protocol_type: EtherType,
15
16    #[construct_with(u16)]
17    pub reserved: u16be,
18
19    #[construct_with(u32)]
20    pub interface_index: u32be,
21
22    #[construct_with(u16)]
23    pub arphrd_type: u16be,
24
25    #[construct_with(u8)]
26    pub packet_type: u8,
27
28    #[construct_with(u8)]
29    pub link_layer_address_length: u8,
30
31    #[construct_with(u8, u8, u8, u8, u8, u8, u8, u8)]
32    #[length = "8"]
33    pub link_layer_address: Vec<u8>,
34
35    #[payload]
36    pub payload: Vec<u8>,
37}