|
Yate
|
A basic Jingle session. More...
#include <yatejingle.h>
Public Types | |
| enum | Version { Version0 = 0 , Version1 = 1 , VersionUnknown } |
| enum | Reason { ReasonUnknown = 0 , ReasonOk , ReasonBusy , ReasonDecline , ReasonCancel , ReasonExpired , ReasonConn , ReasonFailApp , ReasonFailTransport , ReasonGone , ReasonParams , ReasonMedia , ReasonTransport , ReasonApp , ReasonSecurity , ReasonTimeout , ReasonGeneral , ReasonAltSess , Transferred , CryptoRequired , InvalidCrypto } |
| enum | RtpInfo { RtpActive , RtpHold , RtpMute , RtpRinging } |
| enum | State { Idle = 0 , Pending = 1 , Active = 2 , Ending = 3 , Destroy = 4 } |
| enum | Action { ActAccept , ActInitiate , ActTerminate , ActReject , ActInfo , ActTransportInfo , ActTransportAccept , ActTransportReject , ActTransportReplace , ActCandidates , ActContentAccept , ActContentAdd , ActContentModify , ActContentReject , ActContentRemove , ActContentInfo , ActDescriptionInfo , ActTransfer , ActRinging , ActTrying , ActReceived , ActHold , ActActive , ActMute , ActDtmf , ActStreamHost , ActCount } |
| enum | SessionFlag { FlagNoPing = 0x0001 , FlagRingNsRtp = 0x0002 , FlagNoOkInitiate = 0x0004 } |
Public Member Functions | |
| virtual | ~JGSession () |
| Version | version () const |
| JGEngine * | engine () const |
| bool | outgoing () const |
| const String & | sid () const |
| const JabberID & | local () const |
| const JabberID & | remote () const |
| State | state () const |
| int | flag (int mask) const |
| void | setFlags (int value) |
| void * | userData () |
| void | userData (void *userdata) |
| const String & | line () const |
| void | line (const String &acc) |
| Action | getAction (XmlElement *xml) |
| bool | acceptIq (XMPPUtils::IqType type, const JabberID &from, const JabberID &to, const String &id, XmlElement *xml) |
| bool | confirmResult (XmlElement *xml) |
| bool | confirmError (XmlElement *&xml, XMPPError::Type error, const char *text=0, XMPPError::ErrorType type=XMPPError::TypeModify) |
| virtual bool | accept (const ObjList &contents, String *stanzaId=0) |
| virtual bool | hangup (XmlElement *reason=0) |
| virtual XmlElement * | createRtpInfoXml (RtpInfo info) |
| virtual XmlElement * | createReason (int reason, const char *text=0, XmlElement *child=0) |
| virtual XmlElement * | createTransferReason (int reason) |
| virtual XmlElement * | createRtpSessionReason (int reason) |
| virtual bool | sendContent (Action action, const ObjList &contents, String *stanzaId=0) |
| bool | sendContent (Action action, const JGSessionContent *content, String *stanzaId=0) |
| virtual bool | sendStreamHosts (const ObjList &hosts, String *stanzaId=0) |
| virtual bool | sendStreamHostUsed (const char *jid, const char *stanzaId) |
| void | buildSocksDstAddr (String &buf) |
| bool | sendInfo (XmlElement *xml, String *stanzaId=0, XmlElement *extra=0) |
| bool | sendDtmf (const char *dtmf, unsigned int msDuration=0, String *stanzaId=0) |
| bool | hasFeature (XMPPNamespace::Type feature) |
Public Member Functions inherited from RefObject | |
| RefObject () | |
| virtual | ~RefObject () |
| virtual void * | getObject (const String &name) const |
| virtual bool | alive () const |
| bool | ref () |
| bool | deref () |
| int | refcount () const |
| virtual void | destruct () |
Public Member Functions inherited from GenObject | |
| GenObject () | |
| virtual | ~GenObject () |
| virtual const String & | toString () const |
| virtual const String & | traceId () const |
| NamedCounter * | getObjCounter () const |
| NamedCounter * | setObjCounter (NamedCounter *counter) |
Public Member Functions inherited from Mutex | |
| Mutex (bool recursive=false, const char *name=0) | |
| Mutex (const Mutex &original) | |
| ~Mutex () | |
| Mutex & | operator= (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 XmlElement * | buildTransfer (const String &transferTo, const String &transferFrom, const String &sid=String::empty()) |
| static Version | lookupVersion (const char *value, Version def=VersionUnknown) |
| static const char * | lookupVersion (int value, const char *def="unknown") |
| static int | lookupReason (const char *value, int def=ReasonOk) |
| static const char * | lookupReason (int value, const char *def=0) |
| static const char * | lookupState (int state) |
| static const char * | lookupAction (int act, Version ver) |
| static Action | lookupAction (const char *str, Version ver) |
Static Public Member Functions inherited from RefObject | |
| static bool | alive (const RefObject *obj) |
| static bool | efficientIncDec () |
Static Public Member Functions inherited from GenObject | |
| static void * | getObject (const String &name, const GenObject *obj) |
| static bool | getObjCounting () |
| static void | setObjCounting (bool enable) |
| static NamedCounter * | getObjCounter (const String &name, bool create=true) |
| static ObjList & | getObjCounters () |
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 () |
Static Public Attributes | |
| static const TokenDict | s_versions [] |
| static const TokenDict | s_reasons [] |
| static const TokenDict | s_rtpInfo [] |
| static const TokenDict | s_states [] |
| static const TokenDict | s_actions0 [] |
| static const TokenDict | s_actions1 [] |
| static const TokenDict | s_flagName [] |
Protected Member Functions | |
| JGSession (Version ver, JGEngine *engine, const JabberID &caller, const JabberID &called) | |
| JGSession (Version ver, JGEngine *engine, const JabberID &caller, const JabberID &called, XmlElement *xml, const String &id) | |
| virtual bool | initiate (const ObjList &contents, XmlElement *extra, const char *subject=0)=0 |
| virtual JGEvent * | getEvent (u_int64_t time) |
| virtual void | destroyed () |
| bool | sendStanza (XmlElement *stanza, String *stanzaId=0, bool confirmation=true, bool ping=false, unsigned int toutMs=0) |
| bool | sendPing (u_int64_t msecNow) |
| virtual JGEvent * | decodeJingle (XmlElement *&xml, XmlElement *child)=0 |
| virtual XmlElement * | createJingle (Action action, XmlElement *element1=0, XmlElement *element2=0, XmlElement *element3=0)=0 |
| virtual XmlElement * | createDtmf (const char *dtmf, unsigned int msDuration=0)=0 |
| virtual JGEvent * | processJingleSetEvent (JGEvent *&ev) |
| virtual JGEvent * | processJabberIqResponse (bool result, XmlElement *&xml) |
| virtual JGEvent * | processFileTransfer (bool set, XmlElement *&xml, XmlElement *child) |
| void | eventTerminated (JGEvent *event) |
| void | changeState (State newState) |
Protected Member Functions inherited from RefObject | |
| virtual void | zeroRefs () |
| bool | resurrect () |
Protected Attributes | |
| Version | m_version |
| State | m_state |
| int | m_flags |
| u_int64_t | m_timeToPing |
| JGEngine * | m_engine |
| bool | m_outgoing |
| String | m_sid |
| JabberID | m_local |
| JabberID | m_remote |
| XmlFragment | m_queue |
| JGEvent * | m_lastEvent |
| bool | m_recvTerminate |
| void * | m_private |
| String | m_localSid |
| u_int32_t | m_stanzaId |
| ObjList | m_sentStanza |
| String | m_line |
Friends | |
| class | JGEvent |
| class | JGEngine |
A basic Jingle session.
This class is a base class for all specific jingle sessions
| enum Action |
Jingle action enumeration
| enum Reason |
Jingle defined reasons and errors
| enum RtpInfo |
RTP session info (XEP 0167)
| enum SessionFlag |
Session flags
| enum State |
Session state enumeration
| enum Version |
Jingle session version
|
virtual |
Destructor
|
protected |
Constructor. Create an outgoing session
| ver | The session version |
| engine | The engine owning this session |
| caller | The caller's full JID |
| called | The called party's full JID |
References engine().
Referenced by changeState().
|
protected |
Constructor. Create an incoming session.
| ver | The session version |
| engine | The engine owning this session |
| caller | The caller's full JID |
| called | The called party's full JID |
| xml | A valid Jabber Jingle xml with action session initiate |
| id | Session id |
References engine().
Accept a Pending incoming session. This method is thread safe
| contents | The list of accepted contents |
| stanzaId | Optional string to be filled with sent stanza id (used to track the response) |
Reimplemented in JGSession0, and JGSession1.
| bool acceptIq | ( | XMPPUtils::IqType | type, |
| const JabberID & | from, | ||
| const JabberID & | to, | ||
| const String & | id, | ||
| XmlElement * | xml ) |
Ask this session to accept an incoming xml 'iq' element
| type | Iq type as enumeration |
| from | The sender |
| to | The recipient |
| id | The session id of this is a request (set/get) or the stanza id |
| xml | The received element |
| void buildSocksDstAddr | ( | String & | buf | ) |
Build SOCKS SHA1 dst.addr used by file transfer
| buf | Destination string |
|
static |
Build a transfer element
| transferTo | The JID to transfer to |
| transferFrom | The transferror's JID |
| sid | Optional session id used for attended transfer (empty for unattended transfer) |
References String::empty(), and sid().
|
protected |
| bool confirmError | ( | XmlElement *& | xml, |
| XMPPError::Type | error, | ||
| const char * | text = 0, | ||
| XMPPError::ErrorType | type = XMPPError::TypeModify ) |
Confirm (send error) a received element
| xml | The element to confirm (will be consumed and zeroed) |
| error | The error condition |
| text | Optional text to add to the error element |
| type | Error type |
| bool confirmResult | ( | XmlElement * | xml | ) |
Confirm (send result) a received element
| xml | The element to confirm |
|
protectedpure virtual |
Create a dtmf XML element
| dtmf | The dtmf string |
| msDuration | The tone duration in miliseconds. Ignored if 0 |
Implemented in JGSession0, and JGSession1.
|
protectedpure virtual |
Create an 'iq' of type 'set' with a 'jingle' child
| action | The action of the Jingle stanza |
| element1 | Optional child element |
| element2 | Optional child element |
| element3 | Optional child element |
Implemented in JGSession0, and JGSession1.
|
inlinevirtual |
Create a termination reason element
| reason | The reason code |
| text | Optional reason text child |
| child | Optional additional reason child |
Reimplemented in JGSession1.
|
inlinevirtual |
Create a RTP info child to be added to a session-info element
| info | The informational tag as enumeration |
Reimplemented in JGSession1.
|
inlinevirtual |
Create a RTP session reason element
| reason | The reason code |
Reimplemented in JGSession1.
|
inlinevirtual |
Create a transfer reason element
| reason | The reason code |
Reimplemented in JGSession1.
|
protectedpure virtual |
Decode a jingle element
| xml | The element to decode |
| child | The element's first child |
Implemented in JGSession0, and JGSession1.
|
protectedvirtual |
Release this session and its memory
Reimplemented from RefObject.
|
inline |
Retrieve the engine owning this session
Referenced by JGSession(), JGSession(), JGSession0::JGSession0(), JGSession0::JGSession0(), JGSession1::JGSession1(), and JGSession1::JGSession1().
|
protected |
Terminate notification from an event. Reset the last generated event
| event | Terminated (processed) event |
|
inline |
Retrieve session flags
| mask | Mask to retrieve |
| Action getAction | ( | XmlElement * | xml | ) |
Get an action (jingle element type) from a jingle element
| xml | Element to check |
|
protectedvirtual |
Get a Jingle event from the queue. This method is thread safe
| time | Current time in miliseconds |
|
virtual |
Close a Pending or Active session This method is thread safe
| reason | Optional termination reason |
| bool hasFeature | ( | XMPPNamespace::Type | feature | ) |
Check if the remote party supports a given feature
| feature | The requested feature |
|
protectedpure virtual |
Build and send the initial message on an outgoing session
| contents | The session contents to be sent with session initiate element |
| extra | Optional extra child to be added to the session initiate element |
| subject | Optional session subject |
Implemented in JGSession0, and JGSession1.
|
inline |
Retrieve the client account used by this session
|
inline |
Set the client account used by this session
| acc | The client account used by this session |
|
inline |
Get the local peer's JID
Get the action associated with a given string
| str | The action name |
| ver | Session version to use |
|
static |
Get the name of an action
| act | The action to find |
| ver | Session version to use |
Referenced by JGEvent::actionName().
|
inlinestatic |
Get the termination code associated with a text
| value | The termination text |
| def | Default value to return if not found |
References s_reasons.
|
inlinestatic |
Get the termination code associated with a text
| value | The termination code |
| def | Default value to return if not found |
References s_reasons.
|
inlinestatic |
Get the session version associated with a text
| value | The version text |
| def | Default value to return if not found |
References s_versions.
|
inlinestatic |
Get the session version name
| value | The version value |
| def | Default value to return if not found |
References s_versions.
|
inline |
Get the session direction
|
protectedvirtual |
Decode a file transfer element
| set | True if the xml is an iq 'set', false if type is 'get' |
| xml | The element to decode |
| child | The element's first child |
Reimplemented in JGSession1.
|
protectedvirtual |
Method called in getEvent() to process a jabber event carrying a response
| result | True if the element is a result, false if it's an error response |
| xml | Xml element to process |
Method called in getEvent() to process a last event decoded from a received jingle element
| ev | The event to process (will be consumed and zeroed) |
|
inline |
Get the remote peer's JID
|
inline |
Send a stanza with a session content This method is thread safe
| action | Must be a transport- or content- action |
| content | The content to send |
| stanzaId | Optional string to be filled with sent stanza id (used to track the response) |
References ObjList::append(), sendContent(), and ObjList::setDelete().
|
inlinevirtual |
Send a stanza with session content(s) This method is thread safe
| action | Must be a transport- or content- action |
| contents | Non empty list with content(s) to send |
| stanzaId | Optional string to be filled with sent stanza id (used to track the response) |
Reimplemented in JGSession0, and JGSession1.
Referenced by sendContent().
| bool sendDtmf | ( | const char * | dtmf, |
| unsigned int | msDuration = 0, | ||
| String * | stanzaId = 0 ) |
Send a dtmf string to remote peer. If the string's length is greater then 1, each character is added as a 'dtmf' child of the jingle element
| dtmf | The dtmf string |
| msDuration | The tone duration in miliseconds. Ignored if 0 |
| stanzaId | Optional string to be filled with sent stanza id (used to track the response) |
| bool sendInfo | ( | XmlElement * | xml, |
| String * | stanzaId = 0, | ||
| XmlElement * | extra = 0 ) |
Send a session info element to the remote peer. This method is thread safe
| xml | The XmlElement carried by the session info element |
| stanzaId | Optional string to be filled with sent stanza id (used to track the response) |
| extra | Optional extra child for jingle element |
|
protected |
Send a ping (empty session info) stanza to the remote peer if it's time to do it
| msecNow | The current time |
|
protected |
Send a stanza to the remote peer
| stanza | The stanza to send |
| stanzaId | Optional string to be filled with sent stanza id (used to track the response) |
| confirmation | True if the stanza needs confirmation (add 'id' attribute) |
| ping | True if the stanza is a ping one |
| toutMs | Optional stanza timeout interval in milliseconds |
Send a stanza with stream hosts This method is thread safe
| hosts | The list of hosts to send |
| stanzaId | Optional string to be filled with sent stanza id (used to track the response) |
Reimplemented in JGSession1.
|
inlinevirtual |
Send a stanza with a stream host used. If the jid is empty, send an item-not-found error response This method is thread safe
| jid | The stream host to send |
| stanzaId | The id of the stanza to confirm |
Reimplemented in JGSession1.
|
inline |
Replace session flags
| value | The new session flags |
|
inline |
|
inline |
|
inline |
Get the arbitrary user data of this session
|
inline |
Set the arbitrary user data of this session
| userdata | The new arbitrary user data's value |
|
inline |
Get the session version
|
static |
Session flag names
|
static |
Termination reasons and errors
Referenced by lookupReason(), and lookupReason().
|
static |
RTP session info (XEP 0167)
|
static |
Session state names
Referenced by lookupState().
|
static |
Session version names
Referenced by lookupVersion(), and lookupVersion().