summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'Swiften/Session')
-rw-r--r--Swiften/Session/BOSHSessionStream.cpp7
-rw-r--r--Swiften/Session/BOSHSessionStream.h11
-rw-r--r--Swiften/Session/BasicSessionStream.cpp10
-rw-r--r--Swiften/Session/BasicSessionStream.h5
4 files changed, 21 insertions, 12 deletions
diff --git a/Swiften/Session/BOSHSessionStream.cpp b/Swiften/Session/BOSHSessionStream.cpp
index eac493e..62942b9 100644
--- a/Swiften/Session/BOSHSessionStream.cpp
+++ b/Swiften/Session/BOSHSessionStream.cpp
@@ -1,5 +1,5 @@
1/* 1/*
2 * Copyright (c) 2011-2014 Isode Limited. 2 * Copyright (c) 2011-2015 Isode Limited.
3 * All rights reserved. 3 * All rights reserved.
4 * See the COPYING file for more information. 4 * See the COPYING file for more information.
5 */ 5 */
@@ -39,7 +39,8 @@ BOSHSessionStream::BOSHSessionStream(
39 const std::string& to, 39 const std::string& to,
40 const URL& boshHTTPConnectProxyURL, 40 const URL& boshHTTPConnectProxyURL,
41 const SafeString& boshHTTPConnectProxyAuthID, 41 const SafeString& boshHTTPConnectProxyAuthID,
42 const SafeString& boshHTTPConnectProxyAuthPassword) : 42 const SafeString& boshHTTPConnectProxyAuthPassword,
43 const TLSOptions& tlsOptions) :
43 available(false), 44 available(false),
44 eventLoop(eventLoop), 45 eventLoop(eventLoop),
45 firstHeader(true) { 46 firstHeader(true) {
@@ -49,7 +50,7 @@ BOSHSessionStream::BOSHSessionStream(
49 random.seed(static_cast<unsigned int>(time(NULL))); 50 random.seed(static_cast<unsigned int>(time(NULL)));
50 unsigned long long initialRID = boost::variate_generator<boost::mt19937&, boost::uniform_int<unsigned long long> >(random, dist)(); 51 unsigned long long initialRID = boost::variate_generator<boost::mt19937&, boost::uniform_int<unsigned long long> >(random, dist)();
51 52
52 connectionPool = new BOSHConnectionPool(boshURL, resolver, connectionFactory, xmlParserFactory, tlsContextFactory, timerFactory, eventLoop, to, initialRID, boshHTTPConnectProxyURL, boshHTTPConnectProxyAuthID, boshHTTPConnectProxyAuthPassword); 53 connectionPool = new BOSHConnectionPool(boshURL, resolver, connectionFactory, xmlParserFactory, tlsContextFactory, timerFactory, eventLoop, to, initialRID, boshHTTPConnectProxyURL, boshHTTPConnectProxyAuthID, boshHTTPConnectProxyAuthPassword, tlsOptions);
53 connectionPool->onSessionTerminated.connect(boost::bind(&BOSHSessionStream::handlePoolSessionTerminated, this, _1)); 54 connectionPool->onSessionTerminated.connect(boost::bind(&BOSHSessionStream::handlePoolSessionTerminated, this, _1));
54 connectionPool->onSessionStarted.connect(boost::bind(&BOSHSessionStream::handlePoolSessionStarted, this)); 55 connectionPool->onSessionStarted.connect(boost::bind(&BOSHSessionStream::handlePoolSessionStarted, this));
55 connectionPool->onXMPPDataRead.connect(boost::bind(&BOSHSessionStream::handlePoolXMPPDataRead, this, _1)); 56 connectionPool->onXMPPDataRead.connect(boost::bind(&BOSHSessionStream::handlePoolXMPPDataRead, this, _1));
diff --git a/Swiften/Session/BOSHSessionStream.h b/Swiften/Session/BOSHSessionStream.h
index e97436c..436b941 100644
--- a/Swiften/Session/BOSHSessionStream.h
+++ b/Swiften/Session/BOSHSessionStream.h
@@ -9,12 +9,14 @@
9#include <boost/shared_ptr.hpp> 9#include <boost/shared_ptr.hpp>
10 10
11#include <Swiften/Base/API.h> 11#include <Swiften/Base/API.h>
12#include <Swiften/Base/SafeString.h>
13#include <Swiften/Base/SafeByteArray.h> 12#include <Swiften/Base/SafeByteArray.h>
14#include <Swiften/Network/BOSHConnectionPool.h> 13#include <Swiften/Base/SafeString.h>
15#include <Swiften/Session/SessionStream.h>
16#include <Swiften/Elements/StreamType.h> 14#include <Swiften/Elements/StreamType.h>
17#include <Swiften/EventLoop/EventOwner.h> 15#include <Swiften/EventLoop/EventOwner.h>
16#include <Swiften/Network/BOSHConnectionPool.h>
17#include <Swiften/Session/SessionStream.h>
18#include <Swiften/TLS/TLSOptions.h>
19
18 20
19namespace Swift { 21namespace Swift {
20 class TimerFactory; 22 class TimerFactory;
@@ -43,7 +45,8 @@ namespace Swift {
43 const std::string& to, 45 const std::string& to,
44 const URL& boshHTTPConnectProxyURL, 46 const URL& boshHTTPConnectProxyURL,
45 const SafeString& boshHTTPConnectProxyAuthID, 47 const SafeString& boshHTTPConnectProxyAuthID,
46 const SafeString& boshHTTPConnectProxyAuthPassword 48 const SafeString& boshHTTPConnectProxyAuthPassword,
49 const TLSOptions& tlsOptions
47 ); 50 );
48 ~BOSHSessionStream(); 51 ~BOSHSessionStream();
49 52
diff --git a/Swiften/Session/BasicSessionStream.cpp b/Swiften/Session/BasicSessionStream.cpp
index 274d218..43f1c48 100644
--- a/Swiften/Session/BasicSessionStream.cpp
+++ b/Swiften/Session/BasicSessionStream.cpp
@@ -1,5 +1,5 @@
1/* 1/*
2 * Copyright (c) 2010-2014 Isode Limited. 2 * Copyright (c) 2010-2015 Isode Limited.
3 * All rights reserved. 3 * All rights reserved.
4 * See the COPYING file for more information. 4 * See the COPYING file for more information.
5 */ 5 */
@@ -27,14 +27,16 @@ BasicSessionStream::BasicSessionStream(
27 PayloadSerializerCollection* payloadSerializers, 27 PayloadSerializerCollection* payloadSerializers,
28 TLSContextFactory* tlsContextFactory, 28 TLSContextFactory* tlsContextFactory,
29 TimerFactory* timerFactory, 29 TimerFactory* timerFactory,
30 XMLParserFactory* xmlParserFactory) : 30 XMLParserFactory* xmlParserFactory,
31 const TLSOptions& tlsOptions) :
31 available(false), 32 available(false),
32 connection(connection), 33 connection(connection),
33 tlsContextFactory(tlsContextFactory), 34 tlsContextFactory(tlsContextFactory),
34 timerFactory(timerFactory), 35 timerFactory(timerFactory),
35 compressionLayer(NULL), 36 compressionLayer(NULL),
36 tlsLayer(NULL), 37 tlsLayer(NULL),
37 whitespacePingLayer(NULL) { 38 whitespacePingLayer(NULL),
39 tlsOptions_(tlsOptions) {
38 xmppLayer = new XMPPLayer(payloadParserFactories, payloadSerializers, xmlParserFactory, streamType); 40 xmppLayer = new XMPPLayer(payloadParserFactories, payloadSerializers, xmlParserFactory, streamType);
39 xmppLayer->onStreamStart.connect(boost::bind(&BasicSessionStream::handleStreamStartReceived, this, _1)); 41 xmppLayer->onStreamStart.connect(boost::bind(&BasicSessionStream::handleStreamStartReceived, this, _1));
40 xmppLayer->onElement.connect(boost::bind(&BasicSessionStream::handleElementReceived, this, _1)); 42 xmppLayer->onElement.connect(boost::bind(&BasicSessionStream::handleElementReceived, this, _1));
@@ -106,7 +108,7 @@ bool BasicSessionStream::supportsTLSEncryption() {
106 108
107void BasicSessionStream::addTLSEncryption() { 109void BasicSessionStream::addTLSEncryption() {
108 assert(available); 110 assert(available);
109 tlsLayer = new TLSLayer(tlsContextFactory); 111 tlsLayer = new TLSLayer(tlsContextFactory, tlsOptions_);
110 if (hasTLSCertificate() && !tlsLayer->setClientCertificate(getTLSCertificate())) { 112 if (hasTLSCertificate() && !tlsLayer->setClientCertificate(getTLSCertificate())) {
111 onClosed(boost::make_shared<SessionStreamError>(SessionStreamError::InvalidTLSCertificateError)); 113 onClosed(boost::make_shared<SessionStreamError>(SessionStreamError::InvalidTLSCertificateError));
112 } 114 }
diff --git a/Swiften/Session/BasicSessionStream.h b/Swiften/Session/BasicSessionStream.h
index 7832e42..811374a 100644
--- a/Swiften/Session/BasicSessionStream.h
+++ b/Swiften/Session/BasicSessionStream.h
@@ -14,6 +14,7 @@
14#include <Swiften/Session/SessionStream.h> 14#include <Swiften/Session/SessionStream.h>
15#include <Swiften/Elements/StreamType.h> 15#include <Swiften/Elements/StreamType.h>
16#include <Swiften/TLS/TLSError.h> 16#include <Swiften/TLS/TLSError.h>
17#include <Swiften/TLS/TLSOptions.h>
17 18
18namespace Swift { 19namespace Swift {
19 class TLSContextFactory; 20 class TLSContextFactory;
@@ -37,7 +38,8 @@ namespace Swift {
37 PayloadSerializerCollection* payloadSerializers, 38 PayloadSerializerCollection* payloadSerializers,
38 TLSContextFactory* tlsContextFactory, 39 TLSContextFactory* tlsContextFactory,
39 TimerFactory* whitespacePingLayerFactory, 40 TimerFactory* whitespacePingLayerFactory,
40 XMLParserFactory* xmlParserFactory 41 XMLParserFactory* xmlParserFactory,
42 const TLSOptions& tlsOptions
41 ); 43 );
42 ~BasicSessionStream(); 44 ~BasicSessionStream();
43 45
@@ -86,6 +88,7 @@ namespace Swift {
86 TLSLayer* tlsLayer; 88 TLSLayer* tlsLayer;
87 WhitespacePingLayer* whitespacePingLayer; 89 WhitespacePingLayer* whitespacePingLayer;
88 StreamStack* streamStack; 90 StreamStack* streamStack;
91 TLSOptions tlsOptions_;
89 }; 92 };
90 93
91} 94}