|
1 /* |
|
2 * Copyright (c) 2001-2006 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of the License "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: EAP and WLAN authentication protocols. |
|
15 * |
|
16 */ |
|
17 |
|
18 /* |
|
19 * %version: 53 % |
|
20 */ |
|
21 |
|
22 // This is enumeration of EAPOL source code. |
|
23 #if defined(USE_EAP_MINIMUM_RELEASE_TRACES) |
|
24 #undef EAP_FILE_NUMBER_ENUM |
|
25 #define EAP_FILE_NUMBER_ENUM 605 |
|
26 #undef EAP_FILE_NUMBER_DATE |
|
27 #define EAP_FILE_NUMBER_DATE 1127594498 |
|
28 #endif //#if defined(USE_EAP_MINIMUM_RELEASE_TRACES) |
|
29 |
|
30 |
|
31 // INCLUDE FILES |
|
32 |
|
33 #include "EapGeneric.h" |
|
34 #include "EapConversion.h" |
|
35 #include "eap_base_type.h" |
|
36 #include "eap_method_settings.h" |
|
37 #include "eap_am_assert.h" |
|
38 #include <EapTypeInfo.h> |
|
39 #include "abs_eap_am_tools.h" |
|
40 #include "eap_automatic_variable.h" |
|
41 #include <utf.h> // for CnvUtfConverter |
|
42 #include "abs_eap_plugin_message.h" |
|
43 #include "eap_plugin_message_base.h" |
|
44 #include "abs_eap_am_message_if.h" |
|
45 #include "eap_am_message_if.h" |
|
46 #include "eap_automatic_variable.h" |
|
47 #include "eap_plugin_client_message_if.h" |
|
48 #include "eap_am_message_if_symbian.h" |
|
49 #include "EapTraceSymbian.h" |
|
50 |
|
51 // LOCAL CONSTANTS |
|
52 |
|
53 // The version number of this interface. |
|
54 const TUint KInterfaceVersion = 1; |
|
55 |
|
56 |
|
57 // ================= MEMBER FUNCTIONS ======================= |
|
58 |
|
59 |
|
60 CEapGeneric::CEapGeneric( |
|
61 const TIndexType aIndexType, |
|
62 const TInt aIndex, |
|
63 const TEapExpandedType aEapType) |
|
64 : m_am_tools(abs_eap_am_tools_c::new_abs_eap_am_tools_c()) |
|
65 , m_server(eap_plugin_message_base_c::new_eap_plugin_client_message_if_c( |
|
66 m_am_tools, |
|
67 this)) |
|
68 , iIndexType(aIndexType) |
|
69 , iIndex(aIndex) |
|
70 , iEapType(aEapType) |
|
71 , iTunnelingType(eap_type_none) |
|
72 , iTunnelingTypePresent(false) |
|
73 , iWaitState(eap_generic_wait_state_none) |
|
74 , iCompletionStatus(eap_status_process_general_error) |
|
75 |
|
76 , ipEAPSettings(0) |
|
77 { |
|
78 EAP_TRACE_DEBUG( |
|
79 m_am_tools, |
|
80 TRACE_FLAGS_DEFAULT, |
|
81 (EAPL("CEapGeneric::CEapGeneric(): this=0x%08x.\n"), |
|
82 this)); |
|
83 |
|
84 EAP_TRACE_RETURN_STRING(m_am_tools, "returns: CEapGeneric::CEapGeneric()"); |
|
85 } |
|
86 |
|
87 // ---------------------------------------------------------- |
|
88 |
|
89 void CEapGeneric::ConstructL() |
|
90 { |
|
91 EAP_TRACE_DEBUG( |
|
92 m_am_tools, |
|
93 TRACE_FLAGS_DEFAULT, |
|
94 (EAPL("CEapGeneric::ConstructL(): this=0x%08x.\n"), |
|
95 this)); |
|
96 |
|
97 EAP_TRACE_RETURN_STRING(m_am_tools, "returns: CEapGeneric::ConstructL()"); |
|
98 |
|
99 if (m_am_tools == 0 |
|
100 || m_am_tools->get_is_valid() == false |
|
101 || m_server == 0 |
|
102 || m_server->get_is_valid() == false) |
|
103 { |
|
104 abs_eap_am_tools_c::delete_abs_eap_am_tools_c(m_am_tools); |
|
105 delete m_server; |
|
106 |
|
107 User::Leave(KErrNoMemory); |
|
108 } |
|
109 |
|
110 eap_status_e status = m_server->configure(); |
|
111 if (status != eap_status_ok) |
|
112 { |
|
113 abs_eap_am_tools_c::delete_abs_eap_am_tools_c(m_am_tools); |
|
114 delete m_server; |
|
115 |
|
116 User::Leave(KErrNoMemory); |
|
117 } |
|
118 } |
|
119 |
|
120 // ---------------------------------------------------------- |
|
121 |
|
122 CEapGeneric* CEapGeneric::NewL(SIapInfo *aIapInfo) |
|
123 { |
|
124 CEapGeneric* self = new(ELeave) CEapGeneric(aIapInfo->indexType, aIapInfo->index, aIapInfo->aEapType); |
|
125 |
|
126 CleanupStack::PushL(self); |
|
127 |
|
128 self->ConstructL(); |
|
129 |
|
130 CleanupStack::Pop(); |
|
131 |
|
132 return self; |
|
133 } |
|
134 |
|
135 // ---------------------------------------------------------- |
|
136 |
|
137 CEapGeneric::~CEapGeneric() |
|
138 { |
|
139 EAP_TRACE_DEBUG( |
|
140 m_am_tools, |
|
141 TRACE_FLAGS_DEFAULT, |
|
142 (EAPL("CEapGeneric::~CEapGeneric(): this=0x%08x.\n"), |
|
143 this)); |
|
144 |
|
145 // Do not use m_am_tools, because it will be destroyed before return. |
|
146 EAP_TRACE_RETURN_STRING_SYMBIAN(_L("returns: CEapGeneric::~CEapGeneric()")); |
|
147 |
|
148 if (m_server != 0) |
|
149 { |
|
150 m_server->shutdown(); |
|
151 } |
|
152 delete m_server; |
|
153 |
|
154 abs_eap_am_tools_c::delete_abs_eap_am_tools_c(m_am_tools); |
|
155 } |
|
156 |
|
157 // ---------------------------------------------------------- |
|
158 |
|
159 #ifdef USE_EAP_SIMPLE_CONFIG |
|
160 |
|
161 eap_base_type_c* CEapGeneric::GetStackInterfaceL(abs_eap_am_tools_c* const aTools, |
|
162 abs_eap_base_type_c* const aPartner, |
|
163 const bool is_client_when_true, |
|
164 const eap_am_network_id_c * const receive_network_id, |
|
165 abs_eap_configuration_if_c * const /*configuration_if*/) |
|
166 |
|
167 #else |
|
168 |
|
169 eap_base_type_c* CEapGeneric::GetStackInterfaceL(abs_eap_am_tools_c* const aTools, |
|
170 abs_eap_base_type_c* const aPartner, |
|
171 const bool is_client_when_true, |
|
172 const eap_am_network_id_c * const receive_network_id) |
|
173 |
|
174 #endif // #ifdef USE_EAP_SIMPLE_CONFIG |
|
175 { |
|
176 // This class does not have stack interface. |
|
177 EAP_TRACE_DEBUG( |
|
178 m_am_tools, |
|
179 TRACE_FLAGS_DEFAULT, |
|
180 (EAPL("ERROR: CEapGeneric::GetStackInterfaceL(): this=0x%08x\n"), |
|
181 this)); |
|
182 |
|
183 EAP_ASSERT_ANYWAY_TOOLS(aTools); |
|
184 |
|
185 return 0; |
|
186 } |
|
187 |
|
188 //---------------------------------------------------------------- |
|
189 |
|
190 void CEapGeneric::Activate() |
|
191 { |
|
192 EAP_TRACE_DEBUG( |
|
193 m_am_tools, |
|
194 TRACE_FLAGS_DEFAULT, |
|
195 (EAPL("CEapGeneric::Activate(): iAsyncronousStatus=%u\n"), |
|
196 iAsyncronousStatus.Int())); |
|
197 |
|
198 EAP_TRACE_RETURN_STRING(m_am_tools, "returns: CEapGeneric::Activate()"); |
|
199 |
|
200 iAsyncronousStatus = KRequestPending; |
|
201 } |
|
202 |
|
203 //---------------------------------------------------------------- |
|
204 |
|
205 void CEapGeneric::Complete() |
|
206 { |
|
207 EAP_TRACE_DEBUG( |
|
208 m_am_tools, |
|
209 TRACE_FLAGS_DEFAULT, |
|
210 (EAPL("CEapGeneric::Complete(): iAsyncronousStatus=%u\n"), |
|
211 iAsyncronousStatus.Int())); |
|
212 |
|
213 EAP_TRACE_RETURN_STRING(m_am_tools, "returns: CEapGeneric::Complete()"); |
|
214 |
|
215 iAsyncronousStatus = KErrNone; |
|
216 |
|
217 // This is needed to continue the execution after Wait.Start(); |
|
218 iWait.AsyncStop(); |
|
219 } |
|
220 |
|
221 //---------------------------------------------------------------- |
|
222 |
|
223 void CEapGeneric::WaitCompletion() |
|
224 { |
|
225 EAP_TRACE_DEBUG( |
|
226 m_am_tools, |
|
227 TRACE_FLAGS_DEFAULT, |
|
228 (EAPL("CEapGeneric::WaitCompletion(): iAsyncronousStatus=%u\n"), |
|
229 iAsyncronousStatus.Int())); |
|
230 |
|
231 EAP_TRACE_RETURN_STRING(m_am_tools, "returns: CEapGeneric::WaitCompletion()"); |
|
232 |
|
233 while (iAsyncronousStatus == KRequestPending) |
|
234 { |
|
235 EAP_TRACE_DEBUG( |
|
236 m_am_tools, |
|
237 TRACE_FLAGS_DEFAULT, |
|
238 (EAPL("CEapGeneric::WaitCompletion(): calls iWait.Start()\n"))); |
|
239 |
|
240 iWait.Start(); |
|
241 |
|
242 EAP_TRACE_DEBUG( |
|
243 m_am_tools, |
|
244 TRACE_FLAGS_DEFAULT, |
|
245 (EAPL("CEapGeneric::WaitCompletion(): iWait.Start() continue, iAsyncronousStatus=%u\n"), |
|
246 iAsyncronousStatus.Int())); |
|
247 } |
|
248 } |
|
249 |
|
250 // ---------------------------------------------------------- |
|
251 |
|
252 void CEapGeneric::SetCompletionStatusIfStillOk(const eap_status_e status) |
|
253 { |
|
254 EAP_TRACE_DEBUG( |
|
255 m_am_tools, |
|
256 TRACE_FLAGS_DEFAULT, |
|
257 (EAPL("CEapGeneric::SetCompletionStatusIfStillOk(): iCompletionStatus=%u=%s, status=%d=%s\n"), |
|
258 iCompletionStatus, |
|
259 eap_status_string_c::get_status_string(iCompletionStatus), |
|
260 status, |
|
261 eap_status_string_c::get_status_string(status))); |
|
262 |
|
263 EAP_TRACE_RETURN_STRING(m_am_tools, "returns: CEapGeneric::SetCompletionStatusIfStillOk()"); |
|
264 |
|
265 if (iCompletionStatus == eap_status_ok) |
|
266 { |
|
267 iCompletionStatus = status; |
|
268 } |
|
269 } |
|
270 |
|
271 // ---------------------------------------------------------- |
|
272 |
|
273 |
|
274 |
|
275 // ---------------------------------------------------------- |
|
276 |
|
277 CEapTypeInfo* CEapGeneric::GetInfoL() |
|
278 { |
|
279 EAP_TRACE_DEBUG( |
|
280 m_am_tools, |
|
281 TRACE_FLAGS_DEFAULT, |
|
282 (EAPL("CEapGeneric::GetInfoL(): this=0x%08x\n"), |
|
283 this)); |
|
284 |
|
285 EAP_TRACE_RETURN_STRING(m_am_tools, "returns: CEapGeneric::GetInfoL()"); |
|
286 |
|
287 eap_method_settings_c * const internal_settings = new eap_method_settings_c(m_am_tools); |
|
288 if (internal_settings == 0) |
|
289 { |
|
290 User::Leave(m_am_tools->convert_eapol_error_to_am_error( |
|
291 EAP_STATUS_RETURN(m_am_tools, eap_status_allocation_error))); |
|
292 } |
|
293 |
|
294 iCompletionStatus = eap_status_process_general_error; |
|
295 |
|
296 eap_status_e status = m_server->get_type_info(internal_settings); |
|
297 |
|
298 delete internal_settings; |
|
299 |
|
300 if (status != eap_status_ok) |
|
301 { |
|
302 User::Leave(m_am_tools->convert_eapol_error_to_am_error( |
|
303 EAP_STATUS_RETURN(m_am_tools, status))); |
|
304 } |
|
305 |
|
306 iWaitState = eap_generic_wait_state_complete_get_type_info; |
|
307 Activate(); |
|
308 WaitCompletion(); |
|
309 |
|
310 if (iCompletionStatus != eap_status_ok) |
|
311 { |
|
312 User::Leave(m_am_tools->convert_eapol_error_to_am_error( |
|
313 EAP_STATUS_RETURN(m_am_tools, iCompletionStatus))); |
|
314 } |
|
315 |
|
316 CEapTypeInfo* info = new(ELeave) CEapTypeInfo( |
|
317 iReleaseDate, |
|
318 iEapTypeVersion, |
|
319 iManufacturer); |
|
320 |
|
321 return info; |
|
322 } |
|
323 |
|
324 // ---------------------------------------------------------- |
|
325 |
|
326 void CEapGeneric::DeleteConfigurationL() |
|
327 { |
|
328 EAP_TRACE_DEBUG( |
|
329 m_am_tools, |
|
330 TRACE_FLAGS_DEFAULT, |
|
331 (EAPL("CEapGeneric::DeleteConfigurationL(): this=0x%08x\n"), |
|
332 this)); |
|
333 |
|
334 EAP_TRACE_RETURN_STRING(m_am_tools, "returns: CEapGeneric::DeleteConfigurationL()"); |
|
335 |
|
336 eap_method_settings_c * const internal_settings = new eap_method_settings_c(m_am_tools); |
|
337 if (internal_settings == 0) |
|
338 { |
|
339 User::Leave(m_am_tools->convert_eapol_error_to_am_error( |
|
340 EAP_STATUS_RETURN(m_am_tools, eap_status_allocation_error))); |
|
341 } |
|
342 |
|
343 CleanupStack::PushL(internal_settings); |
|
344 |
|
345 internal_settings->m_IndexType = iIndexType; |
|
346 internal_settings->m_Index = iIndex; |
|
347 |
|
348 TInt error = CEapConversion::ConvertExpandedEAPTypeToInternalType( |
|
349 &iEapType, |
|
350 &(internal_settings->m_EAPType)); |
|
351 if (error != KErrNone) |
|
352 { |
|
353 (void)EAP_STATUS_RETURN(m_am_tools, m_am_tools->convert_am_error_to_eapol_error(error)); |
|
354 User::Leave(error); |
|
355 } |
|
356 iCompletionStatus = eap_status_process_general_error; |
|
357 |
|
358 eap_status_e status = m_server->delete_configuration(internal_settings); |
|
359 |
|
360 CleanupStack::PopAndDestroy(internal_settings); |
|
361 |
|
362 if (status != eap_status_ok) |
|
363 { |
|
364 User::Leave(m_am_tools->convert_eapol_error_to_am_error( |
|
365 EAP_STATUS_RETURN(m_am_tools, status))); |
|
366 } |
|
367 |
|
368 iWaitState = eap_generic_wait_state_complete_delete_configuration; |
|
369 Activate(); |
|
370 WaitCompletion(); |
|
371 |
|
372 if (iCompletionStatus != eap_status_ok) |
|
373 { |
|
374 User::Leave(m_am_tools->convert_eapol_error_to_am_error( |
|
375 EAP_STATUS_RETURN(m_am_tools, iCompletionStatus))); |
|
376 } |
|
377 } |
|
378 |
|
379 // ---------------------------------------------------------- |
|
380 |
|
381 TUint CEapGeneric::GetInterfaceVersion() |
|
382 { |
|
383 EAP_TRACE_DEBUG( |
|
384 m_am_tools, |
|
385 TRACE_FLAGS_DEFAULT, |
|
386 (EAPL("CEapGeneric::GetInterfaceVersion(): this=0x%08x\n"), |
|
387 this)); |
|
388 |
|
389 EAP_TRACE_RETURN_STRING(m_am_tools, "returns: CEapGeneric::GetInterfaceVersion()"); |
|
390 |
|
391 return KInterfaceVersion; |
|
392 } |
|
393 |
|
394 // ---------------------------------------------------------- |
|
395 |
|
396 void CEapGeneric::SetTunnelingType(const TEapExpandedType aTunnelingType) |
|
397 { |
|
398 EAP_TRACE_DEBUG( |
|
399 m_am_tools, |
|
400 TRACE_FLAGS_DEFAULT, |
|
401 (EAPL("CEapGeneric::SetTunnelingType(): this=0x%08x\n"), |
|
402 this)); |
|
403 |
|
404 EAP_TRACE_RETURN_STRING(m_am_tools, "returns: CEapGeneric::SetTunnelingType()"); |
|
405 |
|
406 EAP_TRACE_DATA_DEBUG_SYMBIAN( |
|
407 (EAPL("CEapGeneric::SetTunnelingType - tunneling type"), |
|
408 aTunnelingType.GetValue().Ptr(), aTunnelingType.GetValue().Length())); |
|
409 |
|
410 iTunnelingTypePresent = true; |
|
411 |
|
412 eap_type_value_e aInternalType; |
|
413 |
|
414 TInt error = CEapConversion::ConvertExpandedEAPTypeToInternalType( |
|
415 &aTunnelingType, |
|
416 &aInternalType); |
|
417 if (error != KErrNone) |
|
418 { |
|
419 (void)EAP_STATUS_RETURN(m_am_tools, m_am_tools->convert_am_error_to_eapol_error(error)); |
|
420 } |
|
421 |
|
422 iTunnelingType = aInternalType; |
|
423 |
|
424 } |
|
425 |
|
426 |
|
427 // ---------------------------------------------------------- |
|
428 |
|
429 void CEapGeneric::SetIndexL( |
|
430 const TIndexType aIndexType, |
|
431 const TInt aIndex ) |
|
432 { |
|
433 EAP_TRACE_DEBUG( |
|
434 m_am_tools, |
|
435 TRACE_FLAGS_DEFAULT, |
|
436 (EAPL("CEapGeneric::SetIndexL(): this=0x%08x\n"), |
|
437 this)); |
|
438 |
|
439 EAP_TRACE_RETURN_STRING(m_am_tools, "returns: CEapGeneric::SetIndexL()"); |
|
440 |
|
441 eap_method_settings_c * const internal_settings = new eap_method_settings_c(m_am_tools); |
|
442 if (internal_settings == 0) |
|
443 { |
|
444 User::Leave(m_am_tools->convert_eapol_error_to_am_error( |
|
445 EAP_STATUS_RETURN(m_am_tools, eap_status_allocation_error))); |
|
446 } |
|
447 |
|
448 CleanupStack::PushL(internal_settings); |
|
449 internal_settings->m_IndexType = aIndexType; |
|
450 internal_settings->m_Index = aIndex; |
|
451 |
|
452 TInt error = CEapConversion::ConvertExpandedEAPTypeToInternalType( |
|
453 &iEapType, |
|
454 &(internal_settings->m_EAPType)); |
|
455 if (error != KErrNone) |
|
456 { |
|
457 (void)EAP_STATUS_RETURN(m_am_tools, m_am_tools->convert_am_error_to_eapol_error(error)); |
|
458 User::Leave(error); |
|
459 } |
|
460 |
|
461 iCompletionStatus = eap_status_process_general_error; |
|
462 |
|
463 eap_status_e status = m_server->delete_configuration(internal_settings); |
|
464 |
|
465 if (status != eap_status_ok) |
|
466 { |
|
467 CleanupStack::PopAndDestroy(internal_settings); |
|
468 |
|
469 User::Leave(m_am_tools->convert_eapol_error_to_am_error( |
|
470 EAP_STATUS_RETURN(m_am_tools, status))); |
|
471 } |
|
472 |
|
473 iWaitState = eap_generic_wait_state_complete_delete_configuration; |
|
474 Activate(); |
|
475 WaitCompletion(); |
|
476 |
|
477 if (iCompletionStatus != eap_status_ok) |
|
478 { |
|
479 User::Leave(m_am_tools->convert_eapol_error_to_am_error( |
|
480 EAP_STATUS_RETURN(m_am_tools, iCompletionStatus))); |
|
481 } |
|
482 |
|
483 internal_settings->m_IndexType = iIndexType; |
|
484 internal_settings->m_Index = iIndex; |
|
485 |
|
486 error = CEapConversion::ConvertExpandedEAPTypeToInternalType( |
|
487 &iEapType, |
|
488 &(internal_settings->m_EAPType)); |
|
489 if (error != KErrNone) |
|
490 { |
|
491 (void)EAP_STATUS_RETURN(m_am_tools, m_am_tools->convert_am_error_to_eapol_error(error)); |
|
492 User::Leave(error); |
|
493 } |
|
494 |
|
495 internal_settings->m_TunnelingTypePresent = iTunnelingTypePresent; |
|
496 internal_settings->m_TunnelingType = iTunnelingType; |
|
497 |
|
498 internal_settings->m_DestinationIndexAndTypePresent = true; |
|
499 internal_settings->m_DestinationIndexType = aIndexType; |
|
500 internal_settings->m_DestinationIndex = aIndex; |
|
501 |
|
502 iCompletionStatus = eap_status_process_general_error; |
|
503 |
|
504 status = m_server->set_index(internal_settings); |
|
505 |
|
506 CleanupStack::PopAndDestroy(internal_settings); |
|
507 |
|
508 if (status != eap_status_ok) |
|
509 { |
|
510 User::Leave(m_am_tools->convert_eapol_error_to_am_error( |
|
511 EAP_STATUS_RETURN(m_am_tools, status))); |
|
512 } |
|
513 |
|
514 iWaitState = eap_generic_wait_state_complete_set_index; |
|
515 Activate(); |
|
516 WaitCompletion(); |
|
517 |
|
518 if (iCompletionStatus != eap_status_ok) |
|
519 { |
|
520 User::Leave(m_am_tools->convert_eapol_error_to_am_error( |
|
521 EAP_STATUS_RETURN(m_am_tools, iCompletionStatus))); |
|
522 } |
|
523 |
|
524 } |
|
525 |
|
526 // ---------------------------------------------------------- |
|
527 |
|
528 void CEapGeneric::SetConfigurationL(const EAPSettings& aSettings) |
|
529 { |
|
530 EAP_TRACE_DEBUG( |
|
531 m_am_tools, |
|
532 TRACE_FLAGS_DEFAULT, |
|
533 (EAPL("CEapGeneric::SetConfigurationL(): this=0x%08x\n"), |
|
534 this)); |
|
535 |
|
536 EAP_TRACE_RETURN_STRING(m_am_tools, "returns: CEapGeneric::SetConfigurationL()"); |
|
537 |
|
538 eap_method_settings_c * const internal_settings = new eap_method_settings_c(m_am_tools); |
|
539 if (internal_settings == 0) |
|
540 { |
|
541 User::Leave(m_am_tools->convert_eapol_error_to_am_error( |
|
542 EAP_STATUS_RETURN(m_am_tools, eap_status_allocation_error))); |
|
543 } |
|
544 |
|
545 CleanupStack::PushL(internal_settings); |
|
546 |
|
547 eap_status_e status(eap_status_process_general_error); |
|
548 |
|
549 TInt error(KErrNone); |
|
550 |
|
551 error = CEapConversion::ConvertEAPSettingsToInternalType( |
|
552 m_am_tools, |
|
553 &aSettings, |
|
554 internal_settings); |
|
555 if(error == KErrNone) |
|
556 { |
|
557 internal_settings->m_IndexType = iIndexType; |
|
558 internal_settings->m_Index = iIndex; |
|
559 |
|
560 TInt error = CEapConversion::ConvertExpandedEAPTypeToInternalType( |
|
561 &iEapType, |
|
562 &(internal_settings->m_EAPType)); |
|
563 if (error != KErrNone) |
|
564 { |
|
565 CleanupStack::PopAndDestroy(internal_settings); |
|
566 (void)EAP_STATUS_RETURN(m_am_tools, m_am_tools->convert_am_error_to_eapol_error(error)); |
|
567 User::Leave(error); |
|
568 } |
|
569 |
|
570 internal_settings->m_TunnelingTypePresent = iTunnelingTypePresent; |
|
571 internal_settings->m_TunnelingType = iTunnelingType; |
|
572 |
|
573 iCompletionStatus = eap_status_process_general_error; |
|
574 |
|
575 status = m_server->set_configuration(internal_settings); |
|
576 } |
|
577 else |
|
578 { |
|
579 status = m_am_tools->convert_am_error_to_eapol_error(error); |
|
580 } |
|
581 |
|
582 CleanupStack::PopAndDestroy(internal_settings); |
|
583 |
|
584 if (status != eap_status_ok) |
|
585 { |
|
586 User::Leave(m_am_tools->convert_eapol_error_to_am_error( |
|
587 EAP_STATUS_RETURN(m_am_tools, status))); |
|
588 } |
|
589 |
|
590 iWaitState = eap_generic_wait_state_complete_set_configuration; |
|
591 Activate(); |
|
592 WaitCompletion(); |
|
593 |
|
594 if (iCompletionStatus != eap_status_ok) |
|
595 { |
|
596 User::Leave(m_am_tools->convert_eapol_error_to_am_error( |
|
597 EAP_STATUS_RETURN(m_am_tools, iCompletionStatus))); |
|
598 } |
|
599 } |
|
600 |
|
601 // ---------------------------------------------------------- |
|
602 |
|
603 void CEapGeneric::GetConfigurationL(EAPSettings& aSettings) |
|
604 { |
|
605 EAP_TRACE_DEBUG( |
|
606 m_am_tools, |
|
607 TRACE_FLAGS_DEFAULT, |
|
608 (EAPL("CEapGeneric::GetConfigurationL(): this=0x%08x\n"), |
|
609 this)); |
|
610 |
|
611 EAP_TRACE_RETURN_STRING(m_am_tools, "returns: CEapGeneric::GetConfigurationL()"); |
|
612 |
|
613 eap_method_settings_c * const internal_settings = new eap_method_settings_c(m_am_tools); |
|
614 if (internal_settings == 0) |
|
615 { |
|
616 User::Leave(m_am_tools->convert_eapol_error_to_am_error( |
|
617 EAP_STATUS_RETURN(m_am_tools, eap_status_allocation_error))); |
|
618 } |
|
619 CleanupStack::PushL(internal_settings); |
|
620 |
|
621 internal_settings->m_IndexType = iIndexType; |
|
622 internal_settings->m_Index = iIndex; |
|
623 |
|
624 TInt error = CEapConversion::ConvertExpandedEAPTypeToInternalType( |
|
625 &iEapType, |
|
626 &(internal_settings->m_EAPType)); |
|
627 if (error != KErrNone) |
|
628 { |
|
629 CleanupStack::PopAndDestroy(internal_settings); |
|
630 (void)EAP_STATUS_RETURN(m_am_tools, m_am_tools->convert_am_error_to_eapol_error(error)); |
|
631 User::Leave(error); |
|
632 } |
|
633 |
|
634 internal_settings->m_TunnelingTypePresent = iTunnelingTypePresent; |
|
635 internal_settings->m_TunnelingType = iTunnelingType; |
|
636 |
|
637 ipEAPSettings = &aSettings; |
|
638 |
|
639 iCompletionStatus = eap_status_process_general_error; |
|
640 |
|
641 eap_status_e status = m_server->get_configuration(internal_settings); |
|
642 |
|
643 CleanupStack::PopAndDestroy(internal_settings); |
|
644 |
|
645 if (status != eap_status_ok) |
|
646 { |
|
647 User::Leave(m_am_tools->convert_eapol_error_to_am_error( |
|
648 EAP_STATUS_RETURN(m_am_tools, status))); |
|
649 } |
|
650 |
|
651 iWaitState = eap_generic_wait_state_complete_get_configuration; |
|
652 Activate(); |
|
653 WaitCompletion(); |
|
654 |
|
655 if (iCompletionStatus != eap_status_ok) |
|
656 { |
|
657 User::Leave(m_am_tools->convert_eapol_error_to_am_error( |
|
658 EAP_STATUS_RETURN(m_am_tools, iCompletionStatus))); |
|
659 } |
|
660 } |
|
661 |
|
662 // ---------------------------------------------------------- |
|
663 |
|
664 void CEapGeneric::CopySettingsL( |
|
665 const TIndexType aDestinationIndexType, |
|
666 const TInt aDestinationIndex) |
|
667 { |
|
668 EAP_TRACE_DEBUG( |
|
669 m_am_tools, |
|
670 TRACE_FLAGS_DEFAULT, |
|
671 (EAPL("CEapGeneric::CopySettingsL(): this=0x%08x\n"), |
|
672 this)); |
|
673 |
|
674 EAP_TRACE_RETURN_STRING(m_am_tools, "returns: CEapGeneric::CopySettingsL()"); |
|
675 |
|
676 eap_method_settings_c * const internal_settings = new eap_method_settings_c(m_am_tools); |
|
677 if (internal_settings == 0) |
|
678 { |
|
679 User::Leave(m_am_tools->convert_eapol_error_to_am_error( |
|
680 EAP_STATUS_RETURN(m_am_tools, eap_status_allocation_error))); |
|
681 } |
|
682 |
|
683 internal_settings->m_IndexType = aDestinationIndexType; |
|
684 internal_settings->m_Index = aDestinationIndex; |
|
685 |
|
686 iCompletionStatus = eap_status_process_general_error; |
|
687 |
|
688 eap_status_e status = m_server->delete_configuration(internal_settings); |
|
689 |
|
690 if (status != eap_status_ok) |
|
691 { |
|
692 delete internal_settings; |
|
693 |
|
694 User::Leave(m_am_tools->convert_eapol_error_to_am_error( |
|
695 EAP_STATUS_RETURN(m_am_tools, status))); |
|
696 } |
|
697 |
|
698 iWaitState = eap_generic_wait_state_complete_delete_configuration; |
|
699 Activate(); |
|
700 WaitCompletion(); |
|
701 |
|
702 if (iCompletionStatus != eap_status_ok) |
|
703 { |
|
704 delete internal_settings; |
|
705 |
|
706 User::Leave(m_am_tools->convert_eapol_error_to_am_error( |
|
707 EAP_STATUS_RETURN(m_am_tools, iCompletionStatus))); |
|
708 } |
|
709 |
|
710 internal_settings->m_IndexType = iIndexType; |
|
711 internal_settings->m_Index = iIndex; |
|
712 |
|
713 TInt error = CEapConversion::ConvertExpandedEAPTypeToInternalType( |
|
714 &iEapType, |
|
715 &(internal_settings->m_EAPType)); |
|
716 if (error != KErrNone) |
|
717 { |
|
718 (void)EAP_STATUS_RETURN(m_am_tools, m_am_tools->convert_am_error_to_eapol_error(error)); |
|
719 User::Leave(error); |
|
720 } |
|
721 |
|
722 internal_settings->m_TunnelingTypePresent = iTunnelingTypePresent; |
|
723 internal_settings->m_TunnelingType = iTunnelingType; |
|
724 |
|
725 internal_settings->m_DestinationIndexAndTypePresent = true; |
|
726 internal_settings->m_DestinationIndexType = aDestinationIndexType; |
|
727 internal_settings->m_DestinationIndex = aDestinationIndex; |
|
728 |
|
729 iCompletionStatus = eap_status_process_general_error; |
|
730 |
|
731 status = m_server->copy_configuration(internal_settings); |
|
732 |
|
733 delete internal_settings; |
|
734 |
|
735 if (status != eap_status_ok) |
|
736 { |
|
737 User::Leave(m_am_tools->convert_eapol_error_to_am_error( |
|
738 EAP_STATUS_RETURN(m_am_tools, status))); |
|
739 } |
|
740 |
|
741 iWaitState = eap_generic_wait_state_complete_copy_configuration; |
|
742 Activate(); |
|
743 WaitCompletion(); |
|
744 |
|
745 if (iCompletionStatus != eap_status_ok) |
|
746 { |
|
747 User::Leave(m_am_tools->convert_eapol_error_to_am_error( |
|
748 EAP_STATUS_RETURN(m_am_tools, iCompletionStatus))); |
|
749 } |
|
750 } |
|
751 |
|
752 // ---------------------------------------------------------- |
|
753 |
|
754 eap_status_e CEapGeneric::complete_get_configuration( |
|
755 const eap_method_settings_c * const internal_settings) |
|
756 { |
|
757 EAP_TRACE_DEBUG( |
|
758 m_am_tools, |
|
759 TRACE_FLAGS_DEFAULT, |
|
760 (EAPL("CEapGeneric::complete_get_configuration(): this=0x%08x, iWaitState=%d, status=%d=%s\n"), |
|
761 this, |
|
762 iWaitState, |
|
763 internal_settings->m_completion_status, |
|
764 eap_status_string_c::get_status_string(internal_settings->m_completion_status))); |
|
765 |
|
766 EAP_TRACE_RETURN_STRING(m_am_tools, "returns: CEapGeneric::complete_get_configuration()"); |
|
767 |
|
768 if (internal_settings == 0) |
|
769 { |
|
770 iCompletionStatus = eap_status_illegal_parameter; |
|
771 |
|
772 Complete(); |
|
773 |
|
774 return EAP_STATUS_RETURN(m_am_tools, iCompletionStatus); |
|
775 } |
|
776 |
|
777 iCompletionStatus = internal_settings->m_completion_status; |
|
778 |
|
779 if (iWaitState == eap_generic_wait_state_complete_get_configuration |
|
780 && iCompletionStatus == eap_status_ok) |
|
781 { |
|
782 if (ipEAPSettings != 0 |
|
783 && internal_settings != 0) |
|
784 { |
|
785 TInt error(KErrNone); |
|
786 |
|
787 error = CEapConversion::ConvertInternalTypeToEAPSettings( |
|
788 m_am_tools, |
|
789 internal_settings, |
|
790 ipEAPSettings); |
|
791 if(error != KErrNone) |
|
792 { |
|
793 SetCompletionStatusIfStillOk(EAP_STATUS_RETURN(m_am_tools, m_am_tools->convert_am_error_to_eapol_error(error))); |
|
794 } |
|
795 } |
|
796 else |
|
797 { |
|
798 SetCompletionStatusIfStillOk(EAP_STATUS_RETURN(m_am_tools, eap_status_illegal_parameter)); |
|
799 } |
|
800 } |
|
801 else if (iCompletionStatus == eap_status_ok) |
|
802 { |
|
803 // ERROR wrong state. |
|
804 SetCompletionStatusIfStillOk(EAP_STATUS_RETURN(m_am_tools, eap_status_wrong_eap_type_state)); |
|
805 } |
|
806 |
|
807 Complete(); |
|
808 |
|
809 return EAP_STATUS_RETURN(m_am_tools, iCompletionStatus); |
|
810 } |
|
811 |
|
812 // ---------------------------------------------------------- |
|
813 |
|
814 eap_status_e CEapGeneric::complete_set_configuration( |
|
815 const eap_status_e completion_status) |
|
816 { |
|
817 EAP_TRACE_DEBUG( |
|
818 m_am_tools, |
|
819 TRACE_FLAGS_DEFAULT, |
|
820 (EAPL("CEapGeneric::complete_set_configuration(): this=0x%08x, iWaitState=%d, status=%d=%s\n"), |
|
821 this, |
|
822 iWaitState, |
|
823 completion_status, |
|
824 eap_status_string_c::get_status_string(completion_status))); |
|
825 |
|
826 EAP_TRACE_RETURN_STRING(m_am_tools, "returns: CEapGeneric::complete_set_configuration()"); |
|
827 |
|
828 iCompletionStatus = completion_status; |
|
829 |
|
830 if (iWaitState != eap_generic_wait_state_complete_set_configuration |
|
831 && iCompletionStatus == eap_status_ok) |
|
832 { |
|
833 // ERROR wrong state. |
|
834 SetCompletionStatusIfStillOk(EAP_STATUS_RETURN(m_am_tools, eap_status_wrong_eap_type_state)); |
|
835 } |
|
836 |
|
837 Complete(); |
|
838 |
|
839 return EAP_STATUS_RETURN(m_am_tools, completion_status); |
|
840 } |
|
841 |
|
842 // ---------------------------------------------------------- |
|
843 |
|
844 eap_status_e CEapGeneric::complete_delete_configuration( |
|
845 const eap_status_e completion_status) |
|
846 { |
|
847 EAP_TRACE_DEBUG( |
|
848 m_am_tools, |
|
849 TRACE_FLAGS_DEFAULT, |
|
850 (EAPL("CEapGeneric::complete_delete_configuration(): this=0x%08x, iWaitState=%d, status=%d=%s\n"), |
|
851 this, |
|
852 iWaitState, |
|
853 completion_status, |
|
854 eap_status_string_c::get_status_string(completion_status))); |
|
855 |
|
856 EAP_TRACE_RETURN_STRING(m_am_tools, "returns: CEapGeneric::complete_delete_configuration()"); |
|
857 |
|
858 iCompletionStatus = completion_status; |
|
859 |
|
860 if (iWaitState != eap_generic_wait_state_complete_delete_configuration |
|
861 && iCompletionStatus == eap_status_ok) |
|
862 { |
|
863 // ERROR wrong state. |
|
864 SetCompletionStatusIfStillOk(EAP_STATUS_RETURN(m_am_tools, eap_status_wrong_eap_type_state)); |
|
865 } |
|
866 |
|
867 Complete(); |
|
868 |
|
869 return EAP_STATUS_RETURN(m_am_tools, completion_status); |
|
870 } |
|
871 |
|
872 // ---------------------------------------------------------- |
|
873 |
|
874 eap_status_e CEapGeneric::complete_copy_configuration( |
|
875 const eap_status_e completion_status) |
|
876 { |
|
877 EAP_TRACE_DEBUG( |
|
878 m_am_tools, |
|
879 TRACE_FLAGS_DEFAULT, |
|
880 (EAPL("CEapGeneric::complete_copy_configuration(): this=0x%08x, iWaitState=%d, status=%d=%s\n"), |
|
881 this, |
|
882 iWaitState, |
|
883 completion_status, |
|
884 eap_status_string_c::get_status_string(completion_status))); |
|
885 |
|
886 EAP_TRACE_RETURN_STRING(m_am_tools, "returns: CEapGeneric::complete_copy_configuration()"); |
|
887 |
|
888 iCompletionStatus = completion_status; |
|
889 |
|
890 if (iWaitState != eap_generic_wait_state_complete_copy_configuration |
|
891 && iCompletionStatus == eap_status_ok) |
|
892 { |
|
893 // ERROR wrong state. |
|
894 SetCompletionStatusIfStillOk(EAP_STATUS_RETURN(m_am_tools, eap_status_wrong_eap_type_state)); |
|
895 } |
|
896 |
|
897 Complete(); |
|
898 |
|
899 return EAP_STATUS_RETURN(m_am_tools, completion_status); |
|
900 } |
|
901 |
|
902 // ---------------------------------------------------------- |
|
903 |
|
904 eap_status_e CEapGeneric::complete_set_index( |
|
905 const eap_status_e completion_status) |
|
906 { |
|
907 EAP_TRACE_DEBUG( |
|
908 m_am_tools, |
|
909 TRACE_FLAGS_DEFAULT, |
|
910 (EAPL("CEapGeneric::complete_set_index(): this=0x%08x, iWaitState=%d, status=%d=%s\n"), |
|
911 this, |
|
912 iWaitState, |
|
913 completion_status, |
|
914 eap_status_string_c::get_status_string(completion_status))); |
|
915 |
|
916 EAP_TRACE_RETURN_STRING(m_am_tools, "returns: CEapGeneric::complete_set_index()"); |
|
917 |
|
918 iCompletionStatus = completion_status; |
|
919 |
|
920 if (iWaitState != eap_generic_wait_state_complete_set_index |
|
921 && iCompletionStatus == eap_status_ok) |
|
922 { |
|
923 // ERROR wrong state. |
|
924 SetCompletionStatusIfStillOk(EAP_STATUS_RETURN(m_am_tools, eap_status_wrong_eap_type_state)); |
|
925 } |
|
926 |
|
927 Complete(); |
|
928 |
|
929 return EAP_STATUS_RETURN(m_am_tools, completion_status); |
|
930 } |
|
931 |
|
932 // ---------------------------------------------------------- |
|
933 |
|
934 eap_status_e CEapGeneric::complete_get_type_info( |
|
935 const eap_method_settings_c * const internal_settings) |
|
936 { |
|
937 EAP_TRACE_DEBUG( |
|
938 m_am_tools, |
|
939 TRACE_FLAGS_DEFAULT, |
|
940 (EAPL("CEapGeneric::complete_get_type_info(): this=0x%08x, iWaitState=%d, status=%d=%s\n"), |
|
941 this, |
|
942 iWaitState, |
|
943 internal_settings->m_completion_status, |
|
944 eap_status_string_c::get_status_string(internal_settings->m_completion_status))); |
|
945 |
|
946 EAP_TRACE_RETURN_STRING(m_am_tools, "returns: CEapGeneric::complete_get_type_info()"); |
|
947 |
|
948 if (internal_settings == 0) |
|
949 { |
|
950 iCompletionStatus = eap_status_illegal_parameter; |
|
951 |
|
952 Complete(); |
|
953 |
|
954 return EAP_STATUS_RETURN(m_am_tools, iCompletionStatus); |
|
955 } |
|
956 |
|
957 iCompletionStatus = internal_settings->m_completion_status; |
|
958 |
|
959 if (iWaitState == eap_generic_wait_state_complete_get_type_info |
|
960 && iCompletionStatus == eap_status_ok) |
|
961 { |
|
962 if (internal_settings != 0 |
|
963 && internal_settings->m_MethodInfoPresent == true) |
|
964 { |
|
965 TInt error(KErrNone); |
|
966 |
|
967 error = CEapConversion::ConvertFromInternalToBuf16( |
|
968 m_am_tools, |
|
969 &(internal_settings->m_KReleaseDate), |
|
970 &iReleaseDate); |
|
971 |
|
972 if(error == KErrNone) |
|
973 { |
|
974 error = CEapConversion::ConvertFromInternalToBuf16( |
|
975 m_am_tools, |
|
976 &(internal_settings->m_KEapTypeVersion), |
|
977 &iEapTypeVersion); |
|
978 } |
|
979 |
|
980 if(error == KErrNone) |
|
981 { |
|
982 error = CEapConversion::ConvertFromInternalToBuf16( |
|
983 m_am_tools, |
|
984 &(internal_settings->m_KManufacturer), |
|
985 &iManufacturer); |
|
986 } |
|
987 |
|
988 if(error != KErrNone) |
|
989 { |
|
990 SetCompletionStatusIfStillOk(EAP_STATUS_RETURN(m_am_tools, m_am_tools->convert_am_error_to_eapol_error(error))); |
|
991 } |
|
992 } |
|
993 else |
|
994 { |
|
995 SetCompletionStatusIfStillOk(EAP_STATUS_RETURN(m_am_tools, eap_status_illegal_parameter)); |
|
996 } |
|
997 } |
|
998 else if (iCompletionStatus == eap_status_ok) |
|
999 { |
|
1000 // ERROR wrong state. |
|
1001 SetCompletionStatusIfStillOk(EAP_STATUS_RETURN(m_am_tools, eap_status_wrong_eap_type_state)); |
|
1002 } |
|
1003 |
|
1004 Complete(); |
|
1005 |
|
1006 return EAP_STATUS_RETURN(m_am_tools, iCompletionStatus); |
|
1007 } |
|
1008 |
|
1009 // ---------------------------------------------------------- |
|
1010 |
|
1011 eap_status_e CEapGeneric::complete_invoke_ui( |
|
1012 const eap_method_settings_c * const internal_settings) |
|
1013 { |
|
1014 EAP_TRACE_DEBUG( |
|
1015 m_am_tools, |
|
1016 TRACE_FLAGS_DEFAULT, |
|
1017 (EAPL("CEapGeneric::complete_invoke_ui(): this=0x%08x, iWaitState=%d, status=%d=%s\n"), |
|
1018 this, |
|
1019 iWaitState, |
|
1020 internal_settings->m_completion_status, |
|
1021 eap_status_string_c::get_status_string(internal_settings->m_completion_status))); |
|
1022 |
|
1023 EAP_TRACE_RETURN_STRING(m_am_tools, "returns: CEapGeneric::complete_invoke_ui()"); |
|
1024 |
|
1025 if (internal_settings == 0) |
|
1026 { |
|
1027 iCompletionStatus = eap_status_illegal_parameter; |
|
1028 |
|
1029 Complete(); |
|
1030 |
|
1031 return EAP_STATUS_RETURN(m_am_tools, iCompletionStatus); |
|
1032 } |
|
1033 |
|
1034 iCompletionStatus = internal_settings->m_completion_status; |
|
1035 |
|
1036 if (iWaitState == eap_generic_wait_state_complete_invoke_ui |
|
1037 && iCompletionStatus == eap_status_ok) |
|
1038 { |
|
1039 if (internal_settings != 0 |
|
1040 && internal_settings->m_ButtonIdPresent == true) |
|
1041 { |
|
1042 |
|
1043 } |
|
1044 else |
|
1045 { |
|
1046 SetCompletionStatusIfStillOk(EAP_STATUS_RETURN(m_am_tools, eap_status_illegal_parameter)); |
|
1047 } |
|
1048 } |
|
1049 else if (iCompletionStatus == eap_status_ok) |
|
1050 { |
|
1051 // ERROR wrong state. |
|
1052 SetCompletionStatusIfStillOk(EAP_STATUS_RETURN(m_am_tools, eap_status_wrong_eap_type_state)); |
|
1053 } |
|
1054 |
|
1055 Complete(); |
|
1056 |
|
1057 return EAP_STATUS_RETURN(m_am_tools, iCompletionStatus); |
|
1058 } |
|
1059 |
|
1060 |
|
1061 //-------------------------------------------------- |
|
1062 //-------------------------------------------------- |
|
1063 //-------------------------------------------------- |
|
1064 |
|
1065 eap_am_message_if_c * eap_am_message_if_c::new_eap_am_message_if_c( |
|
1066 abs_eap_am_tools_c * const tools) |
|
1067 { |
|
1068 EAP_TRACE_DEBUG( |
|
1069 tools, |
|
1070 TRACE_FLAGS_DEFAULT, |
|
1071 (EAPL("eap_am_message_if_c::new_eap_am_server_general_settings_c()\n"))); |
|
1072 |
|
1073 EAP_TRACE_RETURN_STRING(tools, "returns: eap_am_message_if_c::new_eap_am_message_if_c()"); |
|
1074 |
|
1075 eap_am_message_if_c *client_if = new eap_am_message_if_symbian_c(tools, EEapPluginNew); |
|
1076 |
|
1077 eap_automatic_variable_c<eap_am_message_if_c> automatic_client_if( |
|
1078 tools, |
|
1079 client_if); |
|
1080 |
|
1081 if (client_if == 0 |
|
1082 || client_if->get_is_valid() == false) |
|
1083 { |
|
1084 // ERROR. |
|
1085 if (client_if != 0) |
|
1086 { |
|
1087 EAP_TRACE_DEBUG( |
|
1088 tools, |
|
1089 TRACE_FLAGS_ALWAYS|TRACE_FLAGS_DEFAULT, |
|
1090 (EAPL("ERROR: calls: eap_am_message_if_c::new_eap_am_server_general_settings_c(): client_if->shutdown()\n"))); |
|
1091 |
|
1092 client_if->shutdown(); |
|
1093 } |
|
1094 return 0; |
|
1095 } |
|
1096 |
|
1097 automatic_client_if.do_not_free_variable(); |
|
1098 |
|
1099 return client_if; |
|
1100 |
|
1101 } |
|
1102 |
|
1103 //-------------------------------------------------- |
|
1104 |
|
1105 EAP_FUNC_EXPORT eap_plugin_message_base_c * eap_plugin_message_base_c::new_eap_plugin_client_message_if_c( |
|
1106 abs_eap_am_tools_c * const tools, |
|
1107 abs_eap_plugin_message_c * const partner) |
|
1108 { |
|
1109 EAP_TRACE_DEBUG( |
|
1110 tools, |
|
1111 TRACE_FLAGS_DEFAULT, |
|
1112 (EAPL("eap_plugin_message_base_c::new_eap_plugin_client_message_if_c()\n"))); |
|
1113 |
|
1114 EAP_TRACE_RETURN_STRING(tools, "returns: eap_plugin_message_base_c::new_eap_plugin_client_message_if_c()"); |
|
1115 |
|
1116 eap_am_message_if_c *client_if = eap_am_message_if_c::new_eap_am_message_if_c( |
|
1117 tools); |
|
1118 |
|
1119 eap_automatic_variable_c<eap_am_message_if_c> automatic_client_if( |
|
1120 tools, |
|
1121 client_if); |
|
1122 |
|
1123 if (client_if == 0 |
|
1124 || client_if->get_is_valid() == false) |
|
1125 { |
|
1126 // ERROR. |
|
1127 if (client_if != 0) |
|
1128 { |
|
1129 EAP_TRACE_DEBUG( |
|
1130 tools, |
|
1131 TRACE_FLAGS_ALWAYS|TRACE_FLAGS_DEFAULT, |
|
1132 (EAPL("ERROR: calls: eap_plugin_message_base_c::new_eap_plugin_client_message_if_c(): client_if->shutdown()\n"))); |
|
1133 |
|
1134 (void) client_if->shutdown(); |
|
1135 } |
|
1136 return 0; |
|
1137 } |
|
1138 |
|
1139 eap_plugin_client_message_if_c * new_session_core = new eap_plugin_client_message_if_c(tools, client_if, partner); |
|
1140 |
|
1141 eap_automatic_variable_c<eap_plugin_client_message_if_c> automatic_new_session_core( |
|
1142 tools, |
|
1143 new_session_core); |
|
1144 |
|
1145 if (new_session_core == 0 |
|
1146 || new_session_core->get_is_valid() == false) |
|
1147 { |
|
1148 // ERROR. |
|
1149 if (new_session_core != 0) |
|
1150 { |
|
1151 EAP_TRACE_DEBUG( |
|
1152 tools, |
|
1153 TRACE_FLAGS_ALWAYS|TRACE_FLAGS_DEFAULT, |
|
1154 (EAPL("ERROR: calls: eap_plugin_message_base_c::new_eap_plugin_client_message_if_c(): new_session_core->shutdown()\n"))); |
|
1155 |
|
1156 new_session_core->shutdown(); |
|
1157 } |
|
1158 return 0; |
|
1159 } |
|
1160 |
|
1161 client_if->set_partner(new_session_core); |
|
1162 |
|
1163 automatic_client_if.do_not_free_variable(); |
|
1164 automatic_new_session_core.do_not_free_variable(); |
|
1165 |
|
1166 return new_session_core; |
|
1167 } |
|
1168 |
|
1169 // ---------------------------------------------------------- |
|
1170 // End of file |