eapol/eapol_framework/eapol_symbian/am/include/eapol_am_core_symbian_simulator.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_AM_SYMBIAN_H_)
       
    22 #define _EAP_AM_SYMBIAN_H_
       
    23 
       
    24 #if defined(USE_EAPOL_LLC_INTERFACE)
       
    25 	#include <es_mbuf.h>
       
    26 #endif
       
    27 
       
    28 #include "eap_tools.h"
       
    29 #include "eap_am_export.h"
       
    30 #include "abs_eapol_am_core_symbian_simulator.h"
       
    31 #include "abs_ethernet_core.h"
       
    32 #include "ethernet_core.h"
       
    33 #include "eap_base_type.h"
       
    34 #include "eap_variable_data.h"
       
    35 #include "eap_core_map.h"
       
    36 
       
    37 class CEapType;
       
    38 
       
    39 // 
       
    40 class EAP_EXPORT eapol_am_core_symbian_c
       
    41 : public abs_ethernet_core_c
       
    42 {
       
    43 private:
       
    44 	//--------------------------------------------------
       
    45 
       
    46 	abs_eapol_am_core_symbian_c *m_partner;
       
    47 
       
    48 	ethernet_core_c *m_ethernet_core;
       
    49 
       
    50 	abs_eap_am_tools_c * const m_am_tools;
       
    51 
       
    52 	eap_variable_data_c m_own_address;
       
    53 
       
    54 	u32_t m_error_probability;
       
    55 
       
    56 	u32_t m_authentication_counter;
       
    57 
       
    58 	bool m_is_valid;
       
    59 
       
    60 	bool m_is_client;
       
    61 
       
    62 	bool m_enable_random_errors;
       
    63 
       
    64 	bool m_shutdown_was_called;
       
    65 
       
    66 	RPointerArray<CEapType> m_plugin_if_array;
       
    67 	RArray<eap_type_value_e> m_eap_type_array;
       
    68 
       
    69 	EAP_FUNC_IMPORT eap_status_e random_error(
       
    70 		eap_buf_chain_wr_c * const sent_packet);
       
    71 
       
    72 	//--------------------------------------------------
       
    73 protected:
       
    74 	//--------------------------------------------------
       
    75 
       
    76 	//--------------------------------------------------
       
    77 public:
       
    78 	//--------------------------------------------------
       
    79 
       
    80 	// 
       
    81 	EAP_FUNC_IMPORT virtual ~eapol_am_core_symbian_c();
       
    82 
       
    83 	// 
       
    84 	EAP_FUNC_IMPORT eapol_am_core_symbian_c(
       
    85 		abs_eap_am_tools_c * const m_am_tools,
       
    86 		abs_eapol_am_core_symbian_c * const partner,
       
    87 		const bool is_client_when_true);
       
    88 
       
    89 	//
       
    90 	EAP_FUNC_IMPORT eap_base_type_c * load_type(const eap_type_value_e type);
       
    91 
       
    92 #if defined(USE_EAPOL_LLC_INTERFACE)
       
    93 	//
       
    94 	EAP_FUNC_EXPORT eap_status_e packet_process(
       
    95 		RMBufChain& aPdu);
       
    96 #endif //#if defined(USE_EAPOL_LLC_INTERFACE)
       
    97 
       
    98 	//
       
    99 	EAP_FUNC_IMPORT eap_status_e packet_process(
       
   100 		const eap_am_network_id_c * const receive_network_id,
       
   101 		eapol_ethernet_header_wr_c * const eth_header,
       
   102 		const u32_t packet_length); 
       
   103 
       
   104 	//
       
   105 	EAP_FUNC_IMPORT eap_status_e packet_send(
       
   106 		const eap_am_network_id_c * const send_network_id,
       
   107 		eap_buf_chain_wr_c * const sent_packet,
       
   108 		const u32_t header_offset,
       
   109 		const u32_t data_length,
       
   110 		const u32_t buffer_length); 
       
   111 
       
   112 	eap_status_e set_address(
       
   113 		const u8_t * const address,
       
   114 		const u32_t length)
       
   115 	{
       
   116 		return m_own_address.set_copy_of_buffer(address, length);
       
   117 	}
       
   118 
       
   119 	//
       
   120 	EAP_FUNC_IMPORT u32_t get_header_offset(
       
   121 		u32_t * const MTU,
       
   122 		u32_t * const trailer_length);
       
   123 
       
   124 	//
       
   125 	EAP_FUNC_IMPORT eap_status_e eap_acknowledge(const eap_am_network_id_c * const receive_network_id); 
       
   126 
       
   127 	//
       
   128 	EAP_FUNC_IMPORT eap_status_e load_module(
       
   129 		const eap_type_value_e type,
       
   130 		const eap_type_value_e /* tunneling_type */,
       
   131 		abs_eap_base_type_c * const partner,
       
   132 		eap_base_type_c ** const eap_type,
       
   133 		const bool is_client_when_true,
       
   134 		const eap_am_network_id_c * const receive_network_id);
       
   135 
       
   136 	//
       
   137 	EAP_FUNC_IMPORT eap_status_e unload_module(const eap_type_value_e type); 
       
   138 
       
   139 	/**
       
   140 	 * This function starts the EAP-authentication.
       
   141 	 * The first parameter includes the network addresses of the protocol
       
   142 	 * over the EAP-packets are transmitted.
       
   143 	 * The type attribute of the eap_am_network_id_c object MUST be set
       
   144 	 * either eapol_ethernet_type_e::eapol_ethernet_type_pae
       
   145 	 * or eapol_ethernet_type_e::eapol_ethernet_type_preauthentication.
       
   146 	 * Value eapol_ethernet_type_e::eapol_ethernet_type_pae starts normal EA-authentication.
       
   147 	 * Value eapol_ethernet_type_e::eapol_ethernet_type_preauthentication starts 802.11i preauthentication.
       
   148 	 * The second parameter is_client_when_true tells whether this stack
       
   149 	 * is client (true) or server (false).
       
   150 	 */ 
       
   151 	EAP_FUNC_IMPORT eap_status_e start_authentication(
       
   152 		const eap_am_network_id_c * const receive_network_id,
       
   153 		const bool is_client_when_true);
       
   154 
       
   155 	EAP_FUNC_IMPORT eap_status_e send_logoff(const eap_am_network_id_c * const receive_network_id);
       
   156 
       
   157 	EAP_FUNC_IMPORT_EMPTY void set_is_valid()
       
   158 	{
       
   159 		m_is_valid = true;
       
   160 	}
       
   161 
       
   162 	EAP_FUNC_IMPORT_EMPTY bool get_is_valid()
       
   163 	{
       
   164 		return m_is_valid;
       
   165 	}
       
   166 
       
   167 	const eap_variable_data_c * const get_own_address()
       
   168 	{
       
   169 		return &m_own_address;
       
   170 	}
       
   171 
       
   172 	void increment_authentication_counter()
       
   173 	{
       
   174 		++m_authentication_counter;
       
   175 	}
       
   176 
       
   177 	const u32_t get_authentication_counter()
       
   178 	{
       
   179 		return m_authentication_counter;
       
   180 	}
       
   181 
       
   182 	bool get_is_client()
       
   183 	{
       
   184 		return m_is_client;
       
   185 	}
       
   186 
       
   187 	EAP_FUNC_IMPORT eap_status_e configure();
       
   188 
       
   189 	EAP_FUNC_IMPORT eap_status_e shutdown();
       
   190 
       
   191 	/**
       
   192 	 * Note this function is just an example. Parameters will change later.
       
   193 	 * The packet_data_crypto_keys() function gives the generated keys to lower level.
       
   194 	 * After EAP-authentication has generated the keys it calls this function
       
   195 	 * to offer the keys to lower level.
       
   196 	 * @see abs_eap_base_type_c::packet_data_crypto_keys().
       
   197 	 */
       
   198 	EAP_FUNC_IMPORT eap_status_e packet_data_crypto_keys(
       
   199 		const eap_am_network_id_c * const send_network_id,
       
   200 		const eap_master_session_key_c * const master_session_key);
       
   201 
       
   202 	EAP_FUNC_IMPORT eap_status_e read_configure(
       
   203 		const eap_configuration_field_c * const field,
       
   204 		eap_variable_data_c * const data);
       
   205 
       
   206 	EAP_FUNC_IMPORT eap_status_e write_configure(
       
   207 		const eap_configuration_field_c * const field,
       
   208 		eap_variable_data_c * const data);
       
   209 
       
   210 	// See abs_eap_base_type_c::state_notification().
       
   211 	void state_notification(
       
   212 		const abs_eap_state_notification_c * const state)
       
   213 	{
       
   214 		m_partner->state_notification(state);
       
   215 	}
       
   216 
       
   217 	//
       
   218 	EAP_FUNC_IMPORT eap_status_e set_timer(
       
   219 		abs_eap_base_timer_c * const p_initializer, 
       
   220 		const u32_t p_id, 
       
   221 		void * const p_data,
       
   222 		const u32_t p_time_ms);
       
   223 
       
   224 	EAP_FUNC_IMPORT eap_status_e cancel_timer(
       
   225 		abs_eap_base_timer_c * const p_initializer, 
       
   226 		const u32_t p_id);
       
   227 
       
   228 	//
       
   229 	EAP_FUNC_IMPORT eap_status_e cancel_all_timers();
       
   230 
       
   231 	//
       
   232 	EAP_FUNC_IMPORT eap_status_e check_is_valid_eap_type(const eap_type_value_e eap_type);
       
   233 
       
   234 	//
       
   235 	EAP_FUNC_IMPORT eap_status_e get_eap_type_list(
       
   236 		eap_array_c<eap_type_value_e> * const eap_type_list);
       
   237 
       
   238 	eap_status_e packet_data_session_key(
       
   239 		const eap_am_network_id_c * const send_network_id,
       
   240 		const eapol_session_key_c * const key);
       
   241 
       
   242 	//--------------------------------------------------
       
   243 }; // class eapol_am_core_symbian_c
       
   244 
       
   245 #endif //#if !defined(_EAP_AM_SYMBIAN_H_)
       
   246 
       
   247 //--------------------------------------------------
       
   248 
       
   249 
       
   250 
       
   251 // End.