JBEngine Class Reference
A Jabber engine.
More...
#include <yatejabber.h>
List of all members.
|
Public Types |
enum | Protocol { Component = 1,
Client = 2
} |
enum | Service {
ServiceJingle = 0,
ServiceIq = 1,
ServiceMessage = 2,
ServicePresence = 3,
ServiceCommand = 4,
ServiceDisco = 5,
ServiceStream = 6,
ServiceWriteFail = 7,
ServiceRoster = 8,
ServiceCount = 9
} |
Public Member Functions |
| JBEngine (Protocol proto) |
virtual | ~JBEngine () |
Protocol | protocol () const |
const JabberID & | componentServer () const |
void | setAlternateDomain (const char *domain=0) |
const JabberID & | getAlternateDomain () const |
const String & | defaultResource () const |
const ObjList & | streams () const |
virtual void | destruct () |
virtual void | initialize (const NamedList ¶ms) |
void | cleanup () |
void | setComponentServer (const char *domain) |
JBStream * | findStream (const String &name) |
JBStream * | getStream (const JabberID *jid=0, bool create=true) |
bool | getStream (JBStream *&stream, bool &release) |
JBClientStream * | createClientStream (NamedList ¶ms) |
bool | receive () |
bool | process (u_int64_t time) |
bool | checkDupId (const JBStream *stream) |
bool | checkComponentFrom (JBComponentStream *stream, const char *from) |
virtual void | connect (JBStream *stream) |
virtual bool | exiting () const |
virtual bool | encryptStream (JBStream *stream) |
void | appendServer (XMPPServerInfo *server, bool open) |
bool | getServerIdentity (String &destination, bool full, const char *token=0, bool domain=true) |
XMPPServerInfo * | findServerInfo (const char *token, bool domain) |
void | attachService (JBService *service, Service type, int prio=-1) |
void | detachService (JBService *service) |
void | printXml (const XMLElement &xml, const JBStream *stream, bool send) const |
Static Public Member Functions |
static const char * | lookupProto (int proto, const char *def=0) |
static int | lookupProto (const char *proto, int def=0) |
Friends |
class | JBStream |
Detailed Description
A Jabber engine.
This class holds a Jabber engine
Member Enumeration Documentation
Constructor & Destructor Documentation
Constructor
- Parameters:
-
| proto | The protocol used by the streams belonging to this engine |
Member Function Documentation
Get the Jabber protocol this engine is using
- Returns:
- The Jabber protocol as enumeration
const JabberID& componentServer |
( |
|
) |
const [inline] |
Get the default component server
- Returns:
- The default component server
void setAlternateDomain |
( |
const char * |
domain = 0 |
) |
[inline] |
Set the alternate domain name
- Parameters:
-
| domain | Name of an acceptable alternate domain |
const JabberID& getAlternateDomain |
( |
|
) |
const [inline] |
Get the alternate domain name
- Returns:
- the alternate domain name
const String& defaultResource |
( |
|
) |
const [inline] |
Get the default resource name.
- Returns:
- The default resource name.
const ObjList& streams |
( |
|
) |
const [inline] |
Get the stream list
- Returns:
- The list of streams belonging to this engine
virtual void destruct |
( |
|
) |
[virtual] |
Cleanup streams. Stop all threads owned by this engine. Release memory
Reimplemented from GenObject.
virtual void initialize |
( |
const NamedList & |
params |
) |
[virtual] |
Initialize the engine's parameters. Start private streams if requested
- Parameters:
-
| params | Engine's parameters |
void setComponentServer |
( |
const char * |
domain |
) |
|
Set the default component server to use. The domain must be in the server list. Choose the first one from the server list if the given one doesn't exists. Do nothing if the protocol is not Component
- Parameters:
-
| domain | Domain name of the server |
Find a stream by its name. This method is thread safe
- Parameters:
-
| name | The name of the stream to find |
- Returns:
- Referenced JBStream pointer or 0
Get a stream. Create it not found and requested. For the component protocol, the jid parameter may contain the domain to find, otherwise, the default component will be used. This method won't create a client stream. Use createClientStream(). This method is thread safe
- Parameters:
-
| jid | Optional jid to use to find or create the stream |
| create | True to create a stream if don't exist. Ignored if the engine's protocol is Client |
- Returns:
- Referenced JBStream pointer or 0
bool getStream |
( |
JBStream *& |
stream, |
|
|
bool & |
release | |
|
) |
| | |
Try to get a stream if stream parameter is 0
- Parameters:
-
| stream | Stream to check |
| release | Set to true on exit if the caller must deref the stream |
- Returns:
- True if stream is valid
Create a new client stream. This method is thread safe
- Parameters:
-
- Returns:
- Referenced JBClientStream pointer or 0
Keep calling receive() for each stream until no data is received or the thread is terminated
- Returns:
- True if data was received
bool process |
( |
u_int64_t |
time |
) |
|
Get events from the streams owned by this engine and send them to a service. Delete them if not processed by a service
- Parameters:
-
- Returns:
- True if an event was generated by any stream
bool checkDupId |
( |
const JBStream * |
stream |
) |
|
Check if an outgoing stream exists with the same id and remote peer
- Parameters:
-
| stream | The calling stream |
- Returns:
- True if found
Check the 'from' attribute received by a Component stream at startup
- Parameters:
-
| stream | The calling stream |
| from | The from attribute to check |
- Returns:
- True if valid
virtual void connect |
( |
JBStream * |
stream |
) |
[virtual] |
Asynchronously call the connect method of the given stream if the stream is idle
- Parameters:
-
| stream | The stream to connect |
virtual bool exiting |
( |
|
) |
const [inline, virtual] |
Check if this engine is exiting
- Returns:
- True is terminating
virtual bool encryptStream |
( |
JBStream * |
stream |
) |
[virtual] |
Setup the transport layer security for a stream
- Parameters:
-
| stream | The stream requesting the operation |
- Returns:
- True if stream securing started, false on failure.
Append a server info element to the list
- Parameters:
-
| server | The object to add |
| open | True to open the stream, if in component mode |
bool getServerIdentity |
( |
String & |
destination, |
|
|
bool |
full, |
|
|
const char * |
token = 0 , |
|
|
bool |
domain = true | |
|
) |
| | |
Get the identity of the given server
- Parameters:
-
| destination | The destination buffer |
| full | True to get the full identity |
| token | The search string. If 0 and the component protocol is used, the default server will be used |
| domain | True to find by domain name. False to find by address |
- Returns:
- False if server doesn't exists
Find server info object
- Parameters:
-
| token | The search string. If 0 and the Component protocol is used, the default component server will be used |
| domain | True to find by domain name. False to find by address |
- Returns:
- XMPPServerInfo pointer or 0 if not found
Attach a service to this engine. This method is thread safe
- Parameters:
-
| service | The service to attach |
| type | Service type |
| prio | Service priority. Set to -1 to use the givent service's priority. A lower values indicates a service with higher priority |
Remove a service from all event handlers of this engine. This method is thread safe
- Parameters:
-
| service | The service to detach |
Print an XML element to output
- Parameters:
-
| xml | Element to print |
| stream | Stream requesting the operation |
| send | True if sending, false if receiving |
static const char* lookupProto |
( |
int |
proto, |
|
|
const char * |
def = 0 | |
|
) |
| | [inline, static] |
Get the name of a protocol
- Returns:
- The name of the requested protocol or the default value
References TelEngine::lookup().
static int lookupProto |
( |
const char * |
proto, |
|
|
int |
def = 0 | |
|
) |
| | [inline, static] |
Get the value associated with a protocol name
- Returns:
- The value associated with a protocol name
References TelEngine::lookup().
The documentation for this class was generated from the following file: