realtimenetprots/sipfw/SIP/TransactionUser/src/InviteUAS.h
changeset 0 307788aac0a8
equal deleted inserted replaced
-1:000000000000 0:307788aac0a8
       
     1 /*
       
     2 * Copyright (c) 2007-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          : InviteUAS.h
       
    16 * Part of       : TransactionUser
       
    17 * Version       : SIP/6.0
       
    18 *
       
    19 */
       
    20 
       
    21 
       
    22 
       
    23 
       
    24 /**
       
    25  @internalComponent
       
    26 */
       
    27 
       
    28 #ifndef INVITEUAS_H
       
    29 #define INVITEUAS_H
       
    30 
       
    31 // INCLUDES
       
    32 #include "UserAgentServer.h"
       
    33 
       
    34 // FORWARD DECLARATIONS
       
    35 class CTimerRetransmit2xx;
       
    36 class CTimerStopUA;
       
    37 
       
    38 
       
    39 // CLASS DECLARATION
       
    40 
       
    41 class CInviteUAS : public CUserAgentServer
       
    42 	{
       
    43 public: // Constructor and destructor
       
    44 
       
    45 	static CInviteUAS* NewL(CUserAgentCreateParams& aParams,							
       
    46 							MSipConnectionMgr& aConnectionMgr,		
       
    47 							MSIPRequestRouter& aRouter,
       
    48                             MSipDialogs& aDialogs);
       
    49 
       
    50 	~CInviteUAS();
       
    51 
       
    52 public: // From CUserAgent
       
    53 
       
    54 	void DeleteTimer(const CUserAgentTimer& aTimer);	
       
    55 	
       
    56 public: // From CUserAgentServer
       
    57 
       
    58 	void CreateTransactionL();
       
    59 
       
    60 public: // New functions
       
    61 
       
    62     /**
       
    63 	 * Offers the ACK to Dialogs, and if Dialogs wants to receive the ACK,
       
    64 	 * obtains the MTransactionOwner.
       
    65 	 *
       
    66 	 * @param aAck ACK request received from network MTransactionOwner
       
    67      *  callback.
       
    68      * @return ETrue If there is a dialog matching the ACK,
       
    69      *		   EFalse otherwise
       
    70 	 */
       
    71     TBool DoesDialogExistForAckL(CSIPRequest& aAck);
       
    72 
       
    73 	/**
       
    74 	 * Sending the first 2xx response. The first 2xx is sent using CTransaction
       
    75 	 * and the retransmissions of 2xx are handled by UAS.
       
    76 	 *
       
    77 	 * @param aResp 2xx response. Ownership is transferred.	 
       
    78 	 */
       
    79 	void SendFirst2xxL(CSIPResponse* aResp);
       
    80 
       
    81 	void Retransmit2xxL();
       
    82 
       
    83 	/**
       
    84 	 * Cancels the INVITE server transaction, unless it has already sent a
       
    85 	 * final response.
       
    86 	 */
       
    87 	void CancelInviteL();
       
    88 
       
    89     /**
       
    90 	 * Determine if the UAS has sent a 2xx response.
       
    91 	 *
       
    92 	 * @return value ETrue If UAS has sent a 2xx, EFalse otherwise.
       
    93 	 */
       
    94     TBool IsSending2xx() const;
       
    95 
       
    96 	void StartTimerRetransmit2xxL();
       
    97 	void StopTimerRetransmit2xx();	
       
    98 
       
    99 	void HandleCancelInviteL(const CUserAgentState& aRejected);
       
   100 
       
   101 	TBool InformObserverAboutCancel();
       
   102 
       
   103 	static CInviteUAS& Ptr(CUserAgent& aUserAgent);
       
   104 
       
   105 private: // Constructors, for internal use
       
   106 
       
   107 	CInviteUAS(CUserAgentCreateParams& aParams,			   
       
   108                MSipDialogs& aDialogs,
       
   109                MSIPRequestRouter& aRouter);
       
   110 
       
   111 	void ConstructL(MSipConnectionMgr& aConnectionMgr);
       
   112 
       
   113 private: // New functions, for internal use
       
   114 
       
   115 	void StartTimerWaitAckL();
       
   116 
       
   117 	void StopTimerWaitAck();
       
   118 
       
   119 	void CancelAllTimers();
       
   120 
       
   121 private: // Data
       
   122 
       
   123 	//Duration (ms) for iTimerRetransmit2xx
       
   124 	TUint iTimerRetransmit2xxDuration;
       
   125 
       
   126 	//Timer used retransmitting 2xx response until ACK is received. Owned.
       
   127 	CTimerRetransmit2xx* iTimerRetransmit2xx;
       
   128 
       
   129 	//This timer is started when entering Accepted state to wait an ACK. Owned.
       
   130 	CTimerStopUA* iTimerWaitAck;
       
   131 
       
   132 	//If ETrue, the INVITE server transaction has been canceled.
       
   133 	TBool iCanceled;
       
   134 
       
   135 private: // For testing purposes
       
   136 
       
   137 #ifdef CPPUNIT_TEST	
       
   138 	friend class CTransactionUser_Test;
       
   139     friend class CInviteUAS_Accepted_Test;
       
   140 #endif
       
   141 
       
   142 	void __DbgTestInvariant() const;
       
   143 
       
   144 
       
   145 	};
       
   146 
       
   147 #endif // end of INVITEUAS_H
       
   148 
       
   149 // End of File