eapol/eapol_framework/eapol_common/core/eap_plugin_client_message_if.cpp
branchRCL_3
changeset 19 c74b3d9f6b9e
parent 18 bad0cc58d154
equal deleted inserted replaced
18:bad0cc58d154 19:c74b3d9f6b9e
     1 /*
       
     2 * Copyright (c) 2001-2010 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of the License "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:  EAP-plugin interface message class.
       
    15 *
       
    16 */
       
    17 
       
    18 /*
       
    19 * %version: 9 %
       
    20 */
       
    21 
       
    22 // This is enumeration of EAPOL source code.
       
    23 #if defined(USE_EAP_MINIMUM_RELEASE_TRACES)
       
    24 	#undef EAP_FILE_NUMBER_ENUM
       
    25 	#define EAP_FILE_NUMBER_ENUM 764 
       
    26 	#undef EAP_FILE_NUMBER_DATE 
       
    27 	#define EAP_FILE_NUMBER_DATE 1127594498 
       
    28 #endif //#if defined(USE_EAP_MINIMUM_RELEASE_TRACES)
       
    29 
       
    30 #include "eap_am_tools.h"
       
    31 #include "eap_tools.h"
       
    32 #include "eap_am_export.h"
       
    33 #include "eap_am_assert.h"
       
    34 #include "eap_plugin_client_message_if.h"
       
    35 #include "abs_eap_plugin_message.h"
       
    36 #include "abs_eap_am_message_if.h"
       
    37 #include "eap_am_message_if.h"
       
    38 #include "eap_automatic_variable.h"
       
    39 #include "eap_process_tlv_message_data.h"
       
    40 #include "eap_method_settings.h"
       
    41 #include "eap_am_network_id.h"
       
    42 
       
    43 //--------------------------------------------------
       
    44 
       
    45 EAP_FUNC_EXPORT eap_plugin_client_message_if_c::~eap_plugin_client_message_if_c()
       
    46 {
       
    47 	delete m_client_if;
       
    48 	m_client_if = 0;
       
    49 }
       
    50 
       
    51 //--------------------------------------------------
       
    52 
       
    53 /**
       
    54  * The constructor initializes member attributes using parameters passed to it.
       
    55  * @param tools is pointer to the tools class. @see abs_eap_am_tools_c.
       
    56  * @param client_if is pointer to client interface.
       
    57  * @param partner is back pointer to object which created this object.
       
    58  */
       
    59 EAP_FUNC_EXPORT eap_plugin_client_message_if_c::eap_plugin_client_message_if_c(
       
    60 	abs_eap_am_tools_c * const tools,
       
    61 	eap_am_message_if_c * const client_if,
       
    62 	abs_eap_plugin_message_c * const partner)
       
    63 : m_am_tools(tools)
       
    64 , m_client_if(client_if)
       
    65 , m_partner(partner)
       
    66 , m_is_valid(false)
       
    67 , m_error_code(eap_status_ok)
       
    68 , m_error_function(eap_tlv_message_type_function_none)
       
    69 {
       
    70 	if (m_am_tools == 0
       
    71 		|| m_am_tools->get_is_valid() == false
       
    72 		|| m_client_if == 0
       
    73 		|| m_client_if->get_is_valid() == false
       
    74 		|| m_partner == 0)
       
    75 	{
       
    76 		return;
       
    77 	}
       
    78 
       
    79 	EAP_TRACE_DEBUG(
       
    80 		m_am_tools, 
       
    81 		EAP_TRACE_FLAGS_MESSAGE_DATA, 
       
    82 		(EAPL("eap_plugin_client_message_if_c::eap_plugin_client_message_if_c(): this = 0x%08x.\n"),
       
    83 		this));
       
    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()");
       
    86 
       
    87 	m_is_valid = true;
       
    88 }
       
    89 
       
    90 //--------------------------------------------------
       
    91 
       
    92 /**
       
    93  * This function must reset the state of object to same as 
       
    94  * state was after the configure() function call.
       
    95  * If object reset succeeds this function must return eap_status_ok.
       
    96  * If object reset fails this function must return corresponding error status.
       
    97  * @return This function returns the status of reset operation.
       
    98  */
       
    99 EAP_FUNC_EXPORT eap_status_e eap_plugin_client_message_if_c::reset()
       
   100 {
       
   101 	return EAP_STATUS_RETURN(m_am_tools, eap_status_ok);
       
   102 }
       
   103 
       
   104 //--------------------------------------------------
       
   105 
       
   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()
       
   108 {
       
   109 	EAP_TRACE_DEBUG(
       
   110 		m_am_tools, 
       
   111 		EAP_TRACE_FLAGS_MESSAGE_DATA, 
       
   112 		(EAPL("eap_plugin_client_message_if_c::configure(): this = 0x%08x.\n"),
       
   113 		this));
       
   114 
       
   115 	EAP_TRACE_RETURN_STRING_FLAGS(m_am_tools, EAP_TRACE_FLAGS_MESSAGE_DATA, "returns: eap_plugin_client_message_if_c::configure()");
       
   116 
       
   117 	eap_status_e status = m_client_if->configure(0);
       
   118 
       
   119 	return EAP_STATUS_RETURN(m_am_tools, status);
       
   120 }
       
   121 
       
   122 //--------------------------------------------------
       
   123 
       
   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()
       
   126 {
       
   127 	EAP_TRACE_DEBUG(
       
   128 		m_am_tools, 
       
   129 		EAP_TRACE_FLAGS_MESSAGE_DATA, 
       
   130 		(EAPL("eap_plugin_client_message_if_c::shutdown(): this = 0x%08x.\n"),
       
   131 		this));
       
   132 
       
   133 	EAP_TRACE_RETURN_STRING_FLAGS(m_am_tools, EAP_TRACE_FLAGS_MESSAGE_DATA, "returns: eap_plugin_client_message_if_c::shutdown()");
       
   134 
       
   135 	eap_status_e status = m_client_if->shutdown();
       
   136 
       
   137 	return EAP_STATUS_RETURN(m_am_tools, status);
       
   138 }
       
   139 
       
   140 //--------------------------------------------------
       
   141 
       
   142 // This is documented in abs_eap_stack_interface_c::get_is_valid().
       
   143 EAP_FUNC_EXPORT bool eap_plugin_client_message_if_c::get_is_valid()
       
   144 {
       
   145 	return m_is_valid;
       
   146 }
       
   147 
       
   148 //--------------------------------------------------
       
   149 
       
   150 EAP_FUNC_EXPORT eap_status_e eap_plugin_client_message_if_c::process_message(eap_process_tlv_message_data_c * const message)
       
   151 {
       
   152 	// Process message data composed of Attribute-Value Pairs.
       
   153 
       
   154 	EAP_TRACE_RETURN_STRING_FLAGS(m_am_tools, EAP_TRACE_FLAGS_MESSAGE_DATA, "returns: eap_plugin_client_message_if_c::process_message()");
       
   155 
       
   156 	EAP_TRACE_DATA_DEBUG(
       
   157 		m_am_tools,
       
   158 		EAP_TRACE_FLAGS_MESSAGE_DATA,
       
   159 		(EAPL("eap_plugin_client_message_if_c::process_message()"),
       
   160 		message->get_message_data(),
       
   161 		message->get_message_data_length()));
       
   162 
       
   163 	eap_status_e send_status = m_client_if->process_data(
       
   164 		message->get_message_data(),
       
   165 		message->get_message_data_length());
       
   166 
       
   167 	EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
       
   168 	return EAP_STATUS_RETURN(m_am_tools, send_status);
       
   169 }
       
   170 
       
   171 //--------------------------------------------------
       
   172 
       
   173 EAP_FUNC_EXPORT eap_status_e eap_plugin_client_message_if_c::get_configuration(const eap_method_settings_c * const internal_settings)
       
   174 {
       
   175 	EAP_TRACE_BEGIN(m_am_tools, TRACE_FLAGS_DEFAULT);
       
   176 
       
   177 	eap_status_e status(eap_status_process_general_error);
       
   178 
       
   179 	EAP_TRACE_DEBUG(
       
   180 		m_am_tools, 
       
   181 		EAP_TRACE_FLAGS_MESSAGE_DATA, 
       
   182 		(EAPL("eap_plugin_client_message_if_c::get_configuration(): this = 0x%08x.\n"),
       
   183 		this));
       
   184 
       
   185 	EAP_TRACE_RETURN_STRING_FLAGS(m_am_tools, EAP_TRACE_FLAGS_MESSAGE_DATA, "returns: eap_plugin_client_message_if_c::get_configuration()");
       
   186 
       
   187 	{
       
   188 		// Creates message data composed of Attribute-Value Pairs.
       
   189 		eap_process_tlv_message_data_c message(m_am_tools);
       
   190 
       
   191 		if (message.get_is_valid() == false)
       
   192 		{
       
   193 			EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
       
   194 			return EAP_STATUS_RETURN(m_am_tools, eap_status_allocation_error);
       
   195 		}
       
   196 
       
   197 		status = message.add_parameter_data(eap_tlv_message_type_function_plugin_get_configuration);
       
   198 		if (status != eap_status_ok)
       
   199 		{
       
   200 			EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
       
   201 			return EAP_STATUS_RETURN(m_am_tools, status);
       
   202 		}
       
   203 
       
   204 		status = message.add_parameter_data(internal_settings);
       
   205 		if (status != eap_status_ok)
       
   206 		{
       
   207 			EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
       
   208 			return EAP_STATUS_RETURN(m_am_tools, status);
       
   209 		}
       
   210 
       
   211 		status = process_message(&message);
       
   212 		if (status != eap_status_ok)
       
   213 		{
       
   214 			EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
       
   215 			return EAP_STATUS_RETURN(m_am_tools, status);
       
   216 		}
       
   217 	}
       
   218 
       
   219 	EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
       
   220 	return EAP_STATUS_RETURN(m_am_tools, status);
       
   221 }
       
   222 
       
   223 //--------------------------------------------------
       
   224 
       
   225 EAP_FUNC_EXPORT eap_status_e eap_plugin_client_message_if_c::set_configuration(const eap_method_settings_c * const internal_settings)
       
   226 {
       
   227 	EAP_TRACE_BEGIN(m_am_tools, TRACE_FLAGS_DEFAULT);
       
   228 
       
   229 	eap_status_e status(eap_status_process_general_error);
       
   230 
       
   231 	EAP_TRACE_DEBUG(
       
   232 		m_am_tools, 
       
   233 		EAP_TRACE_FLAGS_MESSAGE_DATA, 
       
   234 		(EAPL("eap_plugin_client_message_if_c::set_configuration(): this = 0x%08x.\n"),
       
   235 		this));
       
   236 
       
   237 	EAP_TRACE_RETURN_STRING_FLAGS(m_am_tools, EAP_TRACE_FLAGS_MESSAGE_DATA, "returns: eap_plugin_client_message_if_c::set_configuration()");
       
   238 
       
   239 	{
       
   240 		// Creates message data composed of Attribute-Value Pairs.
       
   241 		eap_process_tlv_message_data_c message(m_am_tools);
       
   242 
       
   243 		if (message.get_is_valid() == false)
       
   244 		{
       
   245 			EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
       
   246 			return EAP_STATUS_RETURN(m_am_tools, eap_status_allocation_error);
       
   247 		}
       
   248 
       
   249 		status = message.add_parameter_data(eap_tlv_message_type_function_plugin_set_configuration);
       
   250 		if (status != eap_status_ok)
       
   251 		{
       
   252 			EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
       
   253 			return EAP_STATUS_RETURN(m_am_tools, status);
       
   254 		}
       
   255 
       
   256 		status = message.add_parameter_data(internal_settings);
       
   257 		if (status != eap_status_ok)
       
   258 		{
       
   259 			EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
       
   260 			return EAP_STATUS_RETURN(m_am_tools, status);
       
   261 		}
       
   262 
       
   263 		status = process_message(&message);
       
   264 		if (status != eap_status_ok)
       
   265 		{
       
   266 			EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
       
   267 			return EAP_STATUS_RETURN(m_am_tools, status);
       
   268 		}
       
   269 	}
       
   270 
       
   271 	EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
       
   272 	return EAP_STATUS_RETURN(m_am_tools, status);
       
   273 }
       
   274 
       
   275 //--------------------------------------------------
       
   276 
       
   277 EAP_FUNC_EXPORT eap_status_e eap_plugin_client_message_if_c::copy_configuration(const eap_method_settings_c * const internal_settings)
       
   278 {
       
   279 	EAP_TRACE_BEGIN(m_am_tools, TRACE_FLAGS_DEFAULT);
       
   280 
       
   281 	eap_status_e status(eap_status_process_general_error);
       
   282 
       
   283 	EAP_TRACE_DEBUG(
       
   284 		m_am_tools, 
       
   285 		EAP_TRACE_FLAGS_MESSAGE_DATA, 
       
   286 		(EAPL("eap_plugin_client_message_if_c::copy_configuration(): this = 0x%08x.\n"),
       
   287 		this));
       
   288 
       
   289 	EAP_TRACE_RETURN_STRING_FLAGS(m_am_tools, EAP_TRACE_FLAGS_MESSAGE_DATA, "returns: eap_plugin_client_message_if_c::copy_configuration()");
       
   290 
       
   291 	{
       
   292 		// Creates message data composed of Attribute-Value Pairs.
       
   293 		eap_process_tlv_message_data_c message(m_am_tools);
       
   294 
       
   295 		if (message.get_is_valid() == false)
       
   296 		{
       
   297 			EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
       
   298 			return EAP_STATUS_RETURN(m_am_tools, eap_status_allocation_error);
       
   299 		}
       
   300 
       
   301 		status = message.add_parameter_data(eap_tlv_message_type_function_plugin_copy_configuration);
       
   302 		if (status != eap_status_ok)
       
   303 		{
       
   304 			EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
       
   305 			return EAP_STATUS_RETURN(m_am_tools, status);
       
   306 		}
       
   307 
       
   308 		status = message.add_parameter_data(internal_settings);
       
   309 		if (status != eap_status_ok)
       
   310 		{
       
   311 			EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
       
   312 			return EAP_STATUS_RETURN(m_am_tools, status);
       
   313 		}
       
   314 
       
   315 		status = process_message(&message);
       
   316 		if (status != eap_status_ok)
       
   317 		{
       
   318 			EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
       
   319 			return EAP_STATUS_RETURN(m_am_tools, status);
       
   320 		}
       
   321 	}
       
   322 
       
   323 	EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
       
   324 	return EAP_STATUS_RETURN(m_am_tools, status);
       
   325 }
       
   326 
       
   327 //--------------------------------------------------
       
   328 
       
   329 EAP_FUNC_EXPORT eap_status_e eap_plugin_client_message_if_c::delete_configuration(const eap_method_settings_c * const internal_settings)
       
   330 {
       
   331 	EAP_TRACE_BEGIN(m_am_tools, TRACE_FLAGS_DEFAULT);
       
   332 
       
   333 	eap_status_e status(eap_status_process_general_error);
       
   334 
       
   335 	EAP_TRACE_DEBUG(
       
   336 		m_am_tools, 
       
   337 		EAP_TRACE_FLAGS_MESSAGE_DATA, 
       
   338 		(EAPL("eap_plugin_client_message_if_c::delete_configuration(): this = 0x%08x.\n"),
       
   339 		this));
       
   340 
       
   341 	EAP_TRACE_RETURN_STRING_FLAGS(m_am_tools, EAP_TRACE_FLAGS_MESSAGE_DATA, "returns: eap_plugin_client_message_if_c::delete_configuration()");
       
   342 
       
   343 	{
       
   344 		// Creates message data composed of Attribute-Value Pairs.
       
   345 		eap_process_tlv_message_data_c message(m_am_tools);
       
   346 
       
   347 		if (message.get_is_valid() == false)
       
   348 		{
       
   349 			EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
       
   350 			return EAP_STATUS_RETURN(m_am_tools, eap_status_allocation_error);
       
   351 		}
       
   352 
       
   353 		status = message.add_parameter_data(eap_tlv_message_type_function_plugin_delete_configuration);
       
   354 		if (status != eap_status_ok)
       
   355 		{
       
   356 			EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
       
   357 			return EAP_STATUS_RETURN(m_am_tools, status);
       
   358 		}
       
   359 
       
   360 		status = message.add_parameter_data(internal_settings);
       
   361 		if (status != eap_status_ok)
       
   362 		{
       
   363 			EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
       
   364 			return EAP_STATUS_RETURN(m_am_tools, status);
       
   365 		}
       
   366 
       
   367 		status = process_message(&message);
       
   368 		if (status != eap_status_ok)
       
   369 		{
       
   370 			EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
       
   371 			return EAP_STATUS_RETURN(m_am_tools, status);
       
   372 		}
       
   373 	}
       
   374 
       
   375 	EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
       
   376 	return EAP_STATUS_RETURN(m_am_tools, status);
       
   377 }
       
   378 
       
   379 //--------------------------------------------------
       
   380 
       
   381 EAP_FUNC_EXPORT eap_status_e eap_plugin_client_message_if_c::set_index(const eap_method_settings_c * const internal_settings)
       
   382 {
       
   383 	EAP_TRACE_BEGIN(m_am_tools, TRACE_FLAGS_DEFAULT);
       
   384 
       
   385 	eap_status_e status(eap_status_process_general_error);
       
   386 
       
   387 	EAP_TRACE_DEBUG(
       
   388 		m_am_tools, 
       
   389 		EAP_TRACE_FLAGS_MESSAGE_DATA, 
       
   390 		(EAPL("eap_plugin_client_message_if_c::set_index(): this = 0x%08x.\n"),
       
   391 		this));
       
   392 
       
   393 	EAP_TRACE_RETURN_STRING_FLAGS(m_am_tools, EAP_TRACE_FLAGS_MESSAGE_DATA, "returns: eap_plugin_client_message_if_c::set_index()");
       
   394 
       
   395 	{
       
   396 		// Creates message data composed of Attribute-Value Pairs.
       
   397 		eap_process_tlv_message_data_c message(m_am_tools);
       
   398 
       
   399 		if (message.get_is_valid() == false)
       
   400 		{
       
   401 			EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
       
   402 			return EAP_STATUS_RETURN(m_am_tools, eap_status_allocation_error);
       
   403 		}
       
   404 
       
   405 		status = message.add_parameter_data(eap_tlv_message_type_function_plugin_set_index);
       
   406 		if (status != eap_status_ok)
       
   407 		{
       
   408 			EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
       
   409 			return EAP_STATUS_RETURN(m_am_tools, status);
       
   410 		}
       
   411 
       
   412 		status = message.add_parameter_data(internal_settings);
       
   413 		if (status != eap_status_ok)
       
   414 		{
       
   415 			EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
       
   416 			return EAP_STATUS_RETURN(m_am_tools, status);
       
   417 		}
       
   418 
       
   419 		status = process_message(&message);
       
   420 		if (status != eap_status_ok)
       
   421 		{
       
   422 			EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
       
   423 			return EAP_STATUS_RETURN(m_am_tools, status);
       
   424 		}
       
   425 	}
       
   426 
       
   427 	EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
       
   428 	return EAP_STATUS_RETURN(m_am_tools, status);
       
   429 }
       
   430 
       
   431 //--------------------------------------------------
       
   432 
       
   433 EAP_FUNC_EXPORT eap_status_e eap_plugin_client_message_if_c::get_type_info(const eap_method_settings_c * const internal_settings)
       
   434 {
       
   435 	EAP_TRACE_BEGIN(m_am_tools, TRACE_FLAGS_DEFAULT);
       
   436 
       
   437 	eap_status_e status(eap_status_process_general_error);
       
   438 
       
   439 	EAP_TRACE_DEBUG(
       
   440 		m_am_tools, 
       
   441 		EAP_TRACE_FLAGS_MESSAGE_DATA, 
       
   442 		(EAPL("eap_plugin_client_message_if_c::get_type_info(): this = 0x%08x.\n"),
       
   443 		this));
       
   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()");
       
   446 
       
   447 	{
       
   448 		// Creates message data composed of Attribute-Value Pairs.
       
   449 		eap_process_tlv_message_data_c message(m_am_tools);
       
   450 
       
   451 		if (message.get_is_valid() == false)
       
   452 		{
       
   453 			EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
       
   454 			return EAP_STATUS_RETURN(m_am_tools, eap_status_allocation_error);
       
   455 		}
       
   456 
       
   457 		status = message.add_parameter_data(eap_tlv_message_type_function_plugin_get_type_info);
       
   458 		if (status != eap_status_ok)
       
   459 		{
       
   460 			EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
       
   461 			return EAP_STATUS_RETURN(m_am_tools, status);
       
   462 		}
       
   463 
       
   464 		status = message.add_parameter_data(internal_settings);
       
   465 		if (status != eap_status_ok)
       
   466 		{
       
   467 			EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
       
   468 			return EAP_STATUS_RETURN(m_am_tools, status);
       
   469 		}
       
   470 
       
   471 		status = process_message(&message);
       
   472 		if (status != eap_status_ok)
       
   473 		{
       
   474 			EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
       
   475 			return EAP_STATUS_RETURN(m_am_tools, status);
       
   476 		}
       
   477 	}
       
   478 
       
   479 	EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
       
   480 	return EAP_STATUS_RETURN(m_am_tools, status);
       
   481 }
       
   482 
       
   483 //--------------------------------------------------
       
   484 
       
   485 EAP_FUNC_EXPORT eap_status_e eap_plugin_client_message_if_c::invoke_ui(const eap_method_settings_c * const internal_settings)
       
   486 {
       
   487 	EAP_TRACE_BEGIN(m_am_tools, TRACE_FLAGS_DEFAULT);
       
   488 
       
   489 	eap_status_e status(eap_status_process_general_error);
       
   490 
       
   491 	EAP_TRACE_DEBUG(
       
   492 		m_am_tools, 
       
   493 		EAP_TRACE_FLAGS_MESSAGE_DATA, 
       
   494 		(EAPL("eap_plugin_client_message_if_c::invoke_ui(): this = 0x%08x.\n"),
       
   495 		this));
       
   496 
       
   497 	EAP_TRACE_RETURN_STRING_FLAGS(m_am_tools, EAP_TRACE_FLAGS_MESSAGE_DATA, "returns: eap_plugin_client_message_if_c::invoke_ui()");
       
   498 
       
   499 	{
       
   500 		// Creates message data composed of Attribute-Value Pairs.
       
   501 		eap_process_tlv_message_data_c message(m_am_tools);
       
   502 
       
   503 		if (message.get_is_valid() == false)
       
   504 		{
       
   505 			EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
       
   506 			return EAP_STATUS_RETURN(m_am_tools, eap_status_allocation_error);
       
   507 		}
       
   508 
       
   509 		status = message.add_parameter_data(eap_tlv_message_type_function_plugin_invoke_ui);
       
   510 		if (status != eap_status_ok)
       
   511 		{
       
   512 			EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
       
   513 			return EAP_STATUS_RETURN(m_am_tools, status);
       
   514 		}
       
   515 
       
   516 		status = message.add_parameter_data(internal_settings);
       
   517 		if (status != eap_status_ok)
       
   518 		{
       
   519 			EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
       
   520 			return EAP_STATUS_RETURN(m_am_tools, status);
       
   521 		}
       
   522 
       
   523 		status = process_message(&message);
       
   524 		if (status != eap_status_ok)
       
   525 		{
       
   526 			EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
       
   527 			return EAP_STATUS_RETURN(m_am_tools, status);
       
   528 		}
       
   529 	}
       
   530 
       
   531 	EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
       
   532 	return EAP_STATUS_RETURN(m_am_tools, status);
       
   533 }
       
   534 
       
   535 //--------------------------------------------------
       
   536 
       
   537 eap_status_e eap_plugin_client_message_if_c::complete_get_configuration(
       
   538 	EAP_TEMPLATE_CONST eap_array_c<eap_tlv_header_c> * const parameters)
       
   539 {
       
   540 	EAP_TRACE_BEGIN(m_am_tools, TRACE_FLAGS_DEFAULT);
       
   541 
       
   542 	// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
       
   543 
       
   544 	u32_t parameter_index(eap_message_payload_index_first_parameter);
       
   545 
       
   546 	eap_process_tlv_message_data_c message_data(m_am_tools);
       
   547 
       
   548 	if (message_data.get_is_valid() == false)
       
   549 	{
       
   550 		EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
       
   551 		return EAP_STATUS_RETURN(m_am_tools, eap_status_allocation_error);
       
   552 	}
       
   553 
       
   554 	// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
       
   555 
       
   556 	eap_method_settings_c * const internal_settings = new eap_method_settings_c(m_am_tools);
       
   557 
       
   558 	eap_automatic_variable_c<eap_method_settings_c> automatic_internal_settings(m_am_tools, internal_settings);
       
   559 
       
   560 	if (internal_settings == 0)
       
   561 	{
       
   562 		EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
       
   563 		return EAP_STATUS_RETURN(m_am_tools, eap_status_allocation_error);
       
   564 	}
       
   565 
       
   566 	eap_status_e status = message_data.read_parameter_data(parameters, parameter_index, internal_settings);
       
   567 	if (status != eap_status_ok)
       
   568 	{
       
   569 		EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
       
   570 		return EAP_STATUS_RETURN(m_am_tools, status);
       
   571 	}
       
   572 
       
   573 	// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
       
   574 
       
   575 	status = m_partner->complete_get_configuration(
       
   576 		internal_settings);
       
   577 
       
   578 	EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
       
   579 	return EAP_STATUS_RETURN(m_am_tools, status);
       
   580 }
       
   581 
       
   582 //--------------------------------------------------
       
   583 
       
   584 eap_status_e eap_plugin_client_message_if_c::complete_set_configuration(
       
   585 	EAP_TEMPLATE_CONST eap_array_c<eap_tlv_header_c> * const parameters)
       
   586 {
       
   587 	EAP_TRACE_BEGIN(m_am_tools, TRACE_FLAGS_DEFAULT);
       
   588 
       
   589 	// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
       
   590 
       
   591 	u32_t parameter_index(eap_message_payload_index_first_parameter);
       
   592 
       
   593 	eap_process_tlv_message_data_c message_data(m_am_tools);
       
   594 
       
   595 	if (message_data.get_is_valid() == false)
       
   596 	{
       
   597 		EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
       
   598 		return EAP_STATUS_RETURN(m_am_tools, eap_status_allocation_error);
       
   599 	}
       
   600 
       
   601 	// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
       
   602 
       
   603 	eap_method_settings_c * const internal_settings = new eap_method_settings_c(m_am_tools);
       
   604 
       
   605 	eap_automatic_variable_c<eap_method_settings_c> automatic_internal_settings(m_am_tools, internal_settings);
       
   606 
       
   607 	if (internal_settings == 0)
       
   608 	{
       
   609 		EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
       
   610 		return EAP_STATUS_RETURN(m_am_tools, eap_status_allocation_error);
       
   611 	}
       
   612 
       
   613 	eap_status_e status = message_data.read_parameter_data(parameters, parameter_index, internal_settings);
       
   614 	if (status != eap_status_ok)
       
   615 	{
       
   616 		EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
       
   617 		return EAP_STATUS_RETURN(m_am_tools, status);
       
   618 	}
       
   619 
       
   620 	// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
       
   621 
       
   622 	status = m_partner->complete_set_configuration(
       
   623 		internal_settings->m_completion_status);
       
   624 
       
   625 	EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
       
   626 	return EAP_STATUS_RETURN(m_am_tools, status);
       
   627 }
       
   628 
       
   629 //--------------------------------------------------
       
   630 
       
   631 eap_status_e eap_plugin_client_message_if_c::complete_delete_configuration(
       
   632 	EAP_TEMPLATE_CONST eap_array_c<eap_tlv_header_c> * const parameters)
       
   633 {
       
   634 	EAP_TRACE_BEGIN(m_am_tools, TRACE_FLAGS_DEFAULT);
       
   635 
       
   636 	// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
       
   637 
       
   638 	u32_t parameter_index(eap_message_payload_index_first_parameter);
       
   639 
       
   640 	eap_process_tlv_message_data_c message_data(m_am_tools);
       
   641 
       
   642 	if (message_data.get_is_valid() == false)
       
   643 	{
       
   644 		EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
       
   645 		return EAP_STATUS_RETURN(m_am_tools, eap_status_allocation_error);
       
   646 	}
       
   647 
       
   648 	// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
       
   649 
       
   650 	eap_method_settings_c * const internal_settings = new eap_method_settings_c(m_am_tools);
       
   651 
       
   652 	eap_automatic_variable_c<eap_method_settings_c> automatic_internal_settings(m_am_tools, internal_settings);
       
   653 
       
   654 	if (internal_settings == 0)
       
   655 	{
       
   656 		EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
       
   657 		return EAP_STATUS_RETURN(m_am_tools, eap_status_allocation_error);
       
   658 	}
       
   659 
       
   660 	eap_status_e status = message_data.read_parameter_data(parameters, parameter_index, internal_settings);
       
   661 	if (status != eap_status_ok)
       
   662 	{
       
   663 		EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
       
   664 		return EAP_STATUS_RETURN(m_am_tools, status);
       
   665 	}
       
   666 
       
   667 	// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
       
   668 
       
   669 	status = m_partner->complete_delete_configuration(
       
   670 		internal_settings->m_completion_status);
       
   671 
       
   672 	EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
       
   673 	return EAP_STATUS_RETURN(m_am_tools, status);
       
   674 }
       
   675 
       
   676 //--------------------------------------------------
       
   677 
       
   678 eap_status_e eap_plugin_client_message_if_c::complete_copy_configuration(
       
   679 	EAP_TEMPLATE_CONST eap_array_c<eap_tlv_header_c> * const parameters)
       
   680 {
       
   681 	EAP_TRACE_BEGIN(m_am_tools, TRACE_FLAGS_DEFAULT);
       
   682 
       
   683 	// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
       
   684 
       
   685 	u32_t parameter_index(eap_message_payload_index_first_parameter);
       
   686 
       
   687 	eap_process_tlv_message_data_c message_data(m_am_tools);
       
   688 
       
   689 	if (message_data.get_is_valid() == false)
       
   690 	{
       
   691 		EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
       
   692 		return EAP_STATUS_RETURN(m_am_tools, eap_status_allocation_error);
       
   693 	}
       
   694 
       
   695 	// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
       
   696 
       
   697 	eap_method_settings_c * const internal_settings = new eap_method_settings_c(m_am_tools);
       
   698 
       
   699 	eap_automatic_variable_c<eap_method_settings_c> automatic_internal_settings(m_am_tools, internal_settings);
       
   700 
       
   701 	if (internal_settings == 0)
       
   702 	{
       
   703 		EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
       
   704 		return EAP_STATUS_RETURN(m_am_tools, eap_status_allocation_error);
       
   705 	}
       
   706 
       
   707 	eap_status_e status = message_data.read_parameter_data(parameters, parameter_index, internal_settings);
       
   708 	if (status != eap_status_ok)
       
   709 	{
       
   710 		EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
       
   711 		return EAP_STATUS_RETURN(m_am_tools, status);
       
   712 	}
       
   713 
       
   714 	// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
       
   715 
       
   716 	status = m_partner->complete_copy_configuration(
       
   717 		internal_settings->m_completion_status);
       
   718 
       
   719 	EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
       
   720 	return EAP_STATUS_RETURN(m_am_tools, status);
       
   721 }
       
   722 
       
   723 //--------------------------------------------------
       
   724 
       
   725 eap_status_e eap_plugin_client_message_if_c::complete_set_index(
       
   726 	EAP_TEMPLATE_CONST eap_array_c<eap_tlv_header_c> * const parameters)
       
   727 {
       
   728 	EAP_TRACE_BEGIN(m_am_tools, TRACE_FLAGS_DEFAULT);
       
   729 
       
   730 	// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
       
   731 
       
   732 	u32_t parameter_index(eap_message_payload_index_first_parameter);
       
   733 
       
   734 	eap_process_tlv_message_data_c message_data(m_am_tools);
       
   735 
       
   736 	if (message_data.get_is_valid() == false)
       
   737 	{
       
   738 		EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
       
   739 		return EAP_STATUS_RETURN(m_am_tools, eap_status_allocation_error);
       
   740 	}
       
   741 
       
   742 	// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
       
   743 
       
   744 	eap_method_settings_c * const internal_settings = new eap_method_settings_c(m_am_tools);
       
   745 
       
   746 	eap_automatic_variable_c<eap_method_settings_c> automatic_internal_settings(m_am_tools, internal_settings);
       
   747 
       
   748 	if (internal_settings == 0)
       
   749 	{
       
   750 		EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
       
   751 		return EAP_STATUS_RETURN(m_am_tools, eap_status_allocation_error);
       
   752 	}
       
   753 
       
   754 	eap_status_e status = message_data.read_parameter_data(parameters, parameter_index, internal_settings);
       
   755 	if (status != eap_status_ok)
       
   756 	{
       
   757 		EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
       
   758 		return EAP_STATUS_RETURN(m_am_tools, status);
       
   759 	}
       
   760 
       
   761 	// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
       
   762 
       
   763 	status = m_partner->complete_set_index(
       
   764 		internal_settings->m_completion_status);
       
   765 
       
   766 	EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
       
   767 	return EAP_STATUS_RETURN(m_am_tools, status);
       
   768 }
       
   769 
       
   770 //--------------------------------------------------
       
   771 
       
   772 eap_status_e eap_plugin_client_message_if_c::complete_get_type_info(
       
   773 	EAP_TEMPLATE_CONST eap_array_c<eap_tlv_header_c> * const parameters)
       
   774 {
       
   775 	EAP_TRACE_BEGIN(m_am_tools, TRACE_FLAGS_DEFAULT);
       
   776 
       
   777 	// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
       
   778 
       
   779 	u32_t parameter_index(eap_message_payload_index_first_parameter);
       
   780 
       
   781 	eap_process_tlv_message_data_c message_data(m_am_tools);
       
   782 
       
   783 	if (message_data.get_is_valid() == false)
       
   784 	{
       
   785 		EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
       
   786 		return EAP_STATUS_RETURN(m_am_tools, eap_status_allocation_error);
       
   787 	}
       
   788 
       
   789 	// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
       
   790 
       
   791 	eap_method_settings_c * const internal_settings = new eap_method_settings_c(m_am_tools);
       
   792 
       
   793 	eap_automatic_variable_c<eap_method_settings_c> automatic_internal_settings(m_am_tools, internal_settings);
       
   794 
       
   795 	if (internal_settings == 0)
       
   796 	{
       
   797 		EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
       
   798 		return EAP_STATUS_RETURN(m_am_tools, eap_status_allocation_error);
       
   799 	}
       
   800 
       
   801 	eap_status_e status = message_data.read_parameter_data(parameters, parameter_index, internal_settings);
       
   802 	if (status != eap_status_ok)
       
   803 	{
       
   804 		EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
       
   805 		return EAP_STATUS_RETURN(m_am_tools, status);
       
   806 	}
       
   807 
       
   808 	// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
       
   809 
       
   810 	status = m_partner->complete_get_type_info(
       
   811 		internal_settings);
       
   812 
       
   813 	EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
       
   814 	return EAP_STATUS_RETURN(m_am_tools, status);
       
   815 }
       
   816 
       
   817 //--------------------------------------------------
       
   818 
       
   819 eap_status_e eap_plugin_client_message_if_c::complete_invoke_ui(
       
   820 	EAP_TEMPLATE_CONST eap_array_c<eap_tlv_header_c> * const parameters)
       
   821 {
       
   822 	EAP_TRACE_BEGIN(m_am_tools, TRACE_FLAGS_DEFAULT);
       
   823 
       
   824 	// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
       
   825 
       
   826 	u32_t parameter_index(eap_message_payload_index_first_parameter);
       
   827 
       
   828 	eap_process_tlv_message_data_c message_data(m_am_tools);
       
   829 
       
   830 	if (message_data.get_is_valid() == false)
       
   831 	{
       
   832 		EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
       
   833 		return EAP_STATUS_RETURN(m_am_tools, eap_status_allocation_error);
       
   834 	}
       
   835 
       
   836 	// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
       
   837 
       
   838 	eap_method_settings_c * const internal_settings = new eap_method_settings_c(m_am_tools);
       
   839 
       
   840 	eap_automatic_variable_c<eap_method_settings_c> automatic_internal_settings(m_am_tools, internal_settings);
       
   841 
       
   842 	if (internal_settings == 0)
       
   843 	{
       
   844 		EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
       
   845 		return EAP_STATUS_RETURN(m_am_tools, eap_status_allocation_error);
       
   846 	}
       
   847 
       
   848 	eap_status_e status = message_data.read_parameter_data(parameters, parameter_index, internal_settings);
       
   849 	if (status != eap_status_ok)
       
   850 	{
       
   851 		EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
       
   852 		return EAP_STATUS_RETURN(m_am_tools, status);
       
   853 	}
       
   854 
       
   855 	// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
       
   856 
       
   857 	status = m_partner->complete_invoke_ui(
       
   858 		internal_settings);
       
   859 
       
   860 	EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
       
   861 	return EAP_STATUS_RETURN(m_am_tools, status);
       
   862 }
       
   863 
       
   864 //--------------------------------------------------
       
   865 
       
   866 eap_status_e eap_plugin_client_message_if_c::process_message_type_error(
       
   867 	EAP_TEMPLATE_CONST eap_array_c<eap_tlv_header_c> * const parameters)
       
   868 {
       
   869 	eap_status_e status(eap_status_ok);
       
   870 
       
   871 	eap_process_tlv_message_data_c message_data(m_am_tools);
       
   872 
       
   873 	if (message_data.get_is_valid() == false)
       
   874 	{
       
   875 		EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
       
   876 		return EAP_STATUS_RETURN(m_am_tools, eap_status_allocation_error);
       
   877 	}
       
   878 
       
   879 	// Error payload is the first in this case.
       
   880 	status = message_data.read_parameter_data(parameters, eap_message_payload_index_function, eap_tlv_message_type_error, &m_error_code);
       
   881 	if (status != eap_status_ok)
       
   882 	{
       
   883 		EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
       
   884 		return EAP_STATUS_RETURN(m_am_tools, status);
       
   885 	}
       
   886 
       
   887 	// Fuction payload is the second in this case.
       
   888 	status = message_data.read_parameter_data(parameters, eap_message_payload_index_first_parameter, &m_error_function);
       
   889 	if (status != eap_status_ok)
       
   890 	{
       
   891 		EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
       
   892 		return EAP_STATUS_RETURN(m_am_tools, status);
       
   893 	}
       
   894 
       
   895 	EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
       
   896 	return EAP_STATUS_RETURN(m_am_tools, status);
       
   897 }
       
   898 
       
   899 //--------------------------------------------------
       
   900 
       
   901 EAP_FUNC_EXPORT eap_status_e eap_plugin_client_message_if_c::send_data(const void * const data, const u32_t length)
       
   902 {
       
   903 	EAP_TRACE_BEGIN(m_am_tools, TRACE_FLAGS_DEFAULT);
       
   904 
       
   905 	EAP_TRACE_DEBUG(
       
   906 		m_am_tools, 
       
   907 		EAP_TRACE_FLAGS_MESSAGE_DATA, 
       
   908 		(EAPL("eap_plugin_client_message_if_c::send_data(): this = 0x%08x.\n"),
       
   909 		this));
       
   910 
       
   911 	EAP_TRACE_RETURN_STRING_FLAGS(m_am_tools, EAP_TRACE_FLAGS_MESSAGE_DATA, "returns: eap_plugin_client_message_if_c::send_data()");
       
   912 
       
   913 	eap_status_e status(eap_status_process_general_error);
       
   914 
       
   915 	// Parses message data composed of Attribute-Value Pairs.
       
   916 	eap_process_tlv_message_data_c message(m_am_tools);
       
   917 
       
   918 	if (message.get_is_valid() == false)
       
   919 	{
       
   920 		EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
       
   921 		return EAP_STATUS_RETURN(m_am_tools, eap_status_allocation_error);
       
   922 	}
       
   923 
       
   924 	status = message.set_message_data(length, data);
       
   925 	if (status != eap_status_ok)
       
   926 	{
       
   927 		EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
       
   928 		return EAP_STATUS_RETURN(m_am_tools, status);
       
   929 	}
       
   930 
       
   931 	EAP_TRACE_DATA_DEBUG(
       
   932 		m_am_tools,
       
   933 		EAP_TRACE_FLAGS_MESSAGE_DATA,
       
   934 		(EAPL("eap_plugin_client_message_if_c::send_data()"),
       
   935 		message.get_message_data(),
       
   936 		message.get_message_data_length()));
       
   937 
       
   938 	eap_array_c<eap_tlv_header_c> parameters(m_am_tools);
       
   939 
       
   940 	status = message.parse_message_data(&parameters);
       
   941 	if (status != eap_status_ok)
       
   942 	{
       
   943 		EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
       
   944 		return EAP_STATUS_RETURN(m_am_tools, status);
       
   945 	}
       
   946 
       
   947 	if (parameters.get_object_count() == 0)
       
   948 	{
       
   949 		EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
       
   950 		return EAP_STATUS_RETURN(m_am_tools, eap_status_illegal_parameter);
       
   951 	}
       
   952 
       
   953 	const eap_tlv_header_c * const function_header = parameters.get_object(eap_message_payload_index_function);
       
   954 	if (function_header == 0
       
   955 		|| (function_header->get_type() != eap_tlv_message_type_error
       
   956 			&& function_header->get_type() != eap_tlv_message_type_function))
       
   957 	{
       
   958 		EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
       
   959 		return EAP_STATUS_RETURN(m_am_tools, eap_status_illegal_parameter);
       
   960 	}
       
   961 
       
   962 	if (function_header->get_type() == eap_tlv_message_type_error)
       
   963 	{
       
   964 		status = process_message_type_error(&parameters);
       
   965 	}
       
   966 	else // function_header->get_type() == eap_tlv_message_type_function
       
   967 	{
       
   968 		eap_tlv_message_type_function_e function(eap_tlv_message_type_function_none);
       
   969 
       
   970 		status = message.get_parameter_data(function_header, &function);
       
   971 		if (status != eap_status_ok)
       
   972 		{
       
   973 			EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
       
   974 			return EAP_STATUS_RETURN(m_am_tools, status);
       
   975 		}
       
   976 
       
   977 		switch(function)
       
   978 		{
       
   979 		case eap_tlv_message_type_function_plugin_complete_get_configuration:
       
   980 			status = complete_get_configuration(&parameters);
       
   981 			break;
       
   982 		case eap_tlv_message_type_function_plugin_complete_set_configuration:
       
   983 			status = complete_set_configuration(&parameters);
       
   984 			break;
       
   985 		case eap_tlv_message_type_function_plugin_complete_delete_configuration:
       
   986 			status = complete_delete_configuration(&parameters);
       
   987 			break;
       
   988 		case eap_tlv_message_type_function_plugin_complete_copy_configuration:
       
   989 			status = complete_copy_configuration(&parameters);
       
   990 			break;
       
   991 		case eap_tlv_message_type_function_plugin_complete_set_index:
       
   992 			status = complete_set_index(&parameters);
       
   993 			break;
       
   994 		case eap_tlv_message_type_function_plugin_complete_get_type_info:
       
   995 			status = complete_get_type_info(&parameters);
       
   996 			break;
       
   997 		case eap_tlv_message_type_function_plugin_complete_invoke_ui:
       
   998 			status = complete_invoke_ui(&parameters);
       
   999 			break;
       
  1000 		default:
       
  1001 			EAP_TRACE_ERROR(
       
  1002 				m_am_tools,
       
  1003 				TRACE_FLAGS_DEFAULT,
       
  1004 				(EAPL("ERROR: send_data(): unknown function %d.\n"),
       
  1005 				 function));
       
  1006 
       
  1007 			EAP_ASSERT_ANYWAY_TOOLS(m_am_tools);
       
  1008 
       
  1009 			status = EAP_STATUS_RETURN(m_am_tools, eap_status_illegal_parameter);
       
  1010 		};
       
  1011 	}
       
  1012 
       
  1013 	EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
       
  1014 	return EAP_STATUS_RETURN(m_am_tools, status);
       
  1015 }
       
  1016 
       
  1017 //--------------------------------------------------
       
  1018 // End.