diff options
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; }; |