summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJavier <dev.git@javispedro.com>2015-12-13 15:45:19 +0100
committerJavier <dev.git@javispedro.com>2015-12-13 15:45:19 +0100
commitc48db815c7847b88907aae58f2a1af5c20d9dc8f (patch)
tree362293b45a491b671a59a92f7b2f545774e6e796
parent97c93d800287a21b971b763d58c1eebb30ece071 (diff)
downloadsapd-c48db815c7847b88907aae58f2a1af5c20d9dc8f.tar.gz
sapd-c48db815c7847b88907aae58f2a1af5c20d9dc8f.zip
webproxy request packet, but there is something wrong
-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();