Poco::Net

class ICMPv4PacketImpl

File Information

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

Description

This class implements the ICMPv4 packet. Parts are based on the 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

unused))

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

unused))

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

unused))

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

unused))

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

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 virtual

~ICMPv4PacketImpl();

Destructor.

Member Functions

errorDescription virtual

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

Returns error description string. If supplied buffer contains ICMPv4 echo reply packet, an empty string is returned indicating the absence of error. If type and code of the error can be determined, they are assigned to the type and code respectively.

Buffer includes IP header, ICMP header and data.

packetSize virtual

int packetSize() const;

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

time virtual

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.

typeDescription virtual

virtual std::string typeDescription(
    int typeId
);

Returns the description of the packet type.

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

static const Poco::UInt8 DESTINATION_UNREACHABLE_TYPE;

MAX_PACKET_SIZE static

static const Poco::UInt16 MAX_PACKET_SIZE;

MESSAGE_TYPE static

static const std::string MESSAGE_TYPE[MESSAGE_TYPE_LENGTH];

PARAMETER_PROBLEM_TYPE static

static const Poco::UInt8 PARAMETER_PROBLEM_TYPE;

REDIRECT_MESSAGE_TYPE static

static const Poco::UInt8 REDIRECT_MESSAGE_TYPE;

SOURCE_QUENCH_TYPE static

static const Poco::UInt8 SOURCE_QUENCH_TYPE;

TIME_EXCEEDED_TYPE static

static const Poco::UInt8 TIME_EXCEEDED_TYPE;

Securely control IoT edge devices from anywhere   Connect a Device