realtimenetprots/sipfw/SIP/Transaction/inc/TransactionMgr.h
changeset 0 307788aac0a8
equal deleted inserted replaced
-1:000000000000 0:307788aac0a8
       
     1 /*
       
     2 * Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:
       
    15 * Name          : TransactionMgr.h
       
    16 * Part of       : Transaction
       
    17 * Version       : SIP/5.0
       
    18 *
       
    19 */
       
    20 
       
    21 
       
    22 
       
    23 
       
    24 /**
       
    25  @internalComponent
       
    26 */
       
    27 
       
    28 #ifndef TRANSACTIONMGR_H
       
    29 #define TRANSACTIONMGR_H
       
    30 
       
    31 // INCLUDES
       
    32 #include <e32base.h>
       
    33 
       
    34 #include "TransactionBase.h"
       
    35 
       
    36 // FORWARD DECLARATIONS
       
    37 class CUserAgentBase;
       
    38 class MTimerManager;
       
    39 class TTimerValues;
       
    40 class CTransmitter;
       
    41 class MTransactionStore;
       
    42 
       
    43 class CInviteClientTa_Calling;
       
    44 class CInviteClientTa_Proceeding;
       
    45 class CInviteClientTa_Completed;
       
    46 class CNormalClientTa_Trying;
       
    47 class CNormalClientTa_Proceeding;
       
    48 class CNormalClientTa_Completed;	
       
    49 class CInviteServerTa_Proceeding;
       
    50 class CInviteServerTa_Completed;
       
    51 class CInviteServerTa_Confirmed;
       
    52 class CInviteServerTa_Sending2xx;
       
    53 class CNormalServerTa_Trying;
       
    54 class CNormalServerTa_Proceeding;
       
    55 class CNormalServerTa_Completed;
       
    56 
       
    57 
       
    58 // CLASS DECLARATION
       
    59 /**
       
    60  * CTransactionMgr class offers means of creating various transaction state
       
    61  * machines.
       
    62  */
       
    63 class CTransactionMgr: public CBase
       
    64 	{
       
    65 public: // Constructor and destructor
       
    66 
       
    67 	/**
       
    68 	 * Creates a new instance.
       
    69 	 *
       
    70 	 * @param aTimers Timer subsystem
       
    71 	 * @param aTransactionStore TransactionStore	 
       
    72 	 * @return value New CTransactionMgr object, ownership is transferred.
       
    73 	 */
       
    74 	static CTransactionMgr* NewL(MTimerManager& aTimers,							
       
    75 								 MTransactionStore& aTransactionStore);
       
    76 
       
    77 	/**
       
    78 	 * Destructor
       
    79 	 */
       
    80 	~CTransactionMgr();
       
    81 
       
    82 public: // New functions
       
    83 
       
    84 	/**
       
    85 	 * Creates a transaction of the specified type.
       
    86 	 *
       
    87 	 * @param aType Identifies the type of transaction to be created
       
    88 	 * @param aUserAgent UserAgent owning the new transaction
       
    89 	 * @param aTransmitter Transmitter used for sending SIP messages
       
    90 	 * @param aTimerValues Timer values
       
    91 	 * @param aRetransmitInvite Only applicable to INVITE client transaction.
       
    92 	 *		  If ETrue and using UDP, the INVITE is retransmitted even after
       
    93 	 *		  receiving a provisional response, to keep the NAT binding alive.
       
    94 	 * @return value New object, ownership is transferred.
       
    95 	 */
       
    96 	CTransactionBase*
       
    97         CreateTransactionL(CTransactionBase::TTransactionType aType,
       
    98 						   CUserAgentBase& aUserAgent,
       
    99 						   CTransmitter& aTransmitter,
       
   100 						   TTimerValues& aTimerValues,
       
   101 						   TBool aRetransmitInvite=EFalse);
       
   102 
       
   103 	/**
       
   104 	 * Checks if it is possible to send the CANCEL request. Only an invite
       
   105 	 * client transaction that is in the proceeding state can be canceled.
       
   106 	 *
       
   107 	 * @param aTransaction Transaction which is inspected to see if it can be
       
   108 	 *	canceled.
       
   109 	 * @return value ETrue If a CANCEL can be sent. EFalse otherwise.
       
   110 	 */
       
   111 	TBool IsPossibleToSendCancel(const CTransactionBase& aTransaction) const;
       
   112 
       
   113 private: // Constructors
       
   114 
       
   115 	CTransactionMgr(MTimerManager& aTimers,
       
   116 					MTransactionStore& aTransactionStore);
       
   117 
       
   118 	void ConstructL();
       
   119 
       
   120 private: // Data
       
   121 
       
   122 	//Timer subsystem
       
   123 	MTimerManager& iTimers;
       
   124 
       
   125 	//Information of all existing transactions and UserAgents.
       
   126 	MTransactionStore& iTransactionStore;
       
   127 
       
   128 
       
   129 	//CTransactionMgr owns all the state objects of different transaction state
       
   130 	//machines. There is one instance of each CTransactionState derived object.
       
   131 
       
   132 	//Invite client transaction states
       
   133 	CInviteClientTa_Calling*	iInviteClientTa_Calling;
       
   134 	CInviteClientTa_Proceeding* iInviteClientTa_Proceeding;
       
   135 	CInviteClientTa_Completed*	iInviteClientTa_Completed;	
       
   136 
       
   137 	//Non-Invite client transaction states
       
   138 	CNormalClientTa_Trying*		iNormalClientTa_Trying;
       
   139 	CNormalClientTa_Proceeding* iNormalClientTa_Proceeding;
       
   140 	CNormalClientTa_Completed*	iNormalClientTa_Completed;
       
   141 
       
   142 	//Invite server transaction states
       
   143 	CInviteServerTa_Proceeding* iInviteServerTa_Proceeding;
       
   144 	CInviteServerTa_Completed*	iInviteServerTa_Completed;
       
   145 	CInviteServerTa_Confirmed*	iInviteServerTa_Confirmed;
       
   146 	CInviteServerTa_Sending2xx* iInviteServerTa_Sending2xx;
       
   147 
       
   148 	//Non-Invite server transaction states
       
   149 	CNormalServerTa_Trying*		iNormalServerTa_Trying;
       
   150 	CNormalServerTa_Proceeding* iNormalServerTa_Proceeding;
       
   151 	CNormalServerTa_Completed*	iNormalServerTa_Completed;
       
   152 
       
   153 	void __DbgTestInvariant() const;
       
   154 
       
   155 
       
   156 #ifdef CPPUNIT_TEST
       
   157 	friend class CTransactionUser_Test;
       
   158     friend class CInviteUAS_Accepted_Test;
       
   159 #endif
       
   160 	};
       
   161 
       
   162 #endif // end of TRANSACTIONMGR_H
       
   163 
       
   164 // End of File