eapol/eapol_framework/eapol_common/core/eap_plugin_client_message_if.cpp
changeset 49 43351a4f2da3
parent 34 ad1f037f1ac2
equal deleted inserted replaced
47:712b4ffd76bb 49:43351a4f2da3
    14 * Description:  EAP-plugin interface message class.
    14 * Description:  EAP-plugin interface message class.
    15 *
    15 *
    16 */
    16 */
    17 
    17 
    18 /*
    18 /*
    19 * %version: 9 %
    19 * %version: 12 %
    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
    76 		return;
    76 		return;
    77 	}
    77 	}
    78 
    78 
    79 	EAP_TRACE_DEBUG(
    79 	EAP_TRACE_DEBUG(
    80 		m_am_tools, 
    80 		m_am_tools, 
    81 		EAP_TRACE_FLAGS_MESSAGE_DATA, 
    81 		TRACE_FLAGS_DEFAULT, 
    82 		(EAPL("eap_plugin_client_message_if_c::eap_plugin_client_message_if_c(): this = 0x%08x.\n"),
    82 		(EAPL("eap_plugin_client_message_if_c::eap_plugin_client_message_if_c(): this = 0x%08x.\n"),
    83 		this));
    83 		this));
    84 
    84 
    85 	EAP_TRACE_RETURN_STRING_FLAGS(m_am_tools, EAP_TRACE_FLAGS_MESSAGE_DATA, "returns: eap_plugin_client_message_if_c::eap_plugin_client_message_if_c()");
    85 	EAP_TRACE_RETURN_STRING_FLAGS(m_am_tools, TRACE_FLAGS_DEFAULT, "returns: eap_plugin_client_message_if_c::eap_plugin_client_message_if_c()");
    86 
    86 
    87 	m_is_valid = true;
    87 	m_is_valid = true;
    88 }
    88 }
    89 
    89 
    90 //--------------------------------------------------
    90 //--------------------------------------------------
   106 // This is documented in abs_eap_stack_interface_c::configure().
   106 // This is documented in abs_eap_stack_interface_c::configure().
   107 EAP_FUNC_EXPORT eap_status_e eap_plugin_client_message_if_c::configure()
   107 EAP_FUNC_EXPORT eap_status_e eap_plugin_client_message_if_c::configure()
   108 {
   108 {
   109 	EAP_TRACE_DEBUG(
   109 	EAP_TRACE_DEBUG(
   110 		m_am_tools, 
   110 		m_am_tools, 
   111 		EAP_TRACE_FLAGS_MESSAGE_DATA, 
   111 		TRACE_FLAGS_DEFAULT, 
   112 		(EAPL("eap_plugin_client_message_if_c::configure(): this = 0x%08x.\n"),
   112 		(EAPL("eap_plugin_client_message_if_c::configure(): this = 0x%08x.\n"),
   113 		this));
   113 		this));
   114 
   114 
   115 	EAP_TRACE_RETURN_STRING_FLAGS(m_am_tools, EAP_TRACE_FLAGS_MESSAGE_DATA, "returns: eap_plugin_client_message_if_c::configure()");
   115 	EAP_TRACE_RETURN_STRING_FLAGS(m_am_tools, TRACE_FLAGS_DEFAULT, "returns: eap_plugin_client_message_if_c::configure()");
   116 
   116 
   117 	eap_status_e status = m_client_if->configure(0);
   117 	eap_status_e status = m_client_if->configure(0);
   118 
   118 
   119 	return EAP_STATUS_RETURN(m_am_tools, status);
   119 	return EAP_STATUS_RETURN(m_am_tools, status);
   120 }
   120 }
   124 // This is documented in abs_eap_stack_interface_c::shutdown().
   124 // This is documented in abs_eap_stack_interface_c::shutdown().
   125 EAP_FUNC_EXPORT eap_status_e eap_plugin_client_message_if_c::shutdown()
   125 EAP_FUNC_EXPORT eap_status_e eap_plugin_client_message_if_c::shutdown()
   126 {
   126 {
   127 	EAP_TRACE_DEBUG(
   127 	EAP_TRACE_DEBUG(
   128 		m_am_tools, 
   128 		m_am_tools, 
   129 		EAP_TRACE_FLAGS_MESSAGE_DATA, 
   129 		TRACE_FLAGS_DEFAULT, 
   130 		(EAPL("eap_plugin_client_message_if_c::shutdown(): this = 0x%08x.\n"),
   130 		(EAPL("eap_plugin_client_message_if_c::shutdown(): this = 0x%08x.\n"),
   131 		this));
   131 		this));
   132 
   132 
   133 	EAP_TRACE_RETURN_STRING_FLAGS(m_am_tools, EAP_TRACE_FLAGS_MESSAGE_DATA, "returns: eap_plugin_client_message_if_c::shutdown()");
   133 	EAP_TRACE_RETURN_STRING_FLAGS(m_am_tools, TRACE_FLAGS_DEFAULT, "returns: eap_plugin_client_message_if_c::shutdown()");
   134 
   134 
   135 	eap_status_e status = m_client_if->shutdown();
   135 	eap_status_e status = m_client_if->shutdown();
   136 
   136 
   137 	return EAP_STATUS_RETURN(m_am_tools, status);
   137 	return EAP_STATUS_RETURN(m_am_tools, status);
   138 }
   138 }
   149 
   149 
   150 EAP_FUNC_EXPORT eap_status_e eap_plugin_client_message_if_c::process_message(eap_process_tlv_message_data_c * const message)
   150 EAP_FUNC_EXPORT eap_status_e eap_plugin_client_message_if_c::process_message(eap_process_tlv_message_data_c * const message)
   151 {
   151 {
   152 	// Process message data composed of Attribute-Value Pairs.
   152 	// Process message data composed of Attribute-Value Pairs.
   153 
   153 
   154 	EAP_TRACE_RETURN_STRING_FLAGS(m_am_tools, EAP_TRACE_FLAGS_MESSAGE_DATA, "returns: eap_plugin_client_message_if_c::process_message()");
   154 	EAP_TRACE_RETURN_STRING_FLAGS(m_am_tools, TRACE_FLAGS_DEFAULT, "returns: eap_plugin_client_message_if_c::process_message()");
   155 
   155 
   156 	EAP_TRACE_DATA_DEBUG(
   156 	EAP_TRACE_DATA_DEBUG(
   157 		m_am_tools,
   157 		m_am_tools,
   158 		EAP_TRACE_FLAGS_MESSAGE_DATA,
   158 		EAP_TRACE_FLAGS_MESSAGE_DATA,
   159 		(EAPL("eap_plugin_client_message_if_c::process_message()"),
   159 		(EAPL("eap_plugin_client_message_if_c::process_message()"),
   176 
   176 
   177 	eap_status_e status(eap_status_process_general_error);
   177 	eap_status_e status(eap_status_process_general_error);
   178 
   178 
   179 	EAP_TRACE_DEBUG(
   179 	EAP_TRACE_DEBUG(
   180 		m_am_tools, 
   180 		m_am_tools, 
   181 		EAP_TRACE_FLAGS_MESSAGE_DATA, 
   181 		TRACE_FLAGS_DEFAULT, 
   182 		(EAPL("eap_plugin_client_message_if_c::get_configuration(): this = 0x%08x.\n"),
   182 		(EAPL("eap_plugin_client_message_if_c::get_configuration(): this = 0x%08x.\n"),
   183 		this));
   183 		this));
   184 
   184 
   185 	EAP_TRACE_RETURN_STRING_FLAGS(m_am_tools, EAP_TRACE_FLAGS_MESSAGE_DATA, "returns: eap_plugin_client_message_if_c::get_configuration()");
   185 	EAP_TRACE_RETURN_STRING_FLAGS(m_am_tools, TRACE_FLAGS_DEFAULT, "returns: eap_plugin_client_message_if_c::get_configuration()");
   186 
   186 
   187 	{
   187 	{
   188 		// Creates message data composed of Attribute-Value Pairs.
   188 		// Creates message data composed of Attribute-Value Pairs.
   189 		eap_process_tlv_message_data_c message(m_am_tools);
   189 		eap_process_tlv_message_data_c message(m_am_tools);
   190 
   190 
   228 
   228 
   229 	eap_status_e status(eap_status_process_general_error);
   229 	eap_status_e status(eap_status_process_general_error);
   230 
   230 
   231 	EAP_TRACE_DEBUG(
   231 	EAP_TRACE_DEBUG(
   232 		m_am_tools, 
   232 		m_am_tools, 
   233 		EAP_TRACE_FLAGS_MESSAGE_DATA, 
   233 		TRACE_FLAGS_DEFAULT, 
   234 		(EAPL("eap_plugin_client_message_if_c::set_configuration(): this = 0x%08x.\n"),
   234 		(EAPL("eap_plugin_client_message_if_c::set_configuration(): this = 0x%08x.\n"),
   235 		this));
   235 		this));
   236 
   236 
   237 	EAP_TRACE_RETURN_STRING_FLAGS(m_am_tools, EAP_TRACE_FLAGS_MESSAGE_DATA, "returns: eap_plugin_client_message_if_c::set_configuration()");
   237 	EAP_TRACE_RETURN_STRING_FLAGS(m_am_tools, TRACE_FLAGS_DEFAULT, "returns: eap_plugin_client_message_if_c::set_configuration()");
   238 
   238 
   239 	{
   239 	{
   240 		// Creates message data composed of Attribute-Value Pairs.
   240 		// Creates message data composed of Attribute-Value Pairs.
   241 		eap_process_tlv_message_data_c message(m_am_tools);
   241 		eap_process_tlv_message_data_c message(m_am_tools);
   242 
   242 
   280 
   280 
   281 	eap_status_e status(eap_status_process_general_error);
   281 	eap_status_e status(eap_status_process_general_error);
   282 
   282 
   283 	EAP_TRACE_DEBUG(
   283 	EAP_TRACE_DEBUG(
   284 		m_am_tools, 
   284 		m_am_tools, 
   285 		EAP_TRACE_FLAGS_MESSAGE_DATA, 
   285 		TRACE_FLAGS_DEFAULT, 
   286 		(EAPL("eap_plugin_client_message_if_c::copy_configuration(): this = 0x%08x.\n"),
   286 		(EAPL("eap_plugin_client_message_if_c::copy_configuration(): this = 0x%08x.\n"),
   287 		this));
   287 		this));
   288 
   288 
   289 	EAP_TRACE_RETURN_STRING_FLAGS(m_am_tools, EAP_TRACE_FLAGS_MESSAGE_DATA, "returns: eap_plugin_client_message_if_c::copy_configuration()");
   289 	EAP_TRACE_RETURN_STRING_FLAGS(m_am_tools, TRACE_FLAGS_DEFAULT, "returns: eap_plugin_client_message_if_c::copy_configuration()");
   290 
   290 
   291 	{
   291 	{
   292 		// Creates message data composed of Attribute-Value Pairs.
   292 		// Creates message data composed of Attribute-Value Pairs.
   293 		eap_process_tlv_message_data_c message(m_am_tools);
   293 		eap_process_tlv_message_data_c message(m_am_tools);
   294 
   294 
   332 
   332 
   333 	eap_status_e status(eap_status_process_general_error);
   333 	eap_status_e status(eap_status_process_general_error);
   334 
   334 
   335 	EAP_TRACE_DEBUG(
   335 	EAP_TRACE_DEBUG(
   336 		m_am_tools, 
   336 		m_am_tools, 
   337 		EAP_TRACE_FLAGS_MESSAGE_DATA, 
   337 		TRACE_FLAGS_DEFAULT, 
   338 		(EAPL("eap_plugin_client_message_if_c::delete_configuration(): this = 0x%08x.\n"),
   338 		(EAPL("eap_plugin_client_message_if_c::delete_configuration(): this = 0x%08x.\n"),
   339 		this));
   339 		this));
   340 
   340 
   341 	EAP_TRACE_RETURN_STRING_FLAGS(m_am_tools, EAP_TRACE_FLAGS_MESSAGE_DATA, "returns: eap_plugin_client_message_if_c::delete_configuration()");
   341 	EAP_TRACE_RETURN_STRING_FLAGS(m_am_tools, TRACE_FLAGS_DEFAULT, "returns: eap_plugin_client_message_if_c::delete_configuration()");
   342 
   342 
   343 	{
   343 	{
   344 		// Creates message data composed of Attribute-Value Pairs.
   344 		// Creates message data composed of Attribute-Value Pairs.
   345 		eap_process_tlv_message_data_c message(m_am_tools);
   345 		eap_process_tlv_message_data_c message(m_am_tools);
   346 
   346 
   384 
   384 
   385 	eap_status_e status(eap_status_process_general_error);
   385 	eap_status_e status(eap_status_process_general_error);
   386 
   386 
   387 	EAP_TRACE_DEBUG(
   387 	EAP_TRACE_DEBUG(
   388 		m_am_tools, 
   388 		m_am_tools, 
   389 		EAP_TRACE_FLAGS_MESSAGE_DATA, 
   389 		TRACE_FLAGS_DEFAULT, 
   390 		(EAPL("eap_plugin_client_message_if_c::set_index(): this = 0x%08x.\n"),
   390 		(EAPL("eap_plugin_client_message_if_c::set_index(): this = 0x%08x.\n"),
   391 		this));
   391 		this));
   392 
   392 
   393 	EAP_TRACE_RETURN_STRING_FLAGS(m_am_tools, EAP_TRACE_FLAGS_MESSAGE_DATA, "returns: eap_plugin_client_message_if_c::set_index()");
   393 	EAP_TRACE_RETURN_STRING_FLAGS(m_am_tools, TRACE_FLAGS_DEFAULT, "returns: eap_plugin_client_message_if_c::set_index()");
   394 
   394 
   395 	{
   395 	{
   396 		// Creates message data composed of Attribute-Value Pairs.
   396 		// Creates message data composed of Attribute-Value Pairs.
   397 		eap_process_tlv_message_data_c message(m_am_tools);
   397 		eap_process_tlv_message_data_c message(m_am_tools);
   398 
   398 
   436 
   436 
   437 	eap_status_e status(eap_status_process_general_error);
   437 	eap_status_e status(eap_status_process_general_error);
   438 
   438 
   439 	EAP_TRACE_DEBUG(
   439 	EAP_TRACE_DEBUG(
   440 		m_am_tools, 
   440 		m_am_tools, 
   441 		EAP_TRACE_FLAGS_MESSAGE_DATA, 
   441 		TRACE_FLAGS_DEFAULT, 
   442 		(EAPL("eap_plugin_client_message_if_c::get_type_info(): this = 0x%08x.\n"),
   442 		(EAPL("eap_plugin_client_message_if_c::get_type_info(): this = 0x%08x.\n"),
   443 		this));
   443 		this));
   444 
   444 
   445 	EAP_TRACE_RETURN_STRING_FLAGS(m_am_tools, EAP_TRACE_FLAGS_MESSAGE_DATA, "returns: eap_plugin_client_message_if_c::get_type_info()");
   445 	EAP_TRACE_RETURN_STRING_FLAGS(m_am_tools, TRACE_FLAGS_DEFAULT, "returns: eap_plugin_client_message_if_c::get_type_info()");
   446 
   446 
   447 	{
   447 	{
   448 		// Creates message data composed of Attribute-Value Pairs.
   448 		// Creates message data composed of Attribute-Value Pairs.
   449 		eap_process_tlv_message_data_c message(m_am_tools);
   449 		eap_process_tlv_message_data_c message(m_am_tools);
   450 
   450 
   488 
   488 
   489 	eap_status_e status(eap_status_process_general_error);
   489 	eap_status_e status(eap_status_process_general_error);
   490 
   490 
   491 	EAP_TRACE_DEBUG(
   491 	EAP_TRACE_DEBUG(
   492 		m_am_tools, 
   492 		m_am_tools, 
   493 		EAP_TRACE_FLAGS_MESSAGE_DATA, 
   493 		TRACE_FLAGS_DEFAULT, 
   494 		(EAPL("eap_plugin_client_message_if_c::invoke_ui(): this = 0x%08x.\n"),
   494 		(EAPL("eap_plugin_client_message_if_c::invoke_ui(): this = 0x%08x.\n"),
   495 		this));
   495 		this));
   496 
   496 
   497 	EAP_TRACE_RETURN_STRING_FLAGS(m_am_tools, EAP_TRACE_FLAGS_MESSAGE_DATA, "returns: eap_plugin_client_message_if_c::invoke_ui()");
   497 	EAP_TRACE_RETURN_STRING_FLAGS(m_am_tools, TRACE_FLAGS_DEFAULT, "returns: eap_plugin_client_message_if_c::invoke_ui()");
   498 
   498 
   499 	{
   499 	{
   500 		// Creates message data composed of Attribute-Value Pairs.
   500 		// Creates message data composed of Attribute-Value Pairs.
   501 		eap_process_tlv_message_data_c message(m_am_tools);
   501 		eap_process_tlv_message_data_c message(m_am_tools);
   502 
   502 
   902 {
   902 {
   903 	EAP_TRACE_BEGIN(m_am_tools, TRACE_FLAGS_DEFAULT);
   903 	EAP_TRACE_BEGIN(m_am_tools, TRACE_FLAGS_DEFAULT);
   904 
   904 
   905 	EAP_TRACE_DEBUG(
   905 	EAP_TRACE_DEBUG(
   906 		m_am_tools, 
   906 		m_am_tools, 
   907 		EAP_TRACE_FLAGS_MESSAGE_DATA, 
   907 		TRACE_FLAGS_DEFAULT, 
   908 		(EAPL("eap_plugin_client_message_if_c::send_data(): this = 0x%08x.\n"),
   908 		(EAPL("eap_plugin_client_message_if_c::send_data(): this = 0x%08x.\n"),
   909 		this));
   909 		this));
   910 
   910 
   911 	EAP_TRACE_RETURN_STRING_FLAGS(m_am_tools, EAP_TRACE_FLAGS_MESSAGE_DATA, "returns: eap_plugin_client_message_if_c::send_data()");
   911 	EAP_TRACE_RETURN_STRING_FLAGS(m_am_tools, TRACE_FLAGS_DEFAULT, "returns: eap_plugin_client_message_if_c::send_data()");
   912 
   912 
   913 	eap_status_e status(eap_status_process_general_error);
   913 	eap_status_e status(eap_status_process_general_error);
   914 
   914 
   915 	// Parses message data composed of Attribute-Value Pairs.
   915 	// Parses message data composed of Attribute-Value Pairs.
   916 	eap_process_tlv_message_data_c message(m_am_tools);
   916 	eap_process_tlv_message_data_c message(m_am_tools);
   971 		if (status != eap_status_ok)
   971 		if (status != eap_status_ok)
   972 		{
   972 		{
   973 			EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
   973 			EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
   974 			return EAP_STATUS_RETURN(m_am_tools, status);
   974 			return EAP_STATUS_RETURN(m_am_tools, status);
   975 		}
   975 		}
       
   976 
       
   977 		EAP_TRACE_DEBUG(
       
   978 			m_am_tools, 
       
   979 			TRACE_FLAGS_DEFAULT, 
       
   980 			(EAPL("eap_plugin_client_message_if_c::send_data(): this = 0x%08x, message=%d=%s\n"),
       
   981 			this,
       
   982 			function,
       
   983 			eap_process_tlv_message_data_c::get_function_string(function)));
   976 
   984 
   977 		switch(function)
   985 		switch(function)
   978 		{
   986 		{
   979 		case eap_tlv_message_type_function_plugin_complete_get_configuration:
   987 		case eap_tlv_message_type_function_plugin_complete_get_configuration:
   980 			status = complete_get_configuration(&parameters);
   988 			status = complete_get_configuration(&parameters);