diff options
Diffstat (limited to 'Swiften/Client/ClientSession.h')
-rw-r--r-- | Swiften/Client/ClientSession.h | 33 |
1 files changed, 23 insertions, 10 deletions
diff --git a/Swiften/Client/ClientSession.h b/Swiften/Client/ClientSession.h index 2205c8d..8a3deb4 100644 --- a/Swiften/Client/ClientSession.h +++ b/Swiften/Client/ClientSession.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. @@ -11,9 +11,10 @@ #include <boost/enable_shared_from_this.hpp> +#include <Swiften/Base/API.h> #include <Swiften/Base/Error.h> #include <Swiften/Session/SessionStream.h> #include <string> #include <Swiften/JID/JID.h> -#include <Swiften/Elements/Element.h> +#include <Swiften/Elements/ToplevelElement.h> #include <Swiften/StreamManagement/StanzaAckRequester.h> #include <Swiften/StreamManagement/StanzaAckResponder.h> @@ -22,6 +23,8 @@ namespace Swift { class ClientAuthenticator; class CertificateTrustChecker; + class IDNConverter; + class CryptoProvider; - class ClientSession : public boost::enable_shared_from_this<ClientSession> { + class SWIFTEN_API ClientSession : public boost::enable_shared_from_this<ClientSession> { public: enum State { @@ -53,5 +56,5 @@ namespace Swift { TLSClientCertificateError, TLSError, - StreamError, + StreamError } type; Error(Type type) : type(type) {} @@ -66,6 +69,6 @@ namespace Swift { ~ClientSession(); - static boost::shared_ptr<ClientSession> create(const JID& jid, boost::shared_ptr<SessionStream> stream) { - return boost::shared_ptr<ClientSession>(new ClientSession(jid, stream)); + static boost::shared_ptr<ClientSession> create(const JID& jid, boost::shared_ptr<SessionStream> stream, IDNConverter* idnConverter, CryptoProvider* crypto) { + return boost::shared_ptr<ClientSession>(new ClientSession(jid, stream, idnConverter, crypto)); } @@ -92,5 +95,7 @@ namespace Swift { bool getStreamManagementEnabled() const { - return stanzaAckRequester_; + // Explicitly convert to bool. In C++11, it would be cleaner to + // compare to nullptr. + return static_cast<bool>(stanzaAckRequester_); } @@ -99,4 +104,8 @@ namespace Swift { } + std::vector<Certificate::ref> getPeerCertificateChain() const { + return stream->getPeerCertificateChain(); + } + const JID& getLocalJID() const { return localJID; @@ -127,5 +136,7 @@ namespace Swift { ClientSession( const JID& jid, - boost::shared_ptr<SessionStream>); + boost::shared_ptr<SessionStream>, + IDNConverter* idnConverter, + CryptoProvider* crypto); void finishSession(Error::Type error); @@ -138,5 +149,5 @@ namespace Swift { void sendStreamHeader(); - void handleElement(boost::shared_ptr<Element>); + void handleElement(boost::shared_ptr<ToplevelElement>); void handleStreamStart(const ProtocolHeader&); void handleStreamClosed(boost::shared_ptr<Swift::Error>); @@ -151,5 +162,5 @@ namespace Swift { void ack(unsigned int handledStanzasCount); void continueAfterTLSEncrypted(); - void checkTrustOrFinish(Certificate::ref certificate, boost::shared_ptr<CertificateVerificationError> error); + void checkTrustOrFinish(const std::vector<Certificate::ref>& certificateChain, boost::shared_ptr<CertificateVerificationError> error); private: @@ -157,4 +168,6 @@ namespace Swift { State state; boost::shared_ptr<SessionStream> stream; + IDNConverter* idnConverter; + CryptoProvider* crypto; bool allowPLAINOverNonTLS; bool useStreamCompression; |