Added debug info
git-svn-id: http://voip.null.ro/svn/yate@1102 acf43c95-373e-0410-b603-e72c3f656dc1
This commit is contained in:
parent
6f32500571
commit
fc5c9a49ce
|
@ -98,7 +98,7 @@ void JBComponentStream::connect()
|
||||||
}
|
}
|
||||||
m_state = WaitToConnect;
|
m_state = WaitToConnect;
|
||||||
// Check restart counters: If both of them are 0 destroy the stream
|
// Check restart counters: If both of them are 0 destroy the stream
|
||||||
Debug(m_engine,DebugAll,
|
Debug(m_engine,DebugInfo,
|
||||||
"Stream::connect. Remaining attempts: Partial: %d. Total: %d. [%p]",
|
"Stream::connect. Remaining attempts: Partial: %d. Total: %d. [%p]",
|
||||||
m_partialRestart,m_totalRestart,this);
|
m_partialRestart,m_totalRestart,this);
|
||||||
if (!(m_partialRestart && m_totalRestart)) {
|
if (!(m_partialRestart && m_totalRestart)) {
|
||||||
|
@ -144,7 +144,7 @@ void JBComponentStream::connect()
|
||||||
m_socket->setBlocking(false);
|
m_socket->setBlocking(false);
|
||||||
lock.drop();
|
lock.drop();
|
||||||
// Start
|
// Start
|
||||||
DDebug(m_engine,DebugAll,"Stream::connect. Starting stream. [%p]",this);
|
DDebug(m_engine,DebugInfo,"Stream::connect. Starting stream. [%p]",this);
|
||||||
XMLElement* start = XMPPUtils::createElement(XMLElement::StreamStart,
|
XMLElement* start = XMPPUtils::createElement(XMLElement::StreamStart,
|
||||||
XMPPNamespace::ComponentAccept);
|
XMPPNamespace::ComponentAccept);
|
||||||
start->setAttribute("xmlns:stream",s_ns[XMPPNamespace::Stream]);
|
start->setAttribute("xmlns:stream",s_ns[XMPPNamespace::Stream]);
|
||||||
|
@ -181,7 +181,7 @@ void JBComponentStream::terminate(bool destroy, bool sendEnd,
|
||||||
addEvent(JBEvent::Terminated,eventError);
|
addEvent(JBEvent::Terminated,eventError);
|
||||||
m_state = Terminated;
|
m_state = Terminated;
|
||||||
}
|
}
|
||||||
Debug(m_engine,DebugAll,"Stream. %s. [%p]",destroy?"Destroy":"Terminate",this);
|
Debug(m_engine,DebugInfo,"Stream. %s. [%p]",destroy?"Destroy":"Terminate",this);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool JBComponentStream::receive()
|
bool JBComponentStream::receive()
|
||||||
|
@ -265,7 +265,9 @@ void JBComponentStream::cancelPending(bool raise, const String* id)
|
||||||
// Cancel elements with id. Raise event if requested
|
// Cancel elements with id. Raise event if requested
|
||||||
// Don't cancel the first element if partial data was sent:
|
// Don't cancel the first element if partial data was sent:
|
||||||
// The remote parser will fail
|
// The remote parser will fail
|
||||||
if (id && *id) {
|
if (id) {
|
||||||
|
XDebug(m_engine,DebugAll,
|
||||||
|
"Stream. Cancel pending elements with id '%s'. [%p]",id->c_str(),this);
|
||||||
ListIterator iter(m_outXML);
|
ListIterator iter(m_outXML);
|
||||||
GenObject* obj;
|
GenObject* obj;
|
||||||
bool first = true;
|
bool first = true;
|
||||||
|
@ -286,6 +288,7 @@ void JBComponentStream::cancelPending(bool raise, const String* id)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// Cancel all pending elements without id
|
// Cancel all pending elements without id
|
||||||
|
XDebug(m_engine,DebugAll,"Stream. Cancel pending elements without id. [%p]",this);
|
||||||
ListIterator iter(m_outXML);
|
ListIterator iter(m_outXML);
|
||||||
GenObject* obj;
|
GenObject* obj;
|
||||||
for (; (obj = iter.get());) {
|
for (; (obj = iter.get());) {
|
||||||
|
@ -312,7 +315,7 @@ void JBComponentStream::cleanup(bool endStream, XMLElement* e)
|
||||||
delete e;
|
delete e;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
DDebug(m_engine,DebugAll,"Stream::cleanup(%s, %p) [%p]",
|
DDebug(m_engine,DebugAll,"Stream::cleanup(%s, %p). [%p]",
|
||||||
String::boolText(endStream),e,this);
|
String::boolText(endStream),e,this);
|
||||||
bool partialData = false;
|
bool partialData = false;
|
||||||
// Remove first element from queue if partial data was sent
|
// Remove first element from queue if partial data was sent
|
||||||
|
@ -354,7 +357,7 @@ JBComponentStream::Error JBComponentStream::postXML(XMLElementOut* element)
|
||||||
element->deref();
|
element->deref();
|
||||||
return ErrorContext;
|
return ErrorContext;
|
||||||
}
|
}
|
||||||
DDebug(m_engine,DebugAll,"Stream::postXML((%p): '%s'). [%p]",
|
DDebug(m_engine,DebugInfo,"Stream::postXML((%p): '%s'). [%p]",
|
||||||
element->element(),element->element()->name(),this);
|
element->element(),element->element()->name(),this);
|
||||||
// List not empty: the return value will be ErrorPending
|
// List not empty: the return value will be ErrorPending
|
||||||
// Else: element will be sent
|
// Else: element will be sent
|
||||||
|
@ -377,11 +380,11 @@ JBComponentStream::Error JBComponentStream::sendXML()
|
||||||
if (m_engine->debugAt(DebugAll)) {
|
if (m_engine->debugAt(DebugAll)) {
|
||||||
String eStr;
|
String eStr;
|
||||||
XMPPUtils::print(eStr,e->element());
|
XMPPUtils::print(eStr,e->element());
|
||||||
Debug(m_engine,DebugAll,"Stream::sendXML(%p). [%p]%s",
|
Debug(m_engine,DebugInfo,"Stream::sendXML(%p). [%p]%s",
|
||||||
e->element(),this,eStr.c_str());
|
e->element(),this,eStr.c_str());
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
Debug(m_engine,DebugAll,"Stream::sendXML((%p): '%s'). [%p]",
|
Debug(m_engine,DebugInfo,"Stream::sendXML((%p): '%s'). [%p]",
|
||||||
e->element(),e->element()->name(),this);
|
e->element(),e->element()->name(),this);
|
||||||
// Prepare & send
|
// Prepare & send
|
||||||
u_int32_t len;
|
u_int32_t len;
|
||||||
|
@ -413,11 +416,11 @@ bool JBComponentStream::sendStreamXML(XMLElement* element, State newState,
|
||||||
if (before)
|
if (before)
|
||||||
XMPPUtils::print(eStr,before);
|
XMPPUtils::print(eStr,before);
|
||||||
XMPPUtils::print(eStr,element);
|
XMPPUtils::print(eStr,element);
|
||||||
Debug(m_engine,DebugAll,"Stream::sendStreamXML. [%p]%s",
|
Debug(m_engine,DebugInfo,"Stream::sendStreamXML. [%p]%s",
|
||||||
this,eStr.c_str());
|
this,eStr.c_str());
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
Debug(m_engine,DebugAll,"Stream::sendStreamXML('%s'). [%p]",
|
Debug(m_engine,DebugInfo,"Stream::sendStreamXML('%s'). [%p]",
|
||||||
element->name(),this);
|
element->name(),this);
|
||||||
String tmp, buff;
|
String tmp, buff;
|
||||||
switch (element->type()) {
|
switch (element->type()) {
|
||||||
|
@ -476,11 +479,11 @@ bool JBComponentStream::processIncomingXML()
|
||||||
if (m_engine->debugAt(DebugAll)) {
|
if (m_engine->debugAt(DebugAll)) {
|
||||||
String eStr;
|
String eStr;
|
||||||
XMPPUtils::print(eStr,element);
|
XMPPUtils::print(eStr,element);
|
||||||
Debug(m_engine,DebugAll,"Stream::processIncomingXML(%p) [%p]. %s",
|
Debug(m_engine,DebugInfo,"Stream::processIncomingXML(%p) [%p]. %s",
|
||||||
element,this,eStr.c_str());
|
element,this,eStr.c_str());
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
Debug(m_engine,DebugAll,"Stream::processIncomingXML((%p): '%s'). [%p].",
|
Debug(m_engine,DebugInfo,"Stream::processIncomingXML((%p): '%s'). [%p].",
|
||||||
element,element->name(),this);
|
element,element->name(),this);
|
||||||
// Check if we received a stream end or stream error
|
// Check if we received a stream end or stream error
|
||||||
if (isStreamEnd(element))
|
if (isStreamEnd(element))
|
||||||
|
@ -516,7 +519,8 @@ bool JBComponentStream::processStateStarted(XMLElement* e)
|
||||||
if (!e->hasAttribute("xmlns",s_ns[XMPPNamespace::ComponentAccept]))
|
if (!e->hasAttribute("xmlns",s_ns[XMPPNamespace::ComponentAccept]))
|
||||||
return invalidElement(e,XMPPError::InvalidNamespace);
|
return invalidElement(e,XMPPError::InvalidNamespace);
|
||||||
if (!e->hasAttribute("from",m_localName))
|
if (!e->hasAttribute("from",m_localName))
|
||||||
// if (!(e->hasAttribute("from",m_localName) || e->hasAttribute("from",m_remoteName)))
|
//TODO: Possible ejabberd support: check if we received remoteName
|
||||||
|
// if (!(e->hasAttribute("from",m_localName) || e->hasAttribute("from",m_remoteName)))
|
||||||
return invalidElement(e,XMPPError::HostUnknown);
|
return invalidElement(e,XMPPError::HostUnknown);
|
||||||
m_id = e->getAttribute("id");
|
m_id = e->getAttribute("id");
|
||||||
if (!m_id.length() || m_engine->remoteIdExists(this))
|
if (!m_id.length() || m_engine->remoteIdExists(this))
|
||||||
|
|
|
@ -172,6 +172,31 @@ void JabberID::parse()
|
||||||
m_bare << m_domain;
|
m_bare << m_domain;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* JIDIdentity
|
||||||
|
*/
|
||||||
|
TokenDict JIDIdentity::s_category[] = {
|
||||||
|
{"account", Account},
|
||||||
|
{"client", Client},
|
||||||
|
{"component", Component},
|
||||||
|
{"gateway", Gateway},
|
||||||
|
{0,0},
|
||||||
|
};
|
||||||
|
|
||||||
|
TokenDict JIDIdentity::s_type[] = {
|
||||||
|
{"registered", AccountRegistered},
|
||||||
|
{"phone", ClientPhone},
|
||||||
|
{"generic", ComponentGeneric},
|
||||||
|
{"presence", ComponentPresence},
|
||||||
|
{"generic", GatewayGeneric},
|
||||||
|
{0,0},
|
||||||
|
};
|
||||||
|
|
||||||
|
XMLElement* JIDIdentity::toXML()
|
||||||
|
{
|
||||||
|
return XMPPUtils::createIdentity(categoryText(m_category),typeText(m_type),m_name);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* JIDFeatures
|
* JIDFeatures
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -285,22 +285,22 @@ class YJINGLE_API JIDIdentity : public RefObject
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
enum Category {
|
enum Category {
|
||||||
Account = 1, // account
|
Account, // account
|
||||||
Client = 2, // client
|
Client, // client
|
||||||
Component = 3, // component
|
Component, // component
|
||||||
Gateway = 4, // gateway
|
Gateway, // gateway
|
||||||
Count = 5,
|
CategoryUnknown
|
||||||
};
|
};
|
||||||
|
|
||||||
enum Type {
|
enum Type {
|
||||||
AccountRegistered = Count, // registered
|
AccountRegistered, // registered
|
||||||
ClientPhone, // phone
|
ClientPhone, // phone
|
||||||
ComponentGeneric, // generic
|
ComponentGeneric, // generic
|
||||||
ComponentPresence, // presence
|
ComponentPresence, // presence
|
||||||
GatewayGeneric, // generic
|
GatewayGeneric, // generic
|
||||||
|
TypeUnknown
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
inline JIDIdentity(Category c, Type t, const char* name = 0)
|
inline JIDIdentity(Category c, Type t, const char* name = 0)
|
||||||
: m_category(c), m_type(t), m_name(name)
|
: m_category(c), m_type(t), m_name(name)
|
||||||
{}
|
{}
|
||||||
|
@ -312,12 +312,21 @@ public:
|
||||||
|
|
||||||
bool fromXML(const XMLElement* element);
|
bool fromXML(const XMLElement* element);
|
||||||
|
|
||||||
static const char* categoryText(Category c);
|
static inline const char* categoryText(Category c)
|
||||||
|
{ return lookup(c,s_category); }
|
||||||
|
|
||||||
static const char* typeText(Category c);
|
static inline Category categoryValue(const char* c)
|
||||||
|
{ return (Category)lookup(c,s_category,CategoryUnknown); }
|
||||||
|
|
||||||
|
static inline const char* typeText(Type t)
|
||||||
|
{ return lookup(t,s_type); }
|
||||||
|
|
||||||
|
static inline Type typeValue(const char* t)
|
||||||
|
{ return (Type)lookup(t,s_category,TypeUnknown); }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static TokenDict m_strings;
|
static TokenDict s_category[];
|
||||||
|
static TokenDict s_type[];
|
||||||
|
|
||||||
Category m_category; // Category
|
Category m_category; // Category
|
||||||
Type m_type; // Type
|
Type m_type; // Type
|
||||||
|
@ -532,10 +541,10 @@ class YJINGLE_API XMPPUser : public RefObject, public Mutex
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
enum Subscription {
|
enum Subscription {
|
||||||
SubNone = 0,
|
None = 0,
|
||||||
SubTo = 1,
|
To = 1,
|
||||||
SubFrom = 2,
|
From = 2,
|
||||||
SubBoth = 3,
|
Both = 3,
|
||||||
};
|
};
|
||||||
|
|
||||||
XMPPUser(const char* node, const char* domain, Subscription sub);
|
XMPPUser(const char* node, const char* domain, Subscription sub);
|
||||||
|
@ -549,10 +558,10 @@ public:
|
||||||
{ return m_resource; }
|
{ return m_resource; }
|
||||||
|
|
||||||
inline bool subscribedTo() const
|
inline bool subscribedTo() const
|
||||||
{ return (m_subscription & SubTo); }
|
{ return (m_subscription & To); }
|
||||||
|
|
||||||
inline bool subscribedFrom() const
|
inline bool subscribedFrom() const
|
||||||
{ return (m_subscription & SubFrom); }
|
{ return (m_subscription & From); }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
JabberID m_jid; // User's JID
|
JabberID m_jid; // User's JID
|
||||||
|
|
Loading…
Reference in New Issue