Class PacketDefinition

Class Documentation

class core::networking::PacketDefinition

Public Functions

PacketDefinition(std::string name, unsigned char header)
~PacketDefinition()
uint8_t GetHeader()
unsigned int GetSize()
const std::string &GetName()
Field GetField(std::string name)
const std::map<std::string, Field> &GetFields()
std::shared_ptr<PacketDefinition> GetNestedType(std::string name)
bool IsDynamicSized()
template<typename T>
void AddField(std::string name)
template<typename T>
void AddRepeatedField(std::string name, unsigned int count)
void AddField(std::string name, unsigned int length)
void AddRepeatedField(std::string name, unsigned int count, unsigned int entryLength)
void AddString(std::string name, unsigned int length)
void AddRepeatedString(std::string name, unsigned int count, unsigned int entryLength)
void AddSubField(std::string name, std::shared_ptr<PacketDefinition> subType)
void AddRepeatedSubField(std::string name, unsigned int count, std::shared_ptr<PacketDefinition> subType)
std::shared_ptr<PacketDefinition> CreateNestedType(const std::string &name)
void EnableDirectResponse()

Adds internal field for packet identifying to allow direct responses Needs to be activated on request and reply packets!

void EnableSequence()

Adds a byte field to the packet, used only on receiving packets Data is validated with stored array for each connection

bool HasSequence()
void EnableDynamicData()

Allows to set data after the packet data, a field called “size” from type unsigned short must exists!