53#define XMPP_C2S_PORT 5222
58#define XMPP_S2S_PORT 5269
64#define XMPP_MAX_INCOMPLETEXML 8192
80 SASL(
bool plain,
const char* realm = 0);
86 { TelEngine::destruct(m_params); }
111 String tmp(
"rspauth=" + rsp);
145 bool challengeRsp =
true) {
193 const char* password,
bool challengeRsp =
true);
200 unsigned int m_nonceCount;
215 friend class JBStream;
216 friend class JBClientStream;
217 friend class JBServerStream;
271 : m_type(
type), m_stream(0), m_link(true), m_element(
element),
284 : m_type(
type), m_stream(0), m_link(true), m_element(
element),
304 inline const char*
name()
const
312 {
return m_stanzaType; }
373 {
return m_element; }
441 {
return TelEngine::lookup(
type,s_type); }
446 bool init(JBStream* stream, XmlElement* element,
452 XmlElement* m_element;
470 friend class JBEngine;
471 friend class JBEvent;
514 NoAutoRestart = 0x00000001,
515 TlsRequired = 0x00000002,
516 AllowPlainAuth = 0x00000004,
519 DialbackOnly = 0x00000008,
520 RegisterUser = 0x00000010,
521 Compress = 0x00000020,
522 InError = 0x00000080,
524 RosterRequested = 0x00000100,
525 AvailableResource = 0x00000200,
526 PositivePriority = 0x00000400,
528 SetCompressed = 0x00010000,
530 StreamSecured = 0x00020000,
531 StreamTls = 0x00040000,
532 StreamAuthenticated = 0x00080000,
533 StreamRemoteVer1 = 0x00100000,
534 StreamLocalVer1 = 0x00200000,
535 StreamWaitBindRsp = 0x01000000,
536 StreamWaitSessRsp = 0x02000000,
537 StreamWaitChallenge = 0x04000000,
538 StreamWaitChgRsp = 0x08000000,
539 StreamRfc3920Chg = 0x10000000,
540 StreamCompressed = 0x20000000,
541 StreamCanCompress = 0x40000000,
543 StreamFlags = 0x000000ff,
544 InternalFlags = 0xffff0000,
579 {
return m_incoming; }
586 {
return !m_incoming; }
599 inline const char*
name()
const
642 { m_local.set(jid); }
669 return m_socket && m_socket->getPeerName(addr);
680 return m_socket && m_socket->getSockName(addr);
695 inline bool flag(
int mask)
const
696 {
return 0 != (m_flags & mask); }
730 ObjList& srvs,
bool* isRedirect = 0)
const;
738 {
return m_serverHost ? m_serverHost : m_remote.domain(); }
844 const char* username = 0,
const char*
id = 0,
const char* resource = 0);
861 int error = XMPPError::NoError,
const char* reason =
"",
862 bool final =
false,
bool genEvent =
true,
const char* content = 0);
907 SHA1 sha(
id() + secret);
1200 m_features.remove(XMPPNamespace::Tls);
1229 { buf =
id() + extra +
String(++m_stanzaIndex); }
1242 unsigned int m_stanzaIndex;
1244 u_int64_t m_setupTimeout;
1245 u_int64_t m_startTimeout;
1246 u_int64_t m_pingTimeout;
1247 u_int64_t m_pingInterval;
1248 u_int64_t m_nextPing;
1249 u_int64_t m_idleTimeout;
1250 u_int64_t m_connectTimeout;
1252 unsigned int m_restart;
1253 u_int64_t m_timeToFillRestart;
1263 bool processChallenge(XmlElement* xml,
const JabberID& from,
1268 bool processSaslAuth(XmlElement* xml,
const JabberID& from,
1273 bool processFeaturesIn(XmlElement* xml,
const JabberID& from,
1278 bool processFeaturesOut(XmlElement* xml,
const JabberID& from,
1283 bool processWaitTlsRsp(XmlElement* xml,
const JabberID& from,
1289 void eventTerminated(
const JBEvent* event);
1294 void resetConnectStatus();
1298 void postponeTerminate(
int location,
bool destroy,
int error,
const char* reason);
1301 bool postponedTerminate();
1305 inline void resetPostponedTerminate() {
1306 m_ppTerminateTimeout = 0;
1307 TelEngine::destruct(m_ppTerminate);
1311 SocketCanRead = 0x01,
1312 SocketReading = 0x02,
1313 SocketCanWrite = 0x10,
1314 SocketWriting = 0x20,
1315 SocketWaitReset = 0x80,
1317 inline void socketSetCanRead(
bool ok) {
1318 Lock lock(m_socketMutex);
1320 m_socketFlags |= SocketCanRead;
1322 m_socketFlags &= ~SocketCanRead;
1324 inline void socketSetReading(
bool ok) {
1326 m_socketFlags |= SocketReading;
1328 m_socketFlags &= ~SocketReading;
1330 inline void socketSetCanWrite(
bool ok) {
1331 Lock lock(m_socketMutex);
1333 m_socketFlags |= SocketCanWrite;
1335 m_socketFlags &= ~SocketCanWrite;
1337 inline void socketSetWriting(
bool ok) {
1339 m_socketFlags |= SocketWriting;
1341 m_socketFlags &= ~SocketWriting;
1343 inline bool socketCanRead()
const {
1344 return m_socket && (m_socketFlags & SocketCanRead) &&
1347 inline bool socketCanWrite()
const {
1348 return m_socket && (m_socketFlags & SocketCanWrite) &&
1351 inline bool socketReading()
const
1352 {
return (m_socketFlags & SocketReading) != 0; }
1353 inline bool socketWriting()
const
1354 {
return (m_socketFlags & SocketWriting) != 0; }
1355 inline bool socketWaitReset()
const
1356 {
return 0 != (m_socketFlags & SocketWaitReset); }
1362 JBEvent* m_terminateEvent;
1363 NamedList* m_ppTerminate;
1364 u_int64_t m_ppTerminateTimeout;
1366 String m_outStreamXml;
1367 DataBlock m_outStreamXmlCompress;
1368 DataBlock m_outXmlCompress;
1370 XmlDomParser* m_xmlDom;
1373 Mutex m_socketMutex;
1374 String m_connectAddr;
1377 Compressor* m_compress;
1378 int m_connectStatus;
1379 ObjList m_connectSrvs;
1380 unsigned int m_redirectMax;
1381 unsigned int m_redirectCount;
1382 String m_redirectAddr;
1394 friend class JBStream;
1421 {
return m_account; }
1428 {
return m_userData; }
1437 TelEngine::destruct(m_userData);
1541 return id &&
id->
length() == 1 && (*id)[0] == m_registerReq;
1559 friend class JBStream;
1580 const char* dbId = 0,
const char* dbKey = 0,
bool dbOnly =
false,
1618 return tmp && (!auth || tmp->
null());
1736 if (!
flag(StreamRemoteVer1) && rsp != XMPPError::NoError)
1737 rsp = XMPPError::NotAuthorized;
1759 friend class JBStream;
1906 bool exiting(
Socket*& sock);
1909 Socket* connect(
const char* addr,
int port,
bool& stop);
1911 void terminated(
Socket* sock,
bool final);
1913 bool notifyConnecting(
bool sync,
bool useCurrentStat =
false);
1915 void deleteSocket(
Socket*& sock);
1917 void advanceStatus();
1938 friend class JBStream;
1939 friend class JBConnect;
1940 friend class JBStreamSetProcessor;
1958 {
return m_streamReadBuffer; }
1965 {
return m_exiting; }
1975 XMPPError::Shutdown);
1983 {
return m_redirectMax; }
1990 {
return m_hasClientTls; }
2019 virtual void cleanup(
bool final =
false,
bool waitTerminate =
true);
2064 int flags = 0xffffffff);
2120 const char* reason = 0);
2212 int type = JBStream::TypeCount) {
2213 if (type == JBStream::c2s || type == JBStream::TypeCount)
2215 if (type == JBStream::s2s || type == JBStream::TypeCount)
2217 if (type == JBStream::comp || type == JBStream::TypeCount)
2219 if (type == JBStream::cluster || type == JBStream::TypeCount)
2234 unsigned char m_restartMax;
2235 unsigned int m_restartUpdInterval;
2236 unsigned int m_setupTimeout;
2237 unsigned int m_startTimeout;
2238 unsigned int m_connectTimeout;
2239 unsigned int m_srvTimeout;
2240 unsigned int m_pingInterval;
2241 unsigned int m_pingTimeout;
2242 unsigned int m_idleTimeout;
2243 unsigned int m_pptTimeoutC2s;
2244 unsigned int m_pptTimeout;
2245 unsigned int m_streamReadBuffer;
2246 unsigned int m_maxIncompleteXml;
2247 unsigned int m_redirectMax;
2248 bool m_hasClientTls;
2254 void connectStatus(JBConnect* conn,
bool started);
2256 void stopConnect(
const String& name);
2285 virtual void cleanup(
bool final =
false,
bool waitTerminate =
true);
2320 const char* dbId = 0,
const char* dbKey = 0,
bool dbOnly =
false,
2408 return ++m_streamIndex;
2411 unsigned int m_streamIndex;
2446 virtual void cleanup(
bool final =
false,
bool waitTerminate =
true);
2506 friend class JBStreamSetList;
2519 {
return m_clients; }
2585 JBStreamSetList* m_owner;
2657 friend class JBStreamSet;
2694 {
return m_streamCount; }
2701 {
return m_engine; }
2723 void stop(JBStreamSet* set = 0,
bool waitTerminate =
true);
2752 unsigned int m_sleepMs;
2758 unsigned int m_streamCount;
2786 inline JBEntityCaps(
const char*
id,
char version,
const char* node,
const char* data)
2788 m_version(version), m_node(node), m_data(data)
2797 {
return 0 != m_features.get(ns); }
2804 return hasFeature(XMPPNamespace::JingleAppsRtpAudio) ||
2818 const char* data,
String* ext = 0)
2819 { buf << (int)version << node << data << (ext ? ext->c_str() :
""); }
2844 :
Mutex(true,
"JBEntityCapsList"),
m_enable(true), m_reqIndex(0)
2845 { m_reqPrefix <<
"xep0115" << (
unsigned int)
Time::msecNow() <<
"_"; }
2854 if (o->get()->toString() ==
id)
2888 char version,
const char* node,
const char* data);
2920 const char* from,
const char* to);
2987 unsigned int m_reqIndex;
Base64 encoder/decoder class.
Definition yateclass.h:4947
void encode(String &dest, unsigned int lineLen=0, bool lineAtEnd=false)
A class that holds just a block of raw data.
Definition yateclass.h:4237
void clear(bool deleteData=true)
A holder for a debug level.
Definition yateclass.h:312
DebugEnabler(int level=TelEngine::debugLevel(), bool enabled=true)
Definition yateclass.h:319
Definition yateclass.h:1049
const String & hexDigest()
Definition yateclass.h:4529
A Jabber ID.
Definition xmpputils.h:429
static const JabberID & empty()
Ephemeral mutex or semaphore locking object.
Definition yateclass.h:5833
Mutex(bool recursive=false, const char *name=0)
const char * owner() const
virtual bool lock(long maxwait=-1)
A named string container class.
Definition yateclass.h:5016
A named string class.
Definition yateclass.h:3481
An object list class.
Definition yateclass.h:1454
ObjList * find(const GenObject *obj) const
ObjList * skipNull() const
ObjList * skipNext() const
GenObject * get() const
Definition yateclass.h:1490
Templated smart pointer class.
Definition yateclass.h:1306
A standard SHA1 digest calculator.
Definition yateclass.h:4763
A socket address holder.
Definition yateclass.h:6400
A generic socket class.
Definition yateclass.h:7361
A C-style string handling class.
Definition yateclass.h:2131
const char * c_str() const
Definition yateclass.h:2236
bool null() const
Definition yateclass.h:2265
static const String & empty()
unsigned int length() const
Definition yateclass.h:2258
A Jabber client engine.
Definition yatejabber.h:2427
virtual void stopStreamSets(bool waitTerminate=true)
virtual void addStream(JBStream *stream)
JBClientStream * create(const String &account, const NamedList ¶ms, const String &name=String::empty())
JBClientEngine(const char *name="jbclientengine")
virtual void removeStream(JBStream *stream, bool delObj=true)
virtual void getStreamList(RefPointer< JBStreamSetList > &list, int type)
JBClientStream * findAccount(const String &account)
virtual void cleanup(bool final=false, bool waitTerminate=true)
A client to server stream.
Definition yatejabber.h:1392
void userData(GenObject *data)
Definition yatejabber.h:1435
virtual JBClientStream * clientStream()
Definition yatejabber.h:1445
virtual bool processStart(const XmlElement *xml, const JabberID &from, const JabberID &to)
JBClientStream(JBEngine *engine, const JabberID &jid, const String &account, const NamedList ¶ms, const char *name=0, const char *serverHost=0)
virtual XmlElement * buildPing(const String &stanzaId)
void bind(const String &resource, const char *id, XMPPError::Type error=XMPPError::NoError)
virtual bool processRunning(XmlElement *xml, const JabberID &from, const JabberID &to)
virtual bool processAuth(XmlElement *xml, const JabberID &from, const JabberID &to)
JBClientStream(JBEngine *engine, Socket *socket, bool ssl=false)
bool requestRegister(bool data, bool set=true, const String &newPass=String::empty())
GenObject * userData()
Definition yatejabber.h:1427
virtual bool processRegister(XmlElement *xml, const JabberID &from, const JabberID &to)
const String & account() const
Definition yatejabber.h:1420
A cluster stream.
Definition yatejabber.h:1757
virtual JBClusterStream * clusterStream()
Definition yatejabber.h:1782
virtual bool processStart(const XmlElement *xml, const JabberID &from, const JabberID &to)
JBClusterStream(JBEngine *engine, Socket *socket)
virtual bool processRunning(XmlElement *xml, const JabberID &from, const JabberID &to)
virtual XmlElement * buildStreamStart()
JBClusterStream(JBEngine *engine, const JabberID &local, const JabberID &remote, const NamedList *params=0)
A socket connector.
Definition yatejabber.h:1854
virtual void stopConnect()
JBConnect(const JBStream &stream)
virtual const String & toString() const
static const TokenDict s_statusName[]
Definition yatejabber.h:1889
A Jabber engine.
Definition yatejabber.h:1936
virtual void stopStreamSets(bool waitTerminate=true)
Definition yatejabber.h:2193
virtual bool hasDomain(const String &domain)
Definition yatejabber.h:2102
bool hasClientTls() const
Definition yatejabber.h:1989
virtual void printXml(const JBStream *stream, bool send, XmlChild &xml) const
virtual unsigned int dropAll(JBStream::Type type=JBStream::TypeCount, const JabberID &local=JabberID::empty(), const JabberID &remote=JabberID::empty(), XMPPError::Type error=XMPPError::NoError, const char *reason=0)
virtual void addStream(JBStream *stream)
ObjList * findClientStreams(bool in, const JabberID &jid, int flags=0xffffffff)
JBEngine(const char *name="jbengine")
void getStreamLists(RefPointer< JBStreamSetList > list[JBStream::TypeCount], int type=JBStream::TypeCount)
Definition yatejabber.h:2211
JBRemoteDomainDef * remoteDomainDef(const String &domain)
Definition yatejabber.h:1998
bool checkDupId(JBStream *stream)
bool acceptConn(Socket *sock, SocketAddr &remote, JBStream::Type t, bool ssl=false)
bool exiting() const
Definition yatejabber.h:1964
virtual void processEvent(JBEvent *ev)
virtual void connectStream(JBStream *stream)
void setExiting()
Definition yatejabber.h:1970
ObjList * findClientStreams(bool in, const JabberID &jid, const ObjList &resources, int flags=0xffffffff)
virtual void removeStream(JBStream *stream, bool delObj=true)
virtual void returnEvent(JBEvent *ev, XMPPError::Type error=XMPPError::NoError, const char *reason=0)
virtual void getStreamList(RefPointer< JBStreamSetList > &list, int type)
Definition yatejabber.h:2202
unsigned int redirectMax() const
Definition yatejabber.h:1982
virtual void encryptStream(JBStream *stream)
virtual void buildDialbackKey(const String &id, const String &local, const String &remote, String &key)
virtual void compressStream(JBStream *stream, const String &formats)
virtual void buildStreamName(String &name, const JBStream *stream)
Definition yatejabber.h:2094
virtual void initialize(const NamedList ¶ms)
JBStream * findStream(const String &id, JBStreamSetList *list)
JBClientStream * findClientStream(bool in, const JabberID &jid)
unsigned int streamReadBuffer() const
Definition yatejabber.h:1957
virtual JBStream * findStream(const String &id, JBStream::Type hint=JBStream::TypeCount)
virtual void printXml(const JBStream *stream, bool send, XmlFragment &frag) const
virtual void cleanup(bool final=false, bool waitTerminate=true)
Entity capability list manager.
Definition yatejabber.h:2837
void requestCaps(JBStream *stream, const char *from, const char *to, const String &id, char version, const char *node, const char *data)
JBEntityCaps * findCaps(const String &id)
Definition yatejabber.h:2852
void expire(u_int64_t msecNow=Time::msecNow())
bool m_enable
Definition yatejabber.h:2976
XmlDocument * toDocument(const char *rootName="entitycaps")
virtual void capsAdded(JBEntityCaps *caps)
Definition yatejabber.h:2984
void addCaps(NamedList &list, const String &id)
Definition yatejabber.h:2928
bool processRsp(XmlElement *rsp, const String &id, bool ok)
bool saveXmlDoc(const char *file, DebugEnabler *enabler=0)
void fromDocument(XmlDocument &doc, const char *rootName="entitycaps")
JBEntityCapsList()
Definition yatejabber.h:2843
static bool decodeCaps(const XmlElement &xml, char &version, String *&node, String *&ver, String *&ext)
bool loadXmlDoc(const char *file, DebugEnabler *enabler=0)
virtual bool processCaps(String &capsId, XmlElement *xml, JBStream *stream, const char *from, const char *to)
virtual void addCaps(NamedList &list, JBEntityCaps &caps)
Entity capability.
Definition yatejabber.h:2768
bool hasFeature(int ns)
Definition yatejabber.h:2796
static void buildId(String &buf, char version, const char *node, const char *data, String *ext=0)
Definition yatejabber.h:2817
JBEntityCaps(const char *id, char version, const char *node, const char *data)
Definition yatejabber.h:2786
bool hasAudio()
Definition yatejabber.h:2803
A Jabber stream event.
Definition yatejabber.h:213
JBEvent(Type type, JBStream *stream, XmlElement *element, const JabberID &from, const JabberID &to, XmlElement *child=0)
Definition yatejabber.h:269
const JabberID & to() const
Definition yatejabber.h:325
Type
Definition yatejabber.h:222
JBClusterStream * clusterStream()
static const char * lookup(int type)
Definition yatejabber.h:440
const String & stanzaType() const
Definition yatejabber.h:311
JBClientStream * clientStream()
XmlElement * releaseXml(bool del=false)
const String & id() const
Definition yatejabber.h:333
XmlElement * element() const
Definition yatejabber.h:372
XmlElement * child() const
Definition yatejabber.h:379
const char * name() const
Definition yatejabber.h:304
XmlElement * buildIqError(bool addTags, XMPPError::Type error, const char *reason=0, XMPPError::ErrorType type=XMPPError::TypeModify)
bool sendStanzaError(XMPPError::Type error, const char *reason=0, XMPPError::ErrorType type=XMPPError::TypeModify)
XmlElement * buildIqResult(bool addTags, XmlElement *child=0)
const String & text() const
Definition yatejabber.h:340
JBServerStream * serverStream()
JBEvent(Type type, JBStream *stream, XmlElement *element, XmlElement *child=0)
Definition yatejabber.h:282
int type() const
Definition yatejabber.h:297
JBStream * stream() const
Definition yatejabber.h:347
bool sendIqResult(XmlElement *child=0)
void releaseStream(bool release=false)
const JabberID & from() const
Definition yatejabber.h:318
Options and connect settings for a remote domain.
Definition yatejabber.h:1820
int m_port
Definition yatejabber.h:1839
JBRemoteDomainDef(const char *domain=0)
Definition yatejabber.h:1827
int m_flags
Definition yatejabber.h:1844
String m_address
Definition yatejabber.h:1834
A Jabber server engine.
Definition yatejabber.h:2266
virtual void stopStreamSets(bool waitTerminate=true)
JBClusterStream * findClusterStream(const String &remote, JBClusterStream *skip=0)
unsigned int terminateClientStreams(const JabberID &jid, XMPPError::Type error=XMPPError::NoError, const char *reason=0)
virtual void addStream(JBStream *stream)
virtual void getStreamListsType(int type, RefPointer< JBStreamSetList > &recv, RefPointer< JBStreamSetList > &process)
JBServerEngine(const char *name="jbserverengine")
unsigned int getStreamIndex()
Definition yatejabber.h:2406
JBServerStream * createCompStream(const String &name, const String &local, const String &remote, const NamedList *params=0)
virtual JBClusterStream * createClusterStream(const String &local, const String &remote, const NamedList *params=0)
JBServerStream * findServerStream(const String &local, const String &remote, bool out, bool auth=true)
virtual void removeStream(JBStream *stream, bool delObj=true)
virtual void getStreamList(RefPointer< JBStreamSetList > &list, int type)
JBServerStream * createServerStream(const String &local, const String &remote, const char *dbId=0, const char *dbKey=0, bool dbOnly=false, const NamedList *params=0)
virtual void buildStreamName(String &name, const JBStream *stream)
Definition yatejabber.h:2292
virtual void cleanup(bool final=false, bool waitTerminate=true)
A server to server stream.
Definition yatejabber.h:1557
NamedList m_remoteDomains
Definition yatejabber.h:1744
virtual bool processStart(const XmlElement *xml, const JabberID &from, const JabberID &to)
JBServerStream(JBEngine *engine, const JabberID &local, const JabberID &remote, const String *name=0, const NamedList *params=0)
const NamedList & remoteDomains() const
Definition yatejabber.h:1606
bool processDbResult(XmlElement *xml, const JabberID &from, const JabberID &to)
bool sendDbResult(const JabberID &from, const JabberID &to, XMPPError::Type rsp=XMPPError::NoError)
bool hasRemoteDomain(const String &domain, bool auth=true)
Definition yatejabber.h:1616
bool dialback() const
Definition yatejabber.h:1598
virtual bool processRunning(XmlElement *xml, const JabberID &from, const JabberID &to)
JBServerStream(JBEngine *engine, Socket *socket, bool component=false)
bool startComp(const String &local=String::empty(), const String &remote=String::empty())
virtual XmlElement * buildStreamStart()
virtual bool processAuth(XmlElement *xml, const JabberID &from, const JabberID &to)
void adjustDbRsp(XMPPError::Type &rsp)
Definition yatejabber.h:1734
JBServerStream(JBEngine *engine, const JabberID &local, const JabberID &remote, const char *dbId=0, const char *dbKey=0, bool dbOnly=false, const NamedList *params=0)
NamedString * takeDb()
Definition yatejabber.h:1625
bool sendDbVerify(const char *from, const char *to, const char *id, XMPPError::Type rsp=XMPPError::NoError)
virtual JBServerStream * serverStream()
Definition yatejabber.h:1636
A list of stream sets.
Definition yatejabber.h:2655
JBEngine * engine() const
Definition yatejabber.h:2700
JBStreamSetList(JBEngine *engine, unsigned int max, unsigned int sleepMs, const char *name)
virtual JBStreamSet * build()
bool add(JBStream *client)
unsigned int streamCount() const
Definition yatejabber.h:2693
unsigned int maxStreams() const
Definition yatejabber.h:2686
virtual const String & toString() const
void stop(JBStreamSet *set=0, bool waitTerminate=true)
virtual ~JBStreamSetList()
ObjList & sets()
Definition yatejabber.h:2674
void remove(JBStream *client, bool delObj=true)
void remove(JBStreamSet *set)
Specialized stream processor.
Definition yatejabber.h:2598
virtual bool process(JBStream &stream)
JBStreamSetProcessor(JBStreamSetList *owner)
Definition yatejabber.h:2605
Specialized stream data receiver.
Definition yatejabber.h:2626
virtual bool process(JBStream &stream)
JBStreamSetReceive(JBStreamSetList *owner)
A set of streams to be processed in an uniform way.
Definition yatejabber.h:2504
virtual bool remove(JBStream *client, bool delObj=true)
ObjList & clients()
Definition yatejabber.h:2518
JBStreamSet(JBStreamSetList *owner)
virtual bool add(JBStream *client)
unsigned int dropAll(const JabberID &local=JabberID::empty(), const JabberID &remote=JabberID::empty(), XMPPError::Type error=XMPPError::NoError, const char *reason=0)
virtual bool process(JBStream &stream)=0
A Jabber stream.
Definition yatejabber.h:469
JBEngine * engine() const
Definition yatejabber.h:592
JBStream(JBEngine *engine, Socket *socket, Type t, bool ssl=false)
void start(XMPPFeatureList *features=0, XmlElement *caps=0, bool useVer1=true)
virtual void * getObject(const String &name) const
virtual bool processCompressing(XmlElement *xml, const JabberID &from, const JabberID &to)
static const TokenDict s_typeName[]
Definition yatejabber.h:945
Type
Definition yatejabber.h:476
const String & serverHost() const
Definition yatejabber.h:737
void setSecured()
Definition yatejabber.h:1198
virtual JBClientStream * clientStream()
Definition yatejabber.h:769
void setIdleTimer(u_int64_t msecNow=Time::msecNow())
virtual JBClusterStream * clusterStream()
Definition yatejabber.h:783
void connectAddr(String &addr, int &port, String &localip, int &stat, ObjList &srvs, bool *isRedirect=0) const
void setLocal(const char *jid)
Definition yatejabber.h:641
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)
void resetFlags(int mask)
virtual bool processStart(const XmlElement *xml, const JabberID &from, const JabberID &to)
bool readSocket(char *buf, unsigned int len)
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)
bool destroyDropXml(XmlElement *&xml, XMPPError::Type error, const char *reason)
Definition yatejabber.h:1177
bool sendStanza(XmlElement *&xml)
void local(JabberID &jid)
Definition yatejabber.h:632
bool writeSocket(const void *data, unsigned int &len)
const JabberID & remote() const
Definition yatejabber.h:648
virtual bool canProcess(u_int64_t time)
const char * typeName() const
Definition yatejabber.h:898
const char * stateName() const
Definition yatejabber.h:891
XmlElement * checkCompress()
const String & id() const
Definition yatejabber.h:606
State
Definition yatejabber.h:487
bool streamError(XmlElement *xml)
void setTlsRequired(bool set)
Definition yatejabber.h:703
bool isId(const String &str)
Definition yatejabber.h:615
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 connectTerminated(Socket *&sock)
virtual XmlElement * buildPing(const String &stanzaId)
void buildSha1Digest(String &buf, const String &secret)
Definition yatejabber.h:906
const char * name() const
Definition yatejabber.h:599
void setRosterRequested(bool ok)
virtual bool processRunning(XmlElement *xml, const JabberID &from, const JabberID &to)
bool setAvailableResource(bool ok, bool positive=true)
const JabberID & local() const
Definition yatejabber.h:624
virtual const String & toString() const
virtual void resetConnection(Socket *sock=0)
void changeState(State newState, u_int64_t time=Time::msecNow())
bool processStreamStart(const XmlElement *xml)
SASL * m_sasl
Definition yatejabber.h:930
virtual void process(u_int64_t time)
void remote(JabberID &jid)
Definition yatejabber.h:656
void updateFromRemoteDef()
int flags() const
Definition yatejabber.h:687
Flags
Definition yatejabber.h:513
XmlElement * setNextPing(bool force)
bool sendStreamXml(State newState, XmlElement *first, XmlElement *second=0, XmlElement *third=0)
bool sendPending(bool streamOnly=false)
bool remoteAddr(SocketAddr &addr)
Definition yatejabber.h:667
virtual XmlElement * buildStreamStart()
bool localAddr(SocketAddr &addr)
Definition yatejabber.h:678
static const TokenDict s_flagName[]
Definition yatejabber.h:940
virtual void checkTimeouts(u_int64_t time)
virtual bool processAuth(XmlElement *xml, const JabberID &from, const JabberID &to)
bool flag(int mask) const
Definition yatejabber.h:695
bool getJids(XmlElement *xml, JabberID &from, JabberID &to)
JBEvent * getEvent(u_int64_t time=Time::msecNow())
int type() const
Definition yatejabber.h:557
bool dropXml(XmlElement *&xml, const char *reason)
virtual bool connecting(bool sync, int stat, ObjList &srvs)
bool incoming() const
Definition yatejabber.h:578
State state() const
Definition yatejabber.h:571
void generateIdIndex(String &buf, const char *extra=0)
Definition yatejabber.h:1228
int xmlns() const
Definition yatejabber.h:564
bool handleCompressReq(XmlElement *xml)
static const TokenDict s_stateName[]
Definition yatejabber.h:935
XMPPFeature * firstRequiredFeature()
bool outgoing() const
Definition yatejabber.h:585
bool checkStanzaRecv(XmlElement *xml, JabberID &from, JabberID &to)
static Type lookupType(const char *text, Type defVal=TypeCount)
Definition yatejabber.h:924
virtual JBServerStream * serverStream()
Definition yatejabber.h:776
virtual bool processRegister(XmlElement *xml, const JabberID &from, const JabberID &to)
SASL authentication mechanism.
Definition yatejabber.h:72
void setAuthParams(const char *user=0, const char *pwd=0)
bool parseMD5ChallengeRsp(const String &buf)
void buildAuthRspReply(String &buf, const String &rsp)
Definition yatejabber.h:108
bool parsePlain(const DataBlock &buf)
SASL(bool plain, const char *realm=0)
static bool parsePlain(const DataBlock &buf, String &user, String &pwd, String *authzid=0)
static void buildMD5Digest(String &dest, const NamedList ¶ms, const char *password, bool challengeRsp=true)
bool parseMD5Challenge(const String &buf)
bool validAuthReply(const String &reply)
Definition yatejabber.h:122
bool buildMD5Challenge(String &buf)
bool buildAuthRsp(String &buf, const char *digestUri=0)
void buildMD5Digest(String &dest, const char *password, bool challengeRsp=true)
Definition yatejabber.h:144
~SASL()
Definition yatejabber.h:85
Xml Child.
Definition yatexml.h:727
Xml Document.
Definition yatexml.h:980
Xml Element.
Definition yatexml.h:1137
String * getAttribute(const String &name) const
Definition yatexml.h:1516
Xml Fragment.
Definition yatexml.h:857
static u_int64_t msecNow()
Type
Definition xmpputils.h:220
ErrorType
Definition xmpputils.h:286
JID feature list.
Definition xmpputils.h:913
A feature.
Definition xmpputils.h:734
Type
Definition xmpputils.h:130
An outgoing XML element.
Definition xmpputils.h:2293
Definition yateclass.h:848