Skip to main content

PacketHeader

Trait PacketHeader 

Source
pub trait PacketHeader: Sized {
    type InnerType;

    const NAME: &'static str;
    const FIXED_LEN: usize = _;

    // Required method
    fn inner_type(&self) -> Self::InnerType;

    // Provided methods
    fn total_len(&self, buf: &[u8]) -> usize { ... }
    fn is_valid(&self) -> bool { ... }
}

Required Associated Constants§

Source

const NAME: &'static str

Provided Associated Constants§

Required Associated Types§

Required Methods§

Source

fn inner_type(&self) -> Self::InnerType

return the inner type of the header

Provided Methods§

Source

fn total_len(&self, buf: &[u8]) -> usize

Returns the length of the network layer header For protocols with variable-length headers (like IPv6 with extensions), the buffer is needed to calculate the correct length

Source

fn is_valid(&self) -> bool

check whether the network layer header is valid

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

Source§

impl PacketHeader for EtherHeaderVlan<'_>

Source§

const NAME: &'static str = "EtherHeaderVlan"

Source§

type InnerType = EtherProto

Source§

impl PacketHeader for ArpHeader

Source§

const NAME: &'static str = "ArpHeader"

Source§

type InnerType = ()

Source§

impl PacketHeader for DhcpHeader

Source§

const NAME: &'static str = "DhcpHeader"

Source§

type InnerType = ()

Source§

impl PacketHeader for Ether8021qHeader

Source§

const NAME: &'static str = "Ether8021qHeader"

Source§

type InnerType = EtherProto

Source§

impl PacketHeader for EtherHeader

Source§

const NAME: &'static str = "EtherHeader"

Source§

type InnerType = EtherProto

Source§

impl PacketHeader for Icmp6Header

Source§

const NAME: &'static str = "Icmp6Header"

Source§

type InnerType = Icmp6Type

Source§

impl PacketHeader for IcmpHeader

Source§

const NAME: &'static str = "IcmpHeader"

Source§

type InnerType = IcmpType

Source§

impl PacketHeader for Ipv4Header

Source§

const NAME: &'static str = "IPv4Header"

Source§

type InnerType = IpProto

Source§

impl PacketHeader for Ipv6Header

Source§

const NAME: &'static str = "IPv6Header"

Source§

type InnerType = IpProto

Source§

impl PacketHeader for NullHeader

Source§

const NAME: &'static str = "Null/Loopback"

Source§

type InnerType = EtherProto

Source§

impl PacketHeader for SctpHeader

Source§

const NAME: &'static str = "SctpHeader"

Source§

type InnerType = ()

Source§

impl PacketHeader for SllHeader

Source§

const NAME: &'static str = "SllHeader"

Source§

type InnerType = EtherProto

Source§

impl PacketHeader for Sllv2Header

Source§

const NAME: &'static str = "Sllv2Header"

Source§

type InnerType = EtherProto

Source§

impl PacketHeader for TcpHeader

Source§

const NAME: &'static str = "TcpHeader"

Source§

type InnerType = ()

Source§

impl PacketHeader for GeneveHeader

Source§

const NAME: &'static str = "GeneveHeader"

Source§

type InnerType = EtherProto

Source§

impl PacketHeader for GreHeader

Source§

const NAME: &'static str = "GreHeader"

Source§

type InnerType = EtherProto

Source§

impl PacketHeader for Gtpv1Header

Source§

const NAME: &'static str = "Gtpv1Header"

Source§

type InnerType = u8

Source§

impl PacketHeader for Gtpv2Header

Source§

const NAME: &'static str = "Gtpv2Header"

Source§

type InnerType = u8

Source§

impl PacketHeader for L2tpv2Header

Source§

const NAME: &'static str = "L2TPv2"

Source§

type InnerType = ()

Source§

impl PacketHeader for L2tpv3ControlHeader

Source§

const NAME: &'static str = "L2TPv3-Control"

Source§

type InnerType = ()

Source§

impl PacketHeader for L2tpv3SessionHeader

Source§

const NAME: &'static str = "L2TPv3-Session"

Source§

type InnerType = ()

Source§

impl PacketHeader for MplsLabel

Source§

const NAME: &'static str = "MplsLabel"

Source§

type InnerType = u32

Source§

impl PacketHeader for NvgreHeader

Source§

const NAME: &'static str = "NvgreHeader"

Source§

type InnerType = EtherProto

Source§

impl PacketHeader for PbbBTag

Source§

const NAME: &'static str = "PBB-B-Tag"

Source§

type InnerType = EtherProto

Source§

impl PacketHeader for PbbITag

Source§

const NAME: &'static str = "PBB-I-Tag"

Source§

type InnerType = EtherProto

Source§

impl PacketHeader for PptpGreHeader

Source§

const NAME: &'static str = "PptpGreHeader"

Source§

type InnerType = EtherProto

Source§

impl PacketHeader for SttHeader

Source§

const NAME: &'static str = "SttHeader"

Source§

type InnerType = u64

Source§

impl PacketHeader for SttTcpHeader

Source§

const NAME: &'static str = "SttTcpHeader"

Source§

type InnerType = u16

Source§

impl PacketHeader for TeredoAuthHeader

Source§

const NAME: &'static str = "TeredoAuthHeader"

Source§

type InnerType = IpProto

Source§

impl PacketHeader for TeredoHeader

Source§

const NAME: &'static str = "TeredoHeader"

Source§

type InnerType = IpProto

Source§

impl PacketHeader for VxlanHeader

Source§

const NAME: &'static str = "VxlanHeader"

Source§

type InnerType = EtherProto

Source§

impl PacketHeader for UdpHeader

Source§

const NAME: &'static str = "UdpHeader"

Source§

type InnerType = ()