cmmanager/cmmgr/Plugins/cmpluginvpn/inc/cmpluginvpn.h
changeset 0 5a93021fdf25
child 3 f7816ffc66ed
equal deleted inserted replaced
-1:000000000000 0:5a93021fdf25
       
     1 /*
       
     2 * Copyright (c) 2006 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:  VPN plugin IF implementation class.
       
    15 *
       
    16 */
       
    17 
       
    18 #ifndef VPN_PLUGIN_INCLUDED
       
    19 #define VPN_PLUGIN_INCLUDED
       
    20 
       
    21 #include <e32base.h>
       
    22 #include <StringLoader.h>
       
    23 #include <cmpluginbaseeng.h>
       
    24 
       
    25 #include <cmpluginvpndef.h>
       
    26 
       
    27 using namespace CommsDat;
       
    28 
       
    29 class CCDVirtualIAPNextLayerRecord;
       
    30 
       
    31 /**
       
    32  *  VPN Plugin IF implementation class
       
    33  *  @since S60 3.2
       
    34  */
       
    35 NONSHARABLE_CLASS(CCmPluginVpn) : public CCmPluginBaseEng
       
    36     {
       
    37 
       
    38     public:     // Constructors and destructor
       
    39 
       
    40         /**
       
    41         * Two phased constructor. Leaves on failure.
       
    42         * @return The created object.
       
    43         */      
       
    44         static CCmPluginVpn* NewL( TCmPluginInitParam* aInitParam );
       
    45 
       
    46         /**
       
    47         * Destructor.
       
    48         */      
       
    49         virtual ~CCmPluginVpn();
       
    50         
       
    51         virtual CCmPluginBaseEng* CreateInstanceL( TCmPluginInitParam& aInitParam ) const;
       
    52         
       
    53     public: 
       
    54         
       
    55         /**
       
    56         * Gets the value for a TInt attribute.
       
    57         * @param aAttribute Identifies the attribute to be retrived.
       
    58         * @param aValue On completion, contains the requested TInt attribute.
       
    59         * @return None.
       
    60         */
       
    61         virtual TUint32 GetIntAttributeL( const TUint32 aAttribute ) const;
       
    62 
       
    63         /**
       
    64         * Gets the value for a TBool attribute.
       
    65         * @param aAttribute Identifies the attribute to be retrived.
       
    66         * @param aValue On completion, contains the requested TBool attribute.
       
    67         * @return None.
       
    68         */
       
    69         virtual TBool GetBoolAttributeL( const TUint32 aAttribute ) const;
       
    70 
       
    71         /**
       
    72         * Gets the value for a String16 attribute.
       
    73         * @param aAttribute Identifies the attribute to be retrived.
       
    74         * @param aValue On completion, contains the requested TDes16 attribute.
       
    75         * @return None.
       
    76         */
       
    77         virtual HBufC* GetStringAttributeL( const TUint32 aAttribute ) const;
       
    78 
       
    79 		/**
       
    80 		* Gets the value for a String8 attribute.
       
    81 		* @param aAttribute Identifies the attribute to be retrived.
       
    82         * @return copy of the requested attribute. Ownership is passed.
       
    83 		*/
       
    84 		virtual HBufC8* GetString8AttributeL( const TUint32 aAttribute ) const;
       
    85 
       
    86         /**
       
    87         * Sets the value for a TInt attribute.
       
    88         * @param aAttribute Identifies the attribute to be set.
       
    89         * @param aValue The value to be set.
       
    90         * @return None.
       
    91         */
       
    92         virtual void SetIntAttributeL( const TUint32 aAttribute, TUint32 aValue );
       
    93 
       
    94         /**
       
    95         * Sets the value for a TBool attribute.
       
    96         * @param aAttribute Identifies the attribute to be set.
       
    97         * @param aValue The value to be set.
       
    98         * @return None.
       
    99         */
       
   100         virtual void SetBoolAttributeL( const TUint32 aAttribute, TBool aValue );
       
   101 
       
   102         /**
       
   103         * Sets the value for a String16 attribute.
       
   104         * @param aAttribute Identifies the attribute to be set.
       
   105         * @param aValue The value to be set.
       
   106         * @return None.
       
   107         */
       
   108         virtual void SetStringAttributeL( const TUint32 aAttribute, 
       
   109                                           const TDesC16& aValue );
       
   110 
       
   111 		/**
       
   112 		* Sets the value for a String8 attribute.
       
   113 		* @param aAttribute Identifies the attribute to be set.
       
   114 		* @param aValue The value to be set.
       
   115         * @return None.
       
   116 		*/
       
   117 		virtual void SetString8AttributeL( const TUint32 aAttribute, 
       
   118 		                                   const TDesC8& aValue );
       
   119 
       
   120 
       
   121 		void UpdatePolicyNameL();
       
   122 		
       
   123         /**
       
   124         * Puts the currently available bindable destinations into the 
       
   125         * passed array. The array is emptied before appending the values.
       
   126         * It contains only real destinations, no uncategorised 
       
   127         * or any other, created ones (Always ask, DefaultConnection, etc)
       
   128         */
       
   129         void BindableDestinationsL( RArray<TUint32>& aDestinationArray );
       
   130         
       
   131         /**
       
   132         * Change the VPN connection method name when using 
       
   133         * 'Search for WLAN' functionality
       
   134         */
       
   135         HBufC* GenerateVPNPointToWLANNetworkLC(RResourceFile& rf, HBufC*& aName);
       
   136 		
       
   137     public: // From CCmPluginBaseEng        
       
   138 
       
   139         /**
       
   140         * Restore the original value of the attribute from commsdat field.
       
   141         * Base implementation can be used only with attributes 
       
   142         * stored directly in commsdat.
       
   143         * @param aAttribute attribute to be restored
       
   144         */
       
   145         virtual void RestoreAttributeL( const TUint32 aAttribute );
       
   146         
       
   147         /**
       
   148         * Override the load to be able to handle post-processing
       
   149         *
       
   150         */
       
   151         virtual void LoadL( TUint32 aIapId );
       
   152         
       
   153         virtual TBool CanHandleIapIdL( TUint32 aIapId ) const;
       
   154         virtual TBool CanHandleIapIdL( CCDIAPRecord *aIapRecord ) const;
       
   155         
       
   156         virtual TInt RunSettingsL();
       
   157         virtual void LoadServiceSettingL();
       
   158         virtual void LoadAdditionalRecordsL();
       
   159         
       
   160         virtual void UpdateAdditionalRecordsL();
       
   161 
       
   162         virtual TBool InitializeWithUiL( TBool aManuallyConfigure  );
       
   163         
       
   164         virtual void ServiceRecordIdLC( HBufC* &aServiceName, 
       
   165                                         TUint32& aRecordId );
       
   166 
       
   167         virtual void BearerRecordIdLC( HBufC* &aBearerName, 
       
   168                                        TUint32& aRecordId );
       
   169                                        
       
   170         virtual void PrepareToUpdateRecordsL();
       
   171         
       
   172         virtual TBool IsLinkedToIap( TUint32 aIapId );
       
   173         virtual TBool IsLinkedToSnap( TUint32 aSnapId );
       
   174         
       
   175         virtual void CreateNewL();
       
   176 
       
   177         /**
       
   178         * From CCmPluginBaseEng
       
   179         * Deletes additional records, in this case, the WLAN records
       
   180         *
       
   181         * @since S60 3.2
       
   182         */
       
   183         void DeleteAdditionalRecordsL();
       
   184         
       
   185     protected:
       
   186     
       
   187         virtual void AdditionalReset();
       
   188     
       
   189     private: // Constructors
       
   190 
       
   191         /**
       
   192         * Constructor.
       
   193         */      
       
   194         CCmPluginVpn( TCmPluginInitParam* aInitParam );
       
   195 
       
   196         /**
       
   197         * Second phase constructor. Leaves on failure.
       
   198         * @param
       
   199         */      
       
   200         void ConstructL();
       
   201 
       
   202     private:
       
   203     
       
   204         CCDVPNServiceRecord& ServiceRecord() const;
       
   205 
       
   206         TBool ServiceRecordExists() const;
       
   207         
       
   208         virtual void CreateNewServiceRecordL();
       
   209         virtual void CreateAdditionalRecordsL();
       
   210         
       
   211         virtual void UpdateServiceRecordL();
       
   212         
       
   213         /**
       
   214         * Displays a list of installed VPN policies for user selection
       
   215         * and updates the setting
       
   216         *
       
   217         * @since S60 3.2
       
   218         * @return the soft key selection
       
   219         */
       
   220         TBool ShowPolicySelectionDlgL();
       
   221         
       
   222         /**
       
   223         * Shows a dialog for selecting the underlying connection method
       
   224         *
       
   225         * @since S60 3.2
       
   226         * @return ETrue if success
       
   227         */
       
   228         TBool ShowRealConnectionSelectionDlgL();
       
   229         
       
   230         /**
       
   231         * Checks whether there are connection methods or destinations which
       
   232         * the VPN connection method can bind to
       
   233         * 
       
   234         * @since S60 3.2
       
   235         * @return ETrue found
       
   236         */
       
   237         TBool BindableRealConnectionsExistL();
       
   238 
       
   239         void GenerateDefaultCmNameL();  
       
   240         
       
   241         /**
       
   242         * Returns whether the passed destination can be used as an underlying
       
   243         * connection method for this particular CM.
       
   244         * It can be used if it does not points to VPN in any way, directly or
       
   245         * indirectly, it has at least one, non-virtual CM and
       
   246         * it does not links back to our parent destination.
       
   247         * The returned value is a bit field defined in the src file and 
       
   248         * it holds the following informations: 
       
   249         * IsEmpty, ContainsVPN(in any link), LinksBackToPArentDest and
       
   250         * HasNonVirtualCM to be able to decide if it is suitable.
       
   251         * Used only internally.
       
   252         */
       
   253         TUint32 CanDestUsedAsUnderlyingConnectionL( TUint32 aDestinationId );
       
   254 
       
   255 
       
   256         /**
       
   257         * Checks whether the destination/CM passed to it has a VPN connection
       
   258         * up-stream (there is a path from a VPN to this item through indirections).
       
   259         * 
       
   260         * @param aId The id of the destination/connmethod in question.
       
   261         * @param aIsDestination ETrue if the passed id is to be considered 
       
   262         *                       that of a destination, EFalse otherwise.
       
   263         * @return ETrue if this entity is pointed to (in/directly) by a VPN.
       
   264         */
       
   265         TBool HasUpstreamVpnL( TUint32 aId, TBool aIsDestination );
       
   266 
       
   267         /**
       
   268         * Checks and converts the id of the destination if needed
       
   269         * 
       
   270         * @param aDestination the id of the destination
       
   271         * @since S60 5.2
       
   272         * @return the correct id of the destination 
       
   273         *         or leaves with the error code KErrArgument 
       
   274         */                    
       
   275         TInt CheckValidityAndConvertDestinationIdL( TUint32 aDestinationId );
       
   276 
       
   277     public:                
       
   278         /**
       
   279         * Scans aDests for destinations that may be valid parents 
       
   280         * for this plugin and removes those that may not.
       
   281         * @param aDests The array of destination IDs to be filtered.
       
   282         */
       
   283         virtual void FilterPossibleParentsL( RArray<TUint32>& aDests );
       
   284 
       
   285         // finds the parent destination of the connmethod with the given ID
       
   286         TUint32 FindParentDestinationL( TUint32 aCmId );
       
   287         
       
   288     private: // Data
       
   289     
       
   290         CCmPluginBaseEng*       iRealCM;
       
   291         CCDVirtualIAPNextLayerRecord*   iVirtualRecord;
       
   292         TMDBElementId           iVirtualTableId;
       
   293         HBufC*                  iPolicyName;
       
   294         
       
   295         /**
       
   296          * An array of the bindable destinations, 
       
   297          * including (if supported) the uncategorised destation and easy wlan
       
   298          */
       
   299         RArray<TUint32> iBindableMethods;
       
   300     };
       
   301 
       
   302 #endif // VPN_PLUGIN_INCLUDED