Main Page | Class Hierarchy | Class List | File List | Class Members

MessageFrame Class Reference

#include <xmppbase.h>

Inheritance diagram for MessageFrame:

Inheritance graph
[legend]
Collaboration diagram for MessageFrame:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 MessageFrame (LaunchNewId &lid, PINDEX preferredPort)
virtual ~MessageFrame ()
BOOL WaitUntilInitialised ()
void SendThisMessageTo (const char *_message, PString dest)
void SendThisMessageTo (PString &_message, PString dest)
void SendThisMessageTo (PString &_message, const char *subj, PString dest)
void SendThisMessageTo (PString &_message, PString subj, PString dest)
void SendThisMessageTo (const char *message, const char *subj, PString dest)
PString GetLastSender ()
PString GetOurId ()
virtual void Terminate ()
virtual void Main ()
void Initialise ()
PTimeInterval TimeSinceCreation ()
void SetCreatedAtNow ()

Protected Member Functions

void ProcessIncomingMessages (PBYTEArray &data, PINDEX size)
virtual void ProcessMessage (PString message, PString sender)
virtual void ProcessHangup (PStringArray &cmds, PString &sender)
virtual void ProcessCallNode (PStringArray &cmds, PString &sender)
virtual void ProcessStatusQuery (PStringArray &cmds, PString &sender)
virtual void ProcessQueryLocalAddress (PStringArray &cmds, PString &sender)
virtual void ProcessQueryDestAddress (PStringArray &cmds, PString &sender)
virtual void ProcessAdviseSendAddress (PStringArray &cmds, PString &sender)
virtual void ProcessDuration (PStringArray &cmds, PString &sender)
virtual void ProcessIdentify (PStringArray &cmds, PString &sender)
virtual void ProcessDebug (PStringArray &cmds, PString &sender)
virtual void ProcessAnswer (PStringArray &cmds, PString &sender)
virtual void ProcessTransferUdp (PStringArray &cmds, PString &sender)
virtual void ProcessQuitNow (PStringArray &cmds, PString &sender)
virtual void ProcessHelp (PStringArray &cmds, PString &sender)
virtual void ProcessSendDtmf (PStringArray &cmds, PString &sender)
virtual void ProcessRequestNewId (PStringArray &cmds, PString &sender)
virtual void ProcessSetWriteFile (PStringArray &cmds, PString &sender)
virtual void ProcessSetReadFile (PStringArray &cmds, PString &sender)
virtual void SetWriteFile (PString &newWriteFile)
virtual void SetReadFile (PString &newReadFile)
virtual BOOL SendDtmf (const PString &dtmfVals)
BOOL GetLocalAddress (PIPSocket::Address &addr, PINDEX &portNo)
virtual BOOL QueryLocalAddress (PIPSocket::Address &addr, PINDEX &portNo)
virtual BOOL QuerySendToAddress (PIPSocket::Address &addr, PINDEX &portNo)
virtual BOOL SetSendToAddress (PIPSocket::Address &addr, PINDEX &portNo)
BOOL GetSendToAddress (PIPSocket::Address &addr, PINDEX &port)
virtual BOOL OkToQuitNow ()
virtual BOOL OkToHangup ()
virtual void SilentlyEndAll ()

Protected Attributes

PStringArray availableCommands
PString lastSender
PSyncPoint threadRunning
PSyncPoint goodConnection
PSyncPoint writeSourceId
PUDPSocket audioSocket

Detailed Description

A class to handle one connection with a remote server


Constructor & Destructor Documentation

MessageFrame::MessageFrame LaunchNewId lid,
PINDEX  preferredPort
 

Constructor, give it a reference to the LaunchNewId instance, so this can establish a new comms channel

MessageFrame::~MessageFrame  )  [virtual]
 

Destructor, to close of any threads etc


Member Function Documentation

PString MessageFrame::GetLastSender  )  [inline]
 

Report the name of the node that last sent us a message

BOOL MessageFrame::GetLocalAddress PIPSocket::Address &  addr,
PINDEX &  portNo
[protected]
 

Report the first address in the interface table that is not a loop back entry. Grab also the address the internal socket.

Return values are:: FALSE if it fails, TRUE on success.

PString MessageFrame::GetOurId  )  [inline]
 

Report the id used by this connection

BOOL MessageFrame::GetSendToAddress PIPSocket::Address &  addr,
PINDEX &  port
[protected]
 

Report the address and port we are sending udp data to

void MessageFrame::Initialise  ) 
 

Set up the connection to the remote server,

void MessageFrame::Main  )  [virtual]
 

Grab messages as they arrive from the server, and then process them

virtual BOOL MessageFrame::OkToHangup  )  [inline, protected, virtual]
 

Some MessageFrame instances do not obey the hangup command. This virtual method determines if this command has meaning, and if this instance of the comms should close on receiving a hangup

Reimplemented in Comms.

virtual BOOL MessageFrame::OkToQuitNow  )  [inline, protected, virtual]
 

Some MessageFrame instances do not have the permission to quit now. This virtual method determines if this instance is permitted to exit the program

Reimplemented in Supervisor.

void MessageFrame::ProcessAdviseSendAddress PStringArray &  cmds,
PString &  sender
[protected, virtual]
 

we have received a command advising us of the address & port to send to, so store this information and reply accordingly

void MessageFrame::ProcessAnswer PStringArray &  cmds,
PString &  sender
[protected, virtual]
 

we have received a command advising us how to answer to the incoming call, so we act as required and reply accordingly

Reimplemented in Comms.

void MessageFrame::ProcessCallNode PStringArray &  cmds,
PString &  sender
[protected, virtual]
 

we have received a Call other Node command, so do it and reply accordingly

Reimplemented in Comms.

void MessageFrame::ProcessDebug PStringArray &  cmds,
PString &  sender
[protected, virtual]
 

we have received a command which enables/disables debug information so install as required and reply accordingly

Reimplemented in Comms, and Supervisor.

void MessageFrame::ProcessDuration PStringArray &  cmds,
PString &  sender
[protected, virtual]
 

we have received a command queryig the current call duration , so extract information & answer

Reimplemented in Comms.

void MessageFrame::ProcessHangup PStringArray &  cmds,
PString &  sender
[protected, virtual]
 

we have received a hangup message, so end the call

Reimplemented in Comms, and Supervisor.

void MessageFrame::ProcessHelp PStringArray &  cmds,
PString &  sender
[protected, virtual]
 

we have received a command asking us to list the available commands

void MessageFrame::ProcessIdentify PStringArray &  cmds,
PString &  sender
[protected, virtual]
 

we have received a command requesting that we identify ourselves so do it and reply accordingly

Reimplemented in Comms, and Supervisor.

void MessageFrame::ProcessIncomingMessages PBYTEArray &  data,
PINDEX  size
[protected]
 

Next step in the process incoming messages chain. Dissect the incominb binary block into indiividual messages, then process them.

void MessageFrame::ProcessMessage PString  message,
PString  sender
[protected, virtual]
 

We have a message come in from the server, and it ends up here. Now, handle this message, and give it to the relevant method below

void MessageFrame::ProcessQueryDestAddress PStringArray &  cmds,
PString &  sender
[protected, virtual]
 

we have received a Query on the Destination Address & port, so reply accordingly

void MessageFrame::ProcessQueryLocalAddress PStringArray &  cmds,
PString &  sender
[protected, virtual]
 

we have received a Query Local Address & port command, so reply accordingly

void MessageFrame::ProcessQuitNow PStringArray &  cmds,
PString &  sender
[protected, virtual]
 

we have received a command advising us that we are to end now

Reimplemented in Supervisor.

void MessageFrame::ProcessRequestNewId PStringArray &  cmds,
PString &  sender
[protected, virtual]
 

we have received a command asking us to provide the id of a new communications nodes, that will be controlled only by the remote node

Reimplemented in Supervisor.

void MessageFrame::ProcessSendDtmf PStringArray &  cmds,
PString &  sender
[protected, virtual]
 

we have received a command asking us to send the dtmf chars. An application would not normally override this method.

void MessageFrame::ProcessSetReadFile PStringArray &  cmds,
PString &  sender
[protected, virtual]
 

we have received a command asking us to set the file that we read from and then transmit over ethernet to the remote end.. This file will contain audio messages to be announced to the remote node. An application would not override this method, as this mthod does check that a file name is provided. This method will call SetWriteFile, which the application will override

void MessageFrame::ProcessSetWriteFile PStringArray &  cmds,
PString &  sender
[protected, virtual]
 

We have received a command asking us to set the file that we fill with audio data. This file will (normally) be empty. An application would not override this method, as this mthod does check that a file name is provided. This method will call SetReadFile, which the application will override

void MessageFrame::ProcessStatusQuery PStringArray &  cmds,
PString &  sender
[protected, virtual]
 

we have received a query status command, so do it and reply accordingly

Reimplemented in Comms, and Supervisor.

void MessageFrame::ProcessTransferUdp PStringArray &  cmds,
PString &  sender
[protected, virtual]
 

we have received a command advising us that we are to install udp comms with a particular remote node id. Now, we have to reply accordingly to our master, and establish udp comms with the requisite message server

There are three transferudp commands 1) transferUdp messageid sent by the controller 2) transferUdp messageid addr:port sent in response to 1) 3) transferUdp messageid addr:port done sent in response to 2)

An application would not normally override this method.

Reimplemented in Comms.

BOOL MessageFrame::QueryLocalAddress PIPSocket::Address &  addr,
PINDEX &  portNo
[protected, virtual]
 

The overrirde of this class will define this function, which is used by several of the message processing functions.

Get the address of this socket, which receives data.

BOOL MessageFrame::QuerySendToAddress PIPSocket::Address &  addr,
PINDEX &  portNo
[protected, virtual]
 

The overrirde of this class will define this function, which is used by several of the message processing functions.

Get the address that we are currently sending data to

BOOL MessageFrame::SendDtmf const PString &  dtmfVals  )  [protected, virtual]
 

Send this dtmf string to the remote node. Returns TRUE on success, FALSE on failure.

An application will override this method, to actually do the work of sending.

Reimplemented in Comms.

void MessageFrame::SendThisMessageTo const char *  message,
const char *  subj,
PString  dest
 

A fifth flavour of sending a message

void MessageFrame::SendThisMessageTo PString &  _message,
PString  subj,
PString  dest
 

A fourth flavour of sending a message

void MessageFrame::SendThisMessageTo PString &  _message,
const char *  subj,
PString  dest
 

A third flavour of sending a message

void MessageFrame::SendThisMessageTo PString &  _message,
PString  dest
 

A second flavour of sending a message

void MessageFrame::SendThisMessageTo const char *  _message,
PString  dest
 

Multiple flavours of sending messages, which send a message to the remote node

void MessageFrame::SetCreatedAtNow  )  [inline]
 

Mark This frame as having been created right now, which is a required function for those frames sitting in the pending list

void MessageFrame::SetReadFile PString &  newReadFile  )  [protected, virtual]
 

Actually set the read file. We will extract PCM data from this file. An application will override this method, if it is allowed to take audio from a file (which is the case for the answering machine. The method name (SetReadFile) describes what we do to the specified file - we are reading from this file

BOOL MessageFrame::SetSendToAddress PIPSocket::Address &  addr,
PINDEX &  portNo
[protected, virtual]
 

The overrirde of this class will define this function, which is used by several of the message processing functions.

Set the address that we are currently sending data to

void MessageFrame::SetWriteFile PString &  newWriteFile  )  [protected, virtual]
 

Actually set the file that we write audio to. We will fill this file with PCM data An application will override this method, if it is allowed to write audio to this file (which is the case for the answering machine. The method name (SetWriteFile) describes what we do to the specified file - we are writing to this file

void MessageFrame::SilentlyEndAll  )  [protected, virtual]
 

We have a comms error, so just close everything right now. Send no message to the remote node - just end end end.

Reimplemented in Comms, and Supervisor.

void MessageFrame::Terminate  )  [virtual]
 

Close this thread that is doing the Processing of incoming Messages.

PTimeInterval MessageFrame::TimeSinceCreation  )  [inline]
 

Report the age of this MessageFrame structure. This is used to see if we have sat too long in the pending queue, waiting for allocation to a particular call. Other uses are indeed possible.

BOOL MessageFrame::WaitUntilInitialised  ) 
 

Wait until the messaging subsystem reports it is initialised. Wait no more than 1 second. If not initialised, return FALSE. return TRUE immediately on discovering we are initialised


Member Data Documentation

PUDPSocket MessageFrame::audioSocket [protected]
 

The udp socket we send and receive audio data on

PStringArray MessageFrame::availableCommands [protected]
 

List of available commands

PSyncPoint MessageFrame::goodConnection [protected]
 

This sync point goes on when we connect to the remote server

PString MessageFrame::lastSender [protected]
 

The remote client who last sent us a message

PSyncPoint MessageFrame::threadRunning [protected]
 

A SyncPoint that goes on when the thread actually begins

PSyncPoint MessageFrame::writeSourceId [protected]
 

A sync point that goes when this class has written the source Id to the remote server


The documentation for this class was generated from the following files:
Generated on Sun Jan 29 19:49:34 2006 for Sofa Switch Multipoint Conf. Utility by  doxygen 1.4.4