|
1 /* |
|
2 * Copyright (c) 2001-2007 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: Interface to EAPOL authentication protocols. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 // INCLUDE FILES |
|
20 |
|
21 #include "core_wlan_eapol_interface.h" |
|
22 #include "abs_core_server_callback.h" |
|
23 #include "core_tools.h" |
|
24 |
|
25 // LOCAL CONSTANTS |
|
26 |
|
27 const uint_t CORE_EAPOL_TRAILER_LENGTH = 0; |
|
28 const uint_t CORE_EAPOL_HEADER_OFFSET = 0; |
|
29 const uint_t CORE_EAPOL_MTU_VALUE = 1500; |
|
30 |
|
31 // ================= MEMBER FUNCTIONS ======================= |
|
32 |
|
33 //-------------------------------------------------- |
|
34 |
|
35 core_wlan_eapol_interface_c::core_wlan_eapol_interface_c( |
|
36 abs_core_server_callback_c& wlm_callback ) : |
|
37 wlm_callback_m( wlm_callback ), |
|
38 function( ), |
|
39 completed_check_pmksa_cache_list( ), |
|
40 stored_frame_m( NULL ), |
|
41 eapol_mode_m( core_eapol_operating_mode_wfa ), |
|
42 authentication_type_m( wlan_eapol_if_eapol_key_authentication_type_none ) |
|
43 { |
|
44 DEBUG( "core_wlan_eapol_interface_c::core_wlan_eapol_interface_c()" ); |
|
45 } |
|
46 |
|
47 //-------------------------------------------------- |
|
48 |
|
49 core_wlan_eapol_interface_c::~core_wlan_eapol_interface_c() |
|
50 { |
|
51 DEBUG( "core_wlan_eapol_interface_c::~core_wlan_eapol_interface_c()" ); |
|
52 |
|
53 delete stored_frame_m; |
|
54 } |
|
55 |
|
56 //-------------------------------------------------- |
|
57 |
|
58 // |
|
59 core_error_e core_wlan_eapol_interface_c::convert_if_status_to_core_error( const u32_t if_status ) |
|
60 { |
|
61 DEBUG1( "core_wlan_eapol_interface_c::convert_if_status_to_core_error( %i )", if_status ); |
|
62 |
|
63 switch ( if_status ) |
|
64 { |
|
65 case wlan_eapol_if_error_ok: |
|
66 return core_error_ok; |
|
67 case wlan_eapol_if_error_pending_request: |
|
68 return core_error_request_pending; |
|
69 case wlan_eapol_if_error_allocation_error: |
|
70 return core_error_no_memory; |
|
71 case wlan_eapol_if_error_illegal_parameter: |
|
72 return core_error_illegal_argument; |
|
73 case wlan_eapol_if_error_process_general_error: |
|
74 return core_error_general; |
|
75 default: |
|
76 DEBUG( "core_wlan_eapol_interface_c::convert_if_status_to_core_error - Error: unknown status" ); |
|
77 return core_error_general; |
|
78 } |
|
79 } |
|
80 |
|
81 //-------------------------------------------------- |
|
82 |
|
83 // |
|
84 core_error_e core_wlan_eapol_interface_c::load_eapol( |
|
85 core_eapol_operating_mode_e mode, |
|
86 abs_wlan_eapol_callback_c* const eapol_handler ) |
|
87 { |
|
88 DEBUG( "core_wlan_eapol_interface_c::load_eapol()" ); |
|
89 |
|
90 eapol_mode_m = mode; |
|
91 return core_wlan_eapol_interface_c::convert_if_status_to_core_error( |
|
92 wlm_callback_m.load_eapol( mode, eapol_handler ) ); |
|
93 } |
|
94 |
|
95 //-------------------------------------------------- |
|
96 |
|
97 // |
|
98 core_error_e core_wlan_eapol_interface_c::shutdown() |
|
99 { |
|
100 DEBUG( "core_wlan_eapol_interface_c::shutdown()" ); |
|
101 return core_wlan_eapol_interface_c::convert_if_status_to_core_error( |
|
102 wlm_callback_m.shutdown() ); |
|
103 } |
|
104 |
|
105 //-------------------------------------------------- |
|
106 |
|
107 core_error_e core_wlan_eapol_interface_c::configure() |
|
108 { |
|
109 DEBUG( "core_wlan_eapol_interface_c::configure()" ); |
|
110 return core_wlan_eapol_interface_c::convert_if_status_to_core_error( |
|
111 wlm_callback_m.configure( |
|
112 CORE_EAPOL_HEADER_OFFSET, |
|
113 CORE_EAPOL_MTU_VALUE, |
|
114 CORE_EAPOL_TRAILER_LENGTH ) ); |
|
115 } |
|
116 |
|
117 //-------------------------------------------------- |
|
118 |
|
119 // |
|
120 core_error_e core_wlan_eapol_interface_c::check_pmksa_cache( |
|
121 core_type_list_c<network_id_c> & network_id_list, |
|
122 const wlan_eapol_if_eapol_key_authentication_type_e selected_eapol_key_authentication_type, |
|
123 const wlan_eapol_if_rsna_cipher_e pairwise_key_cipher_suite, |
|
124 const wlan_eapol_if_rsna_cipher_e group_key_cipher_suite ) |
|
125 { |
|
126 DEBUG( "core_wlan_eapol_interface_c::check_pmksa_cache()" ); |
|
127 core_error_e error = function.check_pmksa_cache( |
|
128 network_id_list, |
|
129 selected_eapol_key_authentication_type, |
|
130 pairwise_key_cipher_suite, |
|
131 group_key_cipher_suite ); |
|
132 |
|
133 if ( error != core_error_ok ) |
|
134 { |
|
135 DEBUG1( "core_wlan_eapol_interface_c::check_pmksa_cache() - Encoding function returns %i", error ); |
|
136 return error; |
|
137 } |
|
138 return core_wlan_eapol_interface_c::convert_if_status_to_core_error( |
|
139 wlm_callback_m.process_data( function.get_data(), function.size()) ); |
|
140 } |
|
141 |
|
142 //-------------------------------------------------- |
|
143 |
|
144 // |
|
145 core_error_e core_wlan_eapol_interface_c::start_authentication( |
|
146 u8_t * ssid, const u32_t ssid_length, |
|
147 const wlan_eapol_if_eapol_key_authentication_type_e selected_eapol_key_authentication_type, |
|
148 u8_t * wpa_psk, const u32_t wpa_psk_length, |
|
149 const bool_t wpa_override_enabled, |
|
150 const network_id_c * network_id ) |
|
151 { |
|
152 DEBUG( "core_wlan_eapol_interface_c::start_authentication()" ); |
|
153 |
|
154 authentication_type_m = selected_eapol_key_authentication_type; |
|
155 |
|
156 core_error_e error = function.start_authentication( |
|
157 ssid, ssid_length, |
|
158 selected_eapol_key_authentication_type, |
|
159 wpa_psk, wpa_psk_length, |
|
160 wpa_override_enabled, |
|
161 network_id ); |
|
162 |
|
163 if ( error != core_error_ok ) |
|
164 { |
|
165 DEBUG1( "core_wlan_eapol_interface_c::start_authentication() - Encoding function returns %i", error ); |
|
166 return error; |
|
167 } |
|
168 return core_wlan_eapol_interface_c::convert_if_status_to_core_error( |
|
169 wlm_callback_m.process_data( function.get_data(), function.size()) ); |
|
170 } |
|
171 |
|
172 //-------------------------------------------------- |
|
173 |
|
174 // |
|
175 core_error_e core_wlan_eapol_interface_c::complete_association( |
|
176 const wlan_eapol_if_eapol_wlan_authentication_state_e association_result, |
|
177 const network_id_c * network_id, |
|
178 u8_t * received_wpa_ie, const u32_t received_wpa_ie_length, |
|
179 u8_t * sent_wpa_ie, const u32_t sent_wpa_ie_length, |
|
180 const wlan_eapol_if_rsna_cipher_e pairwise_key_cipher_suite, |
|
181 const wlan_eapol_if_rsna_cipher_e group_key_cipher_suite ) |
|
182 { |
|
183 DEBUG( "core_wlan_eapol_interface_c::complete_association()" ); |
|
184 core_error_e error = function.complete_association( |
|
185 association_result, |
|
186 network_id, |
|
187 received_wpa_ie, received_wpa_ie_length, |
|
188 sent_wpa_ie, sent_wpa_ie_length, |
|
189 pairwise_key_cipher_suite, |
|
190 group_key_cipher_suite ); |
|
191 |
|
192 if ( error != core_error_ok ) |
|
193 { |
|
194 DEBUG1( "core_wlan_eapol_interface_c::complete_association() - Encoding function returns %i", error ); |
|
195 return error; |
|
196 } |
|
197 return core_wlan_eapol_interface_c::convert_if_status_to_core_error( |
|
198 wlm_callback_m.process_data( function.get_data(), function.size()) ); |
|
199 } |
|
200 |
|
201 //-------------------------------------------------- |
|
202 |
|
203 // |
|
204 core_error_e core_wlan_eapol_interface_c::disassociation( |
|
205 const network_id_c * network_id ) ///< source includes remote address, destination includes local address. |
|
206 { |
|
207 DEBUG( "core_wlan_eapol_interface_c::disassociation()" ); |
|
208 core_error_e error = function.disassociation( |
|
209 network_id ); |
|
210 |
|
211 if ( error != core_error_ok ) |
|
212 { |
|
213 DEBUG1( "core_wlan_eapol_interface_c::disassociation() - Encoding function returns %i", error ); |
|
214 return error; |
|
215 } |
|
216 core_wlan_eapol_interface_c::convert_if_status_to_core_error( |
|
217 wlm_callback_m.process_data( function.get_data(), function.size()) ); |
|
218 return error; |
|
219 } |
|
220 |
|
221 |
|
222 //-------------------------------------------------- |
|
223 |
|
224 |
|
225 // |
|
226 core_error_e core_wlan_eapol_interface_c::start_preauthentication( |
|
227 const network_id_c * network_id ) |
|
228 { |
|
229 DEBUG( "core_wlan_eapol_interface_c::start_preauthentication()" ); |
|
230 core_error_e error = function.start_preauthentication( |
|
231 network_id ); |
|
232 |
|
233 if ( error != core_error_ok ) |
|
234 { |
|
235 DEBUG1( "core_wlan_eapol_interface_c::start_preauthentication() - Encoding function returns %i", error ); |
|
236 return error; |
|
237 } |
|
238 core_wlan_eapol_interface_c::convert_if_status_to_core_error( |
|
239 wlm_callback_m.process_data( function.get_data(), function.size()) ); |
|
240 return error; |
|
241 } |
|
242 |
|
243 |
|
244 //-------------------------------------------------- |
|
245 |
|
246 // |
|
247 core_error_e core_wlan_eapol_interface_c::start_reassociation( |
|
248 const network_id_c * old_network_id, |
|
249 const network_id_c * new_network_id, |
|
250 const wlan_eapol_if_eapol_key_authentication_type_e selected_eapol_key_authentication_type ) |
|
251 { |
|
252 DEBUG( "core_wlan_eapol_interface_c::start_reassociation()" ); |
|
253 |
|
254 authentication_type_m = selected_eapol_key_authentication_type; |
|
255 |
|
256 core_error_e error = function.start_reassociation( |
|
257 old_network_id, |
|
258 new_network_id, |
|
259 selected_eapol_key_authentication_type ); |
|
260 |
|
261 if ( error != core_error_ok ) |
|
262 { |
|
263 DEBUG1( "core_wlan_eapol_interface_c::start_reassociation() - Encoding function returns %i", error ); |
|
264 return error; |
|
265 } |
|
266 core_wlan_eapol_interface_c::convert_if_status_to_core_error( |
|
267 wlm_callback_m.process_data( function.get_data(), function.size()) ); |
|
268 return error; |
|
269 } |
|
270 |
|
271 //-------------------------------------------------- |
|
272 |
|
273 // |
|
274 core_error_e core_wlan_eapol_interface_c::complete_reassociation( |
|
275 const wlan_eapol_if_eapol_wlan_authentication_state_e association_result, |
|
276 const network_id_c * network_id, |
|
277 u8_t * received_wpa_ie, const u32_t received_wpa_ie_length, |
|
278 u8_t * sent_wpa_ie, const u32_t sent_wpa_ie_length, |
|
279 const wlan_eapol_if_rsna_cipher_e pairwise_key_cipher_suite, |
|
280 const wlan_eapol_if_rsna_cipher_e group_key_cipher_suite ) |
|
281 { |
|
282 DEBUG( "core_wlan_eapol_interface_c::complete_reassociation()" ); |
|
283 core_error_e error = function.complete_reassociation( |
|
284 association_result, |
|
285 network_id, |
|
286 received_wpa_ie, received_wpa_ie_length, |
|
287 sent_wpa_ie, sent_wpa_ie_length, |
|
288 pairwise_key_cipher_suite, |
|
289 group_key_cipher_suite ); |
|
290 |
|
291 if ( error != core_error_ok ) |
|
292 { |
|
293 DEBUG1( "core_wlan_eapol_interface_c::complete_reassociation() - Encoding function returns %i", error ); |
|
294 return error; |
|
295 } |
|
296 core_wlan_eapol_interface_c::convert_if_status_to_core_error( |
|
297 wlm_callback_m.process_data( function.get_data(), function.size()) ); |
|
298 return error; |
|
299 } |
|
300 |
|
301 |
|
302 //-------------------------------------------------- |
|
303 |
|
304 // |
|
305 core_error_e core_wlan_eapol_interface_c::start_wpx_fast_roam_reassociation( |
|
306 const network_id_c * old_network_id, |
|
307 const network_id_c * new_network_id, |
|
308 u8_t * reassociation_request_ie, |
|
309 const u32_t reassociation_request_ie_length, |
|
310 const u8_t* received_wpa_ie, |
|
311 u32_t received_wpa_ie_length, |
|
312 const u8_t* sent_wpa_ie, |
|
313 u32_t sent_wpa_ie_length ) |
|
314 { |
|
315 DEBUG( "core_wlan_eapol_interface_c::start_wpx_fast_roam_reassociation()" ); |
|
316 |
|
317 authentication_type_m = wlan_eapol_if_eapol_key_authentication_type_wpx_fast_roam; |
|
318 |
|
319 core_error_e error = function.start_wpx_fast_roam_reassociation( |
|
320 old_network_id, |
|
321 new_network_id, |
|
322 reassociation_request_ie, |
|
323 reassociation_request_ie_length, |
|
324 received_wpa_ie, |
|
325 received_wpa_ie_length, |
|
326 sent_wpa_ie, |
|
327 sent_wpa_ie_length ); |
|
328 |
|
329 if ( error != core_error_ok ) |
|
330 { |
|
331 DEBUG1( "core_wlan_eapol_interface_c::start_wpx_fast_roam_reassociation() - Encoding function returns %i", error ); |
|
332 return error; |
|
333 } |
|
334 core_wlan_eapol_interface_c::convert_if_status_to_core_error( |
|
335 wlm_callback_m.process_data( function.get_data(), function.size()) ); |
|
336 return error; |
|
337 } |
|
338 |
|
339 //-------------------------------------------------- |
|
340 |
|
341 // |
|
342 core_error_e core_wlan_eapol_interface_c::complete_wpx_fast_roam_reassociation( |
|
343 const wlan_eapol_if_eapol_wlan_authentication_state_e reassociation_result, |
|
344 const network_id_c * network_id, |
|
345 u8_t * received_reassociation_ie, const u32_t received_reassociation_ie_length ) |
|
346 { |
|
347 DEBUG( "core_wlan_eapol_interface_c::complete_wpx_fast_roam_reassociation()" ); |
|
348 core_error_e error = function.complete_wpx_fast_roam_reassociation( |
|
349 reassociation_result, |
|
350 network_id, |
|
351 received_reassociation_ie, received_reassociation_ie_length ); |
|
352 |
|
353 if ( error != core_error_ok ) |
|
354 { |
|
355 DEBUG1( "core_wlan_eapol_interface_c::complete_wpx_fast_roam_reassociation() - Encoding function returns %i", error ); |
|
356 return error; |
|
357 } |
|
358 core_wlan_eapol_interface_c::convert_if_status_to_core_error( |
|
359 wlm_callback_m.process_data( function.get_data(), function.size()) ); |
|
360 return error; |
|
361 } |
|
362 |
|
363 |
|
364 //-------------------------------------------------- |
|
365 |
|
366 // |
|
367 core_error_e core_wlan_eapol_interface_c::process_frame( |
|
368 const core_frame_ethernet_c& frame ) |
|
369 { |
|
370 DEBUG( "core_wlan_eapol_interface_c::process_frame()" ); |
|
371 |
|
372 core_mac_address_s destination = |
|
373 frame.destination(); |
|
374 core_mac_address_s source = |
|
375 frame.source(); |
|
376 |
|
377 network_id_c network_id( |
|
378 const_cast<u8_t*>( &source.addr[0] ), |
|
379 MAC_ADDR_LEN, |
|
380 &destination.addr[0], |
|
381 MAC_ADDR_LEN, |
|
382 frame.type() ); |
|
383 |
|
384 core_error_e error = function.packet_process( |
|
385 &network_id, |
|
386 frame.data(), frame.data_length() ); |
|
387 |
|
388 if ( error != core_error_ok ) |
|
389 { |
|
390 DEBUG1( "core_wlan_eapol_interface_c::process_frame() - Encoding function returns %i", error ); |
|
391 return error; |
|
392 } |
|
393 core_wlan_eapol_interface_c::convert_if_status_to_core_error( |
|
394 wlm_callback_m.process_data( function.get_data(), function.size()) ); |
|
395 return error; |
|
396 } |
|
397 |
|
398 //-------------------------------------------------- |
|
399 |
|
400 // |
|
401 core_error_e core_wlan_eapol_interface_c::tkip_mic_failure( |
|
402 const network_id_c * network_id, |
|
403 const bool_t is_fatal_failure, |
|
404 const wlan_eapol_if_eapol_tkip_mic_failure_type_e tkip_mic_failure_type ) |
|
405 { |
|
406 DEBUG( "core_wlan_eapol_interface_c::tkip_mic_failure()" ); |
|
407 |
|
408 core_error_e error = function.tkip_mic_failure( |
|
409 network_id, |
|
410 is_fatal_failure, |
|
411 tkip_mic_failure_type ); |
|
412 |
|
413 if ( error != core_error_ok ) |
|
414 { |
|
415 DEBUG1( "core_wlan_eapol_interface_c::tkip_mic_failure() - Encoding function returns %i", error ); |
|
416 return error; |
|
417 } |
|
418 core_wlan_eapol_interface_c::convert_if_status_to_core_error( |
|
419 wlm_callback_m.process_data( function.get_data(), function.size()) ); |
|
420 return error; |
|
421 } |
|
422 |
|
423 //-------------------------------------------------- |
|
424 |
|
425 // |
|
426 core_error_e core_wlan_eapol_interface_c::eap_acknowledge( |
|
427 const network_id_c * network_id ) |
|
428 { |
|
429 DEBUG( "core_wlan_eapol_interface_c::eap_acknowledge()" ); |
|
430 core_error_e error = function.eap_acknowledge( |
|
431 network_id ); |
|
432 |
|
433 if ( error != core_error_ok ) |
|
434 { |
|
435 DEBUG1( "core_wlan_eapol_interface_c::eap_acknowledge() - Encoding function returns %i", error ); |
|
436 return error; |
|
437 } |
|
438 core_wlan_eapol_interface_c::convert_if_status_to_core_error( |
|
439 wlm_callback_m.process_data( function.get_data(), function.size()) ); |
|
440 return error; |
|
441 } |
|
442 |
|
443 //-------------------------------------------------- |
|
444 |
|
445 core_error_e core_wlan_eapol_interface_c::update_header_offset( |
|
446 const u32_t header_offset, |
|
447 const u32_t MTU, |
|
448 const u32_t trailer_length ) |
|
449 { |
|
450 DEBUG( "core_wlan_eapol_interface_c::update_header_offset()" ); |
|
451 core_error_e error = function.update_header_offset( |
|
452 header_offset, |
|
453 MTU, |
|
454 trailer_length ); |
|
455 |
|
456 if ( error != core_error_ok ) |
|
457 { |
|
458 DEBUG1( "core_wlan_eapol_interface_c::update_header_offset() - Encoding function returns %i", error ); |
|
459 return error; |
|
460 } |
|
461 core_wlan_eapol_interface_c::convert_if_status_to_core_error( |
|
462 wlm_callback_m.process_data( function.get_data(), function.size()) ); |
|
463 return error; |
|
464 } |
|
465 |
|
466 //-------------------------------------------------- |
|
467 |
|
468 core_error_e core_wlan_eapol_interface_c::update_wlan_database_reference_values( |
|
469 u8_t * database_reference_value, const u32_t database_reference_value_length ) |
|
470 { |
|
471 DEBUG( "core_wlan_eapol_interface_c::update_wlan_database_reference_values()" ); |
|
472 core_error_e error = function.update_wlan_database_reference_values( |
|
473 database_reference_value, database_reference_value_length ); |
|
474 |
|
475 if ( error != core_error_ok ) |
|
476 { |
|
477 DEBUG1( "core_wlan_eapol_interface_c::update_wlan_database_reference_values() - Encoding function returns %i", error ); |
|
478 return error; |
|
479 } |
|
480 core_wlan_eapol_interface_c::convert_if_status_to_core_error( |
|
481 wlm_callback_m.process_data( function.get_data(), function.size()) ); |
|
482 return error; |
|
483 } |
|
484 |
|
485 //-------------------------------------------------- |
|
486 |
|
487 core_error_e core_wlan_eapol_interface_c::update_completed_check_pmksa_cache_list( |
|
488 core_type_list_c<network_id_c> & network_id_list ) |
|
489 { |
|
490 DEBUG1( "core_wlan_eapol_interface_c::update_completed_check_pmksa_cache_list() - network_id_list.count() = %i", network_id_list.count() ); |
|
491 |
|
492 completed_check_pmksa_cache_list.clear(); |
|
493 |
|
494 network_id_list.first(); |
|
495 while ( network_id_list.current() ) |
|
496 { |
|
497 if ( network_id_list.current()->source_ptr ) |
|
498 { |
|
499 DEBUG( "core_wlan_eapol_interface_c::update_completed_check_pmksa_cache_list() - Adding mac address to completed_check_pmksa_cache_list" ); |
|
500 core_mac_address_s * mac = new core_mac_address_s( |
|
501 network_id_list.current()->source() ); |
|
502 if ( !mac ) |
|
503 { |
|
504 DEBUG( "core_wlan_eapol_interface_c::update_completed_check_pmksa_cache_list() - new core_mac_address_s failed" ); |
|
505 return core_error_no_memory; |
|
506 } |
|
507 |
|
508 core_error_e error = completed_check_pmksa_cache_list.append( mac ); |
|
509 if ( error != core_error_ok ) |
|
510 { |
|
511 delete mac; |
|
512 mac = NULL; |
|
513 DEBUG1( "core_wlan_eapol_interface_c::update_completed_check_pmksa_cache_list() - completed_check_pmksa_cache_list.append( mac ) failed with code %i", error ); |
|
514 return error; |
|
515 } |
|
516 } |
|
517 else |
|
518 { |
|
519 DEBUG( "core_wlan_eapol_interface_c::update_completed_check_pmksa_cache_list() - source == NULL" ); |
|
520 } |
|
521 |
|
522 network_id_list.next(); |
|
523 } |
|
524 |
|
525 DEBUG1( "core_wlan_eapol_interface_c::update_completed_check_pmksa_cache_list() - completed_check_pmksa_cache_list.count() %i", completed_check_pmksa_cache_list.count() ); |
|
526 return core_error_ok; |
|
527 } |
|
528 |
|
529 //-------------------------------------------------- |
|
530 |
|
531 core_type_list_c<core_mac_address_s> & core_wlan_eapol_interface_c::get_completed_check_pmksa_cache_list() |
|
532 { |
|
533 return completed_check_pmksa_cache_list; |
|
534 } |
|
535 |
|
536 //-------------------------------------------------- |
|
537 |
|
538 // --------------------------------------------------------------------------- |
|
539 // --------------------------------------------------------------------------- |
|
540 // |
|
541 core_error_e core_wlan_eapol_interface_c::store_frame( |
|
542 const core_frame_ethernet_c& frame ) |
|
543 { |
|
544 DEBUG( "core_wlan_eapol_interface_c::store_frame()" ); |
|
545 |
|
546 if ( stored_frame_m ) |
|
547 { |
|
548 DEBUG( "core_wlan_eapol_interface_c::store_frame() - deleting previously stored frame" ); |
|
549 |
|
550 delete stored_frame_m; |
|
551 stored_frame_m = NULL; |
|
552 } |
|
553 |
|
554 stored_frame_m = core_frame_ethernet_c::instance( |
|
555 frame.data_length(), frame.data(), true_t ); |
|
556 if ( !stored_frame_m ) |
|
557 { |
|
558 DEBUG( "core_wlan_eapol_interface_c::store_frame() - unable to copy the frame" ); |
|
559 |
|
560 return core_error_no_memory; |
|
561 } |
|
562 |
|
563 return core_error_ok; |
|
564 } |
|
565 |
|
566 // --------------------------------------------------------------------------- |
|
567 // --------------------------------------------------------------------------- |
|
568 // |
|
569 void core_wlan_eapol_interface_c::clear_stored_frame() |
|
570 { |
|
571 delete stored_frame_m; |
|
572 stored_frame_m = NULL; |
|
573 } |
|
574 |
|
575 // --------------------------------------------------------------------------- |
|
576 // --------------------------------------------------------------------------- |
|
577 // |
|
578 core_error_e core_wlan_eapol_interface_c::process_stored_frame() |
|
579 { |
|
580 if ( !stored_frame_m ) |
|
581 { |
|
582 DEBUG( "core_wlan_eapol_interface_c::store_frame() - no stored frame" ); |
|
583 |
|
584 return core_error_ok; |
|
585 } |
|
586 |
|
587 core_error_e ret = process_frame( *stored_frame_m ); |
|
588 clear_stored_frame(); |
|
589 |
|
590 return ret; |
|
591 } |
|
592 |
|
593 // --------------------------------------------------------------------------- |
|
594 // --------------------------------------------------------------------------- |
|
595 // |
|
596 core_eapol_operating_mode_e core_wlan_eapol_interface_c::operating_mode() const |
|
597 { |
|
598 return eapol_mode_m; |
|
599 } |
|
600 |
|
601 // --------------------------------------------------------------------------- |
|
602 // --------------------------------------------------------------------------- |
|
603 // |
|
604 wlan_eapol_ethernet_type_e core_wlan_eapol_interface_c::ethernet_type() const |
|
605 { |
|
606 if( eapol_mode_m == core_eapol_operating_mode_wapi ) |
|
607 { |
|
608 return wlan_eapol_ethernet_type_wapi; |
|
609 } |
|
610 |
|
611 return wlan_eapol_ethernet_type_pae; |
|
612 } |
|
613 |
|
614 // --------------------------------------------------------------------------- |
|
615 // --------------------------------------------------------------------------- |
|
616 // |
|
617 wlan_eapol_if_eapol_key_authentication_type_e core_wlan_eapol_interface_c::authentication_type() const |
|
618 { |
|
619 return authentication_type_m; |
|
620 } |
|
621 |
|
622 // End of file |