eapol/eapol_framework/eapol_common/am/include/abs_eap_am_bloom_algorithm_store.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 #if !defined(_ABS_EAP_AM_BLOOM_ALGORITHM_STORE_H_)
       
    21 #define _ABS_EAP_AM_BLOOM_ALGORITHM_STORE_H_
       
    22 
       
    23 
       
    24 #include "eap_tools.h"
       
    25 
       
    26 //--------------------------------------------------
       
    27 
       
    28 /// This is interface to bit store of the Bloom filter algorithm.
       
    29 /** The bit store should be divided to two stores.
       
    30  *  New bits are stored to the current bit store.
       
    31  *  When current bit store becames over populated it should be
       
    32  *  changed previous bit store and a new current bit store should be created.
       
    33  *  Each bit index should be checked from current and previous bit stores.
       
    34  *  Over population can be calculated from count of set bit and size of the bit store.
       
    35  *  When half of the bits are set probability of false filtering will increse
       
    36  *  much faster. Probability of false filtering is saturation raised power to bit index count.
       
    37  *  Saturation is count of set bits divided by size of bit store.
       
    38  *  Bit index count is count of separate indexes extracted from hash digest.
       
    39  *  Each index is n bits long. The size of the bit store is 2^n bits.
       
    40  */
       
    41 class EAP_EXPORT abs_eap_am_bloom_algorithm_store_c
       
    42 {
       
    43 
       
    44 private:
       
    45 
       
    46 	/**
       
    47 	 * The set_is_valid() function sets the state of the object valid.
       
    48 	 * The creator of this object calls this function after it is initialized. 
       
    49 	 */
       
    50 	virtual void set_is_valid() = 0;
       
    51 
       
    52 public:
       
    53 
       
    54 	/**
       
    55 	 * The destructor of the abs_eap_am_bloom_algorithm_store_c class does nothing special.
       
    56 	 */
       
    57 	EAP_FUNC_IMPORT virtual ~abs_eap_am_bloom_algorithm_store_c()
       
    58 	{
       
    59 	}
       
    60 
       
    61 	/**
       
    62 	 * The constructor of the abs_eap_am_bloom_algorithm_store_c does nothing special.
       
    63 	 */
       
    64 	EAP_FUNC_IMPORT abs_eap_am_bloom_algorithm_store_c()
       
    65 	{
       
    66 	}
       
    67 
       
    68 	/**
       
    69 	 * This function sets the name of the bit store.
       
    70 	 * Store name is 8-bit string without terminating NULL.
       
    71 	 */
       
    72 	virtual eap_status_e set_name_of_store(const eap_variable_data_c * const store_name) = 0;
       
    73 
       
    74 	/**
       
    75 	 * This function checks the bit store exists.
       
    76 	 * Function should return eap_status_ok when bit store exists and is valid.
       
    77 	 */
       
    78 	virtual eap_status_e bloom_filter_check_does_bit_store_exists() = 0;
       
    79 
       
    80 	/**
       
    81 	 * This is the count of bits in the index of Bloom algorithm.
       
    82 	 */
       
    83 	virtual eap_status_e set_bloom_bit_index_size(const u32_t bloom_bit_index_size) = 0;
       
    84 
       
    85 	/**
       
    86 	 * This function returns the bit value of queried bit from the current and previous bit store.
       
    87 	 * @param bit_index indicates the queried bit.
       
    88 	 */
       
    89 	virtual u32_t bloom_filter_get_bit_index(const u32_t bit_index) = 0;
       
    90 
       
    91 	/**
       
    92 	 * This function sets the bit value of queried bit to the bit store.
       
    93 	 * @param bit_index indicates the queried bit.
       
    94 	 */
       
    95 	virtual eap_status_e bloom_filter_set_bit_index(const u32_t bit_index) = 0;
       
    96 
       
    97 	/**
       
    98 	 * Object must indicate it's validity.
       
    99 	 * If object initialization fails this function must return false.
       
   100 	 * @return This function returns the validity of this object.
       
   101 	 */
       
   102 	virtual bool get_is_valid() = 0;
       
   103 
       
   104 }; // class eap_am_bloom_algorithm_c
       
   105 
       
   106 #endif //#if !defined(_ABS_EAP_AM_BLOOM_ALGORITHM_STORE_H_)
       
   107 
       
   108 //--------------------------------------------------
       
   109 
       
   110 
       
   111 
       
   112 // End.