Skip to content

Instantly share code, notes, and snippets.

@0xa
Created March 15, 2013 19:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save 0xa/5172326 to your computer and use it in GitHub Desktop.
Save 0xa/5172326 to your computer and use it in GitHub Desktop.
enum Opcodes {
OP_PING = 0x1337
}
class Packet {
public:
Packet(int32_t opcode);
virtual bool encode(std::string& buffer) = 0;
virtual bool decode(const std::string& buffer) = 0;
private:
int32_t m_opcode;
};
class PingPacket : public Packet {
public:
PingPacket()
: Packet(OP_PING)
{}
virtual bool encode(std::string& buffer) {}
virtual bool decode(const std::string& buffer) {}
int64_t pingId;
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment