next up previous contents
Next: IGMP header Up: Packet construction Previous: UDP header   Contents

ICMP header

The macro ICMP_HDR builds the first four bytes of an ICMP header, as defined in [RFC792]. For a valid ICMP message, at least for more bytes must be appended. The format of the rest of the message depends on the message type.

The macro ICMP_PCK prepends an IPv4 header to the partial ICMP header constructed with ICMP_HDR.

\begin{displaymath}
\begin{tabular}{\vert cccccccccccccccccccccccccccccccc\vert}...
...\\
\multicolumn{32}{\vert c\vert}{} \\
\hline
\end{tabular}\end{displaymath}

The default value for $icmp_type (8) is the type code for an ICMP Echo message.

Example:

$identifier = 42
$sequence_number = 2
send ICMP_PCK($ip_ttl=4)
  ns: $identifier ns: $sequence_number



Martin A. Brown 2003-11-06