eapol/eapol_framework/eapol_common/include/abs_eapol_core.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(_ABS_EAPOL_CORE_H_)
       
    22 #define _ABS_EAPOL_CORE_H_
       
    23 
       
    24 #include "eap_am_types.h"
       
    25 #include "eapol_key_state.h"
       
    26 
       
    27 class eap_am_network_id_c;
       
    28 class eapol_session_key_c;
       
    29 class abs_eap_base_type_c;
       
    30 class eap_rogue_ap_entry_c;
       
    31 class eap_base_type_c;
       
    32 
       
    33 
       
    34 /// The abs_eapol_core_c class defines the interface the eapol_core_c class
       
    35 /// will use with the partner class.
       
    36 /// Later eapol and ethernet could be integrated. Now I am too lazy.
       
    37 class EAP_EXPORT abs_eapol_core_c
       
    38 {
       
    39 private:
       
    40 	//--------------------------------------------------
       
    41 
       
    42 	//--------------------------------------------------
       
    43 protected:
       
    44 	//--------------------------------------------------
       
    45 
       
    46 	//--------------------------------------------------
       
    47 public:
       
    48 	//--------------------------------------------------
       
    49 
       
    50 	/**
       
    51 	 * The destructor does nothing special.
       
    52 	 */
       
    53 	virtual ~abs_eapol_core_c()
       
    54 	{
       
    55 	}
       
    56 
       
    57 	/**
       
    58 	 * The constructor does nothing special.
       
    59 	 */
       
    60 	abs_eapol_core_c()
       
    61 	{
       
    62 	}
       
    63 
       
    64 	/**
       
    65 	 * The derived class could send packets to partner class with this function.
       
    66 	 * @see abs_eap_base_type_c::packet_send().
       
    67 	 */
       
    68 	virtual eap_status_e packet_send(
       
    69 		const eap_am_network_id_c * const network_id,
       
    70 		eap_buf_chain_wr_c * const sent_packet,
       
    71 		const u32_t header_offset,
       
    72 		const u32_t data_length,
       
    73 		const u32_t buffer_length) = 0;
       
    74 
       
    75 	/**
       
    76 	 * The get_header_offset() function obtains the header offset of EAP-packet.
       
    77 	 * @see abs_eap_base_type_c::get_header_offset().
       
    78 	 */
       
    79 	virtual u32_t get_header_offset(
       
    80 		u32_t * const MTU,
       
    81 		u32_t * const trailer_length) = 0;
       
    82 
       
    83 	/**
       
    84 	 * The load_module() function function indicates the lower level to
       
    85 	 * load new module of EAP-type.
       
    86 	 * @see abs_eap_core_c::load_module().
       
    87 	 */
       
    88 	virtual eap_status_e load_module(
       
    89 		const eap_type_value_e type,
       
    90 		const eap_type_value_e /* tunneling_type */,
       
    91 		abs_eap_base_type_c * const partner,
       
    92 		eap_base_type_c ** const eap_type,
       
    93 		const bool is_client_when_true,
       
    94 		const eap_am_network_id_c * const receive_network_id) = 0;
       
    95 
       
    96 	/**
       
    97 	 * The unload_module() function unloads the module of a EAP-type. 
       
    98 	 * @param type is the requested EAP-type.
       
    99 	 */
       
   100 	virtual eap_status_e unload_module(
       
   101 		const eap_type_value_e type) = 0;
       
   102 
       
   103 	/**
       
   104 	 * The packet_data_session_key() function passes one traffic encryption key to 
       
   105 	 * the lower layers. Ultimately the key can end up to the WLAN hardware.
       
   106 	 * @param send_network_id carries the addresses (network identity) and type of the packet.
       
   107 	 * @param key is the encryption key
       
   108 	 * @param key_length is the length of the key
       
   109 	 * @param key_type describes the type of the key (WEP or something else...)
       
   110 	 * @param key_index is the index of the encryption key (there can be four broadcast keys in WEP for example)
       
   111 	 */
       
   112 	virtual eap_status_e packet_data_session_key(
       
   113 		const eap_am_network_id_c * const send_network_id,
       
   114 		const eapol_session_key_c * const key
       
   115 		) = 0;
       
   116 
       
   117 
       
   118 	/**
       
   119 	 * The read_configure() function reads the configuration data identified
       
   120 	 * by the field string of field_length bytes length. Adaptation module must direct
       
   121 	 * the query to some persistent store.
       
   122 	 * @see abs_eap_base_type_c::read_configure().
       
   123 	 */
       
   124 	virtual eap_status_e read_configure(
       
   125 		const eap_configuration_field_c * const field,
       
   126 		eap_variable_data_c * const data) = 0;
       
   127 
       
   128 	/**
       
   129 	 * The write_configure() function writes the configuration data identified
       
   130 	 * by the field string of field_length bytes length. Adaptation module must direct
       
   131 	 * the action to some persistent store.
       
   132 	 * @see abs_eap_base_type_c::write_configure().
       
   133 	 */
       
   134 	virtual eap_status_e write_configure(
       
   135 		const eap_configuration_field_c * const field,
       
   136 		eap_variable_data_c * const data) = 0;
       
   137 
       
   138 	/**
       
   139 	 * This is notification of internal state transition.
       
   140 	 * This is used for notifications, debugging and protocol testing.
       
   141 	 * The primal notifications are eap_state_variable_e::eap_state_authentication_finished_successfully
       
   142 	 * and eap_state_variable_e::eap_state_authentication_terminated_unsuccessfully.
       
   143 	 * These two notifications are sent from EAP-protocol layer (eap_protocol_layer_e::eap_protocol_layer_eap).
       
   144 	 */
       
   145 	virtual void state_notification(
       
   146 		const abs_eap_state_notification_c * const state) = 0;
       
   147 
       
   148 	/**
       
   149 	 * The set_timer() function initializes timer to be elapsed after p_time_ms milliseconds.
       
   150 	 * @param initializer is pointer to object which timer_expired() function will
       
   151 	 * be called after timer elapses.
       
   152 	 * @param id is identifier which will be returned in timer_expired() function.
       
   153 	 * The user selects and interprets the id for this timer.
       
   154 	 * @param data is pointer to any user selected data which will be returned in timer_expired() function.
       
   155 	 *
       
   156 	 * Adaptation module internally implements the timer.
       
   157 	 */
       
   158 	virtual eap_status_e set_timer(
       
   159 		abs_eap_base_timer_c * const initializer, 
       
   160 		const u32_t id, 
       
   161 		void * const data,
       
   162 		const u32_t p_time_ms) = 0;
       
   163 
       
   164 	/**
       
   165 	 * The cancel_timer() function cancels the timer id initiated by initializer.
       
   166 	 *
       
   167 	 * Adaptation module internally implements the timer.
       
   168 	 */
       
   169 	virtual eap_status_e cancel_timer(
       
   170 		abs_eap_base_timer_c * const initializer, 
       
   171 		const u32_t id) = 0;
       
   172 
       
   173 	/**
       
   174 	 * The cancel_all_timers() function cancels all timers.
       
   175 	 * User should use this in termination of the stack before
       
   176 	 * the adaptation module of tools is deleted.
       
   177 	 * Preferred mode is to cancel each timer directly
       
   178 	 * using cancel_timer() function.
       
   179 	 *
       
   180 	 * Adaptation module internally implements the timer.
       
   181 	 */
       
   182 	virtual eap_status_e cancel_all_timers() = 0;
       
   183 
       
   184 	/**
       
   185 	 * This function queries the validity of EAP-type.
       
   186 	 * Lower layer should return eap_status_ok if this EAP-type is supported.
       
   187 	 */
       
   188 	virtual eap_status_e check_is_valid_eap_type(const eap_type_value_e eap_type) = 0;
       
   189 
       
   190 	/**
       
   191 	 * This function queries the list of supported EAP-types.
       
   192 	 * Lower layer should return eap_status_ok if this call succeeds.
       
   193 	 * @param eap_type_list will include the list of supported EAP-types. Each value in list
       
   194 	 * is type of u32_t and represent one supported EAP-type. List consists of subsequent u32_t type values.
       
   195 	 */
       
   196 	virtual eap_status_e get_eap_type_list(
       
   197 		eap_array_c<eap_type_value_e> * const eap_type_list) = 0;
       
   198 
       
   199 	virtual eap_status_e add_rogue_ap(eap_array_c<eap_rogue_ap_entry_c> & rogue_ap_list) = 0;
       
   200 
       
   201 //--------------------------------------------------
       
   202 }; // class abs_eapol_core_c
       
   203 
       
   204 #endif //#if !defined(_ABS_EAPOL_CORE_H_)
       
   205 
       
   206 //--------------------------------------------------
       
   207 
       
   208 
       
   209 
       
   210 // End.