26
|
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 |
* %version: 17 %
|
|
20 |
*/
|
|
21 |
|
|
22 |
#if !defined(_EAP_CORE_SERVER_MESSAGE_IF_H_)
|
|
23 |
#define _EAP_CORE_SERVER_MESSAGE_IF_H_
|
|
24 |
|
|
25 |
#include "eap_tools.h"
|
|
26 |
#include "eap_am_export.h"
|
49
|
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.
|
26
|
48 |
#include "abs_eap_session_core.h"
|
|
49 |
#include "eap_variable_data.h"
|
|
50 |
#include "abs_eap_am_mutex.h"
|
|
51 |
#include "eap_session_core_base.h"
|
|
52 |
#include "abs_eap_am_message_if.h"
|
|
53 |
#include "eap_am_message_if.h"
|
|
54 |
#include "eap_process_tlv_message_data.h"
|
|
55 |
#include "abs_eap_am_stack.h"
|
|
56 |
#include "eap_am_stack.h"
|
|
57 |
|
|
58 |
#if defined(USE_EAP_SIMPLE_CONFIG)
|
|
59 |
#include "simple_config_types.h"
|
|
60 |
#include "simple_config_credential.h"
|
|
61 |
#include "simple_config_payloads.h"
|
|
62 |
#include "abs_eap_configuration_if.h"
|
|
63 |
#endif // #if defined(USE_EAP_SIMPLE_CONFIG)
|
|
64 |
|
|
65 |
|
|
66 |
/** @file */
|
|
67 |
|
|
68 |
|
|
69 |
/// A eap_core_server_message_if_c class implements the basic functionality of EAPOL.
|
49
|
70 |
class EAP_CLASS_VISIBILITY_EAP_CORE_SERVER_MESSAGE_IF_H eap_core_server_message_if_c
|
26
|
71 |
: public abs_eap_session_core_c
|
|
72 |
, public eap_am_message_if_c
|
|
73 |
, public abs_eap_base_timer_c
|
|
74 |
, public abs_eap_am_stack_c
|
|
75 |
{
|
|
76 |
|
|
77 |
private:
|
|
78 |
//--------------------------------------------------
|
|
79 |
|
|
80 |
/// This is back pointer to object which created this object.
|
|
81 |
abs_eap_am_message_if_c * m_partner;
|
|
82 |
|
|
83 |
/// This is pointer to the eap_core object. The eapol_core object gives
|
|
84 |
/// the received packets to the eap_core object. The eap_core object sends
|
|
85 |
/// packets through the eapol_core object.
|
|
86 |
eap_session_core_base_c * const m_eap_core;
|
|
87 |
|
|
88 |
eap_am_stack_c * const m_am_stack;
|
|
89 |
|
|
90 |
/// This is pointer to the tools class.
|
|
91 |
abs_eap_am_tools_c * const m_am_tools;
|
|
92 |
|
|
93 |
/// This is offset in bytes of the EAP header.
|
|
94 |
u32_t m_eap_header_offset;
|
|
95 |
|
|
96 |
/// This is maximum transfer unit in bytes.
|
|
97 |
u32_t m_MTU;
|
|
98 |
|
|
99 |
/// This is length of the trailer in bytes.
|
|
100 |
u32_t m_trailer_length;
|
|
101 |
|
|
102 |
eap_status_e m_error_code;
|
|
103 |
|
|
104 |
eap_tlv_message_type_function_e m_error_function;
|
|
105 |
|
|
106 |
/// This indicates whether this object is client (true) or server (false).
|
|
107 |
/// In terms of EAP-protocol whether this network entity is EAP-supplicant (true) or EAP-authenticator (false).
|
|
108 |
bool m_is_client;
|
|
109 |
|
|
110 |
/// This indicates whether this object was generated successfully.
|
|
111 |
bool m_is_valid;
|
|
112 |
|
|
113 |
bool m_shutdown_was_called;
|
|
114 |
|
|
115 |
eap_status_e send_error_message(
|
|
116 |
const eap_status_e error_code,
|
|
117 |
const eap_tlv_message_type_function_e function);
|
|
118 |
|
|
119 |
eap_status_e send_message(eap_process_tlv_message_data_c * const message);
|
|
120 |
|
|
121 |
eap_status_e process_message_type_error(
|
|
122 |
EAP_TEMPLATE_CONST eap_array_c<eap_tlv_header_c> * const parameters);
|
|
123 |
|
|
124 |
eap_status_e process_message(eap_process_tlv_message_data_c * const message);
|
|
125 |
|
|
126 |
eap_status_e create_eap_session(
|
|
127 |
EAP_TEMPLATE_CONST eap_array_c<eap_tlv_header_c> * const parameters);
|
|
128 |
|
|
129 |
eap_status_e remove_eap_session(
|
|
130 |
EAP_TEMPLATE_CONST eap_array_c<eap_tlv_header_c> * const parameters);
|
|
131 |
|
|
132 |
eap_status_e send_eap_identity_request(
|
|
133 |
EAP_TEMPLATE_CONST eap_array_c<eap_tlv_header_c> * const parameters);
|
|
134 |
|
|
135 |
eap_status_e packet_process(
|
|
136 |
EAP_TEMPLATE_CONST eap_array_c<eap_tlv_header_c> * const parameters);
|
|
137 |
|
|
138 |
eap_status_e eap_acknowledge(
|
|
139 |
EAP_TEMPLATE_CONST eap_array_c<eap_tlv_header_c> * const parameters);
|
|
140 |
|
|
141 |
eap_status_e set_eap_database_reference_values(
|
|
142 |
EAP_TEMPLATE_CONST eap_array_c<eap_tlv_header_c> * const parameters);
|
|
143 |
|
|
144 |
eap_status_e eap_mtu(
|
|
145 |
EAP_TEMPLATE_CONST eap_array_c<eap_tlv_header_c> * const parameters);
|
|
146 |
|
|
147 |
eap_status_e get_802_11_authentication_mode(
|
|
148 |
EAP_TEMPLATE_CONST eap_array_c<eap_tlv_header_c> * const parameters);
|
|
149 |
|
|
150 |
|
|
151 |
eap_status_e complete_remove_eap_session(
|
|
152 |
const bool complete_to_lower_layer,
|
|
153 |
const eap_am_network_id_c * const receive_network_id);
|
|
154 |
|
|
155 |
|
|
156 |
//--------------------------------------------------
|
|
157 |
protected:
|
|
158 |
//--------------------------------------------------
|
|
159 |
|
|
160 |
//--------------------------------------------------
|
|
161 |
public:
|
|
162 |
//--------------------------------------------------
|
|
163 |
|
|
164 |
/**
|
|
165 |
* The destructor deletes the m_eap_core object.
|
|
166 |
*/
|
49
|
167 |
EAP_FUNC_VISIBILITY_EAP_CORE_SERVER_MESSAGE_IF_H virtual ~eap_core_server_message_if_c();
|
26
|
168 |
|
|
169 |
/**
|
|
170 |
* The constructor creates the eap_core object and initializes the m_eap_core
|
|
171 |
* to point the eap_core object.
|
|
172 |
* @param tools is pointer to the tools class. @see abs_eap_am_tools_c.
|
|
173 |
* @param partner is back pointer to object which created this object.
|
|
174 |
* @param is_client_when_true indicates whether the network entity should act
|
|
175 |
* as a client (true) or server (false), in terms of EAP-protocol whether
|
|
176 |
* this network entity is EAP-supplicant (true) or EAP-authenticator (false).
|
|
177 |
*/
|
49
|
178 |
EAP_FUNC_VISIBILITY_EAP_CORE_SERVER_MESSAGE_IF_H eap_core_server_message_if_c(
|
26
|
179 |
abs_eap_am_tools_c * const tools,
|
|
180 |
const bool is_client_when_true,
|
|
181 |
const u32_t MTU);
|
|
182 |
|
49
|
183 |
EAP_FUNC_VISIBILITY_EAP_CORE_SERVER_MESSAGE_IF_H void set_partner(abs_eap_am_message_if_c * const partner);
|
26
|
184 |
|
49
|
185 |
EAP_FUNC_VISIBILITY_EAP_CORE_SERVER_MESSAGE_IF_H eap_status_e process_data(const void * const data, const u32_t length);
|
26
|
186 |
|
|
187 |
/**
|
|
188 |
* The class could send packets to partner class with this function.
|
|
189 |
* eap_core_server_message_if_c adds EAPOL header to the send packet.
|
|
190 |
* @param send_network_id carries the addresses (network identity) and type of the packet.
|
|
191 |
* @param sent_packet includes the buffer for the whole packet and initialized
|
|
192 |
* EAP-packet in correct offset.
|
|
193 |
* @param header_offset is offset of the EAP-header within the sent_packet.
|
|
194 |
* @param data_length is length in bytes of the EAP-packet.
|
|
195 |
* @param buffer_length is length in bytes of the whole packet buffer.
|
|
196 |
*/
|
49
|
197 |
EAP_FUNC_VISIBILITY_EAP_CORE_SERVER_MESSAGE_IF_H eap_status_e packet_send(
|
26
|
198 |
const eap_am_network_id_c * const send_network_id,
|
|
199 |
eap_buf_chain_wr_c * const sent_packet,
|
|
200 |
const u32_t header_offset,
|
|
201 |
const u32_t data_length,
|
|
202 |
const u32_t buffer_length);
|
|
203 |
|
|
204 |
/**
|
|
205 |
* The get_header_offset() function obtains the header offset of EAP-packet.
|
|
206 |
* @param MTU_length is pointer to variable to store the maximum transfer unit (MTU).
|
|
207 |
* MTU is the maximum EAP-packet length in bytes
|
|
208 |
* @param trailer_length is pointer to the variable to store length
|
|
209 |
* of trailer needed by lower levels.
|
|
210 |
* @return Function returns the offset of EAP-header.
|
|
211 |
* @see abs_eap_core_c::get_header_offset().
|
|
212 |
*/
|
49
|
213 |
EAP_FUNC_VISIBILITY_EAP_CORE_SERVER_MESSAGE_IF_H u32_t get_header_offset(
|
26
|
214 |
u32_t * const MTU,
|
|
215 |
u32_t * const trailer_length);
|
|
216 |
|
|
217 |
/**
|
|
218 |
* The load_module() function function indicates the lower level to
|
|
219 |
* load new module of EAP-type.
|
|
220 |
* @see abs_eap_core_c::load_module().
|
|
221 |
*/
|
49
|
222 |
EAP_FUNC_VISIBILITY_EAP_CORE_SERVER_MESSAGE_IF_H eap_status_e load_module(
|
26
|
223 |
const eap_type_value_e type,
|
|
224 |
const eap_type_value_e /* tunneling_type */,
|
|
225 |
abs_eap_base_type_c * const partner,
|
|
226 |
eap_base_type_c ** const eap_type,
|
|
227 |
const bool is_client_when_true,
|
|
228 |
const eap_am_network_id_c * const receive_network_id);
|
|
229 |
|
|
230 |
/**
|
|
231 |
* The unload_module() function unloads the module of a EAP-type.
|
|
232 |
* @see abs_eap_core_c::unload_module().
|
|
233 |
*/
|
49
|
234 |
EAP_FUNC_VISIBILITY_EAP_CORE_SERVER_MESSAGE_IF_H eap_status_e unload_module(
|
26
|
235 |
const eap_type_value_e type);
|
|
236 |
|
|
237 |
/**
|
|
238 |
* Note this function is just an example. Parameters will change later.
|
|
239 |
* The packet_data_crypto_keys() function gives the generated keys to lower level.
|
|
240 |
* After EAP-authentication has generated the keys it calls this function
|
|
241 |
* to offer the keys to lower level.
|
|
242 |
* @see abs_eap_base_type_c::packet_data_crypto_keys().
|
|
243 |
*/
|
49
|
244 |
EAP_FUNC_VISIBILITY_EAP_CORE_SERVER_MESSAGE_IF_H eap_status_e packet_data_crypto_keys(
|
26
|
245 |
const eap_am_network_id_c * const send_network_id,
|
|
246 |
const eap_master_session_key_c * const master_session_key
|
|
247 |
);
|
|
248 |
|
|
249 |
// This is documented in abs_eap_stack_interface_c::configure().
|
49
|
250 |
EAP_FUNC_VISIBILITY_EAP_CORE_SERVER_MESSAGE_IF_H eap_status_e configure(
|
26
|
251 |
const eap_variable_data_c * const client_configuration);
|
|
252 |
|
|
253 |
// This is documented in abs_eap_stack_interface_c::shutdown().
|
49
|
254 |
EAP_FUNC_VISIBILITY_EAP_CORE_SERVER_MESSAGE_IF_H eap_status_e shutdown();
|
26
|
255 |
|
|
256 |
/**
|
|
257 |
* The read_configure() function reads the configuration data identified
|
|
258 |
* by the field string of field_length bytes length. Adaptation module must direct
|
|
259 |
* the query to some persistent store.
|
|
260 |
* @see abs_eap_base_type_c::read_configure().
|
|
261 |
*/
|
49
|
262 |
EAP_FUNC_VISIBILITY_EAP_CORE_SERVER_MESSAGE_IF_H eap_status_e read_configure(
|
26
|
263 |
const eap_configuration_field_c * const field,
|
|
264 |
eap_variable_data_c * const data);
|
|
265 |
|
|
266 |
/**
|
|
267 |
* The write_configure() function writes the configuration data identified
|
|
268 |
* by the field string of field_length bytes length. Adaptation module must direct
|
|
269 |
* the action to some persistent store.
|
|
270 |
* @see abs_eap_base_type_c::write_configure().
|
|
271 |
*/
|
49
|
272 |
EAP_FUNC_VISIBILITY_EAP_CORE_SERVER_MESSAGE_IF_H eap_status_e write_configure(
|
26
|
273 |
const eap_configuration_field_c * const field,
|
|
274 |
eap_variable_data_c * const data);
|
|
275 |
|
|
276 |
// This is documented in abs_eap_stack_interface_c::set_is_valid().
|
49
|
277 |
EAP_FUNC_VISIBILITY_EAP_CORE_SERVER_MESSAGE_IF_H void set_is_valid();
|
26
|
278 |
|
|
279 |
// This is documented in abs_eap_stack_interface_c::get_is_valid().
|
49
|
280 |
EAP_FUNC_VISIBILITY_EAP_CORE_SERVER_MESSAGE_IF_H bool get_is_valid();
|
26
|
281 |
|
|
282 |
// See abs_eap_base_type_c::state_notification().
|
49
|
283 |
EAP_FUNC_VISIBILITY_EAP_CORE_SERVER_MESSAGE_IF_H void state_notification(
|
26
|
284 |
const abs_eap_state_notification_c * const state);
|
|
285 |
|
|
286 |
// See abs_eap_base_timer_c::timer_expired().
|
49
|
287 |
EAP_FUNC_VISIBILITY_EAP_CORE_SERVER_MESSAGE_IF_H eap_status_e timer_expired(
|
26
|
288 |
const u32_t id, void *data);
|
|
289 |
|
|
290 |
// See abs_eap_base_timer_c::timer_delete_data().
|
49
|
291 |
EAP_FUNC_VISIBILITY_EAP_CORE_SERVER_MESSAGE_IF_H eap_status_e timer_delete_data(
|
26
|
292 |
const u32_t id, void *data);
|
|
293 |
|
|
294 |
/**
|
|
295 |
* This function tells lower layer to remove EAP session object asyncronously.
|
|
296 |
* @param send_network_id is pointer to network id that identifies the removed EAP session.
|
|
297 |
*/
|
49
|
298 |
EAP_FUNC_VISIBILITY_EAP_CORE_SERVER_MESSAGE_IF_H eap_status_e asynchronous_init_remove_eap_session(
|
26
|
299 |
const eap_am_network_id_c * const send_network_id);
|
|
300 |
|
|
301 |
/**
|
|
302 |
* The upper layer calls the asynchronous_start_authentication() function
|
|
303 |
* when EAP-authentication is needed with another peer.
|
|
304 |
* @see abs_eap_core_c::asynchronous_start_authentication().
|
|
305 |
*/
|
49
|
306 |
EAP_FUNC_VISIBILITY_EAP_CORE_SERVER_MESSAGE_IF_H eap_status_e asynchronous_start_authentication(
|
26
|
307 |
const eap_am_network_id_c * const /* receive_network_id */,
|
|
308 |
const bool /* is_client_when_true */);
|
|
309 |
|
49
|
310 |
EAP_FUNC_VISIBILITY_EAP_CORE_SERVER_MESSAGE_IF_H eap_status_e restart_authentication(
|
26
|
311 |
const eap_am_network_id_c * const send_network_id,
|
|
312 |
const bool is_client_when_true,
|
|
313 |
const bool force_clean_restart,
|
|
314 |
const bool from_timer = false);
|
|
315 |
|
|
316 |
//
|
49
|
317 |
EAP_FUNC_VISIBILITY_EAP_CORE_SERVER_MESSAGE_IF_H eap_status_e set_timer(
|
26
|
318 |
abs_eap_base_timer_c * const p_initializer,
|
|
319 |
const u32_t p_id,
|
|
320 |
void * const p_data,
|
|
321 |
const u32_t p_time_ms);
|
|
322 |
|
49
|
323 |
EAP_FUNC_VISIBILITY_EAP_CORE_SERVER_MESSAGE_IF_H eap_status_e cancel_timer(
|
26
|
324 |
abs_eap_base_timer_c * const p_initializer,
|
|
325 |
const u32_t p_id);
|
|
326 |
|
|
327 |
//
|
49
|
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);
|
26
|
329 |
|
|
330 |
// See abs_eap_core_c::get_eap_type_list().
|
49
|
331 |
EAP_FUNC_VISIBILITY_EAP_CORE_SERVER_MESSAGE_IF_H eap_status_e get_eap_type_list(
|
26
|
332 |
eap_array_c<eap_type_value_e> * const eap_type_list);
|
|
333 |
|
|
334 |
/// @see abs_eap_core_c::add_rogue_ap().
|
49
|
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);
|
26
|
336 |
|
|
337 |
// This is documented in abs_eap_core_c::set_session_timeout().
|
49
|
338 |
EAP_FUNC_VISIBILITY_EAP_CORE_SERVER_MESSAGE_IF_H eap_status_e set_session_timeout(
|
26
|
339 |
const u32_t session_timeout_ms);
|
|
340 |
|
|
341 |
#if defined(USE_EAP_SIMPLE_CONFIG)
|
|
342 |
|
49
|
343 |
EAP_FUNC_VISIBILITY_EAP_CORE_SERVER_MESSAGE_IF_H eap_status_e save_simple_config_session(
|
26
|
344 |
const simple_config_state_e state,
|
|
345 |
EAP_TEMPLATE_CONST eap_array_c<simple_config_credential_c> * const credential_array,
|
|
346 |
const eap_variable_data_c * const new_password,
|
|
347 |
const simple_config_Device_Password_ID_e Device_Password_ID,
|
|
348 |
const simple_config_payloads_c * const other_configuration);
|
|
349 |
|
|
350 |
#endif // #if defined(USE_EAP_SIMPLE_CONFIG)
|
|
351 |
|
49
|
352 |
EAP_FUNC_VISIBILITY_EAP_CORE_SERVER_MESSAGE_IF_H eap_status_e complete_get_802_11_authentication_mode(
|
26
|
353 |
const eap_status_e completion_status,
|
|
354 |
const eap_am_network_id_c * const receive_network_id,
|
|
355 |
const eapol_key_802_11_authentication_mode_e mode);
|
|
356 |
|
|
357 |
//--------------------------------------------------
|
|
358 |
}; // class eap_core_server_message_if_c
|
|
359 |
|
|
360 |
#endif //#if !defined(_EAP_CORE_SERVER_MESSAGE_IF_H_)
|
|
361 |
|
|
362 |
//--------------------------------------------------
|
|
363 |
|
|
364 |
|
|
365 |
|
|
366 |
// End.
|