diff options
author | Fishbone <fishbone@miranda-ng.org> | 2013-06-02 16:19:21 +0000 |
---|---|---|
committer | Fishbone <fishbone@miranda-ng.org> | 2013-06-02 16:19:21 +0000 |
commit | ab7e0b08fa8c31cf1d468ab4b3c660e2b1836811 (patch) | |
tree | 52977603ea0f431adff16573d3d5b46a95843c7f /protocols/WhatsApp/src/WhatsAPI++/BinTreeNodeReader.h | |
parent | 8320783f99419db1e40346fdb292c19ee008948b (diff) |
Added WhatsApp-protocol
git-svn-id: http://svn.miranda-ng.org/main/trunk@4861 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols/WhatsApp/src/WhatsAPI++/BinTreeNodeReader.h')
-rw-r--r-- | protocols/WhatsApp/src/WhatsAPI++/BinTreeNodeReader.h | 76 |
1 files changed, 76 insertions, 0 deletions
diff --git a/protocols/WhatsApp/src/WhatsAPI++/BinTreeNodeReader.h b/protocols/WhatsApp/src/WhatsAPI++/BinTreeNodeReader.h new file mode 100644 index 0000000000..61b70b218b --- /dev/null +++ b/protocols/WhatsApp/src/WhatsAPI++/BinTreeNodeReader.h @@ -0,0 +1,76 @@ +/*
+ * BinTreeNodeReader.h
+ *
+ * Created on: 26/06/2012
+ * Author: Antonio
+ */
+#ifndef BINTREENODEREADER_H_
+#define BINTREENODEREADER_H_
+
+#include "ProtocolTreeNode.h"
+#include "ISocketConnection.h"
+#include "ByteArray.h"
+#include "WAConnection.h"
+#include <string>
+#include <vector>
+#include <map>
+
+#define BUFFER_SIZE 512
+
+class WAConnection;
+
+enum ReadType {STRING, ARRAY};
+
+class ReadData {
+public:
+ ReadData() {};
+ virtual ~ReadData() {};
+
+ ReadType type;
+ void * data;
+};
+
+class BinTreeNodeReader {
+private:
+ const char** tokenMap;
+ int tokenmapsize;
+ ISocketConnection *rawIn;
+ ByteArrayInputStream* in;
+ std::vector<unsigned char>* buf;
+ int readSize;
+ WAConnection* conn;
+
+ ProtocolTreeNode* nextTreeInternal();
+ bool isListTag(int b);
+ void decodeStream(int flags, int offset, int length);
+ std::map<string,string>* readAttributes(int attribCount);
+ std::vector<ProtocolTreeNode*>* readList(int token);
+ int readListSize(int token);
+ std::vector<ProtocolTreeNode*>* readList();
+ ReadData* readString();
+ ReadData* readString(int token);
+ static void fillArray(std::vector<unsigned char>& buff, int len, ByteArrayInputStream* in);
+ static void fillArray(std::vector<unsigned char>& buff, int len, ISocketConnection* in);
+ std::string* objectAsString(ReadData* o);
+ std::string* readStringAsString();
+ std::string* readStringAsString(int token);
+ std::string getToken(int token);
+ void getTopLevelStream();
+ static int readInt8(ByteArrayInputStream* in);
+ static int readInt8(ISocketConnection* in);
+ static int readInt16(ByteArrayInputStream* in);
+ static int readInt16(ISocketConnection* in);
+ static int readInt24(ByteArrayInputStream* in);
+ static int readInt24(ISocketConnection* in);
+
+
+public:
+ BinTreeNodeReader(WAConnection* conn, ISocketConnection* connection, const char** dictionary, const int dictionarysize);
+ virtual ~BinTreeNodeReader();
+ ProtocolTreeNode* nextTree();
+ void streamStart();
+
+};
+
+#endif /* BINTREENODEREADER_H_ */
+
|