realtimenetprots/sipfw/SIP/TransactionUser/src/UserAgentTimer.h
changeset 0 307788aac0a8
equal deleted inserted replaced
-1:000000000000 0:307788aac0a8
       
     1 /*
       
     2 * Copyright (c) 2005-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          : UserAgentTimer.h
       
    16 * Part of       : TransactionUser
       
    17 * Version       : SIP/4.0
       
    18 *
       
    19 */
       
    20 
       
    21 
       
    22 
       
    23 
       
    24 /**
       
    25  @internalComponent
       
    26 */
       
    27 
       
    28 // INCLUDES
       
    29 #ifndef USERAGENTTIMER_H
       
    30 #define USERAGENTTIMER_H
       
    31 
       
    32 #include "TimerBase.h"
       
    33 
       
    34 // FORWARD DECLARATIONS
       
    35 class CUserAgent;
       
    36 
       
    37 
       
    38 // CLASS DECLARATION
       
    39 
       
    40 class CUserAgentTimer : public CTimerBase
       
    41 	{
       
    42 public:
       
    43 	virtual ~CUserAgentTimer() {}
       
    44 
       
    45 
       
    46 	/**
       
    47 	 * Handle the timer expiration.
       
    48 	 *	 
       
    49 	 * @pre
       
    50 	 * @post
       
    51 	 *
       
    52 	 * @see
       
    53 	 *
       
    54 	 * @param aUserAgent UserAgent whose timer expired. Ownership is not
       
    55 	 *	transferred.
       
    56 	 * @param aTimerId Timer identifier
       
    57 	 * @return value -
       
    58 	 */	
       
    59 	virtual void ExpiredL(CUserAgent* aUserAgent, TTimerId aTimerId) = 0;
       
    60 
       
    61 protected:
       
    62 	/**
       
    63 	 * Creates a timer and starts it.
       
    64 	 *	 
       
    65 	 * Note: since there isn't a StartL() function in the CUserAgentTimer,
       
    66 	 * then if a timer is stopped, it can't be restarted.
       
    67 	 *
       
    68 	 * @pre
       
    69 	 * @post
       
    70 	 *
       
    71 	 * @see
       
    72 	 *
       
    73 	 * @param aTimerMgr Timer subsystem
       
    74 	 * @param aObserver Callback for handling timer expiration. Ownership is
       
    75      *  not transferred.
       
    76 	 * @param aDuration Timer duration in milliseconds
       
    77 	 * @return value -
       
    78 	 */
       
    79 	CUserAgentTimer(MTimerManager& aTimerMgr,
       
    80 				    MExpirationHandler* aObserver,
       
    81 				    TUint32 aDuration);
       
    82 	};
       
    83 
       
    84 
       
    85 
       
    86 /*
       
    87  * This timer is used for stopping UserAgent. When the timer expires, UserAgent
       
    88  * is stopped with the given aReason value.
       
    89  */
       
    90 class CTimerStopUA : public CUserAgentTimer
       
    91 	{
       
    92 public:
       
    93 	//Creates and starts the timer
       
    94 	static CTimerStopUA* NewL(MTimerManager& aTimerMgr,
       
    95 							  MExpirationHandler* aObserver,
       
    96 							  TUint32 aDuration,
       
    97 							  TInt aReason);
       
    98 	void ExpiredL(CUserAgent* aUserAgent, TTimerId aTimerId);
       
    99 
       
   100 private:
       
   101 	CTimerStopUA(MTimerManager& aTimerMgr,
       
   102 				 MExpirationHandler* aObserver,
       
   103 				 TUint32 aDuration,
       
   104 				 TInt aReason);
       
   105 
       
   106 	//Reason value which is passed to CUserAgent::Stop() when the timer expires
       
   107 	TInt iReason;
       
   108 	};
       
   109 
       
   110 
       
   111 
       
   112 /*
       
   113  * InviteUAS uses this timer for retransmitting the 2xx response until it
       
   114  * receives ACK.
       
   115  */
       
   116 class CTimerRetransmit2xx : public CUserAgentTimer
       
   117 	{
       
   118 public:
       
   119 	//Creates and starts the timer
       
   120 	static CTimerRetransmit2xx* NewL(MTimerManager& aTimerMgr,
       
   121 									 MExpirationHandler* aObserver,
       
   122 									 TUint32 aDuration);
       
   123 
       
   124 	void ExpiredL(CUserAgent* aUserAgent, TTimerId aTimerId);
       
   125 
       
   126 private:
       
   127 	CTimerRetransmit2xx(MTimerManager& aTimerMgr,
       
   128 						MExpirationHandler* aObserver,
       
   129 						TUint32 aDuration);	
       
   130 	};
       
   131 
       
   132 
       
   133 
       
   134 /*
       
   135  * UAS uses this timer for send error response to remote endpoint when
       
   136  * AssocMgr does not return MTransactionOwner of response in time.
       
   137  */
       
   138 class CTimerOwnerResolver : public CUserAgentTimer
       
   139 	{
       
   140 public:
       
   141 	//Creates and starts the timer
       
   142 	static CTimerOwnerResolver* NewL(MTimerManager& aTimerMgr,
       
   143 									 MExpirationHandler* aObserver,
       
   144 									 TUint32 aDuration);
       
   145 
       
   146 	void ExpiredL(CUserAgent* aUserAgent, TTimerId aTimerId);
       
   147 
       
   148 private:
       
   149 	CTimerOwnerResolver(MTimerManager& aTimerMgr,
       
   150 					    MExpirationHandler* aObserver,
       
   151 					    TUint32 aDuration);	
       
   152 	};
       
   153 
       
   154 
       
   155 
       
   156 /*
       
   157  * InviteUAC uses this timer when SIPSec processed the received SIP response
       
   158  * synchronously.
       
   159  * SIP stack should send the the ACK to the error response before the updated
       
   160  * INVITE is sent. Using a dummy timer with duration zero, introduces an
       
   161  * asynchronous break before UAC processes the SIP response further, causing
       
   162  * the control to return back to the transaction which received the response,
       
   163  * before InviteUAC may create a new transaction for sending the updated INVITE.
       
   164  * This way the old transaction sends the ACK before the new transaction sends
       
   165  * the INVITE.
       
   166  */
       
   167 class CTimerAsyncSIPSec : public CUserAgentTimer
       
   168 	{
       
   169 public:
       
   170 	//Creates and starts the timer
       
   171 	static CTimerAsyncSIPSec* NewL(MTimerManager& aTimerMgr,
       
   172 							       MExpirationHandler* aObserver);
       
   173 
       
   174 	void ExpiredL(CUserAgent* aUserAgent, TTimerId aTimerId);
       
   175 
       
   176 private:
       
   177 	CTimerAsyncSIPSec(MTimerManager& aTimerMgr,
       
   178 					  MExpirationHandler* aObserver);
       
   179 	};
       
   180 
       
   181 #endif // end of USERAGENTTIMER_H
       
   182 
       
   183 // End of File