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