hotspotfw/hsclient/src/hssiaphandler.cpp
branchRCL_3
changeset 25 f28ada11abbf
parent 24 63be7eb3fc78
equal deleted inserted replaced
24:63be7eb3fc78 25:f28ada11abbf
    16 */
    16 */
    17 
    17 
    18 
    18 
    19 
    19 
    20 // INCLUDE FILES
    20 // INCLUDE FILES
       
    21 #include <EapType.h>
    21 #include <cdbpreftable.h>
    22 #include <cdbpreftable.h>
    22 #include "hssiaphandler.h"
    23 #include "hssiaphandler.h"
    23 #include "hotspotclientserver.h"
    24 #include "hotspotclientserver.h"
    24 #include "am_debug.h"
    25 #include "am_debug.h"
    25 #include <es_enum.h>
    26 #include <es_enum.h>
    26 
    27 
    27 #include <cmconnectionmethod.h>
    28 #include <cmconnectionmethodext.h>
    28 #include <cmconnectionmethoddef.h>
    29 #include <cmconnectionmethoddef.h>
    29 #include <cmmanager.h>
    30 #include <cmmanagerext.h>
    30 #include <cmmanagerdef.h>
    31 #include <cmmanagerdef.h>
    31 #include <cmdestination.h>
    32 #include <cmdestinationext.h>
    32 
    33 
    33 // CONSTANTS
    34 // CONSTANTS
    34 const TInt  KRetryCount   = 20;
    35 const TInt  KRetryCount   = 20;
    35 const TInt  KRetryTimeout = 100000;
    36 const TInt  KRetryTimeout = 100000;
    36 
    37 
    41 // -----------------------------------------------------------------------------
    42 // -----------------------------------------------------------------------------
    42 // CHotSpotPluginSession
    43 // CHotSpotPluginSession
    43 // -----------------------------------------------------------------------------
    44 // -----------------------------------------------------------------------------
    44 //
    45 //
    45 CHssIapHandler::CHssIapHandler( )
    46 CHssIapHandler::CHssIapHandler( )
    46     {
    47 	{
    47     DEBUG("CHssIapHandler::CHssIapHandler");
    48     DEBUG("CHssIapHandler::CHssIapHandler");
    48     }
    49 	}
    49 
    50 
    50 // -----------------------------------------------------------------------------
    51 // -----------------------------------------------------------------------------
    51 // ConstructL
    52 // ConstructL
    52 // -----------------------------------------------------------------------------
    53 // -----------------------------------------------------------------------------
    53 //
    54 //
    72 // -----------------------------------------------------------------------------
    73 // -----------------------------------------------------------------------------
    73 // ~CHssIapHandler
    74 // ~CHssIapHandler
    74 // -----------------------------------------------------------------------------
    75 // -----------------------------------------------------------------------------
    75 //
    76 //
    76 CHssIapHandler::~CHssIapHandler()
    77 CHssIapHandler::~CHssIapHandler()
    77     {
    78 	{
    78     DEBUG("CHssIapHandler::~CHssIapHandler()");
    79 	DEBUG("CHssIapHandler::~CHssIapHandler()");
    79     
    80     
    80     if ( iWLANRecord != NULL )
    81 	if ( iWLANRecord != NULL )
    81         {
    82 		{
    82         delete iWLANRecord;
    83 		delete iWLANRecord;
    83         }
    84 		}
    84     iWLANRecord = NULL;
    85 	iWLANRecord = NULL;
    85     }
    86 	}
    86 
    87 
    87 // -----------------------------------------------------------------------------
    88 // -----------------------------------------------------------------------------
    88 // ChangeSettingsL
    89 // ChangeSettingsL
    89 // -----------------------------------------------------------------------------
    90 // -----------------------------------------------------------------------------
    90 //
    91 //
    94     // Wlan table name -field not modified, because it is used to store UIDs
    95     // Wlan table name -field not modified, because it is used to store UIDs
    95     // of clients. 
    96     // of clients. 
    96     DEBUG("CHssIapHandler::ChangeSettingsL");
    97     DEBUG("CHssIapHandler::ChangeSettingsL");
    97     TInt ret( KErrNone );
    98     TInt ret( KErrNone );
    98     
    99     
    99     RCmManager cmManager;
   100     RCmManagerExt cmManager;
   100     cmManager.OpenL();
   101     cmManager.OpenL();
   101     CleanupClosePushL( cmManager );
   102     CleanupClosePushL( cmManager );
   102     
   103     
       
   104     TUint easyWlanId = cmManager.EasyWlanIdL();
       
   105     
       
   106     // Easy WLAN can't be modified
       
   107     if ( easyWlanId == aIapID )
       
   108     	{
       
   109         CleanupStack::PopAndDestroy( &cmManager ); 
       
   110     	return KErrPermissionDenied;
       
   111     	}
       
   112     
   103     // Read WLAN table service id
   113     // Read WLAN table service id
   104     TUint32 serviceId(0);
   114     TUint32 serviceId(0);
   105     RCmConnectionMethod plugin = cmManager.ConnectionMethodL( aIapID );
   115 	RCmConnectionMethodExt plugin = cmManager.ConnectionMethodL( aIapID );
   106     CleanupClosePushL( plugin );
   116 	CleanupClosePushL( plugin );
   107     serviceId = plugin.GetIntAttributeL( EWlanServiceId );
   117     serviceId = plugin.GetIntAttributeL( EWlanServiceId );
   108     DEBUG1("CHssIapHandler::ChangeSettingsL WLAN serviceId: %d", serviceId);
   118     DEBUG1("CHssIapHandler::ChangeSettingsL WLAN serviceId: %d", serviceId);
   109     
   119     
   110     if  ( aSettings.Name.Length() > 0 )
   120     if  ( aSettings.Name.Length() > 0 )
   111         {
   121         {
   117 
   127 
   118     // CommsDat section starts
   128     // CommsDat section starts
   119     CMDBSession* dbSession = CMDBSession::NewL(CMDBSession::LatestVersion());
   129     CMDBSession* dbSession = CMDBSession::NewL(CMDBSession::LatestVersion());
   120     CleanupStack::PushL( dbSession );
   130     CleanupStack::PushL( dbSession );
   121     iWLANRecord = static_cast<CMDBGenericRecord*>
   131     iWLANRecord = static_cast<CMDBGenericRecord*>
   122         ( CCDRecordBase::RecordFactoryL( 0 ) );
   132     	( CCDRecordBase::RecordFactoryL( 0));
   123             
   133             
   124     iWLANRecord->InitializeL( KGenericTable(),NULL );
   134     iWLANRecord->InitializeL( KGenericTable(),NULL );
   125     iWLANRecord->SetRecordId( serviceId );
   135     iWLANRecord->SetRecordId( serviceId );
   126     iWLANRecord->LoadL( *dbSession );
   136     iWLANRecord->LoadL( *dbSession );
   127 
   137 
   148     // Check if THssIapSettings is created wrong (dynamically). 
   158     // Check if THssIapSettings is created wrong (dynamically). 
   149     // -> Then default value is not set to security mode and it will be huge.
   159     // -> Then default value is not set to security mode and it will be huge.
   150     // -> Destination can become unusable.
   160     // -> Destination can become unusable.
   151     TInt secMode = aSettings.iSecurityMode;
   161     TInt secMode = aSettings.iSecurityMode;
   152     if ( secMode > EHssWpa2Only )
   162     if ( secMode > EHssWpa2Only )
   153         {
   163     	{
   154         secMode = EHssAllowUnsecure;
   164     	secMode = EHssAllowUnsecure;
   155         }
   165     	}
   156     
   166     
   157     if( secMode == EHssWep )
   167     if( secMode == EHssWep )
   158         {
   168         {
   159         DEBUG("CHssIapHandler::ChangeSettingsL -> SecurityMode == EHssWep");
   169         DEBUG("CHssIapHandler::ChangeSettingsL -> SecurityMode == EHssWep");
   160         *((CMDBField<TUint32>*)iWLANRecord->GetFieldByIdL(KCDTIdWlanAuthMode)) = aSettings.iAuthenticationMode;
   170         *((CMDBField<TUint32>*)iWLANRecord->GetFieldByIdL(KCDTIdWlanAuthMode)) = aSettings.iAuthenticationMode;
   186             binField->SetL( buf);
   196             binField->SetL( buf);
   187        
   197        
   188             *((CMDBField<TUint32>*)iWLANRecord->GetFieldByIdL(KCDTIdWlanWpaKeyLength)) = aSettings.iWPAKeyLength;
   198             *((CMDBField<TUint32>*)iWLANRecord->GetFieldByIdL(KCDTIdWlanWpaKeyLength)) = aSettings.iWPAKeyLength;
   189             *((CMDBField<TUint32>*)iWLANRecord->GetFieldByIdL(KCDTIdWlanEnableWpaPsk)) = aSettings.iEnableWpaPsk;
   199             *((CMDBField<TUint32>*)iWLANRecord->GetFieldByIdL(KCDTIdWlanEnableWpaPsk)) = aSettings.iEnableWpaPsk;
   190             }
   200             }
   191         else // Use EAP. EAP settings can be set with EAP API.
   201         else // Use EAP
   192             {
   202             {
   193             DEBUG("CHssIapHandler::ChangeSettingsL -> SecurityMode > EHssWep -> EAP");
   203             DEBUG("CHssIapHandler::ChangeSettingsL -> SecurityMode > EHssWep -> EAP");
   194             *((CMDBField<TUint32>*)iWLANRecord->GetFieldByIdL(KCDTIdWlanEnableWpaPsk)) = aSettings.iEnableWpaPsk;
   204             *((CMDBField<TUint32>*)iWLANRecord->GetFieldByIdL(KCDTIdWlanEnableWpaPsk)) = aSettings.iEnableWpaPsk;
   195             }
   205             }
   196         }
   206         }
       
   207       
       
   208     // access point updated EAP data can be now set if needed
       
   209     if ( ( !aSettings.iEnableWpaPsk ) && secMode > EHssWep )
       
   210         {
       
   211         DEBUG("CHssIapHandler::ChangeSettingsL -> Set EAP data");
       
   212         TBuf8<KEapListMaxLength> enabledEapList;
       
   213         for (TInt i=0;i<aSettings.iEapDataArray.Count();i++)
       
   214             {
       
   215             TBuf8< KEapExpandedIdLength > eapTypeCue;
       
   216             TChar eapCode;
       
   217             GetEapTypeDesC(aSettings.iEapDataArray[i]->iEAPType, eapTypeCue, eapCode );
       
   218         
       
   219             CEapType* eapType = NULL;
       
   220             TRAPD( error, ( eapType = CEapType::NewL( eapTypeCue, ELan, serviceId ) ) );
       
   221             DEBUG1(" CEapType::NewL error: %d", error);
       
   222             if ( ( error == KErrNone ) && eapType )
       
   223                 {
       
   224                 CleanupStack::PushL( eapType );
       
   225                 EAPSettings* eapSettings = new (ELeave) EAPSettings;
       
   226                 
       
   227                 ConvertEApSettings( *aSettings.iEapDataArray[i], *eapSettings );
       
   228                 
       
   229                 // Set EAP tunneling
       
   230                 if ( aSettings.iEapDataArray[i]->iEncapsulatedInside != EAPSettings::EEapNone )
       
   231                 	{
       
   232                 	DEBUG("iEncapsulatedInside != EAPSettings::EEapNone");
       
   233                 	eapType->SetTunnelingType( 
       
   234                 			static_cast<TInt> ( aSettings.iEapDataArray[i]->iEncapsulatedInside ) );
       
   235                 	}
       
   236                 else // Write to EAP list
       
   237                 	{
       
   238                 	DEBUG("CHssIapHandler::ChangeSettingsL -> Add to EAP list");
       
   239                 	TBuf8<8> expandedForm;
       
   240     	            expandedForm.AppendFill( 0xFE, 1 );
       
   241     	            if ( THssEapSettings::EEapPlainMschapv2 == aSettings.iEapDataArray[i]->iEAPType )
       
   242     	            	{
       
   243     	            	expandedForm.AppendFill( 0xFF, 3 );
       
   244     	            	}
       
   245     	            else{
       
   246     	            	expandedForm.AppendFill( 0x00, 6 );
       
   247     	            	}
       
   248     	       
       
   249     	            expandedForm.AppendFill( eapCode, 1 );
       
   250     	               	           
       
   251     	            enabledEapList.Append( expandedForm );      
       
   252     	        	}
       
   253                 
       
   254                 DEBUG("CHssIapHandler::ChangeSettingsL -> eapType->SetConfigurationL");
       
   255                 TRAPD( eapErr, eapType->SetConfigurationL( *eapSettings ) );
       
   256                 DEBUG1(" eapType->SetConfigurationL error: %d", eapErr);
       
   257                 if( eapErr != KErrNone )
       
   258                 	{
       
   259                 	CleanupStack::PopAndDestroy( eapType );
       
   260                 	CleanupStack::PopAndDestroy( dbSession );
       
   261                     DEBUG("CHssIapHandler::ChangeSettingsL EapError DONE");
       
   262                     return eapErr;
       
   263                 	}
       
   264                 CleanupStack::PopAndDestroy( eapType );
       
   265                 }
       
   266             if ( error != KErrNone )
       
   267                 {
       
   268                 DEBUG("CHssIapHandler::ChangeSettingsL Eap error");
       
   269                 CleanupStack::PopAndDestroy( dbSession );
       
   270                 return error;
       
   271                 }
       
   272             }
       
   273        
       
   274             // Set enabled EAP list
       
   275             if ( enabledEapList.Length() > 0 )
       
   276         		{
       
   277         		DEBUG("CHssIapHandler::ChangeSettingsL -> Set EAP list");
       
   278 	            CMDBField<TDesC8>* eaps = (CMDBField<TDesC8>*)iWLANRecord->GetFieldByIdL( KCDTIdWlanEnabledEaps );
       
   279 	            //eaps->SetMaxLengthL( eapList16.Length() )
       
   280 	            eaps->SetL( enabledEapList );
       
   281             	}
       
   282         }
       
   283     
   197     // Update access point, be prepared that Commsdat might be locked
   284     // Update access point, be prepared that Commsdat might be locked
   198     TInt errCode( KErrLocked );
   285     TInt errCode( KErrLocked );
   199     TInt retryCount( 0 );
   286     TInt retryCount( 0 );
   200     
   287     
   201     while( errCode == KErrLocked && retryCount < KRetryCount )
   288     while( errCode == KErrLocked && retryCount < KRetryCount )
   212     if ( errCode )
   299     if ( errCode )
   213         {
   300         {
   214         // override previous ret value only when error happened        	    	
   301         // override previous ret value only when error happened        	    	
   215         ret = errCode;
   302         ret = errCode;
   216         }
   303         }
   217 
   304     
   218     CleanupStack::PopAndDestroy( dbSession );
   305     CleanupStack::PopAndDestroy( dbSession );
   219     DEBUG("CHssIapHandler::ChangeSettingsL DONE");
   306     DEBUG("CHssIapHandler::ChangeSettingsL DONE");
   220 	return ret;
   307     return ret;
   221     }
   308     }
   222  
   309  
   223 // -----------------------------------------------------------------------------
   310 // -----------------------------------------------------------------------------
   224 // WriteWepKeysL
   311 // WriteWepKeysL
   225 // Writes WEP keys from aSettings to current WLANServiceTable record
   312 // Writes WEP keys from aSettings to current WLANServiceTable record
   308         wepBuf.Copy( buf8Conv->Des() );
   395         wepBuf.Copy( buf8Conv->Des() );
   309         CleanupStack::PopAndDestroy( buf8Conv );
   396         CleanupStack::PopAndDestroy( buf8Conv );
   310         }
   397         }
   311     
   398     
   312     aPackedKey->SetL( wepBuf);
   399     aPackedKey->SetL( wepBuf);
       
   400     }
       
   401 
       
   402 // -----------------------------------------------------------------------------
       
   403 // ConvertEApSettings
       
   404 // -----------------------------------------------------------------------------
       
   405 //
       
   406 void CHssIapHandler::ConvertEApSettings( THssEapSettings& aHssEap, EAPSettings& aEap )
       
   407     {
       
   408     DEBUG("CHssIapHandler::ConvertEApSettings");
       
   409     aEap.iEAPType = static_cast<EAPSettings::TEapType>(aHssEap.iEAPType);
       
   410     aEap.iUsernamePresent = aHssEap.iUsernamePresent;
       
   411     aEap.iUsername = aHssEap.iUsername;
       
   412     aEap.iPasswordPresent = aHssEap.iPasswordPresent;
       
   413     aEap.iPassword = aHssEap.iPassword;
       
   414     aEap.iRealmPresent = aHssEap.iRealmPresent;
       
   415     aEap.iRealm = aHssEap.iRealm;
       
   416     aEap.iUsePseudonymsPresent = aHssEap.iUsePseudonymsPresent;
       
   417     aEap.iUsePseudonyms = aHssEap.iUsePseudonyms;
       
   418     aEap.iVerifyServerRealmPresent = aHssEap.iVerifyServerRealmPresent;
       
   419     aEap.iVerifyServerRealm = aHssEap.iVerifyServerRealm;
       
   420     aEap.iRequireClientAuthenticationPresent = aHssEap.iRequireClientAuthenticationPresent;
       
   421     aEap.iRequireClientAuthentication = aHssEap.iRequireClientAuthentication;
       
   422     aEap.iSessionValidityTimePresent = aHssEap.iSessionValidityTimePresent;
       
   423     aEap.iSessionValidityTime = aHssEap.iSessionValidityTime;
       
   424     aEap.iCipherSuitesPresent = aHssEap.iCipherSuitesPresent;
       
   425     
       
   426     for( TInt i = 0; i < aHssEap.iCipherSuitesCount; i++ )
       
   427         {
       
   428         aEap.iCipherSuites.Append( aHssEap.iCipherSuites[i] );
       
   429         }
       
   430     aEap.iPEAPVersionsPresent = aHssEap.iPEAPVersionsPresent;
       
   431     aEap.iPEAPv0Allowed = aHssEap.iPEAPv0Allowed;
       
   432     aEap.iPEAPv1Allowed = aHssEap.iPEAPv1Allowed;
       
   433     aEap.iPEAPv2Allowed = aHssEap.iPEAPv2Allowed;
       
   434     aEap.iCertificatesPresent = aHssEap.iCertificatesPresent;
       
   435     for( TInt i = 0; i < aHssEap.iCertificatesCount; i++ )
       
   436         {
       
   437         DEBUG("CHssIapHandler::ConvertEApSettings Certificates present");
       
   438         CertificateEntry entry;
       
   439         
       
   440         entry.iCertType = static_cast<CertificateEntry::TCertType>( aHssEap.iCertificates[i]->iCertType );
       
   441         entry.iSubjectNamePresent = aHssEap.iCertificates[i]->iSubjectNamePresent;
       
   442         entry.iSubjectName = aHssEap.iCertificates[i]->iSubjectName;
       
   443         entry.iIssuerNamePresent = aHssEap.iCertificates[i]->iIssuerNamePresent;
       
   444         entry.iIssuerName = aHssEap.iCertificates[i]->iIssuerName;
       
   445         entry.iSerialNumberPresent= aHssEap.iCertificates[i]->iSerialNumberPresent;
       
   446         entry.iSerialNumber = aHssEap.iCertificates[i]->iSerialNumber;
       
   447         entry.iSubjectKeyIDPresent = aHssEap.iCertificates[i]->iSubjectKeyIDPresent;
       
   448         entry.iSubjectKeyID = aHssEap.iCertificates[i]->iSubjectKeyID;
       
   449         
       
   450         entry.iThumbprintPresent = aHssEap.iCertificates[i]->iThumbprintPresent;
       
   451         entry.iThumbprint = aHssEap.iCertificates[i]->iThumbprint;
       
   452         TRAP_IGNORE( aEap.iCertificates.AppendL( entry ) ); // Memory problem, ignored...
       
   453         }
       
   454     aEap.iEncapsulatedEAPTypesPresent = aHssEap.iEncapsulatedEAPTypesPresent;
       
   455     for( TInt i = 0; i < aHssEap.iEncapsulatedEAPTypesCount; i++ )
       
   456         {
       
   457         aEap.iEncapsulatedEAPTypes.Append( aHssEap.iEncapsulatedEAPTypes[i] );
       
   458         }
   313     }
   459     }
   314     
   460     
   315 // -----------------------------------------------------------------------------
   461 // -----------------------------------------------------------------------------
   316 // ConvertAsciiToHex
   462 // ConvertAsciiToHex
   317 // -----------------------------------------------------------------------------
   463 // -----------------------------------------------------------------------------
   330         ptr.Append( hex()[ch&0x0f] );
   476         ptr.Append( hex()[ch&0x0f] );
   331         }
   477         }
   332     }
   478     }
   333 
   479 
   334 // -----------------------------------------------------------------------------
   480 // -----------------------------------------------------------------------------
       
   481 // GetEapTypeDesC
       
   482 // -----------------------------------------------------------------------------
       
   483 //
       
   484 void CHssIapHandler::GetEapTypeDesC( TUint aEapType, TDes8& aEapString, TChar& aEapCode )
       
   485     {
       
   486     DEBUG1( "CHssIapHandler::GetEapTypeDesC aEapType: %d", aEapType );
       
   487     switch ( aEapType )
       
   488         {
       
   489             // EapNone
       
   490             case 0:
       
   491                 aEapString.Copy( KEapNoneId, KEapExpandedIdLength );
       
   492                 aEapCode = KEapNoneId[7];
       
   493                 break;
       
   494             // KEapGtc
       
   495             case 6:
       
   496             	aEapString.Copy( KEapGtcId, KEapExpandedIdLength );
       
   497             	aEapCode = KEapGtcId[7];
       
   498                 break;
       
   499             // KEapTls
       
   500             case 13:
       
   501             	aEapString.Copy( KEapTlsId, KEapExpandedIdLength );
       
   502             	aEapCode = KEapTlsId[7];
       
   503                 break;
       
   504             // KEapLeap
       
   505             case 17:
       
   506             	aEapString.Copy( KEapLeapId, KEapExpandedIdLength );
       
   507             	aEapCode = KEapLeapId[7];
       
   508                 break;
       
   509             // KEapSim
       
   510             case 18:
       
   511             	aEapString.Copy( KEapSimId, KEapExpandedIdLength );
       
   512             	aEapCode = KEapSimId[7];
       
   513                 break;
       
   514             // KEapTtls
       
   515             case 21:
       
   516             	aEapString.Copy( KEapTtlsId, KEapExpandedIdLength );
       
   517             	aEapCode = KEapTtlsId[7];
       
   518                 break;
       
   519             // KEapAka
       
   520             case 23:
       
   521             	aEapString.Copy( KEapAkaId, KEapExpandedIdLength );
       
   522             	aEapCode = KEapAkaId[7];
       
   523                 break;
       
   524             // KEapPeap
       
   525             case 25:
       
   526             	aEapString.Copy( KEapPeapId, KEapExpandedIdLength );
       
   527             	aEapCode = KEapPeapId[7];
       
   528                 break;
       
   529             // KEapMschapv2
       
   530             case 26:
       
   531             	aEapString.Copy( KEapMschapv2Id, KEapExpandedIdLength );
       
   532             	aEapCode = KEapMschapv2Id[7];
       
   533                 break;
       
   534             // KEapSecurid
       
   535             case 32:
       
   536             	aEapString.Copy( KEapSecuridId, KEapExpandedIdLength );
       
   537             	aEapCode = KEapSecuridId[7];
       
   538                 break;
       
   539             // KEapPlainMschapv2
       
   540             case 99:
       
   541             	aEapString.Copy( KEapPlainMschapv2Id, KEapExpandedIdLength );
       
   542             	aEapCode = KEapPlainMschapv2Id[7];
       
   543             	break;
       
   544             default:
       
   545             	aEapString.Copy( KEapNoneId, KEapExpandedIdLength );
       
   546             	aEapCode = KEapNoneId[7];
       
   547                 break;
       
   548         }
       
   549     DEBUG( "CHssIapHandler::GetEapTypeDesC DONE" );
       
   550     }
       
   551 
       
   552 // -----------------------------------------------------------------------------
   335 // GetNetworkIdL
   553 // GetNetworkIdL
   336 // -----------------------------------------------------------------------------
   554 // -----------------------------------------------------------------------------
   337 //
   555 //
   338 void CHssIapHandler::GetNetworkIdL( const TUint aIapId, TUint32& aNetId )
   556 void CHssIapHandler::GetNetworkIdL( const TUint aIapId, TUint32& aNetId )
   339     {
   557     {
   340     DEBUG( "CHssIapHandler::GetNetworkIdL()" );
   558     DEBUG( "CHssIapHandler::GetNetworkIdL()" );
   341     
   559     
   342     RCmManager cmManager;
   560     RCmManagerExt cmManager;
   343     cmManager.OpenL();
   561     cmManager.OpenL();
   344     CleanupClosePushL( cmManager );
   562     CleanupClosePushL( cmManager );
   345 
   563 
   346     RCmConnectionMethod plugin = cmManager.ConnectionMethodL( aIapId );
   564     RCmConnectionMethodExt plugin = cmManager.ConnectionMethodL( aIapId );
   347     CleanupClosePushL( plugin );
   565     CleanupClosePushL( plugin );
   348     
   566     
   349     aNetId = plugin.GetIntAttributeL( ECmNetworkId );
   567     aNetId = plugin.GetIntAttributeL( ECmNetworkId );
   350     
   568     
   351     CleanupStack::PopAndDestroy( &plugin ); // Close() called on "plugin"
   569     CleanupStack::PopAndDestroy( &plugin ); // Close() called on "plugin"
   369     ModifyClientUid( uidClient );
   587     ModifyClientUid( uidClient );
   370 
   588 
   371     RArray<TUint32> destArray = RArray<TUint32>( 10 );  // KCmArrayGranularity instead of 10
   589     RArray<TUint32> destArray = RArray<TUint32>( 10 );  // KCmArrayGranularity instead of 10
   372     CleanupClosePushL( destArray );
   590     CleanupClosePushL( destArray );
   373 
   591 
   374     RCmManager cmManager;
   592     RCmManagerExt cmManager;
   375     cmManager.OpenL();
   593     cmManager.OpenL();
   376     CleanupClosePushL( cmManager );    
   594     CleanupClosePushL( cmManager );    
   377 
   595 
   378     cmManager.AllDestinationsL( destArray );
   596     cmManager.AllDestinationsL( destArray );
   379 
   597 
   380     for (TInt i = 0; i < destArray.Count(); i++)
   598     for (TInt i = 0; i < destArray.Count(); i++)
   381         {
   599         {
   382         RCmDestination dest = cmManager.DestinationL( destArray[i] );
   600         RCmDestinationExt dest = cmManager.DestinationL( destArray[i] );
   383         CleanupClosePushL( dest );
   601         CleanupClosePushL( dest );
   384 
   602 
   385         for (TInt j = 0; j < dest.ConnectionMethodCount(); j++)
   603         for (TInt j = 0; j < dest.ConnectionMethodCount(); j++)
   386             {
   604             {
   387             TInt bearerType = dest.ConnectionMethodL(j).
   605             TInt bearerType = dest.ConnectionMethodL(j).