summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--hostmanageragent.cc4
-rw-r--r--webproxyconn.cc27
-rw-r--r--webproxyconn.h11
3 files changed, 36 insertions, 6 deletions
diff --git a/hostmanageragent.cc b/hostmanageragent.cc
index 7ed890d..24f3cb1 100644
--- a/hostmanageragent.cc
+++ b/hostmanageragent.cc
@@ -48,8 +48,8 @@ void HostManagerAgent::registerServices(SAPManager *manager)
channel.setChannelId(103);
channel.setPayloadType(SAPChannelInfo::PayloadJson);
- channel.setQoSType(SAPChannelInfo::QoSRestricted);
- channel.setQoSDataRate(SAPChannelInfo::QoSDataRateHigh);
+ channel.setQoSType(SAPChannelInfo::QoSReliabilityDisable);
+ channel.setQoSDataRate(SAPChannelInfo::QoSDataRateLow);
channel.setQoSPriority(SAPChannelInfo::QoSPriorityHigh);
service.addChannel(channel);
diff --git a/webproxyconn.cc b/webproxyconn.cc
index a679803..d4fe6c7 100644
--- a/webproxyconn.cc
+++ b/webproxyconn.cc
@@ -1,10 +1,11 @@
#include <QtCore/QDebug>
#include "sappeer.h"
+#include "endianhelpers.h"
#include "webproxyconn.h"
WebProxyConn::WebProxyConn(SAPConnection *conn, QObject *parent)
- : QObject(parent), _conn(conn), _socket(conn->sockets().first())
+ : QObject(parent), _conn(conn), _socket(conn->getSocket(501))
{
connect(_conn, SIGNAL(disconnected()), SLOT(deleteLater()));
Q_ASSERT(_socket);
@@ -12,6 +13,25 @@ WebProxyConn::WebProxyConn(SAPConnection *conn, QObject *parent)
connect(_socket, SIGNAL(messageReceived()), SLOT(handleMessageReceived()));
}
+WebProxyConn::RequestMessage WebProxyConn::unpackRequestMessage(const QByteArray &data)
+{
+ RequestMessage msg;
+ int offset = 0;
+ msg.command = read<quint8>(data, offset);
+ msg.subCommand = read<quint8>(data, offset);
+ msg.type = read<quint8>(data, offset);
+ msg.transactionId = read<quint8>(data, offset);
+
+ const quint32 len = read<quint32>(data, offset);
+
+ qDebug() << "command=" << msg.command << "sub=" << msg.subCommand
+ << "type=" << msg.type << "transaction=" << msg.transactionId;
+
+ qDebug() << QString::fromUtf8(data.mid(offset, len));
+
+ return msg;
+}
+
void WebProxyConn::handleConnected()
{
qDebug() << "WebProxy socket now connected!";
@@ -20,6 +40,7 @@ void WebProxyConn::handleConnected()
void WebProxyConn::handleMessageReceived()
{
QByteArray data = _socket->receive();
-
- qDebug() << data << data.toHex();
+ qDebug() << data.toHex();
+ RequestMessage req = unpackRequestMessage(data);
+ qDebug() << "End of data";
}
diff --git a/webproxyconn.h b/webproxyconn.h
index 3a05ad3..533feeb 100644
--- a/webproxyconn.h
+++ b/webproxyconn.h
@@ -12,7 +12,16 @@ class WebProxyConn : public QObject
public:
WebProxyConn(SAPConnection *conn, QObject *parent = 0);
-private:
+protected:
+ struct RequestMessage {
+ quint8 command; // Seems to be always 1
+ quint8 subCommand;
+ quint8 type;
+ quint8 transactionId; // Monotonically increasing
+ QByteArray payload;
+ };
+
+ static RequestMessage unpackRequestMessage(const QByteArray &data);
private slots:
void handleConnected();