Class Poco::Net::ICMPv4PacketImpl
Author: Applied Informatics Software Engineering GmbH and Contributors

# Poco::Net

# class ICMPv4PacketImpl

Library: Net
Package: ICMP
Header: Poco/Net/ICMPv4PacketImpl.h

## Description

This class implements the ICMPv4 packet. Parts are based on original ICMP code by Mike Muuss U. S. Army Ballistic Research Laboratory December, 1983

## Inheritance

Direct Base Classes: ICMPPacketImpl

All Base Classes: ICMPPacketImpl

## Member Summary

Member Functions: errorDescription, packetSize, time, typeDescription, validReplyID

Inherited Functions: checksum, errorDescription, getDataSize, initPacket, maxPacketSize, nextSequence, packet, packetSize, resetSequence, sequence, setDataSize, time, typeDescription, validReplyID

## Nested Classes

### struct Header

## Types

### sizeof

typedef poco_static_assert_test < sizeof (POCO_STATIC_ASSERTION_FAILURE < (bool)(__builtin_offsetof (Header, code)== 0x01)>)> poco_static_assert_typedef_53;

### sizeof

typedef poco_static_assert_test < sizeof (POCO_STATIC_ASSERTION_FAILURE < (bool)(__builtin_offsetof (Header, checksum)== 0x02)>)> poco_static_assert_typedef_54;

### sizeof

typedef poco_static_assert_test < sizeof (POCO_STATIC_ASSERTION_FAILURE < (bool)(__builtin_offsetof (Header, id)== 0x04)>)> poco_static_assert_typedef_55;

### sizeof

typedef poco_static_assert_test < sizeof (POCO_STATIC_ASSERTION_FAILURE < (bool)(__builtin_offsetof (Header, seq)== 0x06)>)> poco_static_assert_typedef_56;

## Enumerations

### DestinationUnreachableCode

NET_UNREACHABLE

HOST_UNREACHABLE

PROTOCOL_UNREACHABLE

PORT_UNREACHABLE

FRAGMENTATION_NEEDED_AND_DF_SET

SOURCE_ROUTE_FAILED

DESTINATION_UNREACHABLE_UNKNOWN

DESTINATION_UNREACHABLE_LENGTH

### MessageType

ECHO_REPLY

ICMP_1

ICMP_2

DESTINATION_UNREACHABLE

SOURCE_QUENCH

REDIRECT

ICMP_6

ICMP_7

ECHO_REQUEST

ICMP_9

ICMP_10

TIME_EXCEEDED

PARAMETER_PROBLEM

TIMESTAMP_REQUEST

TIMESTAMP_REPLY

INFORMATION_REQUEST

INFORMATION_REPLY

MESSAGE_TYPE_UNKNOWN

MESSAGE_TYPE_LENGTH

### ParameterProblemCode

POINTER_INDICATES_THE_ERROR

PARAMETER_PROBLEM_UNKNOWN

PARAMETER_PROBLEM_LENGTH

### RedirectMessageCode

REDIRECT_NETWORK

REDIRECT_HOST

REDIRECT_SERVICE_NETWORK

REDIRECT_SERVICE_HOST

REDIRECT_MESSAGE_UNKNOWN

REDIRECT_MESSAGE_LENGTH

### TimeExceededCode

TIME_TO_LIVE

FRAGMENT_REASSEMBLY

TIME_EXCEEDED_UNKNOWN

TIME_EXCEEDED_LENGTH

## Constructors

### ICMPv4PacketImpl

ICMPv4PacketImpl(
int dataSize = 48
);

Constructor. Creates an ICMPv4PacketImpl.

## Destructor

### ~ICMPv4PacketImpl

~ICMPv4PacketImpl();

Destructor.

## Member Functions

### errorDescription

virtual std::string errorDescription(
Poco::UInt8 * buffer,
int length
);

Returns error description string. If supplied buffer contains ICMPv4 echo reply packet, an empty string is returned indicating the absence of error.

Buffer includes IP header, ICMP header and data.

See also: Poco::Net::ICMPPacketImpl::errorDescription()

### packetSize

int packetSize() const;

Returns the total length of packet (header + data);

See also: Poco::Net::ICMPPacketImpl::packetSize()

### time

struct timeval time(
Poco::UInt8 * buffer = 0,
int length = 0
) const;

Returns current epoch time if either buffer or length are equal to zero. Otherwise, it extracts the time value from the supplied buffer.

Buffer includes IP header, ICMP header and data.

See also: Poco::Net::ICMPPacketImpl::time()

### typeDescription

virtual std::string typeDescription(
int typeId
);

Returns the description of the packet type.

See also: Poco::Net::ICMPPacketImpl::typeDescription()

### validReplyID

bool validReplyID(
Poco::UInt8 * buffer,
int length
) const;

Returns true if the extracted id is recognized (i.e. equals the process id).

Buffer includes IP header, ICMP header and data.

## Variables

### DESTINATION_UNREACHABLE_TYPE

static const Poco::UInt8 DESTINATION_UNREACHABLE_TYPE;

### MAX_PACKET_SIZE

static const Poco::UInt16 MAX_PACKET_SIZE;

### MESSAGE_TYPE

static const std::string MESSAGE_TYPE[MESSAGE_TYPE_LENGTH];

### PARAMETER_PROBLEM_TYPE

static const Poco::UInt8 PARAMETER_PROBLEM_TYPE;

### REDIRECT_MESSAGE_TYPE

static const Poco::UInt8 REDIRECT_MESSAGE_TYPE;

### SOURCE_QUENCH_TYPE

static const Poco::UInt8 SOURCE_QUENCH_TYPE;

### TIME_EXCEEDED_TYPE

static const Poco::UInt8 TIME_EXCEEDED_TYPE;