eapol/eapol_framework/eapol_symbian/am/type/gsmsim/symbian/eap_am_type_gsmsim_symbian.cpp
branchRCL_3
changeset 19 c74b3d9f6b9e
parent 18 bad0cc58d154
--- a/eapol/eapol_framework/eapol_symbian/am/type/gsmsim/symbian/eap_am_type_gsmsim_symbian.cpp	Tue Aug 31 15:16:37 2010 +0300
+++ b/eapol/eapol_framework/eapol_symbian/am/type/gsmsim/symbian/eap_am_type_gsmsim_symbian.cpp	Wed Sep 01 12:23:57 2010 +0100
@@ -16,7 +16,7 @@
 */
 
 /*
-* %version: 47.1.10 %
+* %version: 50 %
 */
 
 // This is enumeration of EAPOL source code.
@@ -39,7 +39,7 @@
 #include "EapSimDbDefaults.h"
 #include "EapSimDbParameterNames.h"
 #include "EapSimDbUtils.h"
-#include "EapTraceSymbian.h"
+#include "eap_am_trace_symbian.h"
 
 #include <d32dbms.h>	// For DBMS
 #include <s32strm.h> 	// For RReadStream
@@ -108,6 +108,16 @@
 {
 	EAP_TRACE_BEGIN(m_am_tools, TRACE_FLAGS_DEFAULT);
 
+#ifdef USE_EAP_EXPANDED_TYPES
+
+	m_tunneling_vendor_type = m_tunneling_type.get_vendor_type();
+
+#else
+
+	m_tunneling_vendor_type = static_cast<TUint>(m_tunneling_type);
+
+#endif //#ifdef USE_EAP_EXPANDED_TYPES
+
 	if (receive_network_id != 0
 		&& receive_network_id->get_is_valid_data() == true)
 	{
@@ -131,10 +141,6 @@
 
 void eap_am_type_gsmsim_symbian_c::ConstructL()
 {
-	TInt error = m_session.Connect();
-	EAP_TRACE_DEBUG_SYMBIAN((_L("eap_am_type_gsmsim_symbian_c::ConstructL(): - m_session.Connect(), error=%d\n"), error));
-	User::LeaveIfError(error);
-
 	// Open/create database
 	EapSimDbUtils::OpenDatabaseL(m_database, m_session, m_index_type, m_index, m_tunneling_type);	
 	
@@ -284,22 +290,9 @@
 	HBufC* buf = HBufC::NewLC(KMaxSqlQueryLength);
 	TPtr sqlStatement = buf->Des();
 
-	_LIT(KSQLInsert, "SELECT %S, %S, %S, %S FROM %S WHERE %S=%d AND %S=%d AND %S=%d AND %S=%d");
-	sqlStatement.Format(
-		KSQLInsert,
-		&KXKey,
-		&KK_aut,
-		&KK_encr,
-		&KReauthCounter,
-		&KSimTableName, 
-		&KServiceType,
-		m_index_type,
-		&KServiceIndex,
-		m_index,
-		&KTunnelingTypeVendorId,
-		m_tunneling_type.get_vendor_id(),
-		&KTunnelingType, 
-		m_tunneling_type.get_vendor_type());
+	_LIT(KSQLInsert, "SELECT %S, %S, %S, %S FROM %S WHERE %S=%d AND %S=%d AND %S=%d");
+	sqlStatement.Format(KSQLInsert, &KXKey, &KK_aut, &KK_encr, &KReauthCounter, &KSimTableName, 
+		&KServiceType, m_index_type, &KServiceIndex, m_index, &KTunnelingType, m_tunneling_vendor_type);
 		
 	// Evaluate view
 	RDbView view;
@@ -361,7 +354,7 @@
 
 //--------------------------------------------------
 
-EAP_FUNC_EXPORT eap_status_e eap_am_type_gsmsim_symbian_c::authentication_finished(
+eap_status_e eap_am_type_gsmsim_symbian_c::authentication_finished(
 	const bool true_when_successful,
 	const eap_gsmsim_authentication_type_e authentication_type,
 	const eap_type_gsmsim_identity_type identity_type)
@@ -434,22 +427,9 @@
 	TPtr sqlStatement = buf->Des();
 
 	// Form the query
-	_LIT(KSQLQuery, "SELECT %S, %S, %S, %S FROM %S WHERE %S=%d AND %S=%d AND %S=%d AND %S=%d");
-	sqlStatement.Format(
-		KSQLQuery,
-		&KXKey,
-		&KK_aut,
-		&KK_encr,
-		&KReauthCounter,
-		&KSimTableName,
-		&KServiceType,
-		m_index_type,
-		&KServiceIndex,
-		m_index,
-		&KTunnelingTypeVendorId,
-		m_tunneling_type.get_vendor_id(),
-		&KTunnelingType, 
-		m_tunneling_type.get_vendor_type());
+	_LIT(KSQLQuery, "SELECT %S, %S, %S, %S FROM %S WHERE %S=%d AND %S=%d AND %S=%d");
+	sqlStatement.Format(KSQLQuery, &KXKey, &KK_aut, &KK_encr, &KReauthCounter, &KSimTableName, 
+		&KServiceType, m_index_type, &KServiceIndex, m_index, &KTunnelingType, m_tunneling_vendor_type);
 		
 	RDbView view;
 	// Evaluate view
@@ -553,19 +533,9 @@
 	HBufC* buf = HBufC::NewLC(KMaxSqlQueryLength);
 	TPtr sqlStatement = buf->Des();
 
-	_LIT(KSQLInsert, "SELECT %S FROM %S WHERE %S=%d AND %S=%d AND %S=%d AND %S=%d");
-	sqlStatement.Format(
-		KSQLInsert,
-		&KReauthCounter,
-		&KSimTableName, 
-		&KServiceType,
-		m_index_type,
-		&KServiceIndex,
-		m_index,
-		&KTunnelingTypeVendorId,
-		m_tunneling_type.get_vendor_id(),
-		&KTunnelingType, 
-		m_tunneling_type.get_vendor_type());
+	_LIT(KSQLInsert, "SELECT %S FROM %S WHERE %S=%d AND %S=%d AND %S=%d");
+	sqlStatement.Format(KSQLInsert, &KReauthCounter, &KSimTableName, 
+		&KServiceType, m_index_type, &KServiceIndex, m_index, &KTunnelingType, m_tunneling_vendor_type);
 		
 	// Evaluate view
 	RDbView view;
@@ -663,7 +633,7 @@
 	{
 		eap_variable_data_c simulator_sim_algorithm(m_am_tools);
 
-		eap_status_e status = type_configure_read(
+		eap_status_e status = m_partner->read_configure(
 			cf_str_EAP_GSMSIM_simulator_sim_algorithm.get_field(),
 			&simulator_sim_algorithm);
 		if (status == eap_status_ok
@@ -700,7 +670,7 @@
 	}
 	
 	{
-		eap_status_e status = type_configure_read(
+		eap_status_e status = m_partner->read_configure(
 			cf_str_EAP_GSMSIM_simulator_sim_ki.get_field(),
 			&m_simulator_sim_ki);
 		if (status == eap_status_ok
@@ -749,7 +719,7 @@
 		// Read Maximum Session Validity Time from the config file
 		eap_variable_data_c sessionTimeFromFile(m_am_tools);
 		
-		eap_status_e status = type_configure_read(
+		eap_status_e status = m_partner->read_configure(
 			cf_str_EAP_GSMSIM_max_session_validity_time.get_field(),
 			&sessionTimeFromFile);
 		
@@ -934,19 +904,9 @@
 	HBufC* buf = HBufC::NewLC(KMaxSqlQueryLength);
 	TPtr sqlStatement = buf->Des();
 
-	_LIT(KSQLInsert, "SELECT %S FROM %S WHERE %S=%d AND %S=%d AND %S=%d AND %S=%d");
-	sqlStatement.Format(
-		KSQLInsert,
-		&KPseudonymId,
-		&KSimTableName, 
-		&KServiceType,
-		m_index_type,
-		&KServiceIndex,
-		m_index,
-		&KTunnelingTypeVendorId,
-		m_tunneling_type.get_vendor_id(),
-		&KTunnelingType, 
-		m_tunneling_type.get_vendor_type());
+	_LIT(KSQLInsert, "SELECT %S FROM %S WHERE %S=%d AND %S=%d AND %S=%d");
+	sqlStatement.Format(KSQLInsert, &KPseudonymId, &KSimTableName, 
+		&KServiceType, m_index_type, &KServiceIndex, m_index, &KTunnelingType, m_tunneling_vendor_type);
 
 	// Evaluate view
 	RDbView view;
@@ -1041,19 +1001,9 @@
 	HBufC* buf = HBufC::NewLC(KMaxSqlQueryLength);
 	TPtr sqlStatement = buf->Des();
 
-	_LIT(KSQLInsert, "SELECT %S FROM %S WHERE %S=%d AND %S=%d AND %S=%d AND %S=%d");
-	sqlStatement.Format(
-		KSQLInsert,
-		&KReauthId,
-		&KSimTableName, 
-		&KServiceType,
-		m_index_type,
-		&KServiceIndex,
-		m_index,
-		&KTunnelingTypeVendorId,
-		m_tunneling_type.get_vendor_id(),
-		&KTunnelingType, 
-		m_tunneling_type.get_vendor_type());
+	_LIT(KSQLInsert, "SELECT %S FROM %S WHERE %S=%d AND %S=%d AND %S=%d");
+	sqlStatement.Format(KSQLInsert, &KReauthId, &KSimTableName, 
+		&KServiceType, m_index_type, &KServiceIndex, m_index, &KTunnelingType, m_tunneling_vendor_type);
 		
 	// Evaluate view
 	RDbView view;
@@ -1143,20 +1093,9 @@
 	HBufC* buf = HBufC::NewLC(KMaxSqlQueryLength);
 	TPtr sqlStatement = buf->Des();
 
-	_LIT(KSQLInsert, "SELECT %S FROM %S WHERE %S=%d AND %S=%d AND %S=%d AND %S=%d");
-	sqlStatement.Format(
-		KSQLInsert,
-		&KPreviousIMSI,
-		&KSimTableName, 
-		&KServiceType,
-		m_index_type,
-		&KServiceIndex,
-		m_index,
-		&KTunnelingTypeVendorId,
-		m_tunneling_type.get_vendor_id(),
-		&KTunnelingType, 
-		m_tunneling_type.get_vendor_type());
-
+	_LIT(KSQLInsert, "SELECT %S FROM %S WHERE %S=%d AND %S=%d AND %S=%d");
+	sqlStatement.Format(KSQLInsert, &KPreviousIMSI, &KSimTableName, 
+		&KServiceType, m_index_type, &KServiceIndex, m_index, &KTunnelingType, m_tunneling_vendor_type);
 	// Evaluate view
 	RDbView view;
 	
@@ -1278,22 +1217,11 @@
 
 	// Query all the relevant parameters
 
-	_LIT(KSQLQuery, "SELECT %S, %S, %S, %S FROM %S WHERE %S=%d AND %S=%d AND %S=%d AND %S=%d");
-	sqlStatement.Format(
-		KSQLQuery,
-		&KReauthId,
-		&KReauthCounter,
-		&KPseudonymId,
-		&KPreviousIMSI,
-		&KSimTableName,
-		&KServiceType,
-		m_index_type, 
-		&KServiceIndex,
-		m_index,
-		&KTunnelingTypeVendorId,
-		m_tunneling_type.get_vendor_id(),
-		&KTunnelingType, 
-		m_tunneling_type.get_vendor_type());
+	_LIT(KSQLQuery, "SELECT %S, %S, %S, %S FROM %S WHERE %S=%d AND %S=%d AND %S=%d");
+	sqlStatement.Format(KSQLQuery, &KReauthId, &KReauthCounter, &KPseudonymId,
+						&KPreviousIMSI, &KSimTableName,
+						&KServiceType, m_index_type, 
+						&KServiceIndex, m_index, &KTunnelingType, m_tunneling_vendor_type);
 
 	RDbView view;
 	// Evaluate view
@@ -1648,7 +1576,7 @@
 //--------------------------------------------------
 
 //
-EAP_FUNC_EXPORT eap_status_e eap_am_type_gsmsim_symbian_c::cancel_SIM_IMSI_or_pseudonym_or_reauthentication_id_query()
+eap_status_e eap_am_type_gsmsim_symbian_c::cancel_SIM_IMSI_or_pseudonym_or_reauthentication_id_query()
 {
 	EAP_TRACE_BEGIN(m_am_tools, TRACE_FLAGS_DEFAULT);
 #if defined (USE_EAP_GSMSIM_INTERFACE) && !defined(__WINS__)
@@ -2012,7 +1940,7 @@
 //-------------------------------------------------
 
 //
-EAP_FUNC_EXPORT eap_status_e eap_am_type_gsmsim_symbian_c::cancel_SIM_kc_sres_query()
+eap_status_e eap_am_type_gsmsim_symbian_c::cancel_SIM_kc_sres_query()
 {
 	EAP_TRACE_BEGIN(m_am_tools, TRACE_FLAGS_DEFAULT);
 		
@@ -2146,19 +2074,9 @@
 	HBufC* buf = HBufC::NewLC(KMaxSqlQueryLength);
 	TPtr sqlStatement = buf->Des();
 
-	_LIT(KSQLQueryRow, "SELECT %S FROM %S WHERE %S=%d AND %S=%d AND %S=%d AND %S=%d");
-	sqlStatement.Format(
-		KSQLQueryRow,
-		&unicodeString,
-		&KSimTableName, 
-		&KServiceType,
-		m_index_type,
-		&KServiceIndex,
-		m_index,
-		&KTunnelingTypeVendorId,
-		m_tunneling_type.get_vendor_id(),
-		&KTunnelingType, 
-		m_tunneling_type.get_vendor_type());
+	_LIT(KSQLQueryRow, "SELECT %S FROM %S WHERE %S=%d AND %S=%d AND %S=%d");
+	sqlStatement.Format(KSQLQueryRow, &unicodeString, &KSimTableName, 
+		&KServiceType, m_index_type, &KServiceIndex, m_index, &KTunnelingType, m_tunneling_vendor_type);
 	
 	RDbView view;
 	User::LeaveIfError(view.Prepare(m_database, TDbQuery(sqlStatement), TDbWindow::EUnlimited));
@@ -2543,7 +2461,7 @@
 //--------------------------------------------------
 
 //
-EAP_FUNC_EXPORT eap_status_e eap_am_type_gsmsim_symbian_c::cancel_imsi_from_username_query()
+eap_status_e eap_am_type_gsmsim_symbian_c::cancel_imsi_from_username_query()
 {
 	EAP_TRACE_BEGIN(m_am_tools, TRACE_FLAGS_DEFAULT);
 	EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
@@ -2710,20 +2628,11 @@
 	TPtr sqlStatement = buf->Des();
 	
 	// Query all the relevant parameters
-	_LIT(KSQLQuery, "SELECT %S, %S FROM %S WHERE %S=%d AND %S=%d AND %S=%d AND %S=%d");
-	sqlStatement.Format(
-		KSQLQuery,
-		&cf_str_EAP_GSMSIM_max_session_validity_time_literal,
-		&KGSMSIMLastFullAuthTime,
-		&KSimTableName,
-		&KServiceType,
-		m_index_type, 
-		&KServiceIndex,
-		m_index,
-		&KTunnelingTypeVendorId,
-		m_tunneling_type.get_vendor_id(),
-		&KTunnelingType, 
-		m_tunneling_type.get_vendor_type());
+	_LIT(KSQLQuery, "SELECT %S, %S FROM %S WHERE %S=%d AND %S=%d AND %S=%d");
+	sqlStatement.Format(KSQLQuery, &cf_str_EAP_GSMSIM_max_session_validity_time_literal,
+						&KGSMSIMLastFullAuthTime, &KSimTableName,
+						&KServiceType, m_index_type, 
+						&KServiceIndex, m_index, &KTunnelingType, m_tunneling_vendor_type);
 
 	RDbView view;
 	// Evaluate view
@@ -2841,19 +2750,10 @@
 	TPtr sqlStatement = buf->Des();
 	
 	// Query all the relevant parameters
-	_LIT(KSQLQuery, "SELECT %S FROM %S WHERE %S=%d AND %S=%d AND %S=%d AND %S=%d");
-	sqlStatement.Format(
-		KSQLQuery,
-		&KGSMSIMLastFullAuthTime,
-		&KSimTableName,
-		&KServiceType,
-		m_index_type, 
-		&KServiceIndex,
-		m_index,
-		&KTunnelingTypeVendorId,
-		m_tunneling_type.get_vendor_id(),
-		&KTunnelingType, 
-		m_tunneling_type.get_vendor_type());
+	_LIT(KSQLQuery, "SELECT %S FROM %S WHERE %S=%d AND %S=%d AND %S=%d");
+	sqlStatement.Format(KSQLQuery, &KGSMSIMLastFullAuthTime, &KSimTableName,
+						&KServiceType, m_index_type, 
+						&KServiceIndex, m_index, &KTunnelingType, m_tunneling_vendor_type);
 
 	RDbView view;
 	// Evaluate view