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 <opal/buildopts.h>
00084 
00085 #include <iax2/ies.h>
00086 #include <iax2/remote.h>
00087 
00088 #include <ptlib/sockets.h>
00089 
00090 #ifdef P_USE_PRAGMA
00091 #pragma interface
00092 #endif
00093 
00094 class IAX2Frame;
00095 class IAX2FrameList;
00096 class IAX2FullFrame;
00097 class IAX2FullFrameCng;
00098 class IAX2FullFrameDtmf;
00099 class IAX2FullFrameHtml;
00100 class IAX2FullFrameImage;
00101 class IAX2FullFrameNull;
00102 class IAX2FullFrameProtocol;
00103 class IAX2FullFrameSessionControl;
00104 class IAX2FullFrameText;
00105 class IAX2FullFrameVideo;
00106 class IAX2FullFrameVoice;
00107 class IAX2EndPoint;
00108 class IAX2Processor;
00109 class IAX2CallProcessor;
00110 class IAX2IeList;
00111 class IAX2MiniFrame;
00112 class IAX2Transmitter;
00113 
00114 
00115 
00117 class IAX2Frame :  public PObject
00118 {
00119   PCLASSINFO(IAX2Frame, PObject);
00120  public:
00122   IAX2Frame(IAX2EndPoint &_endpoint);
00123   
00125   virtual ~IAX2Frame();
00126   
00129   PBoolean ReadNetworkPacket(PUDPSocket &sock);
00130   
00132   virtual PBoolean ProcessNetworkPacket();
00133   
00135   virtual PBoolean IsFullFrame();
00136   
00138   PBoolean IsVideo() const;
00139   
00141   PBoolean IsAudio() const;
00142 
00146   virtual BYTE *GetMediaDataPointer() { return data.GetPointer(); }
00147   
00151   virtual PINDEX GetMediaDataSize() { return DataSize();}
00152   
00154   PINDEX DataSize() { return data.GetSize(); }
00155   
00157   IAX2Remote & GetRemoteInfo() { return remote; }
00158   
00160   const BYTE * GetDataPointer() { return data + currentReadIndex; }
00161   
00168   IAX2Frame * BuildAppropriateFrameType(IAX2Encryption &encryptionInfo);
00169 
00171   IAX2Frame * BuildAppropriateFrameType();
00172 
00174   PINDEX   GetUnReadBytes() { return data.GetSize() - currentReadIndex; }
00175   
00177   virtual PBoolean WriteHeader() { return PFalse; }
00178   
00181   virtual PBoolean TransmitPacket(PUDPSocket &sock);
00182   
00184   virtual void PrintOn(ostream & strm) const;
00185   
00187   static DWORD CalcTimeStamp(const PTimeInterval & callStartTick);
00188 
00192   virtual void BuildTimeStamp(const PTimeInterval & callStartTick);
00193   
00195   IAX2EndPoint & GetEndpoint() { return endpoint; }
00196   
00199   PString IdString() const;
00200     
00202   DWORD  GetTimeStamp() { return timeStamp; }
00203   
00205   virtual PBoolean CallMustBeActive() { return PTrue; }     
00206   
00208   enum IAX2FrameType {
00209     undefType        = 0,     
00210     dtmfType         = 1,     
00211     voiceType        = 2,     
00212     videoType        = 3,     
00213     controlType      = 4,     
00214     nullType         = 5,     
00215     iax2ProtocolType = 6,     
00216     textType         = 7,     
00217     imageType        = 8,     
00218     htmlType         = 9,     
00219     cngType          = 10,    
00220     numFrameTypes    = 11     
00221   };
00222   
00225   IAX2FrameType GetFrameType() { return frameType; }
00226     
00230   virtual void InitialiseHeader(IAX2Processor * /*processor*/) { }
00231   
00234   PBoolean CanRetransmitFrame() const {return canRetransmitFrame; } 
00235   
00238   PString GetConnectionToken() const { return connectionToken; }
00239 
00242   void SetConnectionToken(PString newToken) { connectionToken = newToken; } 
00243 
00246   void BuildConnectionTokenId();
00247 
00250   PBoolean EncryptContents(IAX2Encryption &encData);
00251 
00253   virtual PINDEX GetEncryptionOffset();
00254 
00255  protected:
00256 
00260   PBoolean DecryptContents(IAX2Encryption & encryption);
00261 
00264   IAX2Remote  remote;
00265   
00268   IAX2FrameType frameType;
00269   
00272   PBoolean          Read1Byte(BYTE & res);
00273   
00276   PBoolean          Read2Bytes(PINDEX & res);
00277   
00280   PBoolean          Read2Bytes(WORD & res);
00281   
00284   PBoolean          Read4Bytes(DWORD & res);
00285   
00288   void          Write1Byte(BYTE newVal);
00289   
00292   void          Write1Byte(PINDEX newVal);
00293   
00296   void          Write2Bytes(PINDEX newVal);
00297   
00300   void          Write4Bytes(unsigned int newVal);
00301   
00303   void          ZeroAllValues();
00304   
00306   IAX2EndPoint      & endpoint;
00307   
00310   PBYTEArray         data;
00311   
00313   PBoolean               isFullFrame;
00314   
00316   PBoolean               isVideo;
00317   
00319   PBoolean               isAudio;
00320   
00322   PINDEX               currentReadIndex;  
00323   
00325   PINDEX               currentWriteIndex;  
00326   
00328   DWORD                timeStamp;  
00329   
00331   PBoolean               canRetransmitFrame;
00332 
00337   PString            connectionToken;
00338 
00341   DWORD presetTimeStamp;
00342 };
00343 
00345 
00346 class IAX2MiniFrame : public IAX2Frame
00347 {
00348   PCLASSINFO(IAX2MiniFrame, IAX2Frame);
00349  public:
00352   IAX2MiniFrame(const IAX2Frame & srcFrame);
00353   
00355   IAX2MiniFrame(IAX2EndPoint & _endpoint); 
00356   
00365   IAX2MiniFrame(IAX2Processor * con, PBYTEArray &sound, PBoolean isAudio, DWORD usersTimeStamp = 0);
00366 
00368   virtual ~IAX2MiniFrame();
00369   
00372   virtual PBoolean ProcessNetworkPacket();
00373   
00375   virtual PBoolean WriteHeader();
00376   
00378   virtual void PrintOn(ostream & strm) const;
00379   
00382   virtual BYTE *GetMediaDataPointer();
00383   
00385   virtual PINDEX GetMediaDataSize();
00386   
00388   void AlterTimeStamp(PINDEX newValue);
00389   
00395   virtual void InitialiseHeader(IAX2Processor *processor);
00396   
00398   virtual PINDEX GetEncryptionOffset();
00399 
00400  protected:
00402   void ZeroAllValues();
00403 };
00404 
00407 
00408 class IAX2FullFrame : public IAX2Frame
00409 {
00410   PCLASSINFO(IAX2FullFrame, IAX2Frame);
00411  public:
00414   IAX2FullFrame(const IAX2Frame & srcFrame);
00415   
00418   IAX2FullFrame(IAX2EndPoint  &_endpoint);
00419   
00422   virtual ~IAX2FullFrame();
00423   
00425   PBoolean IsAckFrame() { return isAckFrame; }
00426   
00428   PBoolean IsPingFrame();
00429 
00431   PBoolean IsNewFrame();
00432 
00434   PBoolean IsLagRqFrame();
00435 
00437   PBoolean IsLagRpFrame();
00438 
00440   PBoolean IsPongFrame();
00441 
00443   PBoolean IsAuthReqFrame();
00444 
00446   PBoolean IsVnakFrame();
00447   
00449   PBoolean IsRegReqFrame();
00450   
00452   PBoolean IsRegAuthFrame();
00453   
00455   PBoolean IsRegAckFrame();  
00456   
00458   PBoolean IsRegRelFrame();
00459   
00461   PBoolean IsRegRejFrame();
00462 
00465   PBoolean FrameIncrementsInSeqNo();
00466 
00469   virtual PBoolean IsFullFrame() { return PTrue; }  
00470   
00474   PBoolean IsHangupFrame();
00475 
00477   void ZeroAllValues();
00478   
00481   virtual PBoolean ProcessNetworkPacket();
00482   
00485   virtual PBoolean TransmitPacket(PUDPSocket &sock);
00486   
00488   PString GetFullFrameName() const;
00489   
00491   virtual PString GetSubClassName() const
00492     { return PString(" subclass=") + PString(subClass); }
00493   
00497   void MarkDeleteNow();
00498   
00503   void MarkVnakSendNow();
00504 
00507   virtual BYTE *GetMediaDataPointer();
00508   
00510   virtual PINDEX GetMediaDataSize();
00511   
00513   PINDEX GetSubClass() const { return subClass; }
00514   
00516   void SetSubClass(PINDEX newValue) { subClass = newValue;}
00517   
00521   virtual PBoolean WriteHeader();
00522   
00525   void ModifyFrameHeaderSequenceNumbers(PINDEX inNo, PINDEX outNo);
00526 
00531   void ModifyFrameTimeStamp(PINDEX newTimeStamp);
00532 
00534   virtual PBoolean InformationElementsPresent() { return PFalse; }  
00535   
00538   PBoolean  SendFrameNow() { return sendFrameNow; }
00539   
00542   PBoolean  DeleteFrameNow() { return deleteFrameNow; }
00543   
00545   IAX2SequenceNumbers & GetSequenceInfo() { return sequence; }
00546   
00548   virtual void PrintOn(ostream & strm) const;
00549   
00551   void MarkAsResent();
00552   
00555   PBoolean operator *= (IAX2FullFrame & other);
00556   
00559   enum ConnectionRequired {
00560     callActive,      
00561     callIrrelevant   
00562   };
00563   
00565   virtual BYTE GetFullFrameType() { return 0; }
00566 
00568   virtual PINDEX GetEncryptionOffset() { return 4; }
00569   
00570  protected:
00572   virtual PBoolean CallMustBeActive() { return callMustBeActive; }
00573   
00575   void UnCompressSubClass(BYTE a);
00576   
00578   int  CompressSubClass();
00579   
00581   void ClearListFlags();
00582   
00588   virtual void InitialiseHeader(IAX2Processor *processor);
00589   
00590 #ifdef DOC_PLUS_PLUS
00591 
00594   void OnTransmissionTimeout(PTimer &, INT);
00595 #else
00596   PDECLARE_NOTIFIER(PTimer, IAX2FullFrame, OnTransmissionTimeout);
00597 #endif
00598 
00599   PTimer transmissionTimer;
00600   
00602   PINDEX subClass;
00603   
00605   PTimeInterval retryDelta;     
00606   
00608   PTimeInterval timeOffset;     
00609   
00611   PINDEX       retries;        
00612   
00614   enum RetryTime {
00615     minRetryTime = 500,    
00616     maxRetryTime = 010000, 
00617     maxRetries   = 3       
00618   };
00619   
00621   IAX2SequenceNumbers sequence;
00622   
00624   PBoolean         sendFrameNow;   
00625   
00627   PBoolean         deleteFrameNow; 
00628   
00630   PBoolean         packetResent;   
00631   
00633   PBoolean callMustBeActive;
00634   
00636   PBoolean isAckFrame;  
00637 };
00638 
00640 
00645 class IAX2FullFrameDtmf : public IAX2FullFrame
00646 {
00647   PCLASSINFO(IAX2FullFrameDtmf, IAX2FullFrame);
00648  public:
00651   IAX2FullFrameDtmf(const IAX2Frame & srcFrame);
00652 
00655   IAX2FullFrameDtmf(const IAX2FullFrame & srcFrame);
00656   
00659   IAX2FullFrameDtmf(IAX2Processor *processor, 
00660                     char  subClassValue       
00661                     );
00662   
00665   IAX2FullFrameDtmf(IAX2Processor *processor, 
00666                 PString  subClassValue    
00667                 );
00668   
00669   
00671   virtual PString GetSubClassName() const; 
00672   
00674   enum DtmfSc {
00675     dtmf0 = 48,     
00676     dtmf1 = 49,     
00677     dtmf2 = 50,     
00678     dtmf3 = 51,     
00679     dtmf4 = 52,     
00680     dtmf5 = 53,     
00681     dtmf6 = 54,     
00682     dtmf7 = 55,     
00683     dtmf8 = 56,     
00684     dtmf9 = 57,     
00685     dtmfA = 65,     
00686     dtmfB = 66,     
00687     dtmfC = 67,     
00688     dtmfD = 68,     
00689     dtmfStar = 42,  
00690     dtmfHash = 35   
00691   };
00692   
00694   virtual BYTE GetFullFrameType() { return dtmfType; }
00695   
00696  protected:
00697 };
00698 
00700 
00707 class IAX2FullFrameVoice : public IAX2FullFrame
00708 {
00709   PCLASSINFO(IAX2FullFrameVoice, IAX2FullFrame);
00710  public:
00711   
00714   IAX2FullFrameVoice(const IAX2Frame & srcFrame);
00715   
00718   IAX2FullFrameVoice(const IAX2FullFrame & srcFrame);
00719   
00728   IAX2FullFrameVoice(IAX2CallProcessor *processor, PBYTEArray &sound, 
00729                  PINDEX usersTimeStamp = 0);
00730   
00732   virtual ~IAX2FullFrameVoice();
00733 
00735   virtual PString GetSubClassName() const;
00736   
00739   static PString GetSubClassName(unsigned short testValue)
00740      { return GetSubClassName((unsigned int) testValue); }
00741 
00744   static PString GetSubClassName(unsigned int testValue);
00745   
00749   static PString GetOpalNameOfCodec(PINDEX testValue);
00750   
00752   static PString GetSubClassName(int testValue) 
00753     { return GetSubClassName((unsigned short) testValue); }
00754   
00757   static unsigned short OpalNameToIax2Value(const PString opalName);
00758 
00760   enum AudioSc {
00761     g7231    = 1,         
00762     gsm      = 2,         
00763     g711ulaw = 4,         
00764     g711alaw = 8,         
00765     mp3      = 0x10,      
00766     adpcm    = 0x20,      
00767     pcm      = 0x40,      
00768     lpc10    = 0x80,      
00769     g729     = 0x100,     
00770     speex    = 0x200,     
00771     ilbc     = 0x400,     
00772     supportedCodecs = 11  
00773   };
00774   
00776   virtual BYTE GetFullFrameType() { return voiceType; }
00777 };
00779 
00784 class IAX2FullFrameVideo : public IAX2FullFrame
00785 {
00786   PCLASSINFO(IAX2FullFrameVideo, IAX2FullFrame);
00787  public:
00788   
00791   IAX2FullFrameVideo(const IAX2Frame & srcFrame);
00792   
00795   IAX2FullFrameVideo(const IAX2FullFrame & srcFrame);
00796   
00798   virtual PString GetSubClassName() const;
00799   
00801   enum VideoSc {
00802     jpeg  = 0x10000,   
00803     png   = 0x20000,   
00804     h261  = 0x40000,   
00805     h263  = 0x80000    
00806   };
00807   
00809   virtual BYTE GetFullFrameType() { return videoType; }
00810  protected:
00811 };
00812 
00814 
00819 class IAX2FullFrameSessionControl : public IAX2FullFrame
00820 {
00821   PCLASSINFO(IAX2FullFrameSessionControl, IAX2FullFrame);
00822  public:
00823   
00825   enum SessionSc {
00826     hangup          = 1,     
00827     ring            = 2,     
00828     ringing         = 3,     
00829     answer          = 4,     
00830     busy            = 5,     
00831     tkoffhk         = 6,     
00832     offhook         = 7,     
00833     congestion      = 8,     
00834     flashhook       = 9,     
00835     wink            = 10,    
00836     option          = 11,    
00837     keyRadio        = 12,    
00838     unkeyRadio      = 13,    
00839     callProgress    = 14,    
00840     callProceeding  = 15,    
00841     callOnHold      = 16,    
00842     callHoldRelease = 17,    
00843     stopSounds      = 255    
00844   };
00845   
00846   
00847   
00850   IAX2FullFrameSessionControl(const IAX2Frame & srcFrame);
00851   
00854   IAX2FullFrameSessionControl(const IAX2FullFrame & srcFrame);
00855   
00858   IAX2FullFrameSessionControl(IAX2Processor *processor, 
00859                           PINDEX subClassValue
00860                           );
00861   
00864   IAX2FullFrameSessionControl(IAX2Processor *processor,     
00865                           SessionSc subClassValue 
00866                           );
00867   
00869   virtual ~IAX2FullFrameSessionControl() { }
00870 
00872   virtual PString GetSubClassName() const;
00873   
00875   virtual BYTE GetFullFrameType() { return controlType; }
00876   
00877  protected:
00878 };
00879 
00881 
00887 class IAX2FullFrameNull : public IAX2FullFrame
00888 {
00889   PCLASSINFO(IAX2FullFrameNull, IAX2FullFrame);
00890  public:
00893   IAX2FullFrameNull(IAX2EndPoint & endpoint) : IAX2FullFrame(endpoint)   { }
00894   
00898   IAX2FullFrameNull(const IAX2Frame & srcFrame);
00899   
00903   IAX2FullFrameNull(const IAX2FullFrame & srcFrame);
00904   
00906   virtual PString GetSubClassName() const { return  PString(""); }
00907   
00909   virtual BYTE GetFullFrameType() { return nullType; }
00910   
00911  protected:
00912 };
00913 
00915 
00921 class IAX2FullFrameProtocol : public IAX2FullFrame
00922 {
00923   PCLASSINFO(IAX2FullFrameProtocol, IAX2FullFrame);
00924  public:
00925   
00927   enum ProtocolSc {
00928     cmdNew       =  1,       
00929     cmdPing      =  2,       
00930     cmdPong      =  3,       
00931     cmdAck       =  4,       
00932     cmdHangup    =  5,       
00933     cmdReject    =  6,       
00934     cmdAccept    =  7,       
00935     cmdAuthReq   =  8,       
00936     cmdAuthRep   =  9,       
00937     cmdInval     =  10,      
00938     cmdLagRq     =  11,      
00939     cmdLagRp     =  12,      
00940     cmdRegReq    =  13,      
00941     cmdRegAuth   =  14,      
00942     cmdRegAck    =  15,      
00943     cmdRegRej    =  16,      
00944     cmdRegRel    =  17,      
00945     cmdVnak      =  18,      
00946     cmdDpReq     =  19,      
00947     cmdDpRep     =  20,      
00948     cmdDial      =  21,      
00949     cmdTxreq     =  22,      
00950     cmdTxcnt     =  23,      
00951     cmdTxacc     =  24,      
00952     cmdTxready   =  25,      
00953     cmdTxrel     =  26,      
00954     cmdTxrej     =  27,      
00955     cmdQuelch    =  28,      
00956     cmdUnquelch  =  29,      
00957     cmdPoke      =  30,      
00958     cmdPage      =  31,      
00959     cmdMwi       =  32,      
00960     cmdUnsupport =  33,      
00961     cmdTransfer  =  34,      
00962     cmdProvision =  35,      
00963     cmdFwDownl   =  36,      
00964     cmdFwData    =  37       
00965   };
00966   
00970   IAX2FullFrameProtocol(const IAX2Frame & srcFrame);
00971   
00975   IAX2FullFrameProtocol(const IAX2FullFrame & srcFrame);
00976   
00979   IAX2FullFrameProtocol(IAX2Processor *processor,         
00980                     PINDEX subClassValue,            
00981                     ConnectionRequired needCon = IAX2FullFrame::callActive
00983                     );
00984   
00987   IAX2FullFrameProtocol(IAX2Processor *processor,         
00988                     ProtocolSc  subClassValue,       
00989                     ConnectionRequired needCon=IAX2FullFrame::callActive 
00991                     );
00992   
00998   IAX2FullFrameProtocol(IAX2Processor *processor,         
00999                     ProtocolSc  subClassValue,       
01000                     IAX2FullFrame *inReplyTo,            
01001                     ConnectionRequired needCon = IAX2FullFrame::callActive
01003                     );
01004   
01006   virtual ~IAX2FullFrameProtocol();
01007   
01009   void SetRetransmissionRequired();
01010   
01012   virtual PBoolean InformationElementsPresent() { return !ieElements.IsEmpty(); }
01013   
01015   ProtocolSc GetSubClass() const { return (ProtocolSc) subClass; }
01016 
01018   virtual PString GetSubClassName() const; 
01019 
01021   static PString GetSubClassName(PINDEX t);
01022   
01025   IAX2Ie *GetIeAt(PINDEX i) {      return ieElements.GetIeAt(i); }
01026   
01028   void AppendIe(IAX2Ie *newElement) { ieElements.AppendIe(newElement); }
01029   
01032   void WriteIeAsBinaryData();
01033   
01037   void CopyDataFromIeListTo(IAX2IeData &res);
01038   
01041   void GetRemoteCapability(unsigned int & capability, unsigned int & preferred);
01042 
01044   virtual BYTE GetFullFrameType() { return iax2ProtocolType; }
01045   
01047   virtual void PrintOn(ostream & strm) const;
01048 
01049  protected:
01050   
01053   PBoolean ReadInformationElements();
01054   
01056   IAX2IeList ieElements;
01057 
01059 #if PTRACING
01060     friend ostream & operator<<(ostream & o, ProtocolSc t);
01061 #endif
01062 };
01063 
01065 
01070 class IAX2FullFrameText : public IAX2FullFrame
01071 {
01072   PCLASSINFO(IAX2FullFrameText, IAX2FullFrame);
01073  public:
01074 
01077   IAX2FullFrameText(IAX2Processor *processor,       
01078                 const PString&  textValue
01079                 );
01080   
01083   IAX2FullFrameText(const IAX2Frame & srcFrame);
01084   
01087   IAX2FullFrameText(const IAX2FullFrame & srcFrame);
01088   
01090   virtual PString GetSubClassName() const;
01091   
01093   virtual BYTE GetFullFrameType() { return textType; }
01094 
01096   PString GetTextString() const;
01097 
01098  protected:
01099 
01101   PString internalText;
01102 };
01104 
01109 class IAX2FullFrameImage : public IAX2FullFrame
01110 {
01111   PCLASSINFO(IAX2FullFrameImage, IAX2FullFrame);
01112  public:
01113   
01116   IAX2FullFrameImage(const IAX2Frame & srcFrame);
01117   
01120   IAX2FullFrameImage(const IAX2FullFrame & srcFrame);
01121   
01123   virtual PString GetSubClassName() const;
01124   
01126   virtual BYTE GetFullFrameType() { return imageType; }
01127  protected:
01128 };
01129 
01131 
01136 class IAX2FullFrameHtml : public IAX2FullFrame
01137 {
01138   PCLASSINFO(IAX2FullFrameHtml, IAX2FullFrame);
01139  public:
01140   
01143   IAX2FullFrameHtml(const IAX2Frame & srcFrame);
01144   
01147   IAX2FullFrameHtml(const IAX2FullFrame & srcFrame);
01148   
01150   virtual PString GetSubClassName() const;
01151   
01153   virtual BYTE GetFullFrameType() { return htmlType; }
01154  protected:
01155 };
01156 
01158 
01162 class IAX2FullFrameCng : public IAX2FullFrame
01163 {
01164   PCLASSINFO(IAX2FullFrameCng, IAX2FullFrame);
01165  public:
01166   
01169   IAX2FullFrameCng(const IAX2Frame & srcFrame);
01170   
01173   IAX2FullFrameCng(const IAX2FullFrame & srcFrame);
01174   
01176   virtual PString GetSubClassName() const;
01177   
01179   virtual BYTE GetFullFrameType() { return cngType; }
01180  protected:
01181 };
01182 
01184 
01185 PDECLARE_LIST (IAX2FrameList, IAX2Frame *)
01186 #ifdef DOC_PLUS_PLUS     //This makes emacs bracket matching code happy.
01187 
01193 class IAX2FrameList : public IAX2Frame *  
01194 {
01195 #endif
01196  public:
01197   ~IAX2FrameList();
01198   
01200   void ReportList(PString & answer);
01201   
01203   IAX2Frame *GetLastFrame();
01204   
01206   void Initialise();
01207     
01209   PBoolean Empty() { return GetSize() == 0; }
01210   
01212   void GrabContents(IAX2FrameList &src);
01213   
01216   void DeleteMatchingSendFrame(IAX2FullFrame *reply);
01217 
01221   void SendVnakRequestedFrames(IAX2FullFrameProtocol &src);
01222 
01224   void AddNewFrame(IAX2Frame *src);
01225   
01227   void GetResendFramesDeleteOldFrames(IAX2FrameList & framesToSend);
01228   
01230   virtual PINDEX GetSize() { PWaitAndSignal m(mutex); return PAbstractList::GetSize(); }
01231   
01233   void MarkAllAsResent();
01234   
01235  protected:
01237   virtual PINDEX GetEntries() { return PAbstractList::GetSize(); }
01238   
01240   PMutex mutex;
01241 };
01242 
01244 
01248 class IAX2ActiveFrameList : public IAX2FrameList
01249 {
01250   PCLASSINFO(IAX2ActiveFrameList, IAX2FrameList);
01251  public:
01252   IAX2ActiveFrameList() { Initialise(); }
01253 };
01255 
01256 
01257 #endif // FRAME_H
01258 /* The comment below is magic for those who use emacs to edit this file. */
01259 /* With the comment below, the tab key does auto indent to 2 spaces.     */
01260 
01261 /*
01262  * Local Variables:
01263  * mode:c
01264  * c-basic-offset:2
01265  * End:
01266  */
01267 
01268 
01269 

Generated on Mon Sep 22 12:24:21 2008 for OPAL by  doxygen 1.5.1