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++/BinTreeNodeWriter.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++/BinTreeNodeWriter.h')
| -rw-r--r-- | protocols/WhatsApp/src/WhatsAPI++/BinTreeNodeWriter.h | 71 | 
1 files changed, 71 insertions, 0 deletions
diff --git a/protocols/WhatsApp/src/WhatsAPI++/BinTreeNodeWriter.h b/protocols/WhatsApp/src/WhatsAPI++/BinTreeNodeWriter.h new file mode 100644 index 0000000000..20faaea4e8 --- /dev/null +++ b/protocols/WhatsApp/src/WhatsAPI++/BinTreeNodeWriter.h @@ -0,0 +1,71 @@ +/*
 + * BinTreeNodeWriter.h
 + *
 + *  Created on: 26/06/2012
 + *      Author: Antonio
 + */
 +
 +
 +#ifndef BINTREENODEWRITER_H_
 +#define BINTREENODEWRITER_H_
 +
 +#include <string>
 +#include "ProtocolTreeNode.h"
 +#include "ISocketConnection.h"
 +#include "ByteArray.h"
 +#include "IMutex.h"
 +#include "WAConnection.h"
 +
 +using namespace std;
 +
 +#define STREAM_START 1
 +#define	STREAM_END 2
 +#define LIST_EMPTY 0
 +#define	LIST_8 248
 +#define	LIST_16 249
 +#define	JID_PAIR 250
 +#define	BINARY_8 252
 +#define	BINARY_24 253
 +#define	TOKEN_8 254
 +
 +#include <map>
 +
 +class WAConnection;
 +
 +class BinTreeNodeWriter {
 +private:
 +	WAConnection* conn;
 +	map<string,int> tokenMap;
 +	ISocketConnection *realOut;
 +	ByteArrayOutputStream *out;
 +	IMutex* mutex;
 +	int dataBegin;
 +
 +	void writeListStart(int i);
 +	void writeInt8(int v);
 +	void writeInt16(int v, ISocketConnection* out);
 +	void writeInt16(int v, ByteArrayOutputStream* out);
 +	void writeInt16(int v);
 +	void writeAttributes(std::map<string, string>* attributes);
 +	void writeString(const std::string& tag);
 +	void writeJid(std::string* user, const std::string& server);
 +	void writeToken(int intValue);
 +	void writeBytes(unsigned char* bytes, int length);
 +	void writeInt24(int v);
 +    void writeInternal(ProtocolTreeNode* node);
 +    void writeDummyHeader();
 +    void processBuffer();
 +
 +public:
 +	BinTreeNodeWriter(WAConnection* conn, ISocketConnection* connection, const char** dictionary, const int dictionarysize, IMutex* mutex);
 +	void streamStart(std::string domain, std::string resource);
 +	void flushBuffer(bool flushNetwork);
 +	void flushBuffer(bool flushNetwork, int startingOffset);
 +	void streamEnd();
 +	void write(ProtocolTreeNode* node);
 +	void write(ProtocolTreeNode* node, bool needsFlush);
 +
 +	virtual ~BinTreeNodeWriter();
 +};
 +
 +#endif /* BINTREENODEWRITER_H_ */
  | 
