00001 /* 00002 * ============================================================================== 00003 * Name : siptransactionbase.h 00004 * Part of : SIP Client 00005 * Interface : SDK API, SIP Client API 00006 * Description : 00007 * Version : 1.0 00008 * 00009 * Copyright (c) 2005 Nokia Corporation. 00010 * This material, including documentation and any related 00011 * computer programs, is protected by copyright controlled by 00012 * Nokia Corporation. All rights are reserved. Copying, 00013 * including reproducing, storing, adapting or translating, any 00014 * or all of this material requires the prior written consent of 00015 * Nokia Corporation. This material also contains confidential 00016 * information which may not be disclosed to others without the 00017 * prior written consent of Nokia Corporation. 00018 * ============================================================================== 00019 */ 00020 00021 #ifndef CSIPTRANSACTIONBASE_H 00022 #define CSIPTRANSACTIONBASE_H 00023 00024 // INCLUDES 00025 #include <e32base.h> 00026 #include <stringpool.h> 00027 #include "_sipcodecdefs.h" 00028 00029 // FORWARD DECLARATIONS 00030 class CSIPResponseElements; 00031 class MTransactionAssociation; 00032 00033 // CLASS DECLARATION 00034 00045 class CSIPTransactionBase: public CBase 00046 { 00047 public: 00049 enum TState 00050 { 00052 ETrying, 00054 ECalling, 00056 EProceeding, 00058 ECompleted, 00060 EConfirmed, 00062 ETerminated, 00064 EConstructing 00065 }; 00066 00067 public: // Destructor 00071 virtual ~CSIPTransactionBase(); 00072 00073 public: // New functions 00078 IMPORT_C RStringF Type() const; 00079 00086 IMPORT_C CSIPTransactionBase::TState StateL(); 00087 00094 IMPORT_C TBool IsSIPClientTransaction() const; 00095 00103 IMPORT_C TBool 00104 operator==(const CSIPTransactionBase& aTransaction) const; 00105 00106 public: // New functions, for internal use 00112 TUint32 RequestId() const; 00113 00120 virtual void Detach(const MTransactionAssociation& aAssociation); 00121 00127 void ChangeState(CSIPTransactionBase::TState aNextState); 00128 00136 TBool AffectsDialogState() const; 00137 00141 void SetAffectsDialogState(); 00142 00150 static TBool IsTargetRefresh(RStringF aType); 00151 00158 void SetResponseElements(CSIPResponseElements* aElements); 00159 00160 protected: // Constructors 00161 CSIPTransactionBase(TBool aIsClientTransaction, 00162 TUint32 aRequestId, 00163 MTransactionAssociation& aAssociation); 00164 00165 void ConstructL(RStringF aType); 00166 00167 protected: // New functions, for internal use 00173 void CheckAssociationL() const; 00174 00180 const CSIPResponseElements* ResponseElements() const; 00181 00182 protected: // Data 00183 //RequestId received from SIP client 00184 TUint32 iRequestId; 00185 00186 //Every transaction is associated to exactly one other object: 00187 //CSIP, CSIPConnection, CSIPRegistrationBinding or CSIPDialogAssocBase 00188 MTransactionAssociation* iAssociation; 00189 00190 private: // Data 00191 RStringF iType; 00192 00193 //ETrue is the transaction is a client transaction, EFalse otherwise 00194 TBool iIsClientTransaction; 00195 00196 //Current transaction state 00197 CSIPTransactionBase::TState iState; 00198 00199 //ETrue if the transaction has an effect on the dialog state in case 00200 //the transaction is associated with a dialog. 00201 //EFalse otherwise. 00202 TBool iAffectsDialogState; 00203 00204 //SIP response elements 00205 CSIPResponseElements* iResponseElements; 00206 00207 private: // For testing purposes 00208 UNIT_TEST(CSIP_Test) 00209 UNIT_TEST(CSIPServerTransaction_Test) 00210 UNIT_TEST(CSIPSubscribeDialogAssoc_Test) 00211 UNIT_TEST(CSIPInviteDialogAssoc_Test) 00212 UNIT_TEST(CSIPNotifyDialogAssoc_Test) 00213 UNIT_TEST(CSIPConnection_Test) 00214 00215 __DECLARE_TEST; 00216 }; 00217 00218 #endif