diff options
author | tycho <work.tycho@gmail.com> | 2015-09-27 16:18:31 +0200 |
---|---|---|
committer | tycho <work.tycho@gmail.com> | 2015-12-18 19:14:34 +0100 |
commit | 50186579737c12f11bea815d5fb8db732c6ff3c6 (patch) | |
tree | 7ca89ced1321b2bcff243d16818f93db02ca3b25 /src/Protocol/ProtocolRecognizer.h | |
parent | broken 2 (diff) | |
download | cuberite-50186579737c12f11bea815d5fb8db732c6ff3c6.tar cuberite-50186579737c12f11bea815d5fb8db732c6ff3c6.tar.gz cuberite-50186579737c12f11bea815d5fb8db732c6ff3c6.tar.bz2 cuberite-50186579737c12f11bea815d5fb8db732c6ff3c6.tar.lz cuberite-50186579737c12f11bea815d5fb8db732c6ff3c6.tar.xz cuberite-50186579737c12f11bea815d5fb8db732c6ff3c6.tar.zst cuberite-50186579737c12f11bea815d5fb8db732c6ff3c6.zip |
Diffstat (limited to 'src/Protocol/ProtocolRecognizer.h')
-rw-r--r-- | src/Protocol/ProtocolRecognizer.h | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/src/Protocol/ProtocolRecognizer.h b/src/Protocol/ProtocolRecognizer.h index 98dd95b17..5cbe8f2c3 100644 --- a/src/Protocol/ProtocolRecognizer.h +++ b/src/Protocol/ProtocolRecognizer.h @@ -38,8 +38,7 @@ public: PROTO_VERSION_1_8_0 = 47, } ; - cProtocolRecognizer(cClientHandle * a_Client); - virtual ~cProtocolRecognizer(); + cProtocolRecognizer(AString a_LogID); /** Translates protocol version number into protocol version text: 49 -> "1.4.4" */ static AString GetVersionTextFromInt(int a_ProtocolVersion); @@ -133,21 +132,25 @@ public: virtual void SendData(const char * a_Data, size_t a_Size) override; + cProtocolError HandleHandshake(cByteBuffer & a_ByteBuffer, std::vector<std::unique_ptr<cClientAction>> & a_Actions) override WARN_UNUSED; + protected: /** The recognized protocol */ - cProtocol * m_Protocol; + std::unique_ptr<cProtocol> m_Protocol; /** Buffer for the incoming data until we recognize the protocol */ cByteBuffer m_Buffer; + + AString m_LogID; /** Tries to recognize protocol based on m_Buffer contents; returns true if recognized */ - bool TryRecognizeProtocol(void); + cProtocolError TryRecognizeProtocol(std::vector<std::unique_ptr<cClientAction>> & a_Actions); /** Tries to recognize a protocol in the lengthed family (1.7+), based on m_Buffer; returns true if recognized. The packet length and type have already been read, type is 0 The number of bytes remaining in the packet is passed as a_PacketLengthRemaining. */ - bool TryRecognizeLengthedProtocol(UInt32 a_PacketLengthRemaining); + cProtocolError TryRecognizeLengthedProtocol(UInt32 a_PacketLengthRemaining, std::vector<std::unique_ptr<cClientAction>> & a_Actions); /** Sends a single packet contained within the cPacketizer class. The cPacketizer's destructor calls this to send the contained packet; protocol may transform the data (compression in 1.8 etc). */ |