Function parse_ipv4

Source
fn parse_ipv4(packet_bytes: &[u8]) -> (Address, u32, PacketPayload, u32, u32)
Expand description

Parse packet bytes into an IPv4 header, returns the IP result for this header and the payload.

§Arguments

  • ‘packet_bytes’ - the bytes of the packet to parse

§Returns

  • ‘Option<(IpResult, PacketPayload, u32, u32)>’ - the IP result, the payload, and both dst and src address of the packet

§Remarks

The function returns None if the packet is too short to contain an IPv4 header.