eapol/eapol_framework/eapol_symbian/am/type/mschapv2/symbian/plugin/src/EapMsChapV2.cpp
changeset 34 ad1f037f1ac2
parent 26 9abfd4f00d37
child 36 c98682f98478
equal deleted inserted replaced
31:372d2d6c5cf9 34:ad1f037f1ac2
    14 * Description:  EAP and WLAN authentication protocols.
    14 * Description:  EAP and WLAN authentication protocols.
    15 *
    15 *
    16 */
    16 */
    17 
    17 
    18 /*
    18 /*
    19 * %version: 28 %
    19 * %version: 30 %
    20 */
    20 */
    21 
    21 
    22 // This is enumeration of EAPOL source code.
    22 // This is enumeration of EAPOL source code.
    23 #if defined(USE_EAP_MINIMUM_RELEASE_TRACES)
    23 #if defined(USE_EAP_MINIMUM_RELEASE_TRACES)
    24 	#undef EAP_FILE_NUMBER_ENUM
    24 	#undef EAP_FILE_NUMBER_ENUM
   244 
   244 
   245 	RDbNamedDatabase db;
   245 	RDbNamedDatabase db;
   246 
   246 
   247 	RFs session;
   247 	RFs session;
   248 	
   248 	
   249 	EapMsChapV2DbUtils::OpenDatabaseL(db, session, iIndexType, iIndex, iTunnelingType);
       
   250 	
       
   251 	CleanupClosePushL(session);
   249 	CleanupClosePushL(session);
   252 	CleanupClosePushL(db);
   250 	CleanupClosePushL(db);
   253 		
   251 	TInt error = session.Connect();
       
   252 	EAP_TRACE_DEBUG_SYMBIAN((_L("CEapMsChapV2::SetIndexL(): - session.Connect(), error=%d\n"), error));
       
   253 	User::LeaveIfError(error);
       
   254 
       
   255 	EapMsChapV2DbUtils::OpenDatabaseL(db, session, iIndexType, iIndex, iTunnelingType);
       
   256 
   254 	EapMsChapV2DbUtils::SetIndexL(
   257 	EapMsChapV2DbUtils::SetIndexL(
   255 		db, 
   258 		db, 
   256 		iIndexType, 
   259 		iIndexType, 
   257 		iIndex, 
   260 		iIndex, 
   258 		iTunnelingType, 
   261 		iTunnelingType, 
   261 		iTunnelingType);
   264 		iTunnelingType);
   262 	
   265 	
   263 	iIndexType = aIndexType;
   266 	iIndexType = aIndexType;
   264 	iIndex = aIndex;
   267 	iIndex = aIndex;
   265 
   268 
       
   269 	db.Close();
       
   270 	session.Close();
       
   271 
   266 	CleanupStack::PopAndDestroy(&db);
   272 	CleanupStack::PopAndDestroy(&db);
   267 	CleanupStack::PopAndDestroy(&session);
   273 	CleanupStack::PopAndDestroy(&session);
   268 }
   274 }
   269 
   275 
   270 void CEapMsChapV2::SetConfigurationL(const EAPSettings& aSettings)
   276 void CEapMsChapV2::SetConfigurationL(const EAPSettings& aSettings)
   274 
   280 
   275 	RDbNamedDatabase db;
   281 	RDbNamedDatabase db;
   276 
   282 
   277 	RFs session;
   283 	RFs session;
   278 	
   284 	
       
   285 	CleanupClosePushL(session);
       
   286 	CleanupClosePushL(db);
       
   287 	TInt error = session.Connect();
       
   288 	EAP_TRACE_DEBUG_SYMBIAN((_L("CEapMsChapV2::SetConfigurationL(): - session.Connect(), error=%d\n"), error));
       
   289 	User::LeaveIfError(error);
       
   290 
   279 	// This also creates the IAP entry if it doesn't exist
   291 	// This also creates the IAP entry if it doesn't exist
   280 	EapMsChapV2DbUtils::OpenDatabaseL(db, session, iIndexType, iIndex, iTunnelingType);
   292 	EapMsChapV2DbUtils::OpenDatabaseL(db, session, iIndexType, iIndex, iTunnelingType);
   281 	
       
   282 	CleanupClosePushL(session);
       
   283 	CleanupClosePushL(db);
       
   284 
   293 
   285 	EapMsChapV2DbUtils::SetConfigurationL(
   294 	EapMsChapV2DbUtils::SetConfigurationL(
   286 		db,
   295 		db,
   287 		aSettings, 
   296 		aSettings, 
   288 		iIndexType,
   297 		iIndexType,
   289 		iIndex,
   298 		iIndex,
   290 		iTunnelingType);		
   299 		iTunnelingType);		
   291 		
   300 		
       
   301 	db.Close();
       
   302 	session.Close();
       
   303 
   292 	CleanupStack::PopAndDestroy(&db);
   304 	CleanupStack::PopAndDestroy(&db);
   293 	CleanupStack::PopAndDestroy(&session);
   305 	CleanupStack::PopAndDestroy(&session);
   294 }
   306 }
   295 
   307 
   296 void CEapMsChapV2::GetConfigurationL(EAPSettings& aSettings)
   308 void CEapMsChapV2::GetConfigurationL(EAPSettings& aSettings)
   300 
   312 
   301 	RDbNamedDatabase db;
   313 	RDbNamedDatabase db;
   302 
   314 
   303 	RFs session;
   315 	RFs session;
   304 	
   316 	
       
   317 	CleanupClosePushL(session);
       
   318 	CleanupClosePushL(db);
       
   319 	TInt error = session.Connect();
       
   320 	EAP_TRACE_DEBUG_SYMBIAN((_L("CEapMsChapV2::GetConfigurationL(): - session.Connect(), error=%d\n"), error));
       
   321 	User::LeaveIfError(error);
       
   322 
   305 	// This also creates the IAP entry if it doesn't exist
   323 	// This also creates the IAP entry if it doesn't exist
   306 	EapMsChapV2DbUtils::OpenDatabaseL(db, session, iIndexType, iIndex, iTunnelingType);
   324 	EapMsChapV2DbUtils::OpenDatabaseL(db, session, iIndexType, iIndex, iTunnelingType);
   307 	
       
   308 	CleanupClosePushL(session);
       
   309 	CleanupClosePushL(db);
       
   310 
   325 
   311 	EapMsChapV2DbUtils::GetConfigurationL(
   326 	EapMsChapV2DbUtils::GetConfigurationL(
   312 		db,
   327 		db,
   313 		aSettings, 
   328 		aSettings, 
   314 		iIndexType,
   329 		iIndexType,
   315 		iIndex,
   330 		iIndex,
   316 		iTunnelingType);
   331 		iTunnelingType);
   317 		
   332 		
       
   333 	db.Close();
       
   334 	session.Close();
       
   335 
   318 	CleanupStack::PopAndDestroy(&db);
   336 	CleanupStack::PopAndDestroy(&db);
   319 	CleanupStack::PopAndDestroy(&session);
   337 	CleanupStack::PopAndDestroy(&session);
   320 }
   338 }
   321 
   339 
   322 void CEapMsChapV2::CopySettingsL(
   340 void CEapMsChapV2::CopySettingsL(
   343 
   361 
   344 	RDbNamedDatabase db;
   362 	RDbNamedDatabase db;
   345 
   363 
   346 	RFs session;
   364 	RFs session;
   347 	
   365 	
   348 	EapMsChapV2DbUtils::OpenDatabaseL(db, session, iIndexType, iIndex, iTunnelingType);
       
   349 	
       
   350 	CleanupClosePushL(session);
   366 	CleanupClosePushL(session);
   351 	CleanupClosePushL(db);
   367 	CleanupClosePushL(db);
   352 		
   368 	TInt error = session.Connect();
       
   369 	EAP_TRACE_DEBUG_SYMBIAN((_L("CEapMsChapV2::CopySettingsL(): - session.Connect(), error=%d\n"), error));
       
   370 	User::LeaveIfError(error);
       
   371 
       
   372 	EapMsChapV2DbUtils::OpenDatabaseL(db, session, iIndexType, iIndex, iTunnelingType);
       
   373 
   353 	EapMsChapV2DbUtils::CopySettingsL(
   374 	EapMsChapV2DbUtils::CopySettingsL(
   354 		db,
   375 		db,
   355 		iIndexType,
   376 		iIndexType,
   356 		iIndex,
   377 		iIndex,
   357 		iTunnelingType, 
   378 		iTunnelingType, 
   358 		aDestinationIndexType, 
   379 		aDestinationIndexType, 
   359 		aDestinationIndex, 
   380 		aDestinationIndex, 
   360 		iTunnelingType);
   381 		iTunnelingType);
   361 		
   382 		
       
   383 	db.Close();
       
   384 	session.Close();
       
   385 
   362 	CleanupStack::PopAndDestroy(&db);
   386 	CleanupStack::PopAndDestroy(&db);
   363 	CleanupStack::PopAndDestroy(&session);
   387 	CleanupStack::PopAndDestroy(&session);
   364 	
   388 	
   365 }
   389 }
   366 
   390