|
Yate
|
A client to server stream. More...
#include <yatejabber.h>
Public Member Functions | |
| JBClientStream (JBEngine *engine, Socket *socket, bool ssl=false) | |
| JBClientStream (JBEngine *engine, const JabberID &jid, const String &account, const NamedList ¶ms, const char *name=0, const char *serverHost=0) | |
| const String & | account () const |
| GenObject * | userData () |
| 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()) |
Public Member Functions inherited from JBStream | |
| virtual | ~JBStream () |
| int | type () const |
| int | xmlns () const |
| State | state () const |
| bool | incoming () const |
| bool | outgoing () const |
| JBEngine * | engine () const |
| const char * | name () const |
| const String & | id () const |
| bool | isId (const String &str) |
| const JabberID & | local () const |
| void | local (JabberID &jid) |
| void | setLocal (const char *jid) |
| const JabberID & | remote () 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 String & | serverHost () const |
| void | setRosterRequested (bool ok) |
| bool | setAvailableResource (bool ok, bool positive=true) |
| bool | readSocket (char *buf, unsigned int len) |
| virtual JBServerStream * | serverStream () |
| virtual JBClusterStream * | clusterStream () |
| JBEvent * | getEvent (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 String & | toString () 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 String & | traceId () const |
| NamedCounter * | getObjCounter () const |
| NamedCounter * | setObjCounter (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 () | |
| Mutex & | operator= (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 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 () |
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 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 XmlElement * | buildStreamStart () |
| virtual bool | processCompressing (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()) |
| XmlElement * | checkCompress () |
| void | checkPendingEvent () |
| bool | sendPending (bool streamOnly=false) |
| bool | writeSocket (const void *data, unsigned int &len) |
| void | updateFromRemoteDef () |
| XMPPFeature * | firstRequiredFeature () |
| 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 () |
| XmlElement * | setNextPing (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 NamedCounter * | getObjCounter (const String &name, bool create=true) |
| static ObjList & | getObjCounters () |
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 | |
| SASL * | m_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 |
| JBEvent * | m_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 |
A client to server stream.
This class holds a client to server stream
| JBClientStream | ( | JBEngine * | engine, |
| Socket * | socket, | ||
| bool | ssl = false ) |
Constructor. Build an incoming stream from a socket
| engine | Engine owning this stream |
| socket | The socket |
| ssl | True if the socket is already using SSL/TLS |
References JBStream::engine().
Referenced by clientStream().
| JBClientStream | ( | JBEngine * | engine, |
| const JabberID & | jid, | ||
| const String & | account, | ||
| const NamedList & | params, | ||
| const char * | name = 0, | ||
| const char * | serverHost = 0 ) |
Constructor. Build an outgoing stream
| 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 |
References account(), JBStream::engine(), JBStream::name(), and JBStream::serverHost().
|
inline |
|
protected |
Start resource binding on outgoing stream
| void bind | ( | const String & | resource, |
| const char * | id, | ||
| XMPPError::Type | error = XMPPError::NoError ) |
Bind a resource to an incoming stream. This method should be called after processing a Bind event This method is thread safe
| resource | Resource to bind. Empty on error |
| id | Received bind request id |
| error | Failure reason. Ignored on success |
|
virtual |
Build a ping iq stanza
| stanzaId | Stanza id |
Reimplemented from JBStream.
|
inlinevirtual |
Get a client stream from this one
Reimplemented from JBStream.
References JBClientStream().
|
protectedvirtual |
Release memory
Reimplemented from JBStream.
|
protectedvirtual |
Process elements in Auth state
| xml | Received element (will be consumed) |
| from | Already parsed source JID |
| to | Already parsed destination JID |
Reimplemented from JBStream.
|
protectedvirtual |
Process elements in Register state
| xml | Received element (will be consumed) |
| from | Already parsed source JID |
| to | Already parsed destination JID |
Reimplemented from JBStream.
|
protectedvirtual |
Process elements in Running state
| xml | Received element (will be consumed) |
| from | Already parsed source JID |
| to | Already parsed destination JID |
Reimplemented from JBStream.
|
protectedvirtual |
Process stream start elements while waiting for them
| xml | Received xml element |
| from | The 'from' attribute |
| to | The 'to' attribute |
Reimplemented from JBStream.
| bool requestRegister | ( | bool | data, |
| bool | set = true, | ||
| const String & | newPass = String::empty() ) |
Request account register or change on outgoing stream. This method is thread safe
| 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 |
References String::empty().
|
protected |
Start outgoing stream authentication
|
inline |
|
inline |
Set stream's user data. Transfer data ownership to the stream This method is thread safe
| data | Data to set |
References GenObject::GenObject(), and Mutex::lock().