From c48db815c7847b88907aae58f2a1af5c20d9dc8f Mon Sep 17 00:00:00 2001 From: Javier Date: Sun, 13 Dec 2015 15:45:19 +0100 Subject: webproxy request packet, but there is something wrong --- hostmanageragent.cc | 4 ++-- webproxyconn.cc | 27 ++++++++++++++++++++++++--- webproxyconn.h | 11 ++++++++++- 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 #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(data, offset); + msg.subCommand = read(data, offset); + msg.type = read(data, offset); + msg.transactionId = read(data, offset); + + const quint32 len = read(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(); -- cgit v1.2.3