interface IcmpPacket

Generic ICMPv4 packet (RFC 792).

The 4 bytes RFC 792 calls "rest of header" are part of payload here; their meaning is type-specific ((identifier, sequence) for Echo, (unused, nextHopMtu) for some Destination Unreachable codes, etc.).

Properties

type: number

ICMP type field. See ICMP_TYPE.

code: number

ICMP code field, type-specific subtype.

checksum: number

Big-endian 16-bit Internet checksum over the entire ICMP message (header + payload) with this field set to zero. Not auto-computed on encode; use internetChecksum from @binstruct/inet.

payload: Uint8Array<ArrayBufferLike>

Remaining bytes of the message.

Usage

import { type IcmpPacket } from ".";