diff options
author | Jon Bergli Heier <snakebite@jvnv.net> | 2011-06-02 00:17:38 +0200 |
---|---|---|
committer | Jon Bergli Heier <snakebite@jvnv.net> | 2011-06-02 00:17:38 +0200 |
commit | 555f65ad7171511d74513b7055552a941a6fe0f2 (patch) | |
tree | 5a5e10f856574c74c32532e5555abee7b6a873bd /messages.h | |
parent | 1211f632092db824fb2c880063599f7642c34f30 (diff) |
Added a Message class with MessageType MSG_TYPE_MSG to transfer text strings.
Diffstat (limited to 'messages.h')
-rw-r--r-- | messages.h | 17 |
1 files changed, 16 insertions, 1 deletions
@@ -9,7 +9,8 @@ enum MessageType { MSG_TYPE_NONE = 0, MSG_TYPE_HELLO, MSG_TYPE_POS, - MSG_TYPE_CHUNK + MSG_TYPE_CHUNK, + MSG_TYPE_MSG }; class MessageBase { @@ -60,6 +61,20 @@ class Chunk : public MessageBase { void get_coords(int64_t& x, int64_t& y); }; +class Message : public MessageBase { + protected: + uint16_t str_len; + bool got_len; + + public: + Message(); + Message(std::string msg); + + virtual std::size_t payload_size(); + uint16_t get_len(); + std::string get_str(); +}; + } #endif |