CatapultServer
v0.5.0.1 (Elephant)
|
Go to the documentation of this file.
26 namespace catapult {
namespace ionet {
31 if (packet.
Size <= Min_Size) {
32 if (packet.
Size < Min_Size)
38 return packet.
Size - Min_Size;
42 template<
typename TEntity>
44 return TEntity::CalculateRealSize(entity) == entity.Size;
49 template<
typename TEntity,
typename TIsVal
idPredicate>
52 auto offsets = ExtractEntityOffsets<TEntity>({ packet.
Data(), dataSize }, isValid);
53 return offsets.empty()
60 template<
typename TEntity,
typename TIsVal
idPredicate>
63 if (!ContainsSingleEntity<TEntity>({ packet.
Data(), dataSize }, isValid))
66 auto pEntity = utils::MakeUniqueWithSize<TEntity>(dataSize);
67 std::memcpy(static_cast<void*>(pEntity.get()), packet.
Data(), dataSize);
73 template<
typename TStructure>
76 auto numStructures = CountFixedSizeStructures<TStructure>({ packet.
Data(), dataSize });
77 return 0 == numStructures
#define CATAPULT_LOG(SEV)
Writes a log entry to the default logger with SEV severity.
Definition: Logging.h:340
bool IsSizeValid(const TEntity &entity)
Checks the real size of entity against its reported size and returns true if the sizes match.
Definition: PacketEntityUtils.h:43
A packet header with a data payload.
Definition: Packet.h:32
def warning(*args)
Definition: colorPrint.py:10
uint8_t * Data()
Returns a non-const pointer to data contained in this packet.
Definition: Packet.h:35
Represents a range of entities.
Definition: EntityRange.h:31
model::EntityRange< TStructure > ExtractFixedSizeStructuresFromPacket(const Packet &packet)
Definition: PacketEntityUtils.h:74
static EntityRange CopyFixed(const uint8_t *pData, size_t numElements)
Creates an entity range around numElements fixed size elements pointed to by pData.
Definition: EntityRange.h:278
size_t CalculatePacketDataSize(const Packet &packet)
Calculates the data size of packet.
Definition: PacketEntityUtils.h:29
static EntityRange CopyVariable(const uint8_t *pData, size_t dataSize, const std::vector< size_t > &offsets)
Definition: EntityRange.h:287
std::unique_ptr< TEntity > ExtractEntityFromPacket(const Packet &packet, TIsValidPredicate isValid)
Definition: PacketEntityUtils.h:61
Definition: AddressExtractionExtension.cpp:28
model::EntityRange< TEntity > ExtractEntitiesFromPacket(const Packet &packet, TIsValidPredicate isValid)
Definition: PacketEntityUtils.h:50