# class JGEngine | A Jingle engine. More...
Full name | `TelEngine::JGEngine`
Definition | `#include <libs/yjabber/yatejingle.h>`
Inherits | TelEngine::DebugEnabler [public ], TelEngine::Mutex [public ]
List of all Methods
Annotated List
Files
Globals
Hierarchy
Index

#### Public Methods

- JGEngine (const char* name = "jgengine")
- virtual ~JGEngine ()
- inline int sessionFlags () const
- inline u_int64_t stanzaTimeout () const
- inline u_int64_t streamHostTimeout () const
- inline u_int64_t pingInterval () const
- virtual void initialize (const NamedList& params)
- virtual bool sendStanza (JGSession* session, XmlElement*& stanza)
- virtual bool sendMessage (JGSession* session, const char* body)
- JGEvent* getEvent (u_int64_t time)
- JGSession* call (JGSession::Version ver, const JabberID& caller, const JabberID& called, const ObjList& contents, XmlElement* extra = 0, const char* msg = 0, const char* subject = 0, const char* line = 0, int* flags = 0)
- bool acceptIq (XMPPUtils::IqType type, const JabberID& from, const JabberID& to, const String& id, XmlElement* xml, const char* line, XMPPError::Type& error, String& text)
- void defProcessEvent (JGEvent* event)
- virtual void processEvent (JGEvent* event)

#### Public Static Methods

- static int decodeFlags (const String& list, const TokenDict* dict)
- static void encodeFlags (String& buf, int flags, const TokenDict* dict)

## Detailed Description

This class holds a Jingle service for the Jabber engine. Handle jingle stanzas, stanza write fail events and stream termination events

JGEngine (const char* name = "jgengine") | ### JGEngine

Constructor

Parameters:

name | Debug name

~JGEngine () | ### ~JGEngine

[virtual]

Destructor. Terminates all active sessions

inline int sessionFlags () | ### sessionFlags

[const]

Retrieve the default session flags value

Returns: The default session flags value

inline u_int64_t stanzaTimeout () | ### stanzaTimeout

[const]

Get the timeout interval of a sent stanza

Returns: The timeout interval of a sent stanza

inline u_int64_t streamHostTimeout () | ### streamHostTimeout

[const]

Get the timeout interval of a sent stream host stanza

Returns: The timeout interval of a sent stream host stanza

inline u_int64_t pingInterval () | ### pingInterval

[const]

Get the ping interval used by jingle sessions

Returns: The interval to ping the remote party of a jingle session

void initialize (const NamedList& params) | ### initialize

[virtual]

Initialize this service

Parameters:

params | Service's parameters

bool sendStanza (JGSession* session, XmlElement*& stanza) | ### sendStanza

[virtual]

Send a session's stanza. This method should be re-implemented

Parameters:

session | The session requesting the operation
stanza | The stanza to send. Will be consumed and zeroed

Returns: True on success

bool sendMessage (JGSession* session, const char* body) | ### sendMessage

[virtual]

Send a chat message on behalf of a session

Parameters:

session | The session requesting the operation
body | Message body

Returns: True on success

JGEvent* getEvent (u_int64_t time) | ### getEvent

Call getEvent() for each session list until an event is generated or the end is reached This method is thread safe

Parameters:

time | Current time in miliseconds

Returns: The first generated event

JGSession* call (JGSession::Version ver, const JabberID& caller, const JabberID& called, const ObjList& contents, XmlElement* extra = 0, const char* msg = 0, const char* subject = 0, const char* line = 0, int* flags = 0) | ### call

Make an outgoing call. 'media' and 'transport' will be invalid on exit. Don't delete them

Parameters:

ver | The session version to use
caller | The caller
called | The called
contents | The list of session content(s)
extra | Optional extra child for session initiate element
msg | Optional message to send before call
subject | Optional session subject
line | Optional session account
flags | Optional session flags to set

Returns: Valid JGSession pointer (referenced) on success

bool acceptIq (XMPPUtils::IqType type, const JabberID& from, const JabberID& to, const String& id, XmlElement* xml, const char* line, XMPPError::Type& error, String& text) | ### acceptIq

Ask this engine to accept an incoming xml 'iq' element

Parameters:

type | Iq type as enumeration
from | The sender
to | The recipient
id | Element id attribute
xml | The received element
line | Account receiving the stanza (may be empty)
error | XMPPError result. This value should be check if false is returned. Any value different from NoError indicate an invalid element
text | Error text

Returns: True if accepted (don't use the given pointer if accepted)

void defProcessEvent (JGEvent* event) | ### defProcessEvent

Default event processor. Delete event.

Parameters:

event | The event to process

void processEvent (JGEvent* event) | ### processEvent

[virtual]

Process events from the sessions. Default action: Delete event. Descendants must override this method to process generated events

Parameters:

event | The event to process

int decodeFlags (const String& list, const TokenDict* dict) | ### decodeFlags

[static]

Decode a comma separated list of flags

Parameters:

list | The list of flags
dict | Dictionary to use

Returns: Found flags

void encodeFlags (String& buf, int flags, const TokenDict* dict) | ### encodeFlags

[static]

Encode (append) flags to a comma separated list

Parameters:

buf | Destination buffer
flags | Flags to encode
dict | Dictionary to use

Generated by: paulc on bussard on Mon Feb 10 13:15:47 2014, using kdoc 2.0a54.