IcmpHeader

Namespace inet

IcmpHeader

class

ICMP message class

Note: receiver MUST NOT decapsulate the datagram from ICMP error messages, because their contents is conceptually truncated. decapsulate() would result in a "length became negative" error; use getEncapsulatedMsg() instead.

TODO add originator id and sequence number and create an ICMPControlInfo

Extends

Name Type Description
FieldsChunk (unknown -- not in documented files)

Fields

Name Type Description
chunkLength
type IcmpType

1 byte

code int

1 byte

chksum int

2 bytes, RFC 1071

crcMode CrcMode

Packet operations (observed)

actionmodule
insertAtFrontIcmp
peekAtFrontIcmp, Udp
peekDataAtIcmp
popAtFrontPingApp, PcapRecorder, Udp

Source code

//
// ICMP message class
//
// Note: receiver MUST NOT decapsulate the datagram from ICMP error messages,
// because their contents is conceptually truncated. decapsulate() would result
// in a "length became negative" error; use getEncapsulatedMsg() instead.
//
// TODO add originator id and sequence number and create an ICMPControlInfo
class IcmpHeader extends FieldsChunk
{
    chunkLength = B(8);
    IcmpType type;   // 1 byte
    int code = -1;                   // 1 byte
    int chksum = 0;                 // 2 bytes, RFC 1071
    CrcMode crcMode = CRC_MODE_UNDEFINED;
}

File: src/inet/networklayer/ipv4/IcmpHeader.msg