// Use this macro to simplify handling several ReadXXX in a row. It assumes that you want [a_Data, a_Size] parsed (which is true for all Parse() functions)
#define HANDLE_PACKET_READ(Proc, Var, TotalBytes) \
/// Called to parse the packet. Packet type has already been read and the correct packet type created. Return the number of characters processed, PACKET_INCOMPLETE for incomplete data, PACKET_ERROR for error
virtualintParse(constchar*a_Data,inta_Size)
{
LOGERROR("Undefined Parse function for packet type 0x%x\n",m_PacketID);
ASSERT(!"Undefined Parse function");
return-1;
}
/// Called to serialize the packet into a string. Append all packet data to a_Data, including the packet type!
virtualvoidSerialize(AString&a_Data)const
{
LOGERROR("Undefined Serialize function for packet type 0x%x\n",m_PacketID);
ASSERT(!"Undefined Serialize function");
}
virtualcPacket*Clone()const=0;
unsignedcharm_PacketID;
protected:
// These return the number of characters processed, PACKET_INCOMPLETE for incomplete data, PACKET_ERROR for error: