IAX2Processor Class Reference

#include <processor.h>

Inheritance diagram for IAX2Processor:

IAX2CallProcessor IAX2RegProcessor IAX2SpecialProcessor List of all members.

Public Member Functions

 IAX2Processor (IAX2EndPoint &ep)
virtual ~IAX2Processor ()
IAX2SequenceNumbersGetSequenceInfo ()
IAX2EncryptionGetEncryptionInfo ()
void IncomingEthernetFrame (IAX2Frame *frame)
virtual void PrintOn (ostream &strm) const =0
IAX2EndPointGetEndPoint ()
void SetCallToken (const PString &newToken)
PString GetCallToken ()
IAX2RemoteGetRemoteInfo ()
const PTimeInterval & GetCallStartTick ()
void Main ()
PBoolean IsStatusQueryEthernetFrame (IAX2Frame *frame)
void SetSpecialPackets (PBoolean newValue)
void Terminate ()
void Activate ()
virtual PBoolean IncomingMessageOutOfOrder (IAX2FullFrame *ff)=0
void ReportLists (PString &answer)

Protected Types

enum  DefinedNoResponseTimePeriod { NoResponseTimePeriod = 5000 }

Protected Member Functions

void StartNoResponseTimer (PINDEX msToWait=60000)
void StopNoResponseTimer ()
void CleanPendingLists ()
virtual void OnNoResponseTimeout ()=0
PBoolean IsHandlingSpecialPackets ()
virtual void ProcessLists ()=0
virtual void ProcessFullFrame (IAX2FullFrame &fullFrame)=0
virtual void ProcessIaxCmdLagRq (IAX2FullFrameProtocol *src)
virtual void ProcessIaxCmdLagRp (IAX2FullFrameProtocol *src)
virtual void ProcessIaxCmdVnak (IAX2FullFrameProtocol *src)
virtual void ProcessIaxCmdPing (IAX2FullFrameProtocol *src)
virtual void ProcessIaxCmdPong (IAX2FullFrameProtocol *src)
PBoolean ProcessOneIncomingEthernetFrame ()
void IncControlFramesSent ()
void IncControlFramesRcvd ()
virtual void ProcessNetworkFrame (IAX2MiniFrame *src)=0
virtual PBoolean ProcessNetworkFrame (IAX2FullFrameProtocol *src)
void TransmitFrameToRemoteEndpoint (IAX2Frame *src)
void TransmitFrameToRemoteEndpoint (IAX2FullFrame *src, IAX2WaitingForAck::ResponseToAck response)
void TransmitFrameNow (IAX2Frame *src)
void TransmitFrameToRemoteEndpoint (IAX2FullFrameProtocol *src)
PBoolean Authenticate (IAX2FullFrameProtocol *reply, PString &password)
void SendAckFrame (IAX2FullFrame *inReplyTo)
void SendVnakFrame (IAX2FullFrame *inReplyTo)
void SendUnsupportedFrame (IAX2FullFrame *inReplyTo)

Protected Attributes

IAX2EndPointendpoint
PTimeInterval callStartTick
IAX2Remote remote
PTimer noResponseTimer
IAX2WaitingForAck nextTask
PSyncPoint activate
PBoolean endThread
IAX2Encryption encryption
IAX2SequenceNumbers sequence
IAX2ActiveFrameList frameList
SafeString callToken
PBoolean specialPackets
PAtomicInteger controlFramesSent
PAtomicInteger controlFramesRcvd
IAX2IeData ieData
DWORD currentSoundTimeStamp

Detailed Description

This class is an abstract base class for iax2 processors. This class is responsible for handling all the iax2 protocol command messages.

It provides the base structure for two different processor classes, a)registration type commands and b)commands specific to one call.

The unique source and destination call number (which are in the IAX2 frames) are used to determine which processor will handle which incoming packet.

Each processor runs in its own thread so as to process incoming packets in a timely fashion.


Member Enumeration Documentation

enum IAX2Processor::DefinedNoResponseTimePeriod [protected]

A defined value which is the maximum time we will wait for an answer to our packets

Enumerator:
NoResponseTimePeriod  Time (in milliseconds) we will wait


Constructor & Destructor Documentation

IAX2Processor::IAX2Processor ( IAX2EndPoint ep  ) 

Construct this class

virtual IAX2Processor::~IAX2Processor (  )  [virtual]

Destructor


Member Function Documentation

IAX2SequenceNumbers& IAX2Processor::GetSequenceInfo (  )  [inline]

Get the sequence number info (inSeqNo and outSeqNo)

IAX2Encryption& IAX2Processor::GetEncryptionInfo (  )  [inline]

Get the IAX2 encryption info

Reimplemented in IAX2CallProcessor.

void IAX2Processor::IncomingEthernetFrame ( IAX2Frame frame  ) 

Handle a received IAX2 frame. This may be a mini frame or full frame

virtual void IAX2Processor::PrintOn ( ostream &  strm  )  const [pure virtual]

A method to cause some of the values in this class to be formatted into a printable stream

Implemented in IAX2CallProcessor, IAX2RegProcessor, and IAX2SpecialProcessor.

IAX2EndPoint& IAX2Processor::GetEndPoint (  )  [inline]

Access the endpoint class that launched this processor

void IAX2Processor::SetCallToken ( const PString &  newToken  ) 

Give the call token a value. The call token is the ipaddress of the remote node concatented with the remote nodes src number. This is guaranteed to be unique. Sadly, if this connection is setting up the call, the callToken is not known until receipt of the first packet from the remote node.

However, if this connection is created in response to a call, this connection can determine the callToken on examination of that incoming first packet

PString IAX2Processor::GetCallToken (  ) 

Return the string that identifies this IAX2Connection instance

IAX2Remote& IAX2Processor::GetRemoteInfo (  )  [inline]

Get information on IAX2Remote class (remote node address & port + source & dest call number.)

const PTimeInterval& IAX2Processor::GetCallStartTick (  )  [inline]

Get the call start tick

void IAX2Processor::Main (  ) 

The worker method of this thread. In here, all incoming frames (for this call) are handled.

PBoolean IAX2Processor::IsStatusQueryEthernetFrame ( IAX2Frame frame  ) 

Test to see if it is a status query type IAX2 frame (eg lagrq) and handle it. If the frame is a status query, and it is handled, return PTrue

void IAX2Processor::SetSpecialPackets ( PBoolean  newValue  )  [inline]

Set the flag to indicate if we are handling specialPackets (those packets which are not sent to any particular call)

void IAX2Processor::Terminate (  ) 

Cause this thread to die immediately

void IAX2Processor::Activate (  ) 

Cause this thread to come to life, and process events that are pending at IAX2Connection. This method does not start this thread. This method causes this thread to be joggled back into life, after waiting on a PSyncPoint.

virtual PBoolean IAX2Processor::IncomingMessageOutOfOrder ( IAX2FullFrame ff  )  [pure virtual]

Test the sequence number of the incoming frame. This is only valid for handling a call. If the message is outof order, the supplied fullframe is deleted.

Returns:
true if the frame is out of order, which deletes the supplied frame

false, and does not destroy the supplied frame

Implemented in IAX2CallProcessor, IAX2RegProcessor, and IAX2SpecialProcessor.

void IAX2Processor::ReportLists ( PString &  answer  ) 

Report on the contents of the lists waiting for processing

void IAX2Processor::StartNoResponseTimer ( PINDEX  msToWait = 60000  )  [protected]

Set the acceptable time (in milliseconds) to wait before giving up on this call

void IAX2Processor::StopNoResponseTimer (  )  [inline, protected]

Stop the timer - we have received a reply

void IAX2Processor::CleanPendingLists (  )  [inline, protected]

Activate this thread to process all the lists of queued frames

virtual void IAX2Processor::OnNoResponseTimeout (  )  [protected, pure virtual]

A threaded pure threaded callback for the sub classes of processor

Implemented in IAX2CallProcessor, IAX2RegProcessor, and IAX2SpecialProcessor.

PBoolean IAX2Processor::IsHandlingSpecialPackets (  )  [inline, protected]

return the flag to indicate if we are handling special packets, which are those packets sent to the endpoint (and not related to any particular call).

virtual void IAX2Processor::ProcessLists (  )  [protected, pure virtual]

Go through the three lists for incoming data (ethernet/sound/UI commands.

Implemented in IAX2CallProcessor, IAX2RegProcessor, and IAX2SpecialProcessor.

virtual void IAX2Processor::ProcessFullFrame ( IAX2FullFrame fullFrame  )  [protected, pure virtual]

A pure virtual method that is implemented by sub classes to process an incoming full frame

Implemented in IAX2CallProcessor, IAX2RegProcessor, and IAX2SpecialProcessor.

virtual void IAX2Processor::ProcessIaxCmdLagRq ( IAX2FullFrameProtocol src  )  [protected, virtual]

Process a FullFrameProtocol class, where the sub Class value is Initial message, used to measure the round trip time

virtual void IAX2Processor::ProcessIaxCmdLagRp ( IAX2FullFrameProtocol src  )  [protected, virtual]

Process a FullFrameProtocol class, where the sub Class value is Reply to cmdLagrq, which tells us the round trip time

virtual void IAX2Processor::ProcessIaxCmdVnak ( IAX2FullFrameProtocol src  )  [protected, virtual]

Process a FullFrameProtocol class, where the sub Class value is If we receive voice before valid first voice frame, send this

virtual void IAX2Processor::ProcessIaxCmdPing ( IAX2FullFrameProtocol src  )  [protected, virtual]

Process a FullFrameProtocol class, where the sub Class value is Ping request,

virtual void IAX2Processor::ProcessIaxCmdPong ( IAX2FullFrameProtocol src  )  [protected, virtual]

Process a FullFrameProtocol class, where the sub Class value is reply to a Ping

PBoolean IAX2Processor::ProcessOneIncomingEthernetFrame (  )  [protected]

remove one frame on the incoming ethernet frame list. If there may be more to process, return PTrue. If there are no more to process, return PFalse.

void IAX2Processor::IncControlFramesSent (  )  [inline, protected]

Increment the count of full frames sent

void IAX2Processor::IncControlFramesRcvd (  )  [inline, protected]

Increment the count of full frames received

virtual void IAX2Processor::ProcessNetworkFrame ( IAX2MiniFrame src  )  [protected, pure virtual]

A pure virtual method that is implmented by to process an incoming network frame of type IAX2MiniFrame

Implemented in IAX2CallProcessor, IAX2RegProcessor, and IAX2SpecialProcessor.

virtual PBoolean IAX2Processor::ProcessNetworkFrame ( IAX2FullFrameProtocol src  )  [protected, virtual]

Reimplemented in IAX2CallProcessor, IAX2RegProcessor, and IAX2SpecialProcessor.

void IAX2Processor::TransmitFrameToRemoteEndpoint ( IAX2Frame src  )  [protected]

Transmit IAX2Frame to remote endpoint, and then increment send count. This calls a method in the Transmitter class. .It is only called by the this IAX2CallProcessor class.

void IAX2Processor::TransmitFrameToRemoteEndpoint ( IAX2FullFrame src,
IAX2WaitingForAck::ResponseToAck  response 
) [protected]

Transmit IAX2Frame to remote endpoint, and then increment send count. This calls a method in the Transmitter class. .It is only called by the this IAX2CallProcessor class. The second parameter determines what to do when an ack frame is received for the sent frame.

Parameters:
response  action to do on getting Ack

void IAX2Processor::TransmitFrameNow ( IAX2Frame src  )  [protected]

Transmit IAX2Frame to remote endpoint,. This calls a method in the Transmitter class. .It is only called by the this Connection class. There is no stats change when this method is called.

void IAX2Processor::TransmitFrameToRemoteEndpoint ( IAX2FullFrameProtocol src  )  [protected]

FullFrameProtocol class needs to have the IE's correctly appended prior to transmission

PBoolean IAX2Processor::Authenticate ( IAX2FullFrameProtocol reply,
PString &  password 
) [protected]

Do the md5/rsa authentication. Return True if successful. Has the side effect of appending the appropriate Ie class to the "reply" parameter.

Parameters:
reply  this frame contains the result of authenticating the internal data
password  the password to authenticate with

void IAX2Processor::SendAckFrame ( IAX2FullFrame inReplyTo  )  [protected]

Transmit an IAX2 protocol frame with subclass type ack immediately to remote endpoint

void IAX2Processor::SendVnakFrame ( IAX2FullFrame inReplyTo  )  [protected]

Transmit an IAX2 protocol frame with subclass type VNAK immediately to remote endpoint. This message indicates we have received some full frames out of order, and want the interim ones retransmitted.

void IAX2Processor::SendUnsupportedFrame ( IAX2FullFrame inReplyTo  )  [protected]

Transmit an unsupported frame to the remote endpoint


Member Data Documentation

IAX2EndPoint& IAX2Processor::endpoint [protected]

Reference to the global variable of this program

PTimeInterval IAX2Processor::callStartTick [protected]

Time this connection class was created, which is the call start time. It is reported in Ticks, which is required for millisecond accuracy under windows.

IAX2Remote IAX2Processor::remote [protected]

Details on the address of the remote endpoint, and source/dest call numbers

PTimer IAX2Processor::noResponseTimer [protected]

The timer which is used to test for no reply to our outgoing call setup messages

IAX2WaitingForAck IAX2Processor::nextTask [protected]

Action to perform on receiving an ACK packet (which is required during call setup phase for receiver

PSyncPoint IAX2Processor::activate [protected]

Flag which is used to activate this thread, so all pending tasks/packets are processed

PBoolean IAX2Processor::endThread [protected]

Flag to indicate, end this thread

IAX2Encryption IAX2Processor::encryption [protected]

Status of encryption for this processor - by default, no encryption

IAX2SequenceNumbers IAX2Processor::sequence [protected]

Details on the in/out sequence numbers

IAX2ActiveFrameList IAX2Processor::frameList [protected]

Array of frames read from the Receiver for this call

SafeString IAX2Processor::callToken [protected]

The call token, which uniquely identifies this IAX2CallProcessor, and the associated call

PBoolean IAX2Processor::specialPackets [protected]

Flag to indicate we are handing the special packets, which are sent to the endpoint,and not related to any particular call.

PAtomicInteger IAX2Processor::controlFramesSent [protected]

Count of the number of control frames sent

PAtomicInteger IAX2Processor::controlFramesRcvd [protected]

Count of the number of control frames received

IAX2IeData IAX2Processor::ieData [protected]

Hold each of the possible values from an Ie class

DWORD IAX2Processor::currentSoundTimeStamp [protected]

The timestamp we will put on the next mini frame out of here

This timestamp is monotonically increasing, and bears "some" relation to actuality. We generate the timestamp uniformly - this instance of an iax2 call could be driven from a slightly non uniform packet source.


The documentation for this class was generated from the following file:
Generated on Mon Sep 15 11:49:37 2008 for OPAL by  doxygen 1.5.1