mirror of
https://github.com/pocoproject/poco.git
synced 2024-12-12 18:20:26 +01:00
some tidy-up and struct alignment compile-time check
This commit is contained in:
parent
dcede96ede
commit
5b31c46b16
@ -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,
|
||||
|
@ -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[] =
|
||||
|
Loading…
Reference in New Issue
Block a user