IcmpHeader

Namespace: inet

class IcmpHeader

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

Usage diagram

Inheritance diagram

Extends

Name

Type

Description

FieldsChunk

class

(no description)

Known subclasses

Name

Type

Description

IcmpEchoReply

class

(no description)

IcmpEchoRequest

class

(no description)

IcmpPtb

class

(no description)

Fields

Name

Type

Description

id

int

mutable

bool

complete

bool

correct

bool

properlyRepresented

bool

chunkLength

b

rawBin

string[]

rawHex

string[]

regionTags

SharingRegionTagSet::TagBaseRegionTag[]

chunkLength

type

IcmpType

1 byte

code

int

1 byte

chksum

int

2 bytes, RFC 1071

checksumMode

ChecksumMode

Properties

Name

Value

Description

beforeChange

handleChange()

descriptor

readonly

existingClass

packetData

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
    ChecksumMode checksumMode = CHECKSUM_MODE_UNDEFINED;
}

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