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

#### Public Methods

- JBServerStream (JBEngine* engine, Socket* socket, bool component = false)
- JBServerStream (JBEngine* engine, const JabberID& local, const JabberID& remote, const char* dbId = 0, const char* dbKey = 0, bool dbOnly = false, const NamedList* params = 0)
- JBServerStream (JBEngine* engine, const JabberID& local, const JabberID& remote, const String* name = 0, const NamedList* params = 0)
- inline bool dialback () const
- inline const NamedList& remoteDomains () const
- inline bool hasRemoteDomain (const String& domain, bool auth = true)
- inline NamedString* takeDb ()
- virtual JBServerStream* serverStream ()
- bool sendDbVerify (const char* from, const char* to, const char* id, XMPPError::Type rsp = XMPPError::NoError)
- bool sendDbResult (const JabberID& from, const JabberID& to, XMPPError::Type rsp = XMPPError::NoError)
- bool sendDialback ()
- bool startComp (const String& local = String::empty(), const String& remote = String::empty())

#### Protected Methods

- virtual void destroyed ()
- virtual bool processRunning (XmlElement* xml, const JabberID& from, const JabberID& to)
- virtual XmlElement* buildStreamStart ()
- virtual bool processStart (const XmlElement* xml, const JabberID& from, const JabberID& to)
- virtual bool processAuth (XmlElement* xml, const JabberID& from, const JabberID& to)
- bool processDbResult (XmlElement* xml, const JabberID& from, const JabberID& to)
- inline void adjustDbRsp (XMPPError::Type& rsp)

#### Protected Members

- NamedList m_remoteDomains

## Detailed Description

This class holds a server to server stream

JBServerStream (JBEngine* engine, Socket* socket, bool component = false) | ### JBServerStream

Constructor. Build an incoming stream from a socket

Parameters:

engine | Engine owning this stream
socket | The socket
component | True to build an external component stream

JBServerStream (JBEngine* engine, const JabberID& local, const JabberID& remote, const char* dbId = 0, const char* dbKey = 0, bool dbOnly = false, const NamedList* params = 0) | ### JBServerStream

Constructor. Build an outgoing stream

Parameters:

engine | Engine owning this stream
local | Local party jabber id
remote | Remote party jabber id
dbId | Optional dialback id (stream id)
dbKey | Optional dialback key to verify
dbOnly | True if this is a dialback only stream
params | Optional stream parameters

JBServerStream (JBEngine* engine, const JabberID& local, const JabberID& remote, const String* name = 0, const NamedList* params = 0) | ### JBServerStream

Constructor. Build an outgoing component stream

Parameters:

engine | Engine owning this stream
local | Local party jabber id
remote | Remote party jabber id
name | Optional stream name
params | Optional stream parameters

inline bool dialback () | ### dialback

[const]

Check if this is an outgoing dialback stream

Returns: True if this stream is an outgoing dialback one

inline const NamedList& remoteDomains () | ### remoteDomains

[const]

Retrieve the list of remote domains. This method is not thread safe

Returns: The list of remote domains

inline bool hasRemoteDomain (const String& domain, bool auth = true) | ### hasRemoteDomain

Check if this stream has an already authenticated remote domain. This method is not thread safe

Parameters:

domain | Domain to check
auth | Check if the domain is authenticated

Returns: True if a domain was found

inline NamedString* takeDb () | ### takeDb

Take the dialback key from this stream

Returns: NamedString pointer or 0 if there is no dialback key held by this stream

JBServerStream* serverStream () | ### serverStream

[virtual]

Get a server stream from this one

Returns: JBServerStream pointer

Reimplemented from JBStream.

bool sendDbVerify (const char* from, const char* to, const char* id, XMPPError::Type rsp = XMPPError::NoError) | ### sendDbVerify

Send a dialback verify response

Parameters:

from | The 'from' attribute
to | The 'to' attribute
id | The 'id' attribute
rsp | The response as enumeration: set it to NoError if valid, NotAuthorized if invalid or any other error to send a db:verify error type

Returns: True on success

bool sendDbResult (const JabberID& from, const JabberID& to, XMPPError::Type rsp = XMPPError::NoError) | ### sendDbResult

Send a dialback key response. Update the remote domains list. Terminate the stream if there are no more remote domains

Parameters:

from | The 'from' attribute
to | The 'to' attribute
rsp | The response as enumeration: set it to NoError if valid, NotAuthorized if invalid or any other error to send a db:result error type

Returns: True on success

bool sendDialback () | ### sendDialback

Send dialback data (key/verify)

Returns: False if stream termination was initiated

bool startComp (const String& local = String::empty(), const String& remote = String::empty()) | ### startComp

Start a component stream (reply to received stream start). Send handshake if outgoing

Parameters:

local | Local domain. Ignored if outgoing
remote | Remote domain. Ignored if outgoing

Returns: True on success

void destroyed () | ### destroyed

[protected virtual]

Release memory

Reimplemented from JBStream.

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.

XmlElement* buildStreamStart () | ### buildStreamStart

[protected virtual]

Build a stream start XML element

Returns: XmlElement pointer

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 processDbResult (XmlElement* xml, const JabberID& from, const JabberID& to) | ### processDbResult

[protected]

Process dialback key (db:result) requests

Parameters:

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

Returns: False if stream termination was initiated

inline void adjustDbRsp (XMPPError::Type& rsp) | ### adjustDbRsp

[protected]

Adjust a dialback response to avoid sending XEP 0220 'error' to a party not advertising rfc3920 version=1 (might not support it)

Parameters:

rsp | The response to adjust

NamedList m_remoteDomains | ### m_remoteDomains

[protected]

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