mirror of
https://github.com/pocoproject/poco.git
synced 2025-10-24 00:49:46 +02:00
backport initialisation of _seq member and some static checking for ICMP packet
This commit is contained in:
@@ -43,6 +43,7 @@
|
|||||||
#include "Poco/Foundation.h"
|
#include "Poco/Foundation.h"
|
||||||
#include "Poco/Net/Socket.h"
|
#include "Poco/Net/Socket.h"
|
||||||
#include "Poco/Net/ICMPPacketImpl.h"
|
#include "Poco/Net/ICMPPacketImpl.h"
|
||||||
|
#include <cstddef>
|
||||||
|
|
||||||
|
|
||||||
namespace Poco {
|
namespace Poco {
|
||||||
@@ -67,6 +68,12 @@ public:
|
|||||||
Poco::UInt16 seq;
|
Poco::UInt16 seq;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// compile-time shield against misalignment
|
||||||
|
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);
|
||||||
|
|
||||||
enum MessageType
|
enum MessageType
|
||||||
{
|
{
|
||||||
ECHO_REPLY,
|
ECHO_REPLY,
|
||||||
|
|||||||
@@ -125,8 +125,9 @@ const std::string ICMPv4PacketImpl::PARAMETER_PROBLEM_CODE[] =
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
ICMPv4PacketImpl::ICMPv4PacketImpl(int dataSize):
|
ICMPv4PacketImpl::ICMPv4PacketImpl(int dataSize)
|
||||||
ICMPPacketImpl(dataSize)
|
: ICMPPacketImpl(dataSize),
|
||||||
|
_seq(0)
|
||||||
{
|
{
|
||||||
initPacket();
|
initPacket();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user