00001 
00002 
00003 
00004 
00005 
00006 
00007 
00008 
00009 
00010 
00011 
00012 
00013 
00014 
00015 
00016 
00017 
00018 
00019 
00020 
00021 
00022 
00023 
00024 
00025 
00026 
00027 
00028 
00029 
00030 
00031 
00032 #ifndef OPAL_IAX2_IES_H
00033 #define OPAL_IAX2_IES_H
00034 
00035 #ifndef _PTLIB_H
00036 #include <ptlib.h>
00037 #endif
00038 
00039 #include <opal/buildopts.h>
00040 
00041 #if OPAL_IAX2
00042 
00043 #include <ptlib/sockets.h>
00044 #include <iax2/iedata.h>
00045 
00046 #ifdef P_USE_PRAGMA
00047 #pragma interface
00048 #endif
00049 
00050 
00051 class IAX2Ie;
00052 class IAX2Encryption;
00053 
00055 class IAX2Ie : public PObject
00056 { 
00057   PCLASSINFO(IAX2Ie, PObject);
00058  public:
00060   enum IAX2IeTypeCode {    
00061     ie_calledNumber      = 1,     
00062     ie_callingNumber     = 2,     
00063     ie_callingAni        = 3,     
00064     ie_callingName       = 4,     
00065     ie_calledContext     = 5,     
00066     ie_userName          = 6,     
00067     ie_password          = 7,     
00068     ie_capability        = 8,     
00069     ie_format            = 9,     
00070     ie_language          = 10,    
00071     ie_version           = 11,    
00072     ie_adsicpe           = 12,    
00073     ie_dnid              = 13,    
00074     ie_authMethods       = 14,    
00075     ie_challenge         = 15,    
00076     ie_md5Result         = 16,    
00077     ie_rsaResult         = 17,    
00078     ie_apparentAddr      = 18,    
00079     ie_refresh           = 19,    
00080     ie_dpStatus          = 20,    
00081     ie_callNo            = 21,    
00082     ie_cause             = 22,    
00083     ie_iaxUnknown        = 23,    
00084     ie_msgCount          = 24,    
00085     ie_autoAnswer        = 25,    
00086     ie_musicOnHold       = 26,    
00087     ie_transferId        = 27,    
00088     ie_rdnis             = 28,    
00089     ie_provisioning      = 29,    
00090     ie_aesProvisioning   = 30,    
00091     ie_dateTime          = 31,    
00092     ie_deviceType        = 32,    
00093     ie_serviceIdent      = 33,    
00094     ie_firmwareVer       = 34,    
00095     ie_fwBlockDesc       = 35,    
00096     ie_fwBlockData       = 36,    
00097     ie_provVer           = 37,    
00098     ie_callingPres       = 38,    
00099     ie_callingTon        = 39,    
00100     ie_callingTns        = 40,    
00101     ie_samplingRate      = 41,    
00102     ie_causeCode         = 42,    
00103     ie_encryption        = 43,    
00104     ie_encKey            = 44,    
00105     ie_codecPrefs        = 45,    
00106     ie_recJitter         = 46,    
00107     ie_recLoss           = 47,    
00108     ie_recPackets        = 48,    
00109     ie_recDelay          = 49,    
00110     ie_recDropped        = 50,    
00111     ie_recOoo            = 51     
00112   };
00113   
00116   
00118   IAX2Ie();
00119   
00121   virtual ~IAX2Ie() { };
00123   
00127   static IAX2Ie *BuildInformationElement(BYTE _typeCode, BYTE length, BYTE *srcData);     
00128   
00130   virtual PBoolean IsValid() { return validData; }
00131   
00133   virtual BYTE GetLengthOfData() { return 0; }
00134   
00136   int GetBinarySize() { return 2 + GetLengthOfData(); }
00137   
00139   void PrintOn(ostream & str) const;
00140   
00142   virtual BYTE GetKeyValue() const  { return 255; }
00143   
00145   void SetData(int &) { PAssertAlways("Ie class cannnot set data value"); };
00146   
00148   int ReadData() { PAssertAlways("Ie class cannot read the internal data value"); return 0; };
00149   
00152   void WriteBinary(void *data, PINDEX & writeIndex);
00153   
00156   virtual void StoreDataIn(IAX2IeData &) { PAssertAlways(PUnimplementedFunction); }     
00158   
00159  protected:
00161   virtual void WriteBinary(BYTE * ) { PAssertAlways(PUnimplementedFunction); }
00162   
00165   PBoolean   validData;
00166 };
00167 
00169 
00170 class IAX2IeInvalidElement : public IAX2Ie
00171 {
00172   PCLASSINFO(IAX2IeInvalidElement, IAX2Ie);
00173  public:
00174   IAX2IeInvalidElement() : IAX2Ie() {};
00175   
00177   virtual BYTE GetlengthOfData() { return 0; }
00178   
00180   void PrintOn(ostream & str) const
00181     { str << "Invlalid Information Element" << endl; }
00182  protected:
00185   virtual void WriteBinary(BYTE * ) {  }
00186 };
00188 
00189 class IAX2IeNone : public IAX2Ie
00190 {
00191   PCLASSINFO(IAX2IeNone, IAX2Ie);
00194   
00198   IAX2IeNone(BYTE length, BYTE *srcData);     
00199   
00201   IAX2IeNone() : IAX2Ie() {}
00203   
00207   virtual BYTE GetLengthOfData() { return 0; }
00208   
00210   BYTE GetValue() { return 0; }
00211   
00213   void PrintOn(ostream & str) const;
00214   
00216   void SetData(void * ) { PAssertAlways("IeNone cannot set data"); }
00217   
00219   int ReadData() { PAssertAlways("IeNone cannot read the internal data value"); return 0; }
00220   
00222  protected:
00225   virtual void WriteBinary(BYTE * ) {  }
00226 };
00227 
00229 
00230 class IAX2IeByte : public IAX2Ie
00231 {
00232   PCLASSINFO(IAX2IeByte, IAX2Ie);
00235   
00239   IAX2IeByte(BYTE length, BYTE *srcData);     
00240   
00242   IAX2IeByte(BYTE newValue) : IAX2Ie() { SetData(newValue); }
00243   
00245   IAX2IeByte() : IAX2Ie() { }
00247   
00251   virtual BYTE GetLengthOfData() { return sizeof(dataValue); }
00252   
00254   void PrintOn(ostream & str) const;
00255   
00257   void SetData(BYTE newData) { dataValue = newData; validData = PTrue; }
00258   
00260   BYTE ReadData() { return dataValue; }
00261   
00263  protected:
00265   virtual void WriteBinary(BYTE *data) { data[0] = dataValue; }
00266   
00268   BYTE dataValue;
00269 };
00270 
00272 
00273 class IAX2IeChar : public IAX2Ie
00274 {
00275   PCLASSINFO(IAX2IeChar, IAX2Ie);
00278   
00282   IAX2IeChar(BYTE length, BYTE *srcData);     
00283   
00285   IAX2IeChar(char newValue) : IAX2Ie() { SetData(newValue); }
00286   
00288   IAX2IeChar() : IAX2Ie() { }
00290   
00294   virtual BYTE GetLengthOfData() { return sizeof(dataValue); }
00295   
00297   void PrintOn(ostream & str) const;
00298   
00300   void SetData(char newData) { dataValue = newData; validData = PTrue; }
00301   
00303   char ReadData() { return dataValue; }
00304   
00306  protected:
00308   virtual void WriteBinary(BYTE *data) { data[0] = dataValue; }
00309   
00311   char dataValue;
00312 };
00313 
00315 
00316 class IAX2IeShort : public IAX2Ie
00317 {
00318   PCLASSINFO(IAX2IeShort, IAX2Ie);
00321   
00325   IAX2IeShort(BYTE length, BYTE *srcData);     
00326   
00328   IAX2IeShort(short newValue) : IAX2Ie() { SetData(newValue); }
00329   
00331   IAX2IeShort() : IAX2Ie() { }
00333   
00337   virtual BYTE GetLengthOfData() { return sizeof(dataValue); }
00338   
00340   void PrintOn(ostream & str) const;
00341   
00343   void SetData(short newData) { dataValue = newData; validData = PTrue; }
00344   
00346   short ReadData() { return dataValue; }  
00348  protected:
00350   virtual void WriteBinary(BYTE *data);
00351   
00353   short dataValue;
00354 };
00356 
00357 class IAX2IeInt : public IAX2Ie
00358 {
00359   PCLASSINFO(IAX2IeInt, IAX2Ie);
00362   
00366   IAX2IeInt(BYTE length, BYTE *srcData);     
00367   
00369   IAX2IeInt(int  newValue) : IAX2Ie() { SetData(newValue); }
00370   
00372   IAX2IeInt() : IAX2Ie() { }
00374   
00378   virtual BYTE GetLengthOfData() { return sizeof(dataValue); }
00379   
00381   void PrintOn(ostream & str) const;
00382   
00384   void SetData(int newData) { dataValue = newData; validData = PTrue; }
00385   
00387   int ReadData() { return dataValue; }
00388   
00390  protected:
00392   virtual void WriteBinary(BYTE *data);
00393   
00395   int dataValue;
00396 };
00398 
00399 class IAX2IeUShort : public IAX2Ie
00400 {
00401   PCLASSINFO(IAX2IeUShort, IAX2Ie);
00404   
00408   IAX2IeUShort(BYTE length, BYTE *srcData);     
00409   
00411   IAX2IeUShort(unsigned short newValue) : IAX2Ie() { SetData(newValue); }
00412   
00414   IAX2IeUShort() : IAX2Ie() {}
00416   
00420   virtual BYTE GetLengthOfData() { return sizeof(dataValue); }
00421   
00423   void PrintOn(ostream & str) const;
00424   
00426   void SetData(unsigned short newData) { dataValue = newData; validData = PTrue; }
00427   
00429   unsigned short ReadData() { return dataValue; }         
00431  protected:
00433   virtual void WriteBinary(BYTE *data);
00434   
00436   unsigned short dataValue;
00437 };
00439 
00440 class IAX2IeUInt : public IAX2Ie
00441 {
00442   PCLASSINFO(IAX2IeUInt, IAX2Ie);
00445   
00449   IAX2IeUInt(BYTE length, BYTE *srcData);     
00450   
00452   IAX2IeUInt() : IAX2Ie() {}
00453   
00455   IAX2IeUInt(unsigned int newValue) { SetData(newValue); }
00457   
00461   virtual BYTE GetLengthOfData() { return sizeof(dataValue); }
00462   
00464   void PrintOn(ostream & str) const;
00465   
00467   void SetData(unsigned int &newData) { dataValue = newData; validData = PTrue; }
00468   
00470   unsigned int ReadData() { return dataValue; }          
00472   
00473  protected:
00475   virtual void WriteBinary(BYTE *data);
00476   
00478   unsigned int dataValue;
00479 };
00480 
00482 
00483 class IAX2IeString : public IAX2Ie
00484 {
00485   PCLASSINFO(IAX2IeString, IAX2Ie);
00488   
00489  public:
00493   IAX2IeString(BYTE length, BYTE *srcData);     
00494   
00496   IAX2IeString(const PString & newValue) : IAX2Ie() { SetData(newValue); }
00497   
00499   IAX2IeString(const char * newValue) : IAX2Ie() { SetData(newValue); }
00500   
00502   IAX2IeString() : IAX2Ie() {}
00504   
00508   virtual BYTE GetLengthOfData();
00509   
00511   void PrintOn(ostream & str) const;
00512   
00514   void SetData(const PString & newData);
00515   
00517   void SetData(const char * newData);
00518   
00520   PString ReadData() { return dataValue; }          
00522   
00523  protected:
00525   virtual void WriteBinary(BYTE *data);
00526   
00528   PString dataValue;
00529 };
00531 
00532 class IAX2IeDateAndTime : public IAX2Ie
00533 {
00534   PCLASSINFO(IAX2IeDateAndTime, IAX2Ie);
00537   
00538  public:
00542   IAX2IeDateAndTime(BYTE length, BYTE *srcData);     
00543   
00545   IAX2IeDateAndTime(const PTime & newValue) : IAX2Ie() { SetData(newValue); }
00546   
00548   IAX2IeDateAndTime() : IAX2Ie() {}
00550   
00554   void PrintOn(ostream & str) const;
00555   
00557   virtual BYTE GetLengthOfData() { return 4; }
00558   
00560   void SetData(const PTime & newData) { dataValue = newData; validData = PTrue; }
00561   
00563   PTime ReadData() { return dataValue; }
00565  protected:
00567   virtual void WriteBinary(BYTE *data);
00568   
00570   PTime dataValue;
00571 };
00573 
00574 class IAX2IeBlockOfData : public IAX2Ie
00575 {
00576   PCLASSINFO(IAX2IeBlockOfData, IAX2Ie);
00579   
00580  public:
00584   IAX2IeBlockOfData(BYTE length, BYTE *srcData);     
00585   
00587   IAX2IeBlockOfData(const PBYTEArray & newData) : IAX2Ie() { SetData(newData); }
00588   
00590   IAX2IeBlockOfData() : IAX2Ie() {}
00592   
00596   void PrintOn(ostream & str) const;
00597   
00599   virtual BYTE GetLengthOfData() { return (BYTE)dataValue.GetSize(); }
00600   
00602   void SetData(const PBYTEArray & newData) { dataValue = newData; validData = PTrue; }
00603   
00605   PBYTEArray ReadData() { return dataValue; }
00606   
00608  protected:
00610   virtual void WriteBinary(BYTE *data);
00611   
00613   PBYTEArray dataValue;
00614 };
00616 
00617 class IAX2IeSockaddrIn : public IAX2Ie
00618 {
00619   PCLASSINFO(IAX2IeSockaddrIn, IAX2Ie);
00622   
00623  public:
00627   IAX2IeSockaddrIn(BYTE length, BYTE *srcData);     
00628   
00630   IAX2IeSockaddrIn(const PIPSocket::Address & addr, PINDEX port) : IAX2Ie() { SetData(addr, port); }
00631   
00633   IAX2IeSockaddrIn() : IAX2Ie() {}
00634   
00636   ~IAX2IeSockaddrIn() { } ;
00638   
00642   void PrintOn(ostream & str) const;
00643   
00645   virtual BYTE GetLengthOfData() { return sizeof(struct sockaddr_in); }
00646   
00647   
00649   void SetData(const PIPSocket::Address & newAddr, PINDEX newPort) 
00650     { dataValue = newAddr; portNumber = newPort; validData = PTrue; }
00651   
00653   PIPSocket::Address ReadData() { return dataValue; }
00654   
00656  protected:
00658   virtual void WriteBinary(BYTE *data);
00659   
00661   PIPSocket::Address dataValue;
00662   
00664   PINDEX               portNumber;
00665 };
00666 
00668 
00669 class IAX2IeCalledNumber : public IAX2IeString
00670 {
00671   PCLASSINFO(IAX2IeCalledNumber, IAX2IeString);
00672  public:
00676   IAX2IeCalledNumber(BYTE length, BYTE *srcData) : IAX2IeString(length, srcData) {};
00677   
00679   IAX2IeCalledNumber(const PString & newValue) { SetData(newValue); }
00680   
00682   void PrintOn(ostream & str) const;
00683   
00685   virtual BYTE GetKeyValue() const  { return ie_calledNumber; }
00686   
00689   virtual void StoreDataIn(IAX2IeData &res) { res.calledNumber = dataValue; }
00690  protected:
00691 };
00693 
00694 class IAX2IeCallingNumber : public IAX2IeString
00695 {
00696   PCLASSINFO(IAX2IeCallingNumber, IAX2IeString);
00697  public:
00701   IAX2IeCallingNumber(BYTE length, BYTE *srcData) : IAX2IeString(length, srcData) { };
00702   
00704   IAX2IeCallingNumber(const PString & newValue)  { SetData(newValue); } 
00705   
00707   void PrintOn(ostream & str) const;
00708   
00710   virtual BYTE GetKeyValue() const  { return ie_callingNumber; }
00711   
00714   virtual void StoreDataIn(IAX2IeData &res) { res.callingNumber = dataValue; }     
00715  protected:
00716 };
00717 
00719 
00720 class IAX2IeCallingAni : public IAX2IeString
00721 {
00722   PCLASSINFO(IAX2IeCallingAni, IAX2IeString);
00723  public:
00727   IAX2IeCallingAni(BYTE length, BYTE *srcData) : IAX2IeString(length, srcData) { };
00728   
00730   IAX2IeCallingAni(const PString & newValue) { SetData(newValue); }
00731   
00733   void PrintOn(ostream & str) const;
00734   
00736   virtual BYTE GetKeyValue() const  { return ie_callingAni; }
00737   
00740   virtual void StoreDataIn(IAX2IeData &res) { res.callingAni = dataValue; }     
00741  protected:
00742 };
00743 
00745 
00746 class IAX2IeCallingName : public IAX2IeString
00747 {
00748   PCLASSINFO(IAX2IeCallingName, IAX2IeString);
00749  public:
00753   IAX2IeCallingName(BYTE length, BYTE *srcData) : IAX2IeString(length, srcData) { };
00754   
00756   IAX2IeCallingName(const PString & newValue) { SetData(newValue); }
00757   
00759   void PrintOn(ostream & str) const;
00760   
00762   virtual BYTE GetKeyValue() const  { return ie_callingName; }
00763   
00766   virtual void StoreDataIn(IAX2IeData &res) { res.callingName = dataValue; }     
00767  protected:
00768 };
00769 
00771 
00772 class IAX2IeCalledContext : public IAX2IeString
00773 {
00774   PCLASSINFO(IAX2IeCalledContext, IAX2IeString);
00775  public:
00779   IAX2IeCalledContext(BYTE length, BYTE *srcData) : IAX2IeString(length, srcData) { };
00780   
00782   IAX2IeCalledContext(const PString & newValue) { SetData(newValue); }
00783   
00785   void PrintOn(ostream & str) const;
00786   
00788   virtual BYTE GetKeyValue() const  { return ie_calledContext; }
00789   
00792   virtual void StoreDataIn(IAX2IeData &res) { res.calledContext = dataValue; }     
00793  protected:
00794 };
00795 
00797 
00798 class IAX2IeUserName : public IAX2IeString
00799 {
00800   PCLASSINFO(IAX2IeUserName, IAX2IeString);
00801  public:
00805   IAX2IeUserName(BYTE length, BYTE *srcData) : IAX2IeString(length, srcData) { };
00806   
00808   IAX2IeUserName(const PString & newValue)  { SetData(newValue); }
00809   
00811   void PrintOn(ostream & str) const;
00812   
00814   virtual BYTE GetKeyValue() const  { return ie_userName; }
00815   
00818   virtual void StoreDataIn(IAX2IeData &res) { res.userName = dataValue; }     
00819  protected:
00820 };
00821 
00823 
00824 class IAX2IePassword : public IAX2IeString
00825 {
00826   PCLASSINFO(IAX2IePassword, IAX2IeString);
00827  public:
00831   IAX2IePassword(BYTE length, BYTE *srcData) : IAX2IeString(length, srcData) { };
00832   
00834   IAX2IePassword(const PString & newValue) { SetData(newValue); }
00835   
00837   void PrintOn(ostream & str) const;
00838   
00840   virtual BYTE GetKeyValue() const  { return ie_password; }
00841   
00844   virtual void StoreDataIn(IAX2IeData &res) { res.password = dataValue; }     
00845  protected:
00846 };
00847 
00849 
00850 class IAX2IeCapability : public IAX2IeUInt
00851 {
00852   PCLASSINFO(IAX2IeCapability, IAX2IeUInt);
00853  public:
00857   IAX2IeCapability(BYTE length, BYTE *srcData) : IAX2IeUInt(length, srcData) { };
00858   
00860   IAX2IeCapability(unsigned int newValue) : IAX2IeUInt(newValue) { }
00861   
00863   void PrintOn(ostream & str) const;
00864   
00866   virtual BYTE GetKeyValue() const  { return ie_capability; }
00867   
00870   virtual void StoreDataIn(IAX2IeData &res) { res.capability = dataValue; }     
00871  protected:
00872 };
00873 
00875 
00876 class IAX2IeFormat : public IAX2IeUInt
00877 {
00878   PCLASSINFO(IAX2IeFormat, IAX2IeUInt);
00879  public:
00883   IAX2IeFormat(BYTE length, BYTE *srcData) : IAX2IeUInt(length, srcData) { };
00884   
00886   IAX2IeFormat(unsigned int newValue) : IAX2IeUInt(newValue) { }
00887   
00889   void PrintOn(ostream & str) const;
00890   
00892   virtual BYTE GetKeyValue() const  { return ie_format; }
00893   
00896   virtual void StoreDataIn(IAX2IeData &res) { res.format = dataValue; }     
00897  protected:
00898 };
00899 
00901 
00902 class IAX2IeLanguage : public IAX2IeString
00903 {
00904   PCLASSINFO(IAX2IeLanguage, IAX2IeString);
00905  public:
00909   IAX2IeLanguage(BYTE length, BYTE *srcData) : IAX2IeString(length, srcData) { };
00910   
00912   IAX2IeLanguage(const PString & newValue) { SetData(newValue); }
00913   
00915   void PrintOn(ostream & str) const;
00916   
00918   virtual BYTE GetKeyValue() const  { return ie_language; }
00919   
00922   virtual void StoreDataIn(IAX2IeData &res) { res.language = dataValue; }     
00923  protected:
00924 };
00925 
00927 
00928 class IAX2IeVersion : public IAX2IeShort
00929 {
00930   PCLASSINFO(IAX2IeVersion, IAX2IeShort);
00931  public:
00935   IAX2IeVersion(BYTE length, BYTE *srcData) : IAX2IeShort(length, srcData) { };
00936   
00938   IAX2IeVersion() { dataValue = 2; validData = PTrue; }
00939   
00941   void PrintOn(ostream & str) const;
00942   
00944   virtual BYTE GetKeyValue() const  { return ie_version; }
00945   
00948   virtual void StoreDataIn(IAX2IeData &res) { res.version = dataValue; }     
00949  protected:
00950 };
00951 
00953 
00954 class IAX2IeAdsicpe : public IAX2IeShort
00955 {
00956   PCLASSINFO(IAX2IeAdsicpe, IAX2IeShort);
00957  public:
00961   IAX2IeAdsicpe(BYTE length, BYTE *srcData) : IAX2IeShort(length, srcData) { };
00962   
00964   void PrintOn(ostream & str) const;
00965   
00967   virtual BYTE GetKeyValue() const  { return ie_adsicpe; }
00968   
00971   virtual void StoreDataIn(IAX2IeData &res) { res.adsicpe = dataValue; }     
00972  protected:
00973 };
00974 
00976 
00977 class IAX2IeDnid : public IAX2IeString
00978 {
00979   PCLASSINFO(IAX2IeDnid, IAX2IeString);
00980  public:
00984   IAX2IeDnid(BYTE length, BYTE *srcData) : IAX2IeString(length, srcData) { };
00985   
00987   IAX2IeDnid(const PString & newValue)  { SetData(newValue); }
00988   
00990   void PrintOn(ostream & str) const;
00991   
00993   virtual BYTE GetKeyValue() const  { return ie_dnid; }
00994   
00997   virtual void StoreDataIn(IAX2IeData &res) { res.dnid = dataValue; }     
00998  protected:
00999 };
01000 
01002 
01003 class IAX2IeAuthMethods : public IAX2IeShort
01004 {
01005   PCLASSINFO(IAX2IeAuthMethods, IAX2IeShort);
01006  public:
01010   IAX2IeAuthMethods(BYTE length, BYTE *srcData) : IAX2IeShort(length, srcData) { };
01011   
01013   IAX2IeAuthMethods(short newValue) { SetData(newValue); }
01014   
01016   void PrintOn(ostream & str) const;
01017   
01019   virtual BYTE GetKeyValue() const  { return ie_authMethods; }
01020   
01023   virtual void StoreDataIn(IAX2IeData &res) { res.authMethods = dataValue; }     
01024   
01026   static PBoolean IsRsaAuthentication(short testValue) { return InternalIsRsa(testValue); }
01027   
01029   static PBoolean IsMd5Authentication(short testValue) { return InternalIsMd5(testValue); }
01030   
01032   static PBoolean IsPlainTextAuthentication(short testValue) { return InternalIsPlainText(testValue); }     
01033   
01035   PBoolean IsRsaAuthentication() { if (IsValid()) return InternalIsRsa(dataValue); else return PFalse; }
01036   
01038   PBoolean IsMd5Authentication() { if (IsValid()) return InternalIsMd5(dataValue); else return PFalse; }
01039   
01041   PBoolean IsPlainTextAuthentication() { if (IsValid()) return InternalIsPlainText(dataValue); else return PFalse; }
01042   
01043  protected:
01044   
01046   static PBoolean InternalIsRsa(short testValue) { return testValue  & 0x04; }
01047   
01049   static PBoolean InternalIsMd5(short testValue) { return testValue  & 0x02; }
01050   
01052   static PBoolean InternalIsPlainText(short testValue) { return testValue  & 0x01; }
01053 };
01054 
01056 
01057 class IAX2IeChallenge : public IAX2IeString
01058 {
01059   PCLASSINFO(IAX2IeChallenge, IAX2IeString);
01060  public:
01064   IAX2IeChallenge(BYTE length, BYTE *srcData) : IAX2IeString(length, srcData) { };
01065   
01067   IAX2IeChallenge(const PString & newValue) { SetData(newValue); }
01068   
01070   void PrintOn(ostream & str) const;
01071   
01073   virtual BYTE GetKeyValue() const  { return ie_challenge; }
01074   
01077   virtual void StoreDataIn(IAX2IeData &res) { res.challenge = dataValue; }     
01078  protected:
01079 };
01080 
01082 
01083 class IAX2IeMd5Result : public IAX2IeString
01084 {
01085   PCLASSINFO(IAX2IeMd5Result, IAX2IeString);
01086  public:
01090   IAX2IeMd5Result(BYTE length, BYTE *srcData) : IAX2IeString(length, srcData) { };
01091   
01093   IAX2IeMd5Result(const PString & newValue) { SetData(newValue); }
01094   
01096   IAX2IeMd5Result(const PString & challenge, const PString & password);
01097   
01099   IAX2IeMd5Result(IAX2Encryption & encryption);
01100   
01102   void InitializeChallengePassword(const PString & newChallenge, const PString & newPassword);
01103 
01105   void PrintOn(ostream & str) const;
01106   
01108   virtual BYTE GetKeyValue() const  { return ie_md5Result; }
01109   
01112   virtual void StoreDataIn(IAX2IeData &res) { res.md5Result = dataValue; }     
01113 
01116   PBYTEArray & GetDataBlock() { return dataBlock; }
01117 
01118  protected:
01119 
01121   PBYTEArray dataBlock;
01122 };
01123 
01125 
01126 class IAX2IeRsaResult : public IAX2IeString
01127 {
01128   PCLASSINFO(IAX2IeRsaResult, IAX2IeString);
01129  public:
01133   IAX2IeRsaResult(BYTE length, BYTE *srcData) : IAX2IeString(length, srcData) { };
01134   
01136   IAX2IeRsaResult(const PString & newValue) { SetData(newValue); }
01137   
01139   void PrintOn(ostream & str) const;
01140   
01142   virtual BYTE GetKeyValue() const  { return ie_rsaResult; }
01143   
01146   virtual void StoreDataIn(IAX2IeData &res) { res.rsaResult = dataValue; }
01147  protected:
01148 };
01149 
01151 
01152 class IAX2IeApparentAddr : public IAX2IeSockaddrIn
01153 {
01154   PCLASSINFO(IAX2IeApparentAddr, IAX2IeSockaddrIn);
01155  public:
01159   IAX2IeApparentAddr(BYTE length, BYTE *srcData) : IAX2IeSockaddrIn(length, srcData) { };
01160   
01162   ~IAX2IeApparentAddr() { };
01163   
01165   void PrintOn(ostream & str) const;
01166   
01168   virtual BYTE GetKeyValue() const  { return ie_apparentAddr; }
01169   
01172   virtual void StoreDataIn(IAX2IeData &res) { res.apparentAddr = dataValue; }     
01173  protected:
01174 };
01175 
01177 
01178 class IAX2IeRefresh : public IAX2IeShort
01179 {
01180   PCLASSINFO(IAX2IeRefresh, IAX2IeShort);
01181  public:
01185   IAX2IeRefresh(BYTE length, BYTE *srcData) : IAX2IeShort(length, srcData) { };
01186   
01188   IAX2IeRefresh(short refreshTime) : IAX2IeShort(refreshTime) { };
01189   
01191   void PrintOn(ostream & str) const;
01192   
01194   virtual BYTE GetKeyValue() const  { return ie_refresh; }
01195   
01198   virtual void StoreDataIn(IAX2IeData &res) { res.refresh = dataValue; }     
01199  protected:
01200 };
01201 
01203 
01204 class IAX2IeDpStatus : public IAX2IeShort
01205 {
01206   PCLASSINFO(IAX2IeDpStatus, IAX2IeShort);
01207  public:
01211   IAX2IeDpStatus(BYTE length, BYTE *srcData) : IAX2IeShort(length, srcData) { };
01212   
01214   void PrintOn(ostream & str) const;
01215   
01217   virtual BYTE GetKeyValue() const  { return ie_dpStatus; }
01218   
01221   virtual void StoreDataIn(IAX2IeData &res) { res.dpStatus = dataValue; }     
01222  protected:
01223 };
01224 
01226 
01227 class IAX2IeCallNo : public IAX2IeShort
01228 {
01229   PCLASSINFO(IAX2IeCallNo, IAX2IeShort);
01230  public:
01234   IAX2IeCallNo(BYTE length, BYTE *srcData) : IAX2IeShort(length, srcData) { };
01235   
01237   void PrintOn(ostream & str) const;
01238   
01240   virtual BYTE GetKeyValue() const  { return ie_callNo; }
01241   
01244   virtual void StoreDataIn(IAX2IeData &res) { res.callNo = dataValue; }     
01245  protected:
01246 };
01247 
01249 
01250 class IAX2IeCause : public IAX2IeString
01251 {
01252   PCLASSINFO(IAX2IeCause, IAX2IeString);
01253  public:
01257   IAX2IeCause(BYTE length, BYTE *srcData) : IAX2IeString(length, srcData) { };
01258   
01260   IAX2IeCause(const PString & newValue) : IAX2IeString(newValue) { }
01261   
01263   IAX2IeCause(const char *newValue) : IAX2IeString(newValue) { }
01264   
01266   void PrintOn(ostream & str) const;
01267   
01269   virtual BYTE GetKeyValue() const  { return ie_cause; }
01270   
01273   virtual void StoreDataIn(IAX2IeData &res) { res.cause = dataValue; }     
01274  protected:
01275 };
01276 
01278 
01279 class IAX2IeIaxUnknown : public IAX2IeByte
01280 {
01281   PCLASSINFO(IAX2IeIaxUnknown, IAX2IeByte);
01282  public:
01286   IAX2IeIaxUnknown(BYTE length, BYTE *srcData) : IAX2IeByte(length, srcData) { };
01287   
01289   IAX2IeIaxUnknown(BYTE newValue) : IAX2IeByte(newValue) { }
01290   
01292   void PrintOn(ostream & str) const;
01293   
01295   virtual BYTE GetKeyValue() const  { return ie_iaxUnknown; }
01296   
01299   virtual void StoreDataIn(IAX2IeData &res) { res.iaxUnknown = dataValue; }     
01300  protected:
01301 };
01302 
01304 
01305 class IAX2IeMsgCount : public IAX2IeShort
01306 {
01307   PCLASSINFO(IAX2IeMsgCount, IAX2IeShort);
01308  public:
01312   IAX2IeMsgCount(BYTE length, BYTE *srcData) : IAX2IeShort(length, srcData) { };
01313   
01315   void PrintOn(ostream & str) const;
01316   
01318   virtual BYTE GetKeyValue() const  { return ie_msgCount; }
01319   
01322   virtual void StoreDataIn(IAX2IeData &res) { res.msgCount = dataValue; }     
01323  protected:
01324 };
01325 
01327 
01328 class IAX2IeAutoAnswer : public IAX2IeNone
01329 {
01330   PCLASSINFO(IAX2IeAutoAnswer, IAX2IeNone);
01331  public:
01335   IAX2IeAutoAnswer(BYTE length, BYTE *srcData) : IAX2IeNone(length, srcData) { };
01336   
01338   void PrintOn(ostream & str) const;
01339   
01341   virtual BYTE GetKeyValue() const  { return ie_autoAnswer; }
01342   
01345   virtual void StoreDataIn(IAX2IeData &res) { res.autoAnswer = PTrue;; }     
01346  protected:
01347 };
01348 
01350 
01351 class IAX2IeMusicOnHold : public IAX2IeNone
01352 {
01353   PCLASSINFO(IAX2IeMusicOnHold, IAX2IeNone);
01354  public:
01358   IAX2IeMusicOnHold(BYTE length, BYTE *srcData) : IAX2IeNone(length, srcData) { };
01359   
01361   IAX2IeMusicOnHold() : IAX2IeNone() { };
01362   
01364   void PrintOn(ostream & str) const;
01365   
01367   virtual BYTE GetKeyValue() const  { return ie_musicOnHold; }
01368   
01371   virtual void StoreDataIn(IAX2IeData &res) { res.musicOnHold = PTrue; }     
01372  protected:
01373 };
01374 
01376 
01377 class IAX2IeTransferId : public IAX2IeInt
01378 {
01379   PCLASSINFO(IAX2IeTransferId, IAX2IeInt);
01380  public:
01384   IAX2IeTransferId(BYTE length, BYTE *srcData) : IAX2IeInt(length, srcData) { };
01385   
01387   void PrintOn(ostream & str) const;
01388   
01390   virtual BYTE GetKeyValue() const  { return ie_transferId; }
01391   
01394   virtual void StoreDataIn(IAX2IeData &res) { res.transferId = dataValue; }     
01395  protected:
01396 };
01397 
01399 
01400 class IAX2IeRdnis : public IAX2IeString
01401 {
01402   PCLASSINFO(IAX2IeRdnis, IAX2IeString);
01403  public:
01407   IAX2IeRdnis(BYTE length, BYTE *srcData) : IAX2IeString(length, srcData) { };
01408   
01410   void PrintOn(ostream & str) const;
01411   
01413   virtual BYTE GetKeyValue() const  { return ie_rdnis; }
01414   
01417   virtual void StoreDataIn(IAX2IeData &res) { res.rdnis = dataValue; }     
01418  protected:
01419 };
01420 
01422 
01423 class IAX2IeProvisioning : public IAX2IeBlockOfData
01424 {
01425   PCLASSINFO(IAX2IeProvisioning, IAX2IeBlockOfData);
01426  public:
01430   IAX2IeProvisioning(BYTE length, BYTE *srcData) : IAX2IeBlockOfData   (length, srcData) { };
01431   
01433   void PrintOn(ostream & str) const;
01434   
01436   virtual BYTE GetKeyValue() const  { return ie_provisioning; }
01437   
01440   virtual void StoreDataIn(IAX2IeData &) {  }     
01441  protected:
01442 };
01443 
01445 
01446 class IAX2IeAesProvisioning : public IAX2IeNone
01447 {
01448   PCLASSINFO(IAX2IeAesProvisioning, IAX2IeNone);
01449  public:
01453   IAX2IeAesProvisioning(BYTE length, BYTE *srcData) : IAX2IeNone(length, srcData) { };
01454   
01456   void PrintOn(ostream & str) const;
01457   
01459   virtual BYTE GetKeyValue() const  { return ie_aesProvisioning; }
01460   
01463   virtual void StoreDataIn(IAX2IeData &) {  }     
01464  protected:
01465 };
01466 
01468 
01469 class IAX2IeDateTime : public IAX2IeDateAndTime
01470 {
01471   PCLASSINFO(IAX2IeDateTime, IAX2IeDateAndTime);
01472  public:
01476   IAX2IeDateTime(BYTE length, BYTE *srcData) : IAX2IeDateAndTime(length, srcData) { };
01477   
01479   void PrintOn(ostream & str) const;
01480   
01482   virtual BYTE GetKeyValue() const  { return ie_dateTime; }
01483   
01486   virtual void StoreDataIn(IAX2IeData &res) { res.dateTime = dataValue; }     
01487  protected:
01488 };
01489 
01491 
01492 class IAX2IeDeviceType : public IAX2IeString
01493 {
01494   PCLASSINFO(IAX2IeDeviceType, IAX2IeString);
01495  public:
01499   IAX2IeDeviceType(BYTE length, BYTE *srcData) : IAX2IeString(length, srcData) { };
01500   
01502   void PrintOn(ostream & str) const;
01503   
01505   virtual BYTE GetKeyValue() const  { return ie_deviceType; }
01506   
01509   virtual void StoreDataIn(IAX2IeData &res) { res.deviceType = dataValue; }     
01510  protected:
01511 };
01512 
01514 
01515 class IAX2IeServiceIdent : public IAX2IeString
01516 {
01517   PCLASSINFO(IAX2IeServiceIdent, IAX2IeString);
01518  public:
01522   IAX2IeServiceIdent(BYTE length, BYTE *srcData) : IAX2IeString(length, srcData) { };
01523   
01525   void PrintOn(ostream & str) const;
01526   
01528   virtual BYTE GetKeyValue() const  { return ie_serviceIdent; }
01529   
01532   virtual void StoreDataIn(IAX2IeData &res) { res.serviceIdent = dataValue; }     
01533  protected:
01534 };
01535 
01537 
01538 class IAX2IeFirmwareVer : public IAX2IeShort
01539 {
01540   PCLASSINFO(IAX2IeFirmwareVer, IAX2IeShort);
01541  public:
01545   IAX2IeFirmwareVer(BYTE length, BYTE *srcData) : IAX2IeShort(length, srcData) { };
01546   
01548   void PrintOn(ostream & str) const;
01549   
01551   virtual BYTE GetKeyValue() const  { return ie_firmwareVer; }
01552   
01555   virtual void StoreDataIn(IAX2IeData &res) { res.firmwareVer = dataValue; }     
01556  protected:
01557 };
01558 
01560 
01561 class IAX2IeFwBlockDesc : public IAX2IeUInt
01562 {
01563   PCLASSINFO(IAX2IeFwBlockDesc, IAX2IeUInt);
01564  public:
01568   IAX2IeFwBlockDesc(BYTE length, BYTE *srcData) : IAX2IeUInt(length, srcData) { };
01569   
01571   IAX2IeFwBlockDesc(unsigned int newValue) : IAX2IeUInt(newValue) { }
01572   
01574   void PrintOn(ostream & str) const;
01575   
01577   virtual BYTE GetKeyValue() const  { return ie_fwBlockDesc; }
01578   
01581   virtual void StoreDataIn(IAX2IeData &res) { res.fwBlockDesc = dataValue; }     
01582  protected:
01583 };
01584 
01586 
01587 class IAX2IeFwBlockData : public IAX2IeBlockOfData
01588 {
01589   PCLASSINFO(IAX2IeFwBlockData, IAX2IeBlockOfData);
01590  public:
01594   IAX2IeFwBlockData(BYTE length, BYTE *srcData) : IAX2IeBlockOfData(length, srcData) { };
01595   
01597   void PrintOn(ostream & str) const;
01598   
01600   virtual BYTE GetKeyValue() const  { return ie_fwBlockData; }
01601   
01604   virtual void StoreDataIn(IAX2IeData &res) { res.fwBlockData = dataValue; }     
01605  protected:
01606 };
01607 
01609 
01610 class IAX2IeProvVer : public IAX2IeUInt
01611 {
01612   PCLASSINFO(IAX2IeProvVer, IAX2IeUInt);
01613  public:
01617   IAX2IeProvVer(BYTE length, BYTE *srcData) : IAX2IeUInt(length, srcData) { };
01618   
01620   IAX2IeProvVer(unsigned int newValue) : IAX2IeUInt(newValue) { }
01621   
01623   void PrintOn(ostream & str) const;
01624   
01626   virtual BYTE GetKeyValue() const  { return ie_provVer; }
01627   
01630   virtual void StoreDataIn(IAX2IeData &res) { res.provVer = dataValue; }     
01631  protected:
01632 };
01633 
01635 
01636 class IAX2IeCallingPres : public IAX2IeByte
01637 {
01638   PCLASSINFO(IAX2IeCallingPres, IAX2IeByte);
01639  public:
01643   IAX2IeCallingPres(BYTE length, BYTE *srcData) : IAX2IeByte(length, srcData) { };
01644   
01646   void PrintOn(ostream & str) const;
01647   
01649   virtual BYTE GetKeyValue() const  { return ie_callingPres; }
01650   
01653   virtual void StoreDataIn(IAX2IeData &res) { res.callingPres = dataValue; }     
01654  protected:
01655 };
01656 
01658 
01659 class IAX2IeCallingTon : public IAX2IeByte
01660 {
01661   PCLASSINFO(IAX2IeCallingTon, IAX2IeByte);
01662  public:
01666   IAX2IeCallingTon(BYTE length, BYTE *srcData) : IAX2IeByte(length, srcData) { };
01667   
01669   void PrintOn(ostream & str) const;
01670   
01672   virtual BYTE GetKeyValue() const  { return ie_callingTon; }
01673   
01676   virtual void StoreDataIn(IAX2IeData &res) { res.callingTon = dataValue; }     
01677  protected:
01678 };
01679 
01681 
01682 class IAX2IeCallingTns : public IAX2IeUShort
01683 {
01684   PCLASSINFO(IAX2IeCallingTns, IAX2IeUShort);
01685  public:
01689   IAX2IeCallingTns(BYTE length, BYTE *srcData) : IAX2IeUShort(length, srcData) { };
01690   
01692   void PrintOn(ostream & str) const;
01693   
01695   virtual BYTE GetKeyValue() const  { return ie_callingTns; }
01696   
01699   virtual void StoreDataIn(IAX2IeData &res) { res.callingTns = dataValue; }     
01700  protected:
01701 };
01702 
01704 
01705 class IAX2IeSamplingRate : public IAX2IeUShort
01706 {
01707   PCLASSINFO(IAX2IeSamplingRate, IAX2IeUShort);
01708  public:
01712   IAX2IeSamplingRate(BYTE length, BYTE *srcData) : IAX2IeUShort(length, srcData) { };
01713   
01715   void PrintOn(ostream & str) const;
01716   
01718   virtual BYTE GetKeyValue() const  { return ie_samplingRate; }
01719   
01722   virtual void StoreDataIn(IAX2IeData &res) { res.samplingRate = dataValue; }     
01723  protected:
01724 };
01725 
01727 
01728 class IAX2IeEncryption : public IAX2IeUShort
01729 {
01730   PCLASSINFO(IAX2IeEncryption, IAX2IeUShort);
01731  public:
01733   enum IAX2IeEncryptionMethod {
01734     encryptAes128 = 1    
01735   };
01736 
01738   IAX2IeEncryption(IAX2IeEncryptionMethod method = encryptAes128);
01739 
01743   IAX2IeEncryption(BYTE length, BYTE *srcData) : IAX2IeUShort(length, srcData) { };
01744   
01746   void PrintOn(ostream & str) const;
01747   
01749   virtual BYTE GetKeyValue() const  { return ie_encryption; }
01750   
01753   virtual void StoreDataIn(IAX2IeData &res) { res.encryptionMethods = dataValue; }
01754  protected:
01755 };
01756 
01758 
01759 class IAX2IeEncKey : public IAX2IeString
01760 {
01761   PCLASSINFO(IAX2IeEncKey, IAX2IeString);
01762  public:
01766   IAX2IeEncKey(BYTE length, BYTE *srcData) : IAX2IeString(length, srcData) { };
01767   
01769   void PrintOn(ostream & str) const;
01770   
01772   virtual BYTE GetKeyValue() const  { return ie_encKey; }
01773   
01776   virtual void StoreDataIn(IAX2IeData &res) { res.encKey = dataValue; }     
01777  protected:
01778 };
01779 
01781 
01782 class IAX2IeCodecPrefs : public IAX2IeByte
01783 {
01784   PCLASSINFO(IAX2IeCodecPrefs, IAX2IeByte);
01785  public:
01789   IAX2IeCodecPrefs(BYTE length, BYTE *srcData) : IAX2IeByte(length, srcData) { };
01790   
01792   void PrintOn(ostream & str) const;
01793   
01795   virtual BYTE GetKeyValue() const  { return ie_codecPrefs; }
01796   
01799   virtual void StoreDataIn(IAX2IeData &res) { res.codecPrefs = dataValue; }     
01800  protected:
01801 };
01802 
01804 
01805 class IAX2IeReceivedJitter : public IAX2IeUInt
01806 {
01807   PCLASSINFO(IAX2IeReceivedJitter, IAX2IeUInt);
01808  public:
01812   IAX2IeReceivedJitter(BYTE length, BYTE *srcData) : IAX2IeUInt(length, srcData) { };
01813   
01815   void PrintOn(ostream & str) const;
01816   
01818   virtual BYTE GetKeyValue() const  { return ie_recJitter; }
01819   
01822   virtual void StoreDataIn(IAX2IeData &res) { res.receivedJitter = dataValue; }     
01823  protected:
01824 };
01825 
01827 
01828 class IAX2IeReceivedLoss : public IAX2IeUInt
01829 {
01830   PCLASSINFO(IAX2IeReceivedLoss, IAX2IeUInt);
01831  public:
01835   IAX2IeReceivedLoss(BYTE length, BYTE *srcData) : IAX2IeUInt(length, srcData) { };
01836   
01838   void PrintOn(ostream & str) const;
01839   
01841   virtual BYTE GetKeyValue() const  { return ie_recLoss; }
01842   
01845   virtual void StoreDataIn(IAX2IeData &res) { res.receivedLoss = dataValue; }     
01846  protected:
01847 };
01848 
01850 
01851 class IAX2IeReceivedFrames : public IAX2IeUInt
01852 {
01853   PCLASSINFO(IAX2IeReceivedFrames, IAX2IeUInt);
01854  public:
01858   IAX2IeReceivedFrames(BYTE length, BYTE *srcData) : IAX2IeUInt(length, srcData) { };
01859   
01861   void PrintOn(ostream & str) const;
01862   
01864   virtual BYTE GetKeyValue() const  { return ie_recPackets; }
01865   
01868   virtual void StoreDataIn(IAX2IeData &res) { res.receivedPackets = dataValue; }     
01869  protected:
01870 };
01871 
01873 
01874 class IAX2IeReceivedDelay : public IAX2IeUShort
01875 {
01876   PCLASSINFO(IAX2IeReceivedDelay, IAX2IeUShort);
01877  public:
01881   IAX2IeReceivedDelay(BYTE length, BYTE *srcData) : IAX2IeUShort(length, srcData) { };
01882   
01884   void PrintOn(ostream & str) const;
01885   
01887   virtual BYTE GetKeyValue() const  { return ie_recDelay; }
01888   
01891   virtual void StoreDataIn(IAX2IeData &res) { res.receivedDelay = dataValue; }     
01892  protected:
01893 };
01894 
01896 
01897 class IAX2IeDroppedFrames : public IAX2IeUInt
01898 {
01899   PCLASSINFO(IAX2IeDroppedFrames, IAX2IeUInt);
01900  public:
01904   IAX2IeDroppedFrames(BYTE length, BYTE *srcData) : IAX2IeUInt(length, srcData) { };
01905   
01907   void PrintOn(ostream & str) const;
01908   
01910   virtual BYTE GetKeyValue() const  { return ie_recDropped; }
01911   
01914   virtual void StoreDataIn(IAX2IeData &res) { res.receivedDropped = dataValue; }     
01915  protected:
01916 };
01917 
01919 
01920 class IAX2IeReceivedOoo : public IAX2IeUInt
01921 {
01922   PCLASSINFO(IAX2IeReceivedOoo, IAX2IeUInt);
01923  public:
01927   IAX2IeReceivedOoo(BYTE length, BYTE *srcData) : IAX2IeUInt(length, srcData) { };
01928   
01930   void PrintOn(ostream & str) const;
01931   
01933   virtual BYTE GetKeyValue() const  { return ie_recOoo; }
01934   
01937   virtual void StoreDataIn(IAX2IeData &res) { res.receivedOoo = dataValue; }     
01938  protected:
01939 };
01940 
01942 
01943 
01944 PDECLARE_LIST (IAX2IeList, IAX2Ie *)
01945 #ifdef DOC_PLUS_PLUS 
01946 
01947 class IAX2IeList : public IAX2Ie *
01948 {
01949 #endif
01950  public:
01952   ~IAX2IeList();
01953   
01957   IAX2Ie *RemoveIeAt(PINDEX i);
01958   
01962   IAX2Ie *RemoveLastIe();
01963   
01965   void Initialise() {  DisallowDeleteObjects(); }
01966   
01968   void DeleteAt(PINDEX idex);
01969   
01971   PBoolean Empty() const { return GetSize() == 0; }
01972   
01974   PBoolean IsEmpty() const { return GetSize() == 0; }
01975   
01977   void AppendIe(IAX2Ie *newMember) { Append(newMember);}
01978   
01980   int GetBinaryDataSize() const;
01981   
01983   IAX2Ie * GetIeAt(int i) const;
01984   
01985  protected:
01986   
01987 };
01988 
01989 
01990 #endif // OPAL_IAX2
01991 
01992 #endif // OPAL_IAX2_IES_H
01993 
01994 
01995 
01996 
01997 
01998 
01999 
02000 
02001 
02002 
02003