diff options
Diffstat (limited to 'webproxyconn.cc')
-rw-r--r-- | webproxyconn.cc | 27 |
1 files changed, 24 insertions, 3 deletions
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"; } |