realtimenetprots/sipfw/SIP/Transaction/src/TransactionState.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          : TransactionState.h
       
    16 * Part of       : Transaction
       
    17 * Version       : SIP/5.0
       
    18 *
       
    19 */
       
    20 
       
    21 
       
    22 
       
    23 
       
    24 /**
       
    25  @internalComponent
       
    26 */
       
    27 
       
    28 #ifndef TRANSACTIONSTATE_H
       
    29 #define TRANSACTIONSTATE_H
       
    30 
       
    31 // INCLUDES
       
    32 #include <in_sock.h>
       
    33 
       
    34 #include "SipLogs.h"    //for USE_SIP_LOGS
       
    35 #include "Lwtimer.h"
       
    36 #include "sipinternalstates.h"
       
    37 
       
    38 // FORWARD DECLARATIONS
       
    39 class CUri8;
       
    40 class RStringF;
       
    41 class CSIPRequest;
       
    42 class CSIPResponse;
       
    43 class TSIPTransportParams;
       
    44 
       
    45 class CTransaction;
       
    46 
       
    47 // CLASS DECLARATION
       
    48 /*
       
    49  * Base class for all states of both client and server transactions.
       
    50  * Since client and server transactions receive mostly the same events,
       
    51  * their states are derived from this common class.
       
    52  */
       
    53 class CTransactionState : public CBase
       
    54 	{
       
    55 public:
       
    56 
       
    57 	virtual ~CTransactionState();
       
    58 
       
    59 	virtual void SendRequestL(CTransaction& aTransaction,
       
    60 							  CSIPRequest& aReq,
       
    61 							  const TInetAddr& aAddress,
       
    62 							  RStringF aProtocol,
       
    63 							  TBool aForceUDP,
       
    64 							  const TSIPTransportParams& aParams,
       
    65 							  CUri8* aOutboundProxy) const;
       
    66 	virtual void SendResponseL(CTransaction& aTransaction,
       
    67 							   CSIPResponse* aResp,
       
    68 							   RStringF aProtocol,
       
    69 							   const TSIPTransportParams& aParams) const;
       
    70 
       
    71 	virtual void SendCompleteL(CTransaction& aTransaction) const;
       
    72 	virtual void SendFailedL(CTransaction& aTransaction, TInt aError) const;
       
    73 
       
    74     virtual void ReceiveL(CTransaction& aTransaction,
       
    75                           CSIPRequest* aRequest) const;	
       
    76 	virtual void ReceiveL(CTransaction& aTransaction,
       
    77                           CSIPResponse* aResponse) const;
       
    78 
       
    79 	virtual void TimerExpiredL(CTransaction& aTransaction,
       
    80 							   TTimerId aTimerId,
       
    81 							   TAny* aTimerParam) const;
       
    82 
       
    83 	/**
       
    84 	 * Tells whether the transaction can continue without the outgoing SIP
       
    85 	 * message in the send buffer.
       
    86 	 *	 
       
    87 	 * @return value ETrue if the transaction can continue, EFalse otherwise
       
    88 	 */
       
    89 	virtual TBool CanContinueWithoutOutgoingMsg() const;
       
    90 
       
    91     /**
       
    92 	 * Obtains transaction's current state.
       
    93 	 *	 
       
    94 	 * @param aState OUT: Transaction state
       
    95 	 */
       
    96     virtual void GetState(CSIPInternalStates::TState& aState) const = 0;
       
    97 
       
    98 #if defined(USE_SIP_LOGS)
       
    99 	virtual const TDesC8& Log() const;
       
   100 
       
   101     static const TDesC8& EnteringThisStateIsntLogged();
       
   102 #endif
       
   103 
       
   104 protected:
       
   105 	CTransactionState();
       
   106 
       
   107     /**
       
   108 	 * Process timer expiration.
       
   109 	 *
       
   110 	 * @pre aTimerParam != NULL
       
   111 	 *
       
   112      * @param aTransaction The transaction who owns the expired timer.
       
   113      * @param aTimerId Timer identifier
       
   114      * @param aTimerParam User specified value that was specified when the
       
   115      *  timer was started. Ownership isn't transferred.
       
   116 	 */
       
   117 	void HandleTimerExpirationL(CTransaction& aTransaction,
       
   118 								TTimerId aTimerId,
       
   119 								TAny* aTimerParam) const;
       
   120 	};
       
   121 
       
   122 #endif // end of TRANSACTIONSTATE_H
       
   123 
       
   124 // End of File