summaryrefslogtreecommitdiffstats
path: root/source/Protocol132.cpp
diff options
context:
space:
mode:
authormadmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6>2012-08-30 11:56:59 +0200
committermadmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6>2012-08-30 11:56:59 +0200
commitf5fe723b2a704da475b24a594fd59f448cf133a3 (patch)
tree6965c6df44d2b042ca62034119466127fd01b5da /source/Protocol132.cpp
parentcProtocol handles the initial handshake up to player login (diff)
downloadcuberite-f5fe723b2a704da475b24a594fd59f448cf133a3.tar
cuberite-f5fe723b2a704da475b24a594fd59f448cf133a3.tar.gz
cuberite-f5fe723b2a704da475b24a594fd59f448cf133a3.tar.bz2
cuberite-f5fe723b2a704da475b24a594fd59f448cf133a3.tar.lz
cuberite-f5fe723b2a704da475b24a594fd59f448cf133a3.tar.xz
cuberite-f5fe723b2a704da475b24a594fd59f448cf133a3.tar.zst
cuberite-f5fe723b2a704da475b24a594fd59f448cf133a3.zip
Diffstat (limited to 'source/Protocol132.cpp')
-rw-r--r--source/Protocol132.cpp65
1 files changed, 65 insertions, 0 deletions
diff --git a/source/Protocol132.cpp b/source/Protocol132.cpp
new file mode 100644
index 000000000..faff57004
--- /dev/null
+++ b/source/Protocol132.cpp
@@ -0,0 +1,65 @@
+
+// Protocol132.cpp
+
+// Implements the cProtocol132 class representing the release 1.3.2 protocol (#39)
+
+#include "Globals.h"
+#include "Protocol132.h"
+
+
+
+
+
+#define HANDLE_PACKET_READ(Proc, Type, Var) \
+ Type Var; \
+ { \
+ if (!m_ReceivedData.Proc(Var)) \
+ { \
+ return PARSE_INCOMPLETE; \
+ } \
+ }
+
+
+
+
+typedef unsigned char Byte;
+
+
+
+
+
+///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+// cProtocol132:
+
+cProtocol132::cProtocol132(cClientHandle * a_Client) :
+ super(a_Client)
+{
+}
+
+
+
+
+
+void cProtocol132::DataReceived(const char * a_Data, int a_Size)
+{
+ // TODO: Protocol decryption
+ super::DataReceived(a_Data, a_Size);
+}
+
+
+
+
+
+int cProtocol132::ParseHandshake(void)
+{
+ HANDLE_PACKET_READ(ReadByte, Byte, ProtocolVersion);
+ HANDLE_PACKET_READ(ReadBEUTF16String16, AString, Username);
+ HANDLE_PACKET_READ(ReadBEUTF16String16, AString, ServerHost);
+ HANDLE_PACKET_READ(ReadBEInt, int, ServerPort);
+ m_Username = Username;
+ return PARSE_OK;
+}
+
+
+
+