cmmanager/cmmgr/cmmplugins/cmpluginvpn/inc/cmpluginvpn.h
changeset 32 5c4486441ae6
equal deleted inserted replaced
31:c16e04725da3 32:5c4486441ae6
       
     1 /*
       
     2 * Copyright (c) 2009-2010 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 *      Declaration of VPN CmManager plugin interface implementation 
       
    16 *      
       
    17 *
       
    18 */
       
    19 
       
    20 #ifndef CMPLUGINVPN_H
       
    21 #define CMPLUGINVPN_H
       
    22 
       
    23 // INCLUDES
       
    24 #include <cmpluginbaseeng.h>
       
    25 #include <cmpluginvpndef.h>
       
    26 
       
    27 // FORWARD DECLARATION
       
    28 class CCDVirtualIAPNextLayerRecord;
       
    29 
       
    30 /**
       
    31 *  CCmPluginVpn defines the functionality of vpn bearer support.
       
    32 *  Most of the API is inherited from CCmPluginBaseEng class.
       
    33 */
       
    34 NONSHARABLE_CLASS( CCmPluginVpn ) : public CCmPluginBaseEng
       
    35     {
       
    36     public: // Constructors and destructor
       
    37         /**
       
    38          * Two phased constructor.
       
    39          * @return Returns the VPN plugin object.
       
    40          */      
       
    41 		static CCmPluginVpn* NewL( TCmPluginInitParam* aInitParam );
       
    42 
       
    43         /**
       
    44          * Destructor.
       
    45          */      
       
    46         virtual ~CCmPluginVpn();
       
    47 
       
    48     public: // From CCmPluginBaseEng
       
    49         /**
       
    50          * Creates a new instance of VPN bearer plugin. The instance
       
    51          * created represents a bearer, not a connection method.
       
    52          * @param aInitParam Initialization data.
       
    53          * @return Returns CCmPluginBaseEng type pointer which represents pure
       
    54          * bearer instance for the cmm server.
       
    55          */
       
    56         virtual CCmPluginBaseEng* CreateInstanceL( 
       
    57                 TCmPluginInitParam& aInitParam ) const;
       
    58                 
       
    59         /**
       
    60          * Following GetBearerInfoXXXL methods return the values of the 
       
    61          * requested attributes. These values are bearerspecific so they
       
    62          * don't vary between CMs with same bearer type.
       
    63          * @param aAttribute An attribute identifier.
       
    64          * @return Returns the value requested. If not found leaves with
       
    65          * KErrNotFound error code. 
       
    66          */
       
    67         virtual TUint32 GetBearerInfoIntL( TUint32 aAttribute ) const;
       
    68         
       
    69         virtual TBool GetBearerInfoBoolL( TUint32 aAttribute ) const;
       
    70 
       
    71         virtual HBufC* GetBearerInfoStringL( TUint32 aAttribute ) const;
       
    72         
       
    73         virtual HBufC8* GetBearerInfoString8L( TUint32 aAttribute ) const;
       
    74 
       
    75         /**
       
    76          * Checks if the plug-in can handle the Connection Method identified
       
    77          * with parameter aIapId.
       
    78          * @param aIapId IAPId of the AP to be checked
       
    79          * @return ETrue if plug-in can handle the IAP, otherwise EFalse.
       
    80          */
       
    81         TBool CanHandleIapIdL( TUint32 aIapId ) const;
       
    82          
       
    83         /**
       
    84          * Checks if the plug-in can handle the given IAP record.
       
    85          * @param aIapRecord IAP record to be checked
       
    86          * @return ETrue if plug-in can handle the IAP, otherwise EFalse.
       
    87          */
       
    88         TBool CanHandleIapIdL( CommsDat::CCDIAPRecord* aIapRecord ) const;
       
    89 
       
    90         /**
       
    91          * Requests CommsDat table ids to be observed for changes by the cmm
       
    92          * server. If a table used is not mentioned to be modified a bearer
       
    93          * shouldn't return this. Bearers do not reset the array before adding
       
    94          * ids.
       
    95          * @param aTableIdArray A reference to an array where plugin must add
       
    96          * the ids of the tables it want's to be observed.
       
    97          */
       
    98         void GetBearerTableIdsToBeObservedL( RArray<TUint32>& aTableIdArray ) const;
       
    99 
       
   100         
       
   101         /**
       
   102          * Creates a copy of all bearer specific CommsDat data for the client.
       
   103          * Called as result of GetPluginDataL().
       
   104          * @param aRecordArray An array where the copy the records. Only 
       
   105          * the bearer specific implementation knows the amount and order
       
   106          * of these records in the array.
       
   107          */
       
   108         virtual void GetBearerSpecificRecordsL( 
       
   109                 RPointerArray<CommsDat::CCDRecordBase>& aRecordArray );
       
   110 
       
   111         /**
       
   112          * Following GetBearerXXXXAttribute methods get only the
       
   113          * fields in records in pointer arrays(parameters).
       
   114          * @param aAttribute Identifier of the requested value.
       
   115          * @param aGenRecordArray An array containing pointers to generic 
       
   116          * records of the Connection Method.
       
   117          * @param aBearerSpecRecordArray An array containing pointers to bearer
       
   118          * specific records of the Connection Method. aAttribute
       
   119          * parameter should identify one field(integer, boolean string)
       
   120          * in one of these records. 
       
   121          * @return Returns the requested value. In error case leaves with 
       
   122          * system-wide error code.
       
   123          */
       
   124 
       
   125         virtual TUint32 GetBearerIntAttributeL( 
       
   126                 TUint32 aAttribute, 
       
   127                 RPointerArray<CommsDat::CCDRecordBase>& aGenRecordArray,
       
   128                 RPointerArray<CommsDat::CCDRecordBase>& aBearerSpecRecordArray );
       
   129         
       
   130         virtual TBool GetBearerBoolAttributeL( 
       
   131                 TUint32 aAttribute, 
       
   132                 RPointerArray<CommsDat::CCDRecordBase>& aGenRecordArray,
       
   133                 RPointerArray<CommsDat::CCDRecordBase>& aBearerSpecRecordArray );
       
   134                                          
       
   135         virtual HBufC* GetBearerStringAttributeL( 
       
   136                 TUint32 aAttribute, 
       
   137                 RPointerArray<CommsDat::CCDRecordBase>& aGenRecordArray,
       
   138                 RPointerArray<CommsDat::CCDRecordBase>& aBearerSpecRecordArray );
       
   139         
       
   140         virtual HBufC8* GetBearerString8AttributeL( 
       
   141                 TUint32 aAttribute, 
       
   142                 RPointerArray<CommsDat::CCDRecordBase>& aGenRecordArray,
       
   143                 RPointerArray<CommsDat::CCDRecordBase>& aBearerSpecRecordArray );
       
   144 
       
   145         /**
       
   146          * Following SetBearerXXXXAttribute methods set only the
       
   147          * fields in records in pointer arrays(parameters). They are not 
       
   148          * allowed to update the original records in plugins.
       
   149          * @param aAttribute Identifier of the field to set.
       
   150          * @param aValue The value to set.
       
   151          * @param aGenRecordArray An array containing pointers to generic 
       
   152          * records of the Connection Method.
       
   153          * @param aBearerSpecRecordArray An array containing pointers to bearer
       
   154          * specific records of the Connection Method. aAttribute
       
   155          * parameter should identify one field(integer, boolean string)
       
   156          * in one of these records. 
       
   157          * @return None.
       
   158          */
       
   159 
       
   160         virtual void SetBearerIntAttributeL( 
       
   161                 TUint32 aAttribute, 
       
   162                 TUint32 aValue, 
       
   163                 RPointerArray<CommsDat::CCDRecordBase>& aGenRecordArray,
       
   164                 RPointerArray<CommsDat::CCDRecordBase>& aBearerSpecRecordArray );
       
   165         
       
   166         virtual void SetBearerBoolAttributeL( 
       
   167                 TUint32 aAttribute, 
       
   168                 TBool aValue,
       
   169                 RPointerArray<CommsDat::CCDRecordBase>& aGenRecordArray,
       
   170                 RPointerArray<CommsDat::CCDRecordBase>& aBearerSpecRecordArray );
       
   171                                          
       
   172         virtual void SetBearerStringAttributeL( 
       
   173                 TUint32 aAttribute, 
       
   174                 const TDesC16& aValue,
       
   175                 RPointerArray<CommsDat::CCDRecordBase>& aGenRecordArray,
       
   176                 RPointerArray<CommsDat::CCDRecordBase>& aBearerSpecRecordArray );
       
   177 
       
   178         virtual void SetBearerString8AttributeL( 
       
   179                 TUint32 aAttribute, 
       
   180                 const TDesC8& aValue,                                                    
       
   181                 RPointerArray<CommsDat::CCDRecordBase>& aGenRecordArray,
       
   182                 RPointerArray<CommsDat::CCDRecordBase>& aBearerSpecRecordArray );
       
   183 
       
   184         /**
       
   185          * Inherited from CCmPluginBaseEng. 
       
   186          * Implementation is empty.
       
   187          */
       
   188         virtual void PreparePluginToLoadRecordsL();
       
   189         
       
   190         /**
       
   191          * Inherited from CCmPluginBaseEng. 
       
   192          * Implementation is empty.
       
   193          * @param aCopyInstance Client side data instance.
       
   194          */
       
   195         virtual void PrepareToCopyDataL( CCmPluginBaseEng* aCopyInstance );
       
   196 
       
   197         /**
       
   198          * Inherited from CCmPluginBaseEng. 
       
   199          * Implementation is empty.
       
   200          * @param aGenRecordArray Reference to generic records pointer array.
       
   201          * @param aBearerSpecRecordArray Reference to bearer specific records 
       
   202          * pointer array.
       
   203          */
       
   204         virtual void PreparePluginToUpdateRecordsL(
       
   205                 RPointerArray<CommsDat::CCDRecordBase>& aGenRecordArray,
       
   206                 RPointerArray<CommsDat::CCDRecordBase>& aBearerSpecRecordArray );
       
   207 
       
   208         /**
       
   209          * Plugin can prepare to delete the Connection Method with this 
       
   210          * function. Called from DeleteL() before any record would be 
       
   211          * deleted. No records are deleted here.
       
   212          */
       
   213         virtual void PrepareToDeleteRecordsL();
       
   214 
       
   215         /**
       
   216          * Loads the service record. Service record type is known and loaded by 
       
   217          * plugin(bearer specific) part of the implementation even if the record
       
   218          * is saved to the generic side. Service record is linked to IAP record.
       
   219          */
       
   220         virtual void LoadServiceRecordL();
       
   221 
       
   222         /**
       
   223          * Creates the service records.
       
   224          */
       
   225         virtual void CreateServiceRecordL();
       
   226 
       
   227         /**
       
   228          * Update service record.
       
   229          * @param aGenRecordArray Reference to generic records pointer array.
       
   230          * @param aBearerSpecRecordArray Reference to bearer specific records 
       
   231          * pointer array.
       
   232          */
       
   233         virtual void UpdateServiceRecordL( 
       
   234                 RPointerArray<CommsDat::CCDRecordBase>& aGenRecordArray,
       
   235                 RPointerArray<CommsDat::CCDRecordBase>& aBearerSpecRecordArray );
       
   236 
       
   237         /**
       
   238          * Copies the service record. Bearer specific part knows the type of it's
       
   239          * service record.
       
   240          * @return Returns the service record pointer. 
       
   241          */
       
   242         virtual CommsDat::CCDRecordBase* CopyServiceRecordL();
       
   243 
       
   244         /**
       
   245          * Returns the service record id of the Connection Method.
       
   246          * @return Returns the id of the service record id of the Connection Method.
       
   247          */
       
   248         virtual TUint32 ServiceRecordId() const;
       
   249 
       
   250         /**
       
   251          * Returns the service record name of the Connection Method.
       
   252          * @param aServiceName Name of the service record the CM's iap record 
       
   253          * points to.
       
   254          */
       
   255         virtual void ServiceRecordNameLC( HBufC* &aServiceName );
       
   256 
       
   257         /**
       
   258          * Inherited class loads all the bearer specific records after 
       
   259          * loading generic records. Called from LoadL(). 
       
   260          */
       
   261         virtual void LoadBearerRecordsL();
       
   262 
       
   263         /**
       
   264          * Creates bearer specific records.
       
   265          */
       
   266         virtual void CreateBearerRecordsL();
       
   267 
       
   268         /**
       
   269          * Update bearer specific records.
       
   270          * @param aGenRecordArray Reference to generic records pointer array.
       
   271          * @param aBearerSpecRecordArray Reference to bearer specific records 
       
   272          */
       
   273         virtual void UpdateBearerRecordsL( 
       
   274                 RPointerArray<CommsDat::CCDRecordBase>& aGenRecordArray,
       
   275                 RPointerArray<CommsDat::CCDRecordBase>& aBearerSpecRecordArray );
       
   276 
       
   277         /**
       
   278          * Plugin(generic part) can delete bearer specific records
       
   279          * with this function. Called from DeleteL().
       
   280          */
       
   281         virtual void DeleteBearerRecordsL();
       
   282 
       
   283          /** 
       
   284           * Resets the bearer specific records. 
       
   285           */
       
   286          virtual void ResetBearerRecords();
       
   287 
       
   288         /**
       
   289          * Copies the bearer specific records to copy instance given as 
       
   290          * parameter. 
       
   291          * @param aCopyInstance Pointer to instance where to copy.
       
   292          */
       
   293         virtual void CopyBearerRecordsL( CCmPluginBaseEng* aCopyInstance );
       
   294 
       
   295         /**
       
   296          * Returns the bearer record id of the Connection Method.
       
   297          * @param aRecordId Id of the bearer record this CM's iap record 
       
   298          * points to.
       
   299          */
       
   300         virtual void BearerRecordIdL( TUint32& aRecordId );
       
   301 
       
   302         /**
       
   303          * Returns the bearer record name of the Connection Method.
       
   304          * @param aBearerName Name of the bearer record this CM's iap record 
       
   305          * points to.
       
   306          */
       
   307         virtual void BearerRecordNameLC( HBufC* &aBearerName );
       
   308 
       
   309         
       
   310     private: // Constructors
       
   311         /**
       
   312         * Constructor.
       
   313         */      
       
   314 		CCmPluginVpn( TCmPluginInitParam* aInitParam );
       
   315 
       
   316         /**
       
   317         * Second phase constructor. Leaves on failure.
       
   318         */      
       
   319 		void ConstructL();   
       
   320 		
       
   321 		/**
       
   322 		 * Gets the default priority and default UI priority 
       
   323 		 * from the CommsDat.
       
   324 		 */
       
   325 		TUint32 GetDefPriorityL( const TUint32 aAttribute ) const;
       
   326 		
       
   327 		/**
       
   328 		 * Gets the virtual bearer record from the CommsDat.
       
   329 		 */
       
   330 		CommsDat::CCDVirtualBearerRecord* GetVirtualBearerRecordLC() const;
       
   331 		
       
   332 		/**
       
   333 		 * Type casts the service record in the base class to 
       
   334 		 * CommsDat::CCDVPNServiceRecord type. 
       
   335 		 */
       
   336 		CommsDat::CCDVPNServiceRecord& ServiceRecord() const;
       
   337 		
       
   338 		/**
       
   339 		 * Virtual table Id
       
   340 		 */
       
   341 		CommsDat::TMDBElementId                 iVirtualTableId;
       
   342 		
       
   343 		/**
       
   344 		 * Bearer priority table id
       
   345 		 */
       
   346 		CommsDat::TMDBElementId                 iBearerPriorityTableId;
       
   347 		
       
   348 		/**
       
   349 		 * Virtual IAP next layer record
       
   350 		 */
       
   351 		CCDVirtualIAPNextLayerRecord*           iVirtualIapNextLayerRecord;
       
   352     };
       
   353     
       
   354 #endif //CMPLUGINVPN_H