realtimenetprots/sipfw/SIP/Transaction/src/NormalServerTa.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          : NormalServerTa.h
       
    16 * Part of       : Transaction
       
    17 * Version       : SIP/6.0
       
    18 *
       
    19 */
       
    20 
       
    21 
       
    22 
       
    23 
       
    24 /**
       
    25  @internalComponent
       
    26 */
       
    27 
       
    28 #ifndef NORMALSERVERTA_H
       
    29 #define NORMALSERVERTA_H
       
    30 
       
    31 // INCLUDES
       
    32 #include "ServerTransaction.h"
       
    33 
       
    34 // FORWARD DECLARATIONS
       
    35 class CTimerTerminateTa;
       
    36 class CTimerSend100;
       
    37 
       
    38 // CLASS DECLARATION
       
    39 /*
       
    40  * This class represents a non-INVITE server transaction. 
       
    41  */
       
    42 class CNormalServerTransaction : public CServerTransaction
       
    43 	{
       
    44 public: // Constructors and destructor
       
    45 
       
    46 	/**		
       
    47 	 * Creates a new instance of CNormalServerTransaction
       
    48 	 *
       
    49 	 * @param aUserAgent UserAgent owning the new transaction being created.
       
    50 	 * @param aTransmitter CTransmitter instance to use
       
    51 	 * @param aTimers Timer interface
       
    52 	 * @param aInitialState Initial state of this transaction	 
       
    53 	 * @param aTimerValues Values for calculating timer durations
       
    54 	 * @return New CNormalServerTransaction object, ownership is transferred
       
    55 	 */
       
    56 	static CNormalServerTransaction* NewL(CUserAgentBase& aUserAgent,
       
    57 										  CTransmitter& aTransmitter,
       
    58 										  MTimerManager& aTimers,
       
    59 										  CTransactionState& aInitialState,
       
    60 										  TTimerValues& aTimerValues);
       
    61 
       
    62 	~CNormalServerTransaction();	
       
    63 
       
    64 public: // From CServerTransaction
       
    65 
       
    66 	void DeleteTimer(const CTransactionTimer& aTimer);
       
    67 
       
    68 public: // New functions	
       
    69 
       
    70 	TBool IsTimerSend100Running() const;
       
    71 
       
    72 	/**
       
    73 	 * Starts the timer F2, unless it is already running.
       
    74 	 */
       
    75 	void StartTimerF2UnlessExistsL();
       
    76 
       
    77 	/**
       
    78 	 * Starts the timer J, unless it is already running.	 
       
    79 	 */
       
    80 	void StartTimerJUnlessExistsL();
       
    81 
       
    82 	/**
       
    83 	 * Starts the timer for sending a 100 response
       
    84 	 *
       
    85 	 * @pre iTimerSend100 = NULL
       
    86 	 * @param aRequest SIP Request received from network
       
    87 	 */
       
    88 	void StartTimerSend100L(CSIPRequest& aRequest);
       
    89 
       
    90 	/**
       
    91 	 * Stops the timer F2.
       
    92 	 *
       
    93 	 * @post iTimerF2 = NULL
       
    94 	 */	
       
    95 	void StopTimerF2();
       
    96 
       
    97 	/**
       
    98 	 * Stops the timer for sending a 100 response
       
    99 	 *
       
   100 	 * @post iTimerSend100 = NULL
       
   101 	 */
       
   102 	void StopTimerSend100();
       
   103 
       
   104 	/**
       
   105 	 * A retransmitted SIP request is received.
       
   106 	 *
       
   107 	 * @pre aRequest = NULL
       
   108 	 * @param aRequest SIP request, ownership is transferred.	 
       
   109 	 */
       
   110 	void ReceiveRetransmissionL(CSIPRequest* aRequest);
       
   111 
       
   112 	static CNormalServerTransaction& Ptr(CTransaction& aTransaction);
       
   113 
       
   114 private: // Constructor, for internal use
       
   115 
       
   116 	/**	
       
   117 	 * @param aUserAgent UserAgent owning this transaction object
       
   118 	 * @param aTransmitter CTransmitter instance to use
       
   119 	 * @param aTimers Timer interface
       
   120 	 * @param aInitialState Initial state of this transaction	 
       
   121 	 * @param aTimerValues Values for calculating timer durations
       
   122 	 */
       
   123 	CNormalServerTransaction(CUserAgentBase& aUserAgent,
       
   124 							 CTransmitter& aTransmitter,
       
   125 							 MTimerManager& aTimers,
       
   126 							 CTransactionState& aInitialState,
       
   127 							 TTimerValues& aTimerValues);
       
   128 
       
   129 private: // New functions, for internal use
       
   130 
       
   131 	/**
       
   132 	 * Stops timer J
       
   133 	 *
       
   134 	 * @post iTimerJ = NULL
       
   135 	 */
       
   136 	void StopTimerJ();
       
   137 
       
   138     /**
       
   139 	 * Stops all timers of this transaction
       
   140 	 *
       
   141 	 * @post iTimerF2 = NULL, iTimerJ = NULL, iTimerSend100 = NULL
       
   142 	 */
       
   143 	void CancelAllTimers();
       
   144 
       
   145 private: // Data
       
   146 
       
   147     // This timer is started when transaction receives the initial request and
       
   148     // stopped when a final response is sent. If this timer fires, transaction
       
   149     // enters terminated state. Owned.
       
   150 	CTimerTerminateTa* iTimerF2;
       
   151 
       
   152 	// Timer J, owned
       
   153 	CTimerTerminateTa* iTimerJ;
       
   154 
       
   155 	// Timer to send a 100 response unless application sends a response. Owned.
       
   156 	CTimerSend100* iTimerSend100;
       
   157 
       
   158 	void __DbgTestInvariant() const;
       
   159 
       
   160 
       
   161 #ifdef CPPUNIT_TEST
       
   162 	friend class CNormalServerTransaction_Test;
       
   163 	friend class CServerTransaction_Test;
       
   164 	friend class CNormalSTa_Trying_Test;
       
   165 	friend class CNormalSTa_Proceeding_Test;
       
   166 	friend class CNormalSTa_Completed_Test;	
       
   167 	friend class CTransactionUser_Test;
       
   168 #endif
       
   169 	};
       
   170 
       
   171 #endif // end of NORMALSERVERTA_H
       
   172 
       
   173 // End of File