Traceroute.Protocols.ICMP (traceroute v0.2.4)

View Source

Implements the encoding and decoding of ICMP and ICMPv6 packets.

See: https://en.wikipedia.org/wiki/Internet_Control_Message_Protocol See: https://en.wikipedia.org/wiki/ICMPv6

Summary

Functions

Decodes an IPv4 or IPv6 ICMP datagram and its reply packet.

Encodes an ICMP datagram which consists of a header and data section.

Types

Functions

checksum(data)

@spec checksum(binary()) :: binary()

decode_datagram(payload, ip_protocol)

@spec decode_datagram(binary(), atom()) :: t()

Decodes an IPv4 or IPv6 ICMP datagram and its reply packet.

encode_datagram(type, code, id, sequence, payload)

@spec encode_datagram(
  type :: non_neg_integer(),
  code :: non_neg_integer(),
  id :: non_neg_integer(),
  sequence :: non_neg_integer(),
  payload :: binary()
) :: binary()

Encodes an ICMP datagram which consists of a header and data section.

0 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Type | Code | Checksum | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Rest of Header - Varies based on ICMP type and code | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Data | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+