# class Module

A Plugin that implements a module. More...

Full name | `TelEngine::Module`
Definition | `#include <yatephone.h>`
Inherits | TelEngine::MessageReceiver [public ], TelEngine::Mutex [public ], TelEngine::Plugin [public ]
Inherited by | ClientDriver, Driver
List of all Methods

Annotated List
Files
Globals
Hierarchy
Index

#### Public Methods

- virtual void* getObject (const String& name) const
- inline const String& type () const
- void changed ()
- inline bool filterInstalled () const
- bool filterDebug (const String& item) const

#### Public Static Methods

- static inline unsigned int updateDelay ()
- static inline void updateDelay (unsigned int delay)
- static bool itemComplete (String& itemList, const String& item, const String& partWord)

#### Protected Types

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

#### Protected Methods

- Module (const char* name, const char* type = 0, bool earlyInit = false)
- virtual ~Module ()
- virtual void initialize ()
- void setup ()
- inline 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 Static Methods

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

## Detailed Description

Module is a descendent of Plugin specialized in implementing modules

void* getObject (const String& name)

### getObject

[const virtual]

Get a pointer to a derived class given that class name

Parameters:

name | Name 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.

inline const String& type ()

### type

[const]

Retrieve the type of the module

Returns: The module's type as String

void changed ()

### changed

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

inline unsigned int updateDelay ()

### updateDelay

[static]

Retrieve the global update notification delay

Returns: Update delay value in seconds

inline void updateDelay (unsigned int delay)

### updateDelay

[static]

Set the global update notification delay

Parameters:

delay | New update delay value in seconds, 0 to disable

inline bool filterInstalled ()

### filterInstalled

[const]

Check if a debug filter is installed

Returns: True if debugging should be filtered

bool filterDebug (const String& item)

### filterDebug

[const]

Check by filter rule if debugging should be active

Parameters:

item | Value of the item to match

Returns: True if debugging should be activated

bool itemComplete (String& itemList, const String& item, const String& partWord)

### itemComplete

[static]

Helper function to complete just one item on a command line

Parameters:

itemList | Tab separated list of possible values to complete
item | Item to possibly insert in the list
partWord | Partial word to complete, may be empty

Returns: True if the item was added to list, false if it didn't match

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

###

[protected]

IDs of the installed relays

const char* messageName (int id)

### messageName

[protected static]

Find the name of a specific Relay ID

Parameters:

id | RelayID of the message

Returns: Pointer to name of the message or NULL if not found

inline int relayId (const char* name)

### relayId

[protected static]

Find the ID or a specific Relay name

Parameters:

name | Name of the Relay to search for

Returns: ID of the Relay, zero if not found

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

### Module

[protected]

Constructor

Parameters:

name | Plugin name of this driver
type | Type of the driver: "misc", "route", etc.
earlyInit | True to attempt to initialize module before others

~Module ()

### ~Module

[protected virtual]

Destructor

void initialize ()

### initialize

[protected virtual]

This method is called to initialize the loaded module

Reimplemented from Plugin.

void setup ()

### setup

[protected]

Install standard message relays

inline bool relayInstalled (int id)

### relayInstalled

[protected const]

Check if a specific relay ID is installed

Parameters:

id | RelayID to test for

Returns: True if such a relay is installed

bool installRelay (int id, unsigned priority = 100)

### installRelay

[protected]

Install a standard message relay

Parameters:

id | RelayID of the new relay to create
priority | Priority of the handler, 0 = top

Returns: True if installed or already was one installed

bool installRelay (const char* name, unsigned priority = 100)

### installRelay

[protected]

Install a standard message relay

Parameters:

name | Name of the relay to create, must match a RelayID
priority | Priority of the handler, 0 = top

Returns: True if installed or already was one installed

bool installRelay (int id, const char* name, unsigned priority = 100)

### installRelay

[protected]

Install a custom message relay

Parameters:

id | RelayID of the new relay to create
name | Name of the custom relay to create
priority | Priority of the handler, 0 = top

Returns: True if installed or already was one installed

bool installRelay (MessageRelay* relay)

### installRelay

[protected]

Install a custom message relay

Parameters:

relay | Custom message relay

Returns: True if installed, false if there was already one with same ID

bool uninstallRelay (MessageRelay* relay, bool delRelay = true)

### uninstallRelay

[protected]

Uninstall a message relay

Parameters:

relay | Pointer to message relay
delRelay | True to delete the relay after removing it

Returns: True if uninstalled, false if if was not present

bool uninstallRelay (int id, bool delRelay = true)

### uninstallRelay

[protected]

Uninstall a message relay

Parameters:

id | RelayID to uninstall, relay will be deleted
delRelay | True to delete the relay after removing it

Returns: True if uninstalled, false if if was not present

bool uninstallRelays ()

### uninstallRelays

[protected]

Uninstall all installed relays in preparation for unloading

Returns: True if all relays were uninstalled, false if something wrong

bool received (Message &msg, int id)

### received

[protected virtual]

Message receiver handler

Parameters:

msg | The received message
id | The identifier with which the relay was created

Returns: True to stop processing, false to try other handlers

Reimplemented from MessageReceiver.

void genUpdate (Message& msg)

### genUpdate

[protected virtual]

Opportunity to modify the update message

Parameters:

msg | Status update message

void msgTimer (Message& msg)

### msgTimer

[protected virtual]

Timer message handler.

Parameters:

msg | Time message

void msgStatus (Message& msg)

### msgStatus

[protected virtual]

Status message handler that is invoked only for matching messages.

Parameters:

msg | Status message

bool msgRoute (Message& msg)

### msgRoute

[protected virtual]

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

Parameters:

msg | Call routing message

Returns: True to stop processing the message, false to try other handlers

bool msgCommand (Message& msg)

### msgCommand

[protected virtual]

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

Parameters:

msg | Command message

Returns: True to stop processing the message, false to try other handlers

void statusModule (String& str)

### statusModule

[protected virtual]

Build the module identification part of the status answer

Parameters:

str | String variable to fill up

void statusParams (String& str)

### statusParams

[protected virtual]

Build the parameter reporting part of the status answer

Parameters:

str | String variable to fill up

void statusDetail (String& str)

### statusDetail

[protected virtual]

Build the details reporting part of the status answer

Parameters:

str | String variable to fill up

bool commandExecute (String& retVal, const String& line)

### commandExecute

[protected virtual]

Execute a specific command

Parameters:

retVal | String to append the textual command output to
line | Command line to attempt to execute

Returns: True to stop processing the message, false to try other handlers

bool commandComplete (Message& msg, const String& partLine, const String& partWord)

### commandComplete

[protected virtual]

Complete a command line

Parameters:

msg | Message to return completion into
partLine | Partial line to complete, excluding the last word
partWord | Partial word to complete

Returns: True to stop processing the message, false to try other handlers

bool setDebug (Message& msg, const String& target)

### setDebug

[protected virtual]

Set the local debugging level

Parameters:

msg | Debug setting message
target | String to match for local settings

Generated by: paulc on bussard on Fri Dec 21 16:28:34 2012, using kdoc 2.0a54.