eapol/eapol_framework/eapol_symbian/am/type/gsmsim/symbian/EapSimInterface.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: %
    19 * %version: 13.1.2 %
    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
    28 #endif //#if defined(USE_EAP_MINIMUM_RELEASE_TRACES)
    28 #endif //#if defined(USE_EAP_MINIMUM_RELEASE_TRACES)
    29 
    29 
    30 
    30 
    31 // INCLUDE FILES
    31 // INCLUDE FILES
    32 #include "EapSimInterface.h"
    32 #include "EapSimInterface.h"
       
    33 #include "eap_automatic_variable.h"
    33 
    34 
    34 #include <mmtsy_names.h>
    35 #include <mmtsy_names.h>
    35 #include "eap_sim_triplets.h" // For SIM_SRES_LENGTH.
    36 #include "eap_sim_triplets.h" // For SIM_SRES_LENGTH.
    36 
    37 
    37 
    38 
    44 , iAuthenticationData(NULL)
    45 , iAuthenticationData(NULL)
    45 , iQueryId(EQueryNone)
    46 , iQueryId(EQueryNone)
    46 , iMMETELConnectionStatus(EFalse)
    47 , iMMETELConnectionStatus(EFalse)
    47 {
    48 {
    48 	EAP_TRACE_BEGIN(m_am_tools, TRACE_FLAGS_DEFAULT);
    49 	EAP_TRACE_BEGIN(m_am_tools, TRACE_FLAGS_DEFAULT);
       
    50 	EAP_TRACE_DEBUG(m_am_tools, TRACE_FLAGS_DEFAULT, (EAPL("CEapSimIsaInterface::CEapSimIsaInterface()\n")));
       
    51 	EAP_TRACE_RETURN_STRING(m_am_tools, "returns: CEapSimIsaInterface::CEapSimIsaInterface()");
    49 	EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
    52 	EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
    50 }
    53 }
    51 
    54 
    52 //--------------------------------------------------
    55 //--------------------------------------------------
    53 
    56 
    75 //--------------------------------------------------
    78 //--------------------------------------------------
    76 
    79 
    77 CEapSimIsaInterface::~CEapSimIsaInterface()
    80 CEapSimIsaInterface::~CEapSimIsaInterface()
    78 {
    81 {
    79 	EAP_TRACE_BEGIN(m_am_tools, TRACE_FLAGS_DEFAULT);
    82 	EAP_TRACE_BEGIN(m_am_tools, TRACE_FLAGS_DEFAULT);
       
    83 	EAP_TRACE_DEBUG(m_am_tools, TRACE_FLAGS_DEFAULT, (EAPL("CEapSimIsaInterface::~CEapSimIsaInterface()\n")));
       
    84 	EAP_TRACE_RETURN_STRING(m_am_tools, "returns: CEapSimIsaInterface::~CEapSimIsaInterface()");
    80 
    85 
    81 	if(IsActive())
    86 	if(IsActive())
    82 	{
    87 	{
    83 		Cancel();		
    88 		Cancel();		
    84 	}
    89 	}
    85 	
    90 	
    86 	EAP_TRACE_DEBUG(m_am_tools, TRACE_FLAGS_DEFAULT, (EAPL("Closing RMobilePhone and MMETEL.\n")));
    91 	EAP_TRACE_DEBUG(m_am_tools, TRACE_FLAGS_DEFAULT, (EAPL("Closing RMobilePhone and MMETEL.\n")));
    87 	
    92 	
    88 	iPhone.Close();
    93 	iPhone.Close();
    89 	iServer.Close(); // Phone module is unloaded automatically when RTelServer session is closed
    94 	iServer.Close(); // Phone module is unloaded automatically when RTelServer session is closed
       
    95 	iCustomAPI.Close();	
    90 		
    96 		
    91 	delete iAuthenticationData;
    97 	delete iAuthenticationData;
    92 	iAuthenticationData = NULL;
    98 	iAuthenticationData = NULL;
    93 		
    99 		
    94 	EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
   100 	EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
    97 //--------------------------------------------------
   103 //--------------------------------------------------
    98 
   104 
    99 void CEapSimIsaInterface::QueryIMSIL()
   105 void CEapSimIsaInterface::QueryIMSIL()
   100 {	
   106 {	
   101 	EAP_TRACE_BEGIN(m_am_tools, TRACE_FLAGS_DEFAULT);
   107 	EAP_TRACE_BEGIN(m_am_tools, TRACE_FLAGS_DEFAULT);
   102 	EAP_TRACE_DEBUG(m_am_tools, TRACE_FLAGS_DEFAULT, (EAPL("ISA interface: Querying IMSI.\n")));
   108 	EAP_TRACE_DEBUG(m_am_tools, TRACE_FLAGS_DEFAULT, (EAPL("CEapSimIsaInterface::QueryIMSIL()\n")));
   103 	
   109 	EAP_TRACE_RETURN_STRING(m_am_tools, "returns: CEapSimIsaInterface::QueryIMSIL()");
       
   110 
   104 	iQueryId = EQueryIMSI;
   111 	iQueryId = EQueryIMSI;
   105 
   112 
   106 	// Create MMETEl connection.
   113 	// Create MMETEl connection.
   107 	User::LeaveIfError( CreateMMETelConnectionL() );
   114 	User::LeaveIfError( CreateMMETelConnectionL() );
   108 	
   115 	
   119 //--------------------------------------------------
   126 //--------------------------------------------------
   120 
   127 
   121 void CEapSimIsaInterface::QueryKcAndSRESL(const TDesC8& aRand)
   128 void CEapSimIsaInterface::QueryKcAndSRESL(const TDesC8& aRand)
   122 {
   129 {
   123 	EAP_TRACE_BEGIN(m_am_tools, TRACE_FLAGS_DEFAULT);
   130 	EAP_TRACE_BEGIN(m_am_tools, TRACE_FLAGS_DEFAULT);
   124 	EAP_TRACE_DEBUG(m_am_tools, TRACE_FLAGS_DEFAULT, (EAPL("ISA interface: Querying Kc and SRES.\n")));
   131 	EAP_TRACE_DEBUG(m_am_tools, TRACE_FLAGS_DEFAULT, (EAPL("CEapSimIsaInterface::QueryKcAndSRESL()\n")));
       
   132 	EAP_TRACE_RETURN_STRING(m_am_tools, "returns: CEapSimIsaInterface::QueryKcAndSRESL()");
   125 
   133 
   126 	iQueryId = EQuerySRESandKC;
   134 	iQueryId = EQuerySRESandKC;
   127 
   135 
   128 	EAP_TRACE_DATA_DEBUG(m_am_tools, TRACE_FLAGS_DEFAULT, (EAPL("RAND"),
   136 	EAP_TRACE_DATA_DEBUG(m_am_tools, TRACE_FLAGS_DEFAULT, (EAPL("RAND"),
   129 			aRand.Ptr(),
   137 			aRand.Ptr(),
   160 //--------------------------------------------------
   168 //--------------------------------------------------
   161  
   169  
   162 void CEapSimIsaInterface::DoCancel()
   170 void CEapSimIsaInterface::DoCancel()
   163 {
   171 {
   164 	EAP_TRACE_DEBUG(m_am_tools, TRACE_FLAGS_DEFAULT, (EAPL("CEapSimIsaInterface::DoCancel() - Cancelling MMETEL query.\n") ) );
   172 	EAP_TRACE_DEBUG(m_am_tools, TRACE_FLAGS_DEFAULT, (EAPL("CEapSimIsaInterface::DoCancel() - Cancelling MMETEL query.\n") ) );
   165 	
   173 	EAP_TRACE_RETURN_STRING(m_am_tools, "returns: CEapSimIsaInterface::DoCancel()");
   166 	// Cancel the request.
   174 
   167 	iCustomAPI.CancelAsyncRequest( ECustomGetSimAuthenticationDataIPC );
   175 	if (iQueryId == EQuerySRESandKC)
       
   176 	{
       
   177 		// Cancel the request.
       
   178 		iCustomAPI.CancelAsyncRequest( ECustomGetSimAuthenticationDataIPC );
       
   179 	}
   168 }
   180 }
   169 
   181 
   170 //--------------------------------------------------
   182 //--------------------------------------------------
   171 
   183 
   172 void CEapSimIsaInterface::RunL()
   184 void CEapSimIsaInterface::RunL()
   173 {
   185 {
   174 	EAP_TRACE_BEGIN(m_am_tools, TRACE_FLAGS_DEFAULT);
   186 	EAP_TRACE_BEGIN(m_am_tools, TRACE_FLAGS_DEFAULT);
   175 	EAP_TRACE_DEBUG(m_am_tools, TRACE_FLAGS_DEFAULT, (EAPL("CEapSimIsaInterface::RunL(). iStatus.Int() =%d \n"), iStatus.Int() ));
   187 	EAP_TRACE_DEBUG(m_am_tools, TRACE_FLAGS_DEFAULT, (EAPL("CEapSimIsaInterface::RunL(). iStatus.Int()=%d, iQueryId=%d\n"),
   176 	
   188 		iStatus.Int(),
       
   189 		iQueryId));
       
   190 	EAP_TRACE_RETURN_STRING(m_am_tools, "returns: CEapSimIsaInterface::RunL()");
       
   191 
   177 	TInt error = KErrNone;
   192 	TInt error = KErrNone;
   178 	eap_variable_data_c imsi(m_am_tools); // Keeping it here to avoid "error" in ARMV5 build.
   193 	eap_variable_data_c imsi(m_am_tools); // Keeping it here to avoid "error" in ARMV5 build.
   179 	
   194 	
   180 	// This is to store the IMSI, which is in Unicode form.
   195 	// This is to store the IMSI, which is in Unicode form.
   181 	eap_variable_data_c imsiInUnicode(m_am_tools); // Keeping it here to avoid "error" in ARMV5 build.
   196 	eap_variable_data_c imsiInUnicode(m_am_tools); // Keeping it here to avoid "error" in ARMV5 build.
   284 }
   299 }
   285 
   300 
   286 TInt CEapSimIsaInterface::CreateMMETelConnectionL()
   301 TInt CEapSimIsaInterface::CreateMMETelConnectionL()
   287 {
   302 {
   288 	EAP_TRACE_BEGIN(m_am_tools, TRACE_FLAGS_DEFAULT);
   303 	EAP_TRACE_BEGIN(m_am_tools, TRACE_FLAGS_DEFAULT);
   289 	EAP_TRACE_DEBUG(m_am_tools, TRACE_FLAGS_DEFAULT, (EAPL("Creating MMETel connection.\n")));
   304 	EAP_TRACE_DEBUG(m_am_tools, TRACE_FLAGS_DEFAULT, (EAPL("CEapSimIsaInterface::CreateMMETelConnectionL()\n")));
       
   305 	EAP_TRACE_RETURN_STRING(m_am_tools, "returns: CEapSimIsaInterface::CreateMMETelConnectionL()");
   290 
   306 
   291 	TInt errorCode = KErrNone;
   307 	TInt errorCode = KErrNone;
   292 	
   308 	
   293 	// MMETel need to be connected only once.    
   309 	// MMETel need to be connected only once.    
   294     if( !iMMETELConnectionStatus )
   310     if( !iMMETELConnectionStatus )