Function packet_formats::testutil::parse_icmp_packet

source ยท
pub fn parse_icmp_packet<I: IcmpIpExt, C, M: IcmpMessage<I, Code = C>, F: for<'a> FnOnce(&IcmpPacket<I, &'a [u8], M>)>(
    buf: &[u8],
    src_ip: I::Addr,
    dst_ip: I::Addr,
    f: F,
) -> ParseResult<(M, C)>
where for<'a> IcmpPacket<I, &'a [u8], M>: ParsablePacket<&'a [u8], IcmpParseArgs<I::Addr>, Error = ParseError>,
Expand description

Parse an ICMP packet.

parse_icmp_packet parses an ICMP packet, returning the body along with some important fields. Before returning, it invokes the callback f on the parsed packet.