realtimenetprots/sipfw/SIP/SIPSec/IpSecPlugin/src/CStatePendingSa.cpp
changeset 0 307788aac0a8
equal deleted inserted replaced
-1:000000000000 0:307788aac0a8
       
     1 // Copyright (c) 2004-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          : CStatePendingSa.cpp
       
    15 // Part of       : SIPSec, IpSec Plugin
       
    16 // Version       : SIP/4.0 
       
    17 //
       
    18 
       
    19 
       
    20 
       
    21 #include "CSipSecAgreeRecord.h"
       
    22 #include "MIpSecAgreeContextParams.h"
       
    23 #include "MIpSecMechanismParams.h"
       
    24 #include "CStatePendingSa.h"	
       
    25 
       
    26 // ----------------------------------------------------------------------------
       
    27 // CPendingSa::CPendingSa
       
    28 // ----------------------------------------------------------------------------
       
    29 //
       
    30 CPendingSa::CPendingSa() 
       
    31     {
       
    32     }
       
    33 
       
    34 // ----------------------------------------------------------------------------
       
    35 // CPendingSa::State
       
    36 // ----------------------------------------------------------------------------
       
    37 //
       
    38 CState::TSecAgreeRecordState CPendingSa::State()
       
    39 	{
       
    40 	return EPendingSa;
       
    41 	}
       
    42 
       
    43 // ----------------------------------------------------------------------------
       
    44 // CPendingSa::SaAdded
       
    45 // ----------------------------------------------------------------------------
       
    46 //	
       
    47 void CPendingSa::SaAddedL( CSipSecAgreeRecord& aRec )
       
    48 	{
       
    49 	// SAs added successfully.
       
    50 	// Don't yet inform SA readiness to the FW, wait for successfull 
       
    51    	// completion of the policy creation
       
    52 	aRec.NextState( EPendingPolicy );
       
    53 	
       
    54 	// If reserving the ports fails or policy creation fails, notify observer
       
    55 	// about unsuccess and delete corresponding SAs
       
    56 	TRAPD( err, aRec.ReserveTransportAndCreatePolicyL() );
       
    57 	if ( err != KErrNone )
       
    58 	    {
       
    59 	    aRec.iParams.SAReady( EFalse );
       
    60 	    DeleteSasL( aRec );
       
    61 	    }
       
    62 	}
       
    63 
       
    64 // ----------------------------------------------------------------------------
       
    65 // CPendingSa::TimerExpiredL
       
    66 // ----------------------------------------------------------------------------
       
    67 //						  
       
    68 void CPendingSa::TimerExpiredL(  
       
    69 	CSipSecAgreeRecord& aRec,
       
    70 	TTimerId /* aTimerId */, 
       
    71 	TAny* /* aTimerParam */ )
       
    72 	{
       
    73 	aRec.iParams.SAReady( EFalse );
       
    74 	aRec.iParams.SaDeleted( &aRec );
       
    75 	}
       
    76 	
       
    77 // ----------------------------------------------------------------------------
       
    78 // CPendingSa::Resp4xxL
       
    79 // ----------------------------------------------------------------------------
       
    80 //	
       
    81 void CPendingSa::Resp4xxL(  
       
    82 	CSipSecAgreeRecord& aRec,
       
    83 	CSIPResponse& aResponse,
       
    84 	CSIPRequest& /* aRequest */ )
       
    85 	{
       
    86 	aRec.iParams.SAReady( EFalse );
       
    87 	ReInitializeL( aRec, aResponse, EFalse );
       
    88 	}
       
    89 
       
    90 // ----------------------------------------------------------------------------
       
    91 // CPendingSa::ClearSaL
       
    92 // ----------------------------------------------------------------------------
       
    93 //	
       
    94 void CPendingSa::ClearSaL( CSipSecAgreeRecord& aRec )
       
    95 	{
       
    96 	aRec.iParams.SAReady( EFalse );
       
    97 	aRec.StopTimer();
       
    98 	aRec.iParams.SaCleared( &aRec );	
       
    99 	}
       
   100 
       
   101 // End of File