Yate
SignallingEngine Class Reference

Main signalling component holder. More...

#include <yatesig.h>

Inheritance diagram for SignallingEngine:
DebugEnabler Mutex Lockable

Public Member Functions

 SignallingEngine (const char *name="signalling")
 
virtual ~SignallingEngine ()
 
void insert (SignallingComponent *component)
 
void remove (SignallingComponent *component)
 
bool remove (const String &name)
 
SignallingComponentfind (const String &name)
 
SignallingComponentfind (const String &name, const String &type, const SignallingComponent *start=0)
 
SignallingComponentbuild (const String &type, NamedList &params, bool init=false, bool ref=true)
 
bool control (NamedList &params)
 
bool find (const SignallingComponent *component)
 
void notify (SignallingComponent *component, NamedList notifs)
 
bool start (const char *name="Sig Engine", Thread::Priority prio=Thread::Normal, unsigned long usec=0)
 
void stop ()
 
void setNotifier (SignallingNotifier *notifier)
 
void removeNotifier (SignallingNotifier *notifier)
 
Threadthread () const
 
unsigned long tickSleep (unsigned long usec=1000000)
 
unsigned long tickDefault () const
 
- Public Member Functions inherited from DebugEnabler
 DebugEnabler (int level=TelEngine::debugLevel(), bool enabled=true)
 
int debugLevel () const
 
int debugLevel (int level)
 
bool debugEnabled () const
 
void debugEnabled (bool enable)
 
const char * debugName () const
 
bool debugAt (int level) const
 
bool debugChained () const
 
void debugChain (const DebugEnabler *chain=0)
 
void debugCopy (const DebugEnabler *original=0)
 
- Public Member Functions inherited from Mutex
 Mutex (bool recursive=false, const char *name=0)
 
 Mutex (const Mutex &original)
 
 ~Mutex ()
 
Mutexoperator= (const Mutex &original)
 
virtual bool lock (long maxwait=-1)
 
virtual bool unlock ()
 
virtual bool locked () const
 
const char * owner () const
 
bool recursive () const
 
- Public Member Functions inherited from Lockable
virtual ~Lockable ()
 
virtual bool check (long maxwait=-1)
 
virtual bool unlockAll ()
 

Static Public Member Functions

static SignallingEngineself (bool create=false)
 
static long maxLockWait ()
 
static void maxLockWait (long maxWait)
 
template<class Obj>
static void destruct (Obj *&obj)
 
- Static Public Member Functions inherited from Mutex
static int count ()
 
static int locks ()
 
static bool efficientTimedLock ()
 
- Static Public Member Functions inherited from Lockable
static void wait (unsigned long maxwait)
 
static unsigned long wait ()
 
static void startUsingNow ()
 
static void enableSafety (bool safe=true)
 
static bool safety ()
 

Protected Member Functions

virtual unsigned long timerTick (const Time &when)
 
- Protected Member Functions inherited from DebugEnabler
void debugName (const char *name)
 

Protected Attributes

ObjList m_components
 

Friends

class SignallingComponent
 
class SignallingThreadPrivate
 

Detailed Description

Main signalling component holder.

The engine is the center of all SS7 or ISDN applications. It is used as a base to build the protocol stack from components.

Constructor & Destructor Documentation

◆ SignallingEngine()

SignallingEngine ( const char * name = "signalling")

Constructor of an empty engine

Parameters
nameThe debug name of this engine

Referenced by self().

◆ ~SignallingEngine()

virtual ~SignallingEngine ( )
virtual

Destructor, removes all components

Member Function Documentation

◆ build()

SignallingComponent * build ( const String & type,
NamedList & params,
bool init = false,
bool ref = true )

Retrieve and reference an existing component, create by factory if not present

Parameters
typeClass or base class of the component to find or create
paramsName of component to find or create and creation parameters
initSet to true to initialize a newly created component
refTrue to add a reference when returning existing component
Returns
Pointer to component found or created, NULL on failure

◆ control()

bool control ( NamedList & params)

Apply a control operation to all components in the engine

Parameters
paramsThe list of parameters to query or change
Returns
True if the control operation was executed by at least one component

◆ destruct()

template<class Obj>
static void destruct ( Obj *& obj)
inlinestatic

Helper template used to remove a component descendant from its engine, destroy it and set the received pointer to 0

Parameters
objReference to pointer (lvalue) to the object to remove and destroy

◆ find() [1/3]

bool find ( const SignallingComponent * component)

Check if a component is in the engine's list

Parameters
componentPointer to component to check
Returns
True if the component is in the engine's list

◆ find() [2/3]

SignallingComponent * find ( const String & name)

Retrieve a component by name, lock the list while searching for it

Parameters
nameName of the component to find
Returns
Pointer to component found or NULL

◆ find() [3/3]

SignallingComponent * find ( const String & name,
const String & type,
const SignallingComponent * start = 0 )

Retrieve a component by name and class, lock the list while searching for it

Parameters
nameName of the component to find, empty to find any of the type
typeClass or base class of the component to find, empty to match any
startComponent to start searching from, search all list if NULL
Returns
Pointer to component found or NULL

References start().

◆ insert()

void insert ( SignallingComponent * component)

Insert a component in the engine, lock the list while doing so

Parameters
componentPointer to component to insert in engine

◆ maxLockWait() [1/2]

static long maxLockWait ( )
inlinestatic

Get the maximum time we should spend acquiring a non-critical Mutex

Returns
Maximum non-critical lock wait in usec, -1 to wait forever

◆ maxLockWait() [2/2]

static void maxLockWait ( long maxWait)
static

Set the maximum time we should spend acquiring a non-critical Mutex

Parameters
maxWaitNew maximum non-critical lock wait in usec, negative to wait forever

◆ notify()

void notify ( SignallingComponent * component,
NamedList notifs )

Handle notifications from a SignallingComponent

Parameters
componentThe SignallingComponent from which the notifications were received
notifsThe notifications sent by this SignallingComponent

◆ remove() [1/2]

bool remove ( const String & name)

Remove and destroy a component from the engine by name

Parameters
nameName of component to remove from engine
Returns
True if a component was found and destroyed

◆ remove() [2/2]

void remove ( SignallingComponent * component)

Remove a component from the engine, lock the list while doing so

Parameters
componentPointer to component to remove from engine

◆ removeNotifier()

void removeNotifier ( SignallingNotifier * notifier)
inline

Remove from this engine a notifier object

Parameters
notifierThe SignallingNotifier object to be removed from the engine

◆ self()

static SignallingEngine * self ( bool create = false)
static

Get a pointer to the first (and usually only) instance created

Parameters
createCreate the instance if it doesn't exist
Returns
Pointer to first engine, NULL if not created

References SignallingEngine().

◆ setNotifier()

void setNotifier ( SignallingNotifier * notifier)
inline

Add to this engine a notifier object

Parameters
notifierThe SignallingNotifier object to be added to the engine

◆ start()

bool start ( const char * name = "Sig Engine",
Thread::Priority prio = Thread::Normal,
unsigned long usec = 0 )

Starts the worker thread that keeps components alive

Parameters
nameStatic name of the thread
prioThread's priority
usecHow long to sleep between iterations in usec, 0 to use library default
Returns
True if (already) started, false if an error occured

Referenced by find().

◆ stop()

void stop ( )

Stops and destroys the worker thread if running

◆ thread()

Thread * thread ( ) const

Return a pointer to the worker thread

Returns
Pointer to running worker thread or NULL

◆ tickDefault()

unsigned long tickDefault ( ) const
inline

Get the default engine tick sleep time in microseconds

Returns
Default timer sleep in usec

◆ tickSleep()

unsigned long tickSleep ( unsigned long usec = 1000000)

Adjust (decrease only) the desired maximum time until next tick. Can be called only from within timerTick()

Parameters
usecDesired time until next timerTick() call in usec
Returns
Timer sleep in usec after applying the current change

◆ timerTick()

virtual unsigned long timerTick ( const Time & when)
protectedvirtual

Method called periodically by the worker thread to keep everything alive

Parameters
whenTime to use as computing base for events and timeouts
Returns
Desired sleep (in usec) until thread's next tick interval

Member Data Documentation

◆ m_components

ObjList m_components
protected

The list of components managed by this engine


The documentation for this class was generated from the following file: