From 702e018ca9e780bb076033ce5d1d370d4eb7319e Mon Sep 17 00:00:00 2001 From: Javier Date: Mon, 14 Dec 2015 01:52:17 +0100 Subject: properly handle data frames with sequence numbers --- saprotocol.h | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) (limited to 'saprotocol.h') diff --git a/saprotocol.h b/saprotocol.h index 443206b..79c6bcd 100644 --- a/saprotocol.h +++ b/saprotocol.h @@ -83,7 +83,7 @@ public: }; struct Frame { - quint8 protocolVersion; + quint8 protocolVersion; // Always 0 so far. FrameType type; quint16 sessionId; QByteArray data; @@ -93,6 +93,20 @@ public: static QByteArray packFrame(const Frame& frame); static QByteArray packFrame(quint16 sessionId, const QByteArray &data); + + struct DataFrame { + bool withSeqNum; // (not actually present in frame) + // The following fields are only present if "withSeqNum": + quint16 seqNum; // Monotonically increasing, but only for certain sessions... + quint8 unk_1; // No idea, seems to be always 0 + QByteArray data; + }; + + static DataFrame unpackDataFrame(const QByteArray &data, bool withSeqNum); + static QByteArray packDataFrame(const DataFrame& frame); + + /* Default session messages */ + enum DefaultSessionMessageType { ServiceConnectionRequest = 1, ServiceConnectionResponse = 2, @@ -156,6 +170,8 @@ public: static ServiceTerminationResponseFrame unpackServiceTerminationResponseFrame(const QByteArray &data); static QByteArray packServiceTerminationResponseFrame(const ServiceTerminationResponseFrame &frame); + /* Capability discovery messages */ + static const QLatin1String capabilityDiscoveryProfile; static const quint16 capabilityDiscoveryChannel = 255; static const quint16 capabilityDiscoveryAgentId = 0xFFFF; -- cgit v1.2.3