eapol/eapol_framework/eapol_symbian/am/type/gsmsim/symbian/plugin/src/EapSim.cpp
changeset 26 9abfd4f00d37
parent 22 093cf0757204
child 34 ad1f037f1ac2
equal deleted inserted replaced
25:e03a3db4489e 26:9abfd4f00d37
    14 * Description:  EAP and WLAN authentication protocols.
    14 * Description:  EAP and WLAN authentication protocols.
    15 *
    15 *
    16 */
    16 */
    17 
    17 
    18 /*
    18 /*
    19 * %version: 16.1.3 %
    19 * %version: 24 %
    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
    36 #include "eap_type_gsmsim.h"
    36 #include "eap_type_gsmsim.h"
    37 #include "EapSimGlobal.h"
    37 #include "EapSimGlobal.h"
    38 #include <EapTypeInfo.h>
    38 #include <EapTypeInfo.h>
    39 #include "EapSimDbUtils.h"
    39 #include "EapSimDbUtils.h"
    40 
    40 
    41 
    41 #include "EapConversion.h"
    42 
       
    43 #include "eap_am_tools_symbian.h"
    42 #include "eap_am_tools_symbian.h"
       
    43 #include "EapTraceSymbian.h"
    44 
    44 
    45 // LOCAL CONSTANTS
    45 // LOCAL CONSTANTS
    46 
    46 
    47 // The version number of this interface.
    47 // The version number of this interface.
    48 const TUint KInterfaceVersion = 1;
    48 const TUint KInterfaceVersion = 1;
   134 	}
   134 	}
   135 	return type;
   135 	return type;
   136 }
   136 }
   137 
   137 
   138 // ----------------------------------------------------------
   138 // ----------------------------------------------------------
   139 TInt CEapSim::InvokeUiL()
   139 
   140 {
   140 CEapTypeInfo* CEapSim::GetInfoL()
   141 	TInt buttonId(0);
       
   142 
       
   143 	return buttonId;
       
   144 }
       
   145 // ----------------------------------------------------------
       
   146 CEapTypeInfo* CEapSim::GetInfoLC()
       
   147 {
   141 {
   148 	CEapTypeInfo* info = new(ELeave) CEapTypeInfo(
   142 	CEapTypeInfo* info = new(ELeave) CEapTypeInfo(
   149 		(TDesC&)KReleaseDate, 
   143 		(TDesC&)KReleaseDate, 
   150 		(TDesC&)KEapTypeVersion,
   144 		(TDesC&)KEapTypeVersion,
   151 		(TDesC&)KManufacturer);
   145 		(TDesC&)KManufacturer);
   152 
   146 
   153 	CleanupStack::PushL(info);
       
   154 	return info;
   147 	return info;
   155 }
   148 }
   156 
   149 
   157 // ----------------------------------------------------------
   150 // ----------------------------------------------------------
   158 
   151 
   168 	return KInterfaceVersion;
   161 	return KInterfaceVersion;
   169 }
   162 }
   170 
   163 
   171 // ----------------------------------------------------------
   164 // ----------------------------------------------------------
   172 
   165 
   173 void CEapSim::SetTunnelingType(const TInt aTunnelingType)
   166 void CEapSim::SetTunnelingType(const TEapExpandedType aTunnelingType)
   174 {
   167 {
   175 #ifdef USE_EAP_EXPANDED_TYPES
   168 
   176 
   169 EAP_TRACE_DATA_DEBUG_SYMBIAN(
   177 	// Vendor id is eap_type_vendor_id_ietf always in this plugin.
   170     (EAPL("CEapSim::SetTunnelingType - tunneling type"),
   178 	iTunnelingType.set_eap_type_values(eap_type_vendor_id_ietf, aTunnelingType);
   171     aTunnelingType.GetValue().Ptr(), aTunnelingType.GetValue().Length()));
   179 
   172 
   180 #else
   173 eap_type_value_e aInternalType;
   181 
   174 
   182 	iTunnelingType = static_cast<eap_type_value_e>(aTunnelingType);
   175 TInt err = CEapConversion::ConvertExpandedEAPTypeToInternalType(
   183 
   176         &aTunnelingType,
   184 #endif //#ifdef USE_EAP_EXPANDED_TYPES
   177         &aInternalType);
       
   178 
       
   179 iTunnelingType = aInternalType;
       
   180 
   185 }
   181 }
   186 
   182 
   187 
   183 
   188 // ----------------------------------------------------------
   184 // ----------------------------------------------------------
   189 void CEapSim::SetIndexL(
   185 void CEapSim::SetIndexL(
   205 	iIndexType = tmpIndexType;
   201 	iIndexType = tmpIndexType;
   206 	iIndex = tmpIndex;
   202 	iIndex = tmpIndex;
   207 
   203 
   208 	RDbNamedDatabase db;
   204 	RDbNamedDatabase db;
   209 
   205 
   210 	RDbs session;
   206 	RFs session;
   211 	
   207 	
   212 	EapSimDbUtils::OpenDatabaseL(db, session, iIndexType, iIndex, iTunnelingType);
   208 	EapSimDbUtils::OpenDatabaseL(db, session, iIndexType, iIndex, iTunnelingType);
   213 	
   209 	
   214 	CleanupClosePushL(session);
   210 	CleanupClosePushL(session);
   215 	CleanupClosePushL(db);
   211 	CleanupClosePushL(db);
   224 		iTunnelingType);
   220 		iTunnelingType);
   225 	
   221 	
   226 	iIndexType = aIndexType;
   222 	iIndexType = aIndexType;
   227 	iIndex = aIndex;
   223 	iIndex = aIndex;
   228 	
   224 	
   229 	CleanupStack::PopAndDestroy(2); // db
   225 	CleanupStack::PopAndDestroy(&db);
       
   226 	CleanupStack::PopAndDestroy(&session);
   230 }
   227 }
   231 
   228 
   232 void CEapSim::SetConfigurationL(const EAPSettings& aSettings)
   229 void CEapSim::SetConfigurationL(const EAPSettings& aSettings)
   233 {
   230 {
   234 	RDbNamedDatabase db;
   231 	RDbNamedDatabase db;
   235 
   232 
   236 	RDbs session;	
   233 	RFs session;
   237 	
   234 	
   238 	// This also creates the IAP entry if it doesn't exist
   235 	// This also creates the IAP entry if it doesn't exist
   239 	EapSimDbUtils::OpenDatabaseL(db, session, iIndexType, iIndex, iTunnelingType);
   236 	EapSimDbUtils::OpenDatabaseL(db, session, iIndexType, iIndex, iTunnelingType);
   240 	
   237 	
   241 	CleanupClosePushL(session);
   238 	CleanupClosePushL(session);
   246 		aSettings, 
   243 		aSettings, 
   247 		iIndexType,
   244 		iIndexType,
   248 		iIndex,
   245 		iIndex,
   249 		iTunnelingType);		
   246 		iTunnelingType);		
   250 		
   247 		
   251 	CleanupStack::PopAndDestroy(2); // db, session
   248 	CleanupStack::PopAndDestroy(&db);
       
   249 	CleanupStack::PopAndDestroy(&session);
   252 }
   250 }
   253 
   251 
   254 void CEapSim::GetConfigurationL(EAPSettings& aSettings)
   252 void CEapSim::GetConfigurationL(EAPSettings& aSettings)
   255 {
   253 {
   256 	RDbNamedDatabase db;
   254 	RDbNamedDatabase db;
   257 
   255 
   258 	RDbs session;
   256 	RFs session;
   259 	
   257 	
   260 	// This also creates the IAP entry if it doesn't exist
   258 	// This also creates the IAP entry if it doesn't exist
   261 	EapSimDbUtils::OpenDatabaseL(db, session, iIndexType, iIndex, iTunnelingType);
   259 	EapSimDbUtils::OpenDatabaseL(db, session, iIndexType, iIndex, iTunnelingType);
   262 	
   260 	
   263 	CleanupClosePushL(session);
   261 	CleanupClosePushL(session);
   268 		aSettings, 
   266 		aSettings, 
   269 		iIndexType,
   267 		iIndexType,
   270 		iIndex,
   268 		iIndex,
   271 		iTunnelingType);
   269 		iTunnelingType);
   272 		
   270 		
   273 	CleanupStack::PopAndDestroy(2); // db, session
   271 	CleanupStack::PopAndDestroy(&db);
       
   272 	CleanupStack::PopAndDestroy(&session);
   274 }
   273 }
   275 
   274 
   276 void CEapSim::CopySettingsL(
   275 void CEapSim::CopySettingsL(
   277 	const TIndexType aDestinationIndexType,
   276 	const TIndexType aDestinationIndexType,
   278 	const TInt aDestinationIndex)
   277 	const TInt aDestinationIndex)
   292 	iIndexType = tmpIndexType;
   291 	iIndexType = tmpIndexType;
   293 	iIndex = tmpIndex;
   292 	iIndex = tmpIndex;
   294 
   293 
   295 	RDbNamedDatabase db;
   294 	RDbNamedDatabase db;
   296 
   295 
   297 	RDbs session;
   296 	RFs session;
   298 	
   297 	
   299 	EapSimDbUtils::OpenDatabaseL(db, session, iIndexType, iIndex, iTunnelingType);
   298 	EapSimDbUtils::OpenDatabaseL(db, session, iIndexType, iIndex, iTunnelingType);
   300 	
   299 	
   301 	CleanupClosePushL(session);
   300 	CleanupClosePushL(session);
   302 	CleanupClosePushL(db);
   301 	CleanupClosePushL(db);
   308 		iTunnelingType, 
   307 		iTunnelingType, 
   309 		aDestinationIndexType, 
   308 		aDestinationIndexType, 
   310 		aDestinationIndex, 
   309 		aDestinationIndex, 
   311 		iTunnelingType);
   310 		iTunnelingType);
   312 		
   311 		
   313 	CleanupStack::PopAndDestroy(2); // db
   312 	CleanupStack::PopAndDestroy(&db);
       
   313 	CleanupStack::PopAndDestroy(&session);
   314 	
   314 	
   315 }
   315 }
   316 
   316 
   317 	
   317 	
   318 // End of file
   318 // End of file