diff options
Diffstat (limited to 'src/Net/Packet.h')
-rw-r--r-- | src/Net/Packet.h | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/src/Net/Packet.h b/src/Net/Packet.h index 32aba18..c2bd4d1 100644 --- a/src/Net/Packet.h +++ b/src/Net/Packet.h @@ -28,6 +28,11 @@ namespace Net { class Packet { public: + enum Type { + TYPE_UNKNOWN = 0x0000, TYPE_DEBUG = 0x0001, TYPE_PING = 0x0002, TYPE_PONG = 0x0003, + TYPE_DISCONNECT_REQ = 0x0010, TYPE_DISCONNECT_REP = 0x0011 + }; + struct Data { unsigned short type; unsigned short requestId; @@ -39,7 +44,7 @@ class Packet { Data *rawData; public: - Packet(unsigned short type, unsigned short requestId, const void *data = NULL, unsigned long length = 0) { + Packet(Type type, unsigned short requestId, const void *data = NULL, unsigned long length = 0) { rawData = (Data*)std::malloc(sizeof(Data)+length); rawData->type = type; @@ -71,8 +76,8 @@ class Packet { std::free(rawData); } - unsigned short getType() const { - return rawData->type; + Type getType() const { + return (Type)rawData->type; } unsigned short getRequestId() const { |