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 --- webproxyconn.cc | 27 ++++++++++++++++++++++++--- 1 file changed, 24 insertions(+), 3 deletions(-) (limited to 'webproxyconn.cc') 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"; } -- cgit v1.2.3