1 /* |
|
2 * Copyright (c) 2001-2010 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of the License "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: EAP and WLAN authentication protocols. |
|
15 * |
|
16 */ |
|
17 |
|
18 /* |
|
19 * %version: 41 % |
|
20 */ |
|
21 |
|
22 #include "EapServerProcessHandler.h" |
|
23 #include "EapTraceSymbian.h" |
|
24 #if defined(USE_FAST_EAP_TYPE) |
|
25 #include "PacStoreIf.h" |
|
26 #endif //#if defined(USE_FAST_EAP_TYPE) |
|
27 #include "EapServerStrings.h" |
|
28 #include "eap_automatic_variable.h" |
|
29 |
|
30 //---------------------------------------------------------------------------- |
|
31 |
|
32 CEapServerProcessHandler::CEapServerProcessHandler() |
|
33 : CActive (0) |
|
34 , iClient(0) |
|
35 , iTools(0) |
|
36 , iEapCore(0) |
|
37 , iEapPlugin(0) |
|
38 , iEapSettings(0) |
|
39 #if defined (USE_WAPI_CORE) |
|
40 , iWapiCore(0) |
|
41 , iWapiSettings(0) |
|
42 #endif |
|
43 #if defined(USE_FAST_EAP_TYPE) |
|
44 , iPacStore(0) |
|
45 #endif //#if defined(USE_FAST_EAP_TYPE) |
|
46 , iEapMessageQueue(0) |
|
47 { |
|
48 EAP_TRACE_DEBUG( |
|
49 iTools, |
|
50 TRACE_FLAGS_DEFAULT, |
|
51 (EAPL("CEapServerProcessHandler::CEapServerProcessHandler(): this=0x%08x\n"), |
|
52 this)); |
|
53 EAP_TRACE_RETURN_STRING(iTools, "returns: CEapServerProcessHandler::CEapServerProcessHandler()"); |
|
54 } |
|
55 |
|
56 //---------------------------------------------------------------------------- |
|
57 |
|
58 CEapServerProcessHandler::~CEapServerProcessHandler() |
|
59 { |
|
60 EAP_TRACE_DEBUG( |
|
61 iTools, |
|
62 TRACE_FLAGS_DEFAULT, |
|
63 (EAPL("CEapServerProcessHandler::~CEapServerProcessHandler(): this=0x%08x\n"), |
|
64 this)); |
|
65 EAP_TRACE_RETURN_STRING(iTools, "returns: CEapServerProcessHandler::~CEapServerProcessHandler()"); |
|
66 |
|
67 if(IsActive()) |
|
68 { |
|
69 Cancel(); |
|
70 } |
|
71 |
|
72 delete iEapCore; |
|
73 iEapCore = 0; |
|
74 |
|
75 delete iEapPlugin; |
|
76 iEapPlugin = 0; |
|
77 |
|
78 delete iEapSettings; |
|
79 iEapSettings = 0; |
|
80 |
|
81 #if defined (USE_WAPI_CORE) |
|
82 delete iWapiCore; |
|
83 iWapiCore = 0; |
|
84 |
|
85 delete iWapiSettings; |
|
86 iWapiSettings = 0; |
|
87 #endif |
|
88 |
|
89 #if defined(USE_FAST_EAP_TYPE) |
|
90 delete iPacStore; |
|
91 iPacStore = 0; |
|
92 #endif //#if defined(USE_FAST_EAP_TYPE) |
|
93 |
|
94 delete iEapMessageQueue; |
|
95 iEapMessageQueue = 0; |
|
96 } |
|
97 |
|
98 //---------------------------------------------------------------------------- |
|
99 |
|
100 CEapServerProcessHandler* CEapServerProcessHandler::NewL() |
|
101 { |
|
102 return new (ELeave) CEapServerProcessHandler(); |
|
103 } |
|
104 |
|
105 //---------------------------------------------------------------------------- |
|
106 |
|
107 void CEapServerProcessHandler::ConstructL(AbsEapProcessSendInterface* const client, abs_eap_am_tools_c * const tools) |
|
108 { |
|
109 EAP_TRACE_DEBUG( |
|
110 tools, |
|
111 TRACE_FLAGS_DEFAULT, |
|
112 (EAPL("CEapServerProcessHandler::ConstructL(): this=0x%08x\n"), |
|
113 this)); |
|
114 EAP_TRACE_RETURN_STRING(tools, "returns: CEapServerProcessHandler::ConstructL()"); |
|
115 |
|
116 iClient = client; |
|
117 iTools = tools; |
|
118 |
|
119 iEapMessageQueue = new(ELeave) EapMessageQueue(iTools); |
|
120 } |
|
121 |
|
122 //---------------------------------------------------------------------------- |
|
123 |
|
124 eap_status_e CEapServerProcessHandler::SendData(const void * const data, const u32_t length, TEapRequests message) |
|
125 { |
|
126 EAP_TRACE_DEBUG( |
|
127 iTools, |
|
128 TRACE_FLAGS_DEFAULT, |
|
129 (EAPL("CEapServerProcessHandler::SendData(): this=0x%08x\n"), |
|
130 this)); |
|
131 EAP_TRACE_RETURN_STRING(iTools, "returns: CEapServerProcessHandler::SendData()"); |
|
132 |
|
133 eap_status_e status(eap_status_ok); |
|
134 |
|
135 SaveMessage(message, data, length); |
|
136 |
|
137 return status; |
|
138 } |
|
139 |
|
140 //---------------------------------------------------------------------------- |
|
141 |
|
142 void CEapServerProcessHandler::SaveMessage(TEapRequests message, const void * const data, const TUint length) |
|
143 { |
|
144 EAP_TRACE_DEBUG( |
|
145 iTools, |
|
146 TRACE_FLAGS_DEFAULT, |
|
147 (EAPL("CEapServerProcessHandler::SaveMessage(): this=0x%08x, message=%d=%s\n"), |
|
148 this, |
|
149 message, |
|
150 EapServerStrings::GetEapRequestsString(message))); |
|
151 EAP_TRACE_RETURN_STRING(iTools, "returns: CEapServerProcessHandler::SaveMessage()"); |
|
152 |
|
153 EAP_TRACE_DATA_DEBUG( |
|
154 iTools, |
|
155 EAP_TRACE_FLAGS_NEVER, |
|
156 (EAPL("CEapServerProcessHandler::SaveMessage()"), |
|
157 data, |
|
158 length)); |
|
159 |
|
160 EAP_TRACE_DEBUG( |
|
161 iTools, |
|
162 TRACE_FLAGS_DEFAULT, |
|
163 (EAPL("CEapServerProcessHandler::SaveMessage(): calls iEapMessageQueue->AddMessage()\n"))); |
|
164 |
|
165 TInt error = iEapMessageQueue->AddMessage(message, data, length); |
|
166 |
|
167 if (error != KErrNone) |
|
168 { |
|
169 EAP_TRACE_DEBUG( |
|
170 iTools, |
|
171 TRACE_FLAGS_DEFAULT, |
|
172 (EAPL("ERROR: CEapServerProcessHandler::SaveMessage(): failed = %d\n"), |
|
173 error)); |
|
174 return; |
|
175 } |
|
176 |
|
177 Activate(); |
|
178 |
|
179 EAP_TRACE_DEBUG( |
|
180 iTools, |
|
181 TRACE_FLAGS_DEFAULT, |
|
182 (EAPL("CEapServerProcessHandler::SaveMessage(): returns this=0x%08x, message=%d=%s\n"), |
|
183 this, |
|
184 message, |
|
185 EapServerStrings::GetEapRequestsString(message))); |
|
186 } |
|
187 |
|
188 //---------------------------------------------------------------------------- |
|
189 |
|
190 void CEapServerProcessHandler::Activate() |
|
191 { |
|
192 EAP_TRACE_DEBUG( |
|
193 iTools, |
|
194 TRACE_FLAGS_DEFAULT, |
|
195 (EAPL("CEapServerProcessHandler::Activate(): this=0x%08x\n"), |
|
196 this)); |
|
197 EAP_TRACE_RETURN_STRING(iTools, "returns: CEapServerProcessHandler::Activate()"); |
|
198 |
|
199 if(!IsActive()) |
|
200 { |
|
201 EAP_TRACE_DEBUG( |
|
202 iTools, |
|
203 TRACE_FLAGS_DEFAULT, |
|
204 (EAPL("CEapServerProcessHandler::Activate(): calls User::RequestComplete()\n"))); |
|
205 |
|
206 TRequestStatus* status = &iStatus; |
|
207 User::RequestComplete(status, KErrNone); |
|
208 |
|
209 EAP_TRACE_DEBUG( |
|
210 iTools, |
|
211 TRACE_FLAGS_DEFAULT, |
|
212 (EAPL("CEapServerProcessHandler::Activate(): calls SetActive()\n"))); |
|
213 |
|
214 SetActive(); |
|
215 } |
|
216 else |
|
217 { |
|
218 EAP_TRACE_DEBUG( |
|
219 iTools, |
|
220 TRACE_FLAGS_DEFAULT, |
|
221 (EAPL("CEapServerProcessHandler::Activate(): Already active.\n"))); |
|
222 } |
|
223 } |
|
224 |
|
225 //---------------------------------------------------------------------------- |
|
226 |
|
227 void CEapServerProcessHandler::RunL() |
|
228 { |
|
229 EAP_TRACE_DEBUG( |
|
230 iTools, |
|
231 TRACE_FLAGS_DEFAULT, |
|
232 (EAPL("=start=====================================================================\n"))); |
|
233 |
|
234 EAP_TRACE_RETURN_STRING(iTools, "returns: CEapServerProcessHandler::RunL()"); |
|
235 |
|
236 EAP_TRACE_DEBUG( |
|
237 iTools, |
|
238 TRACE_FLAGS_DEFAULT, |
|
239 (EAPL("CEapServerProcessHandler::RunL(): this=0x%08x\n"), |
|
240 this)); |
|
241 |
|
242 EapMessageBuffer * const message = iEapMessageQueue->GetFirstMessage(); |
|
243 |
|
244 if (message != 0) |
|
245 { |
|
246 EAP_TRACE_DEBUG( |
|
247 iTools, |
|
248 TRACE_FLAGS_DEFAULT, |
|
249 (EAPL("CEapServerProcessHandler::RunL(): message->GetRequestType()=%d=%s, data=0x%08x, size=%d\n"), |
|
250 message->GetRequestType(), |
|
251 EapServerStrings::GetEapRequestsString(message->GetRequestType()), |
|
252 message->GetData()->Ptr(), |
|
253 message->GetData()->Size())); |
|
254 |
|
255 eap_status_e status(eap_status_ok); |
|
256 |
|
257 switch (message->GetRequestType()) |
|
258 { |
|
259 |
|
260 case EEapCoreIfNew: |
|
261 |
|
262 { |
|
263 EAP_TRACE_DEBUG( |
|
264 iTools, |
|
265 TRACE_FLAGS_DEFAULT, |
|
266 (EAPL("CEapServerProcessHandler::RunL() EEapCoreIfNew\n"))); |
|
267 |
|
268 CEapCoreIf * tmpEapCore = CEapCoreIf::new_CEapCoreIf( |
|
269 iTools, |
|
270 ETrue, |
|
271 0, |
|
272 this); |
|
273 |
|
274 if (tmpEapCore != 0) |
|
275 { |
|
276 CleanupStack::PushL(tmpEapCore); |
|
277 |
|
278 if (tmpEapCore->get_is_valid() == false) |
|
279 { |
|
280 EAP_TRACE_DEBUG( |
|
281 iTools, |
|
282 TRACE_FLAGS_DEFAULT, |
|
283 (EAPL("ERROR: CEapServerProcessHandler::RunL(): CEapCoreIf::new_CEapCoreIf() failed, this=0x%08x\n"), |
|
284 this)); |
|
285 |
|
286 User::Leave(iTools->convert_eapol_error_to_am_error(EAP_STATUS_RETURN(iTools, eap_status_allocation_error))); |
|
287 } |
|
288 |
|
289 const void * const aData = reinterpret_cast<const void *>(message->GetData()->Ptr()); |
|
290 const TInt aLength = message->GetData()->Size(); |
|
291 |
|
292 const eap_variable_data_c client_configuration( |
|
293 iTools, |
|
294 aData, |
|
295 aLength, |
|
296 false, |
|
297 false); |
|
298 if (client_configuration.get_is_valid() == false) |
|
299 { |
|
300 EAP_TRACE_DEBUG( |
|
301 iTools, |
|
302 TRACE_FLAGS_DEFAULT, |
|
303 (EAPL("ERROR: CEapServerProcessHandler::RunL(): eap_variable_data_c client_configuration() failed, this=0x%08x\n"), |
|
304 this)); |
|
305 |
|
306 User::Leave(iTools->convert_eapol_error_to_am_error(EAP_STATUS_RETURN(iTools, eap_status_allocation_error))); |
|
307 } |
|
308 |
|
309 status = tmpEapCore->configure(&client_configuration); |
|
310 if (status != eap_status_ok) |
|
311 { |
|
312 EAP_TRACE_DEBUG( |
|
313 iTools, |
|
314 TRACE_FLAGS_DEFAULT, |
|
315 (EAPL("ERROR: CEapServerProcessHandler::RunL(): tmpEapCore->configure() failed, this=0x%08x, status=%d=%s\n"), |
|
316 this, |
|
317 status, |
|
318 eap_status_string_c::get_status_string(status))); |
|
319 |
|
320 User::Leave(iTools->convert_eapol_error_to_am_error(EAP_STATUS_RETURN(iTools, status))); |
|
321 } |
|
322 |
|
323 iEapCore = tmpEapCore; |
|
324 |
|
325 CleanupStack::Pop(tmpEapCore); |
|
326 } |
|
327 else |
|
328 { |
|
329 EAP_TRACE_DEBUG( |
|
330 iTools, |
|
331 TRACE_FLAGS_DEFAULT, |
|
332 (EAPL("ERROR: CEapServerProcessHandler::RunL(): EEapCoreIfNew, iEapCore is NULL\n"))); |
|
333 } |
|
334 } |
|
335 |
|
336 break; |
|
337 |
|
338 case EEapPluginNew: |
|
339 |
|
340 { |
|
341 EAP_TRACE_DEBUG( |
|
342 iTools, |
|
343 TRACE_FLAGS_DEFAULT, |
|
344 (EAPL("CEapServerProcessHandler::RunL() EEapPluginNew\n"))); |
|
345 |
|
346 CEapPluginIf * tmpEapPlugin = CEapPluginIf::new_CEapPluginIf(iTools); |
|
347 |
|
348 if (tmpEapPlugin != 0) |
|
349 { |
|
350 CleanupStack::PushL(tmpEapPlugin); |
|
351 |
|
352 if (tmpEapPlugin->get_is_valid() == false) |
|
353 { |
|
354 EAP_TRACE_DEBUG( |
|
355 iTools, |
|
356 TRACE_FLAGS_DEFAULT, |
|
357 (EAPL("ERROR: CEapServerProcessHandler::RunL(): CEapPluginIf::new_CEapPluginIf() failed, this=0x%08x\n"), |
|
358 this)); |
|
359 |
|
360 User::Leave(iTools->convert_eapol_error_to_am_error(EAP_STATUS_RETURN(iTools, eap_status_allocation_error))); |
|
361 } |
|
362 |
|
363 tmpEapPlugin->set_partner(this); |
|
364 |
|
365 const void * const aData = reinterpret_cast<const void *>(message->GetData()->Ptr()); |
|
366 const TInt aLength = message->GetData()->Size(); |
|
367 |
|
368 const eap_variable_data_c client_configuration( |
|
369 iTools, |
|
370 aData, |
|
371 aLength, |
|
372 false, |
|
373 false); |
|
374 if (client_configuration.get_is_valid() == false) |
|
375 { |
|
376 EAP_TRACE_DEBUG( |
|
377 iTools, |
|
378 TRACE_FLAGS_DEFAULT, |
|
379 (EAPL("ERROR: CEapServerProcessHandler::RunL(): eap_variable_data_c client_configuration() failed, this=0x%08x\n"), |
|
380 this)); |
|
381 |
|
382 User::Leave(iTools->convert_eapol_error_to_am_error(EAP_STATUS_RETURN(iTools, eap_status_allocation_error))); |
|
383 } |
|
384 |
|
385 status = tmpEapPlugin->configure(&client_configuration); |
|
386 if (status != eap_status_ok) |
|
387 { |
|
388 EAP_TRACE_DEBUG( |
|
389 iTools, |
|
390 TRACE_FLAGS_DEFAULT, |
|
391 (EAPL("ERROR: CEapServerProcessHandler::RunL(): tmpEapPlugin->configure() failed, this=0x%08x, status=%d=%s\n"), |
|
392 this, |
|
393 status, |
|
394 eap_status_string_c::get_status_string(status))); |
|
395 |
|
396 User::Leave(iTools->convert_eapol_error_to_am_error(EAP_STATUS_RETURN(iTools, status))); |
|
397 } |
|
398 |
|
399 iEapPlugin = tmpEapPlugin; |
|
400 |
|
401 CleanupStack::Pop(tmpEapPlugin); |
|
402 } |
|
403 else |
|
404 { |
|
405 EAP_TRACE_DEBUG( |
|
406 iTools, |
|
407 TRACE_FLAGS_DEFAULT, |
|
408 (EAPL("ERROR: CEapServerProcessHandler::RunL(): EEapPluginNew, iEapPlugin is NULL\n"))); |
|
409 } |
|
410 } |
|
411 |
|
412 break; |
|
413 |
|
414 case EEapSettingsNew: |
|
415 |
|
416 { |
|
417 EAP_TRACE_DEBUG( |
|
418 iTools, |
|
419 TRACE_FLAGS_DEFAULT, |
|
420 (EAPL("CEapServerProcessHandler::RunL() EEapSettingsNew\n"))); |
|
421 |
|
422 CEapSettingsIf * tmpEapSettings = CEapSettingsIf::new_CEapSettingsIf(iTools); |
|
423 |
|
424 if (tmpEapSettings != 0) |
|
425 { |
|
426 CleanupStack::PushL(tmpEapSettings); |
|
427 |
|
428 if (tmpEapSettings->get_is_valid() == false) |
|
429 { |
|
430 EAP_TRACE_DEBUG( |
|
431 iTools, |
|
432 TRACE_FLAGS_DEFAULT, |
|
433 (EAPL("ERROR: CEapServerProcessHandler::RunL(): CEapSettingsIf::new_CEapSettingsIf() failed, this=0x%08x\n"), |
|
434 this)); |
|
435 |
|
436 User::Leave(iTools->convert_eapol_error_to_am_error(EAP_STATUS_RETURN(iTools, eap_status_allocation_error))); |
|
437 } |
|
438 |
|
439 tmpEapSettings->set_partner(this); |
|
440 |
|
441 const void * const aData = reinterpret_cast<const void *>(message->GetData()->Ptr()); |
|
442 const TInt aLength = message->GetData()->Size(); |
|
443 |
|
444 const eap_variable_data_c client_configuration( |
|
445 iTools, |
|
446 aData, |
|
447 aLength, |
|
448 false, |
|
449 false); |
|
450 if (client_configuration.get_is_valid() == false) |
|
451 { |
|
452 EAP_TRACE_DEBUG( |
|
453 iTools, |
|
454 TRACE_FLAGS_DEFAULT, |
|
455 (EAPL("ERROR: CEapServerProcessHandler::RunL(): eap_variable_data_c client_configuration() failed, this=0x%08x\n"), |
|
456 this)); |
|
457 |
|
458 User::Leave(iTools->convert_eapol_error_to_am_error(EAP_STATUS_RETURN(iTools, eap_status_allocation_error))); |
|
459 } |
|
460 |
|
461 status = tmpEapSettings->configure(&client_configuration); |
|
462 if (status != eap_status_ok) |
|
463 { |
|
464 EAP_TRACE_DEBUG( |
|
465 iTools, |
|
466 TRACE_FLAGS_DEFAULT, |
|
467 (EAPL("ERROR: CEapServerProcessHandler::RunL(): tmpEapSettings->configure() failed, this=0x%08x, status=%d=%s\n"), |
|
468 this, |
|
469 status, |
|
470 eap_status_string_c::get_status_string(status))); |
|
471 |
|
472 User::Leave(iTools->convert_eapol_error_to_am_error(EAP_STATUS_RETURN(iTools, status))); |
|
473 } |
|
474 |
|
475 iEapSettings = tmpEapSettings; |
|
476 |
|
477 CleanupStack::Pop(tmpEapSettings); |
|
478 } |
|
479 else |
|
480 { |
|
481 EAP_TRACE_DEBUG( |
|
482 iTools, |
|
483 TRACE_FLAGS_DEFAULT, |
|
484 (EAPL("ERROR: CEapServerProcessHandler::RunL(): EEapSettingsNew, iEapSettings is NULL\n"))); |
|
485 } |
|
486 } |
|
487 |
|
488 break; |
|
489 |
|
490 #if defined (USE_WAPI_CORE) |
|
491 case EWapiCoreIfNew: |
|
492 |
|
493 EAP_TRACE_DEBUG( |
|
494 iTools, |
|
495 TRACE_FLAGS_DEFAULT, |
|
496 (EAPL("CEapServerProcessHandler::RunL() EWapiCoreIfNew\n"))); |
|
497 |
|
498 iWapiCore = CWapiCoreIf::NewL(iTools, this); |
|
499 |
|
500 EAP_TRACE_DEBUG( |
|
501 iTools, |
|
502 TRACE_FLAGS_DEFAULT, |
|
503 (EAPL("CEapServerProcessHandler::RunL() EWapiCoreIfNew - iWapiCore = 0x%08x.\n"), |
|
504 iWapiCore)); |
|
505 |
|
506 |
|
507 break; |
|
508 |
|
509 case EWapiSettingsNew: |
|
510 |
|
511 EAP_TRACE_DEBUG( |
|
512 iTools, |
|
513 TRACE_FLAGS_DEFAULT, |
|
514 (EAPL("CEapServerProcessHandler::RunL() EWapiSettingsNew\n"))); |
|
515 |
|
516 iWapiSettings = CWapiSettingsIf::NewL(iTools, this); |
|
517 |
|
518 EAP_TRACE_DEBUG( |
|
519 iTools, |
|
520 TRACE_FLAGS_DEFAULT, |
|
521 (EAPL("CEapServerProcessHandler::RunL() EWapiSettingsNew - iWapiSettings = 0x%08x.\n"), |
|
522 iWapiSettings)); |
|
523 break; |
|
524 #endif |
|
525 |
|
526 case EEapPacStoreNew: |
|
527 |
|
528 { |
|
529 EAP_TRACE_DEBUG( |
|
530 iTools, |
|
531 TRACE_FLAGS_DEFAULT, |
|
532 (EAPL("CEapServerProcessHandler::RunL() EEapPacStoreNew\n"))); |
|
533 |
|
534 #if defined(USE_FAST_EAP_TYPE) |
|
535 |
|
536 CPacStoreIf * tmpPacStore = CPacStoreIf::new_CPacStoreIf( |
|
537 iTools, |
|
538 ETrue, |
|
539 0, |
|
540 this); |
|
541 |
|
542 if (tmpPacStore != 0) |
|
543 { |
|
544 CleanupStack::PushL(tmpPacStore); |
|
545 |
|
546 if (tmpPacStore->get_is_valid() == false) |
|
547 { |
|
548 EAP_TRACE_DEBUG( |
|
549 iTools, |
|
550 TRACE_FLAGS_DEFAULT, |
|
551 (EAPL("ERROR: CEapServerProcessHandler::RunL(): CPacStoreIf::new_CPacStoreIf() failed, this=0x%08x\n"), |
|
552 this)); |
|
553 |
|
554 User::Leave(iTools->convert_eapol_error_to_am_error(EAP_STATUS_RETURN(iTools, eap_status_allocation_error))); |
|
555 } |
|
556 |
|
557 const void * const aData = reinterpret_cast<const void *>(message->GetData()->Ptr()); |
|
558 const TInt aLength = message->GetData()->Size(); |
|
559 |
|
560 const eap_variable_data_c client_configuration( |
|
561 iTools, |
|
562 aData, |
|
563 aLength, |
|
564 false, |
|
565 false); |
|
566 if (client_configuration.get_is_valid() == false) |
|
567 { |
|
568 EAP_TRACE_DEBUG( |
|
569 iTools, |
|
570 TRACE_FLAGS_DEFAULT, |
|
571 (EAPL("ERROR: CEapServerProcessHandler::RunL(): eap_variable_data_c client_configuration() failed, this=0x%08x\n"), |
|
572 this)); |
|
573 |
|
574 User::Leave(iTools->convert_eapol_error_to_am_error(EAP_STATUS_RETURN(iTools, eap_status_allocation_error))); |
|
575 } |
|
576 |
|
577 status = tmpPacStore->configure(&client_configuration); |
|
578 if (status != eap_status_ok) |
|
579 { |
|
580 EAP_TRACE_DEBUG( |
|
581 iTools, |
|
582 TRACE_FLAGS_DEFAULT, |
|
583 (EAPL("ERROR: CEapServerProcessHandler::RunL(): tmpPacStore->configure() failed, this=0x%08x, status=%d=%s\n"), |
|
584 this, |
|
585 status, |
|
586 eap_status_string_c::get_status_string(status))); |
|
587 |
|
588 User::Leave(iTools->convert_eapol_error_to_am_error(EAP_STATUS_RETURN(iTools, status))); |
|
589 } |
|
590 |
|
591 iPacStore = tmpPacStore; |
|
592 |
|
593 CleanupStack::Pop(tmpPacStore); |
|
594 } |
|
595 else |
|
596 { |
|
597 EAP_TRACE_DEBUG( |
|
598 iTools, |
|
599 TRACE_FLAGS_DEFAULT, |
|
600 (EAPL("ERROR: CEapServerProcessHandler::RunL(): EEapPacStoreNew, iPacStore is NULL\n"))); |
|
601 } |
|
602 |
|
603 #endif //#if defined(USE_FAST_EAP_TYPE) |
|
604 |
|
605 } |
|
606 |
|
607 break; |
|
608 |
|
609 case EEapCoreProcessData: |
|
610 |
|
611 EAP_TRACE_DEBUG( |
|
612 iTools, |
|
613 TRACE_FLAGS_DEFAULT, |
|
614 (EAPL("CEapServerProcessHandler::RunL() EEapCoreProcessData\n"))); |
|
615 |
|
616 if (iEapCore !=0) |
|
617 { |
|
618 void* aData = reinterpret_cast<void *>(const_cast<TUint8 *>(message->GetData()->Ptr())); |
|
619 TInt aLength = message->GetData()->Size(); |
|
620 iEapCore->process_data(aData, aLength); |
|
621 } |
|
622 else |
|
623 { |
|
624 EAP_TRACE_DEBUG( |
|
625 iTools, |
|
626 TRACE_FLAGS_DEFAULT, |
|
627 (EAPL("ERROR: CEapServerProcessHandler::RunL(): EEapCoreProcessData, iEapCore is NULL\n"))); |
|
628 } |
|
629 |
|
630 break; |
|
631 |
|
632 case EEapPacStoreProcessData: |
|
633 |
|
634 EAP_TRACE_DEBUG( |
|
635 iTools, |
|
636 TRACE_FLAGS_DEFAULT, |
|
637 (EAPL("CEapServerProcessHandler::RunL() EEapPacStoreProcessData\n"))); |
|
638 |
|
639 #if defined(USE_FAST_EAP_TYPE) |
|
640 if (iPacStore !=0) |
|
641 { |
|
642 void* aData = reinterpret_cast<void *>(const_cast<TUint8 *>(message->GetData()->Ptr())); |
|
643 TInt aLength = message->GetData()->Size(); |
|
644 iPacStore->process_data(aData, aLength); |
|
645 } |
|
646 else |
|
647 { |
|
648 EAP_TRACE_DEBUG( |
|
649 iTools, |
|
650 TRACE_FLAGS_DEFAULT, |
|
651 (EAPL("ERROR: CEapServerProcessHandler::RunL(): EEapPacStoreProcessData, iPacStore is NULL\n"))); |
|
652 } |
|
653 #endif //#if defined(USE_FAST_EAP_TYPE) |
|
654 break; |
|
655 |
|
656 case EEapPluginProcessData: |
|
657 |
|
658 EAP_TRACE_DEBUG( |
|
659 iTools, |
|
660 TRACE_FLAGS_DEFAULT, |
|
661 (EAPL("CEapServerProcessHandler::RunL() EEapPluginProcessData\n"))); |
|
662 |
|
663 if (iEapPlugin !=0) |
|
664 { |
|
665 void* aData = reinterpret_cast<void *>(const_cast<TUint8 *>(message->GetData()->Ptr())); |
|
666 TInt aLength = message->GetData()->Size(); |
|
667 iEapPlugin->process_data(aData, aLength); |
|
668 } |
|
669 else |
|
670 { |
|
671 EAP_TRACE_DEBUG( |
|
672 iTools, |
|
673 TRACE_FLAGS_DEFAULT, |
|
674 (EAPL("ERROR: CEapServerProcessHandler::RunL(): EEapPluginProcessData, iEapPlugin is NULL\n"))); |
|
675 } |
|
676 |
|
677 break; |
|
678 |
|
679 case EEapSettingsProcessData: |
|
680 |
|
681 EAP_TRACE_DEBUG( |
|
682 iTools, |
|
683 TRACE_FLAGS_DEFAULT, |
|
684 (EAPL("CEapServerProcessHandler::RunL() EEapSettingsProcessData\n"))); |
|
685 |
|
686 if (iEapSettings !=0) |
|
687 { |
|
688 void* aData = reinterpret_cast<void *>(const_cast<TUint8 *>(message->GetData()->Ptr())); |
|
689 TInt aLength = message->GetData()->Size(); |
|
690 iEapSettings->process_data(aData, aLength); |
|
691 } |
|
692 else |
|
693 { |
|
694 EAP_TRACE_DEBUG( |
|
695 iTools, |
|
696 TRACE_FLAGS_DEFAULT, |
|
697 (EAPL("ERROR: CEapServerProcessHandler::RunL(): EEapSettingsProcessData, iEapSettings is NULL\n"))); |
|
698 } |
|
699 |
|
700 break; |
|
701 |
|
702 #if defined (USE_WAPI_CORE) |
|
703 case EWapiCoreProcessData: |
|
704 |
|
705 EAP_TRACE_DEBUG( |
|
706 iTools, |
|
707 TRACE_FLAGS_DEFAULT, |
|
708 (EAPL("CEapServerProcessHandler::RunL() EWapiCoreProcessData\n"))); |
|
709 |
|
710 if (iWapiCore !=0) |
|
711 { |
|
712 void* aData = reinterpret_cast<void *>(const_cast<TUint8 *>(message->GetData()->Ptr())); |
|
713 TInt aLength = message->GetData()->Size(); |
|
714 iWapiCore->process_data(aData, aLength); |
|
715 } |
|
716 else |
|
717 { |
|
718 EAP_TRACE_DEBUG( |
|
719 iTools, |
|
720 TRACE_FLAGS_DEFAULT, |
|
721 (EAPL("ERROR: CEapServerProcessHandler::RunL(): EWapiCoreProcessData, iWapiCore is NULL\n"))); |
|
722 } |
|
723 break; |
|
724 |
|
725 case EWapiSettingsProcessData: |
|
726 |
|
727 EAP_TRACE_DEBUG( |
|
728 iTools, |
|
729 TRACE_FLAGS_DEFAULT, |
|
730 (EAPL("CEapServerProcessHandler::RunL() EWapiSettingsProcessData\n"))); |
|
731 |
|
732 if (iWapiSettings !=0) |
|
733 { |
|
734 void* aData = reinterpret_cast<void *>(const_cast<TUint8 *>(message->GetData()->Ptr())); |
|
735 TInt aLength = message->GetData()->Size(); |
|
736 iWapiSettings->process_data(aData, aLength); |
|
737 } |
|
738 else |
|
739 { |
|
740 EAP_TRACE_DEBUG( |
|
741 iTools, |
|
742 TRACE_FLAGS_DEFAULT, |
|
743 (EAPL("ERROR: CEapServerProcessHandler::RunL(): EWapiSettingsProcessData, iWapiSettings is NULL\n"))); |
|
744 } |
|
745 |
|
746 break; |
|
747 #endif |
|
748 |
|
749 case EEapCoreSendData: |
|
750 case EEapPluginSendData: |
|
751 case EEapSettingsSendData: |
|
752 case EEapPacStoreSendData: |
|
753 #if defined (USE_WAPI_CORE) |
|
754 case EWapiCoreSendData: |
|
755 case EWapiSettingsSendData: |
|
756 #endif |
|
757 if (message->GetRequestType() == EEapCoreSendData) |
|
758 { |
|
759 EAP_TRACE_DEBUG( |
|
760 iTools, |
|
761 TRACE_FLAGS_DEFAULT, |
|
762 (EAPL("CEapServerProcessHandler::RunL() EEapCoreSendData\n"))); |
|
763 } |
|
764 else if (message->GetRequestType() == EEapPluginSendData) |
|
765 { |
|
766 EAP_TRACE_DEBUG( |
|
767 iTools, |
|
768 TRACE_FLAGS_DEFAULT, |
|
769 (EAPL("CEapServerProcessHandler::RunL() EEapPluginSendData\n"))); |
|
770 } |
|
771 else if (message->GetRequestType() == EEapSettingsSendData) |
|
772 { |
|
773 EAP_TRACE_DEBUG( |
|
774 iTools, |
|
775 TRACE_FLAGS_DEFAULT, |
|
776 (EAPL("CEapServerProcessHandler::RunL() EEapSettingsSendData\n"))); |
|
777 } |
|
778 else if (message->GetRequestType() == EEapPacStoreSendData) |
|
779 { |
|
780 EAP_TRACE_DEBUG( |
|
781 iTools, |
|
782 TRACE_FLAGS_DEFAULT, |
|
783 (EAPL("CEapServerProcessHandler::RunL() EEapPacStoreSendData\n"))); |
|
784 } |
|
785 #if defined (USE_WAPI_CORE) |
|
786 else if (message->GetRequestType() == EWapiCoreSendData) |
|
787 { |
|
788 EAP_TRACE_DEBUG( |
|
789 iTools, |
|
790 TRACE_FLAGS_DEFAULT, |
|
791 (EAPL("CEapServerProcessHandler::RunL() EWapiCoreSendData\n"))); |
|
792 } |
|
793 else if (message->GetRequestType() == EWapiSettingsSendData) |
|
794 { |
|
795 EAP_TRACE_DEBUG( |
|
796 iTools, |
|
797 TRACE_FLAGS_DEFAULT, |
|
798 (EAPL("CEapServerProcessHandler::RunL() EWapiSettingsSendData\n"))); |
|
799 } |
|
800 #endif |
|
801 EAP_TRACE_DEBUG( |
|
802 iTools, |
|
803 TRACE_FLAGS_DEFAULT, |
|
804 (EAPL("CEapServerProcessHandler::RunL(): iClient=0x%08x\n"), |
|
805 iClient)); |
|
806 |
|
807 if (iClient != 0) |
|
808 { |
|
809 status = iClient->SendData(message); |
|
810 if (status != eap_status_ok) |
|
811 { |
|
812 EAP_TRACE_DEBUG( |
|
813 iTools, |
|
814 TRACE_FLAGS_DEFAULT, |
|
815 (EAPL("ERROR: CEapServerProcessHandler::RunL(): SendData() failed, iClient=0x%08x, status=%d=%s\n"), |
|
816 iClient, |
|
817 status, |
|
818 eap_status_string_c::get_status_string(status))); |
|
819 |
|
820 // We do not return here. Even the iClient->SendData() fails we run this function to the end. |
|
821 } |
|
822 } |
|
823 else |
|
824 { |
|
825 EAP_TRACE_DEBUG( |
|
826 iTools, |
|
827 TRACE_FLAGS_DEFAULT, |
|
828 (EAPL("ERROR: CEapServerProcessHandler::RunL(): EEap*SendData, iClient is NULL\n"))); |
|
829 } |
|
830 |
|
831 break; |
|
832 |
|
833 default: |
|
834 |
|
835 EAP_TRACE_DEBUG( |
|
836 iTools, |
|
837 TRACE_FLAGS_DEFAULT, |
|
838 (EAPL("ERROR: CEapServerProcessHandler::RunL(): unknown message->GetRequestType()=%d=%s\n"), |
|
839 message->GetRequestType(), |
|
840 EapServerStrings::GetEapRequestsString(message->GetRequestType()))); |
|
841 break; |
|
842 |
|
843 } // switch() |
|
844 |
|
845 if (status == eap_status_ok) |
|
846 { |
|
847 // First one handled, remove message. |
|
848 // iClient->SendData() call may fail, then we do not remove the message. |
|
849 iEapMessageQueue->DeleteFirstMessage(); |
|
850 } |
|
851 |
|
852 } // if () |
|
853 |
|
854 if (iEapMessageQueue->GetFirstMessage() != 0) |
|
855 { |
|
856 EAP_TRACE_DEBUG( |
|
857 iTools, |
|
858 TRACE_FLAGS_DEFAULT, |
|
859 (EAPL("CEapServerProcessHandler::RunL(): Still messages waiting.\n"))); |
|
860 |
|
861 if (iClient != NULL) |
|
862 { |
|
863 if (iClient->GetReceiveActive()) |
|
864 { |
|
865 Activate(); |
|
866 } |
|
867 else |
|
868 { |
|
869 EAP_TRACE_DEBUG( |
|
870 iTools, |
|
871 TRACE_FLAGS_DEFAULT, |
|
872 (EAPL("WARNING: CEapServerProcessHandler::RunL(): cannot call User::RequestComplete() because no receive is active.\n"))); |
|
873 } |
|
874 } |
|
875 } |
|
876 else |
|
877 { |
|
878 EAP_TRACE_DEBUG( |
|
879 iTools, |
|
880 TRACE_FLAGS_DEFAULT, |
|
881 (EAPL("CEapServerProcessHandler::RunL(): No more messages to process.\n"))); |
|
882 } |
|
883 |
|
884 EAP_TRACE_DEBUG( |
|
885 iTools, |
|
886 TRACE_FLAGS_DEFAULT, |
|
887 (EAPL("=end======================================================================\n"))); |
|
888 } |
|
889 |
|
890 //---------------------------------------------------------------------------- |
|
891 |
|
892 void CEapServerProcessHandler::DoCancel() |
|
893 { |
|
894 EAP_TRACE_DEBUG( |
|
895 iTools, |
|
896 TRACE_FLAGS_DEFAULT, |
|
897 (EAPL("CEapServerProcessHandler::DoCancel(): this=0x%08x\n"), |
|
898 this)); |
|
899 EAP_TRACE_RETURN_STRING(iTools, "returns: CEapServerProcessHandler::DoCancel()"); |
|
900 |
|
901 } |
|
902 |
|
903 //---------------------------------------------------------------------------- |
|
904 |
|
905 TInt CEapServerProcessHandler::RunError(TInt aError) |
|
906 { |
|
907 EAP_TRACE_DEBUG( |
|
908 iTools, |
|
909 TRACE_FLAGS_DEFAULT, |
|
910 (EAPL("CEapServerProcessHandler::RunError(): aError=%d, this=0x%08x\n"), |
|
911 aError, |
|
912 this)); |
|
913 EAP_TRACE_RETURN_STRING(iTools, "returns: CEapServerProcessHandler::RunError()"); |
|
914 |
|
915 Cancel(); |
|
916 |
|
917 return aError; |
|
918 } |
|
919 |
|
920 //---------------------------------------------------------------------------- |
|
921 // end |
|