OPAL  Version 3.14.3
IAX2Processor Class Referenceabstract

#include <processor.h>

Inheritance diagram for IAX2Processor:
Collaboration diagram for IAX2Processor:

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

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

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.

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
replythis frame contains the result of authenticating the internal data
passwordthe password to authenticate with
void IAX2Processor::CleanPendingLists ( )
inlineprotected

Activate this thread to process all the lists of queued frames

References activate.

const PTimeInterval& IAX2Processor::GetCallStartTick ( )
inline

Get the call start tick

References callStartTick.

Referenced by IAX2Connection::GetCallStartTick().

PString IAX2Processor::GetCallToken ( )

Return the string that identifies this IAX2Connection instance

Referenced by IAX2Connection::GetCallToken().

IAX2Encryption& IAX2Processor::GetEncryptionInfo ( )
inline

Get the IAX2 encryption info

References encryption.

IAX2EndPoint& IAX2Processor::GetEndPoint ( )
inline

Access the endpoint class that launched this processor

References endpoint.

IAX2Remote& IAX2Processor::GetRemoteInfo ( )
inline

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

References remote.

Referenced by IAX2Connection::GetRemoteInfo().

IAX2SequenceNumbers& IAX2Processor::GetSequenceInfo ( )
inline

Get the sequence number info (inSeqNo and outSeqNo)

References sequence.

Referenced by IAX2Connection::GetSequenceInfo().

void IAX2Processor::IncControlFramesRcvd ( )
inlineprotected

Increment the count of full frames received

References controlFramesRcvd.

void IAX2Processor::IncControlFramesSent ( )
inlineprotected

Increment the count of full frames sent

References controlFramesSent.

void IAX2Processor::IncomingEthernetFrame ( IAX2Frame frame)

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

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.

PBoolean IAX2Processor::IsHandlingSpecialPackets ( )
inlineprotected

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).

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 true

void IAX2Processor::Main ( )

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

virtual void IAX2Processor::OnNoResponseTimeout ( )
protectedpure virtual

A threaded pure threaded callback for the sub classes of processor

Implemented in IAX2CallProcessor, IAX2RegProcessor, and IAX2SpecialProcessor.

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 IAX2RegProcessor, IAX2CallProcessor, and IAX2SpecialProcessor.

virtual void IAX2Processor::ProcessFullFrame ( IAX2FullFrame fullFrame)
protectedpure 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::ProcessIaxCmdLagRp ( IAX2FullFrameProtocol src)
protectedvirtual

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

virtual void IAX2Processor::ProcessIaxCmdLagRq ( IAX2FullFrameProtocol src)
protectedvirtual

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

virtual void IAX2Processor::ProcessIaxCmdPing ( IAX2FullFrameProtocol src)
protectedvirtual

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

virtual void IAX2Processor::ProcessIaxCmdPong ( IAX2FullFrameProtocol src)
protectedvirtual

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

virtual void IAX2Processor::ProcessIaxCmdVnak ( IAX2FullFrameProtocol src)
protectedvirtual

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

virtual void IAX2Processor::ProcessLists ( )
protectedpure virtual

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

Implemented in IAX2CallProcessor, IAX2RegProcessor, and IAX2SpecialProcessor.

virtual void IAX2Processor::ProcessNetworkFrame ( IAX2MiniFrame src)
protectedpure 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)
protectedvirtual
PBoolean IAX2Processor::ProcessOneIncomingEthernetFrame ( )
protected

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

void IAX2Processor::ReportLists ( PString &  answer)

Report on the contents of the lists waiting for processing

void IAX2Processor::SendAckFrame ( IAX2FullFrame inReplyTo)
protected

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

void IAX2Processor::SendUnsupportedFrame ( IAX2FullFrame inReplyTo)
protected

Transmit an unsupported frame to the 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::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

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)

References specialPackets.

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

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

void IAX2Processor::StopNoResponseTimer ( )
inlineprotected

Stop the timer - we have received a reply

References noResponseTimer.

void IAX2Processor::Terminate ( )

Cause this thread to die immediately

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 ( 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
responseaction to do on getting Ack
void IAX2Processor::TransmitFrameToRemoteEndpoint ( IAX2FullFrameProtocol src)
protected

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

Field Documentation

PSyncPoint IAX2Processor::activate
protected

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

Referenced by CleanPendingLists().

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.

Referenced by GetCallStartTick().

SafeString IAX2Processor::callToken
protected

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

PAtomicInteger IAX2Processor::controlFramesRcvd
protected

Count of the number of control frames received

Referenced by IncControlFramesRcvd().

PAtomicInteger IAX2Processor::controlFramesSent
protected

Count of the number of control frames sent

Referenced by IncControlFramesSent().

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.

IAX2Encryption IAX2Processor::encryption
protected

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

Referenced by IAX2CallProcessor::GetEncryptionInfo(), and GetEncryptionInfo().

IAX2EndPoint& IAX2Processor::endpoint
protected

Reference to the global variable of this program

Referenced by GetEndPoint().

PBoolean IAX2Processor::endThread
protected

Flag to indicate, end this thread

IAX2ActiveFrameList IAX2Processor::frameList
protected

Array of frames read from the Receiver for this call

IAX2IeData IAX2Processor::ieData
protected

Hold each of the possible values from an Ie class

IAX2WaitingForAck IAX2Processor::nextTask
protected

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

PTimer IAX2Processor::noResponseTimer
protected

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

Referenced by StopNoResponseTimer().

IAX2Remote IAX2Processor::remote
protected

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

Referenced by GetRemoteInfo(), IAX2CallProcessor::Matches(), and IAX2CallProcessor::MatchingLocalCallNumber().

IAX2SequenceNumbers IAX2Processor::sequence
protected

Details on the in/out sequence numbers

Referenced by GetSequenceInfo().

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.

Referenced by SetSpecialPackets().


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