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   PBoolean ReadNetworkPacket(PUDPSocket &sock);
00128   
00130   virtual PBoolean ProcessNetworkPacket();
00131   
00133   virtual PBoolean IsFullFrame();
00134   
00136   PBoolean IsVideo() const;
00137   
00139   PBoolean 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 PBoolean WriteHeader() { return PFalse; }
00176   
00179   virtual PBoolean 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   
00197   PString IdString() const;
00198     
00200   DWORD  GetTimeStamp() { return timeStamp; }
00201   
00203   virtual PBoolean CallMustBeActive() { return PTrue; }     
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   
00232   PBoolean CanRetransmitFrame() const {return canRetransmitFrame; } 
00233   
00236   PString GetConnectionToken() const { return connectionToken; }
00237 
00240   void SetConnectionToken(PString newToken) { connectionToken = newToken; } 
00241 
00244   void BuildConnectionTokenId();
00245 
00248   PBoolean EncryptContents(IAX2Encryption &encData);
00249 
00251   virtual PINDEX GetEncryptionOffset();
00252 
00253  protected:
00254 
00258   PBoolean DecryptContents(IAX2Encryption & encryption);
00259 
00262   IAX2Remote  remote;
00263   
00266   IAX2FrameType frameType;
00267   
00270   PBoolean          Read1Byte(BYTE & res);
00271   
00274   PBoolean          Read2Bytes(PINDEX & res);
00275   
00278   PBoolean          Read2Bytes(WORD & res);
00279   
00282   PBoolean          Read4Bytes(DWORD & res);
00283   
00286   void          Write1Byte(BYTE newVal);
00287   
00290   void          Write1Byte(PINDEX newVal);
00291   
00294   void          Write2Bytes(PINDEX newVal);
00295   
00298   void          Write4Bytes(unsigned int newVal);
00299   
00301   void          ZeroAllValues();
00302   
00304   IAX2EndPoint      & endpoint;
00305   
00308   PBYTEArray         data;
00309   
00311   PBoolean               isFullFrame;
00312   
00314   PBoolean               isVideo;
00315   
00317   PBoolean               isAudio;
00318   
00320   PINDEX               currentReadIndex;  
00321   
00323   PINDEX               currentWriteIndex;  
00324   
00326   DWORD                timeStamp;  
00327   
00329   PBoolean               canRetransmitFrame;
00330 
00335   PString            connectionToken;
00336 
00339   DWORD presetTimeStamp;
00340 };
00341 
00343 
00344 class IAX2MiniFrame : public IAX2Frame
00345 {
00346   PCLASSINFO(IAX2MiniFrame, IAX2Frame);
00347  public:
00350   IAX2MiniFrame(const IAX2Frame & srcFrame);
00351   
00353   IAX2MiniFrame(IAX2EndPoint & _endpoint); 
00354   
00363   IAX2MiniFrame(IAX2Processor * con, PBYTEArray &sound, PBoolean isAudio, DWORD usersTimeStamp = 0);
00364 
00366   virtual ~IAX2MiniFrame();
00367   
00370   virtual PBoolean ProcessNetworkPacket();
00371   
00373   virtual PBoolean WriteHeader();
00374   
00376   virtual void PrintOn(ostream & strm) const;
00377   
00380   virtual BYTE *GetMediaDataPointer();
00381   
00383   virtual PINDEX GetMediaDataSize();
00384   
00386   void AlterTimeStamp(PINDEX newValue);
00387   
00393   virtual void InitialiseHeader(IAX2Processor *processor);
00394   
00396   virtual PINDEX GetEncryptionOffset();
00397 
00398  protected:
00400   void ZeroAllValues();
00401 };
00402 
00405 
00406 class IAX2FullFrame : public IAX2Frame
00407 {
00408   PCLASSINFO(IAX2FullFrame, IAX2Frame);
00409  public:
00412   IAX2FullFrame(const IAX2Frame & srcFrame);
00413   
00416   IAX2FullFrame(IAX2EndPoint  &_endpoint);
00417   
00420   virtual ~IAX2FullFrame();
00421   
00423   PBoolean IsAckFrame() { return isAckFrame; }
00424   
00426   PBoolean IsPingFrame();
00427 
00429   PBoolean IsNewFrame();
00430 
00432   PBoolean IsLagRqFrame();
00433 
00435   PBoolean IsLagRpFrame();
00436 
00438   PBoolean IsPongFrame();
00439 
00441   PBoolean IsAuthReqFrame();
00442 
00444   PBoolean IsVnakFrame();
00445   
00447   PBoolean IsRegReqFrame();
00448   
00450   PBoolean IsRegAuthFrame();
00451   
00453   PBoolean IsRegAckFrame();  
00454   
00456   PBoolean IsRegRelFrame();
00457   
00459   PBoolean IsRegRejFrame();
00460 
00463   PBoolean FrameIncrementsInSeqNo();
00464 
00467   virtual PBoolean IsFullFrame() { return PTrue; }  
00468   
00472   PBoolean IsHangupFrame();
00473 
00475   void ZeroAllValues();
00476   
00479   virtual PBoolean ProcessNetworkPacket();
00480   
00483   virtual PBoolean TransmitPacket(PUDPSocket &sock);
00484   
00486   PString GetFullFrameName() const;
00487   
00489   virtual PString GetSubClassName() const
00490     { return PString(" subclass=") + PString(subClass); }
00491   
00495   void MarkDeleteNow();
00496   
00501   void MarkVnakSendNow();
00502 
00505   virtual BYTE *GetMediaDataPointer();
00506   
00508   virtual PINDEX GetMediaDataSize();
00509   
00511   PINDEX GetSubClass() const { return subClass; }
00512   
00514   void SetSubClass(PINDEX newValue) { subClass = newValue;}
00515   
00519   virtual PBoolean WriteHeader();
00520   
00523   void ModifyFrameHeaderSequenceNumbers(PINDEX inNo, PINDEX outNo);
00524 
00529   void ModifyFrameTimeStamp(PINDEX newTimeStamp);
00530 
00532   virtual PBoolean InformationElementsPresent() { return PFalse; }  
00533   
00536   PBoolean  SendFrameNow() { return sendFrameNow; }
00537   
00540   PBoolean  DeleteFrameNow() { return deleteFrameNow; }
00541   
00543   IAX2SequenceNumbers & GetSequenceInfo() { return sequence; }
00544   
00546   virtual void PrintOn(ostream & strm) const;
00547   
00549   void MarkAsResent();
00550   
00553   PBoolean operator *= (IAX2FullFrame & other);
00554   
00557   enum ConnectionRequired {
00558     callActive,      
00559     callIrrelevant   
00560   };
00561   
00563   virtual BYTE GetFullFrameType() { return 0; }
00564 
00566   virtual PINDEX GetEncryptionOffset() { return 4; }
00567   
00568  protected:
00570   virtual PBoolean CallMustBeActive() { return callMustBeActive; }
00571   
00573   void UnCompressSubClass(BYTE a);
00574   
00576   int  CompressSubClass();
00577   
00579   void ClearListFlags();
00580   
00586   virtual void InitialiseHeader(IAX2Processor *processor);
00587   
00588 #ifdef DOC_PLUS_PLUS
00589 
00592   void OnTransmissionTimeout(PTimer &, INT);
00593 #else
00594   PDECLARE_NOTIFIER(PTimer, IAX2FullFrame, OnTransmissionTimeout);
00595 #endif
00596 
00597   PTimer transmissionTimer;
00598   
00600   PINDEX subClass;
00601   
00603   PTimeInterval retryDelta;     
00604   
00606   PTimeInterval timeOffset;     
00607   
00609   PINDEX       retries;        
00610   
00612   enum RetryTime {
00613     minRetryTime = 500,    
00614     maxRetryTime = 010000, 
00615     maxRetries   = 3       
00616   };
00617   
00619   IAX2SequenceNumbers sequence;
00620   
00622   PBoolean         sendFrameNow;   
00623   
00625   PBoolean         deleteFrameNow; 
00626   
00628   PBoolean         packetResent;   
00629   
00631   PBoolean callMustBeActive;
00632   
00634   PBoolean isAckFrame;  
00635 };
00636 
00638 
00643 class IAX2FullFrameDtmf : public IAX2FullFrame
00644 {
00645   PCLASSINFO(IAX2FullFrameDtmf, IAX2FullFrame);
00646  public:
00649   IAX2FullFrameDtmf(const IAX2Frame & srcFrame);
00650 
00653   IAX2FullFrameDtmf(const IAX2FullFrame & srcFrame);
00654   
00657   IAX2FullFrameDtmf(IAX2Processor *processor, 
00658                     char  subClassValue       
00659                     );
00660   
00663   IAX2FullFrameDtmf(IAX2Processor *processor, 
00664                 PString  subClassValue    
00665                 );
00666   
00667   
00669   virtual PString GetSubClassName() const; 
00670   
00672   enum DtmfSc {
00673     dtmf0 = 48,     
00674     dtmf1 = 49,     
00675     dtmf2 = 50,     
00676     dtmf3 = 51,     
00677     dtmf4 = 52,     
00678     dtmf5 = 53,     
00679     dtmf6 = 54,     
00680     dtmf7 = 55,     
00681     dtmf8 = 56,     
00682     dtmf9 = 57,     
00683     dtmfA = 65,     
00684     dtmfB = 66,     
00685     dtmfC = 67,     
00686     dtmfD = 68,     
00687     dtmfStar = 42,  
00688     dtmfHash = 35   
00689   };
00690   
00692   virtual BYTE GetFullFrameType() { return dtmfType; }
00693   
00694  protected:
00695 };
00696 
00698 
00705 class IAX2FullFrameVoice : public IAX2FullFrame
00706 {
00707   PCLASSINFO(IAX2FullFrameVoice, IAX2FullFrame);
00708  public:
00709   
00712   IAX2FullFrameVoice(const IAX2Frame & srcFrame);
00713   
00716   IAX2FullFrameVoice(const IAX2FullFrame & srcFrame);
00717   
00726   IAX2FullFrameVoice(IAX2CallProcessor *processor, PBYTEArray &sound, 
00727                  PINDEX usersTimeStamp = 0);
00728   
00730   virtual ~IAX2FullFrameVoice();
00731 
00733   virtual PString GetSubClassName() const;
00734   
00737   static PString GetSubClassName(unsigned short testValue)
00738      { return GetSubClassName((unsigned int) testValue); }
00739 
00742   static PString GetSubClassName(unsigned int testValue);
00743   
00747   static PString GetOpalNameOfCodec(PINDEX testValue);
00748   
00750   static PString GetSubClassName(int testValue) 
00751     { return GetSubClassName((unsigned short) testValue); }
00752   
00755   static unsigned short OpalNameToIax2Value(const PString opalName);
00756 
00758   enum AudioSc {
00759     g7231    = 1,         
00760     gsm      = 2,         
00761     g711ulaw = 4,         
00762     g711alaw = 8,         
00763     mp3      = 0x10,      
00764     adpcm    = 0x20,      
00765     pcm      = 0x40,      
00766     lpc10    = 0x80,      
00767     g729     = 0x100,     
00768     speex    = 0x200,     
00769     ilbc     = 0x400,     
00770     supportedCodecs = 11  
00771   };
00772   
00774   virtual BYTE GetFullFrameType() { return voiceType; }
00775 };
00777 
00782 class IAX2FullFrameVideo : public IAX2FullFrame
00783 {
00784   PCLASSINFO(IAX2FullFrameVideo, IAX2FullFrame);
00785  public:
00786   
00789   IAX2FullFrameVideo(const IAX2Frame & srcFrame);
00790   
00793   IAX2FullFrameVideo(const IAX2FullFrame & srcFrame);
00794   
00796   virtual PString GetSubClassName() const;
00797   
00799   enum VideoSc {
00800     jpeg  = 0x10000,   
00801     png   = 0x20000,   
00802     h261  = 0x40000,   
00803     h263  = 0x80000    
00804   };
00805   
00807   virtual BYTE GetFullFrameType() { return videoType; }
00808  protected:
00809 };
00810 
00812 
00817 class IAX2FullFrameSessionControl : public IAX2FullFrame
00818 {
00819   PCLASSINFO(IAX2FullFrameSessionControl, IAX2FullFrame);
00820  public:
00821   
00823   enum SessionSc {
00824     hangup          = 1,     
00825     ring            = 2,     
00826     ringing         = 3,     
00827     answer          = 4,     
00828     busy            = 5,     
00829     tkoffhk         = 6,     
00830     offhook         = 7,     
00831     congestion      = 8,     
00832     flashhook       = 9,     
00833     wink            = 10,    
00834     option          = 11,    
00835     keyRadio        = 12,    
00836     unkeyRadio      = 13,    
00837     callProgress    = 14,    
00838     callProceeding  = 15,    
00839     callOnHold      = 16,    
00840     callHoldRelease = 17,    
00841     stopSounds      = 255    
00842   };
00843   
00844   
00845   
00848   IAX2FullFrameSessionControl(const IAX2Frame & srcFrame);
00849   
00852   IAX2FullFrameSessionControl(const IAX2FullFrame & srcFrame);
00853   
00856   IAX2FullFrameSessionControl(IAX2Processor *processor, 
00857                           PINDEX subClassValue
00858                           );
00859   
00862   IAX2FullFrameSessionControl(IAX2Processor *processor,     
00863                           SessionSc subClassValue 
00864                           );
00865   
00867   virtual ~IAX2FullFrameSessionControl() { }
00868 
00870   virtual PString GetSubClassName() const;
00871   
00873   virtual BYTE GetFullFrameType() { return controlType; }
00874   
00875  protected:
00876 };
00877 
00879 
00885 class IAX2FullFrameNull : public IAX2FullFrame
00886 {
00887   PCLASSINFO(IAX2FullFrameNull, IAX2FullFrame);
00888  public:
00891   IAX2FullFrameNull(IAX2EndPoint & endpoint) : IAX2FullFrame(endpoint)   { }
00892   
00896   IAX2FullFrameNull(const IAX2Frame & srcFrame);
00897   
00901   IAX2FullFrameNull(const IAX2FullFrame & srcFrame);
00902   
00904   virtual PString GetSubClassName() const { return  PString(""); }
00905   
00907   virtual BYTE GetFullFrameType() { return nullType; }
00908   
00909  protected:
00910 };
00911 
00913 
00919 class IAX2FullFrameProtocol : public IAX2FullFrame
00920 {
00921   PCLASSINFO(IAX2FullFrameProtocol, IAX2FullFrame);
00922  public:
00923   
00925   enum ProtocolSc {
00926     cmdNew       =  1,       
00927     cmdPing      =  2,       
00928     cmdPong      =  3,       
00929     cmdAck       =  4,       
00930     cmdHangup    =  5,       
00931     cmdReject    =  6,       
00932     cmdAccept    =  7,       
00933     cmdAuthReq   =  8,       
00934     cmdAuthRep   =  9,       
00935     cmdInval     =  10,      
00936     cmdLagRq     =  11,      
00937     cmdLagRp     =  12,      
00938     cmdRegReq    =  13,      
00939     cmdRegAuth   =  14,      
00940     cmdRegAck    =  15,      
00941     cmdRegRej    =  16,      
00942     cmdRegRel    =  17,      
00943     cmdVnak      =  18,      
00944     cmdDpReq     =  19,      
00945     cmdDpRep     =  20,      
00946     cmdDial      =  21,      
00947     cmdTxreq     =  22,      
00948     cmdTxcnt     =  23,      
00949     cmdTxacc     =  24,      
00950     cmdTxready   =  25,      
00951     cmdTxrel     =  26,      
00952     cmdTxrej     =  27,      
00953     cmdQuelch    =  28,      
00954     cmdUnquelch  =  29,      
00955     cmdPoke      =  30,      
00956     cmdPage      =  31,      
00957     cmdMwi       =  32,      
00958     cmdUnsupport =  33,      
00959     cmdTransfer  =  34,      
00960     cmdProvision =  35,      
00961     cmdFwDownl   =  36,      
00962     cmdFwData    =  37       
00963   };
00964   
00968   IAX2FullFrameProtocol(const IAX2Frame & srcFrame);
00969   
00973   IAX2FullFrameProtocol(const IAX2FullFrame & srcFrame);
00974   
00977   IAX2FullFrameProtocol(IAX2Processor *processor,         
00978                     PINDEX subClassValue,            
00979                     ConnectionRequired needCon = IAX2FullFrame::callActive
00981                     );
00982   
00985   IAX2FullFrameProtocol(IAX2Processor *processor,         
00986                     ProtocolSc  subClassValue,       
00987                     ConnectionRequired needCon=IAX2FullFrame::callActive 
00989                     );
00990   
00996   IAX2FullFrameProtocol(IAX2Processor *processor,         
00997                     ProtocolSc  subClassValue,       
00998                     IAX2FullFrame *inReplyTo,            
00999                     ConnectionRequired needCon = IAX2FullFrame::callActive
01001                     );
01002   
01004   virtual ~IAX2FullFrameProtocol();
01005   
01007   void SetRetransmissionRequired();
01008   
01010   virtual PBoolean InformationElementsPresent() { return !ieElements.IsEmpty(); }
01011   
01013   ProtocolSc GetSubClass() const { return (ProtocolSc) subClass; }
01014 
01016   virtual PString GetSubClassName() const; 
01017 
01019   static PString GetSubClassName(PINDEX t);
01020   
01023   IAX2Ie *GetIeAt(PINDEX i) {      return ieElements.GetIeAt(i); }
01024   
01026   void AppendIe(IAX2Ie *newElement) { ieElements.AppendIe(newElement); }
01027   
01030   void WriteIeAsBinaryData();
01031   
01035   void CopyDataFromIeListTo(IAX2IeData &res);
01036   
01039   void GetRemoteCapability(unsigned int & capability, unsigned int & preferred);
01040 
01042   virtual BYTE GetFullFrameType() { return iax2ProtocolType; }
01043   
01045   virtual void PrintOn(ostream & strm) const;
01046 
01047  protected:
01048   
01051   PBoolean ReadInformationElements();
01052   
01054   IAX2IeList ieElements;
01055 
01057 #if PTRACING
01058     friend ostream & operator<<(ostream & o, ProtocolSc t);
01059 #endif
01060 };
01061 
01063 
01068 class IAX2FullFrameText : public IAX2FullFrame
01069 {
01070   PCLASSINFO(IAX2FullFrameText, IAX2FullFrame);
01071  public:
01072 
01075   IAX2FullFrameText(IAX2Processor *processor,       
01076                 const PString&  textValue
01077                 );
01078   
01081   IAX2FullFrameText(const IAX2Frame & srcFrame);
01082   
01085   IAX2FullFrameText(const IAX2FullFrame & srcFrame);
01086   
01088   virtual PString GetSubClassName() const;
01089   
01091   virtual BYTE GetFullFrameType() { return textType; }
01092 
01094   PString GetTextString() const;
01095 
01096  protected:
01097 
01099   PString internalText;
01100 };
01102 
01107 class IAX2FullFrameImage : public IAX2FullFrame
01108 {
01109   PCLASSINFO(IAX2FullFrameImage, IAX2FullFrame);
01110  public:
01111   
01114   IAX2FullFrameImage(const IAX2Frame & srcFrame);
01115   
01118   IAX2FullFrameImage(const IAX2FullFrame & srcFrame);
01119   
01121   virtual PString GetSubClassName() const;
01122   
01124   virtual BYTE GetFullFrameType() { return imageType; }
01125  protected:
01126 };
01127 
01129 
01134 class IAX2FullFrameHtml : public IAX2FullFrame
01135 {
01136   PCLASSINFO(IAX2FullFrameHtml, IAX2FullFrame);
01137  public:
01138   
01141   IAX2FullFrameHtml(const IAX2Frame & srcFrame);
01142   
01145   IAX2FullFrameHtml(const IAX2FullFrame & srcFrame);
01146   
01148   virtual PString GetSubClassName() const;
01149   
01151   virtual BYTE GetFullFrameType() { return htmlType; }
01152  protected:
01153 };
01154 
01156 
01160 class IAX2FullFrameCng : public IAX2FullFrame
01161 {
01162   PCLASSINFO(IAX2FullFrameCng, IAX2FullFrame);
01163  public:
01164   
01167   IAX2FullFrameCng(const IAX2Frame & srcFrame);
01168   
01171   IAX2FullFrameCng(const IAX2FullFrame & srcFrame);
01172   
01174   virtual PString GetSubClassName() const;
01175   
01177   virtual BYTE GetFullFrameType() { return cngType; }
01178  protected:
01179 };
01180 
01182 
01183 PDECLARE_LIST (IAX2FrameList, IAX2Frame *)
01184 #ifdef DOC_PLUS_PLUS     //This makes emacs bracket matching code happy.
01185 
01191 class IAX2FrameList : public IAX2Frame *  
01192 {
01193 #endif
01194  public:
01195   ~IAX2FrameList();
01196   
01198   void ReportList(PString & answer);
01199   
01201   IAX2Frame *GetLastFrame();
01202   
01204   void Initialise();
01205     
01207   PBoolean Empty() { return GetSize() == 0; }
01208   
01210   void GrabContents(IAX2FrameList &src);
01211   
01214   void DeleteMatchingSendFrame(IAX2FullFrame *reply);
01215 
01219   void SendVnakRequestedFrames(IAX2FullFrameProtocol &src);
01220 
01222   void AddNewFrame(IAX2Frame *src);
01223   
01225   void GetResendFramesDeleteOldFrames(IAX2FrameList & framesToSend);
01226   
01228   virtual PINDEX GetSize() { PWaitAndSignal m(mutex); return PAbstractList::GetSize(); }
01229   
01231   void MarkAllAsResent();
01232   
01233  protected:
01235   virtual PINDEX GetEntries() { return PAbstractList::GetSize(); }
01236   
01238   PMutex mutex;
01239 };
01240 
01242 
01246 class IAX2ActiveFrameList : public IAX2FrameList
01247 {
01248   PCLASSINFO(IAX2ActiveFrameList, IAX2FrameList);
01249  public:
01250   IAX2ActiveFrameList() { Initialise(); }
01251 };
01253 
01254 
01255 #endif // FRAME_H
01256 /* The comment below is magic for those who use emacs to edit this file. */
01257 /* With the comment below, the tab key does auto indent to 2 spaces.     */
01258 
01259 /*
01260  * Local Variables:
01261  * mode:c
01262  * c-basic-offset:2
01263  * End:
01264  */
01265 
01266 
01267 

Generated on Mon Sep 15 11:48:42 2008 for OPAL by  doxygen 1.5.1