|
Yate
|
A Jabber engine. More...
#include <yatejabber.h>
Public Member Functions | |
| JBEngine (const char *name="jbengine") | |
| virtual | ~JBEngine () |
| unsigned int | streamReadBuffer () const |
| bool | exiting () const |
| void | setExiting () |
| bool | hasClientTls () const |
| JBRemoteDomainDef * | remoteDomainDef (const String &domain) |
| virtual void | destruct () |
| virtual void | initialize (const NamedList ¶ms) |
| virtual void | cleanup (bool final=false, bool waitTerminate=true) |
| bool | acceptConn (Socket *sock, SocketAddr &remote, JBStream::Type t, bool ssl=false) |
| virtual JBStream * | findStream (const String &id, JBStream::Type hint=JBStream::TypeCount) |
| ObjList * | findClientStreams (bool in, const JabberID &jid, int flags=0xffffffff) |
| ObjList * | findClientStreams (bool in, const JabberID &jid, const ObjList &resources, int flags=0xffffffff) |
| JBClientStream * | findClientStream (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 void | buildStreamName (String &name, const JBStream *stream) |
| 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 |
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) |
| void | getStreamLists (RefPointer< JBStreamSetList > list[JBStream::TypeCount], int type=JBStream::TypeCount) |
| JBStream * | findStream (const String &id, JBStreamSetList *list) |
Protected Attributes | |
| 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 |
| bool | m_hasClientTls |
| int | m_printXml |
| bool | m_initialized |
Friends | |
| class | JBStream |
| class | JBConnect |
| class | JBStreamSetProcessor |
A Jabber engine.
This class holds a Jabber engine
| virtual ~JBEngine | ( | ) | [virtual] |
Destructor
| bool acceptConn | ( | Socket * | sock, |
| SocketAddr & | remote, | ||
| JBStream::Type | t, | ||
| bool | ssl = false |
||
| ) |
Accept an incoming stream connection. Build a stream. Don't delete the socket if false is returned
| sock | Accepted socket |
| remote | Remote ip and port |
| t | Expected stream type |
| ssl | True if the socket is already using SSL/TLS |
Add a stream to one of the stream lists
| stream | The stream to add |
Reimplemented in JBClientEngine, and JBServerEngine.
| virtual void buildDialbackKey | ( | const String & | id, |
| const String & | local, | ||
| const String & | remote, | ||
| String & | key | ||
| ) | [virtual] |
Build a dialback key
| id | The stream id |
| local | Local domain |
| remote | Remote domain |
| key | The dialback key |
| virtual void buildStreamName | ( | String & | name, |
| const JBStream * | stream | ||
| ) | [inline, virtual] |
Build an internal stream name
| name | Destination buffer |
| stream | Stream requesting it |
Reimplemented in JBServerEngine.
| bool checkDupId | ( | JBStream * | stream | ) |
Check if an outgoing stream exists with the same id and remote peer
| stream | The calling stream |
| virtual void cleanup | ( | bool | final = false, |
| bool | waitTerminate = true |
||
| ) | [virtual] |
Stop connect threads. Drop all streams. Stop all stream sets. Release memory if final
| final | True if called from destructor |
| waitTerminate | True to wait for all streams to terminate |
Reimplemented in JBClientEngine, and JBServerEngine.
| virtual void compressStream | ( | JBStream * | stream, |
| const String & | formats | ||
| ) | [virtual] |
Start stream compression
| stream | The stream to compress |
| formats | Supported formats |
| virtual void connectStream | ( | JBStream * | stream | ) | [virtual] |
Connect an outgoing stream
| stream | The stream to connect |
| virtual void destruct | ( | ) | [virtual] |
Cleanup streams. Stop all threads owned by this engine. Release memory
Reimplemented from GenObject.
| 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] |
Terminate all streams matching type and/or local/remote jid
| type | Stream type. Match all stream types if unknown |
| local | Optional local jid to match |
| remote | Optional remote jid to match |
| error | Optional error to be sent to the client |
| reason | Optional error text to be sent to the client |
| virtual void encryptStream | ( | JBStream * | stream | ) | [virtual] |
Start stream TLS
| stream | The stream to enchrypt |
| bool exiting | ( | ) | const [inline] |
Check if this engine is exiting
| JBClientStream* findClientStream | ( | bool | in, |
| const JabberID & | jid | ||
| ) |
Find a c2s stream by its local or remote jid. This method is thread safe
| in | True for incoming, false for outgoing |
| jid | JID to compare (the local one for outgoing, remote jid for incoming) |
| ObjList* findClientStreams | ( | bool | in, |
| const JabberID & | jid, | ||
| int | flags = 0xffffffff |
||
| ) |
Find all c2s streams whose local or remote bare jid matches a given one. Ignore destroying streams. This method is thread safe
| in | True for incoming, false for outgoing |
| jid | JID to compare (the local one for outgoing, remote jid for incoming) |
| flags | Optional stream flag to match |
| ObjList* findClientStreams | ( | bool | in, |
| const JabberID & | jid, | ||
| const ObjList & | resources, | ||
| int | flags = 0xffffffff |
||
| ) |
Find all c2s streams whose local or remote bare jid matches a given one and their resource is found in the given list. Ignore destroying streams. This method is thread safe
| in | True for incoming, false for outgoing |
| jid | JID to compare (the local one for outgoing, remote jid for incoming) |
| resources | The list of resources to match |
| flags | Optional stream flag to match |
| virtual JBStream* findStream | ( | const String & | id, |
| JBStream::Type | hint = JBStream::TypeCount |
||
| ) | [virtual] |
Find a stream by its name. This method is thread safe
| id | The internal id of the stream to find |
| hint | Optional stream type hint |
| JBStream* findStream | ( | const String & | id, |
| JBStreamSetList * | list | ||
| ) | [protected] |
Find a stream by its name in a given set list
| id | The name of the stream to find |
| list | The list to search for a stream |
| virtual void getStreamList | ( | RefPointer< JBStreamSetList > & | list, |
| int | type | ||
| ) | [inline, protected, virtual] |
Retrieve the list of streams of a given type. Descendant must implement it
| list | The destination list to set |
| type | Stream type |
Reimplemented in JBClientEngine, and JBServerEngine.
| void getStreamLists | ( | RefPointer< JBStreamSetList > | list[JBStream::TypeCount], |
| int | type = JBStream::TypeCount |
||
| ) | [inline, protected] |
Retrieve all streams
| list | The destination list to set. The first index will be filled with the c2s streams list, the second index will be set to the s2s stream list |
| type | Optional stream type |
| bool hasClientTls | ( | ) | const [inline] |
Check if TLS is available for outgoing streams
Check if a domain is serviced by this engine
| domain | Domain to check |
| virtual void initialize | ( | const NamedList & | params | ) | [virtual] |
Initialize the engine's parameters. Start private streams if requested
| params | Engine's parameters |
Print XML to output
| stream | Stream requesting the operation |
| send | True if sending, false if receiving |
| xml | XML to print |
| virtual void printXml | ( | const JBStream * | stream, |
| bool | send, | ||
| XmlFragment & | frag | ||
| ) | const [virtual] |
Print an XML fragment to output
| stream | Stream requesting the operation |
| send | True if sending, false if receiving |
| frag | XML fragment to print |
| virtual void processEvent | ( | JBEvent * | ev | ) | [virtual] |
Process an event. The default implementation will return the event to this engine
| ev | The event to process |
| JBRemoteDomainDef* remoteDomainDef | ( | const String & | domain | ) | [inline] |
Find a remote domain definition. Return the default settings if not found. This method is not thread safe
| domain | The domain to find |
References ObjList::find(), and ObjList::get().
| virtual void removeStream | ( | JBStream * | stream, |
| bool | delObj = true |
||
| ) | [protected, virtual] |
Remove a stream
| stream | The stream to remove |
| delObj | True to release the stream, false to remove it from list without releasing it |
Reimplemented in JBClientEngine, and JBServerEngine.
| virtual void returnEvent | ( | JBEvent * | ev, |
| XMPPError::Type | error = XMPPError::NoError, |
||
| const char * | reason = 0 |
||
| ) | [virtual] |
Return an event to this engine. The default implementation will send an error if apropriate and delete the event
| ev | The event to return |
| error | Optional error to be returned to the event's XML sender |
| reason | Optional text to be attached to the error |
| void setExiting | ( | ) | [inline] |
Set the exiting flag. Terminate all streams
References JabberID::empty().
| virtual void stopStreamSets | ( | bool | waitTerminate = true | ) | [inline, protected, virtual] |
Stop all stream sets
| waitTerminate | True to wait for all streams to terminate |
Reimplemented in JBClientEngine, and JBServerEngine.
| unsigned int streamReadBuffer | ( | ) | const [inline] |
Retrieve the stream read buffer length
1.7.6.1