Struct etherparse::PacketHeaders
source · pub struct PacketHeaders<'a> {
pub link: Option<Ethernet2Header>,
pub vlan: Option<VlanHeader>,
pub ip: Option<IpHeader>,
pub transport: Option<TransportHeader>,
pub payload: &'a [u8],
}
Expand description
Decoded packet headers. You can use PacketHeaders::decode_from_ethernet2 to decode packets and get this struct as a result.
Fields§
§link: Option<Ethernet2Header>
§vlan: Option<VlanHeader>
§ip: Option<IpHeader>
§transport: Option<TransportHeader>
§payload: &'a [u8]
Rest of the packet that could not be decoded as a header (usually the payload).
Implementations§
source§impl<'a> PacketHeaders<'a>
impl<'a> PacketHeaders<'a>
sourcepub fn from_ethernet_slice<'b>(
packet: &'b [u8]
) -> Result<PacketHeaders<'b>, ReadError>
pub fn from_ethernet_slice<'b>(
packet: &'b [u8]
) -> Result<PacketHeaders<'b>, ReadError>
Tries to decode as much as possible of a packet.
Trait Implementations§
source§impl<'a> Clone for PacketHeaders<'a>
impl<'a> Clone for PacketHeaders<'a>
source§fn clone(&self) -> PacketHeaders<'a>
fn clone(&self) -> PacketHeaders<'a>
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read more