Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Basic Packet class and Opcode enum placeholder
- Loading branch information
Showing
4 changed files
with
51 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
#ifndef OPCODE_H | ||
#define OPCODE_H | ||
|
||
enum Opcode | ||
{ | ||
NONE = 0, | ||
CMSG_TEXT_MESSAGE = 1, | ||
}; | ||
|
||
enum Direction | ||
{ | ||
ClientToServer = 0, // CMSG | ||
ServerToClient = 1, // SMSG | ||
}; | ||
|
||
#endif // OPCODE_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
#ifndef PACKET_H | ||
#define PACKET_H | ||
|
||
#include "ByteBuffer.h" | ||
#include "Opcode.h" | ||
#include "Defines.h" | ||
|
||
class Packet : public ByteBuffer | ||
{ | ||
protected: | ||
// uint32 _time; // unix time | ||
// uint8 _direction; // enum Direction | ||
uint16 _opcode; // enum Opcode | ||
// uint32 _length; | ||
// Byte* _data; | ||
|
||
public: | ||
Packet() : ByteBuffer(0), _opcode(0) {} | ||
Packet(Opcode opcode, uint32 reserveSize) : ByteBuffer(reserveSize), _opcode((uint16)opcode) {} | ||
Packet(const Packet& other) : ByteBuffer(other), _opcode(other._opcode) {} | ||
|
||
Opcode GetOpcode() const { _return (Opcode)_opcode; } | ||
void SetOpcode(Opcode opcode) { _opcode = opcode; } | ||
|
||
}; | ||
|
||
#endif // PACKET_H |