rfc.icmp
- ICMP packets ¶{rfc.icmp
}
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.
{rfc.icmp
}
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 icmp4-fill-checksum!
.
{rfc.icmp
}
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.
{rfc.icmp
}
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).
{rfc.icmp
}
Extracts type, code, ident and sequence fields of ICMP packet.
These functions are common to both ICMPv4/v6.
{rfc.icmp
}
Prints out a simple text description of the given ICMPv4 and v6 packet,
respectively.
{rfc.icmp
}
Returns a text description of ICMPv4 and ICMPv6 types and codes.