|
1 /* |
|
2 * Copyright (c) 2005-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: CEapVpnInterfaceImplementation |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 // INCLUDE FILES |
|
20 #include <w32std.h> |
|
21 #include <pathinfo.h> |
|
22 |
|
23 #include "eap_vpn_if_implementation.h" |
|
24 #include "eap_am_memory.h" |
|
25 #include "eap_tools.h" |
|
26 #include "eap_type_all.h" |
|
27 #include "eap_am_tools_symbian.h" |
|
28 #include "eap_crypto_api.h" |
|
29 #include "eap_type_gsmsim.h" |
|
30 #include "eap_type_aka.h" |
|
31 #include "eap_header_string.h" |
|
32 #include "EapolDbDefaults.h" |
|
33 #include "EapolDbParameterNames.h" |
|
34 #include "eap_am_file_input_symbian.h" |
|
35 #include "abs_eap_vpn_if.h" |
|
36 #include "eap_array_algorithms.h" |
|
37 |
|
38 #include "EapSimDbDefaults.h" |
|
39 |
|
40 // LOCAL CONSTANTS |
|
41 const TUint KMaxConfigStringLength = 256; |
|
42 const u32_t KMTU = 1500u; |
|
43 const u32_t KTrailerLength = 0; |
|
44 const u32_t KHeaderOffset = 0; |
|
45 |
|
46 #ifndef USE_EAP_EXPANDED_TYPES |
|
47 |
|
48 static const TUint KMaxEapCueLength = 3; |
|
49 |
|
50 #endif //#ifndef USE_EAP_EXPANDED_TYPES |
|
51 |
|
52 #define KEapIdentityOffset 5 |
|
53 const eap_const_string EAPPLUGIN_TRACE_FILE = EAPL("logs\\eapol\\eap_vpn_if.txt"); |
|
54 |
|
55 enum eapol_am_core_timer_id_e |
|
56 { |
|
57 EAPOL_AM_CORE_TIMER_RESTART_AUTHENTICATION_ID, |
|
58 EAPOL_AM_CORE_TIMER_DELETE_STACK_ID, |
|
59 EAPOL_AM_CORE_TIMER_FAILED_COMPLETELY_ID, |
|
60 }; |
|
61 |
|
62 // ================= MEMBER FUNCTIONS ======================= |
|
63 // Create instance of concrete ECOM interface implementation |
|
64 CEapVpnInterfaceImplementation* CEapVpnInterfaceImplementation::NewL(TAbsEapVpnInterfaceParams* aParams) |
|
65 { |
|
66 CEapVpnInterfaceImplementation* self = new (ELeave) CEapVpnInterfaceImplementation; |
|
67 CleanupStack::PushL(self); |
|
68 self->ConstructL(aParams->iCaller, aParams->iClient); |
|
69 |
|
70 if (self->get_is_valid() != true) |
|
71 { |
|
72 User::Leave(KErrGeneral); |
|
73 } |
|
74 |
|
75 CleanupStack::Pop(); |
|
76 return self; |
|
77 } |
|
78 |
|
79 |
|
80 //-------------------------------------------------- |
|
81 // Constructor |
|
82 //-------------------------------------------------- |
|
83 |
|
84 /// VPN does not have any IAP setting at all but we use index 1 in the EAP databases |
|
85 /// for all VPN related settings. |
|
86 const TInt EAP_VPN_DEFAULT_SERVICE_TABLE_INDEX = 1; |
|
87 |
|
88 CEapVpnInterfaceImplementation::CEapVpnInterfaceImplementation() |
|
89 : m_trace_log_file_name(0) |
|
90 , m_is_client(true) |
|
91 #ifdef USE_EAP_EXPANDED_TYPES |
|
92 , m_eap_type_array(0) |
|
93 #endif //#ifdef USE_EAP_EXPANDED_TYPES |
|
94 , m_index_type(EVpn) |
|
95 , m_index(EAP_VPN_DEFAULT_SERVICE_TABLE_INDEX) |
|
96 { |
|
97 } |
|
98 |
|
99 //-------------------------------------------------- |
|
100 // Second phase construction. |
|
101 //-------------------------------------------------- |
|
102 void CEapVpnInterfaceImplementation::ConstructL(MAbsEapVpnInterface* aCaller, TBool aClient) |
|
103 { |
|
104 EAP_TRACE_DEBUG( |
|
105 m_am_tools, |
|
106 TRACE_FLAGS_DEFAULT, |
|
107 (EAPL("CEapVpnInterfaceImplementation::ConstructL()\n"))); |
|
108 |
|
109 iCaller = aCaller; |
|
110 if(aClient) |
|
111 { |
|
112 m_is_client = true; |
|
113 } |
|
114 else |
|
115 { |
|
116 m_is_client = false; |
|
117 } |
|
118 |
|
119 if (iCaller == 0) |
|
120 { |
|
121 User::Leave(KErrGeneral); |
|
122 } |
|
123 |
|
124 // Create tools class |
|
125 m_am_tools = new(ELeave) eap_am_tools_symbian_c(0); |
|
126 |
|
127 if (m_am_tools->get_is_valid() != true) |
|
128 { |
|
129 // The real reason most likely is KErrNoMemory but since that is not sure we'll use KErrGeneral |
|
130 User::Leave(KErrGeneral); |
|
131 } |
|
132 |
|
133 if (m_am_tools->configure() != eap_status_ok) |
|
134 { |
|
135 User::Leave(KErrGeneral); |
|
136 } |
|
137 |
|
138 |
|
139 { |
|
140 TFileName drivePath( PathInfo::MemoryCardRootPath() ); |
|
141 |
|
142 const TInt MAXPATHNAME=256ul; |
|
143 |
|
144 HBufC* buf = HBufC::NewLC(MAXPATHNAME); |
|
145 TPtr pathbuffer = buf->Des(); |
|
146 |
|
147 pathbuffer.Append( TParsePtrC( drivePath ).DriveAndPath() ); |
|
148 |
|
149 { |
|
150 eap_variable_data_c unicode_drivepath(m_am_tools); |
|
151 if (unicode_drivepath.get_is_valid() == false) |
|
152 { |
|
153 (void) EAP_STATUS_RETURN(m_am_tools, eap_status_allocation_error); |
|
154 User::Leave(KErrGeneral); |
|
155 } |
|
156 |
|
157 eap_status_e status = unicode_drivepath.set_buffer(pathbuffer.Ptr(), pathbuffer.Length(), false, false); |
|
158 if (status != eap_status_ok) |
|
159 { |
|
160 (void) EAP_STATUS_RETURN(m_am_tools, status); |
|
161 User::Leave(KErrGeneral); |
|
162 } |
|
163 |
|
164 eap_variable_data_c utf8_drivepath(m_am_tools); |
|
165 if (utf8_drivepath.get_is_valid() == false) |
|
166 { |
|
167 (void) EAP_STATUS_RETURN(m_am_tools, eap_status_allocation_error); |
|
168 User::Leave(KErrGeneral); |
|
169 } |
|
170 |
|
171 status = m_am_tools->convert_unicode_to_utf8( |
|
172 utf8_drivepath, |
|
173 unicode_drivepath); |
|
174 if (status != eap_status_ok) |
|
175 { |
|
176 (void) EAP_STATUS_RETURN(m_am_tools, status); |
|
177 User::Leave(KErrGeneral); |
|
178 } |
|
179 |
|
180 delete m_trace_log_file_name; |
|
181 m_trace_log_file_name = new eap_variable_data_c(m_am_tools); |
|
182 |
|
183 if (m_trace_log_file_name == 0 |
|
184 || m_trace_log_file_name->get_is_valid() == false) |
|
185 { |
|
186 (void) EAP_STATUS_RETURN(m_am_tools, eap_status_allocation_error); |
|
187 User::Leave(KErrGeneral); |
|
188 } |
|
189 |
|
190 status = m_trace_log_file_name->set_copy_of_buffer(&utf8_drivepath); |
|
191 if (status != eap_status_ok) |
|
192 { |
|
193 (void) EAP_STATUS_RETURN(m_am_tools, status); |
|
194 User::Leave(KErrGeneral); |
|
195 } |
|
196 |
|
197 status = m_trace_log_file_name->add_data(EAPPLUGIN_TRACE_FILE, sizeof(EAPPLUGIN_TRACE_FILE)-1); |
|
198 if (status != eap_status_ok) |
|
199 { |
|
200 (void) EAP_STATUS_RETURN(m_am_tools, status); |
|
201 User::Leave(KErrGeneral); |
|
202 } |
|
203 |
|
204 status = m_trace_log_file_name->add_end_null(); |
|
205 if (status != eap_status_ok) |
|
206 { |
|
207 (void) EAP_STATUS_RETURN(m_am_tools, status); |
|
208 User::Leave(KErrGeneral); |
|
209 } |
|
210 } |
|
211 |
|
212 CleanupStack::PopAndDestroy(buf); // Delete pathbuffer. |
|
213 } |
|
214 |
|
215 |
|
216 #ifdef USE_EAP_EXPANDED_TYPES |
|
217 |
|
218 m_eap_type_array = new eap_array_c<eap_type_value_e>(m_am_tools); |
|
219 if (m_eap_type_array == 0) |
|
220 { |
|
221 User::Leave(KErrGeneral); |
|
222 } |
|
223 |
|
224 #endif //#ifdef USE_EAP_EXPANDED_TYPES |
|
225 |
|
226 |
|
227 //------ Create network id |
|
228 { |
|
229 EAP_TRACE_DEBUG( |
|
230 m_am_tools, |
|
231 TRACE_FLAGS_DEFAULT, |
|
232 (EAPL("CEapVpnInterfaceImplementation: Create network ID\n"))); |
|
233 |
|
234 u32_t NWID_SRC = 0; |
|
235 u32_t NWID_DEST = 1; |
|
236 const u16_t EAP_DUMMY_PACKET_TYPE = 1; |
|
237 |
|
238 m_receive_network_id = new eap_am_network_id_c( |
|
239 m_am_tools); |
|
240 |
|
241 if (m_receive_network_id == NULL |
|
242 || m_receive_network_id->get_is_valid() != true) |
|
243 { |
|
244 delete m_receive_network_id; |
|
245 m_receive_network_id = 0; |
|
246 User::Leave(KErrGeneral); |
|
247 } |
|
248 |
|
249 eap_status_e status = m_receive_network_id->set_copy_of_am_network_id( |
|
250 &NWID_SRC, |
|
251 sizeof(NWID_SRC), |
|
252 &NWID_DEST, |
|
253 sizeof(NWID_DEST), |
|
254 EAP_DUMMY_PACKET_TYPE); |
|
255 if (status != eap_status_ok) |
|
256 { |
|
257 delete m_receive_network_id; |
|
258 m_receive_network_id = 0; |
|
259 User::Leave(KErrGeneral); |
|
260 } |
|
261 } |
|
262 |
|
263 |
|
264 m_am_tools->set_trace_mask( |
|
265 eap_am_tools_c::eap_trace_mask_debug |
|
266 | eap_am_tools_c::eap_trace_mask_always |
|
267 | eap_am_tools_c::eap_trace_mask_functions |
|
268 | eap_am_tools_c::eap_trace_mask_error |
|
269 | eap_am_tools_c::eap_trace_mask_message_data); |
|
270 |
|
271 |
|
272 #if !defined(USE_EAP_RDEBUG_TRACE) |
|
273 { |
|
274 eap_variable_data_c trace_output_file(m_am_tools); |
|
275 |
|
276 eap_status_e status = read_configure( |
|
277 cf_str_EAP_TRACE_output_file_name.get_field(), |
|
278 &trace_output_file); |
|
279 |
|
280 if (status == eap_status_ok |
|
281 && trace_output_file.get_is_valid_data() == true) |
|
282 { |
|
283 (void) m_am_tools->set_trace_file_name(&trace_output_file); |
|
284 } |
|
285 } |
|
286 #endif //#if defined(USE_EAP_RDEBUG_TRACE) |
|
287 |
|
288 EAP_TRACE_DEBUG( |
|
289 m_am_tools, |
|
290 TRACE_FLAGS_DEFAULT, |
|
291 (EAPL("CEapVpnInterfaceImplementation: configure\n"))); |
|
292 |
|
293 if (configure() != eap_status_ok) |
|
294 { |
|
295 User::Leave(KErrGeneral); |
|
296 } |
|
297 |
|
298 EAP_TRACE_ALWAYS( |
|
299 m_am_tools, |
|
300 TRACE_FLAGS_DEFAULT, |
|
301 (EAPL("Configured EAPPlugin...\n"))); |
|
302 |
|
303 EAP_TRACE_ALWAYS( |
|
304 m_am_tools, |
|
305 TRACE_FLAGS_DEFAULT, |
|
306 (EAPL("==================\n"))); |
|
307 |
|
308 set_is_valid(); |
|
309 } |
|
310 |
|
311 |
|
312 //-------------------------------------------------- |
|
313 // Destructor |
|
314 //-------------------------------------------------- |
|
315 |
|
316 CEapVpnInterfaceImplementation::~CEapVpnInterfaceImplementation() |
|
317 { |
|
318 EAP_TRACE_DEBUG( |
|
319 m_am_tools, |
|
320 TRACE_FLAGS_DEFAULT, |
|
321 (EAPL("CEapVpnInterfaceImplementation::~CEapVpnInterfaceImplementation() - destructor\n"))); |
|
322 |
|
323 delete m_trace_log_file_name; |
|
324 m_trace_log_file_name = 0; |
|
325 |
|
326 shutdown(); |
|
327 } |
|
328 |
|
329 |
|
330 |
|
331 //-------------------------------------------------- |
|
332 // Shutdown() |
|
333 //-------------------------------------------------- |
|
334 eap_status_e CEapVpnInterfaceImplementation::shutdown() |
|
335 { |
|
336 EAP_TRACE_BEGIN(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
337 |
|
338 EAP_TRACE_DEBUG( |
|
339 m_am_tools, |
|
340 TRACE_FLAGS_DEFAULT, |
|
341 (EAPL("CEapVpnInterfaceImplementation: Shutdown called\n"))); |
|
342 |
|
343 // Cancel timer |
|
344 cancel_all_timers(); |
|
345 |
|
346 // Delete upper stack if it still exists |
|
347 if (iEapCore != 0) |
|
348 { |
|
349 iEapCore->shutdown(); |
|
350 delete iEapCore; |
|
351 iEapCore = NULL; |
|
352 } |
|
353 |
|
354 // Print some statistics |
|
355 if (m_is_client) |
|
356 { |
|
357 EAP_TRACE_ALWAYS( |
|
358 m_am_tools, |
|
359 TRACE_FLAGS_ALWAYS|TRACE_TEST_VECTORS, |
|
360 (EAPL("client authentication SUCCESS %d, FAILED %d\n"), |
|
361 m_successful_authentications, |
|
362 m_failed_authentications)); |
|
363 } |
|
364 else |
|
365 { |
|
366 EAP_TRACE_ALWAYS( |
|
367 m_am_tools, |
|
368 TRACE_FLAGS_ALWAYS|TRACE_TEST_VECTORS, |
|
369 (EAPL("server authentication SUCCESS %d, FAILED %d\n"), |
|
370 m_successful_authentications, |
|
371 m_failed_authentications)); |
|
372 } |
|
373 |
|
374 EAP_TRACE_ALWAYS( |
|
375 m_am_tools, |
|
376 TRACE_FLAGS_DEFAULT, |
|
377 (EAPL("EAPPlugin EXITING.\n"))); |
|
378 |
|
379 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
380 |
|
381 if(m_receive_network_id != 0) |
|
382 { |
|
383 delete m_receive_network_id; |
|
384 } |
|
385 |
|
386 // Unload all loaded plugins |
|
387 for(int i = 0; i < m_plugin_if_array.Count(); i++) |
|
388 { |
|
389 delete m_plugin_if_array[i]; |
|
390 } |
|
391 |
|
392 m_plugin_if_array.Close(); |
|
393 |
|
394 #ifdef USE_EAP_EXPANDED_TYPES |
|
395 |
|
396 m_enabled_expanded_eap_array.ResetAndDestroy(); |
|
397 |
|
398 m_disabled_expanded_eap_array.ResetAndDestroy(); |
|
399 |
|
400 m_eap_type_array->reset(); |
|
401 |
|
402 delete m_eap_type_array; |
|
403 m_eap_type_array = 0; |
|
404 |
|
405 #else // For normal EAP type. |
|
406 |
|
407 // Delete the IAP EAP type info array |
|
408 m_iap_eap_array.ResetAndDestroy(); |
|
409 |
|
410 m_eap_type_array.Close(); |
|
411 |
|
412 #endif //#ifdef USE_EAP_EXPANDED_TYPES |
|
413 |
|
414 delete iManualUsername; |
|
415 iManualUsername = NULL; |
|
416 |
|
417 delete iManualRealm; |
|
418 iManualRealm = NULL; |
|
419 |
|
420 delete iRealmPrefix; |
|
421 iRealmPrefix = NULL; |
|
422 |
|
423 // Finally delete tools. No logging is allowed after this. |
|
424 if (m_am_tools != 0) |
|
425 { |
|
426 m_am_tools->shutdown(); |
|
427 delete m_am_tools; |
|
428 } |
|
429 |
|
430 return eap_status_ok; |
|
431 } |
|
432 |
|
433 |
|
434 |
|
435 //-------------------------------------------------- |
|
436 |
|
437 // |
|
438 void CEapVpnInterfaceImplementation::RunL() |
|
439 { |
|
440 EAP_TRACE_BEGIN(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
441 |
|
442 EAP_TRACE_DEBUG( |
|
443 m_am_tools, |
|
444 TRACE_FLAGS_DEFAULT, |
|
445 (EAPL("CEapVpnInterfaceImplementation: RunL(): iStatus.Int() = %d\n"), |
|
446 iStatus.Int())); |
|
447 |
|
448 if (iStatus.Int() != KErrNone) |
|
449 { |
|
450 return; |
|
451 } |
|
452 |
|
453 // Authentication cancelled. |
|
454 EAP_TRACE_ALWAYS( |
|
455 m_am_tools, |
|
456 TRACE_FLAGS_ALWAYS|TRACE_FLAGS_DEFAULT, |
|
457 (EAPL("Authentication cancelled.\n"))); |
|
458 |
|
459 // Set block on. |
|
460 m_block_packet_sends_and_notifications = true; |
|
461 |
|
462 // Reset flags |
|
463 m_stack_marked_to_be_deleted = true; |
|
464 set_timer(this, EAPOL_AM_CORE_TIMER_DELETE_STACK_ID, 0, 0); |
|
465 |
|
466 EAP_TRACE_ALWAYS( |
|
467 m_am_tools, |
|
468 TRACE_FLAGS_ALWAYS|TRACE_FLAGS_DEFAULT, |
|
469 (EAPL("Indication sent: EFailedCompletely.\n"))); |
|
470 |
|
471 iCaller->EapIndication(EFailedCompletely); |
|
472 |
|
473 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
474 } |
|
475 |
|
476 //-------------------------------------------------- |
|
477 |
|
478 // |
|
479 void CEapVpnInterfaceImplementation::DoCancel() |
|
480 { |
|
481 EAP_TRACE_BEGIN(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
482 |
|
483 EAP_TRACE_ALWAYS( |
|
484 m_am_tools, |
|
485 TRACE_FLAGS_DEFAULT, |
|
486 (EAPL("eap_vpn_if::DoCancel()\n"))); |
|
487 |
|
488 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
489 } |
|
490 |
|
491 |
|
492 //-------------------------------------------------- |
|
493 // Configure() |
|
494 //-------------------------------------------------- |
|
495 |
|
496 eap_status_e CEapVpnInterfaceImplementation::configure() |
|
497 { |
|
498 EAP_TRACE_DEBUG( |
|
499 m_am_tools, |
|
500 TRACE_FLAGS_DEFAULT, |
|
501 (EAPL("CEapVpnInterfaceImplementation::configure()\n"))); |
|
502 |
|
503 //---------------------------------------------------------- |
|
504 |
|
505 { |
|
506 eap_variable_data_c EAP_TRACE_activate_trace_on_error(m_am_tools); |
|
507 |
|
508 eap_status_e status = read_configure( |
|
509 cf_str_EAP_TRACE_activate_trace_on_error.get_field(), |
|
510 &EAP_TRACE_activate_trace_on_error); |
|
511 |
|
512 if (status == eap_status_ok |
|
513 && EAP_TRACE_activate_trace_on_error.get_is_valid_data() == true) |
|
514 { |
|
515 u32_t *activate_trace_on_error = (u32_t *)EAP_TRACE_activate_trace_on_error.get_data(sizeof(u32_t)); |
|
516 |
|
517 if (activate_trace_on_error != 0 |
|
518 && *activate_trace_on_error != 0) |
|
519 { |
|
520 m_am_tools->set_activate_trace_on_error(); |
|
521 } |
|
522 } |
|
523 } |
|
524 |
|
525 //---------------------------------------------------------- |
|
526 |
|
527 // All of the configuration options are optional. |
|
528 // So we return OK. |
|
529 return eap_status_ok; |
|
530 } |
|
531 |
|
532 |
|
533 //---------------------------------------------------------- |
|
534 // Implementations of virtual functions from CEapVpnInterface |
|
535 //---------------------------------------------------------- |
|
536 |
|
537 /** |
|
538 * Function: EapConfigure |
|
539 * |
|
540 * Description: Configures the eap plugin |
|
541 * |
|
542 * @param aManualUsername The username, if not zero |
|
543 * @param aManualRealm The realm, if not zero |
|
544 * @param aManualRealmPrefix The realm prefix, if not zero |
|
545 * @param aHideInitialIdentity Scramble username, if true |
|
546 * |
|
547 */ |
|
548 TInt CEapVpnInterfaceImplementation::EapConfigure( |
|
549 TDesC8& aManualUsername, |
|
550 TDesC8& aManualRealm, |
|
551 TDesC8& aRealmPrefix, |
|
552 TBool aHideInitialIdentity) |
|
553 { |
|
554 EAP_TRACE_DEBUG( |
|
555 m_am_tools, |
|
556 TRACE_FLAGS_DEFAULT, |
|
557 (EAPL("CEapVpnInterfaceImplementation::EapConfigure()\n"))); |
|
558 |
|
559 EAP_TRACE_DATA_DEBUG( |
|
560 m_am_tools, |
|
561 TRACE_FLAGS_DEFAULT, |
|
562 (EAPL("CEapVpnInterfaceImplementation::EapConfigure(): aManualUsername\n"), |
|
563 aManualUsername.Ptr(), |
|
564 aManualUsername.Size())); |
|
565 |
|
566 EAP_TRACE_DATA_DEBUG( |
|
567 m_am_tools, |
|
568 TRACE_FLAGS_DEFAULT, |
|
569 (EAPL("CEapVpnInterfaceImplementation::EapConfigure(): aManualRealm\n"), |
|
570 aManualRealm.Ptr(), |
|
571 aManualRealm.Size())); |
|
572 |
|
573 EAP_TRACE_DATA_DEBUG( |
|
574 m_am_tools, |
|
575 TRACE_FLAGS_DEFAULT, |
|
576 (EAPL("CEapVpnInterfaceImplementation::EapConfigure(): aRealmPrefix\n"), |
|
577 aRealmPrefix.Ptr(), |
|
578 aRealmPrefix.Size())); |
|
579 |
|
580 iHideInitialIdentity = aHideInitialIdentity; |
|
581 |
|
582 delete iManualUsername; |
|
583 iManualUsername = NULL; |
|
584 |
|
585 delete iManualRealm; |
|
586 iManualRealm = NULL; |
|
587 |
|
588 delete iRealmPrefix; |
|
589 iRealmPrefix = NULL; |
|
590 |
|
591 TRAPD(error, |
|
592 iManualUsername = aManualUsername.AllocL(); |
|
593 iManualRealm = aManualRealm.AllocL(); |
|
594 iRealmPrefix = aRealmPrefix.AllocL(); |
|
595 ); |
|
596 |
|
597 if (error != KErrNone) |
|
598 { |
|
599 EAP_TRACE_ERROR( |
|
600 m_am_tools, |
|
601 TRACE_FLAGS_DEFAULT, |
|
602 (EAPL("CEapVpnInterfaceImplementation::EapConfigure(): error = %d\n"), |
|
603 error)); |
|
604 return error; |
|
605 } |
|
606 |
|
607 EAP_TRACE_DATA_DEBUG( |
|
608 m_am_tools, |
|
609 TRACE_FLAGS_DEFAULT, |
|
610 (EAPL("CEapVpnInterfaceImplementation::EapConfigure(): iManualUsername\n"), |
|
611 iManualUsername->Ptr(), |
|
612 iManualUsername->Size())); |
|
613 |
|
614 EAP_TRACE_DATA_DEBUG( |
|
615 m_am_tools, |
|
616 TRACE_FLAGS_DEFAULT, |
|
617 (EAPL("CEapVpnInterfaceImplementation::EapConfigure(): iManualRealm\n"), |
|
618 iManualRealm->Ptr(), |
|
619 iManualRealm->Size())); |
|
620 |
|
621 EAP_TRACE_DATA_DEBUG( |
|
622 m_am_tools, |
|
623 TRACE_FLAGS_DEFAULT, |
|
624 (EAPL("CEapVpnInterfaceImplementation::EapConfigure(): iRealmPrefix\n"), |
|
625 iRealmPrefix->Ptr(), |
|
626 iRealmPrefix->Size())); |
|
627 |
|
628 return KErrNone; |
|
629 } |
|
630 |
|
631 |
|
632 /** |
|
633 * Function: StartL |
|
634 * |
|
635 * Description: Initializes the eap plugin |
|
636 * |
|
637 */ |
|
638 TInt CEapVpnInterfaceImplementation::StartL(const TUint8 aEapType) |
|
639 { |
|
640 EAP_TRACE_BEGIN(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
641 |
|
642 EAP_TRACE_DEBUG( |
|
643 m_am_tools, |
|
644 TRACE_FLAGS_DEFAULT, |
|
645 (EAPL("CEapVpnInterfaceImplementation::StartL()\n"))); |
|
646 |
|
647 eap_status_e status(eap_status_ok); |
|
648 iQueryIdentity = EFalse; |
|
649 |
|
650 iRequestedEapType = static_cast<eap_type_ietf_values_e>(aEapType); |
|
651 |
|
652 if (iEapCore != 0) |
|
653 { |
|
654 EAP_TRACE_ALWAYS( |
|
655 m_am_tools, |
|
656 TRACE_FLAGS_DEFAULT, |
|
657 (EAPL("Deleting previously used stack.\n"))); |
|
658 |
|
659 // It is an error to call start without calling disassociated |
|
660 if (m_stack_marked_to_be_deleted == false) |
|
661 { |
|
662 EAP_TRACE_ERROR( |
|
663 m_am_tools, |
|
664 TRACE_FLAGS_DEFAULT, |
|
665 (EAPL("eap_vpn_if::Start called twice!\n"))); |
|
666 return KErrAlreadyExists; |
|
667 } |
|
668 |
|
669 // The previously used stack is perhaps still waiting for deletion. |
|
670 cancel_timer(this, EAPOL_AM_CORE_TIMER_DELETE_STACK_ID); |
|
671 |
|
672 // Delete stack |
|
673 iEapCore->shutdown(); |
|
674 delete iEapCore; |
|
675 iEapCore = 0; |
|
676 |
|
677 m_stack_marked_to_be_deleted = false; |
|
678 } |
|
679 |
|
680 // Clear packet send and notification blocking. |
|
681 m_block_packet_sends_and_notifications = false; |
|
682 |
|
683 #ifdef USE_EAP_EXPANDED_TYPES |
|
684 |
|
685 if (m_enabled_expanded_eap_array.Count() == 0) |
|
686 { |
|
687 // The EAP field was empty. Allow all types. |
|
688 |
|
689 EAP_TRACE_ALWAYS( |
|
690 m_am_tools, |
|
691 TRACE_FLAGS_DEFAULT, |
|
692 (EAPL("Empty EAP field -> enable all types.\n"))); |
|
693 |
|
694 RImplInfoPtrArray eapArray; |
|
695 CleanupStack::PushL( TCleanupItem( CleanupImplArray, &eapArray ) ); |
|
696 |
|
697 REComSession::ListImplementationsL(KEapTypeInterfaceUid, eapArray); |
|
698 |
|
699 for (TInt i = 0; i < eapArray.Count(); i++) |
|
700 { |
|
701 SEapExpandedType * expandedEAPType = new (ELeave) SEapExpandedType; |
|
702 expandedEAPType->EapExpandedType = eapArray[i]->DataType(); |
|
703 |
|
704 eap_expanded_type_c tmpExpEAPType; |
|
705 |
|
706 // This is to make the tmpExpEAPType in 8 byte string with correct vendor type and vendor id details. |
|
707 status = eap_expanded_type_c::read_type(m_am_tools, |
|
708 0, // index should be zero here. |
|
709 expandedEAPType->EapExpandedType.Ptr(), |
|
710 KExpandedEapTypeSize, |
|
711 &tmpExpEAPType); |
|
712 if (status != eap_status_ok) |
|
713 { |
|
714 delete expandedEAPType; |
|
715 expandedEAPType = 0; |
|
716 |
|
717 EAP_TRACE_DEBUG( |
|
718 m_am_tools, |
|
719 TRACE_FLAGS_DEFAULT, |
|
720 (EAPL("CEapVpnInterfaceImplementation::StartL: eap_expanded_type_c::write_type failed \n"))); |
|
721 |
|
722 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
723 return EAP_STATUS_RETURN(m_am_tools, status); |
|
724 } |
|
725 |
|
726 // Now add the EAP types to the array |
|
727 if(tmpExpEAPType == iRequestedEapType) |
|
728 { |
|
729 // This is the requested EAP type. |
|
730 |
|
731 EAP_TRACE_DATA_DEBUG( |
|
732 m_am_tools, |
|
733 TRACE_FLAGS_DEFAULT, |
|
734 (EAPL("CEapVpnInterfaceImplementation::StartL:Enabled (Requested) EAP type:"), |
|
735 expandedEAPType->EapExpandedType.Ptr(), |
|
736 expandedEAPType->EapExpandedType.Size())); |
|
737 |
|
738 m_enabled_expanded_eap_array.Insert(expandedEAPType, 0); // This goes to the beginning. |
|
739 } |
|
740 else |
|
741 { |
|
742 EAP_TRACE_DATA_DEBUG( |
|
743 m_am_tools, |
|
744 TRACE_FLAGS_DEFAULT, |
|
745 (EAPL("CEapVpnInterfaceImplementation::StartL:Disabled EAP type:"), |
|
746 expandedEAPType->EapExpandedType.Ptr(), |
|
747 expandedEAPType->EapExpandedType.Size())); |
|
748 |
|
749 delete expandedEAPType; |
|
750 expandedEAPType = 0; |
|
751 |
|
752 } |
|
753 } // for() |
|
754 |
|
755 CleanupStack::PopAndDestroy(&eapArray); |
|
756 } |
|
757 |
|
758 #else // For normal EAP type. |
|
759 |
|
760 if (m_iap_eap_array.Count() == 0) |
|
761 { |
|
762 // The EAP field was empty. Allow all types. |
|
763 |
|
764 EAP_TRACE_ALWAYS( |
|
765 m_am_tools, |
|
766 TRACE_FLAGS_DEFAULT, |
|
767 (EAPL("Empty EAP field -> enable all types.\n"))); |
|
768 |
|
769 RImplInfoPtrArray eapArray; |
|
770 CleanupStack::PushL( TCleanupItem( CleanupImplArray, &eapArray ) ); |
|
771 |
|
772 REComSession::ListImplementationsL(KEapTypeInterfaceUid, eapArray); |
|
773 |
|
774 for (TInt i = 0; i < eapArray.Count(); i++) |
|
775 { |
|
776 TEap *eap = new(ELeave) TEap; |
|
777 eap->UID.Copy(eapArray[i]->DataType()); |
|
778 eap->Enabled = EFalse; |
|
779 |
|
780 // Convert the string to integer |
|
781 TLex8 tmp(eap->UID); |
|
782 TInt val(0); |
|
783 tmp.Val(val); |
|
784 |
|
785 if(val == iRequestedEapType) |
|
786 { |
|
787 eap->Enabled = ETrue; |
|
788 |
|
789 EAP_TRACE_ALWAYS( |
|
790 m_am_tools, |
|
791 TRACE_FLAGS_DEFAULT, |
|
792 (EAPL("EAP-Type %d enabled\n"), val)); |
|
793 |
|
794 m_iap_eap_array.Insert(eap, 0); |
|
795 } |
|
796 else |
|
797 { |
|
798 m_iap_eap_array.Append(eap); |
|
799 |
|
800 EAP_TRACE_ALWAYS( |
|
801 m_am_tools, |
|
802 TRACE_FLAGS_DEFAULT, |
|
803 (EAPL("EAP-Type %d disabled\n"), val)); |
|
804 } |
|
805 } // for() |
|
806 |
|
807 CleanupStack::PopAndDestroy(&eapArray); |
|
808 } |
|
809 |
|
810 #endif //#ifdef USE_EAP_EXPANDED_TYPES |
|
811 |
|
812 CompleteAssociation(status); |
|
813 |
|
814 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
815 return m_am_tools->convert_eapol_error_to_am_error(EAP_STATUS_RETURN(m_am_tools, status)); |
|
816 } |
|
817 |
|
818 //-------------------------------------------------- |
|
819 |
|
820 // |
|
821 TInt CEapVpnInterfaceImplementation::CompleteAssociation( |
|
822 const TInt aResult |
|
823 ) |
|
824 { |
|
825 EAP_TRACE_BEGIN(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
826 |
|
827 EAP_TRACE_DEBUG( |
|
828 m_am_tools, |
|
829 TRACE_FLAGS_DEFAULT, |
|
830 (EAPL("CEapVpnInterfaceImplementation::CompleteAssociation(): aResult=%d\n"), |
|
831 aResult)); |
|
832 |
|
833 eap_status_e status(eap_status_ok); |
|
834 |
|
835 // ASSOCIATION UNSUCCESSFUL |
|
836 if (aResult != KErrNone) |
|
837 { |
|
838 EAP_TRACE_ALWAYS( |
|
839 m_am_tools, |
|
840 TRACE_FLAGS_DEFAULT, |
|
841 (EAPL("CompleteAssociation: Unsuccessful.\n"))); |
|
842 iCaller->EapIndication(EFailedCompletely); |
|
843 return KErrNone; |
|
844 } |
|
845 |
|
846 // ASSOCIATION SUCCESSFUL |
|
847 EAP_TRACE_ALWAYS( |
|
848 m_am_tools, |
|
849 TRACE_FLAGS_ALWAYS|TRACE_FLAGS_DEFAULT, |
|
850 (EAPL("CompleteAssociation: Successful.\n"))); |
|
851 |
|
852 // Create stack if it does not already exist. |
|
853 status = create_upper_stack(); |
|
854 |
|
855 if (status != eap_status_ok |
|
856 && status != eap_status_already_exists) |
|
857 { |
|
858 EAP_TRACE_ALWAYS( |
|
859 m_am_tools, |
|
860 TRACE_FLAGS_ALWAYS|TRACE_FLAGS_DEFAULT, |
|
861 (EAPL("Indication sent to VPN: EFailedCompletely.\n"))); |
|
862 |
|
863 iCaller->EapIndication(EFailedCompletely); |
|
864 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
865 return KErrNone; |
|
866 } |
|
867 |
|
868 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
869 return m_am_tools->convert_eapol_error_to_am_error(EAP_STATUS_RETURN(m_am_tools, status)); |
|
870 } |
|
871 |
|
872 /** |
|
873 * Function: QueryIdentity |
|
874 * |
|
875 * Description: Ask the identity |
|
876 * |
|
877 * @param aType name of requested eap type implementation. |
|
878 */ |
|
879 TInt CEapVpnInterfaceImplementation::QueryIdentity() |
|
880 { |
|
881 // Build Eap Identity reques message |
|
882 // and send it to eap_core. |
|
883 // Eap core determines the identity and |
|
884 // responses with packet_send() callback |
|
885 EAP_TRACE_BEGIN(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
886 |
|
887 EAP_TRACE_DEBUG( |
|
888 m_am_tools, |
|
889 TRACE_FLAGS_DEFAULT, |
|
890 (EAPL("CEapVpnInterfaceImplementation::QueryIdentity()\n"))); |
|
891 |
|
892 // Build identity request only if GSM/SIM or AKA |
|
893 if((iRequestedEapType != eap_type_gsmsim) && (iRequestedEapType != eap_type_aka)) |
|
894 { |
|
895 TRAPD(error, (iCaller->EapIdentityResponseL(NULL))); |
|
896 if(error != KErrNone) |
|
897 { |
|
898 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
899 return EAP_STATUS_RETURN(m_am_tools, m_am_tools->convert_am_error_to_eapol_error(error)); |
|
900 } |
|
901 return m_am_tools->convert_eapol_error_to_am_error(EAP_STATUS_RETURN(m_am_tools, eap_status_ok)); |
|
902 } |
|
903 |
|
904 iQueryIdentity = ETrue; |
|
905 eap_status_e status(eap_status_ok); |
|
906 |
|
907 status = send_eap_identity_request(); |
|
908 |
|
909 if(status == eap_status_pending_request) |
|
910 { |
|
911 // Request pending, it's OK |
|
912 status = eap_status_ok; |
|
913 } |
|
914 |
|
915 if(status != eap_status_ok) |
|
916 { |
|
917 EAP_TRACE_ALWAYS( |
|
918 m_am_tools, |
|
919 TRACE_FLAGS_DEFAULT, |
|
920 (EAPL("eap_vpn_if::QueryIdentity() error, status = %d\n"), status)); |
|
921 |
|
922 iQueryIdentity = EFalse; |
|
923 } |
|
924 |
|
925 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
926 return m_am_tools->convert_eapol_error_to_am_error(EAP_STATUS_RETURN(m_am_tools, status)); |
|
927 } |
|
928 |
|
929 //-------------------------------------------------- |
|
930 |
|
931 // |
|
932 eap_status_e CEapVpnInterfaceImplementation::send_eap_identity_request() |
|
933 { |
|
934 EAP_TRACE_BEGIN(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
935 |
|
936 EAP_ASSERT(m_am_tools->get_global_mutex()->get_is_reserved() == true); |
|
937 |
|
938 eap_status_e status = eap_status_process_general_error; |
|
939 |
|
940 EAP_TRACE_DEBUG( |
|
941 m_am_tools, |
|
942 TRACE_FLAGS_DEFAULT, |
|
943 (EAPL("CEapVpnInterfaceImplementation::send_eap_identity_request()\n"))); |
|
944 |
|
945 // Creates a identity request message. |
|
946 eap_buf_chain_wr_c request_packet( |
|
947 eap_write_buffer, |
|
948 m_am_tools, |
|
949 EAP_CORE_PACKET_BUFFER_LENGTH); |
|
950 |
|
951 if (request_packet.get_is_valid() == false) |
|
952 { |
|
953 EAP_TRACE_ERROR( |
|
954 m_am_tools, |
|
955 TRACE_FLAGS_DEFAULT, |
|
956 (EAPL("send_eap_identity_request(): %s, %s, packet buffer corrupted.\n"), |
|
957 (m_is_client == true) ? "client": "server" |
|
958 )); |
|
959 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
960 return EAP_STATUS_RETURN(m_am_tools, eap_status_allocation_error); |
|
961 } |
|
962 |
|
963 u32_t buffer_size = EAP_CORE_PACKET_BUFFER_LENGTH; |
|
964 |
|
965 eap_header_wr_c eap_request( |
|
966 m_am_tools, |
|
967 request_packet.get_data_offset(0, buffer_size), |
|
968 buffer_size); |
|
969 |
|
970 if (eap_request.get_is_valid() == false) |
|
971 { |
|
972 EAP_TRACE_ERROR( |
|
973 m_am_tools, |
|
974 TRACE_FLAGS_DEFAULT, |
|
975 (EAPL("send_eap_identity_request():packet buffer corrupted.\n") |
|
976 )); |
|
977 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
978 return EAP_STATUS_RETURN(m_am_tools, eap_status_header_corrupted); |
|
979 } |
|
980 |
|
981 eap_request.set_length((u16_t)(EAP_CORE_PACKET_BUFFER_LENGTH), true); |
|
982 eap_request.set_code(eap_code_request); |
|
983 eap_request.set_identifier(0); |
|
984 eap_request.set_type_data_length(0u, false); |
|
985 eap_request.set_type(eap_type_identity, false); |
|
986 |
|
987 EAP_ASSERT(eap_request.get_length() >= 4); |
|
988 |
|
989 status = iEapCore->packet_process( |
|
990 m_receive_network_id, |
|
991 &eap_request, |
|
992 eap_request.get_length()); |
|
993 |
|
994 EAP_TRACE_DEBUG( |
|
995 m_am_tools, |
|
996 TRACE_FLAGS_DEFAULT, |
|
997 (EAPL("CEapVpnInterfaceImplementation::send_identity_request(): iEapCore->packet_process() = %d\n"), status)); |
|
998 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
999 |
|
1000 return EAP_STATUS_RETURN(m_am_tools, status); |
|
1001 } |
|
1002 |
|
1003 |
|
1004 /** |
|
1005 * Function: EapInbound |
|
1006 * |
|
1007 * Description: Handle incoming eap message. |
|
1008 * |
|
1009 * @param aMessage incoming eap message. |
|
1010 * |
|
1011 */ |
|
1012 TInt CEapVpnInterfaceImplementation::EapInbound(const TDesC8& aMessage) |
|
1013 { |
|
1014 EAP_TRACE_BEGIN(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
1015 |
|
1016 // from eapol_am_core_symbian.cpp ReceivePacket |
|
1017 iQueryIdentity = EFalse; |
|
1018 eap_status_e status(eap_status_ok); |
|
1019 |
|
1020 EAP_TRACE_DEBUG( |
|
1021 m_am_tools, |
|
1022 TRACE_FLAGS_DEFAULT, |
|
1023 (EAPL("CEapVpnInterfaceImplementation::EapInbound()\n"))); |
|
1024 |
|
1025 TInt length = aMessage.Length(); |
|
1026 if (length < 4) |
|
1027 { |
|
1028 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
1029 return m_am_tools->convert_eapol_error_to_am_error( |
|
1030 EAP_STATUS_RETURN(m_am_tools, eap_status_too_short_message)); |
|
1031 } |
|
1032 |
|
1033 // Creates a identity request message. |
|
1034 eap_buf_chain_wr_c request_packet( |
|
1035 eap_write_buffer, |
|
1036 m_am_tools, |
|
1037 aMessage.Length()); |
|
1038 |
|
1039 request_packet.add_data(aMessage.Ptr(), aMessage.Length()); |
|
1040 |
|
1041 eap_header_wr_c eap_request( |
|
1042 m_am_tools, |
|
1043 request_packet.get_data_offset(0, aMessage.Length()), |
|
1044 aMessage.Length()); |
|
1045 |
|
1046 // Forward the packet to the Eap layer of the EAPOL stack. Ignore return value. Failure is signalled using state_notification. |
|
1047 status = iEapCore->packet_process( |
|
1048 m_receive_network_id, |
|
1049 &eap_request, |
|
1050 length); |
|
1051 |
|
1052 EAP_TRACE_DEBUG( |
|
1053 m_am_tools, |
|
1054 TRACE_FLAGS_DEFAULT, |
|
1055 (EAPL("CEapVpnInterfaceImplementation::iEapCore->packet_process() = %d\n"), status)); |
|
1056 |
|
1057 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
1058 |
|
1059 return m_am_tools->convert_eapol_error_to_am_error(EAP_STATUS_RETURN(m_am_tools, status)); |
|
1060 } |
|
1061 |
|
1062 //-------------------------------------------------- |
|
1063 // create_upper_stack |
|
1064 //-------------------------------------------------- |
|
1065 eap_status_e CEapVpnInterfaceImplementation::create_upper_stack() |
|
1066 { |
|
1067 EAP_TRACE_BEGIN(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
1068 |
|
1069 EAP_TRACE_DEBUG( |
|
1070 m_am_tools, |
|
1071 TRACE_FLAGS_DEFAULT, |
|
1072 (EAPL("CEapVpnInterfaceImplementation::create_upper_stack()\n"))); |
|
1073 |
|
1074 eap_status_e status(eap_status_ok); |
|
1075 |
|
1076 if (iEapCore == 0) |
|
1077 { |
|
1078 iEapCore = new eap_core_c(m_am_tools, this, m_is_client, m_receive_network_id, EFalse); |
|
1079 |
|
1080 if (iEapCore == 0 |
|
1081 || iEapCore->get_is_valid() != true) |
|
1082 { |
|
1083 if (iEapCore != 0) |
|
1084 { |
|
1085 iEapCore->shutdown(); |
|
1086 delete iEapCore; |
|
1087 iEapCore = 0; |
|
1088 } |
|
1089 EAP_TRACE_ERROR(m_am_tools, TRACE_FLAGS_DEFAULT, (EAPL("Stack creation failed.\n"))); |
|
1090 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
1091 return EAP_STATUS_RETURN(m_am_tools, eap_status_process_general_error); |
|
1092 } |
|
1093 |
|
1094 // Initialise upper stack |
|
1095 status = iEapCore->configure(); |
|
1096 |
|
1097 if (status != eap_status_ok) |
|
1098 { |
|
1099 iEapCore->shutdown(); |
|
1100 delete iEapCore; |
|
1101 iEapCore = 0; |
|
1102 |
|
1103 EAP_TRACE_ERROR(m_am_tools, TRACE_FLAGS_DEFAULT, (EAPL("Stack creation failed.\n"))); |
|
1104 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
1105 return EAP_STATUS_RETURN(m_am_tools, eap_status_process_general_error); |
|
1106 } |
|
1107 } |
|
1108 else |
|
1109 { |
|
1110 status = eap_status_already_exists; |
|
1111 } |
|
1112 |
|
1113 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
1114 return status; |
|
1115 } |
|
1116 |
|
1117 |
|
1118 // Virtual callback function implementations, called by the eap_core |
|
1119 |
|
1120 /** |
|
1121 * The derived class could send packets to partner class with this function. |
|
1122 * @see abs_eap_base_type_c::packet_send(). |
|
1123 */ |
|
1124 eap_status_e CEapVpnInterfaceImplementation::packet_send( |
|
1125 const eap_am_network_id_c * const /*send_network_id*/, |
|
1126 eap_buf_chain_wr_c * const sent_packet, |
|
1127 const u32_t header_offset, |
|
1128 const u32_t data_length, |
|
1129 const u32_t /*buffer_length*/) |
|
1130 { |
|
1131 EAP_TRACE_BEGIN(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
1132 |
|
1133 EAP_TRACE_DEBUG( |
|
1134 m_am_tools, |
|
1135 TRACE_FLAGS_DEFAULT, |
|
1136 (EAPL("CEapVpnInterfaceImplementation::packet_send(data_length=%d)\n"), |
|
1137 data_length)); |
|
1138 |
|
1139 if (header_offset != 0u) |
|
1140 { |
|
1141 EAP_TRACE_ALWAYS( |
|
1142 m_am_tools, |
|
1143 TRACE_FLAGS_DEFAULT, |
|
1144 (EAPL("packet_send: packet buffer corrupted.\n"))); |
|
1145 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
1146 return eap_status_process_general_error; |
|
1147 } |
|
1148 else if (header_offset+data_length != sent_packet->get_data_length()) |
|
1149 { |
|
1150 EAP_TRACE_ALWAYS( |
|
1151 m_am_tools, |
|
1152 TRACE_FLAGS_DEFAULT, |
|
1153 (EAPL("ERROR: packet_send: packet buffer corrupted (data_length != sent_packet->get_data_length()).\n"))); |
|
1154 EAP_ASSERT(data_length == sent_packet->get_buffer_length()); |
|
1155 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
1156 return eap_status_process_general_error; |
|
1157 } |
|
1158 |
|
1159 if (m_block_packet_sends_and_notifications == true) |
|
1160 { |
|
1161 // Packet sending block is active. This happens when disassociated has been called. |
|
1162 // start_authentication clears the block. |
|
1163 EAP_TRACE_ALWAYS( |
|
1164 m_am_tools, |
|
1165 TRACE_FLAGS_DEFAULT, |
|
1166 (EAPL("packet_send: packet ignored because Disassociated() was called.\n"))); |
|
1167 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
1168 return eap_status_ok; |
|
1169 } |
|
1170 |
|
1171 eap_header_wr_c eap( |
|
1172 m_am_tools, |
|
1173 sent_packet->get_data_offset( |
|
1174 header_offset, data_length), |
|
1175 data_length); |
|
1176 |
|
1177 TInt status(KErrNone); |
|
1178 if (status == KErrNone) |
|
1179 { |
|
1180 u8_t * const packet_data = sent_packet->get_data_offset(header_offset, data_length); |
|
1181 if (packet_data == 0) |
|
1182 { |
|
1183 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
1184 return eap_status_buffer_too_short; |
|
1185 } |
|
1186 |
|
1187 // Here we send the original packet. |
|
1188 HBufC8* eapData = NULL; |
|
1189 TInt error = KErrNone; |
|
1190 |
|
1191 if(iQueryIdentity) |
|
1192 { |
|
1193 TPtr8 eapPtr(packet_data + KEapIdentityOffset, data_length - KEapIdentityOffset, data_length - KEapIdentityOffset); |
|
1194 TRAP(error, eapData = eapPtr.Alloc()); |
|
1195 } |
|
1196 else |
|
1197 { |
|
1198 TPtr8 eapPtr(packet_data, data_length, data_length); |
|
1199 TRAP(error, eapData = eapPtr.Alloc()); |
|
1200 } |
|
1201 |
|
1202 if(error != KErrNone) |
|
1203 { |
|
1204 EAP_TRACE_ALWAYS( |
|
1205 m_am_tools, |
|
1206 TRACE_FLAGS_DEFAULT, |
|
1207 (EAPL("Allocation error\n"))); |
|
1208 return EAP_STATUS_RETURN(m_am_tools, eap_status_allocation_error); |
|
1209 } |
|
1210 |
|
1211 if(iQueryIdentity) |
|
1212 { |
|
1213 EAP_TRACE_DEBUG( |
|
1214 m_am_tools, |
|
1215 TRACE_FLAGS_DEFAULT, |
|
1216 (EAPL("CEapVpnInterfaceImplementation::EapIdentityResponseL()\n"))); |
|
1217 |
|
1218 TRAPD(error, (iCaller->EapIdentityResponseL(eapData))); |
|
1219 if(error != KErrNone) |
|
1220 { |
|
1221 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
1222 return EAP_STATUS_RETURN(m_am_tools, m_am_tools->convert_am_error_to_eapol_error(error)); |
|
1223 } |
|
1224 |
|
1225 iQueryIdentity = EFalse; |
|
1226 } |
|
1227 else |
|
1228 { |
|
1229 EAP_TRACE_DEBUG( |
|
1230 m_am_tools, |
|
1231 TRACE_FLAGS_DEFAULT, |
|
1232 (EAPL("CEapVpnInterfaceImplementation::EapOutboundL()\n"))); |
|
1233 |
|
1234 TRAPD(error, (iCaller->EapOutboundL(eapData))); |
|
1235 if(error != KErrNone) |
|
1236 { |
|
1237 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
1238 return EAP_STATUS_RETURN(m_am_tools, m_am_tools->convert_am_error_to_eapol_error(error)); |
|
1239 } |
|
1240 } |
|
1241 ++m_packet_index; |
|
1242 } |
|
1243 |
|
1244 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
1245 |
|
1246 return EAP_STATUS_RETURN(m_am_tools, m_am_tools->convert_am_error_to_eapol_error(status)); |
|
1247 } |
|
1248 |
|
1249 |
|
1250 /** |
|
1251 * The get_header_offset() function obtains the header offset of EAP-packet. |
|
1252 * @see abs_eap_base_type_c::get_header_offset(). |
|
1253 */ |
|
1254 u32_t CEapVpnInterfaceImplementation::get_header_offset( |
|
1255 u32_t * const MTU, |
|
1256 u32_t * const trailer_length) |
|
1257 { |
|
1258 EAP_TRACE_BEGIN(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
1259 |
|
1260 *MTU = KMTU; |
|
1261 *trailer_length = KTrailerLength; |
|
1262 |
|
1263 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
1264 |
|
1265 return KHeaderOffset; |
|
1266 } |
|
1267 |
|
1268 /** |
|
1269 * The load_module() function function indicates the lower level to |
|
1270 * load new module of EAP-type. |
|
1271 * @param type is the requested EAP-type. |
|
1272 * @param partner is pointer to the caller object. |
|
1273 * The partner of the new created EAP-type object is the caller object. |
|
1274 * @param eap_type is a pointer to a pointer of EAP-type object. |
|
1275 * Adaptation module sets eap_type pointer to created EAP-type object. |
|
1276 * @param is_client_when_true parameter indicates whether the network entity should |
|
1277 * act as a client (true) or server (false), in terms of EAP-protocol whether |
|
1278 * this network entity is EAP-supplicant (true) or EAP-authenticator (false). |
|
1279 * @param receive_network_id includes the addresses (network identity) and packet type. |
|
1280 */ |
|
1281 eap_status_e CEapVpnInterfaceImplementation::load_module( |
|
1282 const eap_type_value_e type, |
|
1283 const eap_type_value_e tunneling_type, |
|
1284 abs_eap_base_type_c * const partner, |
|
1285 eap_base_type_c ** const eap_type_if, |
|
1286 const bool is_client_when_true, |
|
1287 const eap_am_network_id_c * const receive_network_id) |
|
1288 { |
|
1289 EAP_TRACE_BEGIN(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
1290 |
|
1291 EAP_TRACE_DEBUG( |
|
1292 m_am_tools, |
|
1293 TRACE_FLAGS_DEFAULT, |
|
1294 (EAPL("CEapVpnInterfaceImplementation::load_module()\n"))); |
|
1295 |
|
1296 EAP_TRACE_ALWAYS( |
|
1297 m_am_tools, |
|
1298 TRACE_FLAGS_DEFAULT, |
|
1299 (EAPL("eap_vpn_if::load_module(type %d=%s, tunneling_type %d=%s)\n"), |
|
1300 convert_eap_type_to_u32_t(type), |
|
1301 eap_header_string_c::get_eap_type_string(type), |
|
1302 convert_eap_type_to_u32_t(tunneling_type), |
|
1303 eap_header_string_c::get_eap_type_string(tunneling_type))); |
|
1304 |
|
1305 EAP_UNREFERENCED_PARAMETER(type); |
|
1306 EAP_UNREFERENCED_PARAMETER(tunneling_type); |
|
1307 |
|
1308 eap_status_e status = eap_status_process_general_error; |
|
1309 |
|
1310 if (type != iRequestedEapType) |
|
1311 { |
|
1312 EAP_TRACE_DEBUG( |
|
1313 m_am_tools, |
|
1314 TRACE_FLAGS_DEFAULT, |
|
1315 (EAPL("load_module: eap_expanded_type_c::write_type(): not supported EAP-method\n"))); |
|
1316 |
|
1317 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
1318 return EAP_STATUS_RETURN(m_am_tools, eap_status_illegal_eap_type); |
|
1319 } |
|
1320 |
|
1321 EAP_ASSERT_TOOLS(m_am_tools, (type == iRequestedEapType)); |
|
1322 |
|
1323 #ifdef USE_EAP_EXPANDED_TYPES |
|
1324 |
|
1325 TBuf8<KExpandedEapTypeSize> cue; |
|
1326 |
|
1327 // Some indirect way of forming the 8 byte string of an EAP type for the cue is needed here. |
|
1328 TUint8 tmpExpCue[KExpandedEapTypeSize]; |
|
1329 |
|
1330 // This is to make the tmpExpCue in 8 byte string with correct vendor type and vendor id details. |
|
1331 status = eap_expanded_type_c::write_type(m_am_tools, |
|
1332 0, // index should be zero here. |
|
1333 tmpExpCue, |
|
1334 KExpandedEapTypeSize, |
|
1335 true, |
|
1336 iRequestedEapType); |
|
1337 if (status != eap_status_ok) |
|
1338 { |
|
1339 EAP_TRACE_DEBUG( |
|
1340 m_am_tools, |
|
1341 TRACE_FLAGS_DEFAULT, |
|
1342 (EAPL("load_module: eap_expanded_type_c::write_type failed \n"))); |
|
1343 |
|
1344 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
1345 return EAP_STATUS_RETURN(m_am_tools, status); |
|
1346 } |
|
1347 |
|
1348 // Now copy the 8 byte string to the real expanded cue. |
|
1349 cue.Copy(tmpExpCue, KExpandedEapTypeSize); |
|
1350 |
|
1351 EAP_TRACE_DATA_DEBUG( |
|
1352 m_am_tools, |
|
1353 TRACE_FLAGS_DEFAULT, |
|
1354 (EAPL("EAPOL:CEapVpnInterfaceImplementation::load_module: Expanded CUE:"), |
|
1355 cue.Ptr(), |
|
1356 cue.Size())); |
|
1357 |
|
1358 #else |
|
1359 |
|
1360 TBuf8<KMaxEapCueLength> cue; |
|
1361 cue.Num(static_cast<TInt>(iRequestedEapType)); |
|
1362 |
|
1363 #endif //#ifdef USE_EAP_EXPANDED_TYPES |
|
1364 |
|
1365 CEapType* eapType = 0; |
|
1366 TInt error(KErrNone); |
|
1367 |
|
1368 #ifdef USE_EAP_EXPANDED_TYPES |
|
1369 |
|
1370 // Check if this EAP type has already been loaded |
|
1371 TInt eapArrayIndex = find<eap_type_value_e>( |
|
1372 m_eap_type_array, |
|
1373 &iRequestedEapType, |
|
1374 m_am_tools); |
|
1375 |
|
1376 if (eapArrayIndex >= 0) |
|
1377 |
|
1378 #else // For normal EAP type. |
|
1379 |
|
1380 // Check if this EAP type has already been loaded |
|
1381 TInt eapArrayIndex = m_eap_type_array.Find(iRequestedEapType); |
|
1382 |
|
1383 if (eapArrayIndex != KErrNotFound) |
|
1384 |
|
1385 #endif |
|
1386 |
|
1387 { |
|
1388 // Yep. It was loaded already. |
|
1389 EAP_TRACE_DEBUG( |
|
1390 m_am_tools, |
|
1391 TRACE_FLAGS_DEFAULT, |
|
1392 (EAPL("CEapVpnInterfaceImplementation: EAP Type Already loaded\n"))); |
|
1393 |
|
1394 eapType = m_plugin_if_array[eapArrayIndex]; |
|
1395 } |
|
1396 else |
|
1397 { |
|
1398 // We must have a trap here since the EAP core knows nothing about Symbian. |
|
1399 EAP_TRACE_DEBUG( |
|
1400 m_am_tools, |
|
1401 TRACE_FLAGS_DEFAULT, |
|
1402 (EAPL("CEapVpnInterfaceImplementation: EAP Type new\n"))); |
|
1403 |
|
1404 TRAP(error, (eapType = CEapType::NewL(cue, m_index_type, m_index))); |
|
1405 |
|
1406 if (error != KErrNone |
|
1407 || eapType == 0) |
|
1408 { |
|
1409 // Interface not found or implementation creation function failed |
|
1410 |
|
1411 delete eapType; |
|
1412 eapType = 0; |
|
1413 |
|
1414 EAP_TRACE_DEBUG( |
|
1415 m_am_tools, |
|
1416 TRACE_FLAGS_DEFAULT, |
|
1417 (EAPL("CEapVpnInterfaceImplementation: EAP Type new, unable to load\n"))); |
|
1418 EAP_TRACE_ALWAYS( |
|
1419 m_am_tools, |
|
1420 TRACE_FLAGS_DEFAULT, |
|
1421 (EAPL("ECom could not find/initiate implementation.\n"))); |
|
1422 return EAP_STATUS_RETURN(m_am_tools, eap_status_allocation_error); |
|
1423 } |
|
1424 } |
|
1425 |
|
1426 //-------------------------------------------------------- |
|
1427 //-------------------------------------------------------- |
|
1428 // Set the values for realm and user name if there is any. |
|
1429 // If there is no values the default settings will be used( automatic realm and username). |
|
1430 |
|
1431 |
|
1432 { |
|
1433 EAP_TRACE_DEBUG( |
|
1434 m_am_tools, |
|
1435 TRACE_FLAGS_DEFAULT, |
|
1436 (EAPL("CEapVpnInterfaceImplementation::load_module - About to configure manual/auto username and manual/auto realm \n"))); |
|
1437 |
|
1438 EAPSettings* setSettings = new EAPSettings; |
|
1439 if( setSettings == NULL ) |
|
1440 { |
|
1441 EAP_TRACE_DEBUG( |
|
1442 m_am_tools, |
|
1443 TRACE_FLAGS_DEFAULT, |
|
1444 (EAPL("CEapVpnInterfaceImplementation::load_module - EAPSettings allocation error \n"))); |
|
1445 |
|
1446 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
1447 return EAP_STATUS_RETURN(m_am_tools, eap_status_allocation_error); |
|
1448 } |
|
1449 |
|
1450 if(iRequestedEapType == eap_type_aka) |
|
1451 { |
|
1452 setSettings->iEAPType = EAPSettings::EEapAka; |
|
1453 |
|
1454 } |
|
1455 else if(iRequestedEapType == eap_type_gsmsim) |
|
1456 { |
|
1457 setSettings->iEAPType = EAPSettings::EEapSim; |
|
1458 } |
|
1459 else |
|
1460 { |
|
1461 delete setSettings; |
|
1462 setSettings = 0; |
|
1463 |
|
1464 // Only EAP-SIM and AKA are possible now. |
|
1465 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
1466 return EAP_STATUS_RETURN(m_am_tools, eap_status_illegal_eap_type); |
|
1467 } |
|
1468 |
|
1469 if(iManualUsername && iManualUsername->Length() != 0) |
|
1470 { |
|
1471 setSettings->iUsernamePresent = EGSMSIMUseManualUsernameYes; // Same value for both SIM and AKA. |
|
1472 setSettings->iUsername.Copy(iManualUsername->Des()); |
|
1473 } |
|
1474 else |
|
1475 { |
|
1476 // No user name. we have to set automatic now. |
|
1477 setSettings->iUsernamePresent = EGSMSIMUseManualUsernameNo; // Same value for both SIM and AKA. |
|
1478 } |
|
1479 |
|
1480 if(iManualRealm && iManualRealm->Length() != 0) |
|
1481 { |
|
1482 setSettings->iRealmPresent = EGSMSIMUseManualRealmYes; // Same value for both SIM and AKA. |
|
1483 setSettings->iRealm.Copy(iManualRealm->Des()); |
|
1484 } |
|
1485 else |
|
1486 { |
|
1487 // No realm. we have to set automatic now. |
|
1488 setSettings->iRealmPresent = EGSMSIMUseManualRealmNo; // Same value for both SIM and AKA. |
|
1489 } |
|
1490 |
|
1491 TRAP(error, eapType->SetConfigurationL(*setSettings) ); |
|
1492 if ( error != KErrNone ) |
|
1493 { |
|
1494 EAP_TRACE_DEBUG( |
|
1495 m_am_tools, |
|
1496 TRACE_FLAGS_DEFAULT, |
|
1497 (EAPL("CEapVpnInterfaceImplementation::load_module - Setting Manual Username and Realm failed.error=%d, Continuing \n"))); |
|
1498 } |
|
1499 |
|
1500 delete setSettings; |
|
1501 setSettings = 0; |
|
1502 } |
|
1503 |
|
1504 //-------------------------------------------------------- |
|
1505 //-------------------------------------------------------- |
|
1506 |
|
1507 // Create the EAP protocol interface implementation. |
|
1508 EAP_TRACE_DEBUG( |
|
1509 m_am_tools, |
|
1510 TRACE_FLAGS_DEFAULT, |
|
1511 (EAPL("CEapVpnInterfaceImplementation: EAP Type new, GetStackInterfaceL()\n"))); |
|
1512 |
|
1513 #ifdef USE_EAP_SIMPLE_CONFIG |
|
1514 |
|
1515 TRAP(error, (*eap_type_if = eapType->GetStackInterfaceL( |
|
1516 m_am_tools, |
|
1517 partner, |
|
1518 is_client_when_true, |
|
1519 receive_network_id, |
|
1520 0))); // Check this up. |
|
1521 |
|
1522 #else |
|
1523 |
|
1524 TRAP(error, (*eap_type_if = eapType->GetStackInterfaceL( |
|
1525 m_am_tools, |
|
1526 partner, |
|
1527 is_client_when_true, |
|
1528 receive_network_id))); |
|
1529 |
|
1530 #endif // #ifdef USE_EAP_SIMPLE_CONFIG |
|
1531 |
|
1532 if (error != KErrNone |
|
1533 || *eap_type_if == 0 |
|
1534 || (*eap_type_if)->get_is_valid() == false) |
|
1535 { |
|
1536 EAP_TRACE_DEBUG( |
|
1537 m_am_tools, |
|
1538 TRACE_FLAGS_DEFAULT, |
|
1539 (EAPL("CEapVpnInterfaceImplementation: EAP Type new, GetStackInterfaceL(), failed = %d\n"), error)); |
|
1540 |
|
1541 EAP_TRACE_ALWAYS( |
|
1542 m_am_tools, |
|
1543 TRACE_FLAGS_DEFAULT, |
|
1544 (EAPL("Could not create EAP type interface instance. Error: %d\n"), error)); |
|
1545 |
|
1546 status = eap_status_allocation_error; |
|
1547 |
|
1548 // Unload DLL (two ways, depending whether this type was already loaded...) |
|
1549 if (eapArrayIndex == KErrNotFound) |
|
1550 { |
|
1551 // No need to call shutdown here because GetStackInterfaceL has done it. |
|
1552 delete eapType; |
|
1553 } |
|
1554 else |
|
1555 { |
|
1556 unload_module((eap_type_value_e)iRequestedEapType); |
|
1557 } |
|
1558 // Note: even in error cases eap_core_c deletes eap_type_if |
|
1559 } |
|
1560 else |
|
1561 { |
|
1562 EAP_TRACE_DEBUG( |
|
1563 m_am_tools, |
|
1564 TRACE_FLAGS_DEFAULT, |
|
1565 (EAPL("CEapVpnInterfaceImplementation: EAP Type new, GetStackInterfaceL(), success\n"))); |
|
1566 |
|
1567 status = eap_status_ok; |
|
1568 |
|
1569 if (eapArrayIndex == KErrNotFound) |
|
1570 { |
|
1571 // Add plugin information to the member arrays. There is no need to store eap_type pointer because |
|
1572 // the stack takes care of its deletion. |
|
1573 if (m_plugin_if_array.Append(eapType) != KErrNone) |
|
1574 { |
|
1575 delete eapType; |
|
1576 status = eap_status_allocation_error; |
|
1577 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
1578 return EAP_STATUS_RETURN(m_am_tools, status); |
|
1579 } |
|
1580 |
|
1581 #ifdef USE_EAP_EXPANDED_TYPES |
|
1582 |
|
1583 eap_type_value_e * tmpEAPType = new eap_type_value_e(); |
|
1584 if(tmpEAPType == NULL) |
|
1585 { |
|
1586 EAP_TRACE_DEBUG( |
|
1587 m_am_tools, |
|
1588 TRACE_FLAGS_DEFAULT, |
|
1589 (EAPL("eapol_am_wlan_authentication_symbian_c::load_module() eap_type_value_e creation failed\n"))); |
|
1590 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
1591 return EAP_STATUS_RETURN(m_am_tools, eap_status_allocation_error); |
|
1592 } |
|
1593 |
|
1594 *tmpEAPType = type; |
|
1595 |
|
1596 status = m_eap_type_array->add_object(tmpEAPType, true); |
|
1597 |
|
1598 if (status != eap_status_ok) |
|
1599 |
|
1600 #else // For normal EAP type. |
|
1601 |
|
1602 if (m_eap_type_array.Append(iRequestedEapType) != KErrNone) |
|
1603 |
|
1604 #endif |
|
1605 { |
|
1606 // Remove the eap type added just previously |
|
1607 m_plugin_if_array.Remove(m_plugin_if_array.Count() - 1); |
|
1608 delete eapType; |
|
1609 status = eap_status_allocation_error; |
|
1610 |
|
1611 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
1612 return EAP_STATUS_RETURN(m_am_tools, status); |
|
1613 } |
|
1614 } |
|
1615 } |
|
1616 |
|
1617 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
1618 return EAP_STATUS_RETURN(m_am_tools, status); |
|
1619 } |
|
1620 |
|
1621 /** |
|
1622 * The unload_module() function unloads the module of a EAP-type. |
|
1623 * @param eap_type is the requested EAP-type. |
|
1624 */ |
|
1625 eap_status_e CEapVpnInterfaceImplementation::unload_module(const eap_type_value_e type) |
|
1626 { |
|
1627 EAP_TRACE_BEGIN(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
1628 eap_status_e status(eap_status_type_does_not_exists_error); |
|
1629 |
|
1630 #ifdef USE_EAP_EXPANDED_TYPES |
|
1631 |
|
1632 // Check if this EAP type has already been loaded |
|
1633 TInt index = find<eap_type_value_e>( |
|
1634 m_eap_type_array, |
|
1635 &type, |
|
1636 m_am_tools); |
|
1637 |
|
1638 if (index >= 0) |
|
1639 { |
|
1640 // EAP was loaded before. |
|
1641 |
|
1642 delete m_plugin_if_array[index]; |
|
1643 m_plugin_if_array.Remove(index); |
|
1644 |
|
1645 status = m_eap_type_array->remove_object(index); |
|
1646 } |
|
1647 |
|
1648 #else // For normal EAP types. |
|
1649 |
|
1650 TInt index = m_eap_type_array.Find(type); |
|
1651 |
|
1652 if (index != KErrNotFound) |
|
1653 { |
|
1654 delete m_plugin_if_array[index]; |
|
1655 m_plugin_if_array.Remove(index); |
|
1656 m_eap_type_array.Remove(index); |
|
1657 status = eap_status_ok; |
|
1658 } |
|
1659 |
|
1660 #endif |
|
1661 |
|
1662 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
1663 return EAP_STATUS_RETURN(m_am_tools, status); |
|
1664 } |
|
1665 //-------------------------------------------------- |
|
1666 |
|
1667 void CEapVpnInterfaceImplementation::set_is_valid() |
|
1668 { |
|
1669 m_is_valid = true; |
|
1670 } |
|
1671 |
|
1672 bool CEapVpnInterfaceImplementation::get_is_valid() |
|
1673 { |
|
1674 return m_is_valid; |
|
1675 } |
|
1676 |
|
1677 void CEapVpnInterfaceImplementation::increment_authentication_counter() |
|
1678 { |
|
1679 ++m_authentication_counter; |
|
1680 } |
|
1681 |
|
1682 u32_t CEapVpnInterfaceImplementation::get_authentication_counter() |
|
1683 { |
|
1684 return m_authentication_counter; |
|
1685 } |
|
1686 |
|
1687 bool CEapVpnInterfaceImplementation::get_is_client() |
|
1688 { |
|
1689 return m_is_client; |
|
1690 } |
|
1691 |
|
1692 /** |
|
1693 * Note this function is just an example. Parameters will change later. |
|
1694 * The packet_data_crypto_keys() function gives the generated keys to lower level. |
|
1695 * After EAP-authentication has generated the keys it calls this function |
|
1696 * to offer the keys to lower level. |
|
1697 * @see abs_eap_base_type_c::packet_data_crypto_keys(). |
|
1698 */ |
|
1699 eap_status_e CEapVpnInterfaceImplementation::packet_data_crypto_keys( |
|
1700 const eap_am_network_id_c * const /*send_network_id*/, |
|
1701 const eap_master_session_key_c * const master_session_key |
|
1702 ) |
|
1703 { |
|
1704 EAP_TRACE_BEGIN(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
1705 |
|
1706 HBufC8* sharedKey = NULL; |
|
1707 TPtr8 keyPtr( |
|
1708 master_session_key->get_data( |
|
1709 master_session_key->get_data_length()/2), |
|
1710 master_session_key->get_data_length()/2, |
|
1711 master_session_key->get_data_length()/2); |
|
1712 |
|
1713 TRAPD(error, (sharedKey = keyPtr.AllocL())); |
|
1714 if(error != KErrNone) |
|
1715 { |
|
1716 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
1717 return EAP_STATUS_RETURN(m_am_tools, eap_status_allocation_error); |
|
1718 } |
|
1719 |
|
1720 EAP_TRACE_DEBUG( |
|
1721 m_am_tools, |
|
1722 TRACE_FLAGS_DEFAULT, |
|
1723 (EAPL("CEapVpnInterfaceImplementation: EapSharedKeyL()\n"))); |
|
1724 |
|
1725 TRAP(error, (iCaller->EapSharedKeyL(sharedKey))); |
|
1726 if(error != KErrNone) |
|
1727 { |
|
1728 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
1729 return EAP_STATUS_RETURN(m_am_tools, m_am_tools->convert_am_error_to_eapol_error(error)); |
|
1730 } |
|
1731 |
|
1732 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
1733 return eap_status_ok; |
|
1734 } |
|
1735 |
|
1736 /** |
|
1737 * The packet_data_session_key() function passes one traffic encryption key to |
|
1738 * the lower layers. Ultimately the key can end up to the WLAN hardware. |
|
1739 * @param send_network_id carries the addresses (network identity) and type of the packet. |
|
1740 * @param key is the encryption key |
|
1741 * @param key_length is the length of the key |
|
1742 * @param key_type describes the type of the key (WEP or something else...) |
|
1743 * @param key_index is the index of the encryption key (there can be four broadcast keys in WEP for example) |
|
1744 */ |
|
1745 eap_status_e CEapVpnInterfaceImplementation::packet_data_session_key( |
|
1746 const eap_am_network_id_c * const /*send_network_id*/, |
|
1747 const eapol_session_key_c * const /*key*/ |
|
1748 ) |
|
1749 { |
|
1750 // Not used, but might be called? |
|
1751 EAP_TRACE_BEGIN(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
1752 TInt status(KErrNone); |
|
1753 |
|
1754 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
1755 return EAP_STATUS_RETURN(m_am_tools, m_am_tools->convert_am_error_to_eapol_error(status)); |
|
1756 } |
|
1757 |
|
1758 /** |
|
1759 * The read_configure() function reads the configuration data identified |
|
1760 * by the field string of field_length bytes length. Adaptation module must direct |
|
1761 * the query to some persistent store. |
|
1762 * @see abs_eap_base_type_c::read_configure(). |
|
1763 */ |
|
1764 eap_status_e CEapVpnInterfaceImplementation::read_configure( |
|
1765 const eap_configuration_field_c * const field, |
|
1766 eap_variable_data_c * const data) |
|
1767 { |
|
1768 EAP_TRACE_BEGIN(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
1769 EAP_ASSERT_ALWAYS(data != NULL); |
|
1770 EAP_ASSERT_ALWAYS(field->get_field_length() <= KMaxConfigStringLength); |
|
1771 |
|
1772 EAP_UNREFERENCED_PARAMETER(KMaxConfigStringLength); |
|
1773 |
|
1774 EAP_TRACE_DEBUG( |
|
1775 m_am_tools, |
|
1776 TRACE_FLAGS_DEFAULT, |
|
1777 (EAPL("CEapVpnInterfaceImplementation::read_configure()\n"))); |
|
1778 |
|
1779 eap_status_e status(eap_status_ok); |
|
1780 |
|
1781 m_am_tools->trace_configuration( |
|
1782 status, |
|
1783 field, |
|
1784 data); |
|
1785 |
|
1786 |
|
1787 // Check if the wanted parameter is default type |
|
1788 |
|
1789 { |
|
1790 eap_variable_data_c wanted_field(m_am_tools); |
|
1791 |
|
1792 status = wanted_field.set_buffer( |
|
1793 field->get_field(), |
|
1794 field->get_field_length(), |
|
1795 false, |
|
1796 false); |
|
1797 if (status != eap_status_ok) |
|
1798 { |
|
1799 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
1800 return status; |
|
1801 } |
|
1802 |
|
1803 |
|
1804 if (wanted_field.compare( |
|
1805 cf_str_EAP_default_type_u32_t.get_field()->get_field(), |
|
1806 cf_str_EAP_default_type_u32_t.get_field()->get_field_length()) == 0 |
|
1807 || wanted_field.compare( |
|
1808 cf_str_EAP_server_default_type_u32_t.get_field()->get_field(), |
|
1809 cf_str_EAP_server_default_type_u32_t.get_field()->get_field_length()) == 0) |
|
1810 { |
|
1811 // We need to return here the next EAP type we should try |
|
1812 |
|
1813 #ifdef USE_EAP_EXPANDED_TYPES |
|
1814 |
|
1815 if(m_enabled_expanded_eap_array.Count() < 1) |
|
1816 { |
|
1817 // No enabled EAP types. |
|
1818 |
|
1819 // Send WLM notification because there is no way that the authentication |
|
1820 // can be successful if we don't have any EAP types to use... |
|
1821 if (m_is_client) |
|
1822 { |
|
1823 EAP_TRACE_ERROR( |
|
1824 m_am_tools, |
|
1825 TRACE_FLAGS_DEFAULT, |
|
1826 (EAPL("ERROR: No configured EAP types or all tried unsuccessfully.\n"))); |
|
1827 } |
|
1828 |
|
1829 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
1830 return EAP_STATUS_RETURN(m_am_tools, eap_status_illegal_configure_field); |
|
1831 } |
|
1832 |
|
1833 // Now there are enabled EAP type, we need to take the first EAP type from the arrary. |
|
1834 SEapExpandedType * expandedEAPType = m_enabled_expanded_eap_array[0]; //First item. |
|
1835 |
|
1836 status = data->set_copy_of_buffer(expandedEAPType->EapExpandedType.Ptr(), KExpandedEapTypeSize); |
|
1837 if (status != eap_status_ok) |
|
1838 { |
|
1839 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
1840 return EAP_STATUS_RETURN(m_am_tools, eap_status_allocation_error); |
|
1841 } |
|
1842 |
|
1843 // This is to check if this is the requested EAP type. |
|
1844 |
|
1845 eap_expanded_type_c tmpExpEAPType; |
|
1846 |
|
1847 // This is to make the tmpExpEAPType in 8 byte string with correct vendor type and vendor id details. |
|
1848 status = eap_expanded_type_c::read_type(m_am_tools, |
|
1849 0, // index should be zero here. |
|
1850 expandedEAPType->EapExpandedType.Ptr(), |
|
1851 KExpandedEapTypeSize, |
|
1852 &tmpExpEAPType); |
|
1853 if (status != eap_status_ok) |
|
1854 { |
|
1855 EAP_TRACE_DEBUG( |
|
1856 m_am_tools, |
|
1857 TRACE_FLAGS_DEFAULT, |
|
1858 (EAPL("CEapVpnInterfaceImplementation::read_configure: eap_expanded_type_c::write_type failed \n"))); |
|
1859 |
|
1860 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
1861 return EAP_STATUS_RETURN(m_am_tools, status); |
|
1862 } |
|
1863 |
|
1864 if(tmpExpEAPType == iRequestedEapType) |
|
1865 { |
|
1866 EAP_TRACE_DATA_DEBUG( |
|
1867 m_am_tools, |
|
1868 TRACE_FLAGS_DEFAULT, |
|
1869 (EAPL("CEapVpnInterfaceImplementation::StartL:Trying EAP type:"), |
|
1870 expandedEAPType->EapExpandedType.Ptr(), |
|
1871 expandedEAPType->EapExpandedType.Size())); |
|
1872 } |
|
1873 |
|
1874 #else // For normal EAP types |
|
1875 |
|
1876 TInt i; |
|
1877 |
|
1878 for (i = 0; i < m_iap_eap_array.Count(); i++) |
|
1879 { |
|
1880 // Find the first enabled EAP type (highest priority) |
|
1881 TEap *eapType = m_iap_eap_array[i]; |
|
1882 if (eapType->Enabled == 1) |
|
1883 { |
|
1884 // Convert the string to integer |
|
1885 TLex8 tmp(eapType->UID); |
|
1886 TInt val(0); |
|
1887 tmp.Val(val); |
|
1888 |
|
1889 status = data->set_copy_of_buffer((u8_t*) &val, sizeof(TUint)); |
|
1890 if (status != eap_status_ok) |
|
1891 { |
|
1892 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
1893 return EAP_STATUS_RETURN(m_am_tools, eap_status_allocation_error); |
|
1894 } |
|
1895 |
|
1896 if(val == iRequestedEapType) |
|
1897 { |
|
1898 EAP_TRACE_ALWAYS( |
|
1899 m_am_tools, |
|
1900 TRACE_FLAGS_DEFAULT, |
|
1901 (EAPL("EAPOL: Trying EAP type: %d.\n"), val)); |
|
1902 break; |
|
1903 } |
|
1904 else |
|
1905 { |
|
1906 continue; |
|
1907 } |
|
1908 } |
|
1909 } // for() |
|
1910 |
|
1911 if (i >= m_iap_eap_array.Count()) |
|
1912 { |
|
1913 // Not found |
|
1914 // Send WLM notification because there is no way that the authentication |
|
1915 // can be successful if we don't have any EAP types to use... |
|
1916 if (m_is_client) |
|
1917 { |
|
1918 EAP_TRACE_ERROR( |
|
1919 m_am_tools, |
|
1920 TRACE_FLAGS_DEFAULT, |
|
1921 (EAPL("ERROR: No configured EAP types or all tried unsuccessfully.\n"))); |
|
1922 } |
|
1923 |
|
1924 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
1925 return EAP_STATUS_RETURN(m_am_tools, eap_status_illegal_configure_field); |
|
1926 } |
|
1927 |
|
1928 #endif //#ifdef USE_EAP_EXPANDED_TYPES |
|
1929 |
|
1930 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
1931 return EAP_STATUS_RETURN(m_am_tools, status); |
|
1932 } |
|
1933 else if (wanted_field.compare( |
|
1934 cf_str_EAP_GSMSIM_UMA_profile.get_field()->get_field(), |
|
1935 cf_str_EAP_GSMSIM_UMA_profile.get_field()->get_field_length()) == 0 |
|
1936 || wanted_field.compare( |
|
1937 cf_str_EAP_AKA_UMA_profile.get_field()->get_field(), |
|
1938 cf_str_EAP_AKA_UMA_profile.get_field()->get_field_length()) == 0) |
|
1939 { |
|
1940 // Set uma profile of EAP-SIM and EAP-AKA. |
|
1941 TInt val(1); |
|
1942 status = data->set_copy_of_buffer((u8_t*) &val, sizeof(TUint)); |
|
1943 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
1944 return EAP_STATUS_RETURN(m_am_tools, status); |
|
1945 } |
|
1946 else if (wanted_field.compare( |
|
1947 cf_str_EAP_GSMSIM_wait_eap_success_packet.get_field()->get_field(), |
|
1948 cf_str_EAP_GSMSIM_wait_eap_success_packet.get_field()->get_field_length()) == 0 |
|
1949 || wanted_field.compare( |
|
1950 cf_str_EAP_AKA_wait_eap_success_packet.get_field()->get_field(), |
|
1951 cf_str_EAP_AKA_wait_eap_success_packet.get_field()->get_field_length()) == 0) |
|
1952 { |
|
1953 // Set wait eap success of EAP-SIM and EAP-AKA. |
|
1954 TInt val(1); |
|
1955 status = data->set_copy_of_buffer((u8_t*) &val, sizeof(TUint)); |
|
1956 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
1957 return EAP_STATUS_RETURN(m_am_tools, status); |
|
1958 } |
|
1959 else if (wanted_field.compare( |
|
1960 cf_str_EAP_GSMSIM_UMA_realm_prefix.get_field()->get_field(), |
|
1961 cf_str_EAP_GSMSIM_UMA_realm_prefix.get_field()->get_field_length()) == 0 |
|
1962 || wanted_field.compare( |
|
1963 cf_str_EAP_AKA_UMA_realm_prefix.get_field()->get_field(), |
|
1964 cf_str_EAP_AKA_UMA_realm_prefix.get_field()->get_field_length()) == 0) |
|
1965 { |
|
1966 // Set uma realm prefix of EAP-SIM and EAP-AKA. |
|
1967 status = data->set_copy_of_buffer(iRealmPrefix->Ptr(), iRealmPrefix->Length()); |
|
1968 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
1969 return EAP_STATUS_RETURN(m_am_tools, status); |
|
1970 } |
|
1971 else if (wanted_field.compare( |
|
1972 cf_str_EAP_GSMSIM_use_manual_realm.get_field()->get_field(), |
|
1973 cf_str_EAP_GSMSIM_use_manual_realm.get_field()->get_field_length()) == 0 |
|
1974 || wanted_field.compare( |
|
1975 cf_str_EAP_AKA_use_manual_realm.get_field()->get_field(), |
|
1976 cf_str_EAP_AKA_use_manual_realm.get_field()->get_field_length()) == 0) |
|
1977 { |
|
1978 // Use ManualRealm of EAP-SIM and EAP-AKA. |
|
1979 TInt val(1); |
|
1980 if(iManualRealm == NULL || (iManualRealm && (iManualRealm->Length() == 0))) |
|
1981 { |
|
1982 val = 0; |
|
1983 } |
|
1984 status = data->set_copy_of_buffer((u8_t*) &val, sizeof(TUint)); |
|
1985 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
1986 return EAP_STATUS_RETURN(m_am_tools, status); |
|
1987 } |
|
1988 else if (wanted_field.compare( |
|
1989 cf_str_EAP_GSMSIM_manual_realm.get_field()->get_field(), |
|
1990 cf_str_EAP_GSMSIM_manual_realm.get_field()->get_field_length()) == 0 |
|
1991 || wanted_field.compare( |
|
1992 cf_str_EAP_AKA_manual_realm.get_field()->get_field(), |
|
1993 cf_str_EAP_AKA_manual_realm.get_field()->get_field_length()) == 0) |
|
1994 { |
|
1995 // ManualRealm of EAP-SIM and EAP-AKA. |
|
1996 status = data->set_copy_of_buffer(iManualRealm->Ptr(), iManualRealm->Length()); |
|
1997 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
1998 return EAP_STATUS_RETURN(m_am_tools, status); |
|
1999 } |
|
2000 else if (wanted_field.compare( |
|
2001 cf_str_EAP_GSMSIM_use_manual_username.get_field()->get_field(), |
|
2002 cf_str_EAP_GSMSIM_use_manual_username.get_field()->get_field_length()) == 0 |
|
2003 || wanted_field.compare( |
|
2004 cf_str_EAP_AKA_use_manual_username.get_field()->get_field(), |
|
2005 cf_str_EAP_AKA_use_manual_username.get_field()->get_field_length()) == 0) |
|
2006 { |
|
2007 // Use ManualUsername of EAP-SIM and EAP-AKA. |
|
2008 TInt val(1); |
|
2009 if(iManualUsername == NULL || (iManualUsername && (iManualUsername->Length() == 0))) |
|
2010 { |
|
2011 val = 0; |
|
2012 } |
|
2013 status = data->set_copy_of_buffer((u8_t*) &val, sizeof(TUint)); |
|
2014 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
2015 return EAP_STATUS_RETURN(m_am_tools, status); |
|
2016 } |
|
2017 else if (wanted_field.compare( |
|
2018 cf_str_EAP_GSMSIM_manual_username.get_field()->get_field(), |
|
2019 cf_str_EAP_GSMSIM_manual_username.get_field()->get_field_length()) == 0 |
|
2020 || wanted_field.compare( |
|
2021 cf_str_EAP_AKA_manual_username.get_field()->get_field(), |
|
2022 cf_str_EAP_AKA_manual_username.get_field()->get_field_length()) == 0) |
|
2023 { |
|
2024 // ManualUsername of EAP-SIM and EAP-AKA. |
|
2025 status = data->set_copy_of_buffer(iManualUsername->Ptr(), iManualUsername->Length()); |
|
2026 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
2027 return EAP_STATUS_RETURN(m_am_tools, status); |
|
2028 } |
|
2029 else if (wanted_field.compare( |
|
2030 cf_str_EAP_GSMSIM_2_digit_mnc_map_of_mcc_of_imsi_array.get_field()->get_field(), |
|
2031 cf_str_EAP_GSMSIM_2_digit_mnc_map_of_mcc_of_imsi_array.get_field()->get_field_length()) == 0 |
|
2032 || wanted_field.compare( |
|
2033 cf_str_EAP_AKA_2_digit_mnc_map_of_mcc_of_imsi_array.get_field()->get_field(), |
|
2034 cf_str_EAP_AKA_2_digit_mnc_map_of_mcc_of_imsi_array.get_field()->get_field_length()) == 0) |
|
2035 { |
|
2036 // 2-digit MNC configuration of EAP-SIM and EAP-AKA. |
|
2037 const TUint32 K2DigitMncMccList[] |
|
2038 = { |
|
2039 202,204,206,208,213,214,216,218, |
|
2040 219,220,222,226,228,230,231,232, |
|
2041 234,238,240,242,244,246,247,248, |
|
2042 250,255,257,259,260,262,266,268, |
|
2043 270,272,274,276,278,280,282,284, |
|
2044 286,288,290,293,294,295,308,340, |
|
2045 362,363,400,401,402,404,410,413, |
|
2046 414,415,416,417,419,420,421,422, |
|
2047 424,425,426,427,428,429,432,434, |
|
2048 436,437,438,440,441,452,454,455, |
|
2049 456,457,460,470,472,502,505,510, |
|
2050 515,520,525,528,530,537,539,541, |
|
2051 546,547,549,602,603,604,605,607, |
|
2052 608,609,610,611,612,613,614,615, |
|
2053 616,617,619,620,621,622,623,624, |
|
2054 625,626,628,629,630,631,633,634, |
|
2055 635,636,638,639,640,641,642,643, |
|
2056 645,646,647,648,649,650,651,652, |
|
2057 653,654,655,702,704,706,710,712, |
|
2058 714,716,724,730,734,744,746,901 |
|
2059 }; |
|
2060 |
|
2061 status = data->set_copy_of_buffer((u32_t*) K2DigitMncMccList, sizeof(K2DigitMncMccList)); |
|
2062 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
2063 return EAP_STATUS_RETURN(m_am_tools, status); |
|
2064 } |
|
2065 else if (wanted_field.compare( |
|
2066 cf_str_EAP_TRACE_output_file_name.get_field()->get_field(), |
|
2067 cf_str_EAP_TRACE_output_file_name.get_field()->get_field_length()) == 0) |
|
2068 { |
|
2069 // Trace output file name. |
|
2070 status = data->set_copy_of_buffer( |
|
2071 m_trace_log_file_name); |
|
2072 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
2073 return EAP_STATUS_RETURN(m_am_tools, status); |
|
2074 } |
|
2075 else if (wanted_field.compare( |
|
2076 cf_str_EAP_GSMSIM_max_session_validity_time.get_field()->get_field(), |
|
2077 cf_str_EAP_GSMSIM_max_session_validity_time.get_field()->get_field_length()) == 0 |
|
2078 || wanted_field.compare( |
|
2079 cf_str_EAP_AKA_max_session_validity_time.get_field()->get_field(), |
|
2080 cf_str_EAP_AKA_max_session_validity_time.get_field()->get_field_length()) == 0) |
|
2081 { |
|
2082 u32_t session_validity_time_in_seconds(43200ul); |
|
2083 |
|
2084 status = data->set_copy_of_buffer(reinterpret_cast<u8_t*>(&session_validity_time_in_seconds), sizeof(session_validity_time_in_seconds)); |
|
2085 |
|
2086 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
2087 return EAP_STATUS_RETURN(m_am_tools, status); |
|
2088 } |
|
2089 else if (wanted_field.compare( |
|
2090 cf_str_EAP_CORE_wait_eap_request_type_timeout.get_field()->get_field(), |
|
2091 cf_str_EAP_CORE_wait_eap_request_type_timeout.get_field()->get_field_length()) == 0) |
|
2092 { |
|
2093 u32_t wait_eap_request_type_timeout_in_milli_seconds(30000ul); |
|
2094 |
|
2095 status = data->set_copy_of_buffer(reinterpret_cast<u8_t*>(&wait_eap_request_type_timeout_in_milli_seconds), sizeof(wait_eap_request_type_timeout_in_milli_seconds)); |
|
2096 |
|
2097 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
2098 return EAP_STATUS_RETURN(m_am_tools, status); |
|
2099 } |
|
2100 else |
|
2101 { |
|
2102 EAP_TRACE_DATA_DEBUG( |
|
2103 m_am_tools, |
|
2104 TRACE_FLAGS_DEFAULT, |
|
2105 (EAPL("WARNING: CEapVpnInterfaceImplementation: read_configure(): Unknown configuration\n"), |
|
2106 field->get_field(), |
|
2107 field->get_field_length())); |
|
2108 } |
|
2109 } |
|
2110 |
|
2111 // Otherways just use the default value |
|
2112 m_am_tools->trace_configuration( |
|
2113 status, |
|
2114 field, |
|
2115 data); |
|
2116 |
|
2117 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
2118 return EAP_STATUS_RETURN(m_am_tools, status); |
|
2119 } |
|
2120 |
|
2121 /** |
|
2122 * The write_configure() function writes the configuration data identified |
|
2123 * by the field string of field_length bytes length. Adaptation module must direct |
|
2124 * the action to some persistent store. |
|
2125 * @see abs_eap_base_type_c::write_configure(). |
|
2126 */ |
|
2127 eap_status_e CEapVpnInterfaceImplementation::write_configure( |
|
2128 const eap_configuration_field_c * const /*field*/, |
|
2129 eap_variable_data_c * const /*data*/) |
|
2130 { |
|
2131 EAP_TRACE_BEGIN(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
2132 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
2133 return eap_status_not_supported; |
|
2134 } |
|
2135 |
|
2136 /** |
|
2137 * This is notification of internal state transition. |
|
2138 * This is used for notifications, debugging and protocol testing. |
|
2139 * The primal notifications are eap_state_variable_e::eap_state_authentication_finished_successfully |
|
2140 * and eap_state_variable_e::eap_state_authentication_terminated_unsuccessfully. |
|
2141 * These two notifications are sent from EAP-protocol layer (eap_protocol_layer_e::eap_protocol_layer_eap). |
|
2142 * These two notifications tells the end state of authentication session. These are the only |
|
2143 * reliable indications of the final status of authentication session. |
|
2144 * You MUST NOT make decision based on the return value of abs_eap_stack_interface_c::packet_process(). |
|
2145 */ |
|
2146 void CEapVpnInterfaceImplementation::state_notification( |
|
2147 const abs_eap_state_notification_c * const state) |
|
2148 { |
|
2149 EAP_TRACE_BEGIN(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
2150 |
|
2151 EAP_TRACE_DEBUG( |
|
2152 m_am_tools, |
|
2153 TRACE_FLAGS_DEFAULT, |
|
2154 (EAPL("CEapVpnInterfaceImplementation::state_notification() = %d\n"), state->get_current_state())); |
|
2155 |
|
2156 if (m_block_packet_sends_and_notifications == true) |
|
2157 { |
|
2158 // Notification block is active. |
|
2159 EAP_TRACE_ALWAYS( |
|
2160 m_am_tools, |
|
2161 TRACE_FLAGS_DEFAULT, |
|
2162 (EAPL("state_notification: notification ignored because Disassociated() was called.\n"))); |
|
2163 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
2164 return; |
|
2165 } |
|
2166 |
|
2167 // Check if this is EAP layer notification |
|
2168 if(state->get_protocol_layer() == eap_protocol_layer_eap) |
|
2169 { |
|
2170 switch (state->get_current_state()) |
|
2171 { |
|
2172 case eap_state_none: |
|
2173 break; |
|
2174 case eap_state_identity_request_sent: |
|
2175 // This is for server only so no need to notify WLM. |
|
2176 break; |
|
2177 case eap_state_identity_request_received: |
|
2178 break; |
|
2179 case eap_state_identity_response_received: |
|
2180 // This is for server only so no need to notify WLM. |
|
2181 break; |
|
2182 case eap_state_authentication_finished_successfully: |
|
2183 { |
|
2184 increment_authentication_counter(); |
|
2185 m_successful_authentications++; |
|
2186 |
|
2187 EAP_TRACE_ALWAYS( |
|
2188 m_am_tools, |
|
2189 TRACE_FLAGS_DEFAULT, |
|
2190 (EAPL("Indication sent: ESuccess.\n"))); |
|
2191 |
|
2192 EAP_TRACE_DEBUG( |
|
2193 m_am_tools, |
|
2194 TRACE_FLAGS_DEFAULT, |
|
2195 (EAPL("CEapVpnInterfaceImplementation: Indication sent: ESuccess\n"))); |
|
2196 iCaller->EapIndication(ESuccess); |
|
2197 break; |
|
2198 } |
|
2199 case eap_state_authentication_terminated_unsuccessfully: |
|
2200 { |
|
2201 increment_authentication_counter(); |
|
2202 m_failed_authentications++; |
|
2203 |
|
2204 EAP_TRACE_DEBUG( |
|
2205 m_am_tools, |
|
2206 TRACE_FLAGS_DEFAULT, |
|
2207 (EAPL("CEapVpnInterfaceImplementation: Indication sent: EFailure\n"))); |
|
2208 |
|
2209 EAP_TRACE_ALWAYS( |
|
2210 m_am_tools, |
|
2211 TRACE_FLAGS_DEFAULT, |
|
2212 (EAPL("Indication sent: EFailure.\n"))); |
|
2213 iCaller->EapIndication(EFailure); |
|
2214 break; |
|
2215 } |
|
2216 default: |
|
2217 break; |
|
2218 } |
|
2219 } |
|
2220 |
|
2221 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
2222 } |
|
2223 |
|
2224 /** |
|
2225 * The set_timer() function initializes timer to be elapsed after time_ms milliseconds. |
|
2226 * @param initializer is pointer to object which timer_expired() function will |
|
2227 * be called after timer elapses. |
|
2228 * @param id is identifier which will be returned in timer_expired() function. |
|
2229 * The user selects and interprets the id for this timer. |
|
2230 * @param data is pointer to any user selected data which will be returned in timer_expired() function. |
|
2231 * @param time_ms is the time of timer in milli seconds. |
|
2232 * |
|
2233 * Adaptation module internally implements the timer. |
|
2234 */ |
|
2235 eap_status_e CEapVpnInterfaceImplementation::set_timer( |
|
2236 abs_eap_base_timer_c * const p_initializer, |
|
2237 const u32_t p_id, |
|
2238 void * const p_data, |
|
2239 const u32_t p_time_ms) |
|
2240 { |
|
2241 EAP_TRACE_BEGIN(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
2242 |
|
2243 const eap_status_e status = m_am_tools->am_set_timer( |
|
2244 p_initializer, |
|
2245 p_id, |
|
2246 p_data, |
|
2247 p_time_ms); |
|
2248 |
|
2249 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
2250 return status; |
|
2251 } |
|
2252 |
|
2253 /** |
|
2254 * The cancel_timer() function cancels the timer id initiated by initializer. |
|
2255 * @param initializer is pointer to object which set the cancelled timer. |
|
2256 * @param id is identifier which will be returned in timer_expired() function. |
|
2257 * The user selects and interprets the id for this timer. |
|
2258 * |
|
2259 * Adaptation module internally implements the timer. |
|
2260 */ |
|
2261 eap_status_e CEapVpnInterfaceImplementation::cancel_timer( |
|
2262 abs_eap_base_timer_c * const p_initializer, |
|
2263 const u32_t p_id) |
|
2264 { |
|
2265 EAP_TRACE_BEGIN(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
2266 |
|
2267 const eap_status_e status = m_am_tools->am_cancel_timer( |
|
2268 p_initializer, |
|
2269 p_id); |
|
2270 |
|
2271 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
2272 return status; |
|
2273 } |
|
2274 |
|
2275 /** |
|
2276 * The cancel_all_timers() function cancels all timers. |
|
2277 * User should use this in termination of the stack before |
|
2278 * the adaptation module of tools is deleted. |
|
2279 * Preferred mode is to cancel each timer directly |
|
2280 * using cancel_timer() function. |
|
2281 * |
|
2282 * Adaptation module internally implements the timer. |
|
2283 */ |
|
2284 eap_status_e CEapVpnInterfaceImplementation::cancel_all_timers() |
|
2285 { |
|
2286 EAP_TRACE_BEGIN(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
2287 |
|
2288 const eap_status_e status = m_am_tools->am_cancel_all_timers(); |
|
2289 |
|
2290 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
2291 return status; |
|
2292 } |
|
2293 |
|
2294 /** |
|
2295 * This function queries the validity of EAP-type. |
|
2296 * Lower layer should return eap_status_ok if this EAP-type is supported. |
|
2297 * @param eap_type is the requested EAP-type. |
|
2298 */ |
|
2299 eap_status_e CEapVpnInterfaceImplementation::check_is_valid_eap_type(const eap_type_value_e eap_type) |
|
2300 { |
|
2301 EAP_TRACE_BEGIN(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
2302 |
|
2303 eap_status_e status(eap_status_illegal_eap_type); |
|
2304 |
|
2305 #ifdef USE_EAP_EXPANDED_TYPES |
|
2306 |
|
2307 for (int i = 0; i < m_enabled_expanded_eap_array.Count(); i++) |
|
2308 { |
|
2309 TBuf8<KExpandedEapTypeSize> tmpExpEAP(m_enabled_expanded_eap_array[i]->EapExpandedType); |
|
2310 |
|
2311 EAP_TRACE_DEBUG( |
|
2312 m_am_tools, |
|
2313 TRACE_FLAGS_DEFAULT, |
|
2314 (EAPL("CEapVpnInterfaceImplementation::check_is_valid_eap_type:Enabled expanded EAP type at index=%d\n"), |
|
2315 i)); |
|
2316 |
|
2317 EAP_TRACE_DATA_DEBUG( |
|
2318 m_am_tools, |
|
2319 TRACE_FLAGS_DEFAULT, |
|
2320 (EAPL("Enabled expanded EAP type:"), |
|
2321 tmpExpEAP.Ptr(), |
|
2322 tmpExpEAP.Size())); |
|
2323 |
|
2324 // This is for one expanded EAP type (for the above one). |
|
2325 eap_expanded_type_c expandedEAPType; |
|
2326 |
|
2327 // Read the expanded EAP type details for this item in m_enabled_expanded_eap_array. |
|
2328 eap_status_e status = eap_expanded_type_c::read_type(m_am_tools, |
|
2329 0, |
|
2330 tmpExpEAP.Ptr(), |
|
2331 tmpExpEAP.Size(), |
|
2332 &expandedEAPType); |
|
2333 if (status != eap_status_ok) |
|
2334 { |
|
2335 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
2336 return EAP_STATUS_RETURN(m_am_tools, status); |
|
2337 } |
|
2338 |
|
2339 if (eap_type == expandedEAPType) |
|
2340 { |
|
2341 // This is Allowed and Valid. |
|
2342 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
2343 return EAP_STATUS_RETURN(m_am_tools, eap_status_ok); |
|
2344 } |
|
2345 } // End of for() |
|
2346 |
|
2347 #else // For normal unexpanded EAP type |
|
2348 |
|
2349 TEap *eapType = 0; |
|
2350 |
|
2351 for (int i = 0; i < m_iap_eap_array.Count(); i++) |
|
2352 { |
|
2353 // Try next EAP type |
|
2354 eapType = m_iap_eap_array[i]; |
|
2355 if (eapType->Enabled == 1) |
|
2356 { |
|
2357 // Convert the string to integer |
|
2358 TLex8 tmp(eapType->UID); |
|
2359 TInt val(0); |
|
2360 tmp.Val(val); |
|
2361 |
|
2362 if (val == eap_type) |
|
2363 { |
|
2364 // Allowed |
|
2365 status = eap_status_ok; |
|
2366 break; |
|
2367 } |
|
2368 } |
|
2369 } // for() |
|
2370 |
|
2371 #endif // #ifdef USE_EAP_EXPANDED_TYPES |
|
2372 |
|
2373 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
2374 |
|
2375 return EAP_STATUS_RETURN(m_am_tools, status); |
|
2376 } |
|
2377 |
|
2378 /** |
|
2379 * This function queries the list of supported EAP-types. |
|
2380 * Lower layer should return eap_status_ok if this call succeeds. |
|
2381 * @param eap_type_list will include the list of supported EAP-types. Each value in list |
|
2382 * is type of u32_t and represent one supported EAP-type. List consists of subsequent u32_t type values. |
|
2383 */ |
|
2384 eap_status_e CEapVpnInterfaceImplementation::get_eap_type_list(eap_array_c<eap_type_value_e> * const eap_type_list) |
|
2385 { |
|
2386 EAP_TRACE_BEGIN(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
2387 |
|
2388 eap_status_e status(eap_status_illegal_eap_type); |
|
2389 |
|
2390 status = eap_type_list->reset(); |
|
2391 if (status != eap_status_ok) |
|
2392 { |
|
2393 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
2394 return EAP_STATUS_RETURN(m_am_tools, status); |
|
2395 } |
|
2396 |
|
2397 eap_header_string_c eap_string; |
|
2398 EAP_UNREFERENCED_PARAMETER(eap_string); |
|
2399 |
|
2400 #ifdef USE_EAP_EXPANDED_TYPES |
|
2401 |
|
2402 // This function is same as get_selected_eap_types in behavior. |
|
2403 |
|
2404 // We need to return only the EAP types available as enabled types. |
|
2405 // It means only the ones available in m_enabled_expanded_eap_array. |
|
2406 |
|
2407 for (TInt i = 0; i < m_enabled_expanded_eap_array.Count(); i++) |
|
2408 { |
|
2409 TBuf8<KExpandedEapTypeSize> tmpExpEAP(m_enabled_expanded_eap_array[i]->EapExpandedType); |
|
2410 |
|
2411 EAP_TRACE_DEBUG( |
|
2412 m_am_tools, |
|
2413 TRACE_FLAGS_DEFAULT, |
|
2414 (EAPL("CEapVpnInterfaceImplementation::get_eap_type_list:Enabled expanded EAP type at index=%d\n"), |
|
2415 i)); |
|
2416 |
|
2417 EAP_TRACE_DATA_DEBUG( |
|
2418 m_am_tools, |
|
2419 TRACE_FLAGS_DEFAULT, |
|
2420 (EAPL("Enabled expanded EAP type:"), |
|
2421 tmpExpEAP.Ptr(), |
|
2422 tmpExpEAP.Size())); |
|
2423 |
|
2424 // This is for one expanded EAP type (for the above one). |
|
2425 eap_expanded_type_c * expandedEAPType = new eap_type_value_e(); |
|
2426 |
|
2427 // Read the expanded EAP type details from an item in m_enabled_expanded_eap_array. |
|
2428 status = eap_expanded_type_c::read_type(m_am_tools, |
|
2429 0, |
|
2430 tmpExpEAP.Ptr(), |
|
2431 tmpExpEAP.Size(), |
|
2432 expandedEAPType); |
|
2433 if (status != eap_status_ok) |
|
2434 { |
|
2435 delete expandedEAPType; |
|
2436 expandedEAPType = 0; |
|
2437 |
|
2438 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
2439 return EAP_STATUS_RETURN(m_am_tools, status); |
|
2440 } |
|
2441 |
|
2442 // Add EAP-type to list. |
|
2443 status = eap_type_list->add_object(expandedEAPType, true); |
|
2444 if (status != eap_status_ok) |
|
2445 { |
|
2446 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
2447 return EAP_STATUS_RETURN(m_am_tools, status); |
|
2448 } |
|
2449 |
|
2450 EAP_TRACE_DEBUG( |
|
2451 m_am_tools, |
|
2452 TRACE_FLAGS_DEFAULT, |
|
2453 (EAPL("get_eap_type_list():added EAP-type=0x%08x=%s\n"), |
|
2454 expandedEAPType->get_vendor_type(), |
|
2455 eap_string.get_eap_type_string(*expandedEAPType))); |
|
2456 } |
|
2457 |
|
2458 #else // for normal EAP types. |
|
2459 |
|
2460 TEap *eapType = 0; |
|
2461 |
|
2462 for (TInt i = 0; i < m_iap_eap_array.Count(); i++) |
|
2463 { |
|
2464 // Check if type is enabled |
|
2465 eapType = m_iap_eap_array[i]; |
|
2466 if (eapType->Enabled == 1) |
|
2467 { |
|
2468 TLex8 tmp(eapType->UID); |
|
2469 TInt val(0); |
|
2470 tmp.Val(val); |
|
2471 |
|
2472 eap_type_value_e * const eap_type = new eap_type_value_e( |
|
2473 static_cast<eap_type_ietf_values_e>(val)); |
|
2474 if (eap_type == 0) |
|
2475 { |
|
2476 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
2477 return EAP_STATUS_RETURN(m_am_tools, eap_status_allocation_error); |
|
2478 } |
|
2479 |
|
2480 status = eap_type_list->add_object(eap_type, true); |
|
2481 if (status != eap_status_ok) |
|
2482 { |
|
2483 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
2484 return EAP_STATUS_RETURN(m_am_tools, status); |
|
2485 } |
|
2486 } |
|
2487 } // for() |
|
2488 |
|
2489 #endif //#ifdef USE_EAP_EXPANDED_TYPES |
|
2490 |
|
2491 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
2492 return eap_status_ok; |
|
2493 } |
|
2494 //-------------------------------------------------- |
|
2495 |
|
2496 |
|
2497 eap_status_e CEapVpnInterfaceImplementation::add_rogue_ap(eap_array_c<eap_rogue_ap_entry_c> & /*rogue_ap_list*/) |
|
2498 { |
|
2499 // Not used, but might be called |
|
2500 EAP_TRACE_BEGIN(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
2501 TInt err = KErrNone; |
|
2502 |
|
2503 EAP_TRACE_ALWAYS( |
|
2504 m_am_tools, |
|
2505 TRACE_FLAGS_DEFAULT, |
|
2506 (EAPL("eap_vpn_if::add_rogue_ap()\n"))); |
|
2507 |
|
2508 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
2509 return EAP_STATUS_RETURN(m_am_tools, m_am_tools->convert_am_error_to_eapol_error(err)); |
|
2510 } |
|
2511 |
|
2512 |
|
2513 eap_status_e CEapVpnInterfaceImplementation::restart_authentication( |
|
2514 const eap_am_network_id_c * const /*receive_network_id*/, |
|
2515 const bool /*is_client_when_true*/, |
|
2516 const bool /*force_clean_restart*/, |
|
2517 const bool /*from_timer*/) |
|
2518 { |
|
2519 // Not used, but might be called |
|
2520 EAP_TRACE_BEGIN(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
2521 |
|
2522 EAP_TRACE_ALWAYS( |
|
2523 m_am_tools, |
|
2524 TRACE_FLAGS_DEFAULT, |
|
2525 (EAPL("eap_vpn_if::restart_authentication()\n"))); |
|
2526 |
|
2527 eap_status_e status = eap_status_ok; |
|
2528 |
|
2529 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
2530 return EAP_STATUS_RETURN(m_am_tools, status); |
|
2531 } |
|
2532 |
|
2533 |
|
2534 //-------------------------------------------------- |
|
2535 |
|
2536 // |
|
2537 eap_status_e CEapVpnInterfaceImplementation::asynchronous_init_remove_eap_session( |
|
2538 const eap_am_network_id_c * const /* send_network_id */) |
|
2539 { |
|
2540 // eapol_core_c object does not support asynchronous_init_remove_eap_session(). |
|
2541 return EAP_STATUS_RETURN(m_am_tools, eap_status_not_supported); |
|
2542 } |
|
2543 |
|
2544 //-------------------------------------------------- |
|
2545 |
|
2546 // |
|
2547 eap_status_e CEapVpnInterfaceImplementation::set_session_timeout( |
|
2548 const u32_t /* session_timeout_ms */) |
|
2549 { |
|
2550 EAP_TRACE_BEGIN(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
2551 |
|
2552 EAP_ASSERT(m_am_tools->get_global_mutex()->get_is_reserved() == true); |
|
2553 |
|
2554 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
2555 return EAP_STATUS_RETURN(m_am_tools, eap_status_not_supported); |
|
2556 } |
|
2557 |
|
2558 |
|
2559 //-------------------------------------------------- |
|
2560 |
|
2561 // |
|
2562 eap_status_e CEapVpnInterfaceImplementation::timer_expired( |
|
2563 const u32_t id, |
|
2564 void * /*data*/) |
|
2565 { |
|
2566 // Not used, but might be called |
|
2567 EAP_TRACE_BEGIN(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
2568 |
|
2569 EAP_TRACE_DEBUG( |
|
2570 m_am_tools, |
|
2571 TRACE_FLAGS_DEFAULT, |
|
2572 (EAPL("CEapVpnInterfaceImplementation::timer_expired()\n"))); |
|
2573 |
|
2574 EAP_TRACE_ALWAYS( |
|
2575 m_am_tools, |
|
2576 TRACE_FLAGS_DEFAULT, |
|
2577 (EAPL("TIMER: [0x%08x]->eap_vpn_if::timer_expired(id 0x%02x).\n"), |
|
2578 this, |
|
2579 id)); |
|
2580 |
|
2581 switch (id) |
|
2582 { |
|
2583 case EAPOL_AM_CORE_TIMER_DELETE_STACK_ID: |
|
2584 { |
|
2585 EAP_TRACE_ALWAYS( |
|
2586 m_am_tools, |
|
2587 TRACE_FLAGS_DEFAULT, |
|
2588 (EAPL("EAPOL_AM_CORE_TIMER_DELETE_STACK_ID elapsed: Delete stack.\n"))); |
|
2589 |
|
2590 cancel_all_timers(); |
|
2591 |
|
2592 // Delete stack |
|
2593 if (iEapCore != 0) |
|
2594 { |
|
2595 iEapCore->shutdown(); |
|
2596 delete iEapCore; |
|
2597 iEapCore = 0; |
|
2598 } |
|
2599 m_stack_marked_to_be_deleted = false; |
|
2600 |
|
2601 // Re-activates timer queue. |
|
2602 eap_status_e status = m_am_tools->re_activate_timer_queue(); |
|
2603 if (status != eap_status_ok) |
|
2604 { |
|
2605 EAP_TRACE_ALWAYS( |
|
2606 m_am_tools, |
|
2607 TRACE_FLAGS_DEFAULT, |
|
2608 (EAPL("ERROR: re_activate_timer_queue() failed, status = %d\n"))); |
|
2609 } |
|
2610 |
|
2611 break; |
|
2612 } |
|
2613 |
|
2614 default: |
|
2615 break; |
|
2616 } // switch() |
|
2617 |
|
2618 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
2619 return EAP_STATUS_RETURN(m_am_tools, eap_status_ok); |
|
2620 } |
|
2621 |
|
2622 //-------------------------------------------------- |
|
2623 |
|
2624 // |
|
2625 eap_status_e CEapVpnInterfaceImplementation::timer_delete_data( |
|
2626 const u32_t /*id*/, void * /*data*/) |
|
2627 { |
|
2628 // Not used, but might be called |
|
2629 EAP_TRACE_BEGIN(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
2630 |
|
2631 EAP_TRACE_ALWAYS( |
|
2632 m_am_tools, |
|
2633 TRACE_FLAGS_DEFAULT, |
|
2634 (EAPL("TIMER: [0x%08x]->eap_vpn_if::timer_delete_data().\n"), |
|
2635 this)); |
|
2636 |
|
2637 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
2638 return EAP_STATUS_RETURN(m_am_tools, eap_status_ok); |
|
2639 } |
|
2640 |
|
2641 // ----------------------------------------------------------------------------- |
|
2642 // CleanupImplArray |
|
2643 // ----------------------------------------------------------------------------- |
|
2644 // |
|
2645 void CEapVpnInterfaceImplementation::CleanupImplArray( TAny* aAny ) |
|
2646 { |
|
2647 RImplInfoPtrArray* implArray = |
|
2648 reinterpret_cast<RImplInfoPtrArray*>( aAny ); |
|
2649 |
|
2650 implArray->ResetAndDestroy(); |
|
2651 implArray->Close(); |
|
2652 } |
|
2653 |
|
2654 //-------------------------------------------------- |
|
2655 |
|
2656 // End |