# Module Class Reference

A Plugin that implements a module. More...

`#include <yatephone.h>`

Inheritance diagram for Module:

List of all members.

## Public Member Functions

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

## Static Public Member Functions

static unsigned int | updateDelay ()
static void | updateDelay (unsigned int delay)

## 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, PubLast = 0x0fffffff, Private = 0x10000000
}

## Protected Member Functions

| Module (const char *name, const char *type=0)
virtual | ~Module ()
virtual void | initialize ()
void | setup ()
bool | installRelay (int id, unsigned priority=100)
bool | installRelay (const char *name, unsigned priority=100)
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)

## Static Protected Member Functions

static const char * | messageName (int id)

## 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` |
| ) |  |  | `[protected]`

Constructor

Parameters:

  | name | Plugin name of this driver
  | type | Type of the driver: "misc", "route", etc.

virtual ~Module | ( |  | ) | `[protected, virtual]`

Destructor

## Member Function Documentation

virtual void* getObject | ( | const String & | name | ) | 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.

Reimplemented in Driver.

const String& name | ( |  | ) | const`[inline]`

Retrive the name of the module

Returns:
  The module's name as String

const String& type | ( |  | ) | const`[inline]`

Retrive the type of the module

Returns:
  The module's type as String

void changed | ( |  | ) |

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

static unsigned int updateDelay | ( |  | ) | `[inline, static]`

Retrive the global update notification delay

Returns:
  Update delay value in seconds

static void updateDelay | ( | unsigned int | delay | ) | `[inline, static]`

Set the global update notification delay

Parameters:

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

bool filterInstalled | ( |  | ) | const`[inline]`

Check if a debug filter is installed

Returns:
  True if debugging should be filtered

bool filterDebug | ( | const String & | item | ) | 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

static const char* messageName | ( | int | id | ) | `[static, protected]`

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

virtual void initialize | ( |  | ) | `[protected, virtual]`

This method is called to initialize the loaded module

Implements Plugin.

Reimplemented in Driver, and ClientDriver.

void setup | ( |  | ) | `[protected]`

Install standard message relays

Reimplemented in ClientDriver.

bool installRelay | ( | int | id,
|  | unsigned | priority = `100` |
| ) |  |  | `[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` |
| ) |  |  | `[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

virtual bool received | ( | Message & | msg,
|  | int | id |
| ) |  |  | `[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

Implements MessageReceiver.

Reimplemented in Driver.

virtual void genUpdate | ( | Message & | msg | ) | `[protected, virtual]`

Opportunity to modify the update message

Parameters:

  | msg | Status update message

Reimplemented in Driver.

virtual void msgTimer | ( | Message & | msg | ) | `[protected, virtual]`

Timer message handler.

Parameters:

  | msg | Time message

Reimplemented in ClientDriver.

virtual void msgStatus | ( | Message & | msg | ) | `[protected, virtual]`

Status message handler that is invoked only for matching messages.

Parameters:

  | msg | Status message

virtual bool msgRoute | ( | Message & | msg | ) | `[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

Reimplemented in ClientDriver.

virtual bool msgCommand | ( | Message & | msg | ) | `[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

virtual void statusModule | ( | String & | str | ) | `[protected, virtual]`

Build the module identification part of the status answer

Parameters:

  | str | String variable to fill up

Reimplemented in Driver.

virtual void statusParams | ( | String & | str | ) | `[protected, virtual]`

Build the parameter reporting part of the status answer

Parameters:

  | str | String variable to fill up

Reimplemented in Driver.

virtual void statusDetail | ( | String & | str | ) | `[protected, virtual]`

Build the details reporting part of the status answer

Parameters:

  | str | String variable to fill up

Reimplemented in Driver.

virtual bool commandExecute | ( | String & | retVal,
|  | const String & | line |
| ) |  |  | `[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

virtual bool commandComplete | ( | Message & | msg,
|  | const String & | partLine,
|  | const String & | partWord |
| ) |  |  | `[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

Reimplemented in Driver.

virtual bool setDebug | ( | Message & | msg,
|  | const String & | target |
| ) |  |  | `[protected, virtual]`

Set the local debugging level

Parameters:

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

Reimplemented in Driver.

## Member Data Documentation

enum { ... } RelayID`[protected]`

IDs of the installed relays

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

- yatephone.h