realtimenetprots/sipfw/SIP/Transaction/inc/TransactionBase.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          : TransactionBase.h
       
    16 * Part of       : Transaction
       
    17 * Version       : SIP/5.0 
       
    18 *
       
    19 */
       
    20 
       
    21 
       
    22 
       
    23 
       
    24 /**
       
    25  @internalComponent
       
    26 */
       
    27 
       
    28 
       
    29 #ifndef TRANSACTIONBASE_H
       
    30 #define TRANSACTIONBASE_H
       
    31 
       
    32 // INCLUDES
       
    33 #include "SipStackServerDefs.h"
       
    34 #include "sipinternalstates.h"
       
    35 #include "TransactionReceiver.h"
       
    36 
       
    37 #ifdef CPPUNIT_TEST
       
    38 #include "TestCleanupStack.h"
       
    39 #endif
       
    40 
       
    41 // FORWARD DECLARATIONS
       
    42 class RStringF;
       
    43 class CUri8;
       
    44 class CSIPRequest;
       
    45 class CSIPResponse;
       
    46 
       
    47 // CLASS DECLARATION
       
    48 /*
       
    49  * Transaction interface to TransactionUser side
       
    50  */
       
    51 class CTransactionBase :
       
    52     public CBase,
       
    53 	public MTransactionReceiver
       
    54 	{
       
    55 public: // Enumerations
       
    56 
       
    57 	//Different types of the transaction state machines
       
    58 	enum TTransactionType
       
    59         {
       
    60 	    KUndefinedTransaction = 0,	//Initialization value
       
    61 	    KServerTransaction,			//non-INVITE
       
    62 		KServerInviteTransaction,
       
    63 	    KClientTransaction,			//non-INVITE
       
    64 		KClientInviteTransaction
       
    65 	    };
       
    66 
       
    67 public: // Destructor
       
    68 
       
    69 	virtual ~CTransactionBase() {}
       
    70 
       
    71 public: // From MTransactionReceiver
       
    72 
       
    73     virtual void ReceiveL(CSIPRequest* aRequest) = 0;
       
    74 
       
    75 	virtual void ReceiveL(CSIPResponse* aResponse) = 0;
       
    76 
       
    77 	virtual void LeaveOccurred(TInt aReason) = 0;
       
    78 
       
    79 	virtual const TSIPTransportParams& TransportParams() const = 0;
       
    80 
       
    81 	virtual void IcmpErrorL(const TInetAddr& aAddress,
       
    82 						    CSipConnectionMgr::TICMPError aError) = 0;
       
    83 
       
    84 public: // New pure virtual functions
       
    85 
       
    86 	/**
       
    87 	 * Send a SIP request to the transaction.
       
    88 	 *	 
       
    89 	 * @param aReq SIP request message
       
    90 	 * @param aAddress Address where the request is sent
       
    91 	 * @param aProtocol Transport protocol to use
       
    92 	 * @param aForceUDP ETrue if transport protocol can't be changed from UDP
       
    93 	 * @param aParams Transport parameters
       
    94 	 * @param aOutboundProxy Outbound proxy, NULL pointer if not used.
       
    95      *        The ownership is transferred.
       
    96 	 */
       
    97 	virtual void SendRequestL(CSIPRequest& aReq,
       
    98 							  const TInetAddr& aAddress,
       
    99 							  RStringF aProtocol,
       
   100 							  TBool aForceUDP,
       
   101 							  const TSIPTransportParams& aParams,
       
   102 							  CUri8* aOutboundProxy) = 0;
       
   103 
       
   104 	/**
       
   105 	 * Send a SIP response message to the transaction.
       
   106 	 *
       
   107 	 * @pre aResp != NULL
       
   108 	 *
       
   109 	 * @param aResp SIP response message. Ownership is transferred.	 
       
   110 	 * @param aProtocol Transport protocol to use
       
   111 	 * @param aParams Transport parameters	 
       
   112 	 */
       
   113 	virtual void SendResponseL(CSIPResponse* aResp,
       
   114 							   RStringF aProtocol,
       
   115 							   const TSIPTransportParams& aParams) = 0;
       
   116 
       
   117 	/**
       
   118 	 * Clears the send buffer pointer (iOutgoingMsg), unless it contains ACK,
       
   119 	 * which is the case of CInviteClientTransaction which has created the ACK
       
   120 	 * by itself and owns it.
       
   121 	 *	 	 
       
   122 	 * @return value ETrue if the transaction can continue even without the
       
   123 	 *	outgoing SIP message, EFalse otherwise.
       
   124 	 */
       
   125 	virtual TBool ClearSendBuffer() = 0;
       
   126 
       
   127     /**
       
   128 	 * Obtains the transaction's current state.
       
   129 	 *	 
       
   130 	 * @param aState OUT: Transaction's state
       
   131 	 */
       
   132     virtual void GetState(CSIPInternalStates::TState& aState) = 0;
       
   133 
       
   134 	/**
       
   135 	 * Force transaction to terminate, meaning it enters the Terminated state.
       
   136 	 */
       
   137 	virtual void Terminated() = 0;
       
   138 
       
   139 	/**
       
   140 	 * Force transaction to terminate, meaning it enters the Terminated state.
       
   141 	 *
       
   142 	 * @param aReason Reason why the transaction ends.	 
       
   143 	 */
       
   144 	virtual void TerminatedL(TInt aReason) = 0;
       
   145 
       
   146 	/**
       
   147 	 * Check if the transaction state machine has reached the terminated state.
       
   148 	 *
       
   149 	 * @return ETrue:  Transaction has terminated
       
   150      * 		   EFalse: Otherwise
       
   151 	 */
       
   152 	virtual TBool HasTerminated() const = 0;
       
   153 
       
   154 	/**
       
   155 	 * Clear transaction's callback to UserAgent, so that when the transaction
       
   156 	 * terminates, it won't send TransactionEndsL event to UserAgent, because
       
   157 	 * the UserAgent may have created another transaction for sending a SIP
       
   158 	 * request.	 
       
   159 	 */
       
   160 	virtual void DetachFromUserAgent() = 0;
       
   161 	
       
   162 	/**
       
   163 	 * Return the transport protocol used by the transaction.
       
   164 	 *
       
   165 	 * @return Transport protocol
       
   166 	 */
       
   167 	virtual RStringF TransportProtocol() const = 0;
       
   168 	};
       
   169 
       
   170 #endif // end of TRANSACTIONBASE_H
       
   171 
       
   172 // End of File