net_parser_rs/layer4/
mod.rs

1pub mod tcp;
2pub mod udp;
3pub mod vxlan;
4
5pub use tcp::Tcp as Tcp;
6pub use udp::Udp as Udp;
7pub use vxlan::Vxlan as Vxlan;
8
9///
10/// Available Layer 4 representations
11///
12#[derive(Clone, Copy, Debug)]
13pub enum Layer4<'a> {
14    Tcp(Tcp<'a>),
15    Udp(Udp<'a>),
16    Vxlan(Vxlan<'a>),
17}
18
19impl<'a> Layer4<'a> {
20    pub fn as_bytes(&self) -> Vec<u8> {
21        match self {
22            Layer4::Tcp(v) => v.as_bytes(),
23            Layer4::Udp(v) => v.as_bytes(),
24            Layer4::Vxlan(v) => v.as_bytes(),
25        }
26    }
27}