# class JBClientStream | A client to server stream. More...
Full name | `TelEngine::JBClientStream`
Definition | `#include <libs/yjabber/yatejabber.h>`
Inherits | TelEngine::JBStream [public ]
List of all Methods
Annotated List
Files
Globals
Hierarchy
Index

#### Public Methods

- JBClientStream (JBEngine* engine, Socket* socket, bool ssl = false)
- JBClientStream (JBEngine* engine, const JabberID& jid, const String& account, const NamedList& params, const char* name = 0, const char* serverHost = 0)
- inline const String& account () const
- inline GenObject* userData ()
- inline void userData (GenObject* data)
- virtual JBClientStream* clientStream ()
- virtual XmlElement* buildPing (const String& stanzaId)
- void bind (const String& resource, const char* id, XMPPError::Type error = XMPPError::NoError)
- bool requestRegister (bool data, bool set = true, const String& newPass = String::empty())

#### Protected Methods

- virtual bool processRunning (XmlElement* xml, const JabberID& from, const JabberID& to)
- virtual bool processStart (const XmlElement* xml, const JabberID& from, const JabberID& to)
- virtual bool processAuth (XmlElement* xml, const JabberID& from, const JabberID& to)
- virtual bool processRegister (XmlElement* xml, const JabberID& from, const JabberID& to)
- virtual void destroyed ()
- bool startAuth ()
- bool bind ()

## Detailed Description

This class holds a client to server stream

JBClientStream (JBEngine* engine, Socket* socket, bool ssl = false) | ### JBClientStream

Constructor. Build an incoming stream from a socket

Parameters:

engine | Engine owning this stream
socket | The socket
ssl | True if the socket is already using SSL/TLS

JBClientStream (JBEngine* engine, const JabberID& jid, const String& account, const NamedList& params, const char* name = 0, const char* serverHost = 0) | ### JBClientStream

Constructor. Build an outgoing stream

Parameters:

engine | Engine owning this stream
jid | User jid
account | Account (stream) name
params | Stream parameters
name | Optional stream name
serverHost | Optional server host to use instead of jid domain

inline const String& account () | ### account

[const]

Retrieve stream's account

Returns: Stream account

inline GenObject* userData () | ### userData

Retrieve stream's user data

Returns: GenObject pointer or 0

inline void userData (GenObject* data) | ### userData

Set stream's user data. Transfer data ownership to the stream This method is thread safe

Parameters:

data | Data to set

JBClientStream* clientStream () | ### clientStream

[virtual]

Get a client stream from this one

Returns: JBClientStream pointer

Reimplemented from JBStream.

XmlElement* buildPing (const String& stanzaId) | ### buildPing

[virtual]

Build a ping iq stanza

Parameters:

stanzaId | Stanza id

Returns: Valid XmlElement pointer

Reimplemented from JBStream.

void bind (const String& resource, const char* id, XMPPError::Type error = XMPPError::NoError) | ### bind

Bind a resource to an incoming stream. This method should be called after processing a Bind event This method is thread safe

Parameters:

resource | Resource to bind. Empty on error
id | Received bind request id
error | Failure reason. Ignored on success

bool requestRegister (bool data, bool set = true, const String& newPass = String::empty()) | ### requestRegister

Request account register or change on outgoing stream. This method is thread safe

Parameters:

data | True to request registration/change, false to request info
set | True to request new user registration, false to remove account from server
newPass | New password when requesting account setup on an already authenticated stream

Returns: True on success

bool processRunning (XmlElement* xml, const JabberID& from, const JabberID& to) | ### processRunning

[protected virtual]

Process elements in Running state

Parameters:

xml | Received element (will be consumed)
from | Already parsed source JID
to | Already parsed destination JID

Returns: False if stream termination was initiated

Reimplemented from JBStream.

bool processStart (const XmlElement* xml, const JabberID& from, const JabberID& to) | ### processStart

[protected virtual]

Process stream start elements while waiting for them

Parameters:

xml | Received xml element
from | The 'from' attribute
to | The 'to' attribute

Returns: False if stream termination was initiated

Reimplemented from JBStream.

bool processAuth (XmlElement* xml, const JabberID& from, const JabberID& to) | ### processAuth

[protected virtual]

Process elements in Auth state

Parameters:

xml | Received element (will be consumed)
from | Already parsed source JID
to | Already parsed destination JID

Returns: False if stream termination was initiated

Reimplemented from JBStream.

bool processRegister (XmlElement* xml, const JabberID& from, const JabberID& to) | ### processRegister

[protected virtual]

Process elements in Register state

Parameters:

xml | Received element (will be consumed)
from | Already parsed source JID
to | Already parsed destination JID

Returns: False if stream termination was initiated

Reimplemented from JBStream.

void destroyed () | ### destroyed

[protected virtual]

Release memory

Reimplemented from JBStream.

bool startAuth () | ### startAuth

[protected]

Start outgoing stream authentication

Returns: True on success

bool bind () | ### bind

[protected]

Start resource binding on outgoing stream

Returns: True on success

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