ICMP

ICMP protocol layer

Constructor

new ICMP(data, opts)

Parameters:
NameTypeDescription
dataBuffer | ObjectInput buffer or object with protocol fields
optsObjectOptions for the layer
Properties
NameTypeDescription
typenumberICMP message type (see ICMPTypes)
codenumberICMP message code
checksumnumberICMP checksum
Implements

Members

isDestinationUnreachable

Check if this is a Destination Unreachable message

isEchoReply

Check if this is an Echo Reply message

isEchoRequest

Check if this is an Echo Request message

isParameterProblem

Check if this is a Parameter Problem message

isTimeExceeded

Check if this is a Time Exceeded message

isTimestampReply

Check if this is a Timestamp Reply message

isTimestampRequest

Check if this is a Timestamp Request message

length :number

Number of bytes occupied by the layer.
Type:
  • number
Implements

osi :OsiModelLayers

Respective protocol OSI layer.
Implements

typeName

Get the name of the ICMP message type

Methods

calculateChecksum()

Calculates and updates the checksum for the IPv4 layer. This method mutates the object by setting the `checksum` property based on the current state of the `buffer`.

toObject() → {Object}

Returns an object with all protcol fields without owning the underlying buffer. Useful to read all the data and use it without having to deal with binary representation.
Implements
Returns:
- All protocol fields
Type: 
Object

(static) toAlloc(data) → {number}

Get the required allocation size based on ICMP message type
Parameters:
NameTypeDescription
dataObjectThe data object containing type and other fields
Returns:
Required allocation size
Type: 
number