Yate
|
A server to server stream. More...
#include <yatejabber.h>
Public Member Functions | |
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) | |
bool | dialback () const |
const NamedList & | remoteDomains () const |
bool | hasRemoteDomain (const String &domain, bool auth=true) |
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 Member Functions | |
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) |
void | adjustDbRsp (XMPPError::Type &rsp) |
Protected Attributes | |
NamedList | m_remoteDomains |
Friends | |
class | JBStream |
A server to server stream.
This class holds a server to server stream
JBServerStream | ( | JBEngine * | engine, |
Socket * | socket, | ||
bool | component = false |
||
) |
Constructor. Build an incoming stream from a socket
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 |
||
) |
Constructor. Build an outgoing stream
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 |
||
) |
Constructor. Build an outgoing component stream
engine | Engine owning this stream |
local | Local party jabber id |
remote | Remote party jabber id |
name | Optional stream name |
params | Optional stream parameters |
void adjustDbRsp | ( | XMPPError::Type & | rsp | ) | [inline, protected] |
Adjust a dialback response to avoid sending XEP 0220 'error' to a party not advertising rfc3920 version=1 (might not support it)
rsp | The response to adjust |
virtual XmlElement* buildStreamStart | ( | ) | [protected, virtual] |
bool dialback | ( | ) | const [inline] |
Check if this is an outgoing dialback stream
bool hasRemoteDomain | ( | const String & | domain, |
bool | auth = true |
||
) | [inline] |
Check if this stream has an already authenticated remote domain. This method is not thread safe
domain | Domain to check |
auth | Check if the domain is authenticated |
References String::null().
virtual bool processAuth | ( | XmlElement * | xml, |
const JabberID & | from, | ||
const JabberID & | to | ||
) | [protected, virtual] |
Process elements in Auth state
xml | Received element (will be consumed) |
from | Already parsed source JID |
to | Already parsed destination JID |
Reimplemented from JBStream.
bool processDbResult | ( | XmlElement * | xml, |
const JabberID & | from, | ||
const JabberID & | to | ||
) | [protected] |
Process dialback key (db:result) requests
xml | Received element (will be consumed) |
from | Already parsed source JID |
to | Already parsed destination JID |
virtual bool processRunning | ( | XmlElement * | xml, |
const JabberID & | from, | ||
const JabberID & | to | ||
) | [protected, virtual] |
Process elements in Running state
xml | Received element (will be consumed) |
from | Already parsed source JID |
to | Already parsed destination JID |
Reimplemented from JBStream.
virtual bool processStart | ( | const XmlElement * | xml, |
const JabberID & | from, | ||
const JabberID & | to | ||
) | [protected, virtual] |
Process stream start elements while waiting for them
xml | Received xml element |
from | The 'from' attribute |
to | The 'to' attribute |
Reimplemented from JBStream.
const NamedList& remoteDomains | ( | ) | const [inline] |
Retrieve the list of remote domains. This method is not thread safe
bool sendDbResult | ( | const JabberID & | from, |
const JabberID & | to, | ||
XMPPError::Type | rsp = XMPPError::NoError |
||
) |
Send a dialback key response. Update the remote domains list. Terminate the stream if there are no more remote domains
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 |
bool sendDbVerify | ( | const char * | from, |
const char * | to, | ||
const char * | id, | ||
XMPPError::Type | rsp = XMPPError::NoError |
||
) |
Send a dialback verify response
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 |
bool sendDialback | ( | ) |
Send dialback data (key/verify)
virtual JBServerStream* serverStream | ( | ) | [inline, virtual] |
bool startComp | ( | const String & | local = String::empty() , |
const String & | remote = String::empty() |
||
) |
Start a component stream (reply to received stream start). Send handshake if outgoing
local | Local domain. Ignored if outgoing |
remote | Remote domain. Ignored if outgoing |
NamedString* takeDb | ( | ) | [inline] |
Take the dialback key from this stream
NamedList m_remoteDomains [protected] |
Incoming stream remote domains. Each element's value will contain the dialback key if not authenticated