Yate
JGEngine Class Reference

A Jingle engine. More...

#include <yatejingle.h>

Inheritance diagram for JGEngine:
DebugEnabler Mutex Lockable

Public Member Functions

 JGEngine (const char *name="jgengine")
 
virtual ~JGEngine ()
 
int sessionFlags () const
 
u_int64_t stanzaTimeout () const
 
u_int64_t streamHostTimeout () const
 
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)
 
JGEventgetEvent (u_int64_t time)
 
JGSessioncall (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 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 ()
 

Static Public Member Functions

static int decodeFlags (const String &list, const TokenDict *dict)
 
static void encodeFlags (String &buf, int flags, const TokenDict *dict)
 
- 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 ()
 

Friends

class JGSession
 

Additional Inherited Members

- Protected Member Functions inherited from DebugEnabler
void debugName (const char *name)
 

Detailed Description

A Jingle engine.

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

Constructor & Destructor Documentation

◆ JGEngine()

JGEngine ( const char * name = "jgengine")

Constructor

Parameters
nameDebug name

◆ ~JGEngine()

virtual ~JGEngine ( )
virtual

Destructor. Terminates all active sessions

Member Function Documentation

◆ acceptIq()

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

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

Parameters
typeIq type as enumeration
fromThe sender
toThe recipient
idElement id attribute
xmlThe received element
lineAccount receiving the stanza (may be empty)
errorXMPPError result. This value should be check if false is returned. Any value different from NoError indicate an invalid element
textError text
Returns
True if accepted (don't use the given pointer if accepted)

◆ call()

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 )

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

Parameters
verThe session version to use
callerThe caller
calledThe called
contentsThe list of session content(s)
extraOptional extra child for session initiate element
msgOptional message to send before call
subjectOptional session subject
lineOptional session account
flagsOptional session flags to set
Returns
Valid JGSession pointer (referenced) on success

◆ decodeFlags()

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

Decode a comma separated list of flags

Parameters
listThe list of flags
dictDictionary to use
Returns
Found flags

◆ defProcessEvent()

void defProcessEvent ( JGEvent * event)

Default event processor. Delete event.

Parameters
eventThe event to process

◆ encodeFlags()

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

Encode (append) flags to a comma separated list

Parameters
bufDestination buffer
flagsFlags to encode
dictDictionary to use

◆ getEvent()

JGEvent * getEvent ( u_int64_t time)

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

Parameters
timeCurrent time in miliseconds
Returns
The first generated event

◆ initialize()

virtual void initialize ( const NamedList & params)
virtual

Initialize this service

Parameters
paramsService's parameters

◆ pingInterval()

u_int64_t pingInterval ( ) const
inline

Get the ping interval used by jingle sessions

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

◆ processEvent()

virtual void processEvent ( JGEvent * event)
virtual

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

Parameters
eventThe event to process

◆ sendMessage()

virtual bool sendMessage ( JGSession * session,
const char * body )
virtual

Send a chat message on behalf of a session

Parameters
sessionThe session requesting the operation
bodyMessage body
Returns
True on success

◆ sendStanza()

virtual bool sendStanza ( JGSession * session,
XmlElement *& stanza )
virtual

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

Parameters
sessionThe session requesting the operation
stanzaThe stanza to send. Will be consumed and zeroed
Returns
True on success

◆ sessionFlags()

int sessionFlags ( ) const
inline

Retrieve the default session flags value

Returns
The default session flags value

◆ stanzaTimeout()

u_int64_t stanzaTimeout ( ) const
inline

Get the timeout interval of a sent stanza

Returns
The timeout interval of a sent stanza

◆ streamHostTimeout()

u_int64_t streamHostTimeout ( ) const
inline

Get the timeout interval of a sent stream host stanza

Returns
The timeout interval of a sent stream host stanza

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