summaryrefslogtreecommitdiff
path: root/protocols/WhatsApp/src/WASocketConnection.h
diff options
context:
space:
mode:
Diffstat (limited to 'protocols/WhatsApp/src/WASocketConnection.h')
-rw-r--r--protocols/WhatsApp/src/WASocketConnection.h41
1 files changed, 41 insertions, 0 deletions
diff --git a/protocols/WhatsApp/src/WASocketConnection.h b/protocols/WhatsApp/src/WASocketConnection.h
new file mode 100644
index 0000000000..f2d46415bc
--- /dev/null
+++ b/protocols/WhatsApp/src/WASocketConnection.h
@@ -0,0 +1,41 @@
+#if !defined(WASOCKETCONNECTION_H)
+#define WASOCKETCONNECTION_H
+
+#include "common.h"
+#include "WhatsAPI++/ISocketConnection.h"
+#include <iostream>
+#include "WhatsAPI++/WAException.h"
+#include "WhatsAPI++/WALogin.h"
+#include "WhatsAPI++/base64.h"
+#include <windows.h>
+
+class WASocketConnection : public ISocketConnection
+{
+public:
+ static HANDLE hNetlibUser;
+
+private:
+ int readSize;
+ int maxBufRead;
+ bool connected;
+
+ HANDLE hConn;
+
+public:
+ WASocketConnection(const std::string& dir, int port) throw (WAException);
+ void write(int i);
+ unsigned char read();
+ void flush();
+ void write(const std::vector<unsigned char>& b, int length);
+ void write(const std::vector<unsigned char>& bytes, int offset, int length);
+ int read(std::vector<unsigned char>& b, int off, int length);
+ void makeNonBlock();
+ int waitForRead();
+ void forceShutdown();
+
+ virtual ~WASocketConnection();
+ static void initNetwork(HANDLE hNetlibUser) throw (WAException);
+ static void quitNetwork();
+};
+
+#endif // WASOCKETCONNECTION_H \ No newline at end of file