some tidy-up and struct alignment compile-time check

This commit is contained in:
Aleksandar Fabijanic 2008-10-27 15:02:10 +00:00
parent dcede96ede
commit 5b31c46b16
2 changed files with 12 additions and 5 deletions

View File

@ -43,6 +43,7 @@
#include "Poco/Foundation.h"
#include "Poco/Net/Socket.h"
#include "Poco/Net/ICMPPacketImpl.h"
#include <cstddef>
namespace Poco {
@ -67,6 +68,12 @@ public:
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
{
ECHO_REPLY,

View File

@ -57,11 +57,11 @@ namespace Poco {
namespace Net {
const UInt8 ICMPv4PacketImpl::DESTINATION_UNREACHABLE_TYPE = 3;
const Poco::UInt8 ICMPv4PacketImpl::SOURCE_QUENCH_TYPE = 4;
const Poco::UInt8 ICMPv4PacketImpl::REDIRECT_MESSAGE_TYPE = 5;
const UInt8 ICMPv4PacketImpl::TIME_EXCEEDED_TYPE = 11;
const Poco::UInt8 ICMPv4PacketImpl::PARAMETER_PROBLEM_TYPE = 12;
const UInt8 ICMPv4PacketImpl::DESTINATION_UNREACHABLE_TYPE = 3;
const UInt8 ICMPv4PacketImpl::SOURCE_QUENCH_TYPE = 4;
const UInt8 ICMPv4PacketImpl::REDIRECT_MESSAGE_TYPE = 5;
const UInt8 ICMPv4PacketImpl::TIME_EXCEEDED_TYPE = 11;
const UInt8 ICMPv4PacketImpl::PARAMETER_PROBLEM_TYPE = 12;
const std::string ICMPv4PacketImpl::MESSAGE_TYPE[] =