diff options
Diffstat (limited to 'Swiften/Session')
-rw-r--r-- | Swiften/Session/BOSHSessionStream.cpp | 21 | ||||
-rw-r--r-- | Swiften/Session/BOSHSessionStream.h | 12 | ||||
-rw-r--r-- | Swiften/Session/BasicSessionStream.cpp | 17 | ||||
-rw-r--r-- | Swiften/Session/BasicSessionStream.h | 11 | ||||
-rw-r--r-- | Swiften/Session/Session.cpp | 4 | ||||
-rw-r--r-- | Swiften/Session/Session.h | 13 | ||||
-rw-r--r-- | Swiften/Session/SessionStream.cpp | 2 | ||||
-rw-r--r-- | Swiften/Session/SessionStream.h | 12 |
8 files changed, 45 insertions, 47 deletions
diff --git a/Swiften/Session/BOSHSessionStream.cpp b/Swiften/Session/BOSHSessionStream.cpp index 237a394..63e35b8 100644 --- a/Swiften/Session/BOSHSessionStream.cpp +++ b/Swiften/Session/BOSHSessionStream.cpp @@ -1,4 +1,4 @@ /* - * Copyright (c) 2011 Kevin Smith + * Copyright (c) 2011-2014 Kevin Smith * Licensed under the GNU General Public License v3. * See Documentation/Licenses/GPLv3.txt for more information. @@ -42,9 +42,4 @@ BOSHSessionStream::BOSHSessionStream( const SafeString& boshHTTPConnectProxyAuthPassword) : available(false), - payloadParserFactories(payloadParserFactories), - payloadSerializers(payloadSerializers), - tlsContextFactory(tlsContextFactory), - timerFactory(timerFactory), - xmlParserFactory(xmlParserFactory), eventLoop(eventLoop), firstHeader(true) { @@ -52,5 +47,5 @@ BOSHSessionStream::BOSHSessionStream( boost::mt19937 random; boost::uniform_int<unsigned long long> dist(0, (1LL<<53) - 1); - random.seed(time(NULL)); + random.seed(static_cast<unsigned int>(time(NULL))); unsigned long long initialRID = boost::variate_generator<boost::mt19937&, boost::uniform_int<unsigned long long> >(random, dist)(); @@ -62,5 +57,5 @@ BOSHSessionStream::BOSHSessionStream( connectionPool->onBOSHDataWritten.connect(boost::bind(&BOSHSessionStream::handlePoolBOSHDataWritten, this, _1)); - xmppLayer = new XMPPLayer(payloadParserFactories, payloadSerializers, xmlParserFactory, ClientStreamType); + xmppLayer = new XMPPLayer(payloadParserFactories, payloadSerializers, xmlParserFactory, ClientStreamType, true); xmppLayer->onStreamStart.connect(boost::bind(&BOSHSessionStream::handleStreamStartReceived, this, _1)); xmppLayer->onElement.connect(boost::bind(&BOSHSessionStream::handleElementReceived, this, _1)); @@ -92,5 +87,5 @@ void BOSHSessionStream::handlePoolXMPPDataRead(const SafeByteArray& data) { } -void BOSHSessionStream::writeElement(boost::shared_ptr<Element> element) { +void BOSHSessionStream::writeElement(boost::shared_ptr<ToplevelElement> element) { assert(available); xmppLayer->writeElement(element); @@ -130,4 +125,8 @@ Certificate::ref BOSHSessionStream::getPeerCertificate() const { } +std::vector<Certificate::ref> BOSHSessionStream::getPeerCertificateChain() const { + return std::vector<Certificate::ref>(); +} + boost::shared_ptr<CertificateVerificationError> BOSHSessionStream::getPeerCertificateVerificationError() const { return boost::shared_ptr<CertificateVerificationError>(); @@ -158,5 +157,5 @@ void BOSHSessionStream::handleStreamStartReceived(const ProtocolHeader& header) } -void BOSHSessionStream::handleElementReceived(boost::shared_ptr<Element> element) { +void BOSHSessionStream::handleElementReceived(boost::shared_ptr<ToplevelElement> element) { onElementReceived(element); } @@ -214,3 +213,3 @@ void BOSHSessionStream::handlePoolBOSHDataWritten(const SafeByteArray& data) { } -}; +} diff --git a/Swiften/Session/BOSHSessionStream.h b/Swiften/Session/BOSHSessionStream.h index 497d391..e74d534 100644 --- a/Swiften/Session/BOSHSessionStream.h +++ b/Swiften/Session/BOSHSessionStream.h @@ -1,4 +1,4 @@ /* - * Copyright (c) 2011 Kevin Smith + * Copyright (c) 2011-2014 Kevin Smith * Licensed under the GNU General Public License v3. * See Documentation/Licenses/GPLv3.txt for more information. @@ -51,5 +51,5 @@ namespace Swift { virtual void writeHeader(const ProtocolHeader& header); - virtual void writeElement(boost::shared_ptr<Element>); + virtual void writeElement(boost::shared_ptr<ToplevelElement>); virtual void writeFooter(); virtual void writeData(const std::string& data); @@ -62,4 +62,5 @@ namespace Swift { virtual bool isTLSEncrypted(); virtual Certificate::ref getPeerCertificate() const; + virtual std::vector<Certificate::ref> getPeerCertificateChain() const; virtual boost::shared_ptr<CertificateVerificationError> getPeerCertificateVerificationError() const; virtual ByteArray getTLSFinishMessage() const; @@ -72,5 +73,5 @@ namespace Swift { void handleXMPPError(); void handleStreamStartReceived(const ProtocolHeader&); - void handleElementReceived(boost::shared_ptr<Element>); + void handleElementReceived(boost::shared_ptr<ToplevelElement>); void handlePoolXMPPDataRead(const SafeByteArray& data); void handleXMPPLayerDataWritten(const SafeByteArray& data); @@ -87,9 +88,4 @@ namespace Swift { BOSHConnectionPool* connectionPool; bool available; - PayloadParserFactoryCollection* payloadParserFactories; - PayloadSerializerCollection* payloadSerializers; - TLSContextFactory* tlsContextFactory; - TimerFactory* timerFactory; - XMLParserFactory* xmlParserFactory; XMPPLayer* xmppLayer; ProtocolHeader streamHeader; diff --git a/Swiften/Session/BasicSessionStream.cpp b/Swiften/Session/BasicSessionStream.cpp index b49ffc9..5b4b7d5 100644 --- a/Swiften/Session/BasicSessionStream.cpp +++ b/Swiften/Session/BasicSessionStream.cpp @@ -1,4 +1,4 @@ /* - * Copyright (c) 2010 Remko Tronçon + * Copyright (c) 2010-2014 Remko Tronçon * Licensed under the GNU General Public License v3. * See Documentation/Licenses/GPLv3.txt for more information. @@ -31,9 +31,6 @@ BasicSessionStream::BasicSessionStream( available(false), connection(connection), - payloadParserFactories(payloadParserFactories), - payloadSerializers(payloadSerializers), tlsContextFactory(tlsContextFactory), timerFactory(timerFactory), - streamType(streamType), compressionLayer(NULL), tlsLayer(NULL), @@ -58,5 +55,5 @@ BasicSessionStream::~BasicSessionStream() { if (tlsLayer) { - tlsLayer->onError.disconnect(boost::bind(&BasicSessionStream::handleTLSError, this)); + tlsLayer->onError.disconnect(boost::bind(&BasicSessionStream::handleTLSError, this, _1)); tlsLayer->onConnected.disconnect(boost::bind(&BasicSessionStream::handleTLSConnected, this)); delete tlsLayer; @@ -81,5 +78,5 @@ void BasicSessionStream::writeHeader(const ProtocolHeader& header) { } -void BasicSessionStream::writeElement(boost::shared_ptr<Element> element) { +void BasicSessionStream::writeElement(boost::shared_ptr<ToplevelElement> element) { assert(available); xmppLayer->writeElement(element); @@ -130,4 +127,8 @@ Certificate::ref BasicSessionStream::getPeerCertificate() const { } +std::vector<Certificate::ref> BasicSessionStream::getPeerCertificateChain() const { + return tlsLayer->getPeerCertificateChain(); +} + boost::shared_ptr<CertificateVerificationError> BasicSessionStream::getPeerCertificateVerificationError() const { return tlsLayer->getPeerCertificateVerificationError(); @@ -168,5 +169,5 @@ void BasicSessionStream::handleStreamStartReceived(const ProtocolHeader& header) } -void BasicSessionStream::handleElementReceived(boost::shared_ptr<Element> element) { +void BasicSessionStream::handleElementReceived(boost::shared_ptr<ToplevelElement> element) { onElementReceived(element); } @@ -207,3 +208,3 @@ void BasicSessionStream::handleDataWritten(const SafeByteArray& data) { } -}; +} diff --git a/Swiften/Session/BasicSessionStream.h b/Swiften/Session/BasicSessionStream.h index e1f32f4..e5f8004 100644 --- a/Swiften/Session/BasicSessionStream.h +++ b/Swiften/Session/BasicSessionStream.h @@ -1,4 +1,4 @@ /* - * Copyright (c) 2010 Remko Tronçon + * Copyright (c) 2010-2014 Remko Tronçon * Licensed under the GNU General Public License v3. * See Documentation/Licenses/GPLv3.txt for more information. @@ -45,5 +45,5 @@ namespace Swift { virtual void writeHeader(const ProtocolHeader& header); - virtual void writeElement(boost::shared_ptr<Element>); + virtual void writeElement(boost::shared_ptr<ToplevelElement>); virtual void writeFooter(); virtual void writeData(const std::string& data); @@ -56,4 +56,6 @@ namespace Swift { virtual bool isTLSEncrypted(); virtual Certificate::ref getPeerCertificate() const; + virtual std::vector<Certificate::ref> getPeerCertificateChain() const; + virtual boost::shared_ptr<CertificateVerificationError> getPeerCertificateVerificationError() const; virtual ByteArray getTLSFinishMessage() const; @@ -69,5 +71,5 @@ namespace Swift { void handleTLSError(boost::shared_ptr<TLSError>); void handleStreamStartReceived(const ProtocolHeader&); - void handleElementReceived(boost::shared_ptr<Element>); + void handleElementReceived(boost::shared_ptr<ToplevelElement>); void handleDataRead(const SafeByteArray& data); void handleDataWritten(const SafeByteArray& data); @@ -76,9 +78,6 @@ namespace Swift { bool available; boost::shared_ptr<Connection> connection; - PayloadParserFactoryCollection* payloadParserFactories; - PayloadSerializerCollection* payloadSerializers; TLSContextFactory* tlsContextFactory; TimerFactory* timerFactory; - StreamType streamType; XMPPLayer* xmppLayer; ConnectionLayer* connectionLayer; diff --git a/Swiften/Session/Session.cpp b/Swiften/Session/Session.cpp index acc73f1..de54c5f 100644 --- a/Swiften/Session/Session.cpp +++ b/Swiften/Session/Session.cpp @@ -1,4 +1,4 @@ /* - * Copyright (c) 2010 Remko Tronçon + * Copyright (c) 2010-2014 Remko Tronçon * Licensed under the GNU General Public License v3. * See Documentation/Licenses/GPLv3.txt for more information. @@ -77,5 +77,5 @@ void Session::initializeStreamStack() { } -void Session::sendElement(boost::shared_ptr<Element> stanza) { +void Session::sendElement(boost::shared_ptr<ToplevelElement> stanza) { xmppLayer->writeElement(stanza); } diff --git a/Swiften/Session/Session.h b/Swiften/Session/Session.h index c937430..63a6a02 100644 --- a/Swiften/Session/Session.h +++ b/Swiften/Session/Session.h @@ -1,4 +1,4 @@ /* - * Copyright (c) 2010 Remko Tronçon + * Copyright (c) 2010-2014 Remko Tronçon * Licensed under the GNU General Public License v3. * See Documentation/Licenses/GPLv3.txt for more information. @@ -12,6 +12,7 @@ #include <boost/enable_shared_from_this.hpp> +#include <Swiften/Base/API.h> #include <Swiften/JID/JID.h> -#include <Swiften/Elements/Element.h> +#include <Swiften/Elements/ToplevelElement.h> #include <Swiften/Network/Connection.h> #include <Swiften/StreamStack/ConnectionLayer.h> @@ -28,5 +29,5 @@ namespace Swift { class XMLParserFactory; - class Session : public boost::enable_shared_from_this<Session> { + class SWIFTEN_API Session : public boost::enable_shared_from_this<Session> { public: enum SessionError { @@ -54,5 +55,5 @@ namespace Swift { void finishSession(); - void sendElement(boost::shared_ptr<Element>); + void sendElement(boost::shared_ptr<ToplevelElement>); const JID& getLocalJID() const { @@ -64,5 +65,5 @@ namespace Swift { } - boost::signal<void (boost::shared_ptr<Element>)> onElementReceived; + boost::signal<void (boost::shared_ptr<ToplevelElement>)> onElementReceived; boost::signal<void (const boost::optional<SessionError>&)> onSessionFinished; boost::signal<void (const SafeByteArray&)> onDataWritten; @@ -82,5 +83,5 @@ namespace Swift { virtual void handleSessionStarted() {} virtual void handleSessionFinished(const boost::optional<SessionError>&) {} - virtual void handleElement(boost::shared_ptr<Element>) = 0; + virtual void handleElement(boost::shared_ptr<ToplevelElement>) = 0; virtual void handleStreamStart(const ProtocolHeader&) = 0; diff --git a/Swiften/Session/SessionStream.cpp b/Swiften/Session/SessionStream.cpp index 0d73b63..7378680 100644 --- a/Swiften/Session/SessionStream.cpp +++ b/Swiften/Session/SessionStream.cpp @@ -12,3 +12,3 @@ SessionStream::~SessionStream() { } -}; +} diff --git a/Swiften/Session/SessionStream.h b/Swiften/Session/SessionStream.h index 32cb6b6..2394295 100644 --- a/Swiften/Session/SessionStream.h +++ b/Swiften/Session/SessionStream.h @@ -1,4 +1,4 @@ /* - * Copyright (c) 2010-2012 Remko Tronçon + * Copyright (c) 2010-2014 Remko Tronçon * Licensed under the GNU General Public License v3. * See Documentation/Licenses/GPLv3.txt for more information. @@ -11,6 +11,7 @@ #include <boost/optional.hpp> +#include <Swiften/Base/API.h> #include <Swiften/Elements/ProtocolHeader.h> -#include <Swiften/Elements/Element.h> +#include <Swiften/Elements/ToplevelElement.h> #include <Swiften/Base/Error.h> #include <Swiften/Base/SafeByteArray.h> @@ -20,5 +21,5 @@ namespace Swift { - class SessionStream { + class SWIFTEN_API SessionStream { public: class SessionStreamError : public Swift::Error { @@ -46,5 +47,5 @@ namespace Swift { virtual void writeHeader(const ProtocolHeader& header) = 0; virtual void writeFooter() = 0; - virtual void writeElement(boost::shared_ptr<Element>) = 0; + virtual void writeElement(boost::shared_ptr<ToplevelElement>) = 0; virtual void writeData(const std::string& data) = 0; @@ -68,4 +69,5 @@ namespace Swift { virtual Certificate::ref getPeerCertificate() const = 0; + virtual std::vector<Certificate::ref> getPeerCertificateChain() const = 0; virtual boost::shared_ptr<CertificateVerificationError> getPeerCertificateVerificationError() const = 0; @@ -73,5 +75,5 @@ namespace Swift { boost::signal<void (const ProtocolHeader&)> onStreamStartReceived; - boost::signal<void (boost::shared_ptr<Element>)> onElementReceived; + boost::signal<void (boost::shared_ptr<ToplevelElement>)> onElementReceived; boost::signal<void (boost::shared_ptr<Error>)> onClosed; boost::signal<void ()> onTLSEncrypted; |