packet_formats::testutil

Function parse_icmp_packet_in_ip_packet_in_ethernet_frame

Source
pub fn parse_icmp_packet_in_ip_packet_in_ethernet_frame<I: IpExt, C, M: IcmpMessage<I, Code = C>, F: for<'a> FnOnce(&IcmpPacket<I, &'a [u8], M>)>(
    buf: &[u8],
    ethernet_length_check: EthernetFrameLengthCheck,
    f: F,
) -> IpParseResult<I, (Mac, Mac, I::Addr, I::Addr, u8, M, C)>
where for<'a> IcmpPacket<I, &'a [u8], M>: ParsablePacket<&'a [u8], IcmpParseArgs<I::Addr>, Error = ParseError>,
Expand description

Parse an ICMP packet in an IP packet in an Ethernet frame.

parse_icmp_packet_in_ip_packet_in_ethernet_frame parses an ICMP packet in an IP packet in an Ethernet frame, returning the message and code from the ICMP packet along with some important fields from both the IP and Ethernet headers. Before returning, it invokes the callback f on the parsed packet.