Yate
JBClusterStream Class Reference

A cluster stream. More...

#include <yatejabber.h>

Inheritance diagram for JBClusterStream:
JBStream RefObject DebugEnabler Mutex GenObject Lockable

Public Member Functions

 JBClusterStream (JBEngine *engine, Socket *socket)
 
 JBClusterStream (JBEngine *engine, const JabberID &local, const JabberID &remote, const NamedList *params=0)
 
virtual JBClusterStreamclusterStream ()
 
- Public Member Functions inherited from JBStream
virtual ~JBStream ()
 
int type () const
 
int xmlns () const
 
State state () const
 
bool incoming () const
 
bool outgoing () const
 
JBEngineengine () const
 
const char * name () const
 
const Stringid () const
 
bool isId (const String &str)
 
const JabberIDlocal () const
 
void local (JabberID &jid)
 
void setLocal (const char *jid)
 
const JabberIDremote () const
 
void remote (JabberID &jid)
 
bool remoteAddr (SocketAddr &addr)
 
bool localAddr (SocketAddr &addr)
 
int flags () const
 
bool flag (int mask) const
 
void setTlsRequired (bool set)
 
bool haveData ()
 
void connectAddr (String &addr, int &port, String &localip, int &stat, ObjList &srvs, bool *isRedirect=0) const
 
const StringserverHost () const
 
void setRosterRequested (bool ok)
 
bool setAvailableResource (bool ok, bool positive=true)
 
bool readSocket (char *buf, unsigned int len)
 
virtual JBClientStreamclientStream ()
 
virtual JBServerStreamserverStream ()
 
JBEventgetEvent (u_int64_t time=Time::msecNow())
 
bool sendStanza (XmlElement *&xml)
 
bool sendStreamXml (State newState, XmlElement *first, XmlElement *second=0, XmlElement *third=0)
 
void start (XMPPFeatureList *features=0, XmlElement *caps=0, bool useVer1=true)
 
bool authenticated (bool ok, const String &rsp=String::empty(), XMPPError::Type error=XMPPError::NotAuthorized, const char *username=0, const char *id=0, const char *resource=0)
 
void terminate (int location, bool destroy, XmlElement *xml, int error=XMPPError::NoError, const char *reason="", bool final=false, bool genEvent=true, const char *content=0)
 
virtual void connectTerminated (Socket *&sock)
 
virtual bool connecting (bool sync, int stat, ObjList &srvs)
 
virtual void * getObject (const String &name) const
 
const char * stateName () const
 
const char * typeName () const
 
void buildSha1Digest (String &buf, const String &secret)
 
virtual const StringtoString () const
 
- Public Member Functions inherited from RefObject
 RefObject ()
 
virtual ~RefObject ()
 
virtual bool alive () const
 
bool ref ()
 
bool deref ()
 
int refcount () const
 
virtual void destruct ()
 
- Public Member Functions inherited from GenObject
 GenObject ()
 
virtual ~GenObject ()
 
virtual const StringtraceId () const
 
NamedCountergetObjCounter () const
 
NamedCountersetObjCounter (NamedCounter *counter)
 
- Public Member Functions inherited from DebugEnabler
 DebugEnabler (int level=TelEngine::debugLevel(), bool enabled=true)
 
int debugLevel () const
 
int debugLevel (int level)
 
bool debugEnabled () const
 
void debugEnabled (bool enable)
 
const char * debugName () const
 
bool debugAt (int level) const
 
bool debugChained () const
 
void debugChain (const DebugEnabler *chain=0)
 
void debugCopy (const DebugEnabler *original=0)
 
- Public Member Functions inherited from Mutex
 Mutex (bool recursive=false, const char *name=0)
 
 Mutex (const Mutex &original)
 
 ~Mutex ()
 
Mutexoperator= (const Mutex &original)
 
virtual bool lock (long maxwait=-1)
 
virtual bool unlock ()
 
virtual bool locked () const
 
const char * owner () const
 
bool recursive () const
 
- Public Member Functions inherited from Lockable
virtual ~Lockable ()
 
virtual bool check (long maxwait=-1)
 
virtual bool unlockAll ()
 

Protected Member Functions

virtual XmlElementbuildStreamStart ()
 
virtual bool processStart (const XmlElement *xml, const JabberID &from, const JabberID &to)
 
virtual bool processRunning (XmlElement *xml, const JabberID &from, const JabberID &to)
 
- Protected Member Functions inherited from JBStream
 JBStream (JBEngine *engine, Socket *socket, Type t, bool ssl=false)
 
 JBStream (JBEngine *engine, Type t, const JabberID &local, const JabberID &remote, const char *name=0, const NamedList *params=0, const char *serverHost=0)
 
virtual void destroyed ()
 
virtual bool canProcess (u_int64_t time)
 
virtual void process (u_int64_t time)
 
virtual void checkTimeouts (u_int64_t time)
 
virtual void resetConnection (Socket *sock=0)
 
virtual XmlElementbuildPing (const String &stanzaId)
 
virtual bool processAuth (XmlElement *xml, const JabberID &from, const JabberID &to)
 
virtual bool processCompressing (XmlElement *xml, const JabberID &from, const JabberID &to)
 
virtual bool processRegister (XmlElement *xml, const JabberID &from, const JabberID &to)
 
bool processStreamStart (const XmlElement *xml)
 
bool handleCompressReq (XmlElement *xml)
 
bool streamError (XmlElement *xml)
 
bool getJids (XmlElement *xml, JabberID &from, JabberID &to)
 
bool checkStanzaRecv (XmlElement *xml, JabberID &from, JabberID &to)
 
void changeState (State newState, u_int64_t time=Time::msecNow())
 
XmlElementcheckCompress ()
 
void checkPendingEvent ()
 
bool sendPending (bool streamOnly=false)
 
bool writeSocket (const void *data, unsigned int &len)
 
void updateFromRemoteDef ()
 
XMPPFeaturefirstRequiredFeature ()
 
bool dropXml (XmlElement *&xml, const char *reason)
 
bool destroyDropXml (XmlElement *&xml, XMPPError::Type error, const char *reason)
 
void setFlags (int mask)
 
void resetFlags (int mask)
 
void setSecured ()
 
void setIdleTimer (u_int64_t msecNow=Time::msecNow())
 
void resetPing ()
 
XmlElementsetNextPing (bool force)
 
void generateIdIndex (String &buf, const char *extra=0)
 
- Protected Member Functions inherited from RefObject
virtual void zeroRefs ()
 
bool resurrect ()
 
- Protected Member Functions inherited from DebugEnabler
void debugName (const char *name)
 

Friends

class JBStream
 

Additional Inherited Members

- Public Types inherited from JBStream
enum  Type {
  c2s = 0 , s2s , comp , cluster ,
  TypeCount
}
 
enum  State {
  Idle = 0 , Connecting , WaitStart , Starting ,
  Features , WaitTlsRsp , Securing , Auth ,
  Challenge , Compressing , Register , Running ,
  Destroy
}
 
enum  Flags {
  NoAutoRestart = 0x00000001 , TlsRequired = 0x00000002 , AllowPlainAuth = 0x00000004 , DialbackOnly = 0x00000008 ,
  RegisterUser = 0x00000010 , Compress = 0x00000020 , InError = 0x00000080 , RosterRequested = 0x00000100 ,
  AvailableResource = 0x00000200 , PositivePriority = 0x00000400 , SetCompressed = 0x00010000 , StreamSecured = 0x00020000 ,
  StreamTls = 0x00040000 , StreamAuthenticated = 0x00080000 , StreamRemoteVer1 = 0x00100000 , StreamLocalVer1 = 0x00200000 ,
  StreamWaitBindRsp = 0x01000000 , StreamWaitSessRsp = 0x02000000 , StreamWaitChallenge = 0x04000000 , StreamWaitChgRsp = 0x08000000 ,
  StreamRfc3920Chg = 0x10000000 , StreamCompressed = 0x20000000 , StreamCanCompress = 0x40000000 , StreamFlags = 0x000000ff ,
  InternalFlags = 0xffff0000
}
 
- Static Public Member Functions inherited from JBStream
static Type lookupType (const char *text, Type defVal=TypeCount)
 
- Static Public Member Functions inherited from RefObject
static bool alive (const RefObject *obj)
 
static bool efficientIncDec ()
 
- Static Public Member Functions inherited from GenObject
static void * getObject (const String &name, const GenObject *obj)
 
static bool getObjCounting ()
 
static void setObjCounting (bool enable)
 
static NamedCountergetObjCounter (const String &name, bool create=true)
 
static ObjListgetObjCounters ()
 
- Static Public Member Functions inherited from Mutex
static int count ()
 
static int locks ()
 
static bool efficientTimedLock ()
 
- Static Public Member Functions inherited from Lockable
static void wait (unsigned long maxwait)
 
static unsigned long wait ()
 
static void startUsingNow ()
 
static void enableSafety (bool safe=true)
 
static bool safety ()
 
- Public Attributes inherited from JBStream
SASLm_sasl
 
- Static Public Attributes inherited from JBStream
static const TokenDict s_stateName []
 
static const TokenDict s_flagName []
 
static const TokenDict s_typeName []
 
- Protected Attributes inherited from JBStream
State m_state
 
String m_id
 
JabberID m_local
 
JabberID m_remote
 
String m_serverHost
 
int m_flags
 
XMPPNamespace::Type m_xmlns
 
XMPPFeatureList m_features
 
JBEventm_lastEvent
 
ObjList m_events
 
ObjList m_pending
 
unsigned int m_stanzaIndex
 
u_int64_t m_setupTimeout
 
u_int64_t m_startTimeout
 
u_int64_t m_pingTimeout
 
u_int64_t m_pingInterval
 
u_int64_t m_nextPing
 
u_int64_t m_idleTimeout
 
u_int64_t m_connectTimeout
 
unsigned int m_restart
 
u_int64_t m_timeToFillRestart
 
String m_pingId
 

Detailed Description

A cluster stream.

This class holds a cluster stream

Constructor & Destructor Documentation

◆ JBClusterStream() [1/2]

JBClusterStream ( JBEngine * engine,
Socket * socket )

Constructor. Build an incoming stream from a socket

Parameters
engineEngine owning this stream
socketThe socket

References JBStream::engine().

Referenced by clusterStream().

◆ JBClusterStream() [2/2]

JBClusterStream ( JBEngine * engine,
const JabberID & local,
const JabberID & remote,
const NamedList * params = 0 )

Constructor. Build an outgoing stream

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

References JBStream::engine(), JBStream::local(), and JBStream::remote().

Member Function Documentation

◆ buildStreamStart()

virtual XmlElement * buildStreamStart ( )
protectedvirtual

Build a stream start XML element

Returns
XmlElement pointer

Reimplemented from JBStream.

◆ clusterStream()

virtual JBClusterStream * clusterStream ( )
inlinevirtual

Get a cluster stream from this one

Returns
JBClusterStream pointer

Reimplemented from JBStream.

References JBClusterStream().

◆ processRunning()

virtual bool processRunning ( XmlElement * xml,
const JabberID & from,
const JabberID & to )
protectedvirtual

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.

◆ processStart()

virtual bool processStart ( const XmlElement * xml,
const JabberID & from,
const JabberID & to )
protectedvirtual

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.


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