class JBEngine

A Jabber engine. More...

Full nameTelEngine::JBEngine
Definition#include <libs/yjingle/yatejabber.h>
InheritsTelEngine::DebugEnabler [public ], TelEngine::GenObject [public ], TelEngine::JBThreadList [public ], TelEngine::Mutex [public ]
List of all Methods
Annotated List
Files
Globals
Hierarchy
Index

Public Types

Public Methods

Public Static Methods


Detailed Description

This class holds a Jabber engine

enum Protocol { Component = 1, Client = 2, }

Protocol

Jabber protocol type

enum Service { ServiceJingle = 0, ServiceIq = 1, ServiceMessage = 2, ServicePresence = 3, ServiceCommand = 4, ServiceDisco = 5, ServiceStream = 6, ServiceWriteFail = 7, ServiceRoster = 8, ServiceCount = 9 }

Service

Service type enumeration

 JBEngine (Protocol proto)

JBEngine

Constructor

Parameters:
protoThe protocol used by the streams belonging to this engine

 ~JBEngine ()

~JBEngine

[virtual]

Destructor

inline Protocol  protocol ()

protocol

[const]

Get the Jabber protocol this engine is using

Returns: The Jabber protocol as enumeration

inline const JabberID&  componentServer ()

componentServer

[const]

Get the default component server

Returns: The default component server

inline void  setAlternateDomain (const char* domain = 0)

setAlternateDomain

Set the alternate domain name

Parameters:
domainName of an acceptable alternate domain

inline const JabberID&  getAlternateDomain ()

getAlternateDomain

[const]

Get the alternate domain name

Returns: the alternate domain name

inline const String&  defaultResource ()

defaultResource

[const]

Get the default resource name.

Returns: The default resource name.

inline const ObjList&  streams ()

streams

[const]

Get the stream list

Returns: The list of streams belonging to this engine

void  destruct ()

destruct

[virtual]

Cleanup streams. Stop all threads owned by this engine. Release memory

Reimplemented from GenObject.

void  initialize (const NamedList& params)

initialize

[virtual]

Initialize the engine's parameters. Start private streams if requested

Parameters:
paramsEngine's parameters

void  cleanup ()

cleanup

Terminate all streams

void  setComponentServer (const char* domain)

setComponentServer

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:
domainDomain name of the server

JBStream*  findStream (const String& name)

findStream

Find a stream by its name. This method is thread safe

Parameters:
nameThe name of the stream to find

Returns: Referenced JBStream pointer or 0

JBStream*  getStream (const JabberID* jid = 0, bool create = true)

getStream

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:
jidOptional jid to use to find or create the stream
createTrue 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)

getStream

Try to get a stream if stream parameter is 0

Parameters:
streamStream to check
releaseSet to true on exit if the caller must deref the stream

Returns: True if stream is valid

JBClientStream*  createClientStream (NamedList& params)

createClientStream

Create a new client stream. This method is thread safe

Parameters:
paramsStream parameters

Returns: Referenced JBClientStream pointer or 0

bool  receive ()

receive

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)

process

Get events from the streams owned by this engine and send them to a service. Delete them if not processed by a service

Parameters:
timeCurrent time

Returns: True if an event was generated by any stream

bool  checkDupId (const JBStream* stream)

checkDupId

Check if an outgoing stream exists with the same id and remote peer

Parameters:
streamThe calling stream

Returns: True if found

bool  checkComponentFrom (JBComponentStream* stream, const char* from)

checkComponentFrom

Check the 'from' attribute received by a Component stream at startup

Parameters:
streamThe calling stream
fromThe from attribute to check

Returns: True if valid

void  connect (JBStream* stream)

connect

[virtual]

Asynchronously call the connect method of the given stream if the stream is idle

Parameters:
streamThe stream to connect

bool  exiting ()

exiting

[const virtual]

Check if this engine is exiting

Returns: True is terminating

bool  encryptStream (JBStream* stream)

encryptStream

[virtual]

Setup the transport layer security for a stream

Parameters:
streamThe stream requesting the operation

Returns: True if stream securing started, false on failure.

void  appendServer (XMPPServerInfo* server, bool open)

appendServer

Append a server info element to the list

Parameters:
serverThe object to add
openTrue to open the stream, if in component mode

bool  getServerIdentity (String& destination, bool full, const char* token = 0, bool domain = true)

getServerIdentity

Get the identity of the given server

Parameters:
destinationThe destination buffer
fullTrue to get the full identity
tokenThe search string. If 0 and the component protocol is used, the default server will be used
domainTrue to find by domain name. False to find by address

Returns: False if server doesn't exists

XMPPServerInfo*  findServerInfo (const char* token, bool domain)

findServerInfo

Find server info object

Parameters:
tokenThe search string. If 0 and the Component protocol is used, the default component server will be used
domainTrue to find by domain name. False to find by address

Returns: XMPPServerInfo pointer or 0 if not found

void  attachService (JBService* service, Service type, int prio = -1)

attachService

Attach a service to this engine. This method is thread safe

Parameters:
serviceThe service to attach
typeService type
prioService priority. Set to -1 to use the givent service's priority. A lower values indicates a service with higher priority

void  detachService (JBService* service)

detachService

Remove a service from all event handlers of this engine. This method is thread safe

Parameters:
serviceThe service to detach

void  printXml (const XMLElement& xml, const JBStream* stream, bool send)

printXml

[const]

Print an XML element to output

Parameters:
xmlElement to print
streamStream requesting the operation
sendTrue if sending, false if receiving

inline const char*  lookupProto (int proto, const char* def = 0)

lookupProto

[static]

Get the name of a protocol

Returns: The name of the requested protocol or the default value

inline int  lookupProto (const char* proto, int def = 0)

lookupProto

[static]

Get the value associated with a protocol name

Returns: The value associated with a protocol name


Generated by: paulc on bussard on Wed Oct 21 01:57:30 2009, using kdoc 2.0a54.