summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Swiften/Elements/JingleS5BTransportPayload.h11
-rw-r--r--Swiften/Parser/PayloadParsers/JingleS5BTransportMethodPayloadParser.cpp3
-rw-r--r--Swiften/Parser/PayloadParsers/UnitTest/JingleParserTest.cpp8
-rw-r--r--Swiften/Serializer/PayloadSerializers/JingleS5BTransportPayloadSerializer.cpp9
-rw-r--r--Swiften/Serializer/PayloadSerializers/UnitTest/JingleSerializersTest.cpp2
5 files changed, 31 insertions, 2 deletions
diff --git a/Swiften/Elements/JingleS5BTransportPayload.h b/Swiften/Elements/JingleS5BTransportPayload.h
index 0a40d31..f6132a1 100644
--- a/Swiften/Elements/JingleS5BTransportPayload.h
+++ b/Swiften/Elements/JingleS5BTransportPayload.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2011 Isode Limited.
+ * Copyright (c) 2011-2015 Isode Limited.
* All rights reserved.
* See the COPYING file for more information.
*/
@@ -82,6 +82,14 @@ namespace Swift {
return activatedCID;
}
+ void setDstAddr(const std::string& addr) {
+ dstAddr = addr;
+ }
+
+ const std::string& getDstAddr() const {
+ return dstAddr;
+ }
+
void setCandidateError(bool hasError) {
candidateError = hasError;
}
@@ -106,6 +114,7 @@ namespace Swift {
std::string candidateUsedCID;
std::string activatedCID;
+ std::string dstAddr;
bool candidateError;
bool proxyError;
};
diff --git a/Swiften/Parser/PayloadParsers/JingleS5BTransportMethodPayloadParser.cpp b/Swiften/Parser/PayloadParsers/JingleS5BTransportMethodPayloadParser.cpp
index d7b5bb0..dc05352 100644
--- a/Swiften/Parser/PayloadParsers/JingleS5BTransportMethodPayloadParser.cpp
+++ b/Swiften/Parser/PayloadParsers/JingleS5BTransportMethodPayloadParser.cpp
@@ -5,7 +5,7 @@
*/
/*
-* Copyright (c) 2014 Isode Limited.
+* Copyright (c) 2014-2015 Isode Limited.
* All rights reserved.v3.
* See the COPYING file for more information.
*/
@@ -34,6 +34,7 @@ namespace Swift {
SWIFT_LOG(warning) << "Unknown S5B mode; falling back to defaul!";
getPayloadInternal()->setMode(JingleS5BTransportPayload::TCPMode);
}
+ getPayloadInternal()->setDstAddr(attributes.getAttributeValue("dstaddr").get_value_or(""));
} else if (level == 1) {
if (element == "candidate") {
JingleS5BTransportPayload::Candidate candidate;
diff --git a/Swiften/Parser/PayloadParsers/UnitTest/JingleParserTest.cpp b/Swiften/Parser/PayloadParsers/UnitTest/JingleParserTest.cpp
index a6be599..9c166b2 100644
--- a/Swiften/Parser/PayloadParsers/UnitTest/JingleParserTest.cpp
+++ b/Swiften/Parser/PayloadParsers/UnitTest/JingleParserTest.cpp
@@ -4,6 +4,12 @@
* See Documentation/Licenses/BSD-simplified.txt for more information.
*/
+/*
+ * Copyright (c) 2015 Isode Limited.
+ * All rights reserved.
+ * See the COPYING file for more information.
+ */
+
#include <cppunit/extensions/HelperMacros.h>
#include <cppunit/extensions/TestFactoryRegistry.h>
@@ -540,6 +546,7 @@ class JingleParserTest : public CppUnit::TestFixture {
" <content creator='initiator' name='ex'>\n"
" <description xmlns='urn:xmpp:example'/>\n"
" <transport xmlns='urn:xmpp:jingle:transports:s5b:1'\n"
+ " dstaddr='1a12fb7bc625e55f3ed5b29a53dbe0e4aa7d80ba'\n"
" mode='tcp'\n"
" sid='vj3hs98y'>\n"
" <candidate cid='ht567dq'\n"
@@ -579,6 +586,7 @@ class JingleParserTest : public CppUnit::TestFixture {
CPPUNIT_ASSERT_EQUAL(std::string("vj3hs98y"), s5bPayload->getSessionID());
CPPUNIT_ASSERT_EQUAL(JingleS5BTransportPayload::TCPMode, s5bPayload->getMode());
+ CPPUNIT_ASSERT_EQUAL(std::string("1a12fb7bc625e55f3ed5b29a53dbe0e4aa7d80ba"), s5bPayload->getDstAddr());
CPPUNIT_ASSERT_EQUAL(false, s5bPayload->hasCandidateError());
CPPUNIT_ASSERT_EQUAL(false, s5bPayload->hasProxyError());
CPPUNIT_ASSERT_EQUAL(std::string(), s5bPayload->getActivated());
diff --git a/Swiften/Serializer/PayloadSerializers/JingleS5BTransportPayloadSerializer.cpp b/Swiften/Serializer/PayloadSerializers/JingleS5BTransportPayloadSerializer.cpp
index c753839..220d8dd 100644
--- a/Swiften/Serializer/PayloadSerializers/JingleS5BTransportPayloadSerializer.cpp
+++ b/Swiften/Serializer/PayloadSerializers/JingleS5BTransportPayloadSerializer.cpp
@@ -4,6 +4,12 @@
* See Documentation/Licenses/BSD-simplified.txt for more information.
*/
+/*
+ * Copyright (c) 2015 Isode Limited.
+ * All rights reserved.
+ * See the COPYING file for more information.
+ */
+
#include <Swiften/Serializer/PayloadSerializers/JingleS5BTransportPayloadSerializer.h>
#include <boost/shared_ptr.hpp>
@@ -25,6 +31,9 @@ std::string JingleS5BTransportPayloadSerializer::serializePayload(boost::shared_
XMLElement payloadXML("transport", "urn:xmpp:jingle:transports:s5b:1");
payloadXML.setAttribute("sid", payload->getSessionID());
payloadXML.setAttribute("mode", modeToString(payload->getMode()));
+ if (!payload->getDstAddr().empty()) {
+ payloadXML.setAttribute("dstaddr", payload->getDstAddr());
+ }
foreach(JingleS5BTransportPayload::Candidate candidate, payload->getCandidates()) {
boost::shared_ptr<XMLElement> candidateXML = boost::make_shared<XMLElement>("candidate");
diff --git a/Swiften/Serializer/PayloadSerializers/UnitTest/JingleSerializersTest.cpp b/Swiften/Serializer/PayloadSerializers/UnitTest/JingleSerializersTest.cpp
index 722c039..8d5bcb7 100644
--- a/Swiften/Serializer/PayloadSerializers/UnitTest/JingleSerializersTest.cpp
+++ b/Swiften/Serializer/PayloadSerializers/UnitTest/JingleSerializersTest.cpp
@@ -377,6 +377,7 @@ class JingleSerializersTest : public CppUnit::TestFixture {
" xmlns=\"urn:xmpp:jingle:1\">"
"<content creator=\"initiator\" name=\"ex\">"
"<transport"
+ " dstaddr=\"1a12fb7bc625e55f3ed5b29a53dbe0e4aa7d80ba\""
" mode=\"tcp\""
" sid=\"vj3hs98y\""
" xmlns=\"urn:xmpp:jingle:transports:s5b:1\">"
@@ -407,6 +408,7 @@ class JingleSerializersTest : public CppUnit::TestFixture {
JingleS5BTransportPayload::ref transport = boost::make_shared<JingleS5BTransportPayload>();
transport->setMode(JingleS5BTransportPayload::TCPMode);
+ transport->setDstAddr("1a12fb7bc625e55f3ed5b29a53dbe0e4aa7d80ba");
transport->setSessionID("vj3hs98y");
JingleS5BTransportPayload::Candidate candidate1;