eapol/eapol_framework/eapol_symbian/am/common/symbian/eap_am_tools_symbian.cpp
branchRCL_3
changeset 18 bad0cc58d154
parent 2 1c7bc153c08e
child 19 c74b3d9f6b9e
equal deleted inserted replaced
17:30e048a7b597 18:bad0cc58d154
     1 /*
     1 /*
     2 * Copyright (c) 2001-2006 Nokia Corporation and/or its subsidiary(-ies).
     2 * Copyright (c) 2001-2010 Nokia Corporation and/or its subsidiary(-ies).
     3 * All rights reserved.
     3 * All rights reserved.
     4 * This component and the accompanying materials are made available
     4 * This component and the accompanying materials are made available
     5 * under the terms of the License "Eclipse Public License v1.0"
     5 * under the terms of the License "Eclipse Public License v1.0"
     6 * which accompanies this distribution, and is available
     6 * which accompanies this distribution, and is available
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
     9 * Initial Contributors:
     9 * Initial Contributors:
    10 * Nokia Corporation - initial contribution.
    10 * Nokia Corporation - initial contribution.
    11 *
    11 *
    12 * Contributors:
    12 * Contributors:
    13 *
    13 *
    14 * Description:  EAP and WLAN authentication protocols.
    14 * Description:  Tools for common code to run on Symbian.
    15 *
    15 *
    16 */
    16 */
    17 
    17 
    18 /*
    18 /*
    19 * %version: 22.1.3 %
    19 * %version: 36 %
    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
    26 	#undef EAP_FILE_NUMBER_DATE 
    26 	#undef EAP_FILE_NUMBER_DATE 
    27 	#define EAP_FILE_NUMBER_DATE 1127594498 
    27 	#define EAP_FILE_NUMBER_DATE 1127594498 
    28 #endif //#if defined(USE_EAP_MINIMUM_RELEASE_TRACES)
    28 #endif //#if defined(USE_EAP_MINIMUM_RELEASE_TRACES)
    29 
    29 
    30 
    30 
       
    31 #include <e32math.h>
       
    32 #include <utf.h>
    31 
    33 
    32 #include "eap_am_tools_symbian.h"
    34 #include "eap_am_tools_symbian.h"
    33 #include "eap_am_types.h"
    35 #include "eap_am_types.h"
    34 #include <e32math.h>
    36 #include "eap_automatic_variable.h"
    35 #include <utf.h>
    37 #include "EapTraceSymbian.h"
    36 
    38 
    37 const TUint MAX_DB_TRANSACTION_RETRY_COUNT = 10;
    39 const TUint MAX_DB_TRANSACTION_RETRY_COUNT = 10;
    38 const u32_t EAP_TIMER_MAX_AFTER_TIME_MILLISECONDS_SYMBIAN = 2100000ul;
    40 const u32_t EAP_TIMER_MAX_AFTER_TIME_MILLISECONDS_SYMBIAN = 2100000ul;
    39 
    41 
    40 //--------------------------------------------------
    42 //--------------------------------------------------
    45 
    47 
    46 //--------------------------------------------------
    48 //--------------------------------------------------
    47 
    49 
    48 EAP_FUNC_EXPORT eap_am_tools_symbian_c::~eap_am_tools_symbian_c()
    50 EAP_FUNC_EXPORT eap_am_tools_symbian_c::~eap_am_tools_symbian_c()
    49 {
    51 {
       
    52     EAP_TRACE_DEBUG_SYMBIAN((_L("eap_am_tools_symbian_c::~eap_am_tools_symbian_c(): this=0x%08x"),
       
    53 		this));
       
    54 
       
    55 	EAP_TRACE_RETURN_STRING_SYMBIAN(_L("returns: eap_am_tools_symbian_c::~eap_am_tools_symbian_c()"));
       
    56 
    50 	// If multithreading is used the log file is not kept open all the time
    57 	// If multithreading is used the log file is not kept open all the time
    51 	// so no need to close the handles here.
    58 	// so no need to close the handles here.
    52 #if defined(USE_EAP_FILE_TRACE)
    59 #if defined(USE_EAP_FILE_TRACE)
    53 #if !defined (USE_MULTITHREADING)
    60 #if !defined (USE_MULTITHREADING)
    54 	m_LogFile.Close();
    61 	m_LogFile.Close();
    61 
    68 
    62 //
    69 //
    63 EAP_FUNC_EXPORT eap_am_tools_symbian_c::eap_am_tools_symbian_c(eap_const_string /*pfilename*/)
    70 EAP_FUNC_EXPORT eap_am_tools_symbian_c::eap_am_tools_symbian_c(eap_const_string /*pfilename*/)
    64 	: eap_am_tools_c()
    71 	: eap_am_tools_c()
    65 	, CTimer(CTimer::EPriorityStandard)
    72 	, CTimer(CTimer::EPriorityStandard)
       
    73 	, m_prefix_string(this)
    66 	, m_start_ticks(0)
    74 	, m_start_ticks(0)
    67 	, m_directory_exists(false)
    75 	, m_directory_exists(false)
    68 	, m_crypto(this)
    76 	, m_crypto(this)
    69 	, m_timer_queue(this, EAP_TIMER_RESOLUTION)
    77 	, m_timer_queue(this, EAP_TIMER_RESOLUTION)
    70 	, m_run_thread(true)
    78 	, m_run_thread(true)
    77 {
    85 {
    78 	EAP_TRACE_BEGIN(this, TRACE_FLAGS_DEFAULT);
    86 	EAP_TRACE_BEGIN(this, TRACE_FLAGS_DEFAULT);
    79 
    87 
    80 #if defined(USE_EAP_HARDWARE_TRACE)
    88 #if defined(USE_EAP_HARDWARE_TRACE)
    81 	set_trace_mask(
    89 	set_trace_mask(
    82 		eap_am_tools_c::eap_trace_mask_always
    90 		TRACE_FLAGS_ALWAYS
    83 		| eap_am_tools_c::eap_trace_mask_error
    91 		| TRACE_FLAGS_ERROR
    84 		| eap_am_tools_c::eap_trace_mask_debug
    92 		| eap_am_tools_c::eap_trace_mask_debug
    85 		| eap_am_tools_c::eap_trace_mask_message_data);
    93 		| EAP_TRACE_FLAGS_MESSAGE_DATA
       
    94 		| TRACE_FLAGS_TIMER
       
    95 		| TRACE_FLAGS_TIMER_QUEUE);
    86 #endif //#if defined(USE_EAP_HARDWARE_TRACE)
    96 #endif //#if defined(USE_EAP_HARDWARE_TRACE)
       
    97 
       
    98 	const u8_t DEFAULT_PREFIX[] = "EAPOL";
       
    99 
       
   100 	eap_status_e status = m_prefix_string.set_copy_of_buffer(DEFAULT_PREFIX, sizeof(DEFAULT_PREFIX)-1ul);;
       
   101 	if (status != eap_status_ok)
       
   102 	{
       
   103 		EAP_TRACE_END(this, TRACE_FLAGS_DEFAULT);
       
   104 		(void)EAP_STATUS_RETURN(this, status);
       
   105 		return;
       
   106 	}
       
   107 
       
   108 	status = m_prefix_string.add_end_null();
       
   109 	if (status != eap_status_ok)
       
   110 	{
       
   111 		EAP_TRACE_END(this, TRACE_FLAGS_DEFAULT);
       
   112 		(void)EAP_STATUS_RETURN(this, status);
       
   113 		return;
       
   114 	}
    87 
   115 
    88 	EAP_TRACE_DEBUG(
   116 	EAP_TRACE_DEBUG(
    89 		this,
   117 		this,
    90 		TRACE_FLAGS_DEFAULT,
   118 		TRACE_FLAGS_DEFAULT,
    91 		(EAPL("eap_am_tools_symbian_c::eap_am_tools_symbian_c()\n")));
   119 		(EAPL("eap_am_tools_symbian_c::eap_am_tools_symbian_c(): this = 0x%08x => 0x%08x\n"),
       
   120 		 this,
       
   121 		 dynamic_cast<abs_eap_base_timer_c *>(this)));
       
   122 
       
   123 	EAP_TRACE_RETURN_STRING(this, "returns: eap_am_tools_symbian_c::eap_am_tools_symbian_c()");
    92 
   124 
    93 	if (m_crypto.get_is_valid() == false)
   125 	if (m_crypto.get_is_valid() == false)
    94 	{
   126 	{
    95 		EAP_TRACE_ERROR(
   127 		EAP_TRACE_ERROR(
    96 			this,
   128 			this,
   158 	EAP_TRACE_DEBUG(
   190 	EAP_TRACE_DEBUG(
   159 		this,
   191 		this,
   160 		TRACE_FLAGS_DEFAULT,
   192 		TRACE_FLAGS_DEFAULT,
   161 		(EAPL("eap_am_tools_symbian_c::configure()\n")));
   193 		(EAPL("eap_am_tools_symbian_c::configure()\n")));
   162 
   194 
       
   195 	EAP_TRACE_RETURN_STRING(this, "returns: eap_am_tools_symbian_c::configure()");
       
   196 
   163 	if (m_configure_called == true)
   197 	if (m_configure_called == true)
   164 	{
   198 	{
   165 		return EAP_STATUS_RETURN(this, eap_status_ok);
   199 		return EAP_STATUS_RETURN(this, eap_status_ok);
   166 	}
   200 	}
   167 
   201 
   168 #if defined(USE_EAP_HARDWARE_TRACE)
   202 #if defined(USE_EAP_HARDWARE_TRACE)
   169 	set_trace_mask(
   203 	set_trace_mask(
   170 		eap_am_tools_c::eap_trace_mask_always
   204 		TRACE_FLAGS_ALWAYS
   171 		| eap_am_tools_c::eap_trace_mask_error
   205 		| TRACE_FLAGS_ERROR
   172 		| eap_am_tools_c::eap_trace_mask_debug
   206 		| eap_am_tools_c::eap_trace_mask_debug
   173 		| eap_am_tools_c::eap_trace_mask_message_data);
   207 		| EAP_TRACE_FLAGS_MESSAGE_DATA
       
   208 		| TRACE_FLAGS_TIMER
       
   209 		| TRACE_FLAGS_TIMER_QUEUE);
   174 #endif //#if defined(USE_EAP_HARDWARE_TRACE)
   210 #endif //#if defined(USE_EAP_HARDWARE_TRACE)
   175 
   211 
   176 	m_start_ticks = get_clock_ticks();
   212 	m_start_ticks = get_clock_ticks();
   177 	iLastTime = m_start_ticks;
   213 	iLastTime = m_start_ticks;
   178 
   214 
   377 			TInt64 _minutes = _seconds / _div_60;
   413 			TInt64 _minutes = _seconds / _div_60;
   378 			_seconds = _seconds - _minutes * _div_60;
   414 			_seconds = _seconds - _minutes * _div_60;
   379 			TInt64 _hours = _minutes / _div_60;
   415 			TInt64 _hours = _minutes / _div_60;
   380 			_minutes = _minutes - _hours* _div_60;
   416 			_minutes = _minutes - _hours* _div_60;
   381 
   417 
   382 			_LIT8(KFormat1, "%02d:%02d:%02d.%06d:EAPOL:");
   418 			_LIT8(KFormat1, "%02d:%02d:%02d.%06d:%s:");
   383 
   419 
   384 			m_trace_buf.Format(
   420 			m_trace_buf.Format(
   385 				KFormat1,
   421 				KFormat1,
   386 				static_cast<TInt32>(_hours),
   422 				static_cast<TInt32>(_hours),
   387 				static_cast<TInt32>(_minutes),
   423 				static_cast<TInt32>(_minutes),
   388 				static_cast<TInt32>(_seconds),
   424 				static_cast<TInt32>(_seconds),
   389 				static_cast<TInt32>(_micro_seconds));				
   425 				static_cast<TInt32>(_micro_seconds),
       
   426 				m_prefix_string.get_data());
   390 		}
   427 		}
   391 
   428 
   392 	}
   429 	}
   393 	else
   430 	else
   394 	{
   431 	{
   395 		_LIT8(KFormat2, "%08x%08x:EAPOL:");
   432 		_LIT8(KFormat2, "%08x%08x:%s:");
   396 
   433 
   397 		u32_t *time_stamp_u32_t = reinterpret_cast<u32_t *>(&time_stamp);
   434 		u32_t *time_stamp_u32_t = reinterpret_cast<u32_t *>(&time_stamp);
   398 		m_trace_buf.Format(KFormat2, time_stamp_u32_t[1], time_stamp_u32_t[0]);		
   435 		m_trace_buf.Format(
       
   436 			KFormat2,
       
   437 			time_stamp_u32_t[1],
       
   438 			time_stamp_u32_t[0],
       
   439 			m_prefix_string.get_data());
   399 	}
   440 	}
   400 
   441 
   401 	VA_LIST args = {0,};
   442 	VA_LIST args = {0,};
   402 	VA_START(args, format);
   443 	VA_START(args, format);
   403 	m_format_buf.Copy((const TUint8 *)format);
   444 	m_format_buf.Copy((const TUint8 *)format);
   442 
   483 
   443 
   484 
   444 #if defined(USE_EAP_FILE_TRACE)
   485 #if defined(USE_EAP_FILE_TRACE)
   445 
   486 
   446 	#if defined (USE_MULTITHREADING)
   487 	#if defined (USE_MULTITHREADING)
       
   488 		RFs session;
       
   489 
   447 		if (m_filename.Length() > 0ul)
   490 		if (m_filename.Length() > 0ul)
   448 		{
   491 		{
   449 			RFs session;
       
   450 			
       
   451 			TInt result = session.Connect();	
   492 			TInt result = session.Connect();	
   452 			if (result != KErrNone)
   493 			if (result != KErrNone)
   453 			{
   494 			{
   454 				leave_trace_mutex();
   495 				leave_trace_mutex();
   455 				EAP_TRACE_END(this, TRACE_FLAGS_DEFAULT);
   496 				EAP_TRACE_END(this, TRACE_FLAGS_DEFAULT);
   515 EAP_FUNC_EXPORT bool eap_am_tools_symbian_c::get_is_timer_thread_active()
   556 EAP_FUNC_EXPORT bool eap_am_tools_symbian_c::get_is_timer_thread_active()
   516 {
   557 {
   517 	return m_run_thread;
   558 	return m_run_thread;
   518 }
   559 }
   519 
   560 
       
   561 //--------------------------------------------------
       
   562 
       
   563 //
       
   564 EAP_FUNC_EXPORT eap_status_e eap_am_tools_symbian_c::set_trace_prefix(
       
   565 	const eap_variable_data_c * const prefix8bit)
       
   566 {
       
   567 	EAP_TRACE_BEGIN(this, TRACE_FLAGS_DEFAULT);
       
   568 
       
   569 	enter_trace_mutex();
       
   570 
       
   571 	eap_status_e status = m_prefix_string.set_copy_of_buffer(prefix8bit);
       
   572 	if (status != eap_status_ok)
       
   573 	{
       
   574 		EAP_TRACE_END(this, TRACE_FLAGS_DEFAULT);
       
   575 		return EAP_STATUS_RETURN(this, status);
       
   576 	}
       
   577 
       
   578 	status = m_prefix_string.add_end_null();
       
   579 	if (status != eap_status_ok)
       
   580 	{
       
   581 		EAP_TRACE_END(this, TRACE_FLAGS_DEFAULT);
       
   582 		return EAP_STATUS_RETURN(this, status);
       
   583 	}
       
   584 
       
   585 	leave_trace_mutex();
       
   586 
       
   587 	EAP_TRACE_END(this, TRACE_FLAGS_DEFAULT);
       
   588 	return eap_status_ok;
       
   589 }
   520 
   590 
   521 //--------------------------------------------------
   591 //--------------------------------------------------
   522 
   592 
   523 //
   593 //
   524 EAP_FUNC_EXPORT eap_status_e eap_am_tools_symbian_c::set_trace_file_name(
   594 EAP_FUNC_EXPORT eap_status_e eap_am_tools_symbian_c::set_trace_file_name(
   525 	const eap_variable_data_c * const trace_output_file)
   595 	const eap_variable_data_c * const trace_output_file)
   526 {
   596 {
       
   597 	EAP_TRACE_DEBUG(
       
   598 		this,
       
   599 		TRACE_FLAGS_DEFAULT,
       
   600 		(EAPL("eap_am_tools_symbian_c::set_trace_file_name()")));
       
   601 
       
   602 	EAP_TRACE_RETURN_STRING(this, "returns: eap_am_tools_symbian_c::set_trace_file_name()");
       
   603 
   527 	EAP_TRACE_BEGIN(this, TRACE_FLAGS_DEFAULT);
   604 	EAP_TRACE_BEGIN(this, TRACE_FLAGS_DEFAULT);
   528 
   605 
   529 	EAP_UNREFERENCED_PARAMETER(trace_output_file);
   606 	EAP_UNREFERENCED_PARAMETER(trace_output_file);
   530 	
   607 	
   531 #if defined(USE_EAP_FILE_TRACE)
   608 #if defined(USE_EAP_FILE_TRACE)
   532 #if defined(USE_EAP_TRACE) || defined(USE_EAP_TRACE_ALWAYS)
   609 #if defined(USE_EAP_TRACE) || defined(USE_EAP_TRACE_ALWAYS)
       
   610 
   533 	TBuf8<64> tmpFilename((TUint8 *)trace_output_file->get_data(trace_output_file->get_data_length()));
   611 	TBuf8<64> tmpFilename((TUint8 *)trace_output_file->get_data(trace_output_file->get_data_length()));
   534 	tmpFilename.SetLength(trace_output_file->get_data_length());
   612 	tmpFilename.SetLength(trace_output_file->get_data_length());
       
   613 
   535 	enter_trace_mutex();
   614 	enter_trace_mutex();
   536 
   615 
   537 	m_filename.Copy(tmpFilename);
   616 	m_filename.Copy(tmpFilename);
   538 
   617 
   539 #if defined (USE_MULTITHREADING)
   618 #if defined (USE_MULTITHREADING)
   762 //--------------------------------------------------
   841 //--------------------------------------------------
   763 
   842 
   764 //
   843 //
   765 EAP_FUNC_EXPORT u64_t eap_am_tools_symbian_c::get_clock_ticks_of_second()
   844 EAP_FUNC_EXPORT u64_t eap_am_tools_symbian_c::get_clock_ticks_of_second()
   766 {
   845 {
   767 	return 1000000u;
   846 	const u64_t COUNT_OF_CLOCK_TICS_IN_ONE_SECOND = 1000000ul;
       
   847 	return COUNT_OF_CLOCK_TICS_IN_ONE_SECOND;
   768 }
   848 }
   769 
   849 
   770 //--------------------------------------------------
   850 //--------------------------------------------------
   771 
   851 
   772 /**
   852 /**
   903 EAP_FUNC_EXPORT void eap_am_tools_symbian_c::enter_crypto_cs()
   983 EAP_FUNC_EXPORT void eap_am_tools_symbian_c::enter_crypto_cs()
   904 {
   984 {
   905 
   985 
   906 }
   986 }
   907 
   987 
       
   988 //--------------------------------------------------
       
   989 
   908 EAP_FUNC_EXPORT void eap_am_tools_symbian_c::leave_crypto_cs()
   990 EAP_FUNC_EXPORT void eap_am_tools_symbian_c::leave_crypto_cs()
   909 {
   991 {
   910 
   992 
   911 }
   993 }
   912 
   994 
   919 
  1001 
   920 //--------------------------------------------------
  1002 //--------------------------------------------------
   921 
  1003 
   922 EAP_FUNC_EXPORT void eap_am_tools_symbian_c::sleep(u32_t milli_seconds)
  1004 EAP_FUNC_EXPORT void eap_am_tools_symbian_c::sleep(u32_t milli_seconds)
   923 {
  1005 {
   924 	User::After(limit_microsecond_timeout(milli_seconds));
  1006 	After(limit_microsecond_timeout(milli_seconds));
   925 }
  1007 }
   926 
  1008 
   927 //--------------------------------------------------
  1009 //--------------------------------------------------
       
  1010 
   928 EAP_FUNC_EXPORT u32_t eap_am_tools_symbian_c::get_gmt_unix_time()
  1011 EAP_FUNC_EXPORT u32_t eap_am_tools_symbian_c::get_gmt_unix_time()
   929 {
  1012 {
   930 	_LIT(KStart, "19700000:000000.000000");
  1013 	_LIT(KStart, "19700000:000000.000000");
   931 	TTime start(KStart);
  1014 	TTime start(KStart);
   932 	TTime now;
  1015 	TTime now;
   933 	now.UniversalTime();
  1016 	now.UniversalTime();
   934 	TTimeIntervalSeconds interval;
  1017 	TTimeIntervalSeconds interval;
   935 	now.SecondsFrom(start, interval);
  1018 	now.SecondsFrom(start, interval);
   936 	return interval.Int();
  1019 	return interval.Int();
   937 }
  1020 }
       
  1021 
   938 //--------------------------------------------------
  1022 //--------------------------------------------------
   939 
  1023 
   940 EAP_FUNC_EXPORT bool eap_am_tools_symbian_c::get_is_valid() const
  1024 EAP_FUNC_EXPORT bool eap_am_tools_symbian_c::get_is_valid() const
   941 {
  1025 {
   942 	return m_is_valid;
  1026 	return m_is_valid;
   947 EAP_FUNC_EXPORT eap_status_e eap_am_tools_symbian_c::convert_am_error_to_eapol_error(const i32_t aErr)
  1031 EAP_FUNC_EXPORT eap_status_e eap_am_tools_symbian_c::convert_am_error_to_eapol_error(const i32_t aErr)
   948 {
  1032 {
   949 	EAP_TRACE_DEBUG(
  1033 	EAP_TRACE_DEBUG(
   950 		this,
  1034 		this,
   951 		TRACE_FLAGS_DEFAULT,
  1035 		TRACE_FLAGS_DEFAULT,
   952 		(EAPL("eap_am_tools_symbian_c::convert_am_error_to_eapol_error: error=%d\n"),
  1036 		(EAPL("eap_status_e eap_am_tools_symbian_c::convert_am_error_to_eapol_error(): error=%d\n"),
   953 		aErr));
  1037 		aErr));
   954 
  1038 
   955 	eap_status_e status;
  1039 	eap_status_e status;
   956 	switch (aErr)
  1040 	switch (aErr)
   957 	{
  1041 	{
  1023 		break;		
  1107 		break;		
  1024 	}
  1108 	}
  1025 	return status;
  1109 	return status;
  1026 }
  1110 }
  1027 
  1111 
       
  1112 //--------------------------------------------------
       
  1113 
  1028 EAP_FUNC_EXPORT i32_t eap_am_tools_symbian_c::convert_eapol_error_to_am_error(eap_status_e aErr)
  1114 EAP_FUNC_EXPORT i32_t eap_am_tools_symbian_c::convert_eapol_error_to_am_error(eap_status_e aErr)
  1029 {
  1115 {
  1030 	EAP_TRACE_DEBUG(
  1116 	EAP_TRACE_DEBUG(
  1031 		this,
  1117 		this,
  1032 		TRACE_FLAGS_DEFAULT,
  1118 		TRACE_FLAGS_DEFAULT,
  1033 		(EAPL("eap_am_tools_symbian_c::convert_am_error_to_eapol_error: error=%d\n"),
  1119 		(EAPL("eap_am_tools_symbian_c::convert_eapol_error_to_am_error(): error=%d\n"),
  1034 		aErr));
  1120 		aErr));
  1035 
  1121 
  1036 	TInt status;
  1122 	TInt status;
  1037 	switch (aErr)
  1123 	switch (aErr)
  1038 	{
  1124 	{
  1056 
  1142 
  1057 	case eap_status_pending_request:
  1143 	case eap_status_pending_request:
  1058 		status = KErrCompletion;
  1144 		status = KErrCompletion;
  1059 		break;
  1145 		break;
  1060 
  1146 
       
  1147 	case eap_status_not_found:
  1061 	case eap_status_illegal_configure_field:
  1148 	case eap_status_illegal_configure_field:
  1062 		status = KErrNotFound;
  1149 		status = KErrNotFound;
  1063 		break;
  1150 		break;
  1064 
  1151 
  1065 	case eap_status_completed_request:
  1152 	case eap_status_completed_request:
  1155 		retries++;
  1242 		retries++;
  1156 		randomWait = Math::Rand(seed);
  1243 		randomWait = Math::Rand(seed);
  1157 		
  1244 		
  1158 		// Wait 0 - 524287 microseconds
  1245 		// Wait 0 - 524287 microseconds
  1159 		randomWait = randomWait & 0x7ffff;
  1246 		randomWait = randomWait & 0x7ffff;
  1160 		User::After(randomWait);
  1247 		After(randomWait);
  1161 	}
  1248 	}
  1162 	return EAP_STATUS_RETURN(this, status);
  1249 	return EAP_STATUS_RETURN(this, status);
  1163 }
  1250 }
  1164 
  1251 
  1165 //--------------------------------------------------
  1252 //--------------------------------------------------
  1190 		retries++;
  1277 		retries++;
  1191 		randomWait = Math::Rand(seed);
  1278 		randomWait = Math::Rand(seed);
  1192 		
  1279 		
  1193 		// Wait 0 - 524287 microseconds
  1280 		// Wait 0 - 524287 microseconds
  1194 		randomWait = randomWait & 0x7ffff;
  1281 		randomWait = randomWait & 0x7ffff;
  1195 		User::After(randomWait);
  1282 		After(randomWait);
  1196 	}
  1283 	}
  1197 	return EAP_STATUS_RETURN(this, status);
  1284 	return EAP_STATUS_RETURN(this, status);
  1198 }
  1285 }
  1199 
  1286 
  1200 //--------------------------------------------------
  1287 //--------------------------------------------------
  1225 		retries++;
  1312 		retries++;
  1226 		randomWait = Math::Rand(seed);
  1313 		randomWait = Math::Rand(seed);
  1227 		
  1314 		
  1228 		// Wait 0 - 524287 microseconds
  1315 		// Wait 0 - 524287 microseconds
  1229 		randomWait = randomWait & 0x7ffff;
  1316 		randomWait = randomWait & 0x7ffff;
  1230 		User::After(randomWait);
  1317 		After(randomWait);
  1231 	}
  1318 	}
  1232 	return EAP_STATUS_RETURN(this, status);
  1319 	return EAP_STATUS_RETURN(this, status);
  1233 }
  1320 }
  1234 
  1321 
  1235 //--------------------------------------------------
  1322 //--------------------------------------------------
  1241 		this, 
  1328 		this, 
  1242 		TRACE_FLAGS_DEFAULT, 
  1329 		TRACE_FLAGS_DEFAULT, 
  1243 		(EAPL("eap_am_tools_symbian_c::shutdown(): this = 0x%08x => 0x%08x, "),
  1330 		(EAPL("eap_am_tools_symbian_c::shutdown(): this = 0x%08x => 0x%08x, "),
  1244 		 this,
  1331 		 this,
  1245 		 dynamic_cast<abs_eap_base_timer_c *>(this)));
  1332 		 dynamic_cast<abs_eap_base_timer_c *>(this)));
       
  1333 
       
  1334 	// Note, tools cannot be used to trace on return.
       
  1335 	EAP_TRACE_RETURN_STRING_SYMBIAN(_L("returns: eap_am_tools_symbian_c::shutdown()"));
  1246 
  1336 
  1247 	StopTimer();
  1337 	StopTimer();
  1248 	
  1338 	
  1249 	return eap_am_tools_c::shutdown_am_tools();
  1339 	return eap_am_tools_c::shutdown_am_tools();
  1250 }
  1340 }
  1491 //--------------------------------------------------
  1581 //--------------------------------------------------
  1492 //--------------------------------------------------
  1582 //--------------------------------------------------
  1493 
  1583 
  1494 EAP_FUNC_EXPORT_INTERFACE abs_eap_am_tools_c * abs_eap_am_tools_c::new_abs_eap_am_tools_c()
  1584 EAP_FUNC_EXPORT_INTERFACE abs_eap_am_tools_c * abs_eap_am_tools_c::new_abs_eap_am_tools_c()
  1495 {
  1585 {
       
  1586     EAP_TRACE_DEBUG_SYMBIAN((_L("abs_eap_am_tools_c::new_abs_eap_am_tools_c()")));
       
  1587 
       
  1588 	EAP_TRACE_RETURN_STRING_SYMBIAN(_L("returns: abs_eap_am_tools_c::new_abs_eap_am_tools_c()"));
       
  1589 
  1496 	abs_eap_am_tools_c *am_tools = new eap_am_tools_symbian_c(EAP_DEFAULT_TRACE_FILE);
  1590 	abs_eap_am_tools_c *am_tools = new eap_am_tools_symbian_c(EAP_DEFAULT_TRACE_FILE);
  1497 
  1591 
  1498 	if (am_tools != 0)
  1592 	if (am_tools != 0)
  1499 	{
  1593 	{
  1500 		eap_status_e status = am_tools->configure();
  1594 		eap_status_e status = am_tools->configure();
  1507 		else
  1601 		else
  1508 		{
  1602 		{
  1509 			EAP_TRACE_DEBUG(
  1603 			EAP_TRACE_DEBUG(
  1510 				am_tools,
  1604 				am_tools,
  1511 				TRACE_FLAGS_TIMER,
  1605 				TRACE_FLAGS_TIMER,
  1512 				(EAPL("abs_eap_am_tools_c::new_abs_eap_am_tools_c() => 0x%08x success\n"),
  1606 				(EAPL("abs_eap_am_tools_c::new_abs_eap_am_tools_c(0x%08x): success\n"),
  1513 				am_tools));
  1607 				am_tools));
  1514 		}
  1608 		}
  1515 	}
  1609 	}
  1516 
  1610 
  1517 	return am_tools;
  1611 	return am_tools;
  1519 
  1613 
  1520 //--------------------------------------------------
  1614 //--------------------------------------------------
  1521 
  1615 
  1522 EAP_FUNC_EXPORT_INTERFACE void abs_eap_am_tools_c::delete_abs_eap_am_tools_c(abs_eap_am_tools_c * const am_tools)
  1616 EAP_FUNC_EXPORT_INTERFACE void abs_eap_am_tools_c::delete_abs_eap_am_tools_c(abs_eap_am_tools_c * const am_tools)
  1523 {
  1617 {
  1524 	EAP_TRACE_DEBUG(
  1618     EAP_TRACE_DEBUG_SYMBIAN((_L("abs_eap_am_tools_c::delete_abs_eap_am_tools_c()")));
  1525 		am_tools,
  1619 
  1526 		TRACE_FLAGS_TIMER,
  1620 	EAP_TRACE_RETURN_STRING_SYMBIAN(_L("returns: abs_eap_am_tools_c::delete_abs_eap_am_tools_c()"));
  1527 		(EAPL("abs_eap_am_tools_c::delete_abs_eap_am_tools_c(0x%08x)\n"),
  1621 
  1528 		am_tools));
  1622 	if (am_tools != 0)
  1529 
  1623 		{
  1530 	(void)am_tools->shutdown();
  1624 		EAP_TRACE_DEBUG(
  1531 
  1625 			am_tools,
  1532 	delete am_tools;
  1626 			TRACE_FLAGS_TIMER,
       
  1627 			(EAPL("abs_eap_am_tools_c::delete_abs_eap_am_tools_c(0x%08x)\n"),
       
  1628 			am_tools));
       
  1629 	
       
  1630 		(void)am_tools->shutdown();
       
  1631 	
       
  1632 		delete am_tools;
       
  1633 		}
  1533 }
  1634 }
  1534 
  1635 
  1535 //--------------------------------------------------
  1636 //--------------------------------------------------
  1536 //--------------------------------------------------
  1637 //--------------------------------------------------
  1537 //--------------------------------------------------
  1638 //--------------------------------------------------