#include <frame.h>
Inheritance diagram for IAX2Frame:
Public Types | |
enum | IAX2FrameType { undefType = 0, dtmfType = 1, voiceType = 2, videoType = 3, controlType = 4, nullType = 5, iax2ProtocolType = 6, textType = 7, imageType = 8, htmlType = 9, cngType = 10, numFrameTypes = 11 } |
Public Member Functions | |
IAX2Frame (IAX2EndPoint &_endpoint) | |
virtual | ~IAX2Frame () |
PBoolean | ReadNetworkPacket (PUDPSocket &sock) |
virtual PBoolean | ProcessNetworkPacket () |
virtual PBoolean | IsFullFrame () |
PBoolean | IsVideo () const |
PBoolean | IsAudio () const |
virtual BYTE * | GetMediaDataPointer () |
virtual PINDEX | GetMediaDataSize () |
PINDEX | DataSize () |
IAX2Remote & | GetRemoteInfo () |
const BYTE * | GetDataPointer () |
IAX2Frame * | BuildAppropriateFrameType (IAX2Encryption &encryptionInfo) |
IAX2Frame * | BuildAppropriateFrameType () |
PINDEX | GetUnReadBytes () |
virtual PBoolean | WriteHeader () |
virtual PBoolean | TransmitPacket (PUDPSocket &sock) |
virtual void | PrintOn (ostream &strm) const |
virtual void | BuildTimeStamp (const PTimeInterval &callStartTick) |
IAX2EndPoint & | GetEndpoint () |
PString | IdString () const |
DWORD | GetTimeStamp () |
virtual PBoolean | CallMustBeActive () |
IAX2FrameType | GetFrameType () |
virtual void | InitialiseHeader (IAX2Processor *) |
PBoolean | CanRetransmitFrame () const |
PString | GetConnectionToken () const |
void | SetConnectionToken (PString newToken) |
void | BuildConnectionTokenId () |
PBoolean | EncryptContents (IAX2Encryption &encData) |
virtual PINDEX | GetEncryptionOffset () |
Static Public Member Functions | |
static DWORD | CalcTimeStamp (const PTimeInterval &callStartTick) |
Protected Member Functions | |
PBoolean | DecryptContents (IAX2Encryption &encryption) |
PBoolean | Read1Byte (BYTE &res) |
PBoolean | Read2Bytes (PINDEX &res) |
PBoolean | Read2Bytes (WORD &res) |
PBoolean | Read4Bytes (DWORD &res) |
void | Write1Byte (BYTE newVal) |
void | Write1Byte (PINDEX newVal) |
void | Write2Bytes (PINDEX newVal) |
void | Write4Bytes (unsigned int newVal) |
void | ZeroAllValues () |
Protected Attributes | |
IAX2Remote | remote |
IAX2FrameType | frameType |
IAX2EndPoint & | endpoint |
PBYTEArray | data |
PBoolean | isFullFrame |
PBoolean | isVideo |
PBoolean | isAudio |
PINDEX | currentReadIndex |
PINDEX | currentWriteIndex |
DWORD | timeStamp |
PBoolean | canRetransmitFrame |
PString | connectionToken |
DWORD | presetTimeStamp |
Specify the type of this frame.
IAX2Frame::IAX2Frame | ( | IAX2EndPoint & | _endpoint | ) |
construction
virtual IAX2Frame::~IAX2Frame | ( | ) | [virtual] |
Destructor - which is empty
PBoolean IAX2Frame::ReadNetworkPacket | ( | PUDPSocket & | sock | ) |
Wait on the designated socket for an incoming UDP packet. This method is only called by the receiver. This method does NO interpretation
virtual PBoolean IAX2Frame::ProcessNetworkPacket | ( | ) | [virtual] |
Interpret the data from the read process
Reimplemented in IAX2MiniFrame, and IAX2FullFrame.
virtual PBoolean IAX2Frame::IsFullFrame | ( | ) | [virtual] |
True if this is a full frame
Reimplemented in IAX2FullFrame.
PBoolean IAX2Frame::IsVideo | ( | ) | const |
True if it is a video frame
PBoolean IAX2Frame::IsAudio | ( | ) | const |
True if is is an audio frame
virtual BYTE* IAX2Frame::GetMediaDataPointer | ( | ) | [inline, virtual] |
Pointer to the beginning of the media (after the header) in this packet. The low level frame has no idea on headers, so just return pointer to beginning of data.
Reimplemented in IAX2MiniFrame, and IAX2FullFrame.
virtual PINDEX IAX2Frame::GetMediaDataSize | ( | ) | [inline, virtual] |
Number of bytes in the media section of this packet. The low level frame has no idea on headers, so just return the number of bytes in the packet.
Reimplemented in IAX2MiniFrame, and IAX2FullFrame.
PINDEX IAX2Frame::DataSize | ( | ) | [inline] |
Reporting function, to describe the number of bytes in this packet
IAX2Remote& IAX2Frame::GetRemoteInfo | ( | ) | [inline] |
Get the value of the Remote structure
const BYTE* IAX2Frame::GetDataPointer | ( | ) | [inline] |
Obtain a pointer to the current position in the incoming data array
IAX2Frame* IAX2Frame::BuildAppropriateFrameType | ( | IAX2Encryption & | encryptionInfo | ) |
Read the input frame, and create the correct IAX2MiniFrame, FullFrame, and set frame type variables. If a password is supplied, decrypt the frame with this password
This method will never delete the input frame. If the output is null, it failed to derive a result.
IAX2Frame* IAX2Frame::BuildAppropriateFrameType | ( | ) |
Same as the preceeding function, except that encryption is off
PINDEX IAX2Frame::GetUnReadBytes | ( | ) | [inline] |
How many bytes are unread in the incoming data array
virtual PBoolean IAX2Frame::WriteHeader | ( | ) | [inline, virtual] |
Cause the header bytes for this particular frame type to be written to the internal array
Reimplemented in IAX2MiniFrame, and IAX2FullFrame.
virtual PBoolean IAX2Frame::TransmitPacket | ( | PUDPSocket & | sock | ) | [virtual] |
Send this packet on the specified socket to the remote host. This method is only called by the transmiter.
Reimplemented in IAX2FullFrame.
virtual void IAX2Frame::PrintOn | ( | ostream & | strm | ) | const [virtual] |
Pretty print this frame data to the designated stream
Reimplemented in IAX2MiniFrame, IAX2FullFrame, and IAX2FullFrameProtocol.
static DWORD IAX2Frame::CalcTimeStamp | ( | const PTimeInterval & | callStartTick | ) | [static] |
Calculate the timestamp value, given the call start tick
virtual void IAX2Frame::BuildTimeStamp | ( | const PTimeInterval & | callStartTick | ) | [virtual] |
Write the timestamp value, in preparation for writing the header. When sending a packet, the timestamp is written at packet construction.
IAX2EndPoint& IAX2Frame::GetEndpoint | ( | ) | [inline] |
Return a reference to the endpoint structure
PString IAX2Frame::IdString | ( | ) | const |
Globally unique ID string for this frame, to help track frames. The value returned is a pretty printed address of this frame instance.
DWORD IAX2Frame::GetTimeStamp | ( | ) | [inline] |
Get the timestamp as used by this class
virtual PBoolean IAX2Frame::CallMustBeActive | ( | ) | [inline, virtual] |
Report flag stating that this call must be active when this frame is transmitted
Reimplemented in IAX2FullFrame.
IAX2FrameType IAX2Frame::GetFrameType | ( | ) | [inline] |
Access the current value of the variable controlling frame type, which is used when reading data from the network socket.
virtual void IAX2Frame::InitialiseHeader | ( | IAX2Processor * | ) | [inline, virtual] |
Method supplied here to provide basis for descendant classes.
Whenever a frame is transmitted, this method will be called.
Reimplemented in IAX2MiniFrame, and IAX2FullFrame.
PBoolean IAX2Frame::CanRetransmitFrame | ( | ) | const [inline] |
Return true if this frame should be retransmitted. Acks are never retransmitted. cmdNew are retransmitted.
PString IAX2Frame::GetConnectionToken | ( | ) | const [inline] |
Get the string which uniquely identifies the IAXConnection that sent this frame
void IAX2Frame::SetConnectionToken | ( | PString | newToken | ) | [inline] |
Set the string which uniquely identifies the IAXConnection that is responsible for this frame
void IAX2Frame::BuildConnectionTokenId | ( | ) |
Create the connection token id, which uniquely identifies the connection to process this call
PBoolean IAX2Frame::EncryptContents | ( | IAX2Encryption & | encData | ) |
Write the data in the variables to this frame's data array. If encryption is on, the data will be encrypted
virtual PINDEX IAX2Frame::GetEncryptionOffset | ( | ) | [virtual] |
Get the offset to the beginning of the encrypted region
Reimplemented in IAX2MiniFrame, and IAX2FullFrame.
PBoolean IAX2Frame::DecryptContents | ( | IAX2Encryption & | encryption | ) | [protected] |
Use the supplied encryptionKey, and data in storage, to decrypt this frame.
Return False if the decryption fails, PTrue if the decryption works.
PBoolean IAX2Frame::Read1Byte | ( | BYTE & | res | ) | [protected] |
Read 1 byte from the internal area, (Internal area is filled when reading the packet in). Big Endian.
PBoolean IAX2Frame::Read2Bytes | ( | PINDEX & | res | ) | [protected] |
Read 2 bytes from the internal area, (Internal area is filled when reading the packet in) Big Endian.
PBoolean IAX2Frame::Read2Bytes | ( | WORD & | res | ) | [protected] |
Read 2 bytes from the internal area, (Internal area is filled when reading the packet in) Big Endian.
PBoolean IAX2Frame::Read4Bytes | ( | DWORD & | res | ) | [protected] |
Read 4 bytes from the internal area, (Internal area is filled when reading the packet in) Big Endian.
void IAX2Frame::Write1Byte | ( | BYTE | newVal | ) | [protected] |
Write 1 byte to the internal area, as part of writing the header info
void IAX2Frame::Write1Byte | ( | PINDEX | newVal | ) | [protected] |
Write 1 byte to the internal area, as part of writing the header info. Send only the lowest 8 bits of source
void IAX2Frame::Write2Bytes | ( | PINDEX | newVal | ) | [protected] |
Write 2 bytes to the internal area, as part of writing the header info Big Endian.
void IAX2Frame::Write4Bytes | ( | unsigned int | newVal | ) | [protected] |
Write 4 bytes to the internal area, as part of writing the header info Big Endian.
void IAX2Frame::ZeroAllValues | ( | ) | [protected] |
Initialise all internal storage in this structrue
Reimplemented in IAX2MiniFrame, and IAX2FullFrame.
IAX2Remote IAX2Frame::remote [protected] |
Specification of the location (address, call number etc) of the far endpoint
IAX2FrameType IAX2Frame::frameType [protected] |
Variable specifying the IAX type of frame that this is. Used only in reading from the network
IAX2EndPoint& IAX2Frame::endpoint [protected] |
Reference to the global variable of this program
PBYTEArray IAX2Frame::data [protected] |
Internal storage array, ready for sending to remote node, or ready for receiving from remote node
PBoolean IAX2Frame::isFullFrame [protected] |
Flag to indicate if this is a MiniFrame or FullFrame
PBoolean IAX2Frame::isVideo [protected] |
Flag to indicate if this is a MiniFrame with video
PBoolean IAX2Frame::isAudio [protected] |
Flag to indicate if this is a MiniFrame with audio
PINDEX IAX2Frame::currentReadIndex [protected] |
Index of where we are reading from the internal data area
PINDEX IAX2Frame::currentWriteIndex [protected] |
Index of where we are writing to the internal data area
DWORD IAX2Frame::timeStamp [protected] |
unsigned 32 bit representaiton of the time of this day
PBoolean IAX2Frame::canRetransmitFrame [protected] |
Indicate if this frame can be retransmitted
PString IAX2Frame::connectionToken [protected] |
Connection Token, which uniquely identifies the IAXConnection that sent this frame. The token will (except for the first setup packet) uniquely identify the IAXConnection that is to receive this incoming frame.
DWORD IAX2Frame::presetTimeStamp [protected] |
The time stamp to use, for those cases when the user demands a particular timestamp on construction.