summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRemko Tronçon <git@el-tramo.be>2009-07-19 13:21:38 (GMT)
committerRemko Tronçon <git@el-tramo.be>2009-07-19 13:27:00 (GMT)
commita6fcd9e7aa12c5e00c61ff809e81fba14babd70c (patch)
treef65419f4f9a78a1db574f8fa792e745f7fbdf76c /Swiften/Session/Session.h
parent9ccf1973ec3e23e4ba061b774c3f3e3bde4f1040 (diff)
downloadswift-a6fcd9e7aa12c5e00c61ff809e81fba14babd70c.zip
swift-a6fcd9e7aa12c5e00c61ff809e81fba14babd70c.tar.bz2
Factor out common session stuff into Session class.
Diffstat (limited to 'Swiften/Session/Session.h')
-rw-r--r--Swiften/Session/Session.h32
1 files changed, 24 insertions, 8 deletions
diff --git a/Swiften/Session/Session.h b/Swiften/Session/Session.h
index bf8049a..b35179c 100644
--- a/Swiften/Session/Session.h
+++ b/Swiften/Session/Session.h
@@ -14,7 +14,7 @@ namespace Swift {
class ProtocolHeader;
class StreamStack;
class JID;
- class Stanza;
+ class Element;
class ByteArray;
class PayloadParserFactoryCollection;
class PayloadSerializerCollection;
@@ -22,9 +22,18 @@ namespace Swift {
class Session : public boost::enable_shared_from_this<Session> {
public:
- enum Error {
- ConnectionError,
- XMLError
+ enum SessionError {
+ ConnectionReadError,
+ ConnectionWriteError,
+ XMLError,
+ AuthenticationFailedError,
+ NoSupportedAuthMechanismsError,
+ UnexpectedElementError,
+ ResourceBindError,
+ SessionStartError,
+ TLSError,
+ ClientCertificateLoadError,
+ ClientCertificateError
};
Session(
@@ -35,18 +44,19 @@ namespace Swift {
void startSession();
void finishSession();
- void sendStanza(boost::shared_ptr<Stanza>);
+ void sendElement(boost::shared_ptr<Element>);
- boost::signal<void (boost::shared_ptr<Stanza>)> onStanzaReceived;
+ boost::signal<void (boost::shared_ptr<Element>)> onElementReceived;
boost::signal<void ()> onSessionStarted;
- boost::signal<void (const boost::optional<Error>&)> onSessionFinished;
+ boost::signal<void (const boost::optional<SessionError>&)> onSessionFinished;
boost::signal<void (const ByteArray&)> onDataWritten;
boost::signal<void (const ByteArray&)> onDataRead;
protected:
- void finishSession(const Error&);
+ void finishSession(const SessionError&);
virtual void handleSessionStarted() {}
+ virtual void handleSessionFinished(const boost::optional<SessionError>&) {}
virtual void handleElement(boost::shared_ptr<Element>) = 0;
virtual void handleStreamStart(const ProtocolHeader&) = 0;
@@ -56,11 +66,17 @@ namespace Swift {
return xmppLayer;
}
+ StreamStack* getStreamStack() const {
+ return streamStack;
+ }
+
void setInitialized();
bool isInitialized() const {
return initialized;
}
+ void setFinished();
+
private:
void handleDisconnected(const boost::optional<Connection::Error>& error);