class Poco::Net::ICMPv4PacketImpl
Overview
This class implements the ICMPv4 packet. Moreā¦
#include <ICMPv4PacketImpl.h> class ICMPv4PacketImpl: public Poco::Net::ICMPPacketImpl { public: // enums enum DestinationUnreachableCode; enum MessageType; enum ParameterProblemCode; enum RedirectMessageCode; enum TimeExceededCode; // structs struct Header; // fields static const Poco::UInt16 MAX_PACKET_SIZE; static const std::string MESSAGE_TYPE[MESSAGE_TYPE_LENGTH]; static const Poco::UInt8 DESTINATION_UNREACHABLE_TYPE; static const Poco::UInt8 SOURCE_QUENCH_TYPE; static const Poco::UInt8 REDIRECT_MESSAGE_TYPE; static const Poco::UInt8 TIME_EXCEEDED_TYPE; static const Poco::UInt8 PARAMETER_PROBLEM_TYPE; // construction ICMPv4PacketImpl(int dataSize = 48); // methods poco_static_assert(offsetof(Header, code) = =0x01); poco_static_assert(offsetof(Header, checksum) = =0x02); poco_static_assert(offsetof(Header, id) = =0x04); poco_static_assert(offsetof(Header, seq) = =0x06); virtual int packetSize() const; virtual struct timeval time( Poco::UInt8* buffer = 0, int length = 0 ) const; bool validReplyID( Poco::UInt8* buffer, int length ) const; virtual std::string errorDescription( Poco::UInt8* buffer, int length ); virtual std::string typeDescription(int typeId); };
Inherited Members
public: // fields static const Poco::UInt16 MAX_PACKET_SIZE; static const Poco::UInt16 MAX_SEQ_VALUE; // methods const Poco::UInt8* packet(bool init = true); virtual int packetSize() const = 0; virtual int maxPacketSize() const; Poco::UInt16 sequence() const; void setDataSize(int dataSize); int getDataSize() const; virtual struct timeval time( Poco::UInt8* buffer = 0, int length = 0 ) const = 0; virtual bool validReplyID( unsigned char* buffer, int length ) const = 0; virtual std::string errorDescription( Poco::UInt8* buffer, int length ) = 0; virtual std::string typeDescription(int typeId) = 0; protected: // methods Poco::UInt16 nextSequence(); void resetSequence(); virtual void initPacket() = 0; Poco::UInt16 checksum( Poco::UInt16* addr, Poco::Int32 len );
Detailed Documentation
This class implements the ICMPv4 packet.
Parts are based on original ICMP code by Mike Muuss U. S. Army Ballistic Research Laboratory December, 1983
Methods
virtual int packetSize() const
Returns the total length of packet (header + data);.
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.
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.
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.
virtual std::string typeDescription(int typeId)
Returns the description of the packet type.