Added a shared static list of Atom strings and an YATOM macro.
This speeds up signifficantly the Yate RTTI on compilers that HAVE_BLOCK_RETURN. Made the String comparison operator inline to shave off a few cycles. Fast handle the comparison in identity case. git-svn-id: http://voip.null.ro/svn/yate@5449 acf43c95-373e-0410-b603-e72c3f656dc1
This commit is contained in:
parent
4ec21447c3
commit
7c8b2d4c38
|
@ -1049,7 +1049,7 @@ bool QtWindow::setParams(const NamedList& params)
|
|||
bool ok = true;
|
||||
for (unsigned int i = 0; i < n; i++) {
|
||||
NamedString* ns = params.getParam(i);
|
||||
NamedList* nl = static_cast<NamedList*>(ns ? ns->getObject("NamedList") : 0);
|
||||
NamedList* nl = static_cast<NamedList*>(ns ? ns->getObject(YATOM("NamedList")) : 0);
|
||||
if (!(nl && ns->name()))
|
||||
continue;
|
||||
// Find the widget and set its params
|
||||
|
@ -3641,7 +3641,7 @@ bool QtClient::getProperty(QObject* obj, const char* name, String& value)
|
|||
return false;
|
||||
QVariant var = obj->property(name);
|
||||
if (var.type() == QVariant::StringList) {
|
||||
NamedList* l = static_cast<NamedList*>(value.getObject("NamedList"));
|
||||
NamedList* l = static_cast<NamedList*>(value.getObject(YATOM("NamedList")));
|
||||
if (l)
|
||||
copyParams(*l,var.toStringList());
|
||||
else
|
||||
|
|
|
@ -53,7 +53,7 @@ Array::~Array()
|
|||
|
||||
void* Array::getObject(const String& name) const
|
||||
{
|
||||
if (name == YSTRING("Array"))
|
||||
if (name == YATOM("Array"))
|
||||
return const_cast<Array*>(this);
|
||||
return RefObject::getObject(name);
|
||||
}
|
||||
|
|
|
@ -96,7 +96,7 @@ Mutex& CallEndpoint::commonMutex()
|
|||
|
||||
void* CallEndpoint::getObject(const String& name) const
|
||||
{
|
||||
if (name == YSTRING("CallEndpoint"))
|
||||
if (name == YATOM("CallEndpoint"))
|
||||
return const_cast<CallEndpoint*>(this);
|
||||
return RefObject::getObject(name);
|
||||
}
|
||||
|
@ -359,9 +359,9 @@ Channel::~Channel()
|
|||
|
||||
void* Channel::getObject(const String& name) const
|
||||
{
|
||||
if (name == YSTRING("Channel"))
|
||||
if (name == YATOM("Channel"))
|
||||
return const_cast<Channel*>(this);
|
||||
if (name == YSTRING("MessageNotifier"))
|
||||
if (name == YATOM("MessageNotifier"))
|
||||
return static_cast<MessageNotifier*>(const_cast<Channel*>(this));
|
||||
return CallEndpoint::getObject(name);
|
||||
}
|
||||
|
@ -994,7 +994,7 @@ Module::~Module()
|
|||
|
||||
void* Module::getObject(const String& name) const
|
||||
{
|
||||
if (name == YSTRING("Module"))
|
||||
if (name == YATOM("Module"))
|
||||
return const_cast<Module*>(this);
|
||||
return Plugin::getObject(name);
|
||||
}
|
||||
|
@ -1261,7 +1261,7 @@ Driver::Driver(const char* name, const char* type)
|
|||
|
||||
void* Driver::getObject(const String& name) const
|
||||
{
|
||||
if (name == YSTRING("Driver"))
|
||||
if (name == YATOM("Driver"))
|
||||
return const_cast<Driver*>(this);
|
||||
return Module::getObject(name);
|
||||
}
|
||||
|
|
|
@ -38,7 +38,7 @@ Cipher::~Cipher()
|
|||
|
||||
void* Cipher::getObject(const String& name) const
|
||||
{
|
||||
if (name == YSTRING("Cipher"))
|
||||
if (name == YATOM("Cipher"))
|
||||
return const_cast<Cipher*>(this);
|
||||
return GenObject::getObject(name);
|
||||
}
|
||||
|
|
|
@ -3922,7 +3922,7 @@ bool ClientDriver::setConference(const String& id, bool in, const String* confNa
|
|||
Engine::dispatch(m);
|
||||
CallEndpoint* cp = 0;
|
||||
if (m.userData())
|
||||
cp = static_cast<CallEndpoint*>(m.userData()->getObject("CallEndpoint"));
|
||||
cp = static_cast<CallEndpoint*>(m.userData()->getObject(YATOM("CallEndpoint")));
|
||||
const char* reason = "Unable to locate peer";
|
||||
if (cp) {
|
||||
ok = chan->connect(cp,"Conference terminated");
|
||||
|
|
|
@ -110,7 +110,7 @@ DataBlock::~DataBlock()
|
|||
|
||||
void* DataBlock::getObject(const String& name) const
|
||||
{
|
||||
if (name == YSTRING("DataBlock"))
|
||||
if (name == YATOM("DataBlock"))
|
||||
return const_cast<DataBlock*>(this);
|
||||
return GenObject::getObject(name);
|
||||
}
|
||||
|
|
|
@ -467,7 +467,7 @@ void DataConsumer::destroyed()
|
|||
|
||||
void* DataConsumer::getObject(const String& name) const
|
||||
{
|
||||
if (name == YSTRING("DataConsumer"))
|
||||
if (name == YATOM("DataConsumer"))
|
||||
return const_cast<DataConsumer*>(this);
|
||||
return DataNode::getObject(name);
|
||||
}
|
||||
|
@ -692,7 +692,7 @@ void DataSource::synchronize(unsigned long tStamp)
|
|||
|
||||
void* DataSource::getObject(const String& name) const
|
||||
{
|
||||
if (name == YSTRING("DataSource"))
|
||||
if (name == YATOM("DataSource"))
|
||||
return const_cast<DataSource*>(this);
|
||||
return DataNode::getObject(name);
|
||||
}
|
||||
|
@ -725,7 +725,7 @@ void DataEndpoint::destroyed()
|
|||
|
||||
void* DataEndpoint::getObject(const String& name) const
|
||||
{
|
||||
if (name == YSTRING("DataEndpoint"))
|
||||
if (name == YATOM("DataEndpoint"))
|
||||
return const_cast<DataEndpoint*>(this);
|
||||
return RefObject::getObject(name);
|
||||
}
|
||||
|
@ -1153,7 +1153,7 @@ DataTranslator::~DataTranslator()
|
|||
|
||||
void* DataTranslator::getObject(const String& name) const
|
||||
{
|
||||
if (name == YSTRING("DataTranslator"))
|
||||
if (name == YATOM("DataTranslator"))
|
||||
return const_cast<DataTranslator*>(this);
|
||||
return DataConsumer::getObject(name);
|
||||
}
|
||||
|
|
|
@ -348,7 +348,7 @@ public:
|
|||
inline RefList()
|
||||
{ }
|
||||
virtual void* getObject(const String& name) const
|
||||
{ return (name == YSTRING("ObjList")) ? (void*)&m_list : RefObject::getObject(name); }
|
||||
{ return (name == YATOM("ObjList")) ? (void*)&m_list : RefObject::getObject(name); }
|
||||
inline ObjList& list()
|
||||
{ return m_list; }
|
||||
private:
|
||||
|
|
|
@ -48,7 +48,7 @@ HashList::~HashList()
|
|||
|
||||
void* HashList::getObject(const String& name) const
|
||||
{
|
||||
if (name == YSTRING("HashList"))
|
||||
if (name == YATOM("HashList"))
|
||||
return const_cast<HashList*>(this);
|
||||
return GenObject::getObject(name);
|
||||
}
|
||||
|
|
|
@ -58,7 +58,7 @@ Message::~Message()
|
|||
|
||||
void* Message::getObject(const String& name) const
|
||||
{
|
||||
if (name == YSTRING("Message"))
|
||||
if (name == YATOM("Message"))
|
||||
return const_cast<Message*>(this);
|
||||
return NamedList::getObject(name);
|
||||
}
|
||||
|
|
|
@ -94,7 +94,7 @@ MimeHeaderLine::~MimeHeaderLine()
|
|||
|
||||
void* MimeHeaderLine::getObject(const String& name) const
|
||||
{
|
||||
if (name == YSTRING("MimeHeaderLine"))
|
||||
if (name == YATOM("MimeHeaderLine"))
|
||||
return const_cast<MimeHeaderLine*>(this);
|
||||
return NamedString::getObject(name);
|
||||
}
|
||||
|
@ -316,7 +316,7 @@ MimeAuthLine::MimeAuthLine(const MimeAuthLine& original, const char* newName)
|
|||
|
||||
void* MimeAuthLine::getObject(const String& name) const
|
||||
{
|
||||
if (name == YSTRING("MimeAuthLine"))
|
||||
if (name == YATOM("MimeAuthLine"))
|
||||
return const_cast<MimeAuthLine*>(this);
|
||||
return MimeHeaderLine::getObject(name);
|
||||
}
|
||||
|
@ -592,7 +592,7 @@ MimeMultipartBody::MimeMultipartBody(const MimeMultipartBody& original)
|
|||
// Find object by class name, descend into parts
|
||||
void* MimeMultipartBody::getObject(const String& name) const
|
||||
{
|
||||
if (name == YSTRING("MimeMultipartBody"))
|
||||
if (name == YATOM("MimeMultipartBody"))
|
||||
return const_cast<MimeMultipartBody*>(this);
|
||||
void* res = MimeBody::getObject(name);
|
||||
if (res)
|
||||
|
|
|
@ -61,7 +61,7 @@ NamedList& NamedList::operator=(const NamedList& value)
|
|||
|
||||
void* NamedList::getObject(const String& name) const
|
||||
{
|
||||
if (name == YSTRING("NamedList"))
|
||||
if (name == YATOM("NamedList"))
|
||||
return const_cast<NamedList*>(this);
|
||||
return String::getObject(name);
|
||||
}
|
||||
|
|
|
@ -45,7 +45,7 @@ ObjList::~ObjList()
|
|||
|
||||
void* ObjList::getObject(const String& name) const
|
||||
{
|
||||
if (name == YSTRING("ObjList"))
|
||||
if (name == YATOM("ObjList"))
|
||||
return const_cast<ObjList*>(this);
|
||||
return GenObject::getObject(name);
|
||||
}
|
||||
|
@ -365,7 +365,7 @@ ObjVector::~ObjVector()
|
|||
|
||||
void* ObjVector::getObject(const String& name) const
|
||||
{
|
||||
if (name == YSTRING("ObjVector"))
|
||||
if (name == YATOM("ObjVector"))
|
||||
return const_cast<ObjVector*>(this);
|
||||
return GenObject::getObject(name);
|
||||
}
|
||||
|
@ -408,6 +408,16 @@ unsigned int ObjVector::count() const
|
|||
return c;
|
||||
}
|
||||
|
||||
bool ObjVector::null() const
|
||||
{
|
||||
if (!m_objects)
|
||||
return true;
|
||||
for (unsigned int i = 0; i < m_length; i++)
|
||||
if (m_objects[i])
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
int ObjVector::index(const GenObject* obj) const
|
||||
{
|
||||
if (!m_objects)
|
||||
|
|
|
@ -41,7 +41,7 @@ Plugin::~Plugin()
|
|||
|
||||
void* Plugin::getObject(const String& name) const
|
||||
{
|
||||
if (name == YSTRING("Plugin"))
|
||||
if (name == YATOM("Plugin"))
|
||||
return const_cast<Plugin*>(this);
|
||||
return GenObject::getObject(name);
|
||||
}
|
||||
|
|
|
@ -397,7 +397,7 @@ SocketFilter::~SocketFilter()
|
|||
|
||||
void* SocketFilter::getObject(const String& name) const
|
||||
{
|
||||
if (name == YSTRING("SocketFilter"))
|
||||
if (name == YATOM("SocketFilter"))
|
||||
return const_cast<SocketFilter*>(this);
|
||||
return GenObject::getObject(name);
|
||||
}
|
||||
|
|
|
@ -181,6 +181,8 @@ void StringMatchPrivate::fixup()
|
|||
|
||||
|
||||
static const String s_empty;
|
||||
static ObjList s_atoms;
|
||||
static Mutex s_mutex(false,"Atom");
|
||||
|
||||
const String& String::empty()
|
||||
{
|
||||
|
@ -209,6 +211,8 @@ String::String(const String& value)
|
|||
m_string = ::strdup(value.c_str());
|
||||
if (!m_string)
|
||||
Debug("String",DebugFail,"strdup() returned NULL!");
|
||||
else
|
||||
m_length = value.length();
|
||||
changed();
|
||||
}
|
||||
}
|
||||
|
@ -222,6 +226,7 @@ String::String(char value, unsigned int repeat)
|
|||
if (m_string) {
|
||||
::memset(m_string,value,repeat);
|
||||
m_string[repeat] = 0;
|
||||
m_length = repeat;
|
||||
}
|
||||
else
|
||||
Debug("String",DebugFail,"malloc(%d) returned NULL!",repeat+1);
|
||||
|
@ -271,6 +276,8 @@ String::String(const String* value)
|
|||
m_string = ::strdup(value->c_str());
|
||||
if (!m_string)
|
||||
Debug("String",DebugFail,"strdup() returned NULL!");
|
||||
else
|
||||
m_length = value->length();
|
||||
changed();
|
||||
}
|
||||
}
|
||||
|
@ -310,6 +317,7 @@ String& String::assign(const char* value, int len)
|
|||
data[len] = 0;
|
||||
char* odata = m_string;
|
||||
m_string = data;
|
||||
m_length = len;
|
||||
changed();
|
||||
if (odata)
|
||||
::free(odata);
|
||||
|
@ -332,6 +340,7 @@ String& String::assign(char value, unsigned int repeat)
|
|||
data[repeat] = 0;
|
||||
char* odata = m_string;
|
||||
m_string = data;
|
||||
m_length = repeat;
|
||||
changed();
|
||||
if (odata)
|
||||
::free(odata);
|
||||
|
@ -367,6 +376,7 @@ String& String::hexify(void* data, unsigned int len, char sep, bool upCase)
|
|||
*d = '\0';
|
||||
char* odata = m_string;
|
||||
m_string = data;
|
||||
m_length = repeat;
|
||||
changed();
|
||||
if (odata)
|
||||
::free(odata);
|
||||
|
@ -383,7 +393,10 @@ void String::changed()
|
|||
{
|
||||
clearMatches();
|
||||
m_hash = YSTRING_INIT_HASH;
|
||||
m_length = m_string ? ::strlen(m_string) : 0;
|
||||
if (!m_string)
|
||||
m_length = 0;
|
||||
else if (!m_length)
|
||||
m_length = ::strlen(m_string);
|
||||
}
|
||||
|
||||
void String::clear()
|
||||
|
@ -567,6 +580,7 @@ String& String::operator=(const char* value)
|
|||
if (value != c_str()) {
|
||||
char *tmp = m_string;
|
||||
m_string = value ? ::strdup(value) : 0;
|
||||
m_length = 0;
|
||||
if (value && !m_string)
|
||||
Debug("String",DebugFail,"strdup() returned NULL!");
|
||||
changed();
|
||||
|
@ -701,6 +715,7 @@ String& String::append(const char* value, int len)
|
|||
if (len < 0) {
|
||||
if (!m_string) {
|
||||
m_string = ::strdup(value);
|
||||
m_length = 0;
|
||||
if (!m_string)
|
||||
Debug("String",DebugFail,"strdup() returned NULL!");
|
||||
changed();
|
||||
|
@ -718,6 +733,7 @@ String& String::append(const char* value, int len)
|
|||
::strncpy(tmp2+olen,value,len-olen);
|
||||
tmp2[len] = 0;
|
||||
m_string = tmp2;
|
||||
m_length = len;
|
||||
::free(tmp1);
|
||||
}
|
||||
else
|
||||
|
@ -773,6 +789,7 @@ String& String::append(const ObjList* list, const char* separator, bool force)
|
|||
}
|
||||
newStr[olen] = 0;
|
||||
m_string = newStr;
|
||||
m_length = olen;
|
||||
::free(oldStr);
|
||||
changed();
|
||||
return *this;
|
||||
|
@ -801,20 +818,6 @@ bool String::operator!=(const char* value) const
|
|||
return (!value) || ::strcmp(m_string,value);
|
||||
}
|
||||
|
||||
bool String::operator==(const String& value) const
|
||||
{
|
||||
if (hash() != value.hash())
|
||||
return false;
|
||||
return operator==(value.c_str());
|
||||
}
|
||||
|
||||
bool String::operator!=(const String& value) const
|
||||
{
|
||||
if (hash() != value.hash())
|
||||
return true;
|
||||
return operator!=(value.c_str());
|
||||
}
|
||||
|
||||
bool String::operator&=(const char* value) const
|
||||
{
|
||||
if (!m_string)
|
||||
|
@ -1345,7 +1348,7 @@ int String::fixUtf8(const char* replace, unsigned int maxSeq, bool overlong)
|
|||
|
||||
void* String::getObject(const String& name) const
|
||||
{
|
||||
if (name == YSTRING("String"))
|
||||
if (name == YATOM("String"))
|
||||
return const_cast<String*>(this);
|
||||
return GenObject::getObject(name);
|
||||
}
|
||||
|
@ -1355,6 +1358,26 @@ const String& String::toString() const
|
|||
return *this;
|
||||
}
|
||||
|
||||
const String* String::atom(const String*& str, const char* val)
|
||||
{
|
||||
if (!str) {
|
||||
s_mutex.lock();
|
||||
if (!str) {
|
||||
if (TelEngine::null(val))
|
||||
str = &s_empty;
|
||||
else {
|
||||
str = static_cast<const String*>(s_atoms[val]);
|
||||
if (!str) {
|
||||
str = new String(val);
|
||||
s_atoms.insert(str);
|
||||
}
|
||||
}
|
||||
}
|
||||
s_mutex.unlock();
|
||||
}
|
||||
return str;
|
||||
}
|
||||
|
||||
|
||||
Regexp::Regexp()
|
||||
: m_regexp(0), m_flags(0)
|
||||
|
@ -1469,7 +1492,7 @@ const String& NamedString::toString() const
|
|||
|
||||
void* NamedString::getObject(const String& name) const
|
||||
{
|
||||
if (name == YSTRING("NamedString"))
|
||||
if (name == YATOM("NamedString"))
|
||||
return (void*)this;
|
||||
return String::getObject(name);
|
||||
}
|
||||
|
@ -1504,7 +1527,7 @@ GenObject* NamedPointer::takeData()
|
|||
|
||||
void* NamedPointer::getObject(const String& name) const
|
||||
{
|
||||
if (name == YSTRING("NamedPointer"))
|
||||
if (name == YATOM("NamedPointer"))
|
||||
return (void*)this;
|
||||
void* p = NamedString::getObject(name);
|
||||
if (p)
|
||||
|
|
|
@ -436,7 +436,7 @@ bool controlReturn(NamedList* params, bool ret, const char* retVal)
|
|||
{
|
||||
if (retVal && params)
|
||||
params->setParam("retVal",retVal);
|
||||
if (ret || !params || !params->getObject("Message"))
|
||||
if (ret || !params || !params->getObject(YATOM("Message")))
|
||||
return ret;
|
||||
const char* module = params->getValue("module");
|
||||
if (!module || YSTRING("rmanager") != module)
|
||||
|
@ -711,7 +711,7 @@ RefObject::~RefObject()
|
|||
|
||||
void* RefObject::getObject(const String& name) const
|
||||
{
|
||||
if (name == YSTRING("RefObject"))
|
||||
if (name == YATOM("RefObject"))
|
||||
return (void*)this;
|
||||
return GenObject::getObject(name);
|
||||
}
|
||||
|
|
|
@ -1528,8 +1528,8 @@ XmlElement* XMPPUtils::getXml(GenObject* gen)
|
|||
{
|
||||
if (!gen)
|
||||
return 0;
|
||||
NamedPointer* np = static_cast<NamedPointer*>(gen->getObject("NamedPointer"));
|
||||
XmlElement* xml = np ? static_cast<XmlElement*>(np->userObject("XmlElement")) : 0;
|
||||
NamedPointer* np = static_cast<NamedPointer*>(gen->getObject(YATOM("NamedPointer")));
|
||||
XmlElement* xml = np ? static_cast<XmlElement*>(np->userObject(YATOM("XmlElement"))) : 0;
|
||||
if (xml)
|
||||
np->takeData();
|
||||
return xml;
|
||||
|
|
|
@ -126,7 +126,7 @@ void MultiRouter::setup(int priority)
|
|||
|
||||
bool MultiRouter::received(Message& msg, int id)
|
||||
{
|
||||
CallEndpoint* call = static_cast<CallEndpoint*>(msg.userObject("CallEndpoint"));
|
||||
CallEndpoint* call = static_cast<CallEndpoint*>(msg.userObject(YATOM("CallEndpoint")));
|
||||
bool first = false;
|
||||
CallInfo* info = 0;
|
||||
String chanid(msg.getValue("id"));
|
||||
|
|
|
@ -1542,7 +1542,7 @@ bool ExpWrapper::valBoolean() const
|
|||
|
||||
void* ExpWrapper::getObject(const String& name) const
|
||||
{
|
||||
if (name == YSTRING("ExpWrapper"))
|
||||
if (name == YATOM("ExpWrapper"))
|
||||
return const_cast<ExpWrapper*>(this);
|
||||
void* obj = ExpOperation::getObject(name);
|
||||
if (obj)
|
||||
|
|
|
@ -144,9 +144,9 @@ public:
|
|||
~JsCode();
|
||||
virtual void* getObject(const String& name) const
|
||||
{
|
||||
if (name == YSTRING("JsCode"))
|
||||
if (name == YATOM("JsCode"))
|
||||
return const_cast<JsCode*>(this);
|
||||
if (name == YSTRING("ExpEvaluator"))
|
||||
if (name == YATOM("ExpEvaluator"))
|
||||
return const_cast<ExpEvaluator*>((const ExpEvaluator*)this);
|
||||
return ScriptCode::getObject(name);
|
||||
}
|
||||
|
@ -2603,7 +2603,7 @@ ScriptRun* JsCode::createRunner(ScriptContext* context, const char* title)
|
|||
|
||||
bool JsCode::null() const
|
||||
{
|
||||
return !(m_opcodes.skipNull() || m_linked.count());
|
||||
return m_linked.null() && !m_opcodes.skipNull();
|
||||
}
|
||||
|
||||
ScriptRun::Status JsRunner::reset(bool init)
|
||||
|
|
|
@ -531,7 +531,7 @@ bool JsArray::runNative(ObjList& stack, const ExpOperation& oper, GenObject* con
|
|||
if (!last)
|
||||
ExpEvaluator::pushOne(stack,new ExpWrapper(0,0));
|
||||
else {
|
||||
NamedPointer* np = (NamedPointer*)last->getObject(YSTRING("NamedPointer"));
|
||||
NamedPointer* np = (NamedPointer*)last->getObject(YATOM("NamedPointer"));
|
||||
if (!np)
|
||||
ExpEvaluator::pushOne(stack,new ExpOperation(*last));
|
||||
else
|
||||
|
@ -570,14 +570,14 @@ bool JsArray::runNative(ObjList& stack, const ExpOperation& oper, GenObject* con
|
|||
ExpWrapper* obj = YOBJECT(ExpWrapper,op);
|
||||
if (!obj)
|
||||
continue;
|
||||
JsArray* ja = (JsArray*)obj->getObject(YSTRING("JsArray"));
|
||||
JsArray* ja = (JsArray*)obj->getObject(YATOM("JsArray"));
|
||||
if (ja) {
|
||||
for (long int i = 0; i < ja->length(); i++)
|
||||
array->params().addParam(String((int)(i + array->length())),ja->params().getValue(String((int)i)));
|
||||
array->setLength(array->length() + ja->length());
|
||||
}
|
||||
else {
|
||||
JsObject* jo = (JsObject*)obj->getObject(YSTRING("JsObject"));
|
||||
JsObject* jo = (JsObject*)obj->getObject(YATOM("JsObject"));
|
||||
if (jo) {
|
||||
array->params().addParam(new NamedPointer(String((unsigned int)array->length()),jo));
|
||||
array->setLength(array->length() + 1);
|
||||
|
@ -663,7 +663,7 @@ bool JsArray::runNative(ObjList& stack, const ExpOperation& oper, GenObject* con
|
|||
ExpWrapper* obj = YOBJECT(ExpWrapper,op);
|
||||
if (!obj)
|
||||
continue;
|
||||
JsObject* jo = (JsObject*)obj->getObject(YSTRING("JsObject"));
|
||||
JsObject* jo = (JsObject*)obj->getObject(YATOM("JsObject"));
|
||||
if (!jo)
|
||||
continue;
|
||||
jo->ref();
|
||||
|
|
|
@ -102,9 +102,9 @@ bool ScriptParser::callable(const String& name)
|
|||
// RTTI Interface access
|
||||
void* ScriptContext::getObject(const String& name) const
|
||||
{
|
||||
if (name == YSTRING("ScriptContext"))
|
||||
if (name == YATOM("ScriptContext"))
|
||||
return const_cast<ScriptContext*>(this);
|
||||
if (name == YSTRING("ExpExtender"))
|
||||
if (name == YATOM("ExpExtender"))
|
||||
return const_cast<ExpExtender*>(static_cast<const ExpExtender*>(this));
|
||||
return RefObject::getObject(name);
|
||||
}
|
||||
|
|
|
@ -519,7 +519,7 @@ int SIPEngine::authUser(const SIPMessage* message, String& user, bool proxy, Gen
|
|||
const GenObject* o = l->get();
|
||||
if (!o)
|
||||
continue;
|
||||
const MimeHeaderLine* t = static_cast<const MimeHeaderLine*>(o->getObject("MimeHeaderLine"));
|
||||
const MimeHeaderLine* t = static_cast<const MimeHeaderLine*>(o->getObject(YATOM("MimeHeaderLine")));
|
||||
if (!t || (t->name() |= hdr))
|
||||
continue;
|
||||
// remember this line for foreign authentication
|
||||
|
|
|
@ -739,7 +739,7 @@ bool AnalyzerDriver::startCall(NamedList& params, const String& dest)
|
|||
|
||||
bool AnalyzerDriver::msgExecute(Message& msg, String& dest)
|
||||
{
|
||||
CallEndpoint* ch = static_cast<CallEndpoint*>(msg.userObject("CallEndpoint"));
|
||||
CallEndpoint* ch = static_cast<CallEndpoint*>(msg.userObject(YATOM("CallEndpoint")));
|
||||
if (ch) {
|
||||
AnalyzerChan *ac = new AnalyzerChan(dest,true,msg.getValue("window"));
|
||||
ac->initChan();
|
||||
|
@ -767,7 +767,7 @@ bool AttachHandler::received(Message& msg)
|
|||
if (cons.null())
|
||||
return false;
|
||||
|
||||
CallEndpoint* ch = static_cast<CallEndpoint*>(msg.userObject("CallEndpoint"));
|
||||
CallEndpoint* ch = static_cast<CallEndpoint*>(msg.userObject(YATOM("CallEndpoint")));
|
||||
|
||||
if (!ch) {
|
||||
Debug(DebugWarn,"Analyzer attach request with no control channel!");
|
||||
|
|
|
@ -524,7 +524,7 @@ bool ForkMaster::msgProgress(Message& msg, const String& dest)
|
|||
if (m_fake || !dataEp) {
|
||||
const CallEndpoint* call = slave->getPeer();
|
||||
if (!call)
|
||||
call = static_cast<const CallEndpoint*>(msg.userObject("CallEndpoint"));
|
||||
call = static_cast<const CallEndpoint*>(msg.userObject(YATOM("CallEndpoint")));
|
||||
if (call) {
|
||||
dataEp = call->getEndpoint();
|
||||
if (dataEp) {
|
||||
|
|
|
@ -654,9 +654,9 @@ bool AttachHandler::received(Message &msg)
|
|||
return false;
|
||||
}
|
||||
|
||||
DataEndpoint *dd = static_cast<DataEndpoint*>(msg.userObject("DataEndpoint"));
|
||||
DataEndpoint *dd = static_cast<DataEndpoint*>(msg.userObject(YATOM("DataEndpoint")));
|
||||
if (!dd) {
|
||||
CallEndpoint *ch = static_cast<CallEndpoint*>(msg.userObject("CallEndpoint"));
|
||||
CallEndpoint *ch = static_cast<CallEndpoint*>(msg.userObject(YATOM("CallEndpoint")));
|
||||
if (ch)
|
||||
dd = ch->setEndpoint();
|
||||
}
|
||||
|
@ -664,7 +664,7 @@ bool AttachHandler::received(Message &msg)
|
|||
Debug(DebugWarn,"Alsa attach request with no control or data channel!");
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
AlsaDevice* dev = new AlsaDevice(src ? src : cons,msg.getIntValue("rate",8000));
|
||||
if (dev->closed()) {
|
||||
dev->deref();
|
||||
|
|
|
@ -1010,7 +1010,7 @@ bool CoreAudioHandler::received(Message &msg)
|
|||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
bool StatusHandler::received(Message &msg)
|
||||
{
|
||||
const String* sel = msg.getParam("module");
|
||||
|
@ -1033,7 +1033,7 @@ bool MasqHandler::received(Message &msg)
|
|||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
bool DropHandler::received(Message &msg)
|
||||
{
|
||||
String id(msg.getValue("id"));
|
||||
|
@ -1046,7 +1046,7 @@ bool DropHandler::received(Message &msg)
|
|||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
bool AttachHandler::received(Message& msg)
|
||||
{
|
||||
int more = 2;
|
||||
|
@ -1057,7 +1057,7 @@ bool AttachHandler::received(Message& msg)
|
|||
if (!src.startSkip("coreaudio/",false))
|
||||
src = "";
|
||||
}
|
||||
|
||||
|
||||
String cons(msg.getValue("consumer"));
|
||||
if (cons.null())
|
||||
more--;
|
||||
|
@ -1072,10 +1072,10 @@ bool AttachHandler::received(Message& msg)
|
|||
Debug(DebugWarn,"CoreAudio asked to attach source '%s' and consumer '%s'",src.c_str(),cons.c_str());
|
||||
return false;
|
||||
}
|
||||
|
||||
RefPointer<DataEndpoint> dd = static_cast<DataEndpoint*>(msg.userObject("DataEndpoint"));
|
||||
|
||||
RefPointer<DataEndpoint> dd = static_cast<DataEndpoint*>(msg.userObject(YATOM("DataEndpoint")));
|
||||
if (!dd) {
|
||||
CallEndpoint *ch = static_cast<CallEndpoint*>(msg.userObject("CallEndpoint"));
|
||||
CallEndpoint *ch = static_cast<CallEndpoint*>(msg.userObject(YATOM("CallEndpoint")));
|
||||
if (ch) {
|
||||
DataEndpoint::commonMutex().lock();
|
||||
dd = ch->setEndpoint();
|
||||
|
@ -1086,21 +1086,21 @@ bool AttachHandler::received(Message& msg)
|
|||
Debug(DebugWarn,"CoreAudio attach request with no control or data channel!");
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
if (src) {
|
||||
CoreAudioSource* s = new CoreAudioSource(msg.getIntValue("rate",DEFAULT_SAMPLE_RATE));
|
||||
if (s->init())
|
||||
dd->setSource(s);
|
||||
s->deref();
|
||||
}
|
||||
|
||||
|
||||
if (cons) {
|
||||
CoreAudioConsumer* c = new CoreAudioConsumer(msg.getIntValue("rate",DEFAULT_SAMPLE_RATE));
|
||||
if (c->init())
|
||||
dd->setConsumer(c);
|
||||
c->deref();
|
||||
}
|
||||
|
||||
|
||||
// Stop dispatching if we handled all requested
|
||||
return !more;
|
||||
}
|
||||
|
@ -1111,7 +1111,7 @@ CoreAudioPlugin::CoreAudioPlugin()
|
|||
{
|
||||
Output("Loaded module CoreAudio");
|
||||
}
|
||||
|
||||
|
||||
void CoreAudioPlugin::initialize()
|
||||
{
|
||||
Output("Initializing module CoreAudio");
|
||||
|
@ -1129,5 +1129,5 @@ bool CoreAudioPlugin::isBusy() const
|
|||
{
|
||||
return (s_audioChan != 0);
|
||||
}
|
||||
|
||||
|
||||
}; // anonymous namespace
|
||||
|
|
|
@ -690,9 +690,9 @@ bool AttachHandler::received(Message &msg)
|
|||
if (src.null() && cons.null())
|
||||
return false;
|
||||
|
||||
DataEndpoint *dd = static_cast<DataEndpoint*>(msg.userObject("DataEndpoint"));
|
||||
DataEndpoint *dd = static_cast<DataEndpoint*>(msg.userObject(YATOM("DataEndpoint")));
|
||||
if (!dd) {
|
||||
CallEndpoint *ch = static_cast<CallEndpoint*>(msg.userObject("CallEndpoint"));
|
||||
CallEndpoint *ch = static_cast<CallEndpoint*>(msg.userObject(YATOM("CallEndpoint")));
|
||||
if (ch)
|
||||
dd = ch->setEndpoint();
|
||||
}
|
||||
|
|
|
@ -641,9 +641,9 @@ bool AttachHandler::received(Message &msg)
|
|||
return false;
|
||||
}
|
||||
|
||||
DataEndpoint *dd = static_cast<DataEndpoint*>(msg.userObject("DataEndpoint"));
|
||||
DataEndpoint *dd = static_cast<DataEndpoint*>(msg.userObject(YATOM("DataEndpoint")));
|
||||
if (!dd) {
|
||||
CallEndpoint *ch = static_cast<CallEndpoint*>(msg.userObject("CallEndpoint"));
|
||||
CallEndpoint *ch = static_cast<CallEndpoint*>(msg.userObject(YATOM("CallEndpoint")));
|
||||
if (ch)
|
||||
dd = ch->setEndpoint();
|
||||
}
|
||||
|
|
|
@ -1210,7 +1210,7 @@ bool ConfHandler::received(Message& msg)
|
|||
Debug(&__plugin,DebugNote,"Conference request with no channel!");
|
||||
return ok;
|
||||
}
|
||||
if (chan->getObject("ConfChan")) {
|
||||
if (chan->getObject(YATOM("ConfChan"))) {
|
||||
Debug(&__plugin,DebugWarn,"Conference request from a conference leg!");
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -3876,7 +3876,7 @@ public:
|
|||
: m_socket(sock)
|
||||
{}
|
||||
virtual void* getObject(const String& name) const {
|
||||
if (name == "Socket*")
|
||||
if (name == YATOM("Socket*"))
|
||||
return (void*)m_socket;
|
||||
return RefObject::getObject(name);
|
||||
}
|
||||
|
|
|
@ -460,7 +460,7 @@ bool JBFeaturesModule::handleFeaturePrivateData(JabberID& from, Message& msg)
|
|||
XMPPNamespace::IqPrivate);
|
||||
XmlElement* pdata = 0;
|
||||
if (m) {
|
||||
Array* a = static_cast<Array*>(m->userObject("Array"));
|
||||
Array* a = static_cast<Array*>(m->userObject(YATOM("Array")));
|
||||
String* data = a ? YOBJECT(String,a->get(0,1)) : 0;
|
||||
pdata = data ? XMPPUtils::getXml(*data) : 0;
|
||||
if (pdata) {
|
||||
|
@ -550,7 +550,7 @@ bool JBFeaturesModule::handleFeatureVCard(JabberID& from, Message& msg)
|
|||
return buildError(msg,xml);
|
||||
XmlElement* vcard = 0;
|
||||
if (t == XMPPUtils::IqGet && m) {
|
||||
Array* a = static_cast<Array*>(m->userObject("Array"));
|
||||
Array* a = static_cast<Array*>(m->userObject(YATOM("Array")));
|
||||
if (a) {
|
||||
String* vc = YOBJECT(String,a->get(0,1));
|
||||
XDebug(this,DebugInfo,"Got vcard for '%s': '%s'",p.getValue("username"),
|
||||
|
@ -607,7 +607,7 @@ bool JBFeaturesModule::handleFeatureMsgOffline(JabberID& from, Message& msg)
|
|||
p.addParam("maxcount",String(m_maxChatCount));
|
||||
Message* m = queryDb(p,m_chatAccount,m_chatQueryAdd);
|
||||
if (m) {
|
||||
Array* a = static_cast<Array*>(m->userObject("Array"));
|
||||
Array* a = static_cast<Array*>(m->userObject(YATOM("Array")));
|
||||
String* res = a ? YOBJECT(String,a->get(0,1)) : 0;
|
||||
if (res) {
|
||||
DDebug(this,DebugAll,"Got result %s to add chat",res->c_str());
|
||||
|
@ -633,7 +633,7 @@ bool JBFeaturesModule::handleFeatureMsgOffline(JabberID& from, Message& msg)
|
|||
Message* m = queryDb(p,m_chatAccount,m_chatQueryGet);
|
||||
if (!m)
|
||||
return false;
|
||||
Array* a = static_cast<Array*>(m->userObject("Array"));
|
||||
Array* a = static_cast<Array*>(m->userObject(YATOM("Array")));
|
||||
int rows = a ? a->getRows() : 0;
|
||||
int cols = a ? a->getColumns() : 0;
|
||||
DDebug(this,DebugAll,"Got %d offline messages for user =%s",
|
||||
|
|
|
@ -178,7 +178,7 @@ inline DataSource* getChannelSource(GenObject* target, unsigned int channel)
|
|||
chNo << "DataSource" << channel;
|
||||
GenObject* ret = (GenObject*)target->getObject(chNo);
|
||||
chNo.clear();
|
||||
return ret ? static_cast<DataSource*>(ret->getObject("DataSource")) : 0;
|
||||
return ret ? static_cast<DataSource*>(ret->getObject(YATOM("DataSource"))) : 0;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -534,7 +534,7 @@ bool SslHandler::received(Message& msg)
|
|||
return 0 != __plugin.findContext(msg);
|
||||
}
|
||||
addRand(msg.msgTime());
|
||||
Socket** ppSock = static_cast<Socket**>(msg.userObject("Socket*"));
|
||||
Socket** ppSock = static_cast<Socket**>(msg.userObject(YATOM("Socket*")));
|
||||
if (!ppSock) {
|
||||
Debug(&__plugin,DebugGoOn,"SslHandler: No pointer to Socket");
|
||||
return false;
|
||||
|
@ -767,7 +767,7 @@ bool CipherHandler::received(Message& msg)
|
|||
const String* name = msg.getParam("cipher");
|
||||
if (!name)
|
||||
return false;
|
||||
Cipher** ppCipher = static_cast<Cipher**>(msg.userObject("Cipher*"));
|
||||
Cipher** ppCipher = static_cast<Cipher**>(msg.userObject(YATOM("Cipher*")));
|
||||
#ifndef OPENSSL_NO_AES
|
||||
if (*name == "aes_ctr") {
|
||||
if (ppCipher)
|
||||
|
|
|
@ -91,7 +91,7 @@ static CallEndpoint* locateChan(const String& id, bool peer = false)
|
|||
m.addParam("id",id);
|
||||
if (!Engine::dispatch(m))
|
||||
return 0;
|
||||
CallEndpoint* ce = static_cast<CallEndpoint*>(m.userObject("CallEndpoint"));
|
||||
CallEndpoint* ce = static_cast<CallEndpoint*>(m.userObject(YATOM("CallEndpoint")));
|
||||
if (!ce)
|
||||
return 0;
|
||||
return peer ? ce->getPeer() : ce;
|
||||
|
@ -190,9 +190,9 @@ bool AttachHandler::received(Message &msg)
|
|||
if (!(src || cons || ovr || repl))
|
||||
return false;
|
||||
|
||||
RefPointer<DataEndpoint> de = static_cast<DataEndpoint*>(msg.userObject(YSTRING("DataEndpoint")));
|
||||
RefPointer<DataEndpoint> de = static_cast<DataEndpoint*>(msg.userObject(YATOM("DataEndpoint")));
|
||||
if (!de) {
|
||||
CallEndpoint* ch = static_cast<CallEndpoint*>(msg.userObject(YSTRING("CallEndpoint")));
|
||||
CallEndpoint* ch = static_cast<CallEndpoint*>(msg.userObject(YATOM("CallEndpoint")));
|
||||
if (ch) {
|
||||
DataEndpoint::commonMutex().lock();
|
||||
de = ch->getEndpoint(msg.getValue(YSTRING("media"),"audio"));
|
||||
|
@ -248,9 +248,9 @@ bool RecordHandler::received(Message &msg)
|
|||
if (!(call || peer))
|
||||
return false;
|
||||
|
||||
RefPointer<DataEndpoint> de = static_cast<DataEndpoint*>(msg.userObject(YSTRING("DataEndpoint")));
|
||||
RefPointer<DataEndpoint> de = static_cast<DataEndpoint*>(msg.userObject(YATOM("DataEndpoint")));
|
||||
if (!de) {
|
||||
CallEndpoint* ch = static_cast<CallEndpoint*>(msg.userObject(YSTRING("CallEndpoint")));
|
||||
CallEndpoint* ch = static_cast<CallEndpoint*>(msg.userObject(YATOM("CallEndpoint")));
|
||||
if (ch) {
|
||||
DataEndpoint::commonMutex().lock();
|
||||
de = ch->getEndpoint(msg.getValue(YSTRING("media"),"audio"));
|
||||
|
|
|
@ -181,7 +181,7 @@ bool CustomTable::setParams(const NamedList& params)
|
|||
QtClient::deleteLater(m_contextMenu);
|
||||
m_contextMenu = 0;
|
||||
}
|
||||
NamedList* menu = static_cast<NamedList*>(param->getObject("NamedList"));
|
||||
NamedList* menu = static_cast<NamedList*>(param->getObject(YATOM("NamedList")));
|
||||
if (menu) {
|
||||
// Get parent window receiving menu events
|
||||
QtWindow* wnd = static_cast<QtWindow*>(window());
|
||||
|
|
|
@ -156,7 +156,7 @@ public:
|
|||
{ }
|
||||
void* getObject(const String& name) const
|
||||
{
|
||||
if (name == "Socket*")
|
||||
if (name == YATOM("Socket*"))
|
||||
return m_sock;
|
||||
return RefObject::getObject(name);
|
||||
}
|
||||
|
|
|
@ -598,7 +598,7 @@ void ModuleLine::setCallSetupDetector()
|
|||
// Dispatch message
|
||||
DataSource* src = 0;
|
||||
if (circuit())
|
||||
src = static_cast<DataSource*>(circuit()->getObject("DataSource"));
|
||||
src = static_cast<DataSource*>(circuit()->getObject(YATOM("DataSource")));
|
||||
Message msg("chan.attach");
|
||||
msg.userData(src);
|
||||
msg.addParam("consumer",m_detector);
|
||||
|
@ -617,7 +617,7 @@ void ModuleLine::setCallSetupDetector()
|
|||
}
|
||||
DataConsumer* cons = 0;
|
||||
if (msg.userData())
|
||||
cons = static_cast<DataConsumer*>(msg.userData()->getObject("DataConsumer"));
|
||||
cons = static_cast<DataConsumer*>(msg.userData()->getObject(YATOM("DataConsumer")));
|
||||
if (cons && cons->ref())
|
||||
m_callSetupDetector = cons;
|
||||
else
|
||||
|
@ -2007,9 +2007,9 @@ bool AnalogChannel::setAudio(bool in)
|
|||
SignallingCircuit* cic = m_line ? m_line->circuit() : 0;
|
||||
if (cic) {
|
||||
if (in)
|
||||
setSource(static_cast<DataSource*>(cic->getObject("DataSource")));
|
||||
setSource(static_cast<DataSource*>(cic->getObject(YATOM("DataSource"))));
|
||||
else
|
||||
setConsumer(static_cast<DataConsumer*>(cic->getObject("DataConsumer")));
|
||||
setConsumer(static_cast<DataConsumer*>(cic->getObject(YATOM("DataConsumer"))));
|
||||
}
|
||||
|
||||
DataNode* res = in ? (DataNode*)getSource() : (DataNode*)getConsumer();
|
||||
|
@ -2269,7 +2269,7 @@ bool AnalogCallRec::disconnect(const char* reason)
|
|||
// DataSource1: called's source
|
||||
void* AnalogCallRec::getObject(const String& name) const
|
||||
{
|
||||
int who = (name == "DataSource0") ? 0 : (name == "DataSource1" ? 1 : -1);
|
||||
int who = (name == YATOM("DataSource0")) ? 0 : (name == YATOM("DataSource1") ? 1 : -1);
|
||||
if (who == -1)
|
||||
return CallEndpoint::getObject(name);
|
||||
|
||||
|
@ -2278,7 +2278,7 @@ void* AnalogCallRec::getObject(const String& name) const
|
|||
target = m_fxsCaller ? m_line : fxo();
|
||||
else
|
||||
target = m_fxsCaller ? fxo() : m_line;
|
||||
return (target && target->circuit()) ? target->circuit()->getObject("DataSource") : 0;
|
||||
return (target && target->circuit()) ? target->circuit()->getObject(YATOM("DataSource")) : 0;
|
||||
}
|
||||
|
||||
// Create data source. Route and execute
|
||||
|
@ -2295,7 +2295,7 @@ bool AnalogCallRec::startRecording()
|
|||
DataSource* src = 0;
|
||||
String buflen;
|
||||
if (m_line && m_line->circuit()) {
|
||||
src = static_cast<DataSource*>(m_line->circuit()->getObject("DataSource"));
|
||||
src = static_cast<DataSource*>(m_line->circuit()->getObject(YATOM("DataSource")));
|
||||
m_line->circuit()->getParam("buflen",buflen);
|
||||
}
|
||||
if (src)
|
||||
|
@ -2314,7 +2314,7 @@ bool AnalogCallRec::startRecording()
|
|||
if (!Engine::dispatch(m))
|
||||
Debug(this,DebugNote,"Error attaching data mux '%s' [%p]",m->getValue("error"),this);
|
||||
else if (m->userData())
|
||||
setSource(static_cast<DataSource*>(m->userData()->getObject("DataSource")));
|
||||
setSource(static_cast<DataSource*>(m->userData()->getObject(YATOM("DataSource"))));
|
||||
TelEngine::destruct(m);
|
||||
if (!getSource()) {
|
||||
m_reason = "nodata";
|
||||
|
|
|
@ -276,7 +276,7 @@ bool ADModule::chanAttach(Message& msg)
|
|||
String type = msg.getValue("consumer");
|
||||
if (type.startSkip(plugin.prefix(),false)) {
|
||||
if (sender)
|
||||
src = static_cast<DataSource*>(sender->getObject("DataSource"));
|
||||
src = static_cast<DataSource*>(sender->getObject(YATOM("DataSource")));
|
||||
if (src)
|
||||
detect = 1;
|
||||
else
|
||||
|
|
|
@ -512,7 +512,7 @@ bool Cache::copyParams(const String& id, NamedList& list, const String* cpParams
|
|||
lock();
|
||||
const char* error = m.getValue("error");
|
||||
if (ok && !error) {
|
||||
Array* a = static_cast<Array*>(m.userObject("Array"));
|
||||
Array* a = static_cast<Array*>(m.userObject(YATOM("Array")));
|
||||
int rows = a ? a->getRows() : 0;
|
||||
if (rows > 0)
|
||||
item = addUnsafe(*a,1,a->getColumns());
|
||||
|
@ -1309,7 +1309,7 @@ void CacheModule::loadCache(const String& name, bool async, ObjList* items)
|
|||
Debug(this,DebugInfo,"Cache '%s' vanished while loading",name.c_str());
|
||||
break;
|
||||
}
|
||||
Array* a = static_cast<Array*>(m.userObject("Array"));
|
||||
Array* a = static_cast<Array*>(m.userObject(YATOM("Array")));
|
||||
int rows = a ? a->getRows() : 0;
|
||||
unsigned int loadedRows = (rows > 0) ? rows - 1 : 0;
|
||||
if (!items)
|
||||
|
|
|
@ -150,7 +150,7 @@ bool DbMultiRouter::msgRoute(Message& msg, CallInfo& info, bool first)
|
|||
m.addParam("account",m_account);
|
||||
m.addParam("query",query);
|
||||
if (Engine::dispatch(m) && m.getIntValue("rows") >=1) {
|
||||
Array* a = static_cast<Array*>(m.userObject("Array"));
|
||||
Array* a = static_cast<Array*>(m.userObject(YATOM("Array")));
|
||||
if (a) {
|
||||
copyParams(info,a);
|
||||
copyParams(msg,a);
|
||||
|
@ -173,7 +173,7 @@ Message* DbMultiRouter::buildExecute(CallInfo& info, bool reroute)
|
|||
m.addParam("account",m_account);
|
||||
m.addParam("query",query);
|
||||
if (Engine::dispatch(m) && m.getIntValue("rows") >=1) {
|
||||
Array* a = static_cast<Array*>(m.userObject("Array"));
|
||||
Array* a = static_cast<Array*>(m.userObject(YATOM("Array")));
|
||||
if (a) {
|
||||
Message* m = defaultExecute(info);
|
||||
copyParams(info,a);
|
||||
|
|
|
@ -90,9 +90,9 @@ static void alterSource(Message& msg, const String& name)
|
|||
Message m("database");
|
||||
m.addParam("account",account);
|
||||
m.addParam("query",query);
|
||||
if (!Engine::dispatch(m) || (m.getIntValue("rows") != 1) || (m.getIntValue("columns") != 1))
|
||||
if (!Engine::dispatch(m) || (m.getIntValue(YSTRING("rows")) != 1) || (m.getIntValue(YSTRING("columns")) != 1))
|
||||
return;
|
||||
Array* a = static_cast<Array*>(m.userObject("Array"));
|
||||
Array* a = static_cast<Array*>(m.userObject(YATOM("Array")));
|
||||
if (!a)
|
||||
return;
|
||||
GenObject* obj = a->take(0,1);
|
||||
|
@ -179,7 +179,7 @@ DbWriter::~DbWriter()
|
|||
|
||||
void* DbWriter::getObject(const String& name) const
|
||||
{
|
||||
if (name == "Stream")
|
||||
if (name == YATOM("Stream"))
|
||||
return static_cast<Stream*>(const_cast<DbWriter*>(this));
|
||||
return GenObject::getObject(name);
|
||||
}
|
||||
|
|
|
@ -899,7 +899,7 @@ MGCPSpan* MGCPSpan::findNotify(const String& id, const String& epId)
|
|||
|
||||
MGCPSpan::MGCPSpan(const NamedList& params, const char* name, const MGCPEpInfo& ep)
|
||||
: SignallingCircuitSpan(params.getValue("debugname",name),
|
||||
static_cast<SignallingCircuitGroup*>(params.getObject("SignallingCircuitGroup"))),
|
||||
static_cast<SignallingCircuitGroup*>(params.getObject(YATOM("SignallingCircuitGroup")))),
|
||||
m_circuits(0), m_count(0), m_epId(ep), m_operational(false),
|
||||
m_rtpForward(false), m_sdpForward(false), m_rtpForcedFwd(false), m_fxo(false), m_fxs(false),
|
||||
m_ntfyMatch(true), m_rqntEmbed(true), m_rqntCheck(true), m_rqntType(RqntOnce)
|
||||
|
@ -1384,12 +1384,12 @@ MGCPCircuit::~MGCPCircuit()
|
|||
void* MGCPCircuit::getObject(const String& name) const
|
||||
{
|
||||
if (connected()) {
|
||||
if (name == YSTRING("DataSource"))
|
||||
if (name == YATOM("DataSource"))
|
||||
return m_source;
|
||||
if (name == YSTRING("DataConsumer"))
|
||||
if (name == YATOM("DataConsumer"))
|
||||
return m_consumer;
|
||||
}
|
||||
if (name == YSTRING("MGCPCircuit"))
|
||||
if (name == YATOM("MGCPCircuit"))
|
||||
return (void*)this;
|
||||
return SignallingCircuit::getObject(name);
|
||||
}
|
||||
|
|
|
@ -238,7 +238,7 @@ bool AttachHandler::received(Message& msg)
|
|||
snif.clear();
|
||||
if (cons.null() && snif.null())
|
||||
return false;
|
||||
CallEndpoint* ch = static_cast<CallEndpoint *>(msg.userObject("CallEndpoint"));
|
||||
CallEndpoint* ch = static_cast<CallEndpoint *>(msg.userObject(YATOM("CallEndpoint")));
|
||||
if (ch) {
|
||||
if (cons) {
|
||||
MrcpConsumer* c = new MrcpConsumer(ch->id(),cons,msg.getValue("format","slin"));
|
||||
|
@ -274,8 +274,8 @@ bool RecordHandler::received(Message& msg)
|
|||
String id(msg.getValue("id"));
|
||||
if (!src.startsWith("mrcp/"))
|
||||
return false;
|
||||
CallEndpoint* ch = static_cast<CallEndpoint *>(msg.userObject("CallEndpoint"));
|
||||
RefPointer<DataEndpoint> de = static_cast<DataEndpoint *>(msg.userObject("DataEndpoint"));
|
||||
CallEndpoint* ch = static_cast<CallEndpoint *>(msg.userObject(YATOM("CallEndpoint")));
|
||||
RefPointer<DataEndpoint> de = static_cast<DataEndpoint *>(msg.userObject(YATOM("DataEndpoint")));
|
||||
if (ch) {
|
||||
id = ch->id();
|
||||
if (!de)
|
||||
|
|
|
@ -195,7 +195,7 @@ PBXList::~PBXList()
|
|||
|
||||
ChanAssist* PBXList::create(Message& msg, const String& id)
|
||||
{
|
||||
if (msg == "chan.startup" || msg.userObject("Channel")) {
|
||||
if (msg == "chan.startup" || msg.userObject(YATOM("Channel"))) {
|
||||
// if a filter is set try to match it
|
||||
if (s_filter && (s_filterFail == s_filter.matches(id)))
|
||||
return 0;
|
||||
|
@ -424,7 +424,7 @@ bool PBXAssist::msgDisconnect(Message& msg, const String& reason)
|
|||
if ((reason == "hold") || (reason == "park") || (reason == "intrusion")) {
|
||||
String onhold = m_keep.getValue("onhold",s_onhold);
|
||||
if (onhold) {
|
||||
Channel* c = static_cast<Channel*>(msg.userObject("Channel"));
|
||||
Channel* c = static_cast<Channel*>(msg.userObject(YATOM("Channel")));
|
||||
if (!c)
|
||||
return false;
|
||||
Message *m = c->message("call.execute",false,true);
|
||||
|
@ -534,7 +534,7 @@ bool PBXAssist::msgDisconnect(Message& msg, const String& reason)
|
|||
}
|
||||
|
||||
if (!m_guest && (state() != "new")) {
|
||||
Channel* c = static_cast<Channel*>(msg.userObject("Channel"));
|
||||
Channel* c = static_cast<Channel*>(msg.userObject(YATOM("Channel")));
|
||||
if (!c)
|
||||
return false;
|
||||
Message *m = c->message("call.execute",false,true);
|
||||
|
@ -874,7 +874,7 @@ bool PBXAssist::operConference(Message& msg)
|
|||
return errorBeep("conference failed");
|
||||
}
|
||||
else {
|
||||
Channel* c = static_cast<Channel*>(msg.userObject("Channel"));
|
||||
Channel* c = static_cast<Channel*>(msg.userObject(YATOM("Channel")));
|
||||
if (!c)
|
||||
return errorBeep("no channel");
|
||||
if (!room)
|
||||
|
@ -1006,7 +1006,7 @@ bool PBXAssist::operReturnConf(Message& msg)
|
|||
{
|
||||
if ((state() == "conference") || (state() == "new") || m_room.null())
|
||||
return errorBeep("cannot return to conference");
|
||||
Channel* c = static_cast<Channel*>(msg.userObject("Channel"));
|
||||
Channel* c = static_cast<Channel*>(msg.userObject(YATOM("Channel")));
|
||||
if (!c)
|
||||
return errorBeep("no channel");
|
||||
bool owner = msg.getBoolValue("confowner",m_keep.getBoolValue("pbxconfowner",s_confOwner));
|
||||
|
|
|
@ -222,8 +222,8 @@ CallsQueue* CallsQueue::create(const char* name, const NamedList& params)
|
|||
Debug(&__plugin,DebugWarn,"Query on '%s' failed: '%s'",s_account.c_str(),query.c_str());
|
||||
return 0;
|
||||
}
|
||||
Array* res = static_cast<Array*>(m.userObject("Array"));
|
||||
if (!res || (m.getIntValue("rows") != 1)) {
|
||||
Array* res = static_cast<Array*>(m.userObject(YATOM("Array")));
|
||||
if (!res || (m.getIntValue(YSTRING("rows")) != 1)) {
|
||||
Debug(&__plugin,DebugWarn,"Missing queue '%s'",name);
|
||||
return 0;
|
||||
}
|
||||
|
@ -442,14 +442,14 @@ void CallsQueue::startACD()
|
|||
Debug(&__plugin,DebugWarn,"Query on '%s' failed: '%s'",s_account.c_str(),query.c_str());
|
||||
return;
|
||||
}
|
||||
Array* res = static_cast<Array*>(msg.userObject("Array"));
|
||||
if (!res || (msg.getIntValue("rows") < 1))
|
||||
Array* res = static_cast<Array*>(msg.userObject(YATOM("Array")));
|
||||
if (!res || (msg.getIntValue(YSTRING("rows")) < 1))
|
||||
return;
|
||||
for (int i = 1; i < res->getRows(); i++) {
|
||||
NamedList params("");
|
||||
copyArrayParams(params,res,i);
|
||||
const char* callto = params.getValue("location");
|
||||
const char* user = params.getValue("username");
|
||||
const char* callto = params.getValue(YSTRING("location"));
|
||||
const char* user = params.getValue(YSTRING("username"));
|
||||
if (!(callto && user))
|
||||
continue;
|
||||
QueuedCall* call = markCall(user);
|
||||
|
|
|
@ -311,7 +311,7 @@ void processQueryDB(Message* msg, QueuedCall* call, Array*& data, const char* qu
|
|||
// Get data if message succeedded
|
||||
if (ok) {
|
||||
if (msg->getIntValue("rows") >= 1)
|
||||
data = static_cast<Array*>(msg->userObject("Array"));
|
||||
data = static_cast<Array*>(msg->userObject(YATOM("Array")));
|
||||
}
|
||||
else
|
||||
Debug(&__plugin,DebugNote,
|
||||
|
|
|
@ -364,9 +364,9 @@ void AAAHandler::indirectQuery(String& query)
|
|||
prepareQuery(m,m_account,query,true);
|
||||
query.clear();
|
||||
// query must return exactly one row, one column
|
||||
if (!Engine::dispatch(m) || (m.getIntValue("rows") != 1) || (m.getIntValue("columns") != 1))
|
||||
if (!Engine::dispatch(m) || (m.getIntValue(YSTRING("rows")) != 1) || (m.getIntValue(YSTRING("columns")) != 1))
|
||||
return;
|
||||
Array* a = static_cast<Array*>(m.userObject("Array"));
|
||||
Array* a = static_cast<Array*>(m.userObject(YATOM("Array")));
|
||||
if (!a)
|
||||
return;
|
||||
query = YOBJECT(String,a->get(0,1));
|
||||
|
@ -449,7 +449,7 @@ bool AAAHandler::received(Message& msg)
|
|||
if (Engine::dispatch(m))
|
||||
if (m.getIntValue("rows") >=1)
|
||||
{
|
||||
Array* a = static_cast<Array*>(m.userObject("Array"));
|
||||
Array* a = static_cast<Array*>(m.userObject(YATOM("Array")));
|
||||
if (!copyParams(msg,a,m_result)) {
|
||||
Debug(&module,DebugWarn,"Misconfigured result column for '%s'",name().c_str());
|
||||
msg.setParam("error","failure");
|
||||
|
@ -471,7 +471,7 @@ bool AAAHandler::received(Message& msg)
|
|||
if (Engine::dispatch(m))
|
||||
if (m.getIntValue("rows") >=1)
|
||||
{
|
||||
Array* a = static_cast<Array*>(m.userObject("Array"));
|
||||
Array* a = static_cast<Array*>(m.userObject(YATOM("Array")));
|
||||
copyParams(msg,a,m_result);
|
||||
}
|
||||
return false;
|
||||
|
@ -488,7 +488,7 @@ bool AAAHandler::received(Message& msg)
|
|||
if (Engine::dispatch(m))
|
||||
if (m.getIntValue("rows") >=1)
|
||||
{
|
||||
Array* a = static_cast<Array*>(m.userObject("Array"));
|
||||
Array* a = static_cast<Array*>(m.userObject(YATOM("Array")));
|
||||
copyParams(msg,a,m_result);
|
||||
if (msg.retValue().null())
|
||||
{
|
||||
|
@ -645,7 +645,7 @@ Array* EventNotify::queryDatabase(Message& msg, const String& notifier,
|
|||
if (!Engine::dispatch(msg))
|
||||
return 0;
|
||||
rows = msg.getIntValue("rows",0);
|
||||
Array* subscriptions = static_cast<Array*>(msg.userObject("Array"));
|
||||
Array* subscriptions = static_cast<Array*>(msg.userObject(YATOM("Array")));
|
||||
if (!(subscriptions && rows))
|
||||
return 0;
|
||||
DDebug(&module,DebugAll,
|
||||
|
@ -827,7 +827,7 @@ bool SubscribeHandler::received(Message& msg)
|
|||
}
|
||||
|
||||
Message* notify = new Message("resource.notify");
|
||||
Array* a = static_cast<Array*>(m.userObject("Array"));
|
||||
Array* a = static_cast<Array*>(m.userObject(YATOM("Array")));
|
||||
if (subscribe) {
|
||||
copyParams2(*notify,a,1);
|
||||
notify->addParam("subscriptionstate","active");
|
||||
|
@ -884,7 +884,7 @@ bool SubscribeTimerHandler::received(Message& msg)
|
|||
m_nextTime = t + m_expireTime;
|
||||
else
|
||||
return false;
|
||||
|
||||
|
||||
if(!m_queryExpire)
|
||||
return false;
|
||||
|
||||
|
@ -898,7 +898,7 @@ bool SubscribeTimerHandler::received(Message& msg)
|
|||
return false;
|
||||
|
||||
int rows = m.getIntValue("rows",0);
|
||||
Array* a = static_cast<Array*>(m.userObject("Array"));
|
||||
Array* a = static_cast<Array*>(m.userObject(YATOM("Array")));
|
||||
if(!a || rows < 1)
|
||||
return false;
|
||||
for(int i = 1; i <= rows; i++) {
|
||||
|
@ -1168,7 +1168,7 @@ bool AccountsModule::received(Message &msg, int id)
|
|||
if (rows>0) {
|
||||
for (int i=1 ; i<=rows ; i++) {
|
||||
Message *m1= new Message("user.login");
|
||||
Array* a = static_cast<Array*>(m.userObject("Array"));
|
||||
Array* a = static_cast<Array*>(m.userObject(YATOM("Array")));
|
||||
copyParams2(*m1,a, i);
|
||||
Engine::enqueue(m1);
|
||||
}
|
||||
|
|
|
@ -1383,7 +1383,7 @@ PresenceUser* UserList::askDatabase(const String& name)
|
|||
u_int64_t start = Time::now();
|
||||
#endif
|
||||
PresenceUser* u = 0;
|
||||
Array* a = static_cast<Array*>(m->userObject("Array"));
|
||||
Array* a = static_cast<Array*>(m->userObject(YATOM("Array")));
|
||||
int rows = 0;
|
||||
int cols = 0;
|
||||
ObjList** columns = 0;
|
||||
|
@ -1473,7 +1473,7 @@ void GenericUserList::load()
|
|||
clear();
|
||||
if (!m)
|
||||
return;
|
||||
Array* a = static_cast<Array*>(m->userObject("Array"));
|
||||
Array* a = static_cast<Array*>(m->userObject(YATOM("Array")));
|
||||
if (!a) {
|
||||
TelEngine::destruct(m);
|
||||
return;
|
||||
|
@ -1651,7 +1651,7 @@ bool SubMessageHandler::received(Message& msg)
|
|||
u_int64_t start = Time::now();
|
||||
unsigned int n = 0;
|
||||
unsigned int nc = 0;
|
||||
Array* a = static_cast<Array*>(m->userObject("Array"));
|
||||
Array* a = static_cast<Array*>(m->userObject(YATOM("Array")));
|
||||
ObjList** columns = 0;
|
||||
String** titles = 0;
|
||||
int rows = 0;
|
||||
|
@ -1845,7 +1845,7 @@ Array* SubscriptionModule::notifyRosterUpdate(const char* username, const char*
|
|||
m = queryDb(m);
|
||||
Array* data = 0;
|
||||
if (m && m->getIntValue("rows") >= 1) {
|
||||
data = static_cast<Array*>(m->userObject("Array"));
|
||||
data = static_cast<Array*>(m->userObject(YATOM("Array")));
|
||||
if (data && data->ref())
|
||||
m->userData(0);
|
||||
else
|
||||
|
@ -2557,8 +2557,8 @@ bool SubscriptionModule::handleUserRosterQuery(const String& user, const String*
|
|||
m = queryDb(m);
|
||||
if (!m)
|
||||
return false;
|
||||
bool hierarchical = msg.getBoolValue("hierarchical");
|
||||
Array* a = static_cast<Array*>(m->userObject("Array"));
|
||||
bool hierarchical = msg.getBoolValue(YSTRING("hierarchical"));
|
||||
Array* a = static_cast<Array*>(m->userObject(YATOM("Array")));
|
||||
int rows = 0;
|
||||
int cols = 0;
|
||||
unsigned int n = 0;
|
||||
|
|
|
@ -346,7 +346,7 @@ bool UsersModule::queryDb(const String& account, const String& query,
|
|||
ok = msg.getIntValue("affected") >= 1;
|
||||
}
|
||||
else {
|
||||
Array* a = static_cast<Array*>(msg.userObject("Array"));
|
||||
Array* a = static_cast<Array*>(msg.userObject(YATOM("Array")));
|
||||
String* res = a ? YOBJECT(String,a->get(0,1)) : 0;
|
||||
ok = res && (res->toInteger() != 0);
|
||||
}
|
||||
|
|
|
@ -512,7 +512,7 @@ public:
|
|||
virtual ~CipherHolder()
|
||||
{ TelEngine::destruct(m_cipher); }
|
||||
virtual void* getObject(const String& name) const
|
||||
{ return (name == "Cipher*") ? (void*)&m_cipher : RefObject::getObject(name); }
|
||||
{ return (name == YATOM("Cipher*")) ? (void*)&m_cipher : RefObject::getObject(name); }
|
||||
inline Cipher* cipher()
|
||||
{ Cipher* tmp = m_cipher; m_cipher = 0; return tmp; }
|
||||
private:
|
||||
|
|
|
@ -545,9 +545,9 @@ bool AttachHandler::received(Message& msg)
|
|||
snif.clear();
|
||||
if (cons.null() && snif.null())
|
||||
return false;
|
||||
CallEndpoint* ch = static_cast<CallEndpoint*>(msg.userObject("CallEndpoint"));
|
||||
RefPointer<DataEndpoint> de = static_cast<DataEndpoint*>(msg.userObject("DataEndpoint"));
|
||||
DataSource* ds = static_cast<DataSource*>(msg.userObject("DataSource"));
|
||||
CallEndpoint* ch = static_cast<CallEndpoint*>(msg.userObject(YATOM("CallEndpoint")));
|
||||
RefPointer<DataEndpoint> de = static_cast<DataEndpoint*>(msg.userObject(YATOM("DataEndpoint")));
|
||||
DataSource* ds = static_cast<DataSource*>(msg.userObject(YATOM("DataSource")));
|
||||
if (ch) {
|
||||
if (cons) {
|
||||
ToneConsumer* c = new ToneConsumer(ch->id(),cons);
|
||||
|
@ -603,8 +603,8 @@ bool RecordHandler::received(Message& msg)
|
|||
String id(msg.getValue("id"));
|
||||
if (!src.startsWith("tone/"))
|
||||
return false;
|
||||
CallEndpoint* ch = static_cast<CallEndpoint *>(msg.userObject("CallEndpoint"));
|
||||
RefPointer<DataEndpoint> de = static_cast<DataEndpoint *>(msg.userObject("DataEndpoint"));
|
||||
CallEndpoint* ch = static_cast<CallEndpoint *>(msg.userObject(YATOM("CallEndpoint")));
|
||||
RefPointer<DataEndpoint> de = static_cast<DataEndpoint *>(msg.userObject(YATOM("DataEndpoint")));
|
||||
if (ch) {
|
||||
id = ch->id();
|
||||
if (!de)
|
||||
|
|
|
@ -1010,11 +1010,11 @@ DataBlock* getRawData(Message& msg)
|
|||
NamedString* data = msg.getParam("rawdata");
|
||||
if (!data)
|
||||
return 0;
|
||||
NamedPointer* p = static_cast<NamedPointer*>(data->getObject("NamedPointer"));
|
||||
NamedPointer* p = static_cast<NamedPointer*>(data->getObject(YATOM("NamedPointer")));
|
||||
if (!p)
|
||||
return 0;
|
||||
GenObject* gen = p->userData();
|
||||
if (!(gen && gen->getObject("DataBlock")))
|
||||
if (!(gen && gen->getObject(YATOM("DataBlock"))))
|
||||
return 0;
|
||||
return static_cast<DataBlock*>(p->takeData());
|
||||
}
|
||||
|
@ -1033,9 +1033,9 @@ bool AttachHandler::received(Message& msg)
|
|||
if (src.null() && ovr.null() && repl.null())
|
||||
return false;
|
||||
|
||||
RefPointer<DataEndpoint> de = static_cast<DataEndpoint*>(msg.userObject("DataEndpoint"));
|
||||
RefPointer<DataEndpoint> de = static_cast<DataEndpoint*>(msg.userObject(YATOM("DataEndpoint")));
|
||||
if (!de) {
|
||||
CallEndpoint* ch = static_cast<CallEndpoint*>(msg.userObject("CallEndpoint"));
|
||||
CallEndpoint* ch = static_cast<CallEndpoint*>(msg.userObject(YATOM("CallEndpoint")));
|
||||
if (ch) {
|
||||
DataEndpoint::commonMutex().lock();
|
||||
de = ch->setEndpoint();
|
||||
|
|
|
@ -344,7 +344,7 @@ public:
|
|||
virtual ~CipherHolder()
|
||||
{ TelEngine::destruct(m_cipher); }
|
||||
virtual void* getObject(const String& name) const
|
||||
{ return (name == YSTRING("Cipher*")) ? (void*)&m_cipher : RefObject::getObject(name); }
|
||||
{ return (name == YATOM("Cipher*")) ? (void*)&m_cipher : RefObject::getObject(name); }
|
||||
inline Cipher* cipher()
|
||||
{ Cipher* tmp = m_cipher; m_cipher = 0; return tmp; }
|
||||
private:
|
||||
|
@ -474,13 +474,13 @@ YRTPWrapper::~YRTPWrapper()
|
|||
|
||||
void* YRTPWrapper::getObject(const String& name) const
|
||||
{
|
||||
if (name == YSTRING("Socket"))
|
||||
if (name == YATOM("Socket"))
|
||||
return m_rtp ? m_rtp->rtpSock() : 0;
|
||||
if (name == YSTRING("DataSource"))
|
||||
if (name == YATOM("DataSource"))
|
||||
return m_source;
|
||||
if (name == YSTRING("DataConsumer"))
|
||||
if (name == YATOM("DataConsumer"))
|
||||
return m_consumer;
|
||||
if (name == YSTRING("RTPSession"))
|
||||
if (name == YATOM("RTPSession"))
|
||||
return m_rtp;
|
||||
return RefObject::getObject(name);
|
||||
}
|
||||
|
|
|
@ -1010,9 +1010,9 @@ public:
|
|||
: m_data(0), m_socket(sock)
|
||||
{}
|
||||
virtual void* getObject(const String& name) const {
|
||||
if (name == YSTRING("DataBlock"))
|
||||
if (name == YATOM("DataBlock"))
|
||||
return m_data;
|
||||
if (name == YSTRING("Socket*"))
|
||||
if (name == YATOM("Socket*"))
|
||||
return (void*)m_socket;
|
||||
return RefObject::getObject(name);
|
||||
}
|
||||
|
@ -1802,11 +1802,11 @@ static MimeBody* doBuildSIPBody(const DebugEnabler* debug, Message& msg, MimeSdp
|
|||
DataBlock* data = 0;
|
||||
msg = "isup.encode";
|
||||
if (Engine::dispatch(msg)) {
|
||||
NamedString* ns = msg.getParam(YSTRING("rawdata"));
|
||||
NamedString* ns = msg.getParam(YATOM("rawdata"));
|
||||
if (ns) {
|
||||
NamedPointer* np = static_cast<NamedPointer*>(ns->getObject(YSTRING("NamedPointer")));
|
||||
NamedPointer* np = static_cast<NamedPointer*>(ns->getObject(YATOM("NamedPointer")));
|
||||
if (np)
|
||||
data = static_cast<DataBlock*>(np->userObject(YSTRING("DataBlock")));
|
||||
data = static_cast<DataBlock*>(np->userObject(YATOM("DataBlock")));
|
||||
}
|
||||
}
|
||||
if (data && data->length()) {
|
||||
|
@ -3700,9 +3700,9 @@ void* YateUDPParty::getTransport()
|
|||
// Get an object from this one
|
||||
void* YateUDPParty::getObject(const String& name) const
|
||||
{
|
||||
if (name == YSTRING("YateUDPParty"))
|
||||
if (name == YATOM("YateUDPParty"))
|
||||
return (void*)this;
|
||||
if (name == YSTRING("YateSIPUDPTransport") || name == YSTRING("YateSIPTransport"))
|
||||
if (name == YATOM("YateSIPUDPTransport") || name == YATOM("YateSIPTransport"))
|
||||
return m_transport;
|
||||
return SIPParty::getObject(name);
|
||||
}
|
||||
|
@ -3770,9 +3770,9 @@ void* YateTCPParty::getTransport()
|
|||
// Get an object from this one
|
||||
void* YateTCPParty::getObject(const String& name) const
|
||||
{
|
||||
if (name == YSTRING("YateTCPParty"))
|
||||
if (name == YATOM("YateTCPParty"))
|
||||
return (void*)this;
|
||||
if (name == YSTRING("YateSIPTCPTransport") || name == YSTRING("YateSIPTransport"))
|
||||
if (name == YATOM("YateSIPTCPTransport") || name == YATOM("YateSIPTransport"))
|
||||
return m_transport;
|
||||
return SIPParty::getObject(name);
|
||||
}
|
||||
|
|
|
@ -3486,7 +3486,7 @@ bool YSocksPlugin::handleChanSocks(Message& msg)
|
|||
return false;
|
||||
|
||||
RefObject* userdata = msg.userData();
|
||||
CallEndpoint* cp = static_cast<CallEndpoint*>(userdata ? userdata->getObject("CallEndpoint") : 0);
|
||||
CallEndpoint* cp = static_cast<CallEndpoint*>(userdata ? userdata->getObject(YATOM("CallEndpoint")) : 0);
|
||||
if (!cp) {
|
||||
Debug(&__plugin,DebugMild,"%s without data endpoint",msg.c_str());
|
||||
return 0;
|
||||
|
|
|
@ -1195,7 +1195,7 @@ void YStunSocketFilter::processBindResult(YStunMessage* msg)
|
|||
*/
|
||||
bool StunHandler::received(Message& msg)
|
||||
{
|
||||
Socket* socket = static_cast<Socket*>(msg.userObject("Socket"));
|
||||
Socket* socket = static_cast<Socket*>(msg.userObject(YATOM("Socket")));
|
||||
if (!socket) {
|
||||
Debug(&iplugin,DebugGoOn,"StunHandler: No socket to install filter for.");
|
||||
return true;
|
||||
|
|
|
@ -448,7 +448,7 @@ bool ZLibModule::received(Message& msg, int id)
|
|||
return false;
|
||||
if (msg.getBoolValue("test"))
|
||||
return true;
|
||||
Compressor** pp = static_cast<Compressor**>(msg.userObject("Compressor*"));
|
||||
Compressor** pp = static_cast<Compressor**>(msg.userObject(YATOM("Compressor*")));
|
||||
if (!pp) {
|
||||
Debug(this,DebugGoOn,"No pointer in %s message",msg.c_str());
|
||||
return false;
|
||||
|
|
|
@ -2119,7 +2119,7 @@ protected:
|
|||
inline bool peerHasSource(Message& msg) {
|
||||
CallEndpoint* ch = getPeer();
|
||||
if (!ch)
|
||||
ch = static_cast<CallEndpoint*>(msg.userObject(YSTRING("CallEndpoint")));
|
||||
ch = static_cast<CallEndpoint*>(msg.userObject(YATOM("CallEndpoint")));
|
||||
return ch && ch->getSource();
|
||||
}
|
||||
// Check if our consumer's source sent any data
|
||||
|
|
76
yateclass.h
76
yateclass.h
|
@ -201,8 +201,10 @@ namespace TelEngine {
|
|||
|
||||
#ifdef HAVE_BLOCK_RETURN
|
||||
#define YSTRING(s) (*({static const String str(s);&str;}))
|
||||
#define YATOM(s) (*({static const String* str(0);str ? str : String::atom(str,s);}))
|
||||
#else
|
||||
#define YSTRING(s) (s)
|
||||
#define YATOM(s) (s)
|
||||
#endif
|
||||
|
||||
#define YSTRING_INIT_HASH ((unsigned) -1)
|
||||
|
@ -603,6 +605,13 @@ class Mutex;
|
|||
*/
|
||||
constant YSTRING(const char* string);
|
||||
|
||||
/**
|
||||
* Macro to create a shared static String if supported by compiler, use with caution
|
||||
* @param string Literal constant string
|
||||
* @return A const String& if supported, literal string if not supported
|
||||
*/
|
||||
constant YATOM(const char* string);
|
||||
|
||||
/**
|
||||
* Macro to create a GenObject class from a base class and implement @ref GenObject::getObject
|
||||
* @param type Class that is declared
|
||||
|
@ -668,17 +677,17 @@ void YNOCOPY(class type);
|
|||
|
||||
#define YCLASS(type,base) \
|
||||
public: virtual void* getObject(const String& name) const \
|
||||
{ return (name == YSTRING(#type)) ? const_cast<type*>(this) : base::getObject(name); }
|
||||
{ return (name == YATOM(#type)) ? const_cast<type*>(this) : base::getObject(name); }
|
||||
|
||||
#define YCLASS2(type,base1,base2) \
|
||||
public: virtual void* getObject(const String& name) const \
|
||||
{ if (name == YSTRING(#type)) return const_cast<type*>(this); \
|
||||
{ if (name == YATOM(#type)) return const_cast<type*>(this); \
|
||||
void* tmp = base1::getObject(name); \
|
||||
return tmp ? tmp : base2::getObject(name); }
|
||||
|
||||
#define YCLASS3(type,base1,base2,base3) \
|
||||
public: virtual void* getObject(const String& name) const \
|
||||
{ if (name == YSTRING(#type)) return const_cast<type*>(this); \
|
||||
{ if (name == YATOM(#type)) return const_cast<type*>(this); \
|
||||
void* tmp = base1::getObject(name); \
|
||||
if (tmp) return tmp; \
|
||||
tmp = base2::getObject(name); \
|
||||
|
@ -686,23 +695,23 @@ public: virtual void* getObject(const String& name) const \
|
|||
|
||||
#define YCLASSIMP(type,base) \
|
||||
void* type::getObject(const String& name) const \
|
||||
{ return (name == YSTRING(#type)) ? const_cast<type*>(this) : base::getObject(name); }
|
||||
{ return (name == YATOM(#type)) ? const_cast<type*>(this) : base::getObject(name); }
|
||||
|
||||
#define YCLASSIMP2(type,base1,base2) \
|
||||
void* type::getObject(const String& name) const \
|
||||
{ if (name == YSTRING(#type)) return const_cast<type*>(this); \
|
||||
{ if (name == YATOM(#type)) return const_cast<type*>(this); \
|
||||
void* tmp = base1::getObject(name); \
|
||||
return tmp ? tmp : base2::getObject(name); }
|
||||
|
||||
#define YCLASSIMP3(type,base1,base2,base3) \
|
||||
void* type::getObject(const String& name) const \
|
||||
{ if (name == YSTRING(#type)) return const_cast<type*>(this); \
|
||||
{ if (name == YATOM(#type)) return const_cast<type*>(this); \
|
||||
void* tmp = base1::getObject(name); \
|
||||
if (tmp) return tmp; \
|
||||
tmp = base2::getObject(name); \
|
||||
return tmp ? tmp : base3::getObject(name); }
|
||||
|
||||
#define YOBJECT(type,pntr) (static_cast<type*>(GenObject::getObject(YSTRING(#type),pntr)))
|
||||
#define YOBJECT(type,pntr) (static_cast<type*>(GenObject::getObject(YATOM(#type),pntr)))
|
||||
|
||||
#define YNOCOPY(type) private: \
|
||||
type(const type&); \
|
||||
|
@ -1328,6 +1337,12 @@ public:
|
|||
*/
|
||||
unsigned int count() const;
|
||||
|
||||
/**
|
||||
* Check if the vector is empty
|
||||
* @return True if the vector contains no objects
|
||||
*/
|
||||
bool null() const;
|
||||
|
||||
/**
|
||||
* Get the object at a specific index in vector
|
||||
* @param index Index of the object to retrieve
|
||||
|
@ -1975,12 +1990,14 @@ public:
|
|||
/**
|
||||
* Fast equality operator.
|
||||
*/
|
||||
bool operator==(const String& value) const;
|
||||
inline bool operator==(const String& value) const
|
||||
{ return (this == &value) || ((hash() == value.hash()) && operator==(value.c_str())); }
|
||||
|
||||
/**
|
||||
* Fast inequality operator.
|
||||
*/
|
||||
bool operator!=(const String& value) const;
|
||||
inline bool operator!=(const String& value) const
|
||||
{ return (this != &value) && ((hash() != value.hash()) || operator!=(value.c_str())); }
|
||||
|
||||
/**
|
||||
* Case-insensitive equality operator.
|
||||
|
@ -2327,6 +2344,14 @@ public:
|
|||
inline String uriUnescape(int* errptr = 0) const
|
||||
{ return uriUnescape(c_str(),errptr); }
|
||||
|
||||
/**
|
||||
* Atom string support helper
|
||||
* @param str Reference to variable to hold the atom string
|
||||
* @param val String value to allocate to the atom
|
||||
* @return Pointer to shared atom string
|
||||
*/
|
||||
static const String* atom(const String*& str, const char* val);
|
||||
|
||||
protected:
|
||||
/**
|
||||
* Called whenever the value changed (except in constructors).
|
||||
|
@ -2531,6 +2556,39 @@ private:
|
|||
int m_flags;
|
||||
};
|
||||
|
||||
/**
|
||||
* Indirected shared string offering access to atom strings
|
||||
* @short Atom string holder
|
||||
*/
|
||||
class Atom
|
||||
{
|
||||
public:
|
||||
/**
|
||||
* Constructor
|
||||
* @param value Atom's string value
|
||||
*/
|
||||
inline explicit Atom(const char* value)
|
||||
: m_atom(0)
|
||||
{ String::atom(m_atom,value); }
|
||||
|
||||
/**
|
||||
* Conversion to "const String &" operator
|
||||
* @return Pointer to the atom String
|
||||
*/
|
||||
inline operator const String&() const
|
||||
{ return *m_atom; }
|
||||
|
||||
/**
|
||||
* String method call operator
|
||||
* @return Pointer to the atom String
|
||||
*/
|
||||
inline const String* operator->() const
|
||||
{ return m_atom; }
|
||||
|
||||
private:
|
||||
const String* m_atom;
|
||||
};
|
||||
|
||||
/**
|
||||
* Holder for an event (output, debug or alarm) message
|
||||
* @short A captured event string with a debug level
|
||||
|
|
Loading…
Reference in New Issue