summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sappeer.cc4
-rw-r--r--saprotocol.cc31
-rw-r--r--webproxyagent.cc11
3 files changed, 37 insertions, 9 deletions
diff --git a/sappeer.cc b/sappeer.cc
index 60e7660..b9f0136 100644
--- a/sappeer.cc
+++ b/sappeer.cc
@@ -233,6 +233,7 @@ void SAPPeer::handleDefaultSessionMessage(const QByteArray &message)
}
if (!ok) {
+ // Send a negative status code message back
SAProtocol::ServiceConnectionResponseFrame resp;
resp.messageType = SAProtocol::ServiceConnectionResponse;
resp.acceptorId = req.acceptorId;
@@ -256,7 +257,8 @@ void SAPPeer::handleDefaultSessionMessage(const QByteArray &message)
// TODO set socket QoS parameters
conn->setSocket(s.channelId, socket);
- qDebug() << " opening channel" << s.sessionId << s.channelId << "payload=" << s.payloadType;
+ qDebug() << " opening channel" << s.channelId << "as session" << s.sessionId;
+ qDebug() << " payload=" << s.payloadType << "qos=" << s.qosType << "prio=" << s.qosPriority << "rate=" << s.qosDataRate;
_sessions.insert(s.sessionId, socket);
}
diff --git a/saprotocol.cc b/saprotocol.cc
index 541f0af..c580f12 100644
--- a/saprotocol.cc
+++ b/saprotocol.cc
@@ -247,20 +247,30 @@ SAProtocol::ServiceConnectionRequestFrame SAProtocol::unpackServiceConnectionReq
frame.profile = QString::fromUtf8(&data.constData()[offset], marker - offset);
offset = marker + 1;
- int num_sessions = read<quint16>(data, offset);
+ const int num_sessions = read<quint16>(data, offset);
+ frame.sessions.reserve(num_sessions);
- while (num_sessions > 0) {
+ for (int i = 0; i < num_sessions; i++) {
ServiceConnectionRequestSession session;
session.sessionId = read<quint16>(data, offset);
+ frame.sessions.append(session);
+ }
+
+ for (int i = 0; i < num_sessions; i++) {
+ ServiceConnectionRequestSession &session = frame.sessions[i];
session.channelId = read<quint16>(data, offset);
+ }
+
+ for (int i = 0; i < num_sessions; i++) {
+ ServiceConnectionRequestSession &session = frame.sessions[i];
session.qosType = read<quint8>(data, offset);
session.qosDataRate = read<quint8>(data, offset);
session.qosPriority = read<quint8>(data, offset);
- session.payloadType = read<quint8>(data, offset);
-
- frame.sessions.append(session);
+ }
- num_sessions--;
+ for (int i = 0; i < num_sessions; i++) {
+ ServiceConnectionRequestSession &session = frame.sessions[i];
+ session.payloadType = read<quint8>(data, offset);
}
return frame;
@@ -281,10 +291,19 @@ QByteArray SAProtocol::packServiceConnectionRequestFrame(const ServiceConnection
foreach (const ServiceConnectionRequestSession &session, frame.sessions) {
append<quint16>(data, session.sessionId);
+ }
+
+ foreach (const ServiceConnectionRequestSession &session, frame.sessions) {
append<quint16>(data, session.channelId);
+ }
+
+ foreach (const ServiceConnectionRequestSession &session, frame.sessions) {
append<quint8>(data, session.qosType);
append<quint8>(data, session.qosDataRate);
append<quint8>(data, session.qosPriority);
+ }
+
+ foreach (const ServiceConnectionRequestSession &session, frame.sessions) {
append<quint8>(data, session.payloadType);
}
diff --git a/webproxyagent.cc b/webproxyagent.cc
index 186912f..126cd75 100644
--- a/webproxyagent.cc
+++ b/webproxyagent.cc
@@ -46,11 +46,18 @@ void WebProxyAgent::registerServices(SAPManager *manager)
service.setVersion(2, 0);
service.setConnectionTimeout(0);
+ channel.setChannelId(501);
+ channel.setPayloadType(SAPChannelInfo::PayloadBinary);
+ channel.setQoSType(SAPChannelInfo::QoSReliabilityEnable);
+ channel.setQoSDataRate(SAPChannelInfo::QoSDataRateLow);
+ channel.setQoSPriority(SAPChannelInfo::QoSPriorityLow);
+ service.addChannel(channel);
+
channel.setChannelId(502);
channel.setPayloadType(SAPChannelInfo::PayloadBinary);
- channel.setQoSType(SAPChannelInfo::QoSRestricted);
+ channel.setQoSType(SAPChannelInfo::QoSReliabilityEnable);
channel.setQoSDataRate(SAPChannelInfo::QoSDataRateLow);
- channel.setQoSPriority(SAPChannelInfo::QoSPriorityHigh);
+ channel.setQoSPriority(SAPChannelInfo::QoSPriorityLow);
service.addChannel(channel);
manager->registerServiceAgent(service, instance());