2
Copyright (c) 2013 by Jakob Schroeter <js@camaya.net>
3
This file is part of the gloox library. http://camaya.net/gloox
5
This software is distributed under a license. The full license
6
agreement can be found in the file LICENSE in this distribution.
7
This software may not be copied, modified, sold or distributed
8
other than expressed in the named license agreement.
10
This software is distributed without any warranty.
14
#ifndef JINGLESESSIONMANAGER_H__
15
#define JINGLESESSIONMANAGER_H__
18
#include "iqhandler.h"
19
#include "jinglepluginfactory.h"
35
* @brief The SessionManager is responsible for creating and destroying Jingle sessions, as well as for delegating incoming
36
* IQs to their respective sessions. This is part of Jingle (@xep{0166}).
38
* @note The classes in the Jingle namespace implement the signaling part of Jingle only.
39
* Establishing connections to a remote entity or transfering data outside the XMPP channel
40
* is out of scope of gloox.
42
* To use Jingle with gloox you should first instantiate a Jingle::SessionManager. The SessionManager will
43
* let you create new Jingle sessions and notify the respective handler about incoming Jingle session requests.
44
* It will also announce generic Jingle support via Disco. You have to register any
45
* @link gloox::Jingle::Plugin Jingle plugins @endlink you want to use using registerPlugin().
46
* These will automatically announce any additional features via Disco.
48
* Use createSession() to create a new Session.
50
* Implement SessionHandler::handleIncomingSession() to receive incoming session requests.
52
* Use discardSession() to get rid of a session. Do not delete a session manually.
54
* There is no limit to the number of concurrent sessions.
56
* @author Jakob Schroeter <js@camaya.net>
59
class GLOOX_API SessionManager : public IqHandler
63
* Creates new instance. There should be only one SessionManager per ClientBase.
64
* @param parent A ClientBase instance used for sending and receiving.
65
* @param sh A session handler that will be notified about incoming session requests.
66
* Only handleIncomingSession() will be called in that handler.
68
SessionManager( ClientBase* parent, SessionHandler* sh );
73
virtual ~SessionManager();
76
* Registers an empty Plugin as a template with the manager.
77
* @param plugin The plugin to register.
79
void registerPlugin( Plugin* plugin );
82
* Lets you create a new Jingle session.
83
* @param callee The remote entity's JID.
84
* @param handler The handler responsible for handling events assicoated with the new session.
85
* @return The new session.
86
* @note You should not delete a session yourself. Instead, pass it to discardSession().
88
Session* createSession( const JID& callee, SessionHandler* handler );
91
* Removes a given session from the nternal queue and deletes it.
92
* @param session The session to delete.
94
void discardSession( Session* session );
97
// reimplemented from IqHandler
98
virtual bool handleIq( const IQ& iq );
100
// reimplemented from IqHandler
101
virtual void handleIqID( const IQ& /*iq*/, int /*context*/ ) {}
104
typedef std::list<Jingle::Session*> SessionList;
106
SessionList m_sessions;
107
ClientBase* m_parent;
108
SessionHandler* m_handler;
109
PluginFactory m_factory;
117
#endif // JINGLESESSIONMANAGER_H__