summaryrefslogtreecommitdiff
path: root/webproxyconn.h
blob: 705428dc8bce43129fe3acada1ebed5d518e6583 (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
36
37
38
39
40
41
42
43
#ifndef WEBPROXYCONN_H
#define WEBPROXYCONN_H

#include <QtCore/QObject>
#include "sapconnection.h"
#include "sapsocket.h"

class WebProxyConn : public QObject
{
	Q_OBJECT

public:
	WebProxyConn(SAPConnection *conn, QObject *parent = 0);

protected:
	enum RequestMessageType {
		RequestStartTransaction = 1,
		RequestCancelTransaction = 4
	};

	struct RequestMessage {
		quint8 command; // Seems to be always 1
		quint8 subCommand; // Seems to be always 1
		RequestMessageType type;
		quint8 transactionId; // Monotonically increasing
		QByteArray payload;
	};

	static RequestMessage unpackRequestMessage(const QByteArray &data);

	void handleStartTransaction(const RequestMessage &msg);
	void handleCancelTransaction(const RequestMessage &msg);

private slots:
	void handleMessageReceived();

private:
	SAPConnection *_conn;
	SAPSocket *_in;
	SAPSocket *_out;
};

#endif // WEBPROXYCONN_H