Yate
Public Member Functions | Protected Member Functions | Protected Attributes | Friends
JBServerStream Class Reference

A server to server stream. More...

#include <yatejabber.h>

Inheritance diagram for JBServerStream:
JBStream RefObject DebugEnabler Mutex GenObject Lockable

List of all members.

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 NamedListremoteDomains () const
bool hasRemoteDomain (const String &domain, bool auth=true)
NamedStringtakeDb ()
virtual JBServerStreamserverStream ()
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 XmlElementbuildStreamStart ()
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

Detailed Description

A server to server stream.

This class holds a server to server stream


Constructor & Destructor Documentation

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

Constructor. Build an incoming stream from a socket

Parameters:
engineEngine owning this stream
socketThe socket
componentTrue 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

Parameters:
engineEngine owning this stream
localLocal party jabber id
remoteRemote party jabber id
dbIdOptional dialback id (stream id)
dbKeyOptional dialback key to verify
dbOnlyTrue if this is a dialback only stream
paramsOptional 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

Parameters:
engineEngine owning this stream
localLocal party jabber id
remoteRemote party jabber id
nameOptional stream name
paramsOptional stream parameters

Member Function Documentation

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)

Parameters:
rspThe response to adjust
virtual XmlElement* buildStreamStart ( ) [protected, virtual]

Build a stream start XML element

Returns:
XmlElement pointer

Reimplemented from JBStream.

virtual void destroyed ( ) [protected, virtual]

Release memory

Reimplemented from JBStream.

bool dialback ( ) const [inline]

Check if this is an outgoing dialback stream

Returns:
True if this stream is an outgoing dialback one
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

Parameters:
domainDomain to check
authCheck if the domain is authenticated
Returns:
True if a domain was found

References String::null().

virtual bool processAuth ( XmlElement xml,
const JabberID from,
const JabberID to 
) [protected, virtual]

Process elements in Auth state

Parameters:
xmlReceived element (will be consumed)
fromAlready parsed source JID
toAlready parsed destination JID
Returns:
False if stream termination was initiated

Reimplemented from JBStream.

bool processDbResult ( XmlElement xml,
const JabberID from,
const JabberID to 
) [protected]

Process dialback key (db:result) requests

Parameters:
xmlReceived element (will be consumed)
fromAlready parsed source JID
toAlready parsed destination JID
Returns:
False if stream termination was initiated
virtual bool processRunning ( XmlElement xml,
const JabberID from,
const JabberID to 
) [protected, virtual]

Process elements in Running state

Parameters:
xmlReceived element (will be consumed)
fromAlready parsed source JID
toAlready parsed destination JID
Returns:
False if stream termination was initiated

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

Parameters:
xmlReceived xml element
fromThe 'from' attribute
toThe 'to' attribute
Returns:
False if stream termination was initiated

Reimplemented from JBStream.

const NamedList& remoteDomains ( ) const [inline]

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

Returns:
The list of remote domains
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

Parameters:
fromThe 'from' attribute
toThe 'to' attribute
rspThe 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 sendDbVerify ( const char *  from,
const char *  to,
const char *  id,
XMPPError::Type  rsp = XMPPError::NoError 
)

Send a dialback verify response

Parameters:
fromThe 'from' attribute
toThe 'to' attribute
idThe 'id' attribute
rspThe 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 sendDialback ( )

Send dialback data (key/verify)

Returns:
False if stream termination was initiated
virtual JBServerStream* serverStream ( ) [inline, virtual]

Get a server stream from this one

Returns:
JBServerStream pointer

Reimplemented from JBStream.

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

Parameters:
localLocal domain. Ignored if outgoing
remoteRemote domain. Ignored if outgoing
Returns:
True on success
NamedString* takeDb ( ) [inline]

Take the dialback key from this stream

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

Member Data Documentation

Incoming stream remote domains. Each element's value will contain the dialback key if not authenticated


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