26
|
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: This is implementation of CEapGeneralSettings interface.
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
|
|
18 |
/*
|
49
|
19 |
* %version: 52 %
|
26
|
20 |
*/
|
|
21 |
|
|
22 |
// This is enumeration of EAPOL source code.
|
|
23 |
#if defined(USE_EAP_MINIMUM_RELEASE_TRACES)
|
|
24 |
#undef EAP_FILE_NUMBER_ENUM
|
34
|
25 |
#define EAP_FILE_NUMBER_ENUM 740
|
26
|
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 "EapGeneralSettingsImpl.h"
|
|
34 |
#include "EapConversion.h"
|
|
35 |
#include "eap_am_assert.h"
|
|
36 |
#include <EapTypeInfo.h>
|
|
37 |
#include "abs_eap_am_tools.h"
|
|
38 |
#include "eap_automatic_variable.h"
|
|
39 |
#include <utf.h> // for CnvUtfConverter
|
|
40 |
#include "abs_eap_am_message_if.h"
|
|
41 |
#include "eap_am_message_if.h"
|
|
42 |
#include "eap_automatic_variable.h"
|
|
43 |
#include "eap_general_settings_message.h"
|
|
44 |
#include "eap_am_message_if_symbian.h"
|
|
45 |
#include "eap_process_tlv_message_data.h"
|
|
46 |
#include "eap_general_settings_client_message_if.h"
|
|
47 |
|
|
48 |
// LOCAL CONSTANTS
|
|
49 |
|
|
50 |
// The version number of this interface.
|
|
51 |
const TUint KInterfaceVersion = 1;
|
|
52 |
|
|
53 |
|
|
54 |
// ================= MEMBER FUNCTIONS =======================
|
|
55 |
|
|
56 |
CEapGeneralSettingsImpl::CEapGeneralSettingsImpl(
|
|
57 |
const TIndexType aIndexType,
|
|
58 |
const TInt aIndex)
|
|
59 |
: m_am_tools(abs_eap_am_tools_c::new_abs_eap_am_tools_c())
|
|
60 |
, m_server(new_eap_general_settings_client_message_if_c(
|
|
61 |
m_am_tools,
|
|
62 |
this))
|
|
63 |
, iIndexType(aIndexType)
|
|
64 |
, iIndex(aIndex)
|
|
65 |
, iActiveEapMethods(0)
|
|
66 |
, iDisabledEapMethods(0)
|
|
67 |
, iUserCerts(0)
|
|
68 |
, iCACerts(0)
|
|
69 |
, iWaitState(eap_general_settings_wait_state_none)
|
|
70 |
, iCompletionStatus(eap_status_process_general_error)
|
|
71 |
{
|
|
72 |
EAP_TRACE_DEBUG(
|
|
73 |
m_am_tools,
|
|
74 |
TRACE_FLAGS_DEFAULT,
|
|
75 |
(EAPL("CEapGeneralSettingsImpl::CEapGeneralSettingsImpl(): this=0x%08x.\n"),
|
|
76 |
this));
|
|
77 |
|
|
78 |
EAP_TRACE_RETURN_STRING(m_am_tools, "returns: CEapGeneralSettingsImpl::CEapGeneralSettingsImpl()");
|
|
79 |
|
|
80 |
}
|
|
81 |
|
|
82 |
// ----------------------------------------------------------
|
|
83 |
|
|
84 |
void CEapGeneralSettingsImpl::ConstructL()
|
|
85 |
{
|
|
86 |
EAP_TRACE_DEBUG(
|
|
87 |
m_am_tools,
|
|
88 |
TRACE_FLAGS_DEFAULT,
|
|
89 |
(EAPL("CEapGeneralSettingsImpl::ConstructL(): this=0x%08x.\n"),
|
|
90 |
this));
|
|
91 |
|
|
92 |
EAP_TRACE_RETURN_STRING(m_am_tools, "returns: CEapGeneralSettingsImpl::ConstructL()");
|
|
93 |
|
|
94 |
if (m_am_tools == 0
|
|
95 |
|| m_am_tools->get_is_valid() == false
|
|
96 |
|| m_server == 0
|
|
97 |
|| m_server->get_is_valid() == false)
|
|
98 |
{
|
|
99 |
abs_eap_am_tools_c::delete_abs_eap_am_tools_c(m_am_tools);
|
|
100 |
delete m_server;
|
|
101 |
|
|
102 |
User::Leave(KErrNoMemory);
|
|
103 |
}
|
|
104 |
|
|
105 |
eap_status_e status = m_server->configure();
|
|
106 |
if (status != eap_status_ok)
|
|
107 |
{
|
|
108 |
TInt aStatus = m_am_tools->convert_eapol_error_to_am_error(status);
|
|
109 |
|
|
110 |
abs_eap_am_tools_c::delete_abs_eap_am_tools_c(m_am_tools);
|
|
111 |
delete m_server;
|
|
112 |
|
|
113 |
User::Leave(aStatus);
|
|
114 |
}
|
|
115 |
}
|
|
116 |
|
|
117 |
// ----------------------------------------------------------
|
|
118 |
|
|
119 |
CEapGeneralSettingsImpl* CEapGeneralSettingsImpl::NewL(SIapInfo* aIapInfo)
|
|
120 |
{
|
|
121 |
CEapGeneralSettingsImpl* self = new(ELeave) CEapGeneralSettingsImpl(aIapInfo->indexType, aIapInfo->index);
|
|
122 |
|
|
123 |
CleanupStack::PushL(self);
|
|
124 |
|
|
125 |
self->ConstructL();
|
|
126 |
|
|
127 |
CleanupStack::Pop();
|
|
128 |
|
|
129 |
return self;
|
|
130 |
}
|
|
131 |
|
|
132 |
// ----------------------------------------------------------
|
|
133 |
|
|
134 |
CEapGeneralSettingsImpl::~CEapGeneralSettingsImpl()
|
|
135 |
{
|
|
136 |
EAP_TRACE_DEBUG(
|
|
137 |
m_am_tools,
|
|
138 |
TRACE_FLAGS_DEFAULT,
|
|
139 |
(EAPL("CEapGeneralSettingsImpl::~CEapGeneralSettingsImpl(): this=0x%08x.\n"),
|
|
140 |
this));
|
|
141 |
|
|
142 |
if (m_server != 0)
|
|
143 |
{
|
|
144 |
m_server->shutdown();
|
|
145 |
}
|
|
146 |
delete m_server;
|
|
147 |
|
|
148 |
abs_eap_am_tools_c::delete_abs_eap_am_tools_c(m_am_tools);
|
|
149 |
}
|
|
150 |
|
|
151 |
// ----------------------------------------------------------
|
|
152 |
|
|
153 |
TUint CEapGeneralSettingsImpl::GetInterfaceVersion()
|
|
154 |
{
|
|
155 |
EAP_TRACE_DEBUG(
|
|
156 |
m_am_tools,
|
|
157 |
TRACE_FLAGS_DEFAULT,
|
|
158 |
(EAPL("CEapGeneralSettingsImpl::GetInterfaceVersion(): this=0x%08x\n"),
|
|
159 |
this));
|
|
160 |
|
|
161 |
EAP_TRACE_RETURN_STRING(m_am_tools, "returns: CEapGeneralSettingsImpl::GetInterfaceVersion()");
|
|
162 |
|
|
163 |
return KInterfaceVersion;
|
|
164 |
}
|
|
165 |
|
|
166 |
//----------------------------------------------------------------
|
|
167 |
|
|
168 |
void CEapGeneralSettingsImpl::Activate()
|
|
169 |
{
|
|
170 |
EAP_TRACE_DEBUG(
|
|
171 |
m_am_tools,
|
|
172 |
TRACE_FLAGS_DEFAULT,
|
|
173 |
(EAPL("CEapGeneralSettingsImpl::Activate(): iAsyncronousStatus=%u\n"),
|
|
174 |
iAsyncronousStatus.Int()));
|
|
175 |
|
|
176 |
EAP_TRACE_RETURN_STRING(m_am_tools, "returns: CEapGeneralSettingsImpl::Activate()");
|
|
177 |
|
|
178 |
iAsyncronousStatus = KRequestPending;
|
|
179 |
|
|
180 |
}
|
|
181 |
|
|
182 |
//----------------------------------------------------------------
|
|
183 |
|
|
184 |
void CEapGeneralSettingsImpl::Complete()
|
|
185 |
{
|
|
186 |
EAP_TRACE_DEBUG(
|
|
187 |
m_am_tools,
|
|
188 |
TRACE_FLAGS_DEFAULT,
|
|
189 |
(EAPL("CEapGeneralSettingsImpl::Complete(): iAsyncronousStatus=%u\n"),
|
|
190 |
iAsyncronousStatus.Int()));
|
|
191 |
|
|
192 |
EAP_TRACE_RETURN_STRING(m_am_tools, "returns: CEapGeneralSettingsImpl::Complete()");
|
|
193 |
|
|
194 |
iAsyncronousStatus = KErrNone;
|
|
195 |
|
|
196 |
// This is needed to continue the execution after Wait.Start();
|
|
197 |
iWait.AsyncStop();
|
|
198 |
}
|
|
199 |
|
|
200 |
//----------------------------------------------------------------
|
|
201 |
|
|
202 |
void CEapGeneralSettingsImpl::WaitCompletion()
|
|
203 |
{
|
|
204 |
EAP_TRACE_DEBUG(
|
|
205 |
m_am_tools,
|
|
206 |
TRACE_FLAGS_DEFAULT,
|
|
207 |
(EAPL("CEapGeneralSettingsImpl::WaitCompletion(): iAsyncronousStatus=%u\n"),
|
|
208 |
iAsyncronousStatus.Int()));
|
|
209 |
|
|
210 |
EAP_TRACE_RETURN_STRING(m_am_tools, "returns: CEapGeneralSettingsImpl::WaitCompletion()");
|
|
211 |
|
|
212 |
while (iAsyncronousStatus == KRequestPending)
|
|
213 |
{
|
|
214 |
EAP_TRACE_DEBUG(
|
|
215 |
m_am_tools,
|
|
216 |
TRACE_FLAGS_DEFAULT,
|
|
217 |
(EAPL("CEapGeneralSettingsImpl::WaitCompletion(): calls iWait.Start()\n")));
|
|
218 |
|
|
219 |
iWait.Start();
|
|
220 |
|
|
221 |
EAP_TRACE_DEBUG(
|
|
222 |
m_am_tools,
|
|
223 |
TRACE_FLAGS_DEFAULT,
|
|
224 |
(EAPL("CEapGeneralSettingsImpl::WaitCompletion(): iWait.Start() returns, iAsyncronousStatus=%u\n"),
|
|
225 |
iAsyncronousStatus.Int()));
|
|
226 |
}
|
|
227 |
}
|
|
228 |
|
|
229 |
// ----------------------------------------------------------
|
|
230 |
|
|
231 |
void CEapGeneralSettingsImpl::SetCompletionStatusIfStillOk(const eap_status_e status)
|
|
232 |
{
|
|
233 |
EAP_TRACE_DEBUG(
|
|
234 |
m_am_tools,
|
|
235 |
TRACE_FLAGS_DEFAULT,
|
|
236 |
(EAPL("CEapGeneralSettingsImpl::SetCompletionStatusIfStillOk(): iCompletionStatus=%d=%s, status=%d=%s\n"),
|
|
237 |
iCompletionStatus,
|
|
238 |
eap_status_string_c::get_status_string(iCompletionStatus),
|
|
239 |
status,
|
|
240 |
eap_status_string_c::get_status_string(status)));
|
|
241 |
|
|
242 |
EAP_TRACE_RETURN_STRING(m_am_tools, "returns: CEapGeneralSettingsImpl::SetCompletionStatusIfStillOk()");
|
|
243 |
|
|
244 |
if (iCompletionStatus == eap_status_ok)
|
|
245 |
{
|
|
246 |
iCompletionStatus = status;
|
|
247 |
}
|
|
248 |
}
|
|
249 |
|
|
250 |
// ----------------------------------------------------------
|
|
251 |
|
|
252 |
TInt CEapGeneralSettingsImpl::GetEapMethods(
|
|
253 |
RArray<TEapExpandedType> & ActiveEapMethods,
|
|
254 |
RArray<TEapExpandedType> & DisabledEapMethods)
|
|
255 |
{
|
|
256 |
EAP_TRACE_DEBUG(
|
|
257 |
m_am_tools,
|
|
258 |
TRACE_FLAGS_DEFAULT,
|
|
259 |
(EAPL("CEapGeneralSettingsImpl::GetEapMethods(): this=0x%08x.\n"),
|
|
260 |
this));
|
|
261 |
|
|
262 |
EAP_TRACE_RETURN_STRING(m_am_tools, "returns: CEapGeneralSettingsImpl::GetEapMethods()");
|
|
263 |
|
|
264 |
eap_method_settings_c * const internal_settings = new eap_method_settings_c(m_am_tools);
|
|
265 |
|
|
266 |
eap_automatic_variable_c<eap_method_settings_c> automatic_internal_settings(
|
|
267 |
m_am_tools,
|
|
268 |
internal_settings);
|
|
269 |
|
|
270 |
if (internal_settings == 0)
|
|
271 |
{
|
|
272 |
return m_am_tools->convert_eapol_error_to_am_error(
|
|
273 |
EAP_STATUS_RETURN(m_am_tools, eap_status_allocation_error));
|
|
274 |
}
|
|
275 |
|
|
276 |
internal_settings->m_IndexType = iIndexType;
|
|
277 |
internal_settings->m_Index = iIndex;
|
|
278 |
|
|
279 |
iActiveEapMethods = &ActiveEapMethods;
|
|
280 |
iDisabledEapMethods = &DisabledEapMethods;
|
|
281 |
|
|
282 |
eap_status_e status = m_server->get_eap_methods(internal_settings);
|
|
283 |
|
|
284 |
iWaitState = eap_general_settings_wait_state_complete_get_eap_methods;
|
|
285 |
Activate();
|
|
286 |
WaitCompletion();
|
|
287 |
|
|
288 |
if (iCompletionStatus != eap_status_ok)
|
|
289 |
{
|
|
290 |
return m_am_tools->convert_eapol_error_to_am_error(
|
|
291 |
EAP_STATUS_RETURN(m_am_tools, iCompletionStatus));
|
|
292 |
}
|
|
293 |
|
|
294 |
return m_am_tools->convert_eapol_error_to_am_error(
|
|
295 |
EAP_STATUS_RETURN(m_am_tools, status));
|
|
296 |
}
|
|
297 |
|
|
298 |
// ----------------------------------------------------------
|
|
299 |
|
|
300 |
TInt CEapGeneralSettingsImpl::SetEapMethods(
|
|
301 |
const RArray<TEapExpandedType> & ActiveEapMethods,
|
|
302 |
const RArray<TEapExpandedType> & DisabledEapMethods)
|
|
303 |
{
|
|
304 |
EAP_TRACE_DEBUG(
|
|
305 |
m_am_tools,
|
|
306 |
TRACE_FLAGS_DEFAULT,
|
|
307 |
(EAPL("CEapGeneralSettingsImpl::SetEapMethods(): this=0x%08x.\n"),
|
|
308 |
this));
|
|
309 |
|
|
310 |
EAP_TRACE_RETURN_STRING(m_am_tools, "returns: CEapGeneralSettingsImpl::SetEapMethods()");
|
|
311 |
|
|
312 |
eap_method_settings_c * const internal_settings = new eap_method_settings_c(m_am_tools);
|
|
313 |
|
|
314 |
eap_automatic_variable_c<eap_method_settings_c> automatic_internal_settings(
|
|
315 |
m_am_tools,
|
|
316 |
internal_settings);
|
|
317 |
|
|
318 |
if (internal_settings == 0)
|
|
319 |
{
|
|
320 |
return m_am_tools->convert_eapol_error_to_am_error(
|
|
321 |
EAP_STATUS_RETURN(m_am_tools, eap_status_allocation_error));
|
|
322 |
}
|
|
323 |
|
|
324 |
internal_settings->m_IndexType = iIndexType;
|
|
325 |
internal_settings->m_Index = iIndex;
|
|
326 |
|
|
327 |
|
|
328 |
TInt error = CEapConversion::ConvertExpandedEAPTypesToInternalTypes(
|
|
329 |
m_am_tools,
|
|
330 |
&ActiveEapMethods,
|
|
331 |
&(internal_settings->m_active_eap_methods));
|
|
332 |
if (error != KErrNone)
|
|
333 |
{
|
|
334 |
return error;
|
|
335 |
}
|
|
336 |
|
|
337 |
|
|
338 |
error = CEapConversion::ConvertExpandedEAPTypesToInternalTypes(
|
|
339 |
m_am_tools,
|
|
340 |
&DisabledEapMethods,
|
|
341 |
&(internal_settings->m_disabled_eap_methods));
|
|
342 |
if (error != KErrNone)
|
|
343 |
{
|
|
344 |
return error;
|
|
345 |
}
|
|
346 |
|
|
347 |
internal_settings->m_SelectedEAPTypesPresent = true;
|
|
348 |
|
|
349 |
eap_status_e status = m_server->set_eap_methods(internal_settings);
|
|
350 |
|
|
351 |
iWaitState = eap_general_settings_wait_state_complete_set_eap_methods;
|
|
352 |
Activate();
|
|
353 |
WaitCompletion();
|
|
354 |
|
|
355 |
if (iCompletionStatus != eap_status_ok)
|
|
356 |
{
|
|
357 |
return m_am_tools->convert_eapol_error_to_am_error(
|
|
358 |
EAP_STATUS_RETURN(m_am_tools, iCompletionStatus));
|
|
359 |
}
|
|
360 |
|
|
361 |
return m_am_tools->convert_eapol_error_to_am_error(
|
|
362 |
EAP_STATUS_RETURN(m_am_tools, status));
|
|
363 |
}
|
|
364 |
|
|
365 |
// ----------------------------------------------------------
|
|
366 |
|
|
367 |
eap_status_e CEapGeneralSettingsImpl::complete_get_eap_methods(
|
|
368 |
const eap_method_settings_c * const internal_settings)
|
|
369 |
{
|
|
370 |
EAP_TRACE_DEBUG(
|
|
371 |
m_am_tools,
|
|
372 |
TRACE_FLAGS_DEFAULT,
|
|
373 |
(EAPL("CEapGeneralSettingsImpl::complete_get_eap_methods(): this=0x%08x, iWaitState=%d, status=%d=%s\n"),
|
|
374 |
this,
|
|
375 |
iWaitState,
|
|
376 |
internal_settings->m_completion_status,
|
|
377 |
eap_status_string_c::get_status_string(internal_settings->m_completion_status)));
|
|
378 |
|
|
379 |
EAP_TRACE_RETURN_STRING(m_am_tools, "returns: CEapGeneralSettingsImpl::complete_get_eap_methods()");
|
|
380 |
|
|
381 |
if (internal_settings == 0)
|
|
382 |
{
|
|
383 |
iCompletionStatus = eap_status_illegal_parameter;
|
|
384 |
|
|
385 |
Complete();
|
|
386 |
|
|
387 |
return EAP_STATUS_RETURN(m_am_tools, iCompletionStatus);
|
|
388 |
}
|
|
389 |
|
|
390 |
iCompletionStatus = internal_settings->m_completion_status;
|
|
391 |
|
|
392 |
if (iWaitState == eap_general_settings_wait_state_complete_get_eap_methods
|
|
393 |
&& iCompletionStatus == eap_status_ok)
|
|
394 |
{
|
|
395 |
if (iActiveEapMethods != 0
|
|
396 |
&& iDisabledEapMethods != 0
|
|
397 |
&& internal_settings != 0)
|
|
398 |
{
|
|
399 |
TInt error(KErrNone);
|
|
400 |
|
|
401 |
error = CEapConversion::ConvertInternalTypesToExpandedEAPTypes(
|
|
402 |
m_am_tools,
|
|
403 |
&(internal_settings->m_active_eap_methods),
|
|
404 |
iActiveEapMethods);
|
|
405 |
if (error != KErrNone)
|
|
406 |
{
|
|
407 |
SetCompletionStatusIfStillOk(EAP_STATUS_RETURN(m_am_tools, m_am_tools->convert_am_error_to_eapol_error(error)));
|
|
408 |
}
|
|
409 |
else
|
|
410 |
{
|
|
411 |
error = CEapConversion::ConvertInternalTypesToExpandedEAPTypes(
|
|
412 |
m_am_tools,
|
|
413 |
&(internal_settings->m_disabled_eap_methods),
|
|
414 |
iDisabledEapMethods);
|
|
415 |
if (error != KErrNone)
|
|
416 |
{
|
|
417 |
SetCompletionStatusIfStillOk(EAP_STATUS_RETURN(m_am_tools, m_am_tools->convert_am_error_to_eapol_error(error)));
|
|
418 |
}
|
|
419 |
}
|
|
420 |
}
|
|
421 |
else
|
|
422 |
{
|
|
423 |
SetCompletionStatusIfStillOk(EAP_STATUS_RETURN(m_am_tools, eap_status_illegal_parameter));
|
|
424 |
}
|
|
425 |
}
|
|
426 |
else if (iCompletionStatus == eap_status_ok)
|
|
427 |
{
|
|
428 |
// ERROR, wrong state. Other function was completed successfully not the function that was waited.
|
|
429 |
SetCompletionStatusIfStillOk(EAP_STATUS_RETURN(m_am_tools, eap_status_wrong_eap_type_state));
|
|
430 |
}
|
|
431 |
|
|
432 |
Complete();
|
|
433 |
|
|
434 |
return EAP_STATUS_RETURN(m_am_tools, iCompletionStatus);
|
|
435 |
}
|
|
436 |
|
|
437 |
// ----------------------------------------------------------
|
|
438 |
|
|
439 |
eap_status_e CEapGeneralSettingsImpl::complete_set_eap_methods(
|
|
440 |
const eap_status_e completion_status)
|
|
441 |
{
|
|
442 |
EAP_TRACE_DEBUG(
|
|
443 |
m_am_tools,
|
|
444 |
TRACE_FLAGS_DEFAULT,
|
|
445 |
(EAPL("CEapGeneralSettingsImpl::complete_set_eap_methods(): this=0x%08x, iWaitState=%d, status=%d=%s\n"),
|
|
446 |
this,
|
|
447 |
iWaitState,
|
|
448 |
completion_status,
|
|
449 |
eap_status_string_c::get_status_string(completion_status)));
|
|
450 |
|
|
451 |
EAP_TRACE_RETURN_STRING(m_am_tools, "returns: CEapGeneralSettingsImpl::complete_set_eap_methods()");
|
|
452 |
|
|
453 |
iCompletionStatus = completion_status;
|
|
454 |
|
|
455 |
if (iWaitState != eap_general_settings_wait_state_complete_set_eap_methods
|
|
456 |
&& iCompletionStatus == eap_status_ok)
|
|
457 |
{
|
|
458 |
// ERROR, wrong state. Other function was completed successfully not the function that was waited.
|
|
459 |
SetCompletionStatusIfStillOk(EAP_STATUS_RETURN(m_am_tools, eap_status_wrong_eap_type_state));
|
|
460 |
}
|
|
461 |
|
|
462 |
Complete();
|
|
463 |
|
|
464 |
return EAP_STATUS_RETURN(m_am_tools, completion_status);
|
|
465 |
}
|
|
466 |
|
|
467 |
// ----------------------------------------------------------
|
|
468 |
|
|
469 |
TInt CEapGeneralSettingsImpl::GetCertificateLists(
|
|
470 |
RPointerArray<EapCertificateEntry> & aUserCerts,
|
|
471 |
RPointerArray<EapCertificateEntry> & aCACerts)
|
|
472 |
{
|
|
473 |
EAP_TRACE_DEBUG(
|
|
474 |
m_am_tools,
|
|
475 |
TRACE_FLAGS_DEFAULT,
|
|
476 |
(EAPL("CEapGeneralSettingsImpl::GetCertificateLists(): this=0x%08x.\n"),
|
|
477 |
this));
|
|
478 |
|
|
479 |
EAP_TRACE_RETURN_STRING(m_am_tools, "returns: CEapGeneralSettingsImpl::GetCertificateLists()");
|
|
480 |
|
|
481 |
eap_method_settings_c * const internal_settings = new eap_method_settings_c(m_am_tools);
|
|
482 |
|
|
483 |
eap_automatic_variable_c<eap_method_settings_c> automatic_internal_settings(
|
|
484 |
m_am_tools,
|
|
485 |
internal_settings);
|
|
486 |
|
|
487 |
if (internal_settings == 0)
|
|
488 |
{
|
|
489 |
return m_am_tools->convert_eapol_error_to_am_error(
|
|
490 |
EAP_STATUS_RETURN(m_am_tools, eap_status_allocation_error));
|
|
491 |
}
|
|
492 |
|
|
493 |
internal_settings->m_IndexType = iIndexType;
|
|
494 |
internal_settings->m_Index = iIndex;
|
|
495 |
|
|
496 |
iUserCerts = &aUserCerts;
|
|
497 |
iCACerts = &aCACerts;
|
|
498 |
|
|
499 |
eap_status_e status = m_server->get_certificate_lists(internal_settings);
|
|
500 |
|
|
501 |
iWaitState = eap_general_settings_wait_state_complete_get_certificate_lists;
|
|
502 |
Activate();
|
|
503 |
WaitCompletion();
|
|
504 |
|
|
505 |
if (iCompletionStatus != eap_status_ok)
|
|
506 |
{
|
|
507 |
return m_am_tools->convert_eapol_error_to_am_error(
|
|
508 |
EAP_STATUS_RETURN(m_am_tools, iCompletionStatus));
|
|
509 |
}
|
|
510 |
|
|
511 |
return m_am_tools->convert_eapol_error_to_am_error(
|
|
512 |
EAP_STATUS_RETURN(m_am_tools, status));
|
|
513 |
}
|
|
514 |
|
|
515 |
// ----------------------------------------------------------
|
|
516 |
|
|
517 |
eap_status_e CEapGeneralSettingsImpl::complete_get_certificate_lists(
|
|
518 |
const eap_method_settings_c * const internal_settings)
|
|
519 |
{
|
|
520 |
EAP_TRACE_DEBUG(
|
|
521 |
m_am_tools,
|
|
522 |
TRACE_FLAGS_DEFAULT,
|
|
523 |
(EAPL("CEapGeneralSettingsImpl::complete_get_certificate_lists(): this=0x%08x, iWaitState=%d, status=%d=%s\n"),
|
|
524 |
this,
|
|
525 |
iWaitState,
|
|
526 |
internal_settings->m_completion_status,
|
|
527 |
eap_status_string_c::get_status_string(internal_settings->m_completion_status)));
|
|
528 |
|
|
529 |
EAP_TRACE_RETURN_STRING(m_am_tools, "returns: CEapGeneralSettingsImpl::complete_get_certificate_lists()");
|
|
530 |
|
|
531 |
if (internal_settings == 0)
|
|
532 |
{
|
|
533 |
// ERROR
|
|
534 |
iCompletionStatus = eap_status_illegal_parameter;
|
|
535 |
|
|
536 |
Complete();
|
|
537 |
|
|
538 |
return EAP_STATUS_RETURN(m_am_tools, iCompletionStatus);
|
|
539 |
}
|
|
540 |
|
|
541 |
iCompletionStatus = internal_settings->m_completion_status;
|
|
542 |
|
|
543 |
if (iWaitState == eap_general_settings_wait_state_complete_get_certificate_lists
|
|
544 |
&& iCompletionStatus == eap_status_ok)
|
|
545 |
{
|
|
546 |
if (iUserCerts != 0
|
|
547 |
&& iCACerts != 0
|
|
548 |
&& internal_settings != 0)
|
|
549 |
{
|
|
550 |
TInt error = CEapConversion::ConvertInternalTypeToCertificates(
|
|
551 |
m_am_tools,
|
|
552 |
eap_certificate_entry_c::eap_certificate_type_user,
|
|
553 |
&(internal_settings->m_Certificates),
|
|
554 |
iUserCerts);
|
|
555 |
if (error != KErrNone)
|
|
556 |
{
|
|
557 |
// ERROR
|
|
558 |
SetCompletionStatusIfStillOk(EAP_STATUS_RETURN(m_am_tools, m_am_tools->convert_am_error_to_eapol_error(error)));
|
|
559 |
}
|
|
560 |
else
|
|
561 |
{
|
|
562 |
error = CEapConversion::ConvertInternalTypeToCertificates(
|
|
563 |
m_am_tools,
|
|
564 |
eap_certificate_entry_c::eap_certificate_type_CA,
|
|
565 |
&(internal_settings->m_Certificates),
|
|
566 |
iCACerts);
|
|
567 |
if (error != KErrNone)
|
|
568 |
{
|
|
569 |
// ERROR
|
|
570 |
SetCompletionStatusIfStillOk(EAP_STATUS_RETURN(m_am_tools, m_am_tools->convert_am_error_to_eapol_error(error)));
|
|
571 |
}
|
|
572 |
}
|
|
573 |
}
|
|
574 |
else
|
|
575 |
{
|
|
576 |
// ERROR
|
|
577 |
SetCompletionStatusIfStillOk(EAP_STATUS_RETURN(m_am_tools, eap_status_illegal_parameter));
|
|
578 |
}
|
|
579 |
}
|
|
580 |
else if (iCompletionStatus == eap_status_ok)
|
|
581 |
{
|
|
582 |
// ERROR, wrong state. Other function was completed successfully not the function that was waited.
|
|
583 |
SetCompletionStatusIfStillOk(EAP_STATUS_RETURN(m_am_tools, eap_status_wrong_eap_type_state));
|
|
584 |
}
|
|
585 |
|
|
586 |
Complete();
|
|
587 |
|
|
588 |
return EAP_STATUS_RETURN(m_am_tools, iCompletionStatus);
|
|
589 |
}
|
|
590 |
|
|
591 |
// ----------------------------------------------------------
|
|
592 |
|
|
593 |
TInt CEapGeneralSettingsImpl::DeleteAllEapSettings()
|
|
594 |
{
|
|
595 |
EAP_TRACE_DEBUG(
|
|
596 |
m_am_tools,
|
|
597 |
TRACE_FLAGS_DEFAULT,
|
|
598 |
(EAPL("CEapGeneralSettingsImpl::DeleteAllEapSettings(): this=0x%08x.\n"),
|
|
599 |
this));
|
|
600 |
|
|
601 |
EAP_TRACE_RETURN_STRING(m_am_tools, "returns: CEapGeneralSettingsImpl::DeleteAllEapSettings()");
|
|
602 |
|
|
603 |
eap_method_settings_c * const internal_settings = new eap_method_settings_c(m_am_tools);
|
|
604 |
|
|
605 |
eap_automatic_variable_c<eap_method_settings_c> automatic_internal_settings(
|
|
606 |
m_am_tools,
|
|
607 |
internal_settings);
|
|
608 |
|
|
609 |
if (internal_settings == 0)
|
|
610 |
{
|
|
611 |
return m_am_tools->convert_eapol_error_to_am_error(
|
|
612 |
EAP_STATUS_RETURN(m_am_tools, eap_status_allocation_error));
|
|
613 |
}
|
|
614 |
|
|
615 |
internal_settings->m_IndexType = iIndexType;
|
|
616 |
internal_settings->m_Index = iIndex;
|
|
617 |
|
|
618 |
eap_status_e status = m_server->delete_all_eap_settings(internal_settings);
|
|
619 |
|
|
620 |
iWaitState = eap_general_settings_wait_state_complete_delete_all_eap_settings;
|
|
621 |
Activate();
|
|
622 |
WaitCompletion();
|
|
623 |
|
|
624 |
if (iCompletionStatus != eap_status_ok)
|
|
625 |
{
|
|
626 |
return m_am_tools->convert_eapol_error_to_am_error(
|
|
627 |
EAP_STATUS_RETURN(m_am_tools, iCompletionStatus));
|
|
628 |
}
|
|
629 |
|
|
630 |
return m_am_tools->convert_eapol_error_to_am_error(
|
|
631 |
EAP_STATUS_RETURN(m_am_tools, status));
|
|
632 |
}
|
|
633 |
|
|
634 |
// ----------------------------------------------------------
|
|
635 |
|
|
636 |
TInt CEapGeneralSettingsImpl::CopyAllEapSettings(
|
|
637 |
const TIndexType aDestinationIndexType,
|
|
638 |
const TInt aDestinationIndex)
|
|
639 |
{
|
|
640 |
EAP_TRACE_DEBUG(
|
|
641 |
m_am_tools,
|
|
642 |
TRACE_FLAGS_DEFAULT,
|
|
643 |
(EAPL("CEapGeneralSettingsImpl::CopyAllEapSettings(): this=0x%08x.\n"),
|
|
644 |
this));
|
|
645 |
|
|
646 |
EAP_TRACE_RETURN_STRING(m_am_tools, "returns: CEapGeneralSettingsImpl::CopyAllEapSettings()");
|
|
647 |
|
|
648 |
eap_method_settings_c * const internal_settings = new eap_method_settings_c(m_am_tools);
|
|
649 |
|
|
650 |
eap_automatic_variable_c<eap_method_settings_c> automatic_internal_settings(
|
|
651 |
m_am_tools,
|
|
652 |
internal_settings);
|
|
653 |
|
|
654 |
if (internal_settings == 0)
|
|
655 |
{
|
|
656 |
return m_am_tools->convert_eapol_error_to_am_error(
|
|
657 |
EAP_STATUS_RETURN(m_am_tools, eap_status_allocation_error));
|
|
658 |
}
|
|
659 |
|
|
660 |
internal_settings->m_IndexType = iIndexType;
|
|
661 |
internal_settings->m_Index = iIndex;
|
|
662 |
internal_settings->m_DestinationIndexType = aDestinationIndexType;
|
|
663 |
internal_settings->m_DestinationIndex = aDestinationIndex;
|
|
664 |
|
|
665 |
eap_status_e status = m_server->copy_all_eap_settings(internal_settings);
|
|
666 |
|
|
667 |
iWaitState = eap_general_settings_wait_state_complete_copy_all_eap_settings;
|
|
668 |
Activate();
|
|
669 |
WaitCompletion();
|
|
670 |
|
|
671 |
if (iCompletionStatus != eap_status_ok)
|
|
672 |
{
|
|
673 |
return m_am_tools->convert_eapol_error_to_am_error(
|
|
674 |
EAP_STATUS_RETURN(m_am_tools, iCompletionStatus));
|
|
675 |
}
|
|
676 |
|
|
677 |
return m_am_tools->convert_eapol_error_to_am_error(
|
|
678 |
EAP_STATUS_RETURN(m_am_tools, status));
|
|
679 |
}
|
|
680 |
|
|
681 |
// ----------------------------------------------------------
|
|
682 |
|
|
683 |
eap_status_e CEapGeneralSettingsImpl::complete_delete_all_eap_settings(
|
|
684 |
const eap_status_e completion_status)
|
|
685 |
{
|
|
686 |
EAP_TRACE_DEBUG(
|
|
687 |
m_am_tools,
|
|
688 |
TRACE_FLAGS_DEFAULT,
|
|
689 |
(EAPL("CEapGeneralSettingsImpl::complete_delete_all_eap_settings(): this=0x%08x, iWaitState=%d, status=%d=%s\n"),
|
|
690 |
this,
|
|
691 |
iWaitState,
|
|
692 |
completion_status,
|
|
693 |
eap_status_string_c::get_status_string(completion_status)));
|
|
694 |
|
|
695 |
EAP_TRACE_RETURN_STRING(m_am_tools, "returns: CEapGeneralSettingsImpl::complete_delete_all_eap_settings()");
|
|
696 |
|
|
697 |
iCompletionStatus = completion_status;
|
|
698 |
|
|
699 |
if (iWaitState != eap_general_settings_wait_state_complete_delete_all_eap_settings
|
|
700 |
&& iCompletionStatus == eap_status_ok)
|
|
701 |
{
|
|
702 |
// ERROR, wrong state. Other function was completed successfully not the function that was waited.
|
|
703 |
SetCompletionStatusIfStillOk(EAP_STATUS_RETURN(m_am_tools, eap_status_wrong_eap_type_state));
|
|
704 |
}
|
|
705 |
|
|
706 |
Complete();
|
|
707 |
|
|
708 |
return EAP_STATUS_RETURN(m_am_tools, completion_status);
|
|
709 |
}
|
|
710 |
|
|
711 |
// ----------------------------------------------------------
|
|
712 |
|
|
713 |
eap_status_e CEapGeneralSettingsImpl::complete_copy_all_eap_settings(
|
|
714 |
const eap_status_e completion_status)
|
|
715 |
{
|
|
716 |
EAP_TRACE_DEBUG(
|
|
717 |
m_am_tools,
|
|
718 |
TRACE_FLAGS_DEFAULT,
|
|
719 |
(EAPL("CEapGeneralSettingsImpl::complete_copy_all_eap_settings(): this=0x%08x, iWaitState=%d, status=%d=%s\n"),
|
|
720 |
this,
|
|
721 |
iWaitState,
|
|
722 |
completion_status,
|
|
723 |
eap_status_string_c::get_status_string(completion_status)));
|
|
724 |
|
|
725 |
EAP_TRACE_RETURN_STRING(m_am_tools, "returns: CEapGeneralSettingsImpl::complete_copy_all_eap_settings()");
|
|
726 |
|
|
727 |
iCompletionStatus = completion_status;
|
|
728 |
|
|
729 |
if (iWaitState != eap_general_settings_wait_state_complete_copy_all_eap_settings
|
|
730 |
&& iCompletionStatus == eap_status_ok)
|
|
731 |
{
|
|
732 |
// ERROR, wrong state. Other function was completed successfully not the function that was waited.
|
|
733 |
SetCompletionStatusIfStillOk(EAP_STATUS_RETURN(m_am_tools, eap_status_wrong_eap_type_state));
|
|
734 |
}
|
|
735 |
|
|
736 |
Complete();
|
|
737 |
|
|
738 |
return EAP_STATUS_RETURN(m_am_tools, completion_status);
|
|
739 |
}
|
|
740 |
|
|
741 |
// ----------------------------------------------------------
|
|
742 |
// ----------------------------------------------------------
|
|
743 |
// ----------------------------------------------------------
|
|
744 |
|
|
745 |
eap_am_message_if_c * eap_am_message_if_c::new_eap_am_message_if_c(
|
|
746 |
abs_eap_am_tools_c * const tools)
|
|
747 |
{
|
|
748 |
EAP_TRACE_DEBUG(
|
|
749 |
tools,
|
|
750 |
TRACE_FLAGS_DEFAULT,
|
|
751 |
(EAPL("eap_am_message_if_c::new_eap_am_server_general_settings_c()\n")));
|
|
752 |
|
|
753 |
EAP_TRACE_RETURN_STRING(tools, "returns: eap_am_message_if_c::new_eap_am_message_if_c()");
|
|
754 |
|
|
755 |
eap_am_message_if_c *client_if = new eap_am_message_if_symbian_c(tools, EEapSettingsNew);
|
|
756 |
|
|
757 |
eap_automatic_variable_c<eap_am_message_if_c> automatic_client_if(
|
|
758 |
tools,
|
|
759 |
client_if);
|
|
760 |
|
|
761 |
if (client_if == 0
|
|
762 |
|| client_if->get_is_valid() == false)
|
|
763 |
{
|
|
764 |
// ERROR.
|
|
765 |
if (client_if != 0)
|
|
766 |
{
|
|
767 |
EAP_TRACE_DEBUG(
|
|
768 |
tools,
|
|
769 |
TRACE_FLAGS_ALWAYS|TRACE_FLAGS_DEFAULT,
|
|
770 |
(EAPL("ERROR: calls: eap_am_message_if_c::new_eap_am_server_general_settings_c(): client_if->shutdown()\n")));
|
|
771 |
|
|
772 |
client_if->shutdown();
|
|
773 |
}
|
|
774 |
return 0;
|
|
775 |
}
|
|
776 |
|
|
777 |
automatic_client_if.do_not_free_variable();
|
|
778 |
|
|
779 |
return client_if;
|
|
780 |
|
|
781 |
}
|
|
782 |
|
|
783 |
// ----------------------------------------------------------
|
|
784 |
|
|
785 |
eap_general_settings_message_c * new_eap_general_settings_client_message_if_c(
|
|
786 |
abs_eap_am_tools_c * const tools,
|
|
787 |
abs_eap_general_settings_message_c * const partner)
|
|
788 |
{
|
|
789 |
EAP_TRACE_DEBUG(
|
|
790 |
tools,
|
|
791 |
TRACE_FLAGS_DEFAULT,
|
|
792 |
(EAPL("new_eap_general_settings_client_message_if_c()\n")));
|
|
793 |
|
|
794 |
EAP_TRACE_RETURN_STRING(tools, "returns: new_eap_general_settings_client_message_if_c()");
|
|
795 |
|
|
796 |
eap_am_message_if_c *client_if = eap_am_message_if_c::new_eap_am_message_if_c(
|
|
797 |
tools);
|
|
798 |
|
|
799 |
eap_automatic_variable_c<eap_am_message_if_c> automatic_client_if(
|
|
800 |
tools,
|
|
801 |
client_if);
|
|
802 |
|
|
803 |
if (client_if == 0
|
|
804 |
|| client_if->get_is_valid() == false)
|
|
805 |
{
|
|
806 |
// ERROR.
|
|
807 |
if (client_if != 0)
|
|
808 |
{
|
|
809 |
EAP_TRACE_DEBUG(
|
|
810 |
tools,
|
|
811 |
TRACE_FLAGS_ALWAYS|TRACE_FLAGS_DEFAULT,
|
|
812 |
(EAPL("ERROR: calls: new_eap_general_settings_client_message_if_c(): client_if->shutdown()\n")));
|
|
813 |
|
|
814 |
(void) client_if->shutdown();
|
|
815 |
}
|
|
816 |
return 0;
|
|
817 |
}
|
|
818 |
|
|
819 |
eap_general_settings_client_message_if_c * new_session_core = new eap_general_settings_client_message_if_c(tools, client_if, partner);
|
|
820 |
|
|
821 |
eap_automatic_variable_c<eap_general_settings_client_message_if_c> automatic_new_session_core(
|
|
822 |
tools,
|
|
823 |
new_session_core);
|
|
824 |
|
|
825 |
if (new_session_core == 0
|
|
826 |
|| new_session_core->get_is_valid() == false)
|
|
827 |
{
|
|
828 |
// ERROR.
|
|
829 |
if (new_session_core != 0)
|
|
830 |
{
|
|
831 |
EAP_TRACE_DEBUG(
|
|
832 |
tools,
|
|
833 |
TRACE_FLAGS_ALWAYS|TRACE_FLAGS_DEFAULT,
|
|
834 |
(EAPL("ERROR: calls: new_eap_general_settings_client_message_if_c(): new_session_core->shutdown()\n")));
|
|
835 |
|
|
836 |
new_session_core->shutdown();
|
|
837 |
}
|
|
838 |
return 0;
|
|
839 |
}
|
|
840 |
|
|
841 |
client_if->set_partner(new_session_core);
|
|
842 |
|
|
843 |
automatic_client_if.do_not_free_variable();
|
|
844 |
automatic_new_session_core.do_not_free_variable();
|
|
845 |
|
|
846 |
return new_session_core;
|
|
847 |
}
|
|
848 |
|
|
849 |
// ----------------------------------------------------------
|
|
850 |
// End of file
|