Created
October 4, 2018 06:20
-
-
Save Romain-P/e6a6da21c6edccc12940c93f60b74cdd to your computer and use it in GitHub Desktop.
sample protocol msg
This file contains hidden or 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
// | |
// Created by romain on 01/10/18. | |
// | |
#ifndef SERVER_HELLOCONNECTMESSAGE_H | |
#define SERVER_HELLOCONNECTMESSAGE_H | |
#include "../shared/BinaryWriter.h" | |
#include "../shared/BinaryReader.h" | |
#include "../shared/hook/NetworkMessage.h" | |
struct HelloConnectMessage : NetworkMessage { | |
static opcode constexpr OPCODE = 1; | |
HelloConnectMessage() : NetworkMessage(OPCODE) {} | |
void serialize(BinaryWriter &writer) const override { | |
writer & _4bytesIntTest & _8bytesUintTest & _stringTest; | |
} | |
void deserialize(BinaryReader &reader) override { | |
reader & _4bytesIntTest & _8bytesUintTest & _stringTest; | |
} | |
std::ostream &dump(std::ostream &o) const override { | |
return o << "HelloConnectMessage(" << | |
"4bytesIntTest=" << _4bytesIntTest << ", " << | |
"etc...)"; | |
} | |
boost::int32_t _4bytesIntTest; | |
boost::uint64_t _8bytesUintTest; | |
std::string _stringTest; | |
}; | |
#endif //SERVER_HELLOCONNECTMESSAGE_H |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment