rfc.icmp- ICMP packets
This module provides some basic utilities to construct and parse ICMP packets.
For the functions below, buffer should be a writable u8vector of the enough size.
Parsing functions takes offset as well as buffer, which specifies the beginning of the ICMP packet. Using the offset you can carry the whole IP packet in buffer, without creating a new buffer to extract ICMP portion.
Fills buffer with the ICMPv4 Echo Request packet.
Data must be a u8vector. The checksum field is
left to be zero, which can be filled by
Calculates the ICMPv4 checksum of the packet in the buffer, of size length (the size of the packet, not the buffer), and fills the checksum field of the packet.
Fills buffer with the ICMPv6 Echo Request packet. Data must be a u8vector. The checksum field is left to be zero, which is to be filled by the kernel (so you don’t need to fill by yourself).
Extracts type, code, ident and sequence fields of ICMP packet. These functions are common to both ICMPv4/v6.
Prints out a simple text description of the given ICMPv4 and v6 packet, respectively.
Returns a text description of ICMPv4 and ICMPv6 types and codes.