Enum etherparse::LaxNetSlice
source · pub enum LaxNetSlice<'a> {
Ipv4(LaxIpv4Slice<'a>),
Ipv6(LaxIpv6Slice<'a>),
}
Expand description
Slice containing laxly parsed the network headers & payloads (e.g. IPv4, IPv6, ARP).
Compared to the normal NetSlice
this slice allows the
payload to be incomplete/cut off and errors to be present in
the IpPayload.
The main usecases for “laxly” parsed slices are are:
- Parsing packets that have been cut off. This is, for example, useful to parse packets returned via ICMP as these usually only contain the start.
- Parsing packets where the
total_len
(for IPv4) orpayload_len
(for IPv6) have not yet been set. This can be useful when parsing packets which have been recorded in a layer before the length field was set (e.g. before the operating system set the length fields).
Variants§
Ipv4(LaxIpv4Slice<'a>)
The ipv4 header & the decoded extension headers.
Ipv6(LaxIpv6Slice<'a>)
The ipv6 header & the decoded extension headers.
Implementations§
source§impl<'a> LaxNetSlice<'a>
impl<'a> LaxNetSlice<'a>
sourcepub fn ip_payload_ref(&self) -> Option<&LaxIpPayloadSlice<'a>>
pub fn ip_payload_ref(&self) -> Option<&LaxIpPayloadSlice<'a>>
Returns a reference to ip payload if the net slice contains an ipv4 or ipv6 slice.
Trait Implementations§
source§impl<'a> Clone for LaxNetSlice<'a>
impl<'a> Clone for LaxNetSlice<'a>
source§fn clone(&self) -> LaxNetSlice<'a>
fn clone(&self) -> LaxNetSlice<'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 moresource§impl<'a> Debug for LaxNetSlice<'a>
impl<'a> Debug for LaxNetSlice<'a>
source§impl<'a> From<LaxIpSlice<'a>> for LaxNetSlice<'a>
impl<'a> From<LaxIpSlice<'a>> for LaxNetSlice<'a>
source§fn from(value: LaxIpSlice<'a>) -> LaxNetSlice<'a>
fn from(value: LaxIpSlice<'a>) -> LaxNetSlice<'a>
Converts to this type from the input type.
source§impl<'a> From<LaxIpv4Slice<'a>> for LaxNetSlice<'a>
impl<'a> From<LaxIpv4Slice<'a>> for LaxNetSlice<'a>
source§fn from(value: LaxIpv4Slice<'a>) -> LaxNetSlice<'a>
fn from(value: LaxIpv4Slice<'a>) -> LaxNetSlice<'a>
Converts to this type from the input type.
source§impl<'a> From<LaxIpv6Slice<'a>> for LaxNetSlice<'a>
impl<'a> From<LaxIpv6Slice<'a>> for LaxNetSlice<'a>
source§fn from(value: LaxIpv6Slice<'a>) -> LaxNetSlice<'a>
fn from(value: LaxIpv6Slice<'a>) -> LaxNetSlice<'a>
Converts to this type from the input type.
source§impl<'a> PartialEq for LaxNetSlice<'a>
impl<'a> PartialEq for LaxNetSlice<'a>
source§fn eq(&self, other: &LaxNetSlice<'a>) -> bool
fn eq(&self, other: &LaxNetSlice<'a>) -> bool
This method tests for
self
and other
values to be equal, and is used
by ==
.impl<'a> Eq for LaxNetSlice<'a>
impl<'a> StructuralPartialEq for LaxNetSlice<'a>
Auto Trait Implementations§
impl<'a> Freeze for LaxNetSlice<'a>
impl<'a> RefUnwindSafe for LaxNetSlice<'a>
impl<'a> Send for LaxNetSlice<'a>
impl<'a> Sync for LaxNetSlice<'a>
impl<'a> Unpin for LaxNetSlice<'a>
impl<'a> UnwindSafe for LaxNetSlice<'a>
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more