realtimenetprots/sipfw/SIP/Transaction/src/TransactionState.cpp
changeset 0 307788aac0a8
equal deleted inserted replaced
-1:000000000000 0:307788aac0a8
       
     1 // Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     2 // All rights reserved.
       
     3 // This component and the accompanying materials are made available
       
     4 // under the terms of "Eclipse Public License v1.0"
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 // Name          : TransactionState.cpp
       
    15 // Part of       : Transaction
       
    16 // Version       : SIP/5.0
       
    17 //
       
    18 
       
    19 
       
    20 
       
    21 #include "SipAssert.h"
       
    22 #include "siprequest.h"
       
    23 
       
    24 #include "NormalClientTa.h"
       
    25 #include "InviteClientTa.h"
       
    26 #include "NormalServerTa.h"
       
    27 #include "InviteServerTa.h"
       
    28 
       
    29 #include "TransactionState.h"
       
    30 #include "TransactionTimer.h"
       
    31 
       
    32 
       
    33 // -----------------------------------------------------------------------------
       
    34 // CTransactionState::CTransactionState
       
    35 // -----------------------------------------------------------------------------
       
    36 //
       
    37 CTransactionState::CTransactionState()
       
    38 	{
       
    39 	}
       
    40 
       
    41 // -----------------------------------------------------------------------------
       
    42 // CTransactionState::~CTransactionState
       
    43 // -----------------------------------------------------------------------------
       
    44 //
       
    45 CTransactionState::~CTransactionState()
       
    46 	{
       
    47 	}
       
    48 
       
    49 // -----------------------------------------------------------------------------
       
    50 // CTransactionState::SendRequestL
       
    51 // -----------------------------------------------------------------------------
       
    52 //
       
    53 void CTransactionState::SendRequestL(CTransaction& /*aTransaction*/,
       
    54 							     CSIPRequest& /*aReq*/,
       
    55 							     const TInetAddr& /*aAddress*/,								     
       
    56 							     RStringF /*aProtocol*/,
       
    57 							     TBool /*aForceUDP*/,
       
    58 							     const TSIPTransportParams& /*aParams*/,
       
    59 							     CUri8* /*aOutboundProxy*/) const
       
    60 	{
       
    61     __SIP_ASSERT_LEAVE(EFalse, KErrGeneral);
       
    62 	}
       
    63 
       
    64 // -----------------------------------------------------------------------------
       
    65 // CTransactionState::SendResponseL
       
    66 // -----------------------------------------------------------------------------
       
    67 //
       
    68 void CTransactionState::SendResponseL(CTransaction& /*aTransaction*/,
       
    69 						      CSIPResponse* aResp,								      
       
    70 						      RStringF /*aProtocol*/,
       
    71 						      const TSIPTransportParams& /*aParams*/) const
       
    72 	{
       
    73     __SIP_ASSERT_LEAVE(aResp, KErrArgument);
       
    74 	__SIP_ASSERT_LEAVE(EFalse, KErrGeneral);
       
    75 	}
       
    76 
       
    77 // -----------------------------------------------------------------------------
       
    78 // CTransactionState::SendCompleteL
       
    79 // -----------------------------------------------------------------------------
       
    80 //
       
    81 void CTransactionState::SendCompleteL(CTransaction& /*aTransaction*/) const
       
    82 	{
       
    83     __SIP_ASSERT_LEAVE(EFalse, KErrGeneral);
       
    84 	}
       
    85 
       
    86 // -----------------------------------------------------------------------------
       
    87 // CTransactionState::SendFailedL
       
    88 // -----------------------------------------------------------------------------
       
    89 //
       
    90 void CTransactionState::SendFailedL(CTransaction& /*aTransaction*/,
       
    91 									TInt /*aError*/) const
       
    92 	{    
       
    93     __SIP_ASSERT_LEAVE(EFalse, KErrGeneral);
       
    94 	}
       
    95 
       
    96 // -----------------------------------------------------------------------------
       
    97 // CTransactionState::ReceiveL
       
    98 // -----------------------------------------------------------------------------
       
    99 //
       
   100 void CTransactionState::ReceiveL(CTransaction& /*aTransaction*/,
       
   101                                  CSIPRequest* aRequest) const
       
   102     {
       
   103     __SIP_ASSERT_LEAVE(aRequest, KErrArgument);    
       
   104     __SIP_ASSERT_LEAVE(EFalse, KErrGeneral);
       
   105     }
       
   106 
       
   107 // -----------------------------------------------------------------------------
       
   108 // CTransactionState::ReceiveL
       
   109 // -----------------------------------------------------------------------------
       
   110 //	
       
   111 void CTransactionState::ReceiveL(CTransaction& /*aTransaction*/,
       
   112                                  CSIPResponse* aResponse) const
       
   113     {
       
   114     __SIP_ASSERT_LEAVE(aResponse, KErrArgument);
       
   115     __SIP_ASSERT_LEAVE(EFalse, KErrGeneral);
       
   116     }
       
   117 
       
   118 // -----------------------------------------------------------------------------
       
   119 // CTransactionState::TimerExpiredL
       
   120 // -----------------------------------------------------------------------------
       
   121 //
       
   122 void CTransactionState::TimerExpiredL(CTransaction& /*aTransaction*/,
       
   123 								      TTimerId /*aTimerId*/,
       
   124 								      TAny* aTimerParam) const
       
   125 	{
       
   126     __SIP_ASSERT_LEAVE(aTimerParam, KErrArgument);
       
   127     __SIP_ASSERT_LEAVE(EFalse, KErrGeneral);
       
   128 	}
       
   129 
       
   130 // -----------------------------------------------------------------------------
       
   131 // CTransactionState::HandleTimerExpirationL
       
   132 // -----------------------------------------------------------------------------
       
   133 //
       
   134 void CTransactionState::HandleTimerExpirationL(CTransaction& aTransaction,
       
   135 											   TTimerId aTimerId,
       
   136 											   TAny* aTimerParam) const
       
   137 	{
       
   138 	__SIP_ASSERT_LEAVE(aTimerParam, KErrArgument);	
       
   139 
       
   140 	CTransactionTimer* timer =
       
   141         reinterpret_cast<CTransactionTimer*>(aTimerParam);
       
   142 	timer->ExpiredL(aTransaction, aTimerId);
       
   143 
       
   144 	//Even if CTransactionTimer::ExpiredL() used DeleteMgr to free the expired
       
   145 	//timer (timer) and started a new instance of the same timer, the following
       
   146 	//call is ok. It just doesn't do anything since timer points to the old
       
   147 	//timer, and aTransaction now has the a pointer to the new timer.
       
   148 	aTransaction.DeleteTimer(*timer);
       
   149 	}
       
   150 
       
   151 // -----------------------------------------------------------------------------
       
   152 // CTransactionState::CanContinueWithoutOutgoingMsg
       
   153 // -----------------------------------------------------------------------------
       
   154 //
       
   155 TBool CTransactionState::CanContinueWithoutOutgoingMsg() const
       
   156 	{
       
   157 	//By default, CTransaction can't continue without iOutgoingMsg
       
   158 	return EFalse;
       
   159 	}
       
   160 
       
   161 #if defined(USE_SIP_LOGS)
       
   162 // -----------------------------------------------------------------------------
       
   163 // CTransactionState::Log
       
   164 // -----------------------------------------------------------------------------
       
   165 //
       
   166 const TDesC8& CTransactionState::Log() const
       
   167 	{
       
   168 	return KNullDesC8;
       
   169 	}
       
   170 
       
   171 // -----------------------------------------------------------------------------
       
   172 // CTransactionState::EnteringThisStateIsntLogged
       
   173 // -----------------------------------------------------------------------------
       
   174 //
       
   175 const TDesC8& CTransactionState::EnteringThisStateIsntLogged()
       
   176     {
       
   177     //This constant is needed to avoid writing CInviteServerTransaction's
       
   178     //transition into state Sending2xx to log, but to get the transition from
       
   179     //state Sending2xx to Terminated written into log. An empty descriptor
       
   180     //can't be used here.
       
   181     _LIT8(KEnteringThisStateIsntLogged, " ");
       
   182 
       
   183     return KEnteringThisStateIsntLogged;
       
   184     }
       
   185 #endif