frame.h

Go to the documentation of this file.
00001 /*
00002  *
00003  * Inter Asterisk Exchange 2
00004  * 
00005  * Open Phone Abstraction Library (OPAL)
00006  *
00007  * Define the classes that carry information over the ethernet.
00008  *
00009  * Copyright (c) 2005 Indranet Technologies Ltd.
00010  *
00011  * The contents of this file are subject to the Mozilla Public License
00012  * Version 1.0 (the "License"); you may not use this file except in
00013  * compliance with the License. You may obtain a copy of the License at
00014  * http://www.mozilla.org/MPL/
00015  *
00016  * Software distributed under the License is distributed on an "AS IS"
00017  * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
00018  * the License for the specific language governing rights and limitations
00019  * under the License.
00020  *
00021  * The Original Code is Open Phone Abstraction Library.
00022  *
00023  * The Initial Developer of the Original Code is Indranet Technologies Ltd.
00024  *
00025  * The author of this code is Derek J Smithies
00026  *
00027  *  $Log: frame.h,v $
00028  *  Revision 1.12  2007/09/05 04:04:35  csoutheren
00029  *  Fixed spelling mistakes
00030  *
00031  *  Revision 1.11  2007/04/19 06:17:21  csoutheren
00032  *  Fixes for precompiled headers with gcc
00033  *
00034  *  Revision 1.10  2007/01/23 02:08:25  dereksmithies
00035  *  Handle Vnak frames correctly. handle iseqno and oseqno correctly.
00036  *
00037  *  Revision 1.9  2007/01/17 03:48:13  dereksmithies
00038  *  Tidy up comments, remove leaks, improve reporting of packet types.
00039  *
00040  *  Revision 1.8  2007/01/16 03:17:42  dereksmithies
00041  *  tidyup of comments. Remove unused variables.
00042  *  Guarantee that media frames are sent with a monotonically increasing timestamp
00043  *
00044  *  Revision 1.7  2006/08/09 03:46:39  dereksmithies
00045  *  Add ability to register to a remote Asterisk box. The iaxProcessor class is split
00046  *  into a callProcessor and a regProcessor class.
00047  *  Big thanks to Stephen Cook, (sitiveni@gmail.com) for this work.
00048  *
00049  *  Revision 1.6  2005/08/26 03:07:38  dereksmithies
00050  *  Change naming convention, so all class names contain the string "IAX2"
00051  *
00052  *  Revision 1.5  2005/08/25 03:26:06  dereksmithies
00053  *  Add patch from Adrian Sietsma to correctly set the packet timestamps under windows.
00054  *  Many thanks.
00055  *
00056  *  Revision 1.4  2005/08/24 04:56:25  dereksmithies
00057  *  Add code from Adrian Sietsma to send FullFrameTexts and FullFrameDtmfs to
00058  *  the remote end.  Many Thanks.
00059  *
00060  *  Revision 1.3  2005/08/24 01:38:38  dereksmithies
00061  *  Add encryption, iax2 style. Numerous tidy ups. Use the label iax2, not iax
00062  *
00063  *  Revision 1.2  2005/08/04 08:14:17  rjongbloed
00064  *  Fixed Windows build under DevStudio 2003 of IAX2 code
00065  *
00066  *  Revision 1.1  2005/07/30 07:01:32  csoutheren
00067  *  Added implementation of IAX2 (Inter Asterisk Exchange 2) protocol
00068  *  Thanks to Derek Smithies of Indranet Technologies Ltd. for
00069  *  writing and contributing this code
00070  *
00071  *
00072  *
00073  *
00074  */
00075 
00076 #ifndef FRAME_H
00077 #define FRAME_H
00078 
00079 #ifndef _PTLIB_H
00080 #include <ptlib.h>
00081 #endif
00082 
00083 #include <iax2/ies.h>
00084 #include <iax2/remote.h>
00085 
00086 #include <ptlib/sockets.h>
00087 
00088 #ifdef P_USE_PRAGMA
00089 #pragma interface
00090 #endif
00091 
00092 class IAX2Frame;
00093 class IAX2FrameList;
00094 class IAX2FullFrame;
00095 class IAX2FullFrameCng;
00096 class IAX2FullFrameDtmf;
00097 class IAX2FullFrameHtml;
00098 class IAX2FullFrameImage;
00099 class IAX2FullFrameNull;
00100 class IAX2FullFrameProtocol;
00101 class IAX2FullFrameSessionControl;
00102 class IAX2FullFrameText;
00103 class IAX2FullFrameVideo;
00104 class IAX2FullFrameVoice;
00105 class IAX2EndPoint;
00106 class IAX2Processor;
00107 class IAX2CallProcessor;
00108 class IAX2IeList;
00109 class IAX2MiniFrame;
00110 class IAX2Transmitter;
00111 
00112 
00113 
00115 class IAX2Frame :  public PObject
00116 {
00117   PCLASSINFO(IAX2Frame, PObject);
00118  public:
00120   IAX2Frame(IAX2EndPoint &_endpoint);
00121   
00123   virtual ~IAX2Frame();
00124   
00127   BOOL ReadNetworkPacket(PUDPSocket &sock);
00128   
00130   virtual BOOL ProcessNetworkPacket();
00131   
00133   virtual BOOL IsFullFrame();
00134   
00136   BOOL IsVideo() const;
00137   
00139   BOOL IsAudio() const;
00140 
00144   virtual BYTE *GetMediaDataPointer() { return data.GetPointer(); }
00145   
00149   virtual PINDEX GetMediaDataSize() { return DataSize();}
00150   
00152   PINDEX DataSize() { return data.GetSize(); }
00153   
00155   IAX2Remote & GetRemoteInfo() { return remote; }
00156   
00158   const BYTE * GetDataPointer() { return data + currentReadIndex; }
00159   
00166   IAX2Frame * BuildAppropriateFrameType(IAX2Encryption &encryptionInfo);
00167 
00169   IAX2Frame * BuildAppropriateFrameType();
00170 
00172   PINDEX   GetUnReadBytes() { return data.GetSize() - currentReadIndex; }
00173   
00175   virtual BOOL WriteHeader() { return FALSE; }
00176   
00179   virtual BOOL TransmitPacket(PUDPSocket &sock);
00180   
00182   virtual void PrintOn(ostream & strm) const;
00183   
00185   static DWORD CalcTimeStamp(const PTimeInterval & callStartTick);
00186 
00190   virtual void BuildTimeStamp(const PTimeInterval & callStartTick);
00191   
00193   IAX2EndPoint & GetEndpoint() { return endpoint; }
00194   
00196   PString IdString() const { return PString("FR-ID#") + PString(frameIndex); }
00197   
00198   
00200   DWORD  GetTimeStamp() { return timeStamp; }
00201   
00203   virtual BOOL CallMustBeActive() { return TRUE; }     
00204   
00206   enum IAX2FrameType {
00207     undefType        = 0,     
00208     dtmfType         = 1,     
00209     voiceType        = 2,     
00210     videoType        = 3,     
00211     controlType      = 4,     
00212     nullType         = 5,     
00213     iax2ProtocolType = 6,     
00214     textType         = 7,     
00215     imageType        = 8,     
00216     htmlType         = 9,     
00217     cngType          = 10,    
00218     numFrameTypes    = 11     
00219   };
00220   
00223   IAX2FrameType GetFrameType() { return frameType; }
00224     
00228   virtual void InitialiseHeader(IAX2Processor * /*processor*/) { }
00229   
00231   BOOL CanRetransmitFrame() const {return canRetransmitFrame; } 
00232   
00234   PString GetConnectionToken() const { return connectionToken; }
00235 
00238   void SetConnectionToken(PString newToken) { connectionToken = newToken; } 
00239 
00242   void BuildConnectionTokenId();
00243 
00246   BOOL EncryptContents(IAX2Encryption &encData);
00247 
00249   virtual PINDEX GetEncryptionOffset();
00250 
00251  protected:
00252 
00256   BOOL DecryptContents(IAX2Encryption & encryption);
00257 
00259   IAX2Remote  remote;
00260   
00262   IAX2FrameType frameType;
00263   
00265   BOOL          Read1Byte(BYTE & res);
00266   
00268   BOOL          Read2Bytes(PINDEX & res);
00269   
00271   BOOL          Read2Bytes(WORD & res);
00272   
00274   BOOL          Read4Bytes(DWORD & res);
00275   
00277   void          Write1Byte(BYTE newVal);
00278   
00280   void          Write1Byte(PINDEX newVal);
00281   
00283   void          Write2Bytes(PINDEX newVal);
00284   
00286   void          Write4Bytes(unsigned int newVal);
00287   
00289   void          ZeroAllValues();
00290   
00292   IAX2EndPoint      & endpoint;
00293   
00295   PBYTEArray         data;
00296   
00298   BOOL               isFullFrame;
00299   
00301   BOOL               isVideo;
00302   
00304   BOOL               isAudio;
00305   
00307   PINDEX               currentReadIndex;  
00308   
00310   PINDEX               currentWriteIndex;  
00311   
00313   DWORD                timeStamp;  
00314   
00316   int                frameIndex;
00317   
00319   BOOL               canRetransmitFrame;
00320 
00325   PString            connectionToken;
00326 
00329   DWORD presetTimeStamp;
00330 };
00331 
00333 
00334 class IAX2MiniFrame : public IAX2Frame
00335 {
00336   PCLASSINFO(IAX2MiniFrame, IAX2Frame);
00337  public:
00340   IAX2MiniFrame(IAX2Frame & srcFrame);
00341   
00343   IAX2MiniFrame(IAX2EndPoint & _endpoint); 
00344   
00352   IAX2MiniFrame(IAX2Processor * con, PBYTEArray &sound, BOOL isAudio, DWORD usersTimeStamp = 0);
00353 
00355   virtual ~IAX2MiniFrame();
00356   
00358   virtual BOOL ProcessNetworkPacket();
00359   
00361   virtual BOOL WriteHeader();
00362   
00364   virtual void PrintOn(ostream & strm) const;
00365   
00367   virtual BYTE *GetMediaDataPointer();
00368   
00370   virtual PINDEX GetMediaDataSize();
00371   
00373   void AlterTimeStamp(PINDEX newValue);
00374   
00380   virtual void InitialiseHeader(IAX2Processor *processor);
00381   
00383   virtual PINDEX GetEncryptionOffset();
00384 
00385  protected:
00387   void ZeroAllValues();
00388 };
00389 
00391 
00392 class IAX2FullFrame : public IAX2Frame
00393 {
00394   PCLASSINFO(IAX2FullFrame, IAX2Frame);
00395  public:
00398   IAX2FullFrame(IAX2Frame & srcFrame);
00399   
00402   IAX2FullFrame(IAX2EndPoint  &_endpoint);
00403   
00406   virtual ~IAX2FullFrame();
00407   
00409   BOOL IsAckFrame() { return isAckFrame; }
00410   
00412   BOOL IsPingFrame();
00413 
00415   BOOL IsNewFrame();
00416 
00418   BOOL IsLagRqFrame();
00419 
00421   BOOL IsLagRpFrame();
00422 
00424   BOOL IsPongFrame();
00425 
00427   BOOL IsAuthReqFrame();
00428 
00430   BOOL IsVnakFrame();
00431   
00433   BOOL IsRegReqFrame();
00434   
00436   BOOL IsRegAuthFrame();
00437   
00439   BOOL IsRegAckFrame();  
00440   
00442   BOOL IsRegRelFrame();
00443   
00445   BOOL IsRegRejFrame();
00446 
00448   BOOL FrameIncrementsInSeqNo();
00449 
00452   virtual BOOL IsFullFrame() { return TRUE; }  
00453   
00457   BOOL IsHangupFrame();
00458 
00460   void ZeroAllValues();
00461   
00463   virtual BOOL ProcessNetworkPacket();
00464   
00467   virtual BOOL TransmitPacket(PUDPSocket &sock);
00468   
00470   PString GetFullFrameName() const;
00471   
00473   virtual PString GetSubClassName() const
00474     { return PString(" subclass=") + PString(subClass); }
00475   
00478   void MarkDeleteNow();
00479   
00483   void MarkVnakSendNow();
00484 
00486   virtual BYTE *GetMediaDataPointer();
00487   
00489   virtual PINDEX GetMediaDataSize();
00490   
00492   PINDEX GetSubClass() const { return subClass; }
00493   
00495   void SetSubClass(PINDEX newValue) { subClass = newValue;}
00496   
00500   virtual BOOL WriteHeader();
00501   
00503   void ModifyFrameHeaderSequenceNumbers(PINDEX inNo, PINDEX outNo);
00504 
00509   void ModifyFrameTimeStamp(PINDEX newTimeStamp);
00510 
00512   virtual BOOL InformationElementsPresent() { return FALSE; }  
00513   
00515   BOOL  SendFrameNow() { return sendFrameNow; }
00516   
00518   BOOL  DeleteFrameNow() { return deleteFrameNow; }
00519   
00521   IAX2SequenceNumbers & GetSequenceInfo() { return sequence; }
00522   
00524   virtual void PrintOn(ostream & strm) const;
00525   
00527   void MarkAsResent();
00528   
00531   BOOL operator *= (IAX2FullFrame & other);
00532   
00535   enum ConnectionRequired {
00536     callActive,      
00537     callIrrelevant   
00538   };
00539   
00541   virtual BYTE GetFullFrameType() { return 0; }
00542 
00544   virtual PINDEX GetEncryptionOffset() { return 4; }
00545   
00546  protected:
00548   virtual BOOL CallMustBeActive() { return callMustBeActive; }
00549   
00551   void UnCompressSubClass(BYTE a);
00552   
00554   int  CompressSubClass();
00555   
00557   void ClearListFlags();
00558   
00564   virtual void InitialiseHeader(IAX2Processor *processor);
00565   
00566 #ifdef DOC_PLUS_PLUS
00567 
00570   void OnTransmissionTimeout(PTimer &, INT);
00571 #else
00572   PDECLARE_NOTIFIER(PTimer, IAX2FullFrame, OnTransmissionTimeout);
00573 #endif
00574 
00575   PTimer transmissionTimer;
00576   
00578   PINDEX subClass;
00579   
00581   PTimeInterval retryDelta;     
00582   
00584   PTimeInterval timeOffset;     
00585   
00587   PINDEX       retries;        
00588   
00590   enum RetryTime {
00591     minRetryTime = 500,    
00592     maxRetryTime = 010000, 
00593     maxRetries   = 10,     
00594   };
00595   
00597   IAX2SequenceNumbers sequence;
00598   
00600   BOOL         sendFrameNow;   
00601   
00603   BOOL         deleteFrameNow; 
00604   
00606   BOOL         packetResent;   
00607   
00609   BOOL callMustBeActive;
00610   
00612   BOOL isAckFrame;  
00613 };
00614 
00616 
00621 class IAX2FullFrameDtmf : public IAX2FullFrame
00622 {
00623   PCLASSINFO(IAX2FullFrameDtmf, IAX2FullFrame);
00624  public:
00627   IAX2FullFrameDtmf(IAX2Frame & srcFrame);
00628 
00631   IAX2FullFrameDtmf(IAX2FullFrame & srcFrame);
00632   
00635   IAX2FullFrameDtmf(IAX2Processor *processor, 
00636                     char  subClassValue       
00637                     );
00638   
00641   IAX2FullFrameDtmf(IAX2Processor *processor, 
00642                 PString  subClassValue    
00643                 );
00644   
00645   
00647   virtual PString GetSubClassName() const; 
00648   
00650   enum DtmfSc {
00651     dtmf0 = 48,     
00652     dtmf1 = 49,     
00653     dtmf2 = 50,     
00654     dtmf3 = 51,     
00655     dtmf4 = 52,     
00656     dtmf5 = 53,     
00657     dtmf6 = 54,     
00658     dtmf7 = 55,     
00659     dtmf8 = 56,     
00660     dtmf9 = 57,     
00661     dtmfA = 65,     
00662     dtmfB = 66,     
00663     dtmfC = 67,     
00664     dtmfD = 68,     
00665     dtmfStar = 42,  
00666     dtmfHash = 35   
00667   };
00668   
00670   virtual BYTE GetFullFrameType() { return dtmfType; }
00671   
00672  protected:
00673 };
00674 
00676 
00683 class IAX2FullFrameVoice : public IAX2FullFrame
00684 {
00685   PCLASSINFO(IAX2FullFrameVoice, IAX2FullFrame);
00686  public:
00687   
00690   IAX2FullFrameVoice(IAX2Frame & srcFrame);
00691   
00694   IAX2FullFrameVoice(IAX2FullFrame & srcFrame);
00695   
00704   IAX2FullFrameVoice(IAX2CallProcessor *processor, PBYTEArray &sound, 
00705                  PINDEX usersTimeStamp = 0);
00706   
00708   virtual ~IAX2FullFrameVoice();
00709 
00711   virtual PString GetSubClassName() const;
00712   
00715   static PString GetSubClassName(unsigned short testValue)
00716      { return GetSubClassName((unsigned int) testValue); }
00717 
00720   static PString GetSubClassName(unsigned int testValue);
00721   
00725   static PString GetOpalNameOfCodec(PINDEX testValue);
00726   
00728   static PString GetSubClassName(int testValue) 
00729     { return GetSubClassName((unsigned short) testValue); }
00730   
00733   static unsigned short OpalNameToIax2Value(const PString opalName);
00734 
00736   enum AudioSc {
00737     g7231    = 1,         
00738     gsm      = 2,         
00739     g711ulaw = 4,         
00740     g711alaw = 8,         
00741     mp3      = 0x10,      
00742     adpcm    = 0x20,      
00743     pcm      = 0x40,      
00744     lpc10    = 0x80,      
00745     g729     = 0x100,     
00746     speex    = 0x200,     
00747     ilbc     = 0x400,     
00748     supportedCodecs = 11  
00749   };
00750   
00752   virtual BYTE GetFullFrameType() { return voiceType; }
00753 };
00755 
00760 class IAX2FullFrameVideo : public IAX2FullFrame
00761 {
00762   PCLASSINFO(IAX2FullFrameVideo, IAX2FullFrame);
00763  public:
00764   
00767   IAX2FullFrameVideo(IAX2Frame & srcFrame);
00768   
00771   IAX2FullFrameVideo(IAX2FullFrame & srcFrame);
00772   
00774   virtual PString GetSubClassName() const;
00775   
00777   enum VideoSc {
00778     jpeg  = 0x10000,   
00779     png   = 0x20000,   
00780     h261  = 0x40000,   
00781     h263  = 0x80000    
00782   };
00783   
00785   virtual BYTE GetFullFrameType() { return videoType; }
00786  protected:
00787 };
00788 
00790 
00795 class IAX2FullFrameSessionControl : public IAX2FullFrame
00796 {
00797   PCLASSINFO(IAX2FullFrameSessionControl, IAX2FullFrame);
00798  public:
00799   
00801   enum SessionSc {
00802     hangup          = 1,     
00803     ring            = 2,     
00804     ringing         = 3,     
00805     answer          = 4,     
00806     busy            = 5,     
00807     tkoffhk         = 6,     
00808     offhook         = 7,     
00809     congestion      = 8,     
00810     flashhook       = 9,     
00811     wink            = 10,    
00812     option          = 11,    
00813     keyRadio        = 12,    
00814     unkeyRadio      = 13,    
00815     callProgress    = 14,    
00816     callProceeding  = 15,    
00817     callOnHold      = 16,    
00818     callHoldRelease = 17,    
00819     stopSounds      = 255    
00820   };
00821   
00822   
00823   
00826   IAX2FullFrameSessionControl(IAX2Frame & srcFrame);
00827   
00830   IAX2FullFrameSessionControl(IAX2FullFrame & srcFrame);
00831   
00834   IAX2FullFrameSessionControl(IAX2Processor *processor, 
00835                           PINDEX subClassValue
00836                           );
00837   
00840   IAX2FullFrameSessionControl(IAX2Processor *processor,     
00841                           SessionSc subClassValue 
00842                           );
00843   
00845   virtual ~IAX2FullFrameSessionControl() { }
00846 
00848   virtual PString GetSubClassName() const;
00849   
00851   virtual BYTE GetFullFrameType() { return controlType; }
00852   
00853  protected:
00854 };
00855 
00857 
00863 class IAX2FullFrameNull : public IAX2FullFrame
00864 {
00865   PCLASSINFO(IAX2FullFrameNull, IAX2FullFrame);
00866  public:
00869   IAX2FullFrameNull(IAX2EndPoint & endpoint) : IAX2FullFrame(endpoint)   { }
00870   
00874   IAX2FullFrameNull(IAX2Frame & srcFrame);
00875   
00879   IAX2FullFrameNull(IAX2FullFrame & srcFrame);
00880   
00882   virtual PString GetSubClassName() const { return  PString(""); }
00883   
00885   virtual BYTE GetFullFrameType() { return nullType; }
00886   
00887  protected:
00888 };
00889 
00891 
00897 class IAX2FullFrameProtocol : public IAX2FullFrame
00898 {
00899   PCLASSINFO(IAX2FullFrameProtocol, IAX2FullFrame);
00900  public:
00901   
00903   enum ProtocolSc {
00904     cmdNew       =  1,       
00905     cmdPing      =  2,       
00906     cmdPong      =  3,       
00907     cmdAck       =  4,       
00908     cmdHangup    =  5,       
00909     cmdReject    =  6,       
00910     cmdAccept    =  7,       
00911     cmdAuthReq   =  8,       
00912     cmdAuthRep   =  9,       
00913     cmdInval     =  10,      
00914     cmdLagRq     =  11,      
00915     cmdLagRp     =  12,      
00916     cmdRegReq    =  13,      
00917     cmdRegAuth   =  14,      
00918     cmdRegAck    =  15,      
00919     cmdRegRej    =  16,      
00920     cmdRegRel    =  17,      
00921     cmdVnak      =  18,      
00922     cmdDpReq     =  19,      
00923     cmdDpRep     =  20,      
00924     cmdDial      =  21,      
00925     cmdTxreq     =  22,      
00926     cmdTxcnt     =  23,      
00927     cmdTxacc     =  24,      
00928     cmdTxready   =  25,      
00929     cmdTxrel     =  26,      
00930     cmdTxrej     =  27,      
00931     cmdQuelch    =  28,      
00932     cmdUnquelch  =  29,      
00933     cmdPoke      =  30,      
00934     cmdPage      =  31,      
00935     cmdMwi       =  32,      
00936     cmdUnsupport =  33,      
00937     cmdTransfer  =  34,      
00938     cmdProvision =  35,      
00939     cmdFwDownl   =  36,      
00940     cmdFwData    =  37       
00941   };
00942   
00946   IAX2FullFrameProtocol(IAX2Frame & srcFrame);
00947   
00951   IAX2FullFrameProtocol(IAX2FullFrame & srcFrame);
00952   
00955   IAX2FullFrameProtocol(IAX2Processor *processor,         
00956                     PINDEX subClassValue,            
00957                     ConnectionRequired needCon = IAX2FullFrame::callActive
00959                     );
00960   
00963   IAX2FullFrameProtocol(IAX2Processor *processor,         
00964                     ProtocolSc  subClassValue,       
00965                     ConnectionRequired needCon=IAX2FullFrame::callActive 
00967                     );
00968   
00974   IAX2FullFrameProtocol(IAX2Processor *processor,         
00975                     ProtocolSc  subClassValue,       
00976                     IAX2FullFrame *inReplyTo,            
00977                     ConnectionRequired needCon = IAX2FullFrame::callActive
00979                     );
00980   
00982   virtual ~IAX2FullFrameProtocol();
00983   
00985   void SetRetransmissionRequired();
00986   
00988   virtual BOOL InformationElementsPresent() { return !ieElements.IsEmpty(); }
00989   
00991   ProtocolSc GetSubClass() const { return (ProtocolSc) subClass; }
00992 
00994   virtual PString GetSubClassName() const; 
00995 
00997   static PString GetSubClassName(PINDEX t);
00998   
01001   IAX2Ie *GetIeAt(PINDEX i) {      return ieElements.GetIeAt(i); }
01002   
01004   void AppendIe(IAX2Ie *newElement) { ieElements.AppendIe(newElement); }
01005   
01008   void WriteIeAsBinaryData();
01009   
01013   void CopyDataFromIeListTo(IAX2IeData &res);
01014   
01017   void GetRemoteCapability(unsigned int & capability, unsigned int & preferred);
01018 
01020   virtual BYTE GetFullFrameType() { return iax2ProtocolType; }
01021   
01023   virtual void PrintOn(ostream & strm) const;
01024 
01025  protected:
01026   
01029   BOOL ReadInformationElements();
01030   
01032   IAX2IeList ieElements;
01033 
01035 #if PTRACING
01036     friend ostream & operator<<(ostream & o, ProtocolSc t);
01037 #endif
01038 };
01039 
01041 
01046 class IAX2FullFrameText : public IAX2FullFrame
01047 {
01048   PCLASSINFO(IAX2FullFrameText, IAX2FullFrame);
01049  public:
01050 
01053   IAX2FullFrameText(IAX2Processor *processor,       
01054                 const PString&  textValue
01055                 );
01056   
01059   IAX2FullFrameText(IAX2Frame & srcFrame);
01060   
01063   IAX2FullFrameText(IAX2FullFrame & srcFrame);
01064   
01066   virtual PString GetSubClassName() const;
01067   
01069   virtual BYTE GetFullFrameType() { return textType; }
01070 
01072   PString GetTextString() const;
01073 
01074  protected:
01075 
01077   PString internalText;
01078 };
01080 
01085 class IAX2FullFrameImage : public IAX2FullFrame
01086 {
01087   PCLASSINFO(IAX2FullFrameImage, IAX2FullFrame);
01088  public:
01089   
01092   IAX2FullFrameImage(IAX2Frame & srcFrame);
01093   
01096   IAX2FullFrameImage(IAX2FullFrame & srcFrame);
01097   
01099   virtual PString GetSubClassName() const;
01100   
01102   virtual BYTE GetFullFrameType() { return imageType; }
01103  protected:
01104 };
01105 
01107 
01112 class IAX2FullFrameHtml : public IAX2FullFrame
01113 {
01114   PCLASSINFO(IAX2FullFrameHtml, IAX2FullFrame);
01115  public:
01116   
01119   IAX2FullFrameHtml(IAX2Frame & srcFrame);
01120   
01123   IAX2FullFrameHtml(IAX2FullFrame & srcFrame);
01124   
01126   virtual PString GetSubClassName() const;
01127   
01129   virtual BYTE GetFullFrameType() { return htmlType; }
01130  protected:
01131 };
01132 
01134 
01138 class IAX2FullFrameCng : public IAX2FullFrame
01139 {
01140   PCLASSINFO(IAX2FullFrameCng, IAX2FullFrame);
01141  public:
01142   
01145   IAX2FullFrameCng(IAX2Frame & srcFrame);
01146   
01149   IAX2FullFrameCng(IAX2FullFrame & srcFrame);
01150   
01152   virtual PString GetSubClassName() const;
01153   
01155   virtual BYTE GetFullFrameType() { return cngType; }
01156  protected:
01157 };
01158 
01160 
01161 PDECLARE_LIST (IAX2FrameList, IAX2Frame *)
01162 #ifdef DOC_PLUS_PLUS     //This makes emacs bracket matching code happy.
01163 
01169 class IAX2FrameList : public IAX2Frame *  
01170 {
01171 #endif
01172  public:
01173   ~IAX2FrameList();
01174   
01176   void ReportList();
01177   
01179   IAX2Frame *GetLastFrame();
01180   
01182   void Initialise() {  DisallowDeleteObjects(); }
01183     
01185   BOOL Empty() { return GetSize() == 0; }
01186   
01188   void GrabContents(IAX2FrameList &src);
01189   
01192   void DeleteMatchingSendFrame(IAX2FullFrame *reply);
01193 
01197   void SendVnakRequestedFrames(IAX2FullFrameProtocol &src);
01198 
01200   void AddNewFrame(IAX2Frame *src);
01201   
01203   void GetResendFramesDeleteOldFrames(IAX2FrameList & framesToSend);
01204   
01206   virtual PINDEX GetSize() { PWaitAndSignal m(mutex); return PAbstractList::GetSize(); }
01207   
01209   void MarkAllAsResent();
01210   
01211  protected:
01213   virtual PINDEX GetEntries() { return PAbstractList::GetSize(); }
01214   
01216   PMutex mutex;
01217 };
01218 
01219 
01221 
01222 
01223 #endif // FRAME_H
01224 /* The comment below is magic for those who use emacs to edit this file. */
01225 /* With the comment below, the tab key does auto indent to 2 spaces.     */
01226 
01227 /*
01228  * Local Variables:
01229  * mode:c
01230  * c-file-style:linux
01231  * c-basic-offset:2
01232  * End:
01233  */
01234 
01235 
01236 

Generated on Fri Mar 7 06:33:09 2008 for OPAL by  doxygen 1.5.1