summaryrefslogtreecommitdiff
path: root/webproxytrans.h
diff options
context:
space:
mode:
authorJavier <dev.git@javispedro.com>2015-12-15 02:42:46 +0100
committerJavier <dev.git@javispedro.com>2015-12-15 02:42:46 +0100
commit2bb9a14110d909af1894426d456237bfc0b60ad4 (patch)
tree71ac5a40e0d0934ead3ceff120e9201b7a61d686 /webproxytrans.h
parent5abd8e0359cfa1dc2437427f2f0446d8801441cb (diff)
downloadsapd-2bb9a14110d909af1894426d456237bfc0b60ad4.tar.gz
sapd-2bb9a14110d909af1894426d456237bfc0b60ad4.zip
implement the WebProxy agent
Diffstat (limited to 'webproxytrans.h')
-rw-r--r--webproxytrans.h42
1 files changed, 42 insertions, 0 deletions
diff --git a/webproxytrans.h b/webproxytrans.h
new file mode 100644
index 0000000..950c7b9
--- /dev/null
+++ b/webproxytrans.h
@@ -0,0 +1,42 @@
+#ifndef WEBPROXYTRANS_H
+#define WEBPROXYTRANS_H
+
+#include <QtCore/QIODevice>
+#include <QtNetwork/QTcpSocket>
+
+class WebProxyConn;
+
+class WebProxyTrans : public QObject
+{
+ Q_OBJECT
+public:
+ explicit WebProxyTrans(int transactionId, bool tunnel, const QString &host, int port, WebProxyConn *conn);
+
+ int transactionId() const;
+
+ void write(const QByteArray &data);
+
+signals:
+ void connected();
+ void dataReceived(const QByteArray &data);
+ void error();
+ void disconnected();
+
+private slots:
+ void handleSocketConnected();
+ void handleSocketDataWritten(qint64 written);
+ void handleSocketDataReady();
+ void handleSocketDisconnected();
+
+private:
+ WebProxyConn* conn();
+ void writeFromBuffer();
+
+private:
+ int _transactionId;
+ bool _tunnel;
+ QTcpSocket *_socket;
+ QByteArray _outBuf;
+};
+
+#endif // WEBPROXYTRANS_H