realtimenetprots/sipfw/SIP/Transaction/src/RestoreTransactionState.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          : RestoreTransactionState.h
       
    16 * Part of       : Transaction
       
    17 * Version       : SIP/5.0
       
    18 *
       
    19 */
       
    20 
       
    21 
       
    22 
       
    23 
       
    24 /**
       
    25  @internalComponent
       
    26 */
       
    27 
       
    28 #ifndef RESTORETRANSACTIONSTATE_H
       
    29 #define RESTORETRANSACTIONSTATE_H
       
    30 
       
    31 // INCLUDES
       
    32 #include <e32base.h>
       
    33 
       
    34 // FORWARD DECLARATIONS
       
    35 class CClientTransaction;
       
    36 class CTransactionState;
       
    37 class CTransactionTimer;
       
    38 
       
    39 
       
    40 /**
       
    41  * This class is used for changing the state of a client transaction back to
       
    42  * its previous state, if passing a SIP response to the UAC leaves.
       
    43  */
       
    44 class TRestoreTransactionState
       
    45 	{
       
    46 public: // Constructor
       
    47 
       
    48 	/**
       
    49 	 * Constructor
       
    50 	 *
       
    51 	 * @param aTransaction Client transaction, whose state will be restored
       
    52 	 * @param aState State which the transaction will enter
       
    53 	 * @param aTimer Timer to stop when state is restored. If NULL, then timer
       
    54 	 *		  is not stopped. Ownership is not transferred.
       
    55 	 * @param aTimer2 Timer to stop when state is restored. If NULL, then timer
       
    56 	 *		  is not stopped. Ownership is not transferred.
       
    57 	 */
       
    58 	TRestoreTransactionState(CClientTransaction& aTransaction,
       
    59                              const CTransactionState& aState,
       
    60                        		 CTransactionTimer* aTimer = NULL,
       
    61                        		 CTransactionTimer* aTimer2 = NULL);
       
    62 
       
    63 public: // New functions
       
    64 
       
    65     /**
       
    66 	 * Returns a TCleanupItem which can be pushed into CleanupStack.
       
    67 	 *
       
    68      * @return TCleanupItem
       
    69 	 */
       
    70 	TCleanupItem CleanupItem();
       
    71 
       
    72     /**
       
    73 	 * When CleanupStack destroys the TCleanupItem, this function is called.
       
    74      * The state of iTransaction is restored to iState.
       
    75 	 *
       
    76 	 * @pre aRestoreState != NULL
       
    77 	 *
       
    78 	 * @param aRestoreState Pointer to a TRestoreTransactionState containing
       
    79      *  the information required to restore transaction's state. Ownership is
       
    80      *  not transferred.
       
    81 	 */
       
    82 	static void Restore(TAny* aRestoreState);
       
    83 
       
    84 private: // Data
       
    85 
       
    86     //Transaction
       
    87 	CClientTransaction& iTransaction;
       
    88 
       
    89     //State, which the transaction will enter if TCleanupItem is destroyed
       
    90     const CTransactionState& iState;
       
    91 
       
    92     //Timer that is stopped when restoring is done. Not owned.
       
    93     CTransactionTimer* iTimer;
       
    94     
       
    95     //Timer that is stopped when restoring is done. Not owned.
       
    96     CTransactionTimer* iTimer2;
       
    97 	};
       
    98 
       
    99 #endif // end of RESTORETRANSACTIONSTATE_H
       
   100 
       
   101 // End of File