diff options
author | tycho <work.tycho@gmail.com> | 2015-09-25 17:21:48 +0200 |
---|---|---|
committer | tycho <work.tycho@gmail.com> | 2015-12-18 19:14:34 +0100 |
commit | 9a6d0867b45d745db8d54ffd9fc95cf7f156d904 (patch) | |
tree | ce6d7f652c97737da1057081b09ce6c3cbf49c9d /src/Protocol/LengthenedProtocol.h | |
parent | Broken (diff) | |
download | cuberite-9a6d0867b45d745db8d54ffd9fc95cf7f156d904.tar cuberite-9a6d0867b45d745db8d54ffd9fc95cf7f156d904.tar.gz cuberite-9a6d0867b45d745db8d54ffd9fc95cf7f156d904.tar.bz2 cuberite-9a6d0867b45d745db8d54ffd9fc95cf7f156d904.tar.lz cuberite-9a6d0867b45d745db8d54ffd9fc95cf7f156d904.tar.xz cuberite-9a6d0867b45d745db8d54ffd9fc95cf7f156d904.tar.zst cuberite-9a6d0867b45d745db8d54ffd9fc95cf7f156d904.zip |
Diffstat (limited to 'src/Protocol/LengthenedProtocol.h')
-rw-r--r-- | src/Protocol/LengthenedProtocol.h | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/src/Protocol/LengthenedProtocol.h b/src/Protocol/LengthenedProtocol.h new file mode 100644 index 000000000..88550989d --- /dev/null +++ b/src/Protocol/LengthenedProtocol.h @@ -0,0 +1,26 @@ + +#pragma once +#include "Protocol.h" + +class cLengthenedProtocol : public cProtocol +{ +public: + cLengthenedProtocol(AString a_LogID) : + cProtocol(a_LogID), + m_ReceivedData(32 KiB) + { + } + +protected: + virtual cProtocolError DataReceived(const char * a_Data, size_t a_Size, std::vector<std::unique_ptr<cClientAction>> & a_Actions) override WARN_UNUSED; + /** This method should append the actions from incoming packets to a_Action */ + virtual cProtocolError OnDataAddedToBuffer(cByteBuffer & a_Buffer, std::vector<std::unique_ptr<cClientAction>> & a_Action) WARN_UNUSED = 0; + +private: + + /** Buffer for the received data */ + cByteBuffer m_ReceivedData; + + /** Adds the received (unencrypted) data to m_ReceivedData, parses complete packets, appends to a_Actions */ + cProtocolError AddReceivedData(const char * a_Data, size_t a_Size, std::vector<std::unique_ptr<cClientAction>> & a_Actions) WARN_UNUSED; +}; |