14 #ifndef CONFIGMANAGER_H__
15 #define CONFIGMANAGER_H__
19 #include <gloox/gloox.h>
20 #include <gloox/jid.h>
21 #include <gloox/mutex.h>
34 class ServerEventHandler;
77 void bindDomain(
const std::string& domain,
const std::string& interface = gloox::EmptyString,
78 unsigned short port = 5222 );
86 void unbindDomain(
const std::string& domain,
const std::string& interface = gloox::EmptyString,
87 unsigned short port = 5222 );
94 bool addC2SInterface(
const std::string& interface = gloox::EmptyString,
95 unsigned short port = 5222 );
102 bool removeC2SInterface(
const std::string& interface = gloox::EmptyString,
103 unsigned short port = 5222 );
126 virtual bool checkDomain(
const std::string& domain,
const std::string& ip,
140 virtual void handleC2SListening(
bool yes );
153 virtual void handleS2SListening(
bool yes );
164 virtual void handleClientConnected(
const gloox::JID jid,
const std::string localIP,
int localPort,
165 const std::string remoteIP,
int remotePort );
176 virtual void handleClientDisconnected(
const gloox::JID jid, gloox::ConnectionError e,
177 gloox::StreamError se );
195 Interface(
const std::string& iface = gloox::EmptyString,
int p = 5222 )
196 : m_interface( iface ), m_port( p )
208 const std::string& interface()
const {
return m_interface; }
214 int port()
const {
return m_port; }
221 bool hasDomain(
const std::string& domain );
227 void removeDomain(
const std::string& domain )
229 m_domains.remove( domain );
236 void addDomain(
const std::string& domain )
238 m_domains.push_back( domain );
242 std::string m_interface;
245 gloox::StringList m_domains;
249 bool findInterface(
const std::string& interface,
unsigned short port );
251 typedef std::list<ConfigHandler*> ConfigHandlerList;
252 typedef std::list<Interface*> InterfaceList;
253 typedef std::list<ServerEventHandler*> ServerEventHandlerList;
255 ConfigHandlerList m_configHandlers;
256 InterfaceList m_c2sInterfaces;
257 ServerEventHandlerList m_eventHandlers;
259 gloox::util::Mutex m_c2sInterfacesMutex;
260 gloox::util::Mutex m_configHandlersMutex;
261 gloox::util::Mutex m_eventHandlersMutex;
263 const gloox::LogSink& m_logInstance;
269 #endif // CONFIGMANAGER_H__