eapol/eapol_framework/eapol_symbian/am/type/securid/symbian/plugin/src/EapSecurID.cpp
branchRCL_3
changeset 18 bad0cc58d154
parent 2 1c7bc153c08e
child 19 c74b3d9f6b9e
equal deleted inserted replaced
17:30e048a7b597 18:bad0cc58d154
    14 * Description:  EAP and WLAN authentication protocols.
    14 * Description:  EAP and WLAN authentication protocols.
    15 *
    15 *
    16 */
    16 */
    17 
    17 
    18 /*
    18 /*
    19 * %version: 15.1.2 %
    19 * %version: 25 %
    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
    35 #include "eap_type_securid.h"
    35 #include "eap_type_securid.h"
    36 #include "EapSecurIDGlobal.h"
    36 #include "EapSecurIDGlobal.h"
    37 #include <EapTypeInfo.h>
    37 #include <EapTypeInfo.h>
    38 #include "EapGtcDbUtils.h"
    38 #include "EapGtcDbUtils.h"
    39 
    39 
    40 #include <EapGtcUiConnection.h>
       
    41 #include "EapGtcUi.h"
       
    42 
       
    43 #include "eap_am_tools_symbian.h"
    40 #include "eap_am_tools_symbian.h"
       
    41 #include "EapConversion.h"
       
    42 #include "EapTraceSymbian.h"
    44 
    43 
    45 // LOCAL CONSTANTS
    44 // LOCAL CONSTANTS
    46 
    45 
    47 // The version number of this interface.
    46 // The version number of this interface.
    48 const TUint KInterfaceVersion = 1;
    47 const TUint KInterfaceVersion = 1;
   150 	return KInterfaceVersion; 
   149 	return KInterfaceVersion; 
   151 }
   150 }
   152 
   151 
   153 // ----------------------------------------------------------
   152 // ----------------------------------------------------------
   154 
   153 
   155 TInt CEapSecurID::InvokeUiL()
   154 CEapTypeInfo* CEapSecurID::GetInfoL()
   156 {
       
   157 	TInt buttonId(0);
       
   158 
       
   159 #ifdef USE_EAP_EXPANDED_TYPES
       
   160 
       
   161     CEapGtcUiConnection uiConn(iIndexType, iIndex, iTunnelingType.get_vendor_type());
       
   162 	
       
   163 #else
       
   164 
       
   165     CEapGtcUiConnection uiConn(iIndexType, iIndex, iTunnelingType);
       
   166 
       
   167 #endif //#ifdef USE_EAP_EXPANDED_TYPES
       
   168 	
       
   169 	CEapGtcUi* ui = CEapGtcUi::NewL(&uiConn);
       
   170 	CleanupStack::PushL(ui);
       
   171 	buttonId = ui->InvokeUiL();
       
   172 	CleanupStack::PopAndDestroy(ui);
       
   173 	return buttonId;
       
   174 }
       
   175 
       
   176 // ----------------------------------------------------------
       
   177 
       
   178 CEapTypeInfo* CEapSecurID::GetInfoLC()
       
   179 {
   155 {
   180 	CEapTypeInfo* info = new(ELeave) CEapTypeInfo(
   156 	CEapTypeInfo* info = new(ELeave) CEapTypeInfo(
   181 		(TDesC&) KReleaseDate,
   157 		(TDesC&) KReleaseDate,
   182 		(TDesC&) KEapTypeVersion,
   158 		(TDesC&) KEapTypeVersion,
   183 		(TDesC&) KManufacturer);
   159 		(TDesC&) KManufacturer);
   184 	CleanupStack::PushL(info);
   160 
   185 	return info;
   161 	return info;
   186 }
   162 }
   187 
   163 
   188 // ----------------------------------------------------------
   164 // ----------------------------------------------------------
   189 
   165 
   192 	EapGtcDbUtils::DeleteConfigurationL(iIndexType, iIndex, iTunnelingType);
   168 	EapGtcDbUtils::DeleteConfigurationL(iIndexType, iIndex, iTunnelingType);
   193 }
   169 }
   194 
   170 
   195 // ----------------------------------------------------------
   171 // ----------------------------------------------------------
   196 
   172 
   197 void CEapSecurID::SetTunnelingType(const TInt aTunnelingType)
   173 void CEapSecurID::SetTunnelingType(const TEapExpandedType aTunnelingType)
   198 {
   174     {
   199 #ifdef USE_EAP_EXPANDED_TYPES
   175     EAP_TRACE_DATA_DEBUG_SYMBIAN(
   200 
   176         (EAPL("CEapSecurID::SetTunnelingType - tunneling type"),
   201 	// Vendor id is eap_type_vendor_id_ietf always in this plugin.
   177         aTunnelingType.GetValue().Ptr(), aTunnelingType.GetValue().Length()));
   202 	iTunnelingType.set_eap_type_values(eap_type_vendor_id_ietf, aTunnelingType);
   178     
   203 
   179     eap_type_value_e aInternalType;
   204 #else
   180     
   205 
   181     TInt err = CEapConversion::ConvertExpandedEAPTypeToInternalType(
   206 	iTunnelingType = static_cast<eap_type_value_e>(aTunnelingType);
   182             &aTunnelingType,
   207 
   183             &aInternalType);
   208 #endif //#ifdef USE_EAP_EXPANDED_TYPES
   184     
   209 }
   185     iTunnelingType = aInternalType;
       
   186     }
   210 
   187 
   211 // ----------------------------------------------------------
   188 // ----------------------------------------------------------
   212 void CEapSecurID::SetIndexL(
   189 void CEapSecurID::SetIndexL(
   213 		const TIndexType aIndexType, 
   190 		const TIndexType aIndexType, 
   214 		const TInt aIndex)
   191 		const TInt aIndex)
   228 	iIndexType = tmpIndexType;
   205 	iIndexType = tmpIndexType;
   229 	iIndex = tmpIndex;
   206 	iIndex = tmpIndex;
   230 
   207 
   231 	RDbNamedDatabase db;
   208 	RDbNamedDatabase db;
   232 
   209 
   233 	RDbs session;
   210 	RFs session;
   234 	
       
   235 	EapGtcDbUtils::OpenDatabaseL(db, session, iIndexType, iIndex, iTunnelingType);
       
   236 	
   211 	
   237 	CleanupClosePushL(session);
   212 	CleanupClosePushL(session);
   238 	CleanupClosePushL(db);
   213 	CleanupClosePushL(db);
   239 		
   214 	TInt error = session.Connect();
       
   215 	EAP_TRACE_DEBUG_SYMBIAN((_L("CEapSecurID::SetIndexL(): - session.Connect(), error=%d\n"), error));
       
   216 	User::LeaveIfError(error);
       
   217 
       
   218 	EapGtcDbUtils::OpenDatabaseL(db, session, iIndexType, iIndex, iTunnelingType);
       
   219 
   240 	EapGtcDbUtils::SetIndexL(
   220 	EapGtcDbUtils::SetIndexL(
   241 		db, 
   221 		db, 
   242 		iIndexType, 
   222 		iIndexType, 
   243 		iIndex, 
   223 		iIndex, 
   244 		iTunnelingType, 
   224 		iTunnelingType, 
   247 		iTunnelingType);
   227 		iTunnelingType);
   248 	
   228 	
   249 	iIndexType = aIndexType;
   229 	iIndexType = aIndexType;
   250 	iIndex = aIndex;
   230 	iIndex = aIndex;
   251 
   231 
   252 	CleanupStack::PopAndDestroy(2); // db
   232 	db.Close();
   253 	
   233 	session.Close();
   254 		
   234 
       
   235 	CleanupStack::PopAndDestroy(&db);
       
   236 	CleanupStack::PopAndDestroy(&session);
   255 }
   237 }
   256 
   238 
   257 void CEapSecurID::SetConfigurationL(const EAPSettings& aSettings)
   239 void CEapSecurID::SetConfigurationL(const EAPSettings& aSettings)
   258 {
   240 {
   259 	RDbNamedDatabase db;
   241 	RDbNamedDatabase db;
   260 
   242 
   261 	RDbs session;	
   243 	RFs session;
   262 	
   244 	
       
   245 	CleanupClosePushL(session);
       
   246 	CleanupClosePushL(db);
       
   247 	TInt error = session.Connect();
       
   248 	EAP_TRACE_DEBUG_SYMBIAN((_L("CEapSecurID::SetConfigurationL(): - session.Connect(), error=%d\n"), error));
       
   249 	User::LeaveIfError(error);
       
   250 
   263 	// This also creates the IAP entry if it doesn't exist
   251 	// This also creates the IAP entry if it doesn't exist
   264 	EapGtcDbUtils::OpenDatabaseL(db, session, iIndexType, iIndex, iTunnelingType);
   252 	EapGtcDbUtils::OpenDatabaseL(db, session, iIndexType, iIndex, iTunnelingType);
   265 	
       
   266 	CleanupClosePushL(session);
       
   267 	CleanupClosePushL(db);
       
   268 
   253 
   269 	EapGtcDbUtils::SetConfigurationL(
   254 	EapGtcDbUtils::SetConfigurationL(
   270 		db,
   255 		db,
   271 		aSettings, 
   256 		aSettings, 
   272 		iIndexType,
   257 		iIndexType,
   273 		iIndex,
   258 		iIndex,
   274 		iTunnelingType);		
   259 		iTunnelingType);		
   275 		
   260 
   276 	CleanupStack::PopAndDestroy(2); // db, session
   261 	db.Close();
       
   262 	session.Close();
       
   263 
       
   264 	CleanupStack::PopAndDestroy(&db);
       
   265 	CleanupStack::PopAndDestroy(&session);
   277 }
   266 }
   278 
   267 
   279 void CEapSecurID::GetConfigurationL(EAPSettings& aSettings)
   268 void CEapSecurID::GetConfigurationL(EAPSettings& aSettings)
   280 {
   269 {
   281 	RDbNamedDatabase db;
   270 	RDbNamedDatabase db;
   282 
   271 
   283 	RDbs session;
   272 	RFs session;
   284 	
   273 	
       
   274 	CleanupClosePushL(session);
       
   275 	CleanupClosePushL(db);
       
   276 	TInt error = session.Connect();
       
   277 	EAP_TRACE_DEBUG_SYMBIAN((_L("CEapSecurID::GetConfigurationL(): - session.Connect(), error=%d\n"), error));
       
   278 	User::LeaveIfError(error);
       
   279 
   285 	// This also creates the IAP entry if it doesn't exist
   280 	// This also creates the IAP entry if it doesn't exist
   286 	EapGtcDbUtils::OpenDatabaseL(db, session, iIndexType, iIndex, iTunnelingType);
   281 	EapGtcDbUtils::OpenDatabaseL(db, session, iIndexType, iIndex, iTunnelingType);
   287 	
       
   288 	CleanupClosePushL(session);
       
   289 	CleanupClosePushL(db);
       
   290 
   282 
   291 	EapGtcDbUtils::GetConfigurationL(
   283 	EapGtcDbUtils::GetConfigurationL(
   292 		db,
   284 		db,
   293 		aSettings, 
   285 		aSettings, 
   294 		iIndexType,
   286 		iIndexType,
   295 		iIndex,
   287 		iIndex,
   296 		iTunnelingType);
   288 		iTunnelingType);
   297 		
   289 
   298 	CleanupStack::PopAndDestroy(2); // db, session
   290 	db.Close();
       
   291 	session.Close();
       
   292 
       
   293 	CleanupStack::PopAndDestroy(&db);
       
   294 	CleanupStack::PopAndDestroy(&session);
   299 }
   295 }
   300 
   296 
   301 void CEapSecurID::CopySettingsL(
   297 void CEapSecurID::CopySettingsL(
   302 	const TIndexType aDestinationIndexType,
   298 	const TIndexType aDestinationIndexType,
   303 	const TInt aDestinationIndex)
   299 	const TInt aDestinationIndex)
   317 	iIndexType = tmpIndexType;
   313 	iIndexType = tmpIndexType;
   318 	iIndex = tmpIndex;
   314 	iIndex = tmpIndex;
   319 
   315 
   320 	RDbNamedDatabase db;
   316 	RDbNamedDatabase db;
   321 
   317 
   322 	RDbs session;
   318 	RFs session;
   323 	
       
   324 	EapGtcDbUtils::OpenDatabaseL(db, session, iIndexType, iIndex, iTunnelingType);
       
   325 	
   319 	
   326 	CleanupClosePushL(session);
   320 	CleanupClosePushL(session);
   327 	CleanupClosePushL(db);
   321 	CleanupClosePushL(db);
   328 		
   322 	TInt error = session.Connect();
       
   323 	EAP_TRACE_DEBUG_SYMBIAN((_L("CEapSecurID::CopySettingsL(): - session.Connect(), error=%d\n"), error));
       
   324 	User::LeaveIfError(error);
       
   325 
       
   326 	EapGtcDbUtils::OpenDatabaseL(db, session, iIndexType, iIndex, iTunnelingType);
       
   327 
   329 	EapGtcDbUtils::CopySettingsL(
   328 	EapGtcDbUtils::CopySettingsL(
   330 		db,
   329 		db,
   331 		iIndexType,
   330 		iIndexType,
   332 		iIndex,
   331 		iIndex,
   333 		iTunnelingType, 
   332 		iTunnelingType, 
   334 		aDestinationIndexType, 
   333 		aDestinationIndexType, 
   335 		aDestinationIndex, 
   334 		aDestinationIndex, 
   336 		iTunnelingType);
   335 		iTunnelingType);
   337 		
   336 
   338 	CleanupStack::PopAndDestroy(2); // db
   337 	db.Close();
   339 	
   338 	session.Close();
       
   339 
       
   340 	CleanupStack::PopAndDestroy(&db);
       
   341 	CleanupStack::PopAndDestroy(&session);
   340 }
   342 }
   341 
   343 
   342 
   344 
   343 // End of File
   345 // End of File