summaryrefslogtreecommitdiff
path: root/protocols/WhatsApp/src/WASocketConnection.h
blob: 23beac6ef24abe06938ebc1256464a3b8fcdbc27 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#if !defined(WASOCKETCONNECTION_H)
#define WASOCKETCONNECTION_H

#include "WhatsAPI++/ISocketConnection.h"
#include "WhatsAPI++/WAException.h"

class WASocketConnection : public ISocketConnection
{
	int readSize;
	int maxBufRead;
	bool connected;

	HANDLE hConn;

public:
	WASocketConnection(const std::string &dir, int port) throw (WAException);
	virtual ~WASocketConnection();

	virtual void write(int i);
	virtual unsigned char read();
	virtual int read(std::vector<unsigned char>& b, int off, int length);
	virtual int read(unsigned char*, int length);
	virtual void flush();
	virtual void write(const std::vector<unsigned char>& b, int length);
	// virtual void write(const std::vector<unsigned char>& bytes, int offset, int length);
	virtual void makeNonBlock();
	virtual void forceShutdown();
	
	virtual void log(const char *prefix, const char *str);

	static void initNetwork(HNETLIBUSER hNetlibUser) throw (WAException);
	static void quitNetwork();
};

#endif // WASOCKETCONNECTION_H