Yate
JBServerEngine Class Reference

A Jabber server engine. More...

#include <yatejabber.h>

Inheritance diagram for JBServerEngine:
JBEngine DebugEnabler Mutex GenObject Lockable

Public Member Functions

 JBServerEngine (const char *name="jbserverengine")
 
 ~JBServerEngine ()
 
virtual void cleanup (bool final=false, bool waitTerminate=true)
 
virtual void buildStreamName (String &name, const JBStream *stream)
 
JBServerStreamfindServerStream (const String &local, const String &remote, bool out, bool auth=true)
 
JBServerStreamcreateServerStream (const String &local, const String &remote, const char *dbId=0, const char *dbKey=0, bool dbOnly=false, const NamedList *params=0)
 
JBServerStreamcreateCompStream (const String &name, const String &local, const String &remote, const NamedList *params=0)
 
JBClusterStreamfindClusterStream (const String &remote, JBClusterStream *skip=0)
 
virtual JBClusterStreamcreateClusterStream (const String &local, const String &remote, const NamedList *params=0)
 
unsigned int terminateClientStreams (const JabberID &jid, XMPPError::Type error=XMPPError::NoError, const char *reason=0)
 
- Public Member Functions inherited from JBEngine
 JBEngine (const char *name="jbengine")
 
virtual ~JBEngine ()
 
unsigned int streamReadBuffer () const
 
bool exiting () const
 
void setExiting ()
 
unsigned int redirectMax () const
 
bool hasClientTls () const
 
JBRemoteDomainDefremoteDomainDef (const String &domain)
 
virtual void destruct ()
 
virtual void initialize (const NamedList &params)
 
bool acceptConn (Socket *sock, SocketAddr &remote, JBStream::Type t, bool ssl=false)
 
virtual JBStreamfindStream (const String &id, JBStream::Type hint=JBStream::TypeCount)
 
ObjListfindClientStreams (bool in, const JabberID &jid, int flags=0xffffffff)
 
ObjListfindClientStreams (bool in, const JabberID &jid, const ObjList &resources, int flags=0xffffffff)
 
JBClientStreamfindClientStream (bool in, const JabberID &jid)
 
virtual unsigned int dropAll (JBStream::Type type=JBStream::TypeCount, const JabberID &local=JabberID::empty(), const JabberID &remote=JabberID::empty(), XMPPError::Type error=XMPPError::NoError, const char *reason=0)
 
virtual bool hasDomain (const String &domain)
 
virtual void processEvent (JBEvent *ev)
 
virtual void returnEvent (JBEvent *ev, XMPPError::Type error=XMPPError::NoError, const char *reason=0)
 
virtual void encryptStream (JBStream *stream)
 
virtual void connectStream (JBStream *stream)
 
virtual void compressStream (JBStream *stream, const String &formats)
 
virtual void buildDialbackKey (const String &id, const String &local, const String &remote, String &key)
 
bool checkDupId (JBStream *stream)
 
virtual void printXml (const JBStream *stream, bool send, XmlChild &xml) const
 
virtual void printXml (const JBStream *stream, bool send, XmlFragment &frag) const
 
- Public Member Functions inherited from DebugEnabler
 DebugEnabler (int level=TelEngine::debugLevel(), bool enabled=true)
 
int debugLevel () const
 
int debugLevel (int level)
 
bool debugEnabled () const
 
void debugEnabled (bool enable)
 
const char * debugName () const
 
bool debugAt (int level) const
 
bool debugChained () const
 
void debugChain (const DebugEnabler *chain=0)
 
void debugCopy (const DebugEnabler *original=0)
 
- Public Member Functions inherited from Mutex
 Mutex (bool recursive=false, const char *name=0)
 
 Mutex (const Mutex &original)
 
 ~Mutex ()
 
Mutexoperator= (const Mutex &original)
 
virtual bool lock (long maxwait=-1)
 
virtual bool unlock ()
 
virtual bool locked () const
 
const char * owner () const
 
bool recursive () const
 
- Public Member Functions inherited from Lockable
virtual ~Lockable ()
 
virtual bool check (long maxwait=-1)
 
virtual bool unlockAll ()
 
- Public Member Functions inherited from GenObject
 GenObject ()
 
virtual ~GenObject ()
 
virtual bool alive () const
 
virtual const StringtoString () const
 
virtual const StringtraceId () const
 
virtual void * getObject (const String &name) const
 
NamedCountergetObjCounter () const
 
NamedCountersetObjCounter (NamedCounter *counter)
 

Protected Member Functions

virtual void addStream (JBStream *stream)
 
virtual void removeStream (JBStream *stream, bool delObj=true)
 
virtual void stopStreamSets (bool waitTerminate=true)
 
virtual void getStreamList (RefPointer< JBStreamSetList > &list, int type)
 
virtual void getStreamListsType (int type, RefPointer< JBStreamSetList > &recv, RefPointer< JBStreamSetList > &process)
 
unsigned int getStreamIndex ()
 
- Protected Member Functions inherited from JBEngine
void getStreamLists (RefPointer< JBStreamSetList > list[JBStream::TypeCount], int type=JBStream::TypeCount)
 
JBStreamfindStream (const String &id, JBStreamSetList *list)
 
- Protected Member Functions inherited from DebugEnabler
void debugName (const char *name)
 

Protected Attributes

unsigned int m_streamIndex
 
JBStreamSetListm_c2sReceive
 
JBStreamSetListm_c2sProcess
 
JBStreamSetListm_s2sReceive
 
JBStreamSetListm_s2sProcess
 
JBStreamSetListm_compReceive
 
JBStreamSetListm_compProcess
 
JBStreamSetListm_clusterReceive
 
JBStreamSetListm_clusterProcess
 
- Protected Attributes inherited from JBEngine
bool m_exiting
 
JBRemoteDomainDef m_remoteDomain
 
ObjList m_remoteDomains
 
unsigned char m_restartMax
 
unsigned int m_restartUpdInterval
 
unsigned int m_setupTimeout
 
unsigned int m_startTimeout
 
unsigned int m_connectTimeout
 
unsigned int m_srvTimeout
 
unsigned int m_pingInterval
 
unsigned int m_pingTimeout
 
unsigned int m_idleTimeout
 
unsigned int m_pptTimeoutC2s
 
unsigned int m_pptTimeout
 
unsigned int m_streamReadBuffer
 
unsigned int m_maxIncompleteXml
 
unsigned int m_redirectMax
 
bool m_hasClientTls
 
int m_printXml
 
bool m_initialized
 

Additional Inherited Members

- Static Public Member Functions inherited from Mutex
static int count ()
 
static int locks ()
 
static bool efficientTimedLock ()
 
- Static Public Member Functions inherited from Lockable
static void wait (unsigned long maxwait)
 
static unsigned long wait ()
 
static void startUsingNow ()
 
static void enableSafety (bool safe=true)
 
static bool safety ()
 
- Static Public Member Functions inherited from GenObject
static void * getObject (const String &name, const GenObject *obj)
 
static bool getObjCounting ()
 
static void setObjCounting (bool enable)
 
static NamedCountergetObjCounter (const String &name, bool create=true)
 
static ObjListgetObjCounters ()
 

Detailed Description

A Jabber server engine.

This class implements a Jabber server engine

Constructor & Destructor Documentation

◆ JBServerEngine()

JBServerEngine ( const char * name = "jbserverengine")

Constructor

Parameters
nameEngine name

◆ ~JBServerEngine()

Destructor

Member Function Documentation

◆ addStream()

virtual void addStream ( JBStream * stream)
protectedvirtual

Add a stream to one of the stream lists

Parameters
streamThe stream to add

Reimplemented from JBEngine.

◆ buildStreamName()

virtual void buildStreamName ( String & name,
const JBStream * stream )
inlinevirtual

Build an internal stream name

Parameters
nameDestination buffer
streamStream requesting it

Reimplemented from JBEngine.

References getStreamIndex().

◆ cleanup()

virtual void cleanup ( bool final = false,
bool waitTerminate = true )
virtual

Terminate all streams. Stop all sets processors. Release memory if final

Parameters
finalTrue if called from destructor
waitTerminateTrue to wait for all streams to terminate

Reimplemented from JBEngine.

◆ createClusterStream()

virtual JBClusterStream * createClusterStream ( const String & local,
const String & remote,
const NamedList * params = 0 )
virtual

Create an outgoing cluster stream. This method is thread safe

Parameters
localLocal party domain
remoteRemote party domain
paramsOptional stream parameters
Returns
Referenced JBClusterStream pointer or 0 if a stream already exists

◆ createCompStream()

JBServerStream * createCompStream ( const String & name,
const String & local,
const String & remote,
const NamedList * params = 0 )

Create an outgoing comp stream.

Parameters
nameStream name
localLocal party domain
remoteRemote party domain
paramsOptional stream parameters
Returns
Referenced JBServerStream pointer or 0 if a stream already exists

◆ createServerStream()

JBServerStream * createServerStream ( const String & local,
const String & remote,
const char * dbId = 0,
const char * dbKey = 0,
bool dbOnly = false,
const NamedList * params = 0 )

Create an outgoing s2s stream.

Parameters
localLocal party domain
remoteRemote party domain
dbIdOptional dialback id (stream id)
dbKeyOptional dialback key to verify
dbOnlyTrue if this is a dialback only stream
paramsOptional stream parameters
Returns
Referenced JBServerStream pointer or 0 if a stream already exists

◆ findClusterStream()

JBClusterStream * findClusterStream ( const String & remote,
JBClusterStream * skip = 0 )

Find a cluster stream by remote domain. This method is thread safe

Parameters
remoteRemote jid
skipOptional stream to skip
Returns
Referenced JBClusterStream pointer or 0

◆ findServerStream()

JBServerStream * findServerStream ( const String & local,
const String & remote,
bool out,
bool auth = true )

Find a server to server or component stream by local/remote domain. Skip over outgoing dialback only streams This method is thread safe

Parameters
localLocal domain
remoteRemote domain
outTrue to find an outgoing stream, false to find an incoming one. Ignored for component streams
authCheck if the remote domain of an incoming s2s stream is authenticated
Returns
Referenced JBServerStream pointer or 0

◆ getStreamIndex()

unsigned int getStreamIndex ( )
inlineprotected

Increment and return the stream index counter

Returns
Current stream index

References Mutex::lock().

Referenced by buildStreamName().

◆ getStreamList()

virtual void getStreamList ( RefPointer< JBStreamSetList > & list,
int type )
protectedvirtual

Retrieve the list of streams of a given type

Parameters
listThe destination list to set
typeStream type

Reimplemented from JBEngine.

◆ getStreamListsType()

virtual void getStreamListsType ( int type,
RefPointer< JBStreamSetList > & recv,
RefPointer< JBStreamSetList > & process )
protectedvirtual

Retrieve the stream lists of a given type

Parameters
typeStream type
recvReceive stream list to set
processProcess stream list to set

◆ removeStream()

virtual void removeStream ( JBStream * stream,
bool delObj = true )
protectedvirtual

Remove a stream

Parameters
streamThe stream to remove
delObjTrue to release the stream, false to remove it from list without releasing it

Reimplemented from JBEngine.

◆ stopStreamSets()

virtual void stopStreamSets ( bool waitTerminate = true)
protectedvirtual

Stop all stream sets

Parameters
waitTerminateTrue to wait for all streams to terminate

Reimplemented from JBEngine.

◆ terminateClientStreams()

unsigned int terminateClientStreams ( const JabberID & jid,
XMPPError::Type error = XMPPError::NoError,
const char * reason = 0 )

Terminate all incoming c2s streams matching a given JID This method is thread safe

Parameters
jidClient JID
errorOptional error to be sent to the client
reasonOptional error text to be sent to the client
Returns
The number of stream terminated

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