pub struct Ipv4PacketRaw<B> { /* private fields */ }Expand description
A partially parsed and not yet validated IPv4 packet.
Ipv4PacketRaw provides minimal parsing of an IPv4 packet, namely
it only requires that the fixed header part (HeaderPrefix) be retrieved,
all the other parts of the packet may be missing when attempting to create
it.
Ipv4Packet provides a FromRaw implementation that can be used to
validate an Ipv4PacketRaw.
Implementations§
Source§impl<B> Ipv4PacketRaw<B>
impl<B> Ipv4PacketRaw<B>
Sourcepub fn body_mut(&mut self) -> &mut B
pub fn body_mut(&mut self) -> &mut B
Returns a mutable reference to the body bytes of this Ipv4PacketRaw.
Might not be complete if a full packet was not received.
Source§impl<B> Ipv4PacketRaw<B>
impl<B> Ipv4PacketRaw<B>
Sourcepub fn options(&self) -> &MaybeParsed<OptionsRaw<B, Ipv4OptionsImpl>, B>
pub fn options(&self) -> &MaybeParsed<OptionsRaw<B, Ipv4OptionsImpl>, B>
Gets the maybe parsed options from the raw packet.
Source§impl<B: SplitByteSlice> Ipv4PacketRaw<B>
impl<B: SplitByteSlice> Ipv4PacketRaw<B>
Sourcepub fn body(&self) -> MaybeParsed<&[u8], &[u8]>
pub fn body(&self) -> MaybeParsed<&[u8], &[u8]>
Return the body.
body returns MaybeParsed::Complete if the entire body is present
(as determined by the header’s “total length” and “internet header
length” fields), and MaybeParsed::Incomplete otherwise.
Sourcepub fn into_body(self) -> MaybeParsed<B, B>
pub fn into_body(self) -> MaybeParsed<B, B>
Consumes self returning the body.
See Ipv4PacketRaw::body for details on parsing completeness.
Source§impl<B: SplitByteSliceMut> Ipv4PacketRaw<B>
impl<B: SplitByteSliceMut> Ipv4PacketRaw<B>
Sourcepub fn set_src_ip_and_update_checksum(&mut self, addr: Ipv4Addr)
pub fn set_src_ip_and_update_checksum(&mut self, addr: Ipv4Addr)
Set the source IP address.
Set the source IP address and update the header checksum accordingly.
Sourcepub fn set_dst_ip_and_update_checksum(&mut self, addr: Ipv4Addr)
pub fn set_dst_ip_and_update_checksum(&mut self, addr: Ipv4Addr)
Set the destination IP address.
Set the destination IP address and update the header checksum accordingly.
Trait Implementations§
Source§impl<B: SplitByteSlice> FromRaw<Ipv4PacketRaw<B>, ()> for Ipv4Packet<B>
impl<B: SplitByteSlice> FromRaw<Ipv4PacketRaw<B>, ()> for Ipv4Packet<B>
Source§type Error = IpParseError<Ipv4>
type Error = IpParseError<Ipv4>
Source§fn try_from_raw_with(
raw: Ipv4PacketRaw<B>,
_args: (),
) -> Result<Self, Self::Error>
fn try_from_raw_with( raw: Ipv4PacketRaw<B>, _args: (), ) -> Result<Self, Self::Error>
Self from the raw form in raw with args.Source§impl<B: SplitByteSlice, I: IpExt> GenericOverIp<I> for Ipv4PacketRaw<B>
impl<B: SplitByteSlice, I: IpExt> GenericOverIp<I> for Ipv4PacketRaw<B>
Source§impl<B: SplitByteSlice> Ipv4Header for Ipv4PacketRaw<B>
impl<B: SplitByteSlice> Ipv4Header for Ipv4PacketRaw<B>
Source§fn get_header_prefix(&self) -> &HeaderPrefix
fn get_header_prefix(&self) -> &HeaderPrefix
HeaderPrefix.Source§fn dscp_and_ecn(&self) -> DscpAndEcn
fn dscp_and_ecn(&self) -> DscpAndEcn
Source§fn fragment_offset(&self) -> FragmentOffset
fn fragment_offset(&self) -> FragmentOffset
Source§fn fragment_type(&self) -> Ipv4FragmentType
fn fragment_type(&self) -> Ipv4FragmentType
Source§fn builder(&self) -> Ipv4PacketBuilder
fn builder(&self) -> Ipv4PacketBuilder
Source§impl<B: SplitByteSlice> ParsablePacket<B, ()> for Ipv4PacketRaw<B>
impl<B: SplitByteSlice> ParsablePacket<B, ()> for Ipv4PacketRaw<B>
Source§fn parse_metadata(&self) -> ParseMetadata
fn parse_metadata(&self) -> ParseMetadata
GrowBuffer::undo_parse. Read moreSource§fn parse<BV: BufferView<B>>(buffer: BV, _args: ()) -> IpParseResult<Ipv4, Self>
fn parse<BV: BufferView<B>>(buffer: BV, _args: ()) -> IpParseResult<Ipv4, Self>
Source§fn parse_mut<BV>(buffer: BV, args: ParseArgs) -> Result<Self, Self::Error>where
BV: BufferViewMut<B>,
B: SplitByteSliceMut,
fn parse_mut<BV>(buffer: BV, args: ParseArgs) -> Result<Self, Self::Error>where
BV: BufferViewMut<B>,
B: SplitByteSliceMut,
impl<B: SplitByteSlice> IpPacketRaw<B, Ipv4> for Ipv4PacketRaw<B>
Auto Trait Implementations§
impl<B> Freeze for Ipv4PacketRaw<B>where
B: Freeze,
impl<B> RefUnwindSafe for Ipv4PacketRaw<B>where
B: RefUnwindSafe,
impl<B> Send for Ipv4PacketRaw<B>where
B: Send,
impl<B> Sync for Ipv4PacketRaw<B>where
B: Sync,
impl<B> Unpin for Ipv4PacketRaw<B>where
B: Unpin,
impl<B> UnwindSafe for Ipv4PacketRaw<B>where
B: UnwindSafe,
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
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more