realtimenetprots/sipfw/SIP/SIPSec/IpSecPlugin/inc/CIpSecPolicyHandler.h
changeset 0 307788aac0a8
equal deleted inserted replaced
-1:000000000000 0:307788aac0a8
       
     1 /*
       
     2 * Copyright (c) 2005-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          : CIpSecPolicyHandler.h
       
    16 * Part of       : SIPSec
       
    17 * Version       : SIP/4.0 
       
    18 *
       
    19 */
       
    20 
       
    21 
       
    22 
       
    23 
       
    24 /**
       
    25  @internalComponent
       
    26 */
       
    27 
       
    28 #ifndef CIPSECPOLICYHANDLER_H
       
    29 #define CIPSECPOLICYHANDLER_H
       
    30 
       
    31 #include <e32base.h>
       
    32 #include <ipsecpolapi.h>
       
    33 #include <in_sock.h>
       
    34 
       
    35 class MSipSecPolicyObserver;
       
    36 class TSipSecSaParams;
       
    37 
       
    38 // IpSec policy hanling
       
    39 class CIpSecPolicyHandler : public CActive
       
    40 	{
       
    41 public:
       
    42 
       
    43     enum TPolicyHandlerState
       
    44         {
       
    45         EIdle,
       
    46         ELoading,
       
    47         EActivating,
       
    48         EActive,
       
    49         EUnloading
       
    50         };
       
    51 
       
    52 	static CIpSecPolicyHandler* NewL( MSipSecPolicyObserver& aObserver,
       
    53 	                                  RIpsecPolicyServ& aPolicyServ );
       
    54 						 
       
    55 	static CIpSecPolicyHandler* NewLC( MSipSecPolicyObserver& aObserver,
       
    56 	                                   RIpsecPolicyServ& aPolicyServ );
       
    57 							  
       
    58 	~CIpSecPolicyHandler();
       
    59 	
       
    60     
       
    61     void CreatePolicyL( const TInetAddr& aLocalAddress,
       
    62 	                    const TInetAddr& aRemoteAddress,
       
    63 	                    const TSipSecSaParams& aSaParams );
       
    64 	                    
       
    65 	void RemovePolicy();
       
    66 
       
    67 protected:
       
    68 		
       
    69 	void RunL();
       
    70 	
       
    71 	TInt RunError( TInt aError );
       
    72     	
       
    73 	void DoCancel();
       
    74 
       
    75 private:
       
    76 
       
    77     CIpSecPolicyHandler( MSipSecPolicyObserver& aObserver,
       
    78                          RIpsecPolicyServ& aPolicyServ );
       
    79 
       
    80     HBufC8* GetAddrAsTextLC( const TInetAddr& aAddr );
       
    81     
       
    82     void RemovePolicyData();
       
    83     
       
    84     void NotifyActiveL();
       
    85     
       
    86     void NotifyUnload();
       
    87     
       
    88     void NotifyError( TInt aError );
       
    89     
       
    90 private: // Data
       
    91 
       
    92     MSipSecPolicyObserver& iObserver;
       
    93     
       
    94     RIpsecPolicyServ& iPolicyServ;
       
    95     
       
    96     TPolicyHandlerState iHandlerState;
       
    97     
       
    98     HBufC8* iPolicyData;
       
    99     
       
   100     TPolicyHandlePckg iPolicyHandle;
       
   101     
       
   102 						  
       
   103 #ifdef CPPUNIT_TEST
       
   104     friend class CActiveObjController1;
       
   105 #endif
       
   106 	};
       
   107 
       
   108 #endif // CIPSECPOLICYHANDLER_H
       
   109 
       
   110 
       
   111 // End of File