bool Packet::addPayload(const core::memory::ConstBlob &newData) { const size_t newSize = getHeader().m_size + newData.size(); if (newSize + sizeof(Packet::Header) > PACKET_MAX_SIZE_TCP) { return false; } core::memory::Blob payload = getMutablePayload(newSize); memcpy(payload.data() + getHeader().m_size, newData.data(), newData.size()); getMutableHeader().m_size = newSize; return true; }
Logon() : Message<ProtocolAdaptor>("A"){ getMutableHeader().setField(35, "A"); }
void Packet::setType(const u16 type) { getMutableHeader().m_type = type; }
void Packet::setIndex(const u16 index) { getMutableHeader().m_index = index; }
Packet::Packet() { getMutableHeader() = Header(); }