Session Class Reference

`#include <jinglesession.h>`

Inheritance diagram for Session:
[legend]

## Classes

class | Reason
class | Jingle

## Public Types

enum | State { Ended , Pending , Active }

## Public Member Functions

virtual | ~Session ()
void | setInitiator (const JID &initiator)
const JID & | initiator () const
const JID & | responder () const
void | setResponder (const JID &jid)
void | setHandler (SessionHandler *handler)
bool | contentAccept (const Content *content)
bool | contentAdd (const Content *content)
bool | contentAdd (const PluginList &contents)
bool | contentModify (const Content *content)
bool | contentReject (const Content *content)
bool | contentRemove (const Content *content)
bool | descriptionInfo (const Plugin *info)
bool | securityInfo (const Plugin *info)
bool | sessionAccept (const Content *content)
bool | sessionAccept (const PluginList &plugins)
bool | sessionInfo (const Plugin *info)
bool | sessionInitiate (const Content *content)
bool | sessionInitiate (const PluginList &plugins)
bool | sessionTerminate (Session::Reason *reason)
bool | transportAccept (const Content *content)
bool | transportInfo (const Plugin *info)
bool | transportReject (const Content *content)
bool | transportReplace (const Content *content)
State | state () const
void | setSID (const std::string &sid)
const std::string & | sid () const
virtual bool | handleIq (const IQ &iq)
virtual void | handleIqID (const IQ &iq, int context)
Public Member Functions inherited from IqHandler
virtual | ~IqHandler ()

## Detailed Description

This is an implementation of a Jingle Session (XEP-0166).

See Jingle::SessionManager for info on how to use Jingle in gloox.

XEP Version: 1.1

Author
  Jakob Schröter js@ca.nosp@m.maya.nosp@m..net

Since
  1.0.5

Definition at line 80 of file jinglesession.h.

## Member Enumeration Documentation

## State

enum State

Session state.

Enumerator
Ended | The session has ended or was not active yet.
Pending | The session has been initiated but has not yet been accepted by the remote party.
Active | The session is active.

Definition at line 89 of file jinglesession.h.

## Constructor & Destructor Documentation

## ~Session()

~Session | ( |  | ) |

virtual

Virtual Destructor.

Definition at line 244 of file jinglesession.cpp.

## Member Function Documentation

## contentAccept()

bool contentAccept | ( | const Content * | content | ) |

Sends a 'content-accept' notification.

Parameters

  content | The accepted content. This object will be owned and deleted by this Session instance.

Returns
  False if a prerequisite is not met, true otherwise.

Definition at line 250 of file jinglesession.cpp.

## contentAdd() [1/2]

bool contentAdd | ( | const Content * | content | ) |

Sends a 'content-add' request.

Parameters

  content | The proposed content to be added. This object will be owned and deleted by this Session instance.

Returns
  False if a prerequisite is not met, true otherwise.

Definition at line 258 of file jinglesession.cpp.

## contentAdd() [2/2]

bool contentAdd | ( | const PluginList & | contents | ) |

Sends a 'content-add' request.

Parameters

  contents | A list of proposed content to be added. These objects will be owned and deleted by this Session instance.

Returns
  False if a prerequisite is not met, true otherwise.

Definition at line 266 of file jinglesession.cpp.

## contentModify()

bool contentModify | ( | const Content * | content | ) |

Sends a 'content-modify' request.

Parameters

  content | The proposed content type to be modified. This object will be owned and deleted by this Session instance.

Returns
  False if a prerequisite is not met, true otherwise.

Definition at line 274 of file jinglesession.cpp.

## contentReject()

bool contentReject | ( | const Content * | content | ) |

Sends a 'content-reject' reply.

Parameters

  content | The rejected content. This object will be owned and deleted by this Session instance.

Returns
  False if a prerequisite is not met, true otherwise.

Definition at line 282 of file jinglesession.cpp.

## contentRemove()

bool contentRemove | ( | const Content * | content | ) |

Sends a 'content-remove' request.

Parameters

  content | The content type to be removed. This object will be owned and deleted by this Session instance.

Returns
  False if a prerequisite is not met, true otherwise.

Definition at line 290 of file jinglesession.cpp.

## descriptionInfo()

bool descriptionInfo | ( | const Plugin * | info | ) |

Sends a 'description-info' notice.

Parameters

  info | The payload. This object will be owned and deleted by this Session instance.

Returns
  False if a prerequisite is not met, true otherwise.

Definition at line 298 of file jinglesession.cpp.

## handleIq()

bool handleIq | ( | const IQ & | iq | ) |

virtual

Reimplement this function if you want to be notified about incoming IQs.

Parameters

  iq | The complete IQ stanza.

Returns
  Indicates whether a request of type 'get' or 'set' has been handled. This includes the obligatory 'result' answer. If you return false, an 'error' will be sent back.

Since
  1.0

Implements IqHandler.

Definition at line 419 of file jinglesession.cpp.

## handleIqID()

void handleIqID | ( | const IQ & | iq,
|  | int | context )

virtual

Reimplement this function if you want to be notified about incoming IQs with a specific value of the `id` attribute. You have to enable tracking of those IDs using Client::trackID(). This is usually useful for IDs that generate a empty positive reply, i.e. <iq type='result' id='reg'/> where a namespace filter wouldn't work.

Parameters

  iq | The complete IQ stanza.
  context | A value to restore context, stored with ClientBase::trackID().

Note
  Only IQ stanzas of type 'result' or 'error' can arrive here.

Since
  1.0

Implements IqHandler.

Definition at line 452 of file jinglesession.cpp.

## initiator()

const JID & initiator | ( |  | ) | const

inline

Returns the session's initiator.

Returns
  The session's initiator.

Definition at line 336 of file jinglesession.h.

## responder()

const JID & responder | ( |  | ) | const

inline

Returns the session's responder. This will only return something useful after the 'session-accept' action has been sent/received.

Returns
  The session's responder.

Definition at line 343 of file jinglesession.h.

## securityInfo()

bool securityInfo | ( | const Plugin * | info | ) |

Sends a 'security-info' notice.

Parameters

  info | A security pre-condition. This object will be owned and deleted by this Session instance.

Returns
  False if a prerequisite is not met, true otherwise.

Definition at line 306 of file jinglesession.cpp.

## sessionAccept() [1/2]

bool sessionAccept | ( | const Content * | content | ) |

Accepts an incoming session with the given content.

Parameters

  content | A pair of application description and transport method wrapped in a Content that describes the accepted session parameters. This object will be owned and deleted by this Session instance.

Returns
  False if a prerequisite is not met, true otherwise.

Definition at line 314 of file jinglesession.cpp.

## sessionAccept() [2/2]

bool sessionAccept | ( | const PluginList & | plugins | ) |

Accepts an incoming session with the given list of contents.

Parameters

  plugins | A list of Content objects that describe the accepted session parameters. These objects will be owned and deleted by this Session instance.

Returns
  False if a prerequisite is not met, true otherwise.

Definition at line 323 of file jinglesession.cpp.

## sessionInfo()

bool sessionInfo | ( | const Plugin * | info | ) |

Sends a 'session-info' notice.

Parameters

  info | The payload. This object will be owned and deleted by this Session instance.

Returns
  False if a prerequisite is not met, true otherwise.

Definition at line 332 of file jinglesession.cpp.

## sessionInitiate() [1/2]

bool sessionInitiate | ( | const Content * | content | ) |

Initiates a session with a remote entity.

Parameters

  content | A Content object. You may use initiate( const PluginList& contents ) for more than one Content. This object will be owned and deleted by this Session instance.

Returns
  False if a prerequisite is not met, true otherwise.

Definition at line 340 of file jinglesession.cpp.

## sessionInitiate() [2/2]

bool sessionInitiate | ( | const PluginList & | plugins | ) |

Initiates a session with a remote entity.

Parameters

  plugins | A list of Content objects. It is important to pass a (list of) Content objects here. Even though e.g. Jingle::ICEUDP are Plugin-derived, too, using anything other than Content here will result in erroneous behaviour at best. You may use sessionInitiate( const Content* content ) for just one Content. These objects will be owned and deleted by this Session instance.

Returns
  False if a prerequisite is not met, true otherwise.

Definition at line 349 of file jinglesession.cpp.

## sessionTerminate()

bool sessionTerminate | ( | Session::Reason * | reason | ) |

Terminates the current session, if it is at least in Pending state, with the given reason. The sid parameter is ignored unless the reason is AlternativeSession.

Parameters

  reason | The reason for terminating the session. This object will be owned and deleted by this Session instance.

Returns
  False if a prerequisite is not met, true otherwise.

Definition at line 358 of file jinglesession.cpp.

## setHandler()

void setHandler | ( | SessionHandler * | handler | ) |

inline

Explicitely sets a new handler for the session.

Parameters

  handler | The new handler.

Definition at line 358 of file jinglesession.h.

## setInitiator()

void setInitiator | ( | const JID & | initiator | ) |

inline

Explicitely sets a new session initiator. The initiator defaults to the initiating entity's JID. Normally, you should not need to use this function.

Parameters

  initiator | The new initiator.

Definition at line 330 of file jinglesession.h.

## setResponder()

void setResponder | ( | const JID & | jid | ) |

inline

Explicitely sets the 'session responder'. By default, the associated ClientBase's jid() will be used. You can change this here.

Note
  Changing the session responder only affects the 'session-accept' action; it will have no effect after that action has been executed or if the local entity is the session initiator.

Parameters

  jid | The session responder's full JID.

Definition at line 352 of file jinglesession.h.

## setSID()

void setSID | ( | const std::string & | sid | ) |

inline

Sets the session's ID. This will be initialized to a random value (or taken from an incoming session request) by default. You should not need to set the session ID manually.

Parameters

  sid | The session's id.

Definition at line 519 of file jinglesession.h.

## sid()

const std::string & sid | ( |  | ) | const

inline

Returns the session's ID.

Returns
  The session's ID.

Definition at line 525 of file jinglesession.h.

## state()

State state | ( |  | ) | const

inline

Returns the session's state.

Returns
  The session's state.

Definition at line 512 of file jinglesession.h.

## transportAccept()

bool transportAccept | ( | const Content * | content | ) |

Sends a 'transport-accept' reply.

Parameters

  content | The accepted transport wrapped in a Content. This object will be owned and deleted by this Session instance.

Returns
  False if a prerequisite is not met, true otherwise.

Definition at line 368 of file jinglesession.cpp.

## transportInfo()

bool transportInfo | ( | const Plugin * | info | ) |

Sends a 'transport-info' notice.

Parameters

  info | The payload. This object will be owned and deleted by this Session instance.

Returns
  False if a prerequisite is not met, true otherwise.

Definition at line 376 of file jinglesession.cpp.

## transportReject()

bool transportReject | ( | const Content * | content | ) |

Sends a 'transport-reject' reply.

Parameters

  content | The rejected transport wrapped in a Content. This object will be owned and deleted by this Session instance.

Returns
  False if a prerequisite is not met, true otherwise.

Definition at line 384 of file jinglesession.cpp.

## transportReplace()

bool transportReplace | ( | const Content * | content | ) |

Sends a 'transport-replace' request.

Parameters

  content | The proposed transport to be replaced wrapped in a Content. This object will be owned and deleted by this Session instance.

Returns
  False if a prerequisite is not met, true otherwise.

Definition at line 392 of file jinglesession.cpp.

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

- jinglesession.h
- jinglesession.cpp