Yate
Public Member Functions | Static Public Member Functions | Protected Types | Protected Member Functions | Static Protected Member Functions | Protected Attributes | List of all members
Module Class Reference

A Plugin that implements a module. More...

#include <yatephone.h>

Inheritance diagram for Module:
Plugin Mutex MessageReceiver GenObject DebugEnabler Lockable GenObject Driver ClientDriver

Public Member Functions

virtual void * getObject (const String &name) const
 
const Stringtype () const
 
void changed ()
 
bool filterInstalled () const
 
bool filterDebug (const String &item) const
 
- Public Member Functions inherited from Plugin
 Plugin (const char *name, bool earlyInit=false)
 
virtual ~Plugin ()
 
virtual const StringtoString () const
 
virtual bool isBusy () const
 
const Stringname () const
 
NamedCounterobjectsCounter () const
 
bool earlyInit () const
 
- Public Member Functions inherited from GenObject
 GenObject ()
 
virtual ~GenObject ()
 
virtual bool alive () const
 
virtual void destruct ()
 
NamedCountergetObjCounter () const
 
NamedCountersetObjCounter (NamedCounter *counter)
 
- 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 unsigned int updateDelay ()
 
static void updateDelay (unsigned int delay)
 
static bool itemComplete (String &itemList, const String &item, const String &partWord)
 
- Static Public Member Functions inherited from GenObject
static void * getObject (const String &name, const GenObject *obj)
 
static bool getObjCounting ()
 
static void setObjCounting (bool enable)
 
static NamedCountergetObjCounter (const String &name, bool create=true)
 
static ObjListgetObjCounters ()
 
- 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 Types

enum  {
  Status = 0x00000001, Timer = 0x00000002, Level = 0x00000004, Command = 0x00000008,
  Help = 0x00000010, Halt = 0x00000020, Route = 0x00000040, Stop = 0x00000080,
  Execute = 0x00000100, Drop = 0x00000200, Locate = 0x00000400, Masquerade = 0x00000800,
  Ringing = 0x00001000, Answered = 0x00002000, Tone = 0x00004000, Text = 0x00008000,
  Progress = 0x00010000, Update = 0x00020000, Transfer = 0x00040000, Control = 0x00080000,
  MsgExecute = 0x00100000, PubLast = 0x0fffffff, Private = 0x10000000
}
 

Protected Member Functions

 Module (const char *name, const char *type=0, bool earlyInit=false)
 
virtual ~Module ()
 
virtual void initialize ()
 
void setup ()
 
bool relayInstalled (int id) const
 
bool installRelay (int id, unsigned priority=100)
 
bool installRelay (const char *name, unsigned priority=100)
 
bool installRelay (int id, const char *name, unsigned priority=100)
 
bool installRelay (MessageRelay *relay)
 
bool uninstallRelay (MessageRelay *relay, bool delRelay=true)
 
bool uninstallRelay (int id, bool delRelay=true)
 
bool uninstallRelays ()
 
virtual bool received (Message &msg, int id)
 
virtual void genUpdate (Message &msg)
 
virtual void msgTimer (Message &msg)
 
virtual void msgStatus (Message &msg)
 
virtual bool msgRoute (Message &msg)
 
virtual bool msgCommand (Message &msg)
 
virtual void statusModule (String &str)
 
virtual void statusParams (String &str)
 
virtual void statusDetail (String &str)
 
virtual bool commandExecute (String &retVal, const String &line)
 
virtual bool commandComplete (Message &msg, const String &partLine, const String &partWord)
 
virtual bool setDebug (Message &msg, const String &target)
 
- Protected Member Functions inherited from DebugEnabler
void debugName (const char *name)
 

Static Protected Member Functions

static const char * messageName (int id)
 
static int relayId (const char *name)
 

Protected Attributes

enum TelEngine::Module:: { ... }  RelayID
 

Detailed Description

A Plugin that implements a module.

Module is a descendent of Plugin specialized in implementing modules

Member Enumeration Documentation

anonymous enum
protected

IDs of the installed relays

Constructor & Destructor Documentation

Module ( const char *  name,
const char *  type = 0,
bool  earlyInit = false 
)
protected

Constructor

Parameters
namePlugin name of this driver
typeType of the driver: "misc", "route", etc.
earlyInitTrue to attempt to initialize module before others
virtual ~Module ( )
protectedvirtual

Destructor

Member Function Documentation

void changed ( )

Mark the driver statistics "dirty" therefore triggring a delayed status update.

virtual bool commandComplete ( Message msg,
const String partLine,
const String partWord 
)
protectedvirtual

Complete a command line

Parameters
msgMessage to return completion into
partLinePartial line to complete, excluding the last word
partWordPartial word to complete
Returns
True to stop processing the message, false to try other handlers

Reimplemented in Driver.

virtual bool commandExecute ( String retVal,
const String line 
)
protectedvirtual

Execute a specific command

Parameters
retValString to append the textual command output to
lineCommand line to attempt to execute
Returns
True to stop processing the message, false to try other handlers
bool filterDebug ( const String item) const

Check by filter rule if debugging should be active

Parameters
itemValue of the item to match
Returns
True if debugging should be activated
bool filterInstalled ( ) const
inline

Check if a debug filter is installed

Returns
True if debugging should be filtered

References String::null().

virtual void genUpdate ( Message msg)
protectedvirtual

Opportunity to modify the update message

Parameters
msgStatus update message

Reimplemented in Driver.

virtual void* getObject ( const String name) const
virtual

Get a pointer to a derived class given that class name

Parameters
nameName of the class we are asking for
Returns
Pointer to the requested class or NULL if this object doesn't implement it

Reimplemented from Plugin.

Reimplemented in Driver.

virtual void initialize ( )
protectedvirtual

This method is called to initialize the loaded module

Implements Plugin.

Reimplemented in ClientDriver, and Driver.

bool installRelay ( int  id,
unsigned  priority = 100 
)
protected

Install a standard message relay

Parameters
idRelayID of the new relay to create
priorityPriority of the handler, 0 = top
Returns
True if installed or already was one installed
bool installRelay ( const char *  name,
unsigned  priority = 100 
)
protected

Install a standard message relay

Parameters
nameName of the relay to create, must match a RelayID
priorityPriority of the handler, 0 = top
Returns
True if installed or already was one installed
bool installRelay ( int  id,
const char *  name,
unsigned  priority = 100 
)
protected

Install a custom message relay

Parameters
idRelayID of the new relay to create
nameName of the custom relay to create
priorityPriority of the handler, 0 = top
Returns
True if installed or already was one installed
bool installRelay ( MessageRelay relay)
protected

Install a custom message relay

Parameters
relayCustom message relay
Returns
True if installed, false if there was already one with same ID
static bool itemComplete ( String itemList,
const String item,
const String partWord 
)
static

Helper function to complete just one item on a command line

Parameters
itemListTab separated list of possible values to complete
itemItem to possibly insert in the list
partWordPartial word to complete, may be empty
Returns
True if the item was added to list, false if it didn't match
static const char* messageName ( int  id)
staticprotected

Find the name of a specific Relay ID

Parameters
idRelayID of the message
Returns
Pointer to name of the message or NULL if not found
virtual bool msgCommand ( Message msg)
protectedvirtual

Handler for special commands and line completion requests. By default it calls commandExecute() or commandComplete().

Parameters
msgCommand message
Returns
True to stop processing the message, false to try other handlers
virtual bool msgRoute ( Message msg)
protectedvirtual

Routing message handler that is invoked for all call.route messages.

Parameters
msgCall routing message
Returns
True to stop processing the message, false to try other handlers

Reimplemented in ClientDriver, and Driver.

virtual void msgStatus ( Message msg)
protectedvirtual

Status message handler that is invoked only for matching messages.

Parameters
msgStatus message
virtual void msgTimer ( Message msg)
protectedvirtual

Timer message handler.

Parameters
msgTime message

Reimplemented in ClientDriver.

virtual bool received ( Message msg,
int  id 
)
protectedvirtual

Message receiver handler

Parameters
msgThe received message
idThe identifier with which the relay was created
Returns
True to stop processing, false to try other handlers

Implements MessageReceiver.

Reimplemented in ClientDriver, and Driver.

static int relayId ( const char *  name)
inlinestaticprotected

Find the ID or a specific Relay name

Parameters
nameName of the Relay to search for
Returns
ID of the Relay, zero if not found

References TelEngine::lookup().

bool relayInstalled ( int  id) const
inlineprotected

Check if a specific relay ID is installed

Parameters
idRelayID to test for
Returns
True if such a relay is installed
virtual bool setDebug ( Message msg,
const String target 
)
protectedvirtual

Set the local debugging level

Parameters
msgDebug setting message
targetString to match for local settings

Reimplemented in Driver.

void setup ( )
protected

Install standard message relays

virtual void statusDetail ( String str)
protectedvirtual

Build the details reporting part of the status answer

Parameters
strString variable to fill up

Reimplemented in Driver.

virtual void statusModule ( String str)
protectedvirtual

Build the module identification part of the status answer

Parameters
strString variable to fill up

Reimplemented in Driver.

virtual void statusParams ( String str)
protectedvirtual

Build the parameter reporting part of the status answer

Parameters
strString variable to fill up

Reimplemented in Driver.

const String& type ( ) const
inline

Retrieve the type of the module

Returns
The module's type as String
bool uninstallRelay ( MessageRelay relay,
bool  delRelay = true 
)
protected

Uninstall a message relay

Parameters
relayPointer to message relay
delRelayTrue to delete the relay after removing it
Returns
True if uninstalled, false if if was not present
bool uninstallRelay ( int  id,
bool  delRelay = true 
)
protected

Uninstall a message relay

Parameters
idRelayID to uninstall, relay will be deleted
delRelayTrue to delete the relay after removing it
Returns
True if uninstalled, false if if was not present
bool uninstallRelays ( )
protected

Uninstall all installed relays in preparation for unloading

Returns
True if all relays were uninstalled, false if something wrong
static unsigned int updateDelay ( )
inlinestatic

Retrieve the global update notification delay

Returns
Update delay value in seconds
static void updateDelay ( unsigned int  delay)
inlinestatic

Set the global update notification delay

Parameters
delayNew update delay value in seconds, 0 to disable

Member Data Documentation

enum { ... } RelayID

IDs of the installed relays


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