eapol/eapol_framework/eapol_common/include/eap_core_server_message_if.h
changeset 49 43351a4f2da3
parent 26 9abfd4f00d37
equal deleted inserted replaced
47:712b4ffd76bb 49:43351a4f2da3
    22 #if !defined(_EAP_CORE_SERVER_MESSAGE_IF_H_)
    22 #if !defined(_EAP_CORE_SERVER_MESSAGE_IF_H_)
    23 #define _EAP_CORE_SERVER_MESSAGE_IF_H_
    23 #define _EAP_CORE_SERVER_MESSAGE_IF_H_
    24 
    24 
    25 #include "eap_tools.h"
    25 #include "eap_tools.h"
    26 #include "eap_am_export.h"
    26 #include "eap_am_export.h"
       
    27 // Start: added by script change_export_macros.sh.
       
    28 #if defined(EAP_NO_EXPORT_EAP_CORE_SERVER_MESSAGE_IF_H)
       
    29 	#define EAP_CLASS_VISIBILITY_EAP_CORE_SERVER_MESSAGE_IF_H EAP_NONSHARABLE 
       
    30 	#define EAP_FUNC_VISIBILITY_EAP_CORE_SERVER_MESSAGE_IF_H 
       
    31 	#define EAP_C_FUNC_VISIBILITY_EAP_CORE_SERVER_MESSAGE_IF_H 
       
    32 	#define EAP_FUNC_EXPORT_EAP_CORE_SERVER_MESSAGE_IF_H 
       
    33 	#define EAP_C_FUNC_EXPORT_EAP_CORE_SERVER_MESSAGE_IF_H 
       
    34 #elif defined(EAP_EXPORT_EAP_CORE_SERVER_MESSAGE_IF_H)
       
    35 	#define EAP_CLASS_VISIBILITY_EAP_CORE_SERVER_MESSAGE_IF_H EAP_EXPORT 
       
    36 	#define EAP_FUNC_VISIBILITY_EAP_CORE_SERVER_MESSAGE_IF_H EAP_FUNC_EXPORT 
       
    37 	#define EAP_C_FUNC_VISIBILITY_EAP_CORE_SERVER_MESSAGE_IF_H EAP_C_FUNC_EXPORT 
       
    38 	#define EAP_FUNC_EXPORT_EAP_CORE_SERVER_MESSAGE_IF_H EAP_FUNC_EXPORT 
       
    39 	#define EAP_C_FUNC_EXPORT_EAP_CORE_SERVER_MESSAGE_IF_H EAP_C_FUNC_EXPORT 
       
    40 #else
       
    41 	#define EAP_CLASS_VISIBILITY_EAP_CORE_SERVER_MESSAGE_IF_H EAP_IMPORT 
       
    42 	#define EAP_FUNC_VISIBILITY_EAP_CORE_SERVER_MESSAGE_IF_H EAP_FUNC_IMPORT 
       
    43 	#define EAP_C_FUNC_VISIBILITY_EAP_CORE_SERVER_MESSAGE_IF_H EAP_C_FUNC_IMPORT 
       
    44 	#define EAP_FUNC_EXPORT_EAP_CORE_SERVER_MESSAGE_IF_H 
       
    45 	#define EAP_C_FUNC_EXPORT_EAP_CORE_SERVER_MESSAGE_IF_H 
       
    46 #endif
       
    47 // End: added by script change_export_macros.sh.
    27 #include "abs_eap_session_core.h"
    48 #include "abs_eap_session_core.h"
    28 #include "eap_variable_data.h"
    49 #include "eap_variable_data.h"
    29 #include "abs_eap_am_mutex.h"
    50 #include "abs_eap_am_mutex.h"
    30 #include "eap_session_core_base.h"
    51 #include "eap_session_core_base.h"
    31 #include "abs_eap_am_message_if.h"
    52 #include "abs_eap_am_message_if.h"
    44 
    65 
    45 /** @file */
    66 /** @file */
    46 
    67 
    47 
    68 
    48 /// A eap_core_server_message_if_c class implements the basic functionality of EAPOL.
    69 /// A eap_core_server_message_if_c class implements the basic functionality of EAPOL.
    49 class EAP_EXPORT eap_core_server_message_if_c
    70 class EAP_CLASS_VISIBILITY_EAP_CORE_SERVER_MESSAGE_IF_H eap_core_server_message_if_c
    50 : public abs_eap_session_core_c
    71 : public abs_eap_session_core_c
    51 , public eap_am_message_if_c
    72 , public eap_am_message_if_c
    52 , public abs_eap_base_timer_c
    73 , public abs_eap_base_timer_c
    53 , public abs_eap_am_stack_c
    74 , public abs_eap_am_stack_c
    54 {
    75 {
   141 	//--------------------------------------------------
   162 	//--------------------------------------------------
   142 
   163 
   143 	/**
   164 	/**
   144 	 * The destructor deletes the m_eap_core object.
   165 	 * The destructor deletes the m_eap_core object.
   145 	 */
   166 	 */
   146 	EAP_FUNC_IMPORT virtual ~eap_core_server_message_if_c();
   167 	EAP_FUNC_VISIBILITY_EAP_CORE_SERVER_MESSAGE_IF_H virtual ~eap_core_server_message_if_c();
   147 
   168 
   148 	/**
   169 	/**
   149 	 * The constructor creates the eap_core object and initializes the m_eap_core
   170 	 * The constructor creates the eap_core object and initializes the m_eap_core
   150 	 * to point the eap_core object.
   171 	 * to point the eap_core object.
   151 	 * @param tools is pointer to the tools class. @see abs_eap_am_tools_c.
   172 	 * @param tools is pointer to the tools class. @see abs_eap_am_tools_c.
   152 	 * @param partner is back pointer to object which created this object.
   173 	 * @param partner is back pointer to object which created this object.
   153 	 * @param is_client_when_true indicates whether the network entity should act
   174 	 * @param is_client_when_true indicates whether the network entity should act
   154 	 * as a client (true) or server (false), in terms of EAP-protocol whether
   175 	 * as a client (true) or server (false), in terms of EAP-protocol whether
   155 	 * this network entity is EAP-supplicant (true) or EAP-authenticator (false).
   176 	 * this network entity is EAP-supplicant (true) or EAP-authenticator (false).
   156 	 */
   177 	 */
   157 	EAP_FUNC_IMPORT eap_core_server_message_if_c(
   178 	EAP_FUNC_VISIBILITY_EAP_CORE_SERVER_MESSAGE_IF_H eap_core_server_message_if_c(
   158 		abs_eap_am_tools_c * const tools,
   179 		abs_eap_am_tools_c * const tools,
   159 		const bool is_client_when_true,
   180 		const bool is_client_when_true,
   160 		const u32_t MTU);
   181 		const u32_t MTU);
   161 
   182 
   162 	EAP_FUNC_IMPORT void set_partner(abs_eap_am_message_if_c * const partner);
   183 	EAP_FUNC_VISIBILITY_EAP_CORE_SERVER_MESSAGE_IF_H void set_partner(abs_eap_am_message_if_c * const partner);
   163 
   184 
   164 	EAP_FUNC_IMPORT eap_status_e process_data(const void * const data, const u32_t length);
   185 	EAP_FUNC_VISIBILITY_EAP_CORE_SERVER_MESSAGE_IF_H eap_status_e process_data(const void * const data, const u32_t length);
   165 
   186 
   166 	/**
   187 	/**
   167 	 * The class could send packets to partner class with this function.
   188 	 * The class could send packets to partner class with this function.
   168 	 * eap_core_server_message_if_c adds EAPOL header to the send packet.
   189 	 * eap_core_server_message_if_c adds EAPOL header to the send packet.
   169 	 * @param send_network_id carries the addresses (network identity) and type of the packet.
   190 	 * @param send_network_id carries the addresses (network identity) and type of the packet.
   171 	 * EAP-packet in correct offset.
   192 	 * EAP-packet in correct offset.
   172 	 * @param header_offset is offset of the EAP-header within the sent_packet.
   193 	 * @param header_offset is offset of the EAP-header within the sent_packet.
   173 	 * @param data_length is length in bytes of the EAP-packet.
   194 	 * @param data_length is length in bytes of the EAP-packet.
   174 	 * @param buffer_length is length in bytes of the whole packet buffer.
   195 	 * @param buffer_length is length in bytes of the whole packet buffer.
   175 	 */
   196 	 */
   176 	EAP_FUNC_IMPORT eap_status_e packet_send(
   197 	EAP_FUNC_VISIBILITY_EAP_CORE_SERVER_MESSAGE_IF_H eap_status_e packet_send(
   177 		const eap_am_network_id_c * const send_network_id,
   198 		const eap_am_network_id_c * const send_network_id,
   178 		eap_buf_chain_wr_c * const sent_packet,
   199 		eap_buf_chain_wr_c * const sent_packet,
   179 		const u32_t header_offset,
   200 		const u32_t header_offset,
   180 		const u32_t data_length,
   201 		const u32_t data_length,
   181 		const u32_t buffer_length); 
   202 		const u32_t buffer_length); 
   187 	 * @param trailer_length is pointer to the variable to store length
   208 	 * @param trailer_length is pointer to the variable to store length
   188 	 * of trailer needed by lower levels.
   209 	 * of trailer needed by lower levels.
   189 	 * @return Function returns the offset of EAP-header.
   210 	 * @return Function returns the offset of EAP-header.
   190 	 * @see abs_eap_core_c::get_header_offset().
   211 	 * @see abs_eap_core_c::get_header_offset().
   191 	 */
   212 	 */
   192 	EAP_FUNC_IMPORT u32_t get_header_offset(
   213 	EAP_FUNC_VISIBILITY_EAP_CORE_SERVER_MESSAGE_IF_H u32_t get_header_offset(
   193 		u32_t * const MTU,
   214 		u32_t * const MTU,
   194 		u32_t * const trailer_length);
   215 		u32_t * const trailer_length);
   195 
   216 
   196 	/**
   217 	/**
   197 	 * The load_module() function function indicates the lower level to
   218 	 * The load_module() function function indicates the lower level to
   198 	 * load new module of EAP-type.
   219 	 * load new module of EAP-type.
   199 	 * @see abs_eap_core_c::load_module().
   220 	 * @see abs_eap_core_c::load_module().
   200 	 */
   221 	 */
   201 	EAP_FUNC_IMPORT eap_status_e load_module(
   222 	EAP_FUNC_VISIBILITY_EAP_CORE_SERVER_MESSAGE_IF_H eap_status_e load_module(
   202 		const eap_type_value_e type,
   223 		const eap_type_value_e type,
   203 		const eap_type_value_e /* tunneling_type */,
   224 		const eap_type_value_e /* tunneling_type */,
   204 		abs_eap_base_type_c * const partner,
   225 		abs_eap_base_type_c * const partner,
   205 		eap_base_type_c ** const eap_type,
   226 		eap_base_type_c ** const eap_type,
   206 		const bool is_client_when_true,
   227 		const bool is_client_when_true,
   208 
   229 
   209 	/**
   230 	/**
   210 	 * The unload_module() function unloads the module of a EAP-type. 
   231 	 * The unload_module() function unloads the module of a EAP-type. 
   211 	 * @see abs_eap_core_c::unload_module().
   232 	 * @see abs_eap_core_c::unload_module().
   212 	 */
   233 	 */
   213 	EAP_FUNC_IMPORT eap_status_e unload_module(
   234 	EAP_FUNC_VISIBILITY_EAP_CORE_SERVER_MESSAGE_IF_H eap_status_e unload_module(
   214 		const eap_type_value_e type); 
   235 		const eap_type_value_e type); 
   215 
   236 
   216 	/**
   237 	/**
   217 	 * Note this function is just an example. Parameters will change later.
   238 	 * Note this function is just an example. Parameters will change later.
   218 	 * The packet_data_crypto_keys() function gives the generated keys to lower level.
   239 	 * The packet_data_crypto_keys() function gives the generated keys to lower level.
   219 	 * After EAP-authentication has generated the keys it calls this function
   240 	 * After EAP-authentication has generated the keys it calls this function
   220 	 * to offer the keys to lower level.
   241 	 * to offer the keys to lower level.
   221 	 * @see abs_eap_base_type_c::packet_data_crypto_keys().
   242 	 * @see abs_eap_base_type_c::packet_data_crypto_keys().
   222 	 */
   243 	 */
   223 	EAP_FUNC_IMPORT eap_status_e packet_data_crypto_keys(
   244 	EAP_FUNC_VISIBILITY_EAP_CORE_SERVER_MESSAGE_IF_H eap_status_e packet_data_crypto_keys(
   224 		const eap_am_network_id_c * const send_network_id,
   245 		const eap_am_network_id_c * const send_network_id,
   225 		const eap_master_session_key_c * const master_session_key
   246 		const eap_master_session_key_c * const master_session_key
   226 		);
   247 		);
   227 
   248 
   228 	// This is documented in abs_eap_stack_interface_c::configure().
   249 	// This is documented in abs_eap_stack_interface_c::configure().
   229 	EAP_FUNC_IMPORT eap_status_e configure(
   250 	EAP_FUNC_VISIBILITY_EAP_CORE_SERVER_MESSAGE_IF_H eap_status_e configure(
   230 		const eap_variable_data_c * const client_configuration);
   251 		const eap_variable_data_c * const client_configuration);
   231 
   252 
   232 	// This is documented in abs_eap_stack_interface_c::shutdown().
   253 	// This is documented in abs_eap_stack_interface_c::shutdown().
   233 	EAP_FUNC_IMPORT eap_status_e shutdown();
   254 	EAP_FUNC_VISIBILITY_EAP_CORE_SERVER_MESSAGE_IF_H eap_status_e shutdown();
   234 
   255 
   235 	/**
   256 	/**
   236 	 * The read_configure() function reads the configuration data identified
   257 	 * The read_configure() function reads the configuration data identified
   237 	 * by the field string of field_length bytes length. Adaptation module must direct
   258 	 * by the field string of field_length bytes length. Adaptation module must direct
   238 	 * the query to some persistent store.
   259 	 * the query to some persistent store.
   239 	 * @see abs_eap_base_type_c::read_configure().
   260 	 * @see abs_eap_base_type_c::read_configure().
   240 	 */
   261 	 */
   241 	EAP_FUNC_IMPORT eap_status_e read_configure(
   262 	EAP_FUNC_VISIBILITY_EAP_CORE_SERVER_MESSAGE_IF_H eap_status_e read_configure(
   242 		const eap_configuration_field_c * const field,
   263 		const eap_configuration_field_c * const field,
   243 		eap_variable_data_c * const data);
   264 		eap_variable_data_c * const data);
   244 
   265 
   245 	/**
   266 	/**
   246 	 * The write_configure() function writes the configuration data identified
   267 	 * The write_configure() function writes the configuration data identified
   247 	 * by the field string of field_length bytes length. Adaptation module must direct
   268 	 * by the field string of field_length bytes length. Adaptation module must direct
   248 	 * the action to some persistent store.
   269 	 * the action to some persistent store.
   249 	 * @see abs_eap_base_type_c::write_configure().
   270 	 * @see abs_eap_base_type_c::write_configure().
   250 	 */
   271 	 */
   251 	EAP_FUNC_IMPORT eap_status_e write_configure(
   272 	EAP_FUNC_VISIBILITY_EAP_CORE_SERVER_MESSAGE_IF_H eap_status_e write_configure(
   252 		const eap_configuration_field_c * const field,
   273 		const eap_configuration_field_c * const field,
   253 		eap_variable_data_c * const data);
   274 		eap_variable_data_c * const data);
   254 
   275 
   255 	// This is documented in abs_eap_stack_interface_c::set_is_valid().
   276 	// This is documented in abs_eap_stack_interface_c::set_is_valid().
   256 	EAP_FUNC_IMPORT void set_is_valid();
   277 	EAP_FUNC_VISIBILITY_EAP_CORE_SERVER_MESSAGE_IF_H void set_is_valid();
   257 
   278 
   258 	// This is documented in abs_eap_stack_interface_c::get_is_valid().
   279 	// This is documented in abs_eap_stack_interface_c::get_is_valid().
   259 	EAP_FUNC_IMPORT bool get_is_valid();
   280 	EAP_FUNC_VISIBILITY_EAP_CORE_SERVER_MESSAGE_IF_H bool get_is_valid();
   260 
   281 
   261 	// See abs_eap_base_type_c::state_notification().
   282 	// See abs_eap_base_type_c::state_notification().
   262 	EAP_FUNC_IMPORT void state_notification(
   283 	EAP_FUNC_VISIBILITY_EAP_CORE_SERVER_MESSAGE_IF_H void state_notification(
   263 		const abs_eap_state_notification_c * const state);
   284 		const abs_eap_state_notification_c * const state);
   264 
   285 
   265 	// See abs_eap_base_timer_c::timer_expired().
   286 	// See abs_eap_base_timer_c::timer_expired().
   266 	EAP_FUNC_IMPORT eap_status_e timer_expired(
   287 	EAP_FUNC_VISIBILITY_EAP_CORE_SERVER_MESSAGE_IF_H eap_status_e timer_expired(
   267 		const u32_t id, void *data);
   288 		const u32_t id, void *data);
   268 
   289 
   269 	// See abs_eap_base_timer_c::timer_delete_data().
   290 	// See abs_eap_base_timer_c::timer_delete_data().
   270 	EAP_FUNC_IMPORT eap_status_e timer_delete_data(
   291 	EAP_FUNC_VISIBILITY_EAP_CORE_SERVER_MESSAGE_IF_H eap_status_e timer_delete_data(
   271 		const u32_t id, void *data);
   292 		const u32_t id, void *data);
   272 
   293 
   273 	/**
   294 	/**
   274 	 * This function tells lower layer to remove EAP session object asyncronously.
   295 	 * This function tells lower layer to remove EAP session object asyncronously.
   275 	 * @param send_network_id is pointer to network id that identifies the removed EAP session.
   296 	 * @param send_network_id is pointer to network id that identifies the removed EAP session.
   276 	 */
   297 	 */
   277 	EAP_FUNC_IMPORT eap_status_e asynchronous_init_remove_eap_session(
   298 	EAP_FUNC_VISIBILITY_EAP_CORE_SERVER_MESSAGE_IF_H eap_status_e asynchronous_init_remove_eap_session(
   278 		const eap_am_network_id_c * const send_network_id);
   299 		const eap_am_network_id_c * const send_network_id);
   279 
   300 
   280 	/**
   301 	/**
   281 	 * The upper layer calls the asynchronous_start_authentication() function
   302 	 * The upper layer calls the asynchronous_start_authentication() function
   282 	 * when EAP-authentication is needed with another peer.
   303 	 * when EAP-authentication is needed with another peer.
   283 	 * @see abs_eap_core_c::asynchronous_start_authentication().
   304 	 * @see abs_eap_core_c::asynchronous_start_authentication().
   284 	 */
   305 	 */
   285 	EAP_FUNC_IMPORT eap_status_e asynchronous_start_authentication(
   306 	EAP_FUNC_VISIBILITY_EAP_CORE_SERVER_MESSAGE_IF_H eap_status_e asynchronous_start_authentication(
   286 		const eap_am_network_id_c * const /* receive_network_id */,
   307 		const eap_am_network_id_c * const /* receive_network_id */,
   287 		const bool /* is_client_when_true */);
   308 		const bool /* is_client_when_true */);
   288 
   309 
   289 	EAP_FUNC_IMPORT eap_status_e restart_authentication(
   310 	EAP_FUNC_VISIBILITY_EAP_CORE_SERVER_MESSAGE_IF_H eap_status_e restart_authentication(
   290 		const eap_am_network_id_c * const send_network_id,
   311 		const eap_am_network_id_c * const send_network_id,
   291 		const bool is_client_when_true,
   312 		const bool is_client_when_true,
   292 		const bool force_clean_restart,
   313 		const bool force_clean_restart,
   293 		const bool from_timer = false);
   314 		const bool from_timer = false);
   294 
   315 
   295 	//
   316 	//
   296 	EAP_FUNC_IMPORT eap_status_e set_timer(
   317 	EAP_FUNC_VISIBILITY_EAP_CORE_SERVER_MESSAGE_IF_H eap_status_e set_timer(
   297 		abs_eap_base_timer_c * const p_initializer, 
   318 		abs_eap_base_timer_c * const p_initializer, 
   298 		const u32_t p_id, 
   319 		const u32_t p_id, 
   299 		void * const p_data,
   320 		void * const p_data,
   300 		const u32_t p_time_ms);
   321 		const u32_t p_time_ms);
   301 
   322 
   302 	EAP_FUNC_IMPORT eap_status_e cancel_timer(
   323 	EAP_FUNC_VISIBILITY_EAP_CORE_SERVER_MESSAGE_IF_H eap_status_e cancel_timer(
   303 		abs_eap_base_timer_c * const p_initializer, 
   324 		abs_eap_base_timer_c * const p_initializer, 
   304 		const u32_t p_id);
   325 		const u32_t p_id);
   305 
   326 
   306 	//
   327 	//
   307 	EAP_FUNC_IMPORT eap_status_e check_is_valid_eap_type(const eap_type_value_e eap_type);
   328 	EAP_FUNC_VISIBILITY_EAP_CORE_SERVER_MESSAGE_IF_H eap_status_e check_is_valid_eap_type(const eap_type_value_e eap_type);
   308 
   329 
   309 	// See abs_eap_core_c::get_eap_type_list().
   330 	// See abs_eap_core_c::get_eap_type_list().
   310 	EAP_FUNC_IMPORT eap_status_e get_eap_type_list(
   331 	EAP_FUNC_VISIBILITY_EAP_CORE_SERVER_MESSAGE_IF_H eap_status_e get_eap_type_list(
   311 		eap_array_c<eap_type_value_e> * const eap_type_list);
   332 		eap_array_c<eap_type_value_e> * const eap_type_list);
   312 
   333 
   313 	/// @see abs_eap_core_c::add_rogue_ap().
   334 	/// @see abs_eap_core_c::add_rogue_ap().
   314 	EAP_FUNC_IMPORT eap_status_e add_rogue_ap(eap_array_c<eap_rogue_ap_entry_c> & rogue_ap_list);
   335 	EAP_FUNC_VISIBILITY_EAP_CORE_SERVER_MESSAGE_IF_H eap_status_e add_rogue_ap(eap_array_c<eap_rogue_ap_entry_c> & rogue_ap_list);
   315 
   336 
   316 	// This is documented in abs_eap_core_c::set_session_timeout().
   337 	// This is documented in abs_eap_core_c::set_session_timeout().
   317 	EAP_FUNC_IMPORT eap_status_e set_session_timeout(
   338 	EAP_FUNC_VISIBILITY_EAP_CORE_SERVER_MESSAGE_IF_H eap_status_e set_session_timeout(
   318 		const u32_t session_timeout_ms);
   339 		const u32_t session_timeout_ms);
   319 
   340 
   320 #if defined(USE_EAP_SIMPLE_CONFIG)
   341 #if defined(USE_EAP_SIMPLE_CONFIG)
   321 
   342 
   322 	EAP_FUNC_IMPORT eap_status_e save_simple_config_session(
   343 	EAP_FUNC_VISIBILITY_EAP_CORE_SERVER_MESSAGE_IF_H eap_status_e save_simple_config_session(
   323 		const simple_config_state_e state,
   344 		const simple_config_state_e state,
   324 		EAP_TEMPLATE_CONST eap_array_c<simple_config_credential_c> * const credential_array,
   345 		EAP_TEMPLATE_CONST eap_array_c<simple_config_credential_c> * const credential_array,
   325 		const eap_variable_data_c * const new_password,
   346 		const eap_variable_data_c * const new_password,
   326 		const simple_config_Device_Password_ID_e Device_Password_ID,
   347 		const simple_config_Device_Password_ID_e Device_Password_ID,
   327 		const simple_config_payloads_c * const other_configuration);
   348 		const simple_config_payloads_c * const other_configuration);
   328 
   349 
   329 #endif // #if defined(USE_EAP_SIMPLE_CONFIG)
   350 #endif // #if defined(USE_EAP_SIMPLE_CONFIG)
   330 
   351 
   331 	EAP_FUNC_IMPORT eap_status_e complete_get_802_11_authentication_mode(
   352 	EAP_FUNC_VISIBILITY_EAP_CORE_SERVER_MESSAGE_IF_H eap_status_e complete_get_802_11_authentication_mode(
   332 		const eap_status_e completion_status,
   353 		const eap_status_e completion_status,
   333 		const eap_am_network_id_c * const receive_network_id,
   354 		const eap_am_network_id_c * const receive_network_id,
   334 		const eapol_key_802_11_authentication_mode_e mode);
   355 		const eapol_key_802_11_authentication_mode_e mode);
   335 
   356 
   336 	//--------------------------------------------------
   357 	//--------------------------------------------------