diff options
author | Remko Tronçon <git@el-tramo.be> | 2009-11-10 21:24:03 (GMT) |
---|---|---|
committer | Remko Tronçon <git@el-tramo.be> | 2009-11-10 21:24:03 (GMT) |
commit | 54781ce12f7654f8136e645d4ebc5934d90c6bea (patch) | |
tree | 90bad869f9f64d57a3c0af209b83a538a47c7762 /Swiften/Session/BasicSessionStream.h | |
parent | fcfac59db5cb4503554f2b30854b2e91928296f6 (diff) | |
parent | 66ced3654ad295478b33d3e4f1716f66ab4048b5 (diff) | |
download | swift-contrib-54781ce12f7654f8136e645d4ebc5934d90c6bea.zip swift-contrib-54781ce12f7654f8136e645d4ebc5934d90c6bea.tar.bz2 |
Refactored session management.
Diffstat (limited to 'Swiften/Session/BasicSessionStream.h')
-rw-r--r-- | Swiften/Session/BasicSessionStream.h | 22 |
1 files changed, 19 insertions, 3 deletions
diff --git a/Swiften/Session/BasicSessionStream.h b/Swiften/Session/BasicSessionStream.h index bf92bbb..0cb50eb 100644 --- a/Swiften/Session/BasicSessionStream.h +++ b/Swiften/Session/BasicSessionStream.h @@ -1,6 +1,7 @@ #pragma once #include <boost/shared_ptr.hpp> +#include <boost/enable_shared_from_this.hpp> #include "Swiften/Network/Connection.h" #include "Swiften/Session/SessionStream.h" @@ -17,7 +18,7 @@ namespace Swift { class BasicSessionStream : public SessionStream, - public boost::BOOST_SIGNALS_NAMESPACE::trackable { + public boost::enable_shared_from_this<BasicSessionStream> { public: BasicSessionStream( boost::shared_ptr<Connection> connection, @@ -27,25 +28,40 @@ namespace Swift { ); ~BasicSessionStream(); + void initialize(); + + virtual bool isAvailable(); + virtual void writeHeader(const ProtocolHeader& header); virtual void writeElement(boost::shared_ptr<Element>); + virtual void writeFooter(); virtual bool supportsTLSEncryption(); virtual void addTLSEncryption(); - virtual void addWhitespacePing(); + virtual void setWhitespacePingEnabled(bool); virtual void resetXMPPParser(); private: + void handleConnectionError(const boost::optional<Connection::Error>& error); void handleXMPPError(); + void handleTLSConnected(); void handleTLSError(); + void handleStreamStartReceived(const ProtocolHeader&); + void handleElementReceived(boost::shared_ptr<Element>); + void handleDataRead(const ByteArray& data); + void handleDataWritten(const ByteArray& data); private: + bool available; + boost::shared_ptr<Connection> connection; + PayloadParserFactoryCollection* payloadParserFactories; + PayloadSerializerCollection* payloadSerializers; + TLSLayerFactory* tlsLayerFactory; boost::shared_ptr<XMPPLayer> xmppLayer; boost::shared_ptr<ConnectionLayer> connectionLayer; StreamStack* streamStack; - TLSLayerFactory* tlsLayerFactory; boost::shared_ptr<TLSLayer> tlsLayer; boost::shared_ptr<WhitespacePingLayer> whitespacePingLayer; }; |