hotspotfw/hsclient/src/hssiaphandler.cpp
branchRCL_3
changeset 24 63be7eb3fc78
parent 20 a9524956f6b5
child 25 f28ada11abbf
equal deleted inserted replaced
23:b852595f5cbe 24:63be7eb3fc78
    16 */
    16 */
    17 
    17 
    18 
    18 
    19 
    19 
    20 // INCLUDE FILES
    20 // INCLUDE FILES
    21 #include <EapType.h>
       
    22 #include <cdbpreftable.h>
    21 #include <cdbpreftable.h>
    23 #include "hssiaphandler.h"
    22 #include "hssiaphandler.h"
    24 #include "hotspotclientserver.h"
    23 #include "hotspotclientserver.h"
    25 #include "am_debug.h"
    24 #include "am_debug.h"
    26 #include <es_enum.h>
    25 #include <es_enum.h>
    27 
    26 
    28 #include <cmconnectionmethodext.h>
    27 #include <cmconnectionmethod.h>
    29 #include <cmconnectionmethoddef.h>
    28 #include <cmconnectionmethoddef.h>
    30 #include <cmmanagerext.h>
    29 #include <cmmanager.h>
    31 #include <cmmanagerdef.h>
    30 #include <cmmanagerdef.h>
    32 #include <cmdestinationext.h>
    31 #include <cmdestination.h>
    33 
    32 
    34 // CONSTANTS
    33 // CONSTANTS
    35 const TInt  KRetryCount   = 20;
    34 const TInt  KRetryCount   = 20;
    36 const TInt  KRetryTimeout = 100000;
    35 const TInt  KRetryTimeout = 100000;
    37 
    36 
    42 // -----------------------------------------------------------------------------
    41 // -----------------------------------------------------------------------------
    43 // CHotSpotPluginSession
    42 // CHotSpotPluginSession
    44 // -----------------------------------------------------------------------------
    43 // -----------------------------------------------------------------------------
    45 //
    44 //
    46 CHssIapHandler::CHssIapHandler( )
    45 CHssIapHandler::CHssIapHandler( )
    47 	{
    46     {
    48     DEBUG("CHssIapHandler::CHssIapHandler");
    47     DEBUG("CHssIapHandler::CHssIapHandler");
    49 	}
    48     }
    50 
    49 
    51 // -----------------------------------------------------------------------------
    50 // -----------------------------------------------------------------------------
    52 // ConstructL
    51 // ConstructL
    53 // -----------------------------------------------------------------------------
    52 // -----------------------------------------------------------------------------
    54 //
    53 //
    73 // -----------------------------------------------------------------------------
    72 // -----------------------------------------------------------------------------
    74 // ~CHssIapHandler
    73 // ~CHssIapHandler
    75 // -----------------------------------------------------------------------------
    74 // -----------------------------------------------------------------------------
    76 //
    75 //
    77 CHssIapHandler::~CHssIapHandler()
    76 CHssIapHandler::~CHssIapHandler()
    78 	{
    77     {
    79 	DEBUG("CHssIapHandler::~CHssIapHandler()");
    78     DEBUG("CHssIapHandler::~CHssIapHandler()");
    80     
    79     
    81 	if ( iWLANRecord != NULL )
    80     if ( iWLANRecord != NULL )
    82 		{
    81         {
    83 		delete iWLANRecord;
    82         delete iWLANRecord;
    84 		}
    83         }
    85 	iWLANRecord = NULL;
    84     iWLANRecord = NULL;
    86 	}
    85     }
    87 
    86 
    88 // -----------------------------------------------------------------------------
    87 // -----------------------------------------------------------------------------
    89 // ChangeSettingsL
    88 // ChangeSettingsL
    90 // -----------------------------------------------------------------------------
    89 // -----------------------------------------------------------------------------
    91 //
    90 //
    95     // Wlan table name -field not modified, because it is used to store UIDs
    94     // Wlan table name -field not modified, because it is used to store UIDs
    96     // of clients. 
    95     // of clients. 
    97     DEBUG("CHssIapHandler::ChangeSettingsL");
    96     DEBUG("CHssIapHandler::ChangeSettingsL");
    98     TInt ret( KErrNone );
    97     TInt ret( KErrNone );
    99     
    98     
   100     RCmManagerExt cmManager;
    99     RCmManager cmManager;
   101     cmManager.OpenL();
   100     cmManager.OpenL();
   102     CleanupClosePushL( cmManager );
   101     CleanupClosePushL( cmManager );
   103     
   102     
   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     
       
   113     // Read WLAN table service id
   103     // Read WLAN table service id
   114     TUint32 serviceId(0);
   104     TUint32 serviceId(0);
   115 	RCmConnectionMethodExt plugin = cmManager.ConnectionMethodL( aIapID );
   105     RCmConnectionMethod plugin = cmManager.ConnectionMethodL( aIapID );
   116 	CleanupClosePushL( plugin );
   106     CleanupClosePushL( plugin );
   117     serviceId = plugin.GetIntAttributeL( EWlanServiceId );
   107     serviceId = plugin.GetIntAttributeL( EWlanServiceId );
   118     DEBUG1("CHssIapHandler::ChangeSettingsL WLAN serviceId: %d", serviceId);
   108     DEBUG1("CHssIapHandler::ChangeSettingsL WLAN serviceId: %d", serviceId);
   119     
   109     
   120     if  ( aSettings.Name.Length() > 0 )
   110     if  ( aSettings.Name.Length() > 0 )
   121         {
   111         {
   127 
   117 
   128     // CommsDat section starts
   118     // CommsDat section starts
   129     CMDBSession* dbSession = CMDBSession::NewL(CMDBSession::LatestVersion());
   119     CMDBSession* dbSession = CMDBSession::NewL(CMDBSession::LatestVersion());
   130     CleanupStack::PushL( dbSession );
   120     CleanupStack::PushL( dbSession );
   131     iWLANRecord = static_cast<CMDBGenericRecord*>
   121     iWLANRecord = static_cast<CMDBGenericRecord*>
   132     	( CCDRecordBase::RecordFactoryL( 0));
   122         ( CCDRecordBase::RecordFactoryL( 0 ) );
   133             
   123             
   134     iWLANRecord->InitializeL( KGenericTable(),NULL );
   124     iWLANRecord->InitializeL( KGenericTable(),NULL );
   135     iWLANRecord->SetRecordId( serviceId );
   125     iWLANRecord->SetRecordId( serviceId );
   136     iWLANRecord->LoadL( *dbSession );
   126     iWLANRecord->LoadL( *dbSession );
   137 
   127 
   158     // Check if THssIapSettings is created wrong (dynamically). 
   148     // Check if THssIapSettings is created wrong (dynamically). 
   159     // -> Then default value is not set to security mode and it will be huge.
   149     // -> Then default value is not set to security mode and it will be huge.
   160     // -> Destination can become unusable.
   150     // -> Destination can become unusable.
   161     TInt secMode = aSettings.iSecurityMode;
   151     TInt secMode = aSettings.iSecurityMode;
   162     if ( secMode > EHssWpa2Only )
   152     if ( secMode > EHssWpa2Only )
   163     	{
   153         {
   164     	secMode = EHssAllowUnsecure;
   154         secMode = EHssAllowUnsecure;
   165     	}
   155         }
   166     
   156     
   167     if( secMode == EHssWep )
   157     if( secMode == EHssWep )
   168         {
   158         {
   169         DEBUG("CHssIapHandler::ChangeSettingsL -> SecurityMode == EHssWep");
   159         DEBUG("CHssIapHandler::ChangeSettingsL -> SecurityMode == EHssWep");
   170         *((CMDBField<TUint32>*)iWLANRecord->GetFieldByIdL(KCDTIdWlanAuthMode)) = aSettings.iAuthenticationMode;
   160         *((CMDBField<TUint32>*)iWLANRecord->GetFieldByIdL(KCDTIdWlanAuthMode)) = aSettings.iAuthenticationMode;
   196             binField->SetL( buf);
   186             binField->SetL( buf);
   197        
   187        
   198             *((CMDBField<TUint32>*)iWLANRecord->GetFieldByIdL(KCDTIdWlanWpaKeyLength)) = aSettings.iWPAKeyLength;
   188             *((CMDBField<TUint32>*)iWLANRecord->GetFieldByIdL(KCDTIdWlanWpaKeyLength)) = aSettings.iWPAKeyLength;
   199             *((CMDBField<TUint32>*)iWLANRecord->GetFieldByIdL(KCDTIdWlanEnableWpaPsk)) = aSettings.iEnableWpaPsk;
   189             *((CMDBField<TUint32>*)iWLANRecord->GetFieldByIdL(KCDTIdWlanEnableWpaPsk)) = aSettings.iEnableWpaPsk;
   200             }
   190             }
   201         else // Use EAP
   191         else // Use EAP. EAP settings can be set with EAP API.
   202             {
   192             {
   203             DEBUG("CHssIapHandler::ChangeSettingsL -> SecurityMode > EHssWep -> EAP");
   193             DEBUG("CHssIapHandler::ChangeSettingsL -> SecurityMode > EHssWep -> EAP");
   204             *((CMDBField<TUint32>*)iWLANRecord->GetFieldByIdL(KCDTIdWlanEnableWpaPsk)) = aSettings.iEnableWpaPsk;
   194             *((CMDBField<TUint32>*)iWLANRecord->GetFieldByIdL(KCDTIdWlanEnableWpaPsk)) = aSettings.iEnableWpaPsk;
   205             }
   195             }
   206         }
   196         }
   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     
       
   284     // Update access point, be prepared that Commsdat might be locked
   197     // Update access point, be prepared that Commsdat might be locked
   285     TInt errCode( KErrLocked );
   198     TInt errCode( KErrLocked );
   286     TInt retryCount( 0 );
   199     TInt retryCount( 0 );
   287     
   200     
   288     while( errCode == KErrLocked && retryCount < KRetryCount )
   201     while( errCode == KErrLocked && retryCount < KRetryCount )
   299     if ( errCode )
   212     if ( errCode )
   300         {
   213         {
   301         // override previous ret value only when error happened        	    	
   214         // override previous ret value only when error happened        	    	
   302         ret = errCode;
   215         ret = errCode;
   303         }
   216         }
   304     
   217 
   305     CleanupStack::PopAndDestroy( dbSession );
   218     CleanupStack::PopAndDestroy( dbSession );
   306     DEBUG("CHssIapHandler::ChangeSettingsL DONE");
   219     DEBUG("CHssIapHandler::ChangeSettingsL DONE");
   307     return ret;
   220 	return ret;
   308     }
   221     }
   309  
   222  
   310 // -----------------------------------------------------------------------------
   223 // -----------------------------------------------------------------------------
   311 // WriteWepKeysL
   224 // WriteWepKeysL
   312 // Writes WEP keys from aSettings to current WLANServiceTable record
   225 // Writes WEP keys from aSettings to current WLANServiceTable record
   395         wepBuf.Copy( buf8Conv->Des() );
   308         wepBuf.Copy( buf8Conv->Des() );
   396         CleanupStack::PopAndDestroy( buf8Conv );
   309         CleanupStack::PopAndDestroy( buf8Conv );
   397         }
   310         }
   398     
   311     
   399     aPackedKey->SetL( wepBuf);
   312     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         }
       
   459     }
   313     }
   460     
   314     
   461 // -----------------------------------------------------------------------------
   315 // -----------------------------------------------------------------------------
   462 // ConvertAsciiToHex
   316 // ConvertAsciiToHex
   463 // -----------------------------------------------------------------------------
   317 // -----------------------------------------------------------------------------
   476         ptr.Append( hex()[ch&0x0f] );
   330         ptr.Append( hex()[ch&0x0f] );
   477         }
   331         }
   478     }
   332     }
   479 
   333 
   480 // -----------------------------------------------------------------------------
   334 // -----------------------------------------------------------------------------
   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 // -----------------------------------------------------------------------------
       
   553 // GetNetworkIdL
   335 // GetNetworkIdL
   554 // -----------------------------------------------------------------------------
   336 // -----------------------------------------------------------------------------
   555 //
   337 //
   556 void CHssIapHandler::GetNetworkIdL( const TUint aIapId, TUint32& aNetId )
   338 void CHssIapHandler::GetNetworkIdL( const TUint aIapId, TUint32& aNetId )
   557     {
   339     {
   558     DEBUG( "CHssIapHandler::GetNetworkIdL()" );
   340     DEBUG( "CHssIapHandler::GetNetworkIdL()" );
   559     
   341     
   560     RCmManagerExt cmManager;
   342     RCmManager cmManager;
   561     cmManager.OpenL();
   343     cmManager.OpenL();
   562     CleanupClosePushL( cmManager );
   344     CleanupClosePushL( cmManager );
   563 
   345 
   564     RCmConnectionMethodExt plugin = cmManager.ConnectionMethodL( aIapId );
   346     RCmConnectionMethod plugin = cmManager.ConnectionMethodL( aIapId );
   565     CleanupClosePushL( plugin );
   347     CleanupClosePushL( plugin );
   566     
   348     
   567     aNetId = plugin.GetIntAttributeL( ECmNetworkId );
   349     aNetId = plugin.GetIntAttributeL( ECmNetworkId );
   568     
   350     
   569     CleanupStack::PopAndDestroy( &plugin ); // Close() called on "plugin"
   351     CleanupStack::PopAndDestroy( &plugin ); // Close() called on "plugin"
   587     ModifyClientUid( uidClient );
   369     ModifyClientUid( uidClient );
   588 
   370 
   589     RArray<TUint32> destArray = RArray<TUint32>( 10 );  // KCmArrayGranularity instead of 10
   371     RArray<TUint32> destArray = RArray<TUint32>( 10 );  // KCmArrayGranularity instead of 10
   590     CleanupClosePushL( destArray );
   372     CleanupClosePushL( destArray );
   591 
   373 
   592     RCmManagerExt cmManager;
   374     RCmManager cmManager;
   593     cmManager.OpenL();
   375     cmManager.OpenL();
   594     CleanupClosePushL( cmManager );    
   376     CleanupClosePushL( cmManager );    
   595 
   377 
   596     cmManager.AllDestinationsL( destArray );
   378     cmManager.AllDestinationsL( destArray );
   597 
   379 
   598     for (TInt i = 0; i < destArray.Count(); i++)
   380     for (TInt i = 0; i < destArray.Count(); i++)
   599         {
   381         {
   600         RCmDestinationExt dest = cmManager.DestinationL( destArray[i] );
   382         RCmDestination dest = cmManager.DestinationL( destArray[i] );
   601         CleanupClosePushL( dest );
   383         CleanupClosePushL( dest );
   602 
   384 
   603         for (TInt j = 0; j < dest.ConnectionMethodCount(); j++)
   385         for (TInt j = 0; j < dest.ConnectionMethodCount(); j++)
   604             {
   386             {
   605             TInt bearerType = dest.ConnectionMethodL(j).
   387             TInt bearerType = dest.ConnectionMethodL(j).