eapol/eapol_framework/eapol_common/include/eap_core_map.h
changeset 0 c8830336c852
child 2 1c7bc153c08e
equal deleted inserted replaced
-1:000000000000 0:c8830336c852
       
     1 /*
       
     2 * Copyright (c) 2001-2006 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 and WLAN authentication protocols.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 
       
    21 #if !defined(_EAP_TYPE_MAP_H_)
       
    22 #define _EAP_TYPE_MAP_H_
       
    23 
       
    24 #include "eap_am_memory.h"
       
    25 #include "eap_am_export.h"
       
    26 #include "abs_eap_core_map.h"
       
    27 #include "eap_variable_data.h"
       
    28 #include "eap_am_tools.h"
       
    29 
       
    30 
       
    31 const u32_t EAP_MAP_SIZE = 256;
       
    32 
       
    33 
       
    34 #if defined(_WIN32) && !defined(__GNUC__)
       
    35 	#pragma warning (disable : 4251)
       
    36 #endif
       
    37 
       
    38 
       
    39 //
       
    40 template <class Type, class Selector_Type>
       
    41 class EAP_EXPORT eap_state_map_atom_c
       
    42 {
       
    43 private:
       
    44 
       
    45 	abs_eap_am_tools_c * const m_am_tools;
       
    46 
       
    47 	Type *m_object;
       
    48 	Selector_Type *m_selector;
       
    49 	eap_state_map_atom_c<Type, Selector_Type> *m_next_atom;
       
    50 
       
    51 	bool m_is_valid;
       
    52 
       
    53 public:
       
    54 
       
    55 	//
       
    56 	virtual ~eap_state_map_atom_c()
       
    57 	{
       
    58 		EAP_TRACE_BEGIN(m_am_tools, TRACE_FLAGS_DEFAULT);
       
    59 
       
    60 		EAP_TRACE_DEBUG(
       
    61 			m_am_tools,
       
    62 			EAP_TRACE_MASK_HASH_MAP,
       
    63 			(EAPL("CORE_MAP: ~eap_state_map_atom_c(): this 0x%08x starts.\n"),
       
    64 			 this));
       
    65 
       
    66 		if (m_selector != 0)
       
    67 		{
       
    68 			EAP_TRACE_DEBUG(
       
    69 				m_am_tools,
       
    70 				EAP_TRACE_MASK_HASH_MAP,
       
    71 				(EAPL("CORE_MAP: ~eap_state_map_atom_c(): delete m_selector starts: selector 0x%08x.\n"),
       
    72 				 m_selector));
       
    73 
       
    74 			delete m_selector;
       
    75 
       
    76 			EAP_TRACE_DEBUG(
       
    77 				m_am_tools,
       
    78 				EAP_TRACE_MASK_HASH_MAP,
       
    79 				(EAPL("CORE_MAP: ~eap_state_map_atom_c(): delete m_selector ends.\n")));
       
    80 
       
    81 			m_selector = 0;
       
    82 		}
       
    83 
       
    84 		if (m_object != 0)
       
    85 		{
       
    86 			EAP_TRACE_DEBUG(
       
    87 				m_am_tools,
       
    88 				EAP_TRACE_MASK_HASH_MAP,
       
    89 				(EAPL("CORE_MAP: ~eap_state_map_atom_c(): delete m_object starts: object 0x%08x.\n"),
       
    90 				 m_object));
       
    91 
       
    92 			delete m_object;
       
    93 
       
    94 			EAP_TRACE_DEBUG(
       
    95 				m_am_tools,
       
    96 				EAP_TRACE_MASK_HASH_MAP,
       
    97 				(EAPL("CORE_MAP: ~eap_state_map_atom_c(): delete m_object ends.\n")));
       
    98 
       
    99 			m_object = 0;
       
   100 		}
       
   101 
       
   102 		if (m_next_atom != 0)
       
   103 		{
       
   104 			EAP_TRACE_DEBUG(
       
   105 				m_am_tools,
       
   106 				EAP_TRACE_MASK_HASH_MAP,
       
   107 				(EAPL("CORE_MAP: ~eap_state_map_atom_c(): delete m_next_atom starts: next atom 0x%08x.\n"),
       
   108 				 m_next_atom));
       
   109 
       
   110 			delete m_next_atom;
       
   111 
       
   112 			EAP_TRACE_DEBUG(
       
   113 				m_am_tools,
       
   114 				EAP_TRACE_MASK_HASH_MAP,
       
   115 				(EAPL("CORE_MAP: ~eap_state_map_atom_c(): delete m_next_atom ends.\n")));
       
   116 
       
   117 			m_next_atom = 0;
       
   118 		}
       
   119 		EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
       
   120 	}
       
   121 
       
   122 	//
       
   123 	eap_state_map_atom_c()
       
   124 		: m_am_tools(0)
       
   125 		, m_object(0)
       
   126 		, m_selector(0)
       
   127 		, m_next_atom(0)
       
   128 		, m_is_valid(false)
       
   129 	{
       
   130 	}
       
   131 
       
   132 	//
       
   133 	eap_state_map_atom_c(
       
   134 		Selector_Type * const p_selector,
       
   135 		abs_eap_am_tools_c * const tools,
       
   136 		Type * const p_object)
       
   137 		: m_am_tools(tools)
       
   138 		, m_object(p_object)
       
   139 		, m_selector(p_selector)
       
   140 		, m_next_atom(0)
       
   141 		, m_is_valid(false)
       
   142 	{
       
   143 		if (m_am_tools == 0
       
   144 			|| m_am_tools->get_is_valid() == false
       
   145 			|| m_object == 0
       
   146 			|| m_selector == 0)
       
   147 		{
       
   148 			return;
       
   149 		}
       
   150 
       
   151 		set_is_valid();
       
   152 	}
       
   153 
       
   154 	//
       
   155 	Type * const get_object()
       
   156 	{
       
   157 		return m_object;
       
   158 	}
       
   159 
       
   160 	//
       
   161 	const Type * const get_const_object() const
       
   162 	{
       
   163 		return m_object;
       
   164 	}
       
   165 
       
   166 	//
       
   167 	void set_object(Type * const p_type)
       
   168 	{
       
   169 		m_object = p_type;
       
   170 	}
       
   171 
       
   172 	const Selector_Type * const get_selector() const
       
   173 	{
       
   174 		return m_selector;
       
   175 	}
       
   176 
       
   177 	eap_state_map_atom_c * const get_next_atom() const
       
   178 	{
       
   179 		return m_next_atom;
       
   180 	}
       
   181 
       
   182 	void set_next_atom(eap_state_map_atom_c<Type, Selector_Type> * const next)
       
   183 	{
       
   184 		m_next_atom = next;
       
   185 	}
       
   186 
       
   187 	void set_is_valid()
       
   188 	{
       
   189 		m_is_valid = true;
       
   190 	}
       
   191 
       
   192 	bool get_is_valid()
       
   193 	{
       
   194 		return m_is_valid;
       
   195 	}
       
   196 };
       
   197 
       
   198 
       
   199 /// This template class stores the Type identified with Selector_Type.
       
   200 /**
       
   201   * A eap_core_map_c template class.
       
   202   * The eap_core_map_c template class includes an array that is indexed with 
       
   203   * type of Selector_Type parameter.
       
   204   * @param Type template parameter is the actual type which is stored.
       
   205   * @param Abs_Type template parameter is the abstract partner type of Type.
       
   206   * @param Selector_Type template type is the type of the selector object.
       
   207   * The Selector_Type could be any class that offers three functions with 
       
   208   * the following prototypes:
       
   209   * @code
       
   210   * i32_t compare(
       
   211   * 	const Selector_Type * const data) const;
       
   212   * 
       
   213   * u32_t hash(
       
   214   * 	const u32_t size) const;
       
   215   * 
       
   216   * Selector_Type * const copy() const;
       
   217   * @endcode
       
   218   *
       
   219   * The Type could be any class that offers two functions with
       
   220   * the following prototypes:
       
   221   * @code
       
   222   * void object_increase_reference_count();
       
   223   *
       
   224   * u32_t object_decrease_reference_count();
       
   225   *
       
   226   * @endcode
       
   227   *
       
   228   */
       
   229 template <class Type, class Abs_Type, class Selector_Type>
       
   230 class EAP_EXPORT eap_core_map_c
       
   231 {
       
   232 private:
       
   233 	//--------------------------------------------------
       
   234 
       
   235 	/// This is back pointer to object which created this object.
       
   236 	Abs_Type * const m_partner;
       
   237 
       
   238 	/// This is hash-table to all objects stored to the eap_core_map object.
       
   239 	/// Objects are stored using the eap_state_map_atom template class.
       
   240 	eap_state_map_atom_c<Type, Selector_Type> *m_map[EAP_MAP_SIZE];
       
   241 
       
   242 	/// This is pointer to the tools class. 
       
   243 	abs_eap_am_tools_c * const m_am_tools;
       
   244 
       
   245 	//--------------------------------------------------
       
   246 protected:
       
   247 	//--------------------------------------------------
       
   248 
       
   249 	//--------------------------------------------------
       
   250 public:
       
   251 	//--------------------------------------------------
       
   252 
       
   253 	/**
       
   254 	 * The destructor of the eap_core_map template class deletes all stored objects.
       
   255 	 */
       
   256 	virtual ~eap_core_map_c()
       
   257 	{
       
   258 		EAP_TRACE_BEGIN(m_am_tools, TRACE_FLAGS_DEFAULT);
       
   259 
       
   260 		(void) reset();
       
   261 
       
   262 		EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
       
   263 	}
       
   264 
       
   265 	/**
       
   266 	 * The constructor initializes attributes using the passed parameters.
       
   267 	 * Each pointer of m_map array is initialized null.
       
   268 	 * @param tools is pointer to the tools class. @see abs_eap_am_tools_c.
       
   269 	 * @param partner is back pointer to object which created this object.
       
   270 	 */
       
   271 	eap_core_map_c(
       
   272 		abs_eap_am_tools_c * const tools,
       
   273 		Abs_Type * const partner)
       
   274 	: m_partner(partner)
       
   275 	, m_am_tools(tools)
       
   276 	{
       
   277 		EAP_TRACE_BEGIN(m_am_tools, TRACE_FLAGS_DEFAULT);
       
   278 		for (u32_t ind = 0u; ind < EAP_MAP_SIZE; ind++)
       
   279 		{
       
   280 			m_map[ind] = 0;
       
   281 		}
       
   282 		EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
       
   283 	}
       
   284 
       
   285 	u32_t get_atom_count() const
       
   286 	{
       
   287 		return EAP_MAP_SIZE;
       
   288 	}
       
   289 
       
   290 	const eap_state_map_atom_c<Type, Selector_Type> *get_atom(const u32_t index) const
       
   291 	{
       
   292 		if (index >= EAP_MAP_SIZE)
       
   293 		{
       
   294 			return 0;
       
   295 		}
       
   296 
       
   297 		return m_map[index];
       
   298 	}
       
   299 
       
   300 	/**
       
   301 	 * The add_handler() function stores a new type to the eap_core_map object.
       
   302 	 * @param p_selector is pointer to a selector object.
       
   303 	 * The p_selector object identifies the stored type.
       
   304 	 * @param type is pointer to the stored object.
       
   305 	 */
       
   306 	eap_status_e add_handler(
       
   307 		const Selector_Type * const p_selector,
       
   308 		Type * const object)
       
   309 	{
       
   310 		EAP_TRACE_BEGIN(m_am_tools, TRACE_FLAGS_DEFAULT);
       
   311 
       
   312 		const u32_t index = p_selector->hash(EAP_MAP_SIZE);
       
   313 
       
   314 		if (index >= EAP_MAP_SIZE)
       
   315 		{
       
   316 			return EAP_STATUS_RETURN(m_am_tools, eap_status_illegal_hashed_index);
       
   317 		}
       
   318 
       
   319 		eap_state_map_atom_c<Type, Selector_Type> *cursor = m_map[index];
       
   320 		eap_state_map_atom_c<Type, Selector_Type> *last_cursor = 0;
       
   321 
       
   322 		EAP_TRACE_DEBUG(
       
   323 			m_am_tools,
       
   324 			EAP_TRACE_MASK_HASH_MAP,
       
   325 			(EAPL("CORE_MAP: add_handler(): index %d\n"),
       
   326 			index));
       
   327 
       
   328 		EAP_TRACE_DATA_DEBUG(
       
   329 			m_am_tools,
       
   330 			EAP_TRACE_MASK_HASH_MAP,
       
   331 			(EAPL("CORE_MAP: selector"),
       
   332 			p_selector->get_data(p_selector->get_data_length()),
       
   333 			p_selector->get_data_length()));
       
   334 
       
   335 		while (cursor != 0)
       
   336 		{
       
   337 			EAP_TRACE_DEBUG(
       
   338 				m_am_tools,
       
   339 				EAP_TRACE_MASK_HASH_MAP,
       
   340 				(EAPL("CORE_MAP: add_handler(): cursor 0x%08x\n"),
       
   341 				cursor));
       
   342 
       
   343 			if (p_selector->compare(cursor->get_selector()) == 0)
       
   344 			{
       
   345 				// match
       
   346 				break;
       
   347 			}
       
   348 			last_cursor = cursor;
       
   349 			cursor = cursor->get_next_atom();
       
   350 		}
       
   351 
       
   352 		if (cursor != 0)
       
   353 		{
       
   354 			// Already exists.
       
   355 			return EAP_STATUS_RETURN(m_am_tools, eap_status_handler_exists_error);
       
   356 		}
       
   357 		else
       
   358 		{
       
   359 			eap_state_map_atom_c<Type, Selector_Type> *atom
       
   360 				= new eap_state_map_atom_c<Type, Selector_Type>(
       
   361 					p_selector->copy(), m_am_tools, object);
       
   362 
       
   363 			if (atom == 0
       
   364 				|| atom->get_is_valid() == false)
       
   365 			{
       
   366 				delete atom;
       
   367 				return EAP_STATUS_RETURN(m_am_tools, eap_status_allocation_error);
       
   368 			}
       
   369 
       
   370 			EAP_TRACE_DEBUG(
       
   371 				m_am_tools,
       
   372 				EAP_TRACE_MASK_HASH_MAP,
       
   373 				(EAPL("CORE_MAP: add_handler(): atom 0x%08x, object 0x%08x\n"),
       
   374 				atom,
       
   375 				object));
       
   376 
       
   377 			if (last_cursor != 0)
       
   378 			{
       
   379 				last_cursor->set_next_atom(atom);
       
   380 			}
       
   381 			else
       
   382 			{
       
   383 				m_map[index] = atom;
       
   384 			}
       
   385 
       
   386 			object->object_increase_reference_count();
       
   387 		}
       
   388 
       
   389 		EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
       
   390 		return eap_status_ok;
       
   391 	}
       
   392 
       
   393 
       
   394 	/**
       
   395 	 * @return The get_handler() function returns a pointer to the type object or NULL.
       
   396 	 * @param p_selector is pointer to a selector object.
       
   397 	 * The p_selector object identifies the required object.
       
   398 	 */
       
   399 	Type * const get_handler(
       
   400 		const Selector_Type * const p_selector) const
       
   401 	{
       
   402 		EAP_TRACE_BEGIN(m_am_tools, TRACE_FLAGS_DEFAULT);
       
   403 
       
   404 		if (p_selector->get_is_valid() == false)
       
   405 		{
       
   406 			return 0;
       
   407 		}
       
   408 
       
   409 		Type *object = 0;
       
   410 		const u32_t index = p_selector->hash(EAP_MAP_SIZE);
       
   411 
       
   412 		if (index >= EAP_MAP_SIZE)
       
   413 		{
       
   414 			return 0;
       
   415 		}
       
   416 
       
   417 		eap_state_map_atom_c<Type, Selector_Type> *cursor = m_map[index];
       
   418 
       
   419 		EAP_TRACE_DEBUG(
       
   420 			m_am_tools,
       
   421 			EAP_TRACE_MASK_HASH_MAP,
       
   422 			(EAPL("CORE_MAP: get_handler(): index %d\n"),
       
   423 			index));
       
   424 
       
   425 		EAP_TRACE_DATA_DEBUG(
       
   426 			m_am_tools,
       
   427 			EAP_TRACE_MASK_HASH_MAP,
       
   428 			(EAPL("CORE_MAP: selector"),
       
   429 			p_selector->get_data(p_selector->get_data_length()),
       
   430 			p_selector->get_data_length()));
       
   431 
       
   432 		while (cursor != 0)
       
   433 		{
       
   434 			EAP_TRACE_DEBUG(
       
   435 				m_am_tools,
       
   436 				EAP_TRACE_MASK_HASH_MAP,
       
   437 				(EAPL("CORE_MAP: get_handler(): cursor 0x%08x\n"),
       
   438 				cursor));
       
   439 
       
   440 			if (p_selector->compare(cursor->get_selector()) == 0)
       
   441 			{
       
   442 				// match
       
   443 				break;
       
   444 			}
       
   445 
       
   446 			cursor = cursor->get_next_atom();
       
   447 		}
       
   448 
       
   449 		if (cursor != 0)
       
   450 		{
       
   451 			object = cursor->get_object();
       
   452 
       
   453 			EAP_TRACE_DEBUG(
       
   454 				m_am_tools,
       
   455 				EAP_TRACE_MASK_HASH_MAP,
       
   456 				(EAPL("CORE_MAP: get_handler(): found cursor 0x%08x\n"),
       
   457 				cursor));
       
   458 
       
   459 			EAP_TRACE_DEBUG(
       
   460 				m_am_tools,
       
   461 				EAP_TRACE_MASK_HASH_MAP,
       
   462 				(EAPL("CORE_MAP: get_handler(): found object 0x%08x\n"),
       
   463 				object));
       
   464 		}
       
   465 		else
       
   466 		{
       
   467 			EAP_TRACE_DEBUG(
       
   468 				m_am_tools,
       
   469 				EAP_TRACE_MASK_HASH_MAP,
       
   470 				(EAPL("CORE_MAP: get_handler(): NOT found\n")));
       
   471 		}
       
   472 
       
   473 		EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
       
   474 		return object;
       
   475 	}
       
   476 
       
   477 
       
   478 	/**
       
   479 	 * The remove_handler() function removes and deletes the object from MAP.
       
   480 	 * @param p_selector is pointer to a selector object.
       
   481 	 * @param delete_object tells whether the object is deleted (true) or not (false).
       
   482 	 * The p_selector object identifies the removed object.
       
   483 	 */
       
   484 	eap_status_e remove_handler(
       
   485 		const Selector_Type * const p_selector,
       
   486 		const bool delete_object)
       
   487 	{
       
   488 		EAP_TRACE_BEGIN(m_am_tools, TRACE_FLAGS_DEFAULT);
       
   489 
       
   490 		const u32_t index = p_selector->hash(EAP_MAP_SIZE);
       
   491 
       
   492 		if (index >= EAP_MAP_SIZE)
       
   493 		{
       
   494 			return EAP_STATUS_RETURN(m_am_tools, eap_status_illegal_hashed_index);
       
   495 		}
       
   496 
       
   497 		eap_state_map_atom_c<Type, Selector_Type> *cursor = m_map[index];
       
   498 		eap_state_map_atom_c<Type, Selector_Type> *last_cursor = 0;
       
   499 
       
   500 		EAP_TRACE_DEBUG(
       
   501 			m_am_tools,
       
   502 			EAP_TRACE_MASK_HASH_MAP,
       
   503 			(EAPL("CORE_MAP: remove_handler(): index %d\n"),
       
   504 			index));
       
   505 
       
   506 		EAP_TRACE_DATA_DEBUG(
       
   507 			m_am_tools,
       
   508 			EAP_TRACE_MASK_HASH_MAP,
       
   509 			(EAPL("CORE_MAP: selector"),
       
   510 			p_selector->get_data(p_selector->get_data_length()),
       
   511 			p_selector->get_data_length()));
       
   512 
       
   513 		while (cursor != 0)
       
   514 		{
       
   515 			EAP_TRACE_DEBUG(
       
   516 				m_am_tools,
       
   517 				EAP_TRACE_MASK_HASH_MAP,
       
   518 				(EAPL("CORE_MAP: remove_handler(): cursor 0x%08x\n"),
       
   519 				cursor));
       
   520 
       
   521 			if (p_selector->compare(cursor->get_selector()) == 0)
       
   522 			{
       
   523 				if (cursor->get_object()->object_decrease_reference_count() > 0u)
       
   524 				{
       
   525 					// Other users of the EAP-type are still active.
       
   526 					EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
       
   527 					return EAP_STATUS_RETURN(m_am_tools, eap_status_state_reference_count_not_zero);
       
   528 				}
       
   529 				// match
       
   530 				break;
       
   531 			}
       
   532 			last_cursor = cursor;
       
   533 			cursor = cursor->get_next_atom();
       
   534 		}
       
   535 
       
   536 		if (cursor == 0)
       
   537 		{
       
   538 			EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
       
   539 			return EAP_STATUS_RETURN(m_am_tools, eap_status_handler_does_not_exists_error);
       
   540 		}
       
   541 
       
   542 		EAP_TRACE_DEBUG(
       
   543 			m_am_tools,
       
   544 			EAP_TRACE_MASK_HASH_MAP,
       
   545 			(EAPL("CORE_MAP: remove_handler(): cursor 0x%08x, object 0x%08x\n"),
       
   546 			cursor,
       
   547 			cursor->get_object()));
       
   548 
       
   549 		if (last_cursor != 0)
       
   550 		{
       
   551 			last_cursor->set_next_atom(cursor->get_next_atom());
       
   552 		}
       
   553 		else
       
   554 		{
       
   555 			m_map[index] = cursor->get_next_atom();
       
   556 		}
       
   557 		cursor->set_next_atom(0);
       
   558 
       
   559 		if (delete_object == false)
       
   560 		{
       
   561 			// Object will be used on other location.
       
   562 			// We do not delete it here.
       
   563 			cursor->set_object(0);
       
   564 		}
       
   565 
       
   566 		delete cursor;
       
   567 
       
   568 		EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
       
   569 		return eap_status_ok;
       
   570 	}
       
   571 
       
   572 
       
   573 	/**
       
   574 	 * The for_each() function runs function for the each object in the MAP.
       
   575 	 * @param p_selector is pointer to a selector object.
       
   576 	 * The p_selector object identifies the removed object.
       
   577 	 */
       
   578 	eap_status_e for_each(
       
   579 		eap_status_e (*function)(
       
   580 			Type * const value,
       
   581 			abs_eap_am_tools_c * const m_am_tools),
       
   582 		const bool /* do_not_care_errors */)
       
   583 	{
       
   584 		EAP_TRACE_BEGIN(m_am_tools, TRACE_FLAGS_DEFAULT);
       
   585 
       
   586 		u32_t index = 0ul;
       
   587 
       
   588 		for (index = 0ul; index < EAP_MAP_SIZE; index++)
       
   589 		{
       
   590 			eap_state_map_atom_c<Type, Selector_Type> *cursor = m_map[index];
       
   591 
       
   592 			while (cursor != 0)
       
   593 			{
       
   594 				eap_status_e status = function(cursor->get_object(), m_am_tools);
       
   595 
       
   596 				if (status != eap_status_ok)
       
   597 				{
       
   598 					EAP_TRACE_DEBUG(
       
   599 						m_am_tools,
       
   600 						EAP_TRACE_MASK_HASH_MAP,
       
   601 						(EAPL("CORE_MAP: ERROR: for_each(): cursor 0x%08x, status %d\n"),
       
   602 						 cursor,
       
   603 						 status));
       
   604 				}
       
   605 
       
   606 				cursor = cursor->get_next_atom();
       
   607 
       
   608 			} // while()
       
   609 		} // for()
       
   610 
       
   611 		EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
       
   612 		return eap_status_ok;
       
   613 	}
       
   614 
       
   615 	bool get_is_valid()
       
   616 	{
       
   617 		return true;
       
   618 	}
       
   619 
       
   620 	eap_status_e reset()
       
   621 	{
       
   622 		EAP_TRACE_BEGIN(m_am_tools, TRACE_FLAGS_DEFAULT);
       
   623 
       
   624 		EAP_TRACE_DEBUG(
       
   625 			m_am_tools,
       
   626 			EAP_TRACE_MASK_HASH_MAP,
       
   627 			(EAPL("CORE_MAP: eap_core_map_c::reset(): this 0x%08x starts.\n"),
       
   628 			 this));
       
   629 
       
   630 		for (u32_t ind = 0u; ind < EAP_MAP_SIZE; ind++)
       
   631 		{
       
   632 			if (m_map[ind] != 0)
       
   633 			{
       
   634 				EAP_TRACE_DEBUG(
       
   635 					m_am_tools,
       
   636 					EAP_TRACE_MASK_HASH_MAP,
       
   637 					(EAPL("CORE_MAP: eap_core_map_c::reset(): delete m_map[%d], atom 0x%08x starts.\n"),
       
   638 					ind,
       
   639 					m_map[ind]));
       
   640 
       
   641 				eap_state_map_atom_c<Type, Selector_Type> *tmp = m_map[ind];
       
   642 				m_map[ind] = 0;
       
   643 				delete tmp;
       
   644 
       
   645 				EAP_TRACE_DEBUG(
       
   646 					m_am_tools,
       
   647 					EAP_TRACE_MASK_HASH_MAP,
       
   648 					(EAPL("CORE_MAP: eap_core_map_c::reset(): delete m_map[%d] ends.\n"),
       
   649 					ind));
       
   650 			}
       
   651 		}
       
   652 
       
   653 		EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT);
       
   654 		return eap_status_ok;
       
   655 	}
       
   656 
       
   657 	//--------------------------------------------------
       
   658 }; // class eap_core_map_c
       
   659 
       
   660 #endif //#if !defined(_EAP_TYPE_MAP_H_)
       
   661 
       
   662 
       
   663 //--------------------------------------------------
       
   664 
       
   665 
       
   666 
       
   667 // End.