diff options
author | Matthias Schiffer <matthias@gamezock.de> | 2008-06-27 19:34:09 +0200 |
---|---|---|
committer | Matthias Schiffer <matthias@gamezock.de> | 2008-06-27 19:34:09 +0200 |
commit | d1306a1710cda4acb9a0138347cdb43943271b9c (patch) | |
tree | 50544a31e47670b257be804648c6d714750cee12 /src/Net/Packet.h | |
parent | b143406a05a1698df5b88b0d4298362a9c8c080b (diff) | |
download | mad-d1306a1710cda4acb9a0138347cdb43943271b9c.tar mad-d1306a1710cda4acb9a0138347cdb43943271b9c.zip |
Verbindungen geregelt trennen... hoffentlich...
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 { |