CatapultServer  v0.5.0.1 (Elephant)
PacketHeader.h
Go to the documentation of this file.
1 
21 #pragma once
22 #include "PacketType.h"
23 #include <iosfwd>
24 
25 namespace catapult { namespace ionet {
26 
27 #pragma pack(push, 1)
28 
30  struct PacketHeader {
32  uint32_t Size;
33 
36  };
37 
38 #pragma pack(pop)
39 
41  constexpr bool IsPacketDataSizeValid(const PacketHeader& header, size_t maxPacketDataSize) {
42  return header.Size >= sizeof(PacketHeader) && (header.Size - sizeof(PacketHeader)) <= maxPacketDataSize;
43  }
44 
46  std::ostream& operator<<(std::ostream& out, const PacketHeader& header);
47 }}
PacketType.h
catapult::ionet::PacketHeader::Size
uint32_t Size
Size of the packet.
Definition: PacketHeader.h:32
PacketHeader.h
catapult::ionet::PacketHeader
A packet header that all transferable information is expected to have.
Definition: PacketHeader.h:30
catapult::ionet::PacketHeader::Type
PacketType Type
Type of the packet.
Definition: PacketHeader.h:35
catapult::ionet::PacketType
PacketType
An enumeration of known packet types.
Definition: PacketType.h:171
catapult::ionet::IsPacketDataSizeValid
constexpr bool IsPacketDataSizeValid(const PacketHeader &header, size_t maxPacketDataSize)
Determines if header indicates a valid packet data size no greater than maxPacketDataSize.
Definition: PacketHeader.h:41
catapult::ionet::operator<<
std::ostream & operator<<(std::ostream &out, ConnectionSecurityMode value)
Insertion operator for outputting value to out.
catapult
Definition: AddressExtractionExtension.cpp:28