Added extra parameter used to set relay filter in module install relay.

git-svn-id: http://yate.null.ro/svn/yate/trunk@6531 acf43c95-373e-0410-b603-e72c3f656dc1
This commit is contained in:
marian 2021-12-16 11:37:39 +00:00
parent ded00a075b
commit 2bcacf9525
2 changed files with 19 additions and 10 deletions

View File

@ -1107,31 +1107,37 @@ void* Module::getObject(const String& name) const
return Plugin::getObject(name);
}
bool Module::installRelay(int id, const char* name, unsigned priority)
bool Module::installRelay(int id, const char* name, unsigned priority, NamedString* filter)
{
if (!(id && name && priority))
if (!(id && name && priority)) {
TelEngine::destruct(filter);
return false;
}
TempObjectCounter cnt(objectsCounter(),true);
Lock lock(this);
if (m_relays & id)
if (m_relays & id) {
TelEngine::destruct(filter);
return true;
}
m_relays |= id;
MessageRelay* relay = new MessageRelay(name,this,id,priority,Module::name());
if (filter)
relay->setFilter(filter);
m_relayList.append(relay)->setDelete(false);
Engine::install(relay);
return true;
}
bool Module::installRelay(int id, unsigned priority)
bool Module::installRelay(int id, unsigned priority, NamedString* filter)
{
return installRelay(id,messageName(id),priority);
return installRelay(id,messageName(id),priority,filter);
}
bool Module::installRelay(const char* name, unsigned priority)
bool Module::installRelay(const char* name, unsigned priority, NamedString* filter)
{
return installRelay(lookup(name,s_messages),name,priority);
return installRelay(lookup(name,s_messages),name,priority,filter);
}
bool Module::installRelay(MessageRelay* relay)

View File

@ -1509,26 +1509,29 @@ protected:
* Install a standard message relay
* @param id RelayID of the new relay to create
* @param priority Priority of the handler, 0 = top
* @param filter Optional filter for relay. It will be consumed
* @return True if installed or already was one installed
*/
bool installRelay(int id, unsigned priority = 100);
bool installRelay(int id, unsigned priority = 100, NamedString* filter = 0);
/**
* Install a standard message relay
* @param name Name of the relay to create, must match a RelayID
* @param priority Priority of the handler, 0 = top
* @param filter Optional filter for relay. It will be consumed
* @return True if installed or already was one installed
*/
bool installRelay(const char* name, unsigned priority = 100);
bool installRelay(const char* name, unsigned priority = 100, NamedString* filter = 0);
/**
* Install a custom message relay
* @param id RelayID of the new relay to create
* @param name Name of the custom relay to create
* @param priority Priority of the handler, 0 = top
* @param filter Optional filter for relay. It will be consumed
* @return True if installed or already was one installed
*/
bool installRelay(int id, const char* name, unsigned priority = 100);
bool installRelay(int id, const char* name, unsigned priority = 100, NamedString* filter = 0);
/**
* Install a custom message relay