glooxd  0.3-svn
Public Member Functions | List of all members
ConfigManager Class Reference

#include <configmanager.h>

Public Member Functions

 ConfigManager (const gloox::LogSink &_logInstance)
virtual ~ConfigManager ()
void registerConfigHandler (ConfigHandler *ch)
void registerServerEventHandler (ServerEventHandler *seh)
void bindDomain (const std::string &domain, const std::string &interface=gloox::EmptyString, unsigned short port=5222)
void unbindDomain (const std::string &domain, const std::string &interface=gloox::EmptyString, unsigned short port=5222)
bool addC2SInterface (const std::string &interface=gloox::EmptyString, unsigned short port=5222)
bool removeC2SInterface (const std::string &interface=gloox::EmptyString, unsigned short port=5222)
void rebind ()
void shutdown ()
virtual bool checkDomain (const std::string &domain, const std::string &ip, int port)
virtual void handleC2SListening (bool yes)
virtual void handleS2SListening (bool yes)
virtual void handleClientConnected (const gloox::JID jid, const std::string localIP, int localPort, const std::string remoteIP, int remotePort)
virtual void handleClientDisconnected (const gloox::JID jid, gloox::ConnectionError e, gloox::StreamError se)

Detailed Description

The manager for the server configuration.

Author
Jakob Schroeter js@ca.nosp@m.maya.nosp@m..net
Since
0.2

Definition at line 42 of file configmanager.h.

Constructor & Destructor Documentation

ConfigManager ( const gloox::LogSink &  _logInstance)

Constructor.

Parameters
_logInstanceThe LogSink to use.

Definition at line 37 of file configmanager.cpp.

~ConfigManager ( )
virtual

Virtual destructor.

Definition at line 42 of file configmanager.cpp.

Member Function Documentation

bool addC2SInterface ( const std::string &  interface = gloox::EmptyString,
unsigned short  port = 5222 
)

Adds a C2S interface that can then be used with bindDomain().

Parameters
interfaceThe interface to bind to.
portThe port to listen on.

Definition at line 111 of file configmanager.cpp.

void bindDomain ( const std::string &  domain,
const std::string &  interface = gloox::EmptyString,
unsigned short  port = 5222 
)

Use this function to add a domain to a previously added interface. That is, use addC2SInterface() first, the bindDomain() (using the same interface/port).

Parameters
domainA domain to handle.
interfaceA local interface to bind to. Default: all local interfaces.
portA local port to listen on. Default: 5222

Definition at line 67 of file configmanager.cpp.

bool checkDomain ( const std::string &  domain,
const std::string &  ip,
int  port 
)
virtual

Checks if the given domain is valid for the given interface/port.

Parameters
domainThe domain to check.
interfaceThe local interface.
portThe local port.

Definition at line 178 of file configmanager.cpp.

void handleC2SListening ( bool  yes)
virtual

This function is called with an parameter of true exactly once when one or more c2s interfaces have been added. I.e. it is called when the number of listening interfaces is exactly 1. It is called with a parameter of false when interfaces have been removed and the number of listening interfaces is now exactly 0.

Parameters
yesWhether or not there is at least one listening interface.

Definition at line 197 of file configmanager.cpp.

void handleClientConnected ( const gloox::JID  jid,
const std::string  localIP,
int  localPort,
const std::string  remoteIP,
int  remotePort 
)
virtual

This function is called when a client connected, authenticated, and requested creation of a session.

Parameters
jidThe client's full JID.
localIPThe local IP the client connected to.
localPortThe local port the client connected to.
remoteIPThe remote IP the client connected from.
remotePortThe remote port the client connected from.

Definition at line 209 of file configmanager.cpp.

void handleClientDisconnected ( const gloox::JID  jid,
gloox::ConnectionError  e,
gloox::StreamError  se 
)
virtual

This function is called when a client disconnected or got disconnected. It will only be called for client connections that handleClientConnected() has been called for previously.

Parameters
jidThe client's full JID.
eA connection error.
seA stanza error.

Definition at line 218 of file configmanager.cpp.

void handleS2SListening ( bool  yes)
virtual

This function is called with an parameter of true exactly once when one or more s2s interfaces have been added. I.e. it is called when the number of listening interfaces is exactly 1. It is called with a parameter of false when interfaces have been removed and the number of listening interfaces is now exactly 0.

Parameters
yesWhether or not there is at least one listening interface.

Definition at line 203 of file configmanager.cpp.

void rebind ( )

Causes the server to rebind its local interfaces. This is useful if one or more listening interfaces are 'wildcards', ie. the server is listening on all local interfaces, and an interface has been added to or removed from the system.

Definition at line 159 of file configmanager.cpp.

void registerConfigHandler ( ConfigHandler ch)

Registers a new ConfigHandler.

Parameters
chA new ConfigHandler.

Definition at line 47 of file configmanager.cpp.

void registerServerEventHandler ( ServerEventHandler seh)

Registers a new ServerEventHandler.

Parameters
chA new ConfigHandler.

Definition at line 57 of file configmanager.cpp.

bool removeC2SInterface ( const std::string &  interface = gloox::EmptyString,
unsigned short  port = 5222 
)

Stops listening on the given interface/port.

Parameters
interfaceThe interface.
portThe port.

Definition at line 127 of file configmanager.cpp.

void shutdown ( )

Prepares a system shutdown, that is, stops all listening interfaces and disconnects any connected clients, indicating that the disconnect is due to a server shutdown.

Definition at line 172 of file configmanager.cpp.

void unbindDomain ( const std::string &  domain,
const std::string &  interface = gloox::EmptyString,
unsigned short  port = 5222 
)

Use this function to remove a domain from the given interface.

Parameters
domainA domain to remove.
interfaceA local interface.
portA local port.

Definition at line 89 of file configmanager.cpp.


The documentation for this class was generated from the following files: