|
1 /* |
|
2 * Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of the License "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: EAP and WLAN authentication protocols. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 // This is enumeration of EAPOL source code. |
|
20 #if defined(USE_EAP_MINIMUM_RELEASE_TRACES) |
|
21 #undef EAP_FILE_NUMBER_ENUM |
|
22 #define EAP_FILE_NUMBER_ENUM 175 |
|
23 #undef EAP_FILE_NUMBER_DATE |
|
24 #define EAP_FILE_NUMBER_DATE 1127594498 |
|
25 #endif //#if defined(USE_EAP_MINIMUM_RELEASE_TRACES) |
|
26 |
|
27 // INCLUDE FILES |
|
28 |
|
29 #include "eap_am_type_protected_setup_symbian.h" |
|
30 |
|
31 #include "eap_am_tools.h" |
|
32 #include "eap_state_notification.h" |
|
33 #include "eap_config.h" |
|
34 #include <wdbifwlansettings.h> |
|
35 |
|
36 #include "eap_type_simple_config_types.h" |
|
37 #include "eap_tlv_message_data.h" |
|
38 #include "abs_simple_config_am_services.h" |
|
39 #include "simple_config_credential.h" |
|
40 #include "abs_eap_configuration_if.h" |
|
41 |
|
42 #include "eap_am_trace_symbian.h" |
|
43 #include <mmtsy_names.h> |
|
44 |
|
45 static const char EAP_AM_TYPE_SIMPLE_CONFIG_MEMORY_STORE_KEY[] = "eap_am_type_simple_config_simulator_c credential_store"; |
|
46 |
|
47 // ================= MEMBER FUNCTIONS ======================= |
|
48 |
|
49 |
|
50 // |
|
51 EAP_FUNC_EXPORT eap_am_type_protected_setup_symbian_c::eap_am_type_protected_setup_symbian_c( |
|
52 abs_eap_am_tools_c * const tools, |
|
53 abs_eap_base_type_c * const partner, |
|
54 const TIndexType aIndexType, |
|
55 const TInt aIndex, |
|
56 const eap_type_value_e aTunnelingType, |
|
57 const eap_type_value_e eap_type, |
|
58 const bool is_client_when_true, |
|
59 const eap_am_network_id_c * const receive_network_id, |
|
60 abs_eap_configuration_if_c * const configuration_if) |
|
61 : m_partner(partner) |
|
62 , m_index(aIndex) |
|
63 , m_am_tools(tools) |
|
64 , m_am_partner(0) |
|
65 , m_simple_config_am_partner(0) |
|
66 , m_configuration_if(configuration_if) |
|
67 , m_device_parameters_valid(false) |
|
68 , m_network_and_device_parameters(tools) |
|
69 , m_UUID_E(tools) |
|
70 , m_Device_Password_ID(simple_config_Device_Password_ID_Default_PIN) |
|
71 , m_receive_network_id(tools) |
|
72 , m_eap_identifier(0) |
|
73 , m_eap_type(eap_type) |
|
74 , m_simple_config_state(simple_config_state_none) |
|
75 , m_is_valid(false) |
|
76 , m_is_client(is_client_when_true) |
|
77 , m_shutdown_was_called(false) |
|
78 , m_manual_username(tools) |
|
79 , m_manual_realm(tools) |
|
80 , m_use_manual_username(false) |
|
81 , m_use_manual_realm(false) |
|
82 , m_configured(false) |
|
83 , m_prot_setup_if(0) |
|
84 { |
|
85 EAP_TRACE_BEGIN(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
86 |
|
87 EAP_TRACE_DEBUG(m_am_tools, TRACE_FLAGS_DEFAULT, (EAPL("\n"))); |
|
88 |
|
89 EAP_TRACE_DEBUG( |
|
90 m_am_tools, |
|
91 TRACE_FLAGS_DEFAULT, |
|
92 (EAPL("SIMPLE_CONFIG: %s: function: eap_am_type_protected_setup_symbian_c(): this = 0x%08x\n"), |
|
93 (m_is_client == true ? "client": "server"), |
|
94 this)); |
|
95 |
|
96 if (receive_network_id == 0 |
|
97 || receive_network_id->get_is_valid_data() == false) |
|
98 { |
|
99 // No need to delete anything here because it is done in destructor. |
|
100 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
101 return; |
|
102 } |
|
103 |
|
104 eap_status_e status = m_receive_network_id.set_copy_of_network_id( |
|
105 receive_network_id); |
|
106 if (status != eap_status_ok) |
|
107 { |
|
108 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
109 return; |
|
110 } |
|
111 |
|
112 set_is_valid(); |
|
113 |
|
114 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
115 } |
|
116 |
|
117 //-------------------------------------------------- |
|
118 |
|
119 void eap_am_type_protected_setup_symbian_c::ConstructL() |
|
120 { |
|
121 if (m_is_client == true) |
|
122 { |
|
123 m_prot_setup_if = CEapProtectedSetupInterface::NewL(m_am_tools, this); |
|
124 if(m_prot_setup_if == NULL) |
|
125 { |
|
126 EAP_TRACE_ERROR(m_am_tools, TRACE_FLAGS_DEFAULT, (EAPL("ERROR: EAP-WSC No interface to MMETEL\n"))); |
|
127 User::Leave(KErrNoMemory); |
|
128 } |
|
129 } |
|
130 else |
|
131 { |
|
132 EAP_TRACE_ERROR(m_am_tools, TRACE_FLAGS_DEFAULT, (EAPL("ERROR: EAP-WSC server does not work at the moment\n"))); |
|
133 User::Leave(KErrNotSupported); |
|
134 } |
|
135 } |
|
136 |
|
137 //-------------------------------------------------- |
|
138 |
|
139 eap_am_type_protected_setup_symbian_c* eap_am_type_protected_setup_symbian_c::NewL( |
|
140 abs_eap_am_tools_c * const tools, |
|
141 abs_eap_base_type_c * const partner, |
|
142 const TIndexType aIndexType, |
|
143 const TInt aIndex, |
|
144 const eap_type_value_e aTunnelingType, |
|
145 const eap_type_value_e eap_type, |
|
146 const bool is_client_when_true, |
|
147 const eap_am_network_id_c * const receive_network_id, |
|
148 abs_eap_configuration_if_c * const configuration_if) |
|
149 { |
|
150 eap_am_type_protected_setup_symbian_c* self = new (ELeave) eap_am_type_protected_setup_symbian_c( |
|
151 tools, |
|
152 partner, |
|
153 aIndexType, |
|
154 aIndex, |
|
155 aTunnelingType, |
|
156 eap_type, |
|
157 is_client_when_true, |
|
158 receive_network_id, |
|
159 configuration_if); |
|
160 |
|
161 CleanupStack::PushL(self); |
|
162 |
|
163 self->ConstructL(); |
|
164 |
|
165 if (self->get_is_valid() != true) |
|
166 { |
|
167 User::Leave(KErrGeneral); |
|
168 } |
|
169 |
|
170 CleanupStack::Pop(); |
|
171 return self; |
|
172 } |
|
173 |
|
174 //-------------------------------------------------- |
|
175 |
|
176 // |
|
177 EAP_FUNC_EXPORT eap_am_type_protected_setup_symbian_c::~eap_am_type_protected_setup_symbian_c() |
|
178 { |
|
179 EAP_TRACE_BEGIN(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
180 |
|
181 EAP_TRACE_DEBUG(m_am_tools, TRACE_FLAGS_DEFAULT, (EAPL("\n"))); |
|
182 EAP_TRACE_DEBUG( |
|
183 m_am_tools, |
|
184 TRACE_FLAGS_DEFAULT, |
|
185 (EAPL("SIMPLE_CONFIG: %s: function: ~eap_am_type_protected_setup_symbian_c(): this = 0x%08x\n"), |
|
186 (m_is_client == true ? "client": "server"), |
|
187 this)); |
|
188 |
|
189 EAP_ASSERT(m_shutdown_was_called == true); |
|
190 |
|
191 if (m_is_client == true) |
|
192 { |
|
193 delete m_prot_setup_if; |
|
194 } |
|
195 |
|
196 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
197 } |
|
198 |
|
199 //-------------------------------------------------- |
|
200 |
|
201 abs_simple_config_am_services_c * eap_am_type_protected_setup_symbian_c::get_simple_config_am_partner() |
|
202 { |
|
203 EAP_TRACE_BEGIN(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
204 EAP_ASSERT_ALWAYS(m_simple_config_am_partner != 0); |
|
205 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
206 return m_simple_config_am_partner; |
|
207 } |
|
208 |
|
209 //-------------------------------------------------- |
|
210 |
|
211 EAP_FUNC_EXPORT void eap_am_type_protected_setup_symbian_c::set_simple_config_am_partner(abs_simple_config_am_services_c * const simple_config_am_partner) |
|
212 { |
|
213 EAP_TRACE_BEGIN(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
214 m_simple_config_am_partner = simple_config_am_partner; |
|
215 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
216 } |
|
217 |
|
218 //-------------------------------------------------- |
|
219 |
|
220 EAP_FUNC_EXPORT void eap_am_type_protected_setup_symbian_c::set_am_partner(abs_eap_am_type_simple_config_c * const partner) |
|
221 { |
|
222 EAP_TRACE_BEGIN(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
223 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
224 m_am_partner = partner; |
|
225 } |
|
226 |
|
227 //-------------------------------------------------- |
|
228 |
|
229 EAP_FUNC_EXPORT eap_status_e eap_am_type_protected_setup_symbian_c::configure() |
|
230 { |
|
231 |
|
232 EAP_TRACE_DEBUG( |
|
233 m_am_tools, |
|
234 TRACE_FLAGS_DEFAULT, |
|
235 (EAPL("SIMPLE_CONFIG: %s: function: eap_am_type_protected_setup_symbian_c::configure()\n"), |
|
236 (m_is_client == true ? "client": "server"))); |
|
237 |
|
238 if (m_configured == true) |
|
239 { |
|
240 EAP_TRACE_DEBUG( |
|
241 m_am_tools, |
|
242 TRACE_FLAGS_DEFAULT, |
|
243 (EAPL("SIMPLE_CONFIG: %s: function: eap_am_type_protected_setup_symbian_c::configure(): Already configured.\n"), |
|
244 (m_is_client == true ? "client": "server"))); |
|
245 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
246 return EAP_STATUS_RETURN(m_am_tools, eap_status_ok); |
|
247 } |
|
248 |
|
249 //---------------------------------------------------------- |
|
250 |
|
251 { |
|
252 eap_variable_data_c use_manual_username(m_am_tools); |
|
253 |
|
254 eap_status_e status = m_partner->read_configure( |
|
255 cf_str_EAP_SIMPLE_CONFIG_use_manual_username.get_field(), |
|
256 &use_manual_username); |
|
257 if (status == eap_status_ok |
|
258 && use_manual_username.get_is_valid_data() == true) |
|
259 { |
|
260 u32_t *use_manual_username_flag = reinterpret_cast<u32_t *>( |
|
261 use_manual_username.get_data(sizeof(u32_t))); |
|
262 if (use_manual_username_flag != 0 |
|
263 && *use_manual_username_flag != 0) |
|
264 { |
|
265 m_use_manual_username = true; |
|
266 } |
|
267 } |
|
268 } |
|
269 |
|
270 //---------------------------------------------------------- |
|
271 |
|
272 if (m_use_manual_username == true) |
|
273 { |
|
274 eap_status_e status = m_partner->read_configure( |
|
275 cf_str_EAP_SIMPLE_CONFIG_manual_username.get_field(), |
|
276 &m_manual_username); |
|
277 if (status == eap_status_ok |
|
278 && m_manual_username.get_is_valid_data() == true) |
|
279 { |
|
280 // This is optional value. |
|
281 } |
|
282 else |
|
283 { |
|
284 // No username defined. |
|
285 m_use_manual_username = false; |
|
286 } |
|
287 } |
|
288 |
|
289 //---------------------------------------------------------- |
|
290 |
|
291 // create UUID using create_uuid_v5_from_mac_address, mac address from receive_nw_id. |
|
292 // Copy the UUID to m_UUID_E |
|
293 { |
|
294 eap_status_e status = m_am_tools->create_uuid_v5_from_mac_address( |
|
295 m_receive_network_id.get_destination(), |
|
296 m_receive_network_id.get_destination_length(), |
|
297 &m_UUID_E); |
|
298 if (status != eap_status_ok) |
|
299 { |
|
300 EAP_TRACE_DEBUG( |
|
301 m_am_tools, |
|
302 TRACE_FLAGS_DEFAULT, |
|
303 (EAPL("ERROR: EAP_type_SIMPLE_CONFIG: function: configure(): cannot get UUID-E from MAC address\n"))); |
|
304 } |
|
305 else |
|
306 { |
|
307 EAP_TRACE_DATA_DEBUG( |
|
308 m_am_tools, |
|
309 TRACE_FLAGS_DEFAULT, |
|
310 (EAPL("SIMPLE_CONFIG: UUID-E from MAC address"), |
|
311 m_UUID_E.get_data(), |
|
312 m_UUID_E.get_data_length())); |
|
313 } |
|
314 |
|
315 } |
|
316 |
|
317 m_configured = true; |
|
318 |
|
319 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
320 return EAP_STATUS_RETURN(m_am_tools, eap_status_ok); |
|
321 } |
|
322 |
|
323 |
|
324 //-------------------------------------------------- |
|
325 |
|
326 EAP_FUNC_EXPORT eap_status_e eap_am_type_protected_setup_symbian_c::reset() |
|
327 { |
|
328 EAP_TRACE_BEGIN(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
329 m_device_parameters_valid = false; |
|
330 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
331 return EAP_STATUS_RETURN(m_am_tools, eap_status_ok); |
|
332 } |
|
333 |
|
334 //-------------------------------------------------- |
|
335 |
|
336 EAP_FUNC_EXPORT eap_status_e eap_am_type_protected_setup_symbian_c::shutdown() |
|
337 { |
|
338 EAP_TRACE_BEGIN(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
339 |
|
340 EAP_TRACE_DEBUG( |
|
341 m_am_tools, |
|
342 TRACE_FLAGS_DEFAULT, |
|
343 (EAPL("SIMPLE_CONFIG: %s: function: eap_am_type_protected_setup_symbian_c::shutdown(): ") |
|
344 EAPL("this = 0x%08x\n"), |
|
345 (m_is_client == true ? "client": "server"), |
|
346 this)); |
|
347 |
|
348 if (m_shutdown_was_called == true) |
|
349 { |
|
350 // Shutdown function was called already. |
|
351 return EAP_STATUS_RETURN(m_am_tools, eap_status_ok); |
|
352 } |
|
353 |
|
354 m_shutdown_was_called = true; |
|
355 |
|
356 { |
|
357 eap_variable_data_c key(m_am_tools); |
|
358 |
|
359 eap_status_e status = key.set_copy_of_buffer( |
|
360 EAP_AM_TYPE_SIMPLE_CONFIG_MEMORY_STORE_KEY, |
|
361 sizeof(EAP_AM_TYPE_SIMPLE_CONFIG_MEMORY_STORE_KEY)); |
|
362 if (status != eap_status_ok) |
|
363 { |
|
364 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
365 return EAP_STATUS_RETURN(m_am_tools, status); |
|
366 } |
|
367 |
|
368 status = key.add_data(&m_is_client, sizeof(m_is_client)); |
|
369 if (status != eap_status_ok) |
|
370 { |
|
371 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
372 return EAP_STATUS_RETURN(m_am_tools, status); |
|
373 } |
|
374 |
|
375 status = key.add_data(&m_eap_type, sizeof(m_eap_type)); |
|
376 if (status != eap_status_ok) |
|
377 { |
|
378 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
379 return EAP_STATUS_RETURN(m_am_tools, status); |
|
380 } |
|
381 |
|
382 (void) m_am_tools->memory_store_remove_data(&key); |
|
383 |
|
384 EAP_TRACE_DEBUG( |
|
385 m_am_tools, |
|
386 TRACE_FLAGS_DEFAULT, |
|
387 (EAPL("EAP_type_SIMPLE_CONFIG: eap_am_type_protected_setup_symbian_c::shutdown():") |
|
388 EAPL("credentials removed from eapol\n"))); |
|
389 |
|
390 eap_tlv_message_data_c tlv_data(m_am_tools); |
|
391 |
|
392 |
|
393 status = m_am_tools->memory_store_add_data( |
|
394 &key, |
|
395 &tlv_data, |
|
396 eap_type_default_credential_timeout); |
|
397 if (status != eap_status_ok) |
|
398 { |
|
399 EAP_TRACE_DEBUG( |
|
400 m_am_tools, |
|
401 TRACE_FLAGS_DEFAULT, |
|
402 (EAPL("EAP_type_SIMPLE_CONFIG: function: shutdown(): cannot store credentials\n"))); |
|
403 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
404 return EAP_STATUS_RETURN(m_am_tools, status); |
|
405 } |
|
406 |
|
407 } |
|
408 |
|
409 reset(); |
|
410 |
|
411 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
412 return EAP_STATUS_RETURN(m_am_tools, eap_status_ok); |
|
413 } |
|
414 |
|
415 //-------------------------------------------------- |
|
416 |
|
417 void eap_am_type_protected_setup_symbian_c::send_error_notification(const eap_status_e error) |
|
418 { |
|
419 { |
|
420 eap_general_state_variable_e general_state_variable(eap_general_state_authentication_error); |
|
421 |
|
422 if (error == eap_status_user_cancel_authentication) |
|
423 { |
|
424 general_state_variable = eap_general_state_authentication_cancelled; |
|
425 } |
|
426 |
|
427 // Notifies the lower level of an authentication error. |
|
428 eap_state_notification_c notification( |
|
429 m_am_tools, |
|
430 &m_receive_network_id, |
|
431 m_is_client, |
|
432 eap_state_notification_eap, |
|
433 eap_protocol_layer_general, |
|
434 m_eap_type, |
|
435 eap_state_none, |
|
436 general_state_variable, |
|
437 0, |
|
438 false); |
|
439 |
|
440 notification.set_authentication_error(error); |
|
441 |
|
442 m_partner->state_notification(¬ification); |
|
443 } |
|
444 } |
|
445 |
|
446 //-------------------------------------------------- |
|
447 |
|
448 EAP_FUNC_EXPORT eap_status_e eap_am_type_protected_setup_symbian_c::authentication_finished( |
|
449 const bool true_when_successfull, |
|
450 const bool true_when_session_resumed) |
|
451 { |
|
452 EAP_UNREFERENCED_PARAMETER(true_when_successfull); // for release |
|
453 EAP_UNREFERENCED_PARAMETER(true_when_session_resumed); // for release |
|
454 |
|
455 EAP_TRACE_DEBUG( |
|
456 m_am_tools, |
|
457 TRACE_FLAGS_DEFAULT, |
|
458 (EAPL("\n"))); |
|
459 EAP_TRACE_DEBUG( |
|
460 m_am_tools, |
|
461 TRACE_FLAGS_DEFAULT, |
|
462 (EAPL("SIMPLE_CONFIG: %s: function: authentication_finished()\n"), |
|
463 (m_is_client == true ? "client": "server"))); |
|
464 |
|
465 return eap_status_ok; |
|
466 } |
|
467 |
|
468 //-------------------------------------------------- |
|
469 |
|
470 EAP_FUNC_EXPORT eap_status_e eap_am_type_protected_setup_symbian_c::query_eap_identity( |
|
471 const eap_am_network_id_c * const receive_network_id, |
|
472 const u8_t eap_identifier, |
|
473 bool * const use_manual_username, |
|
474 eap_variable_data_c * const manual_username, |
|
475 bool *const use_manual_realm, |
|
476 eap_variable_data_c * const manual_realm |
|
477 ) |
|
478 { |
|
479 EAP_TRACE_BEGIN(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
480 |
|
481 EAP_TRACE_DEBUG( |
|
482 m_am_tools, |
|
483 TRACE_FLAGS_DEFAULT, |
|
484 (EAPL("\n"))); |
|
485 EAP_TRACE_DEBUG( |
|
486 m_am_tools, |
|
487 TRACE_FLAGS_DEFAULT, |
|
488 (EAPL("SIMPLE_CONFIG: %s: function: query_eap_identity()\n"), |
|
489 (m_is_client == true ? "client": "server"))); |
|
490 |
|
491 eap_status_e status(eap_status_process_general_error); |
|
492 |
|
493 if (m_use_manual_username == true |
|
494 && m_manual_username.get_is_valid_data() == true) |
|
495 { |
|
496 status = manual_username->set_copy_of_buffer(&m_manual_username); |
|
497 } |
|
498 |
|
499 m_eap_identifier = eap_identifier; |
|
500 |
|
501 { |
|
502 EAP_TRACE_DEBUG( |
|
503 m_am_tools, |
|
504 TRACE_FLAGS_DEFAULT, |
|
505 (EAPL("SIMPLE_CONFIG: %s: direct_complete_function: complete_eap_identity_query()\n"), |
|
506 (m_is_client == true ? "client": "server"))); |
|
507 |
|
508 status = get_am_partner()->complete_eap_identity_query( |
|
509 &m_receive_network_id, |
|
510 m_eap_identifier, |
|
511 status, |
|
512 m_use_manual_username, |
|
513 &m_manual_username, |
|
514 m_use_manual_realm, |
|
515 &m_manual_realm); |
|
516 if (status != eap_status_ok) |
|
517 { |
|
518 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
519 return EAP_STATUS_RETURN(m_am_tools, status); |
|
520 } |
|
521 else //if (status == eap_status_ok) |
|
522 { |
|
523 status = eap_status_completed_request; |
|
524 } |
|
525 } |
|
526 |
|
527 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
528 return EAP_STATUS_RETURN(m_am_tools, status); |
|
529 } |
|
530 |
|
531 //-------------------------------------------------- |
|
532 |
|
533 // |
|
534 EAP_FUNC_EXPORT eap_status_e eap_am_type_protected_setup_symbian_c::cancel_identity_query() |
|
535 { |
|
536 EAP_TRACE_BEGIN(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
537 |
|
538 EAP_TRACE_DEBUG( |
|
539 m_am_tools, |
|
540 TRACE_FLAGS_DEFAULT, |
|
541 (EAPL("\n"))); |
|
542 EAP_TRACE_DEBUG( |
|
543 m_am_tools, |
|
544 TRACE_FLAGS_DEFAULT, |
|
545 (EAPL("SIMPLE_CONFIG: %s: function: cancel_identity_query()\n"), |
|
546 (m_is_client == true ? "client": "server"))); |
|
547 |
|
548 if (m_is_client == true) |
|
549 { |
|
550 m_prot_setup_if->Cancel(); |
|
551 } |
|
552 |
|
553 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
554 return EAP_STATUS_RETURN(m_am_tools, eap_status_ok); |
|
555 } |
|
556 |
|
557 //-------------------------------------------------- |
|
558 |
|
559 // |
|
560 EAP_FUNC_EXPORT void eap_am_type_protected_setup_symbian_c::set_is_valid() |
|
561 { |
|
562 m_is_valid = true; |
|
563 } |
|
564 |
|
565 //-------------------------------------------------- |
|
566 |
|
567 // |
|
568 EAP_FUNC_EXPORT bool eap_am_type_protected_setup_symbian_c::get_is_valid() |
|
569 { |
|
570 return m_is_valid; |
|
571 } |
|
572 |
|
573 //-------------------------------------------------- |
|
574 |
|
575 // |
|
576 EAP_FUNC_EXPORT eap_status_e eap_am_type_protected_setup_symbian_c::type_configure_read( |
|
577 const eap_configuration_field_c * const field, |
|
578 eap_variable_data_c * const data) |
|
579 { |
|
580 // Here configuration data must be read from type spesific database (CommsDat). |
|
581 |
|
582 EAP_TRACE_BEGIN(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
583 EAP_ASSERT(data != NULL); |
|
584 |
|
585 // Trap must be set here because the OS independent portion of EAP protected setup |
|
586 // that calls this function does not know anything about Symbian. |
|
587 |
|
588 eap_status_e status(eap_status_ok); |
|
589 |
|
590 eap_variable_data_c wanted_field(m_am_tools); |
|
591 eap_variable_data_c type_field(m_am_tools); |
|
592 |
|
593 status = wanted_field.set_buffer( |
|
594 field->get_field(), |
|
595 field->get_field_length(), |
|
596 false, |
|
597 false); |
|
598 if (status != eap_status_ok) |
|
599 { |
|
600 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
601 return EAP_STATUS_RETURN(m_am_tools, status); |
|
602 } |
|
603 |
|
604 status = type_field.set_buffer( |
|
605 cf_str_EAP_SIMPLE_CONFIG_device_password.get_field()->get_field(), |
|
606 cf_str_EAP_SIMPLE_CONFIG_device_password.get_field()->get_field_length(), |
|
607 false, |
|
608 false); |
|
609 if (status != eap_status_ok) |
|
610 { |
|
611 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
612 return EAP_STATUS_RETURN(m_am_tools, status); |
|
613 } |
|
614 |
|
615 if (!wanted_field.compare(&type_field)) |
|
616 { |
|
617 // We have to get the device password here. It is nothing but the PIN code in PIN based protected setup. |
|
618 |
|
619 TRAPD(err, read_device_passwordL( |
|
620 field->get_field(), |
|
621 field->get_field_length(), |
|
622 data)); |
|
623 if (err != KErrNone) |
|
624 { |
|
625 status = m_am_tools->convert_am_error_to_eapol_error(err); |
|
626 } |
|
627 |
|
628 m_am_tools->trace_configuration( |
|
629 status, |
|
630 field, |
|
631 data); |
|
632 |
|
633 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
634 return EAP_STATUS_RETURN(m_am_tools, status); |
|
635 |
|
636 } // if (!wanted_field.compare(&type_field)) |
|
637 |
|
638 |
|
639 // NOTE: This is for simulation. |
|
640 // Read is routed to partner object. |
|
641 status = m_partner->read_configure( |
|
642 field, |
|
643 data); |
|
644 |
|
645 m_am_tools->trace_configuration( |
|
646 status, |
|
647 field, |
|
648 data); |
|
649 |
|
650 return status; |
|
651 } |
|
652 |
|
653 //-------------------------------------------------- |
|
654 |
|
655 // |
|
656 void eap_am_type_protected_setup_symbian_c::read_device_passwordL( |
|
657 eap_config_string /*field*/, |
|
658 const u32_t /*field_length*/, |
|
659 eap_variable_data_c * const data) |
|
660 { |
|
661 EAP_TRACE_BEGIN(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
662 |
|
663 // Get the things from commsdat here. |
|
664 |
|
665 // We need PSK (PIN code for protected setup) from the CommsDat. |
|
666 // CommDbIf is used to get the PSK. |
|
667 |
|
668 CWLanSettings* wlan_settings = new(ELeave) CWLanSettings; |
|
669 CleanupStack::PushL(wlan_settings); |
|
670 SWLANSettings wlanSettings; |
|
671 TInt error(KErrNone); |
|
672 |
|
673 // Connect to CommsDat using CommDbIf |
|
674 error = wlan_settings->Connect(); |
|
675 if (error != KErrNone) |
|
676 { |
|
677 // Could not connect to CommsDat |
|
678 |
|
679 EAP_TRACE_DEBUG( |
|
680 m_am_tools, |
|
681 TRACE_FLAGS_DEFAULT, ( |
|
682 EAPL("ERROR: eap_am_type_protected_setup_symbian_c::read_device_passwordL() Connecting to CommsDat failed!\n"))); |
|
683 |
|
684 User::Leave(KErrCouldNotConnect); |
|
685 } |
|
686 |
|
687 EAP_TRACE_DEBUG( |
|
688 m_am_tools, |
|
689 TRACE_FLAGS_DEFAULT, ( |
|
690 EAPL("eap_am_type_protected_setup_symbian_c::read_device_passwordL() Connected to CommDbIf.\n"))); |
|
691 |
|
692 error = wlan_settings->GetWlanSettingsForService(m_index, wlanSettings); |
|
693 if ( error != KErrNone) |
|
694 { |
|
695 EAP_TRACE_DEBUG( |
|
696 m_am_tools, |
|
697 TRACE_FLAGS_DEFAULT, ( |
|
698 EAPL("ERROR: eap_am_type_protected_setup_symbian_c::read_device_passwordL() GetWlanSettingsForService failed, error=%d\n"), |
|
699 error)); |
|
700 |
|
701 wlan_settings->Disconnect(); |
|
702 |
|
703 User::Leave(error); |
|
704 } |
|
705 |
|
706 EAP_TRACE_DEBUG( |
|
707 m_am_tools, |
|
708 TRACE_FLAGS_DEFAULT, |
|
709 (EAPL("Protected Setup: Got WLAN settings: wlanSettings.EnableWpaPsk=%d\n"), |
|
710 wlanSettings.EnableWpaPsk)); |
|
711 |
|
712 EAP_TRACE_DATA_DEBUG( |
|
713 m_am_tools, |
|
714 TRACE_FLAGS_DEFAULT, |
|
715 (EAPL("WPA-PSK or PIN"), |
|
716 wlanSettings.WPAPreSharedKey.Ptr(), |
|
717 wlanSettings.WPAPreSharedKey.Size())); |
|
718 |
|
719 if(wlanSettings.WPAPreSharedKey.Size() != 0) |
|
720 { |
|
721 // Copy the PSK (PIN for us here) to the data |
|
722 eap_status_e status = data->set_copy_of_buffer( |
|
723 wlanSettings.WPAPreSharedKey.Ptr(), |
|
724 wlanSettings.WPAPreSharedKey.Size()); |
|
725 |
|
726 if (status != eap_status_ok) |
|
727 { |
|
728 wlan_settings->Disconnect(); |
|
729 |
|
730 User::Leave(KErrNoMemory); |
|
731 } |
|
732 } |
|
733 else |
|
734 { |
|
735 // NO PIN -> means this is for the PUSH-BUTTON. |
|
736 EAP_TRACE_DEBUG( |
|
737 m_am_tools, |
|
738 TRACE_FLAGS_DEFAULT, ( |
|
739 EAPL("WARNING: ############ NO PIN (WPA-PSK) FOR PROTECTED SETUP -> PUSH-BUTTON ############\n"))); |
|
740 |
|
741 m_Device_Password_ID = simple_config_Device_Password_ID_PushButton; |
|
742 |
|
743 // This ("00000000") is a temporary password. This is not used since we will try push-button. |
|
744 // Some value has to be set for this password so that that calling function doesn't return error. |
|
745 // If nothing is set for the password the calling function takes it as wrong password and |
|
746 // stops the authentication. |
|
747 TBuf8<16> asciiString(_L8("00000000")); |
|
748 eap_status_e status = data->set_copy_of_buffer(asciiString.Ptr(), asciiString.Size()); |
|
749 if (status != eap_status_ok) |
|
750 { |
|
751 wlan_settings->Disconnect(); |
|
752 |
|
753 User::Leave(KErrNoMemory); |
|
754 } |
|
755 |
|
756 EAP_TRACE_DEBUG( |
|
757 m_am_tools, |
|
758 TRACE_FLAGS_DEFAULT, ( |
|
759 EAPL("WARNING: ############ WE WILL TRY PUSH-BUTTON ############\n"))); |
|
760 } |
|
761 |
|
762 wlan_settings->Disconnect(); |
|
763 CleanupStack::PopAndDestroy(wlan_settings); |
|
764 |
|
765 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
766 } |
|
767 |
|
768 //-------------------------------------------------- |
|
769 |
|
770 // |
|
771 EAP_FUNC_EXPORT eap_status_e eap_am_type_protected_setup_symbian_c::type_configure_write( |
|
772 const eap_configuration_field_c * const field, |
|
773 eap_variable_data_c * const data) |
|
774 { |
|
775 // Here configuration data must be read from type spesific database. |
|
776 |
|
777 // NOTE: This is for simulation. |
|
778 // Write is routed to partner object. |
|
779 eap_status_e status = m_partner->write_configure( |
|
780 field, |
|
781 data); |
|
782 return status; |
|
783 } |
|
784 |
|
785 //-------------------------------------------------- |
|
786 |
|
787 abs_eap_am_type_simple_config_c * eap_am_type_protected_setup_symbian_c::get_am_partner() |
|
788 { |
|
789 EAP_TRACE_BEGIN(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
790 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
791 return m_am_partner; |
|
792 } |
|
793 |
|
794 //-------------------------------------------------- |
|
795 |
|
796 EAP_FUNC_EXPORT eap_status_e eap_am_type_protected_setup_symbian_c::query_network_and_device_parameters( |
|
797 const simple_config_state_e state) |
|
798 { |
|
799 EAP_TRACE_BEGIN(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
800 |
|
801 EAP_TRACE_DEBUG( |
|
802 m_am_tools, |
|
803 TRACE_FLAGS_DEFAULT, |
|
804 (EAPL("\n"))); |
|
805 EAP_TRACE_DEBUG( |
|
806 m_am_tools, |
|
807 TRACE_FLAGS_DEFAULT, |
|
808 (EAPL("SIMPLE_CONFIG: %s: eap_am_type_protected_setup_symbian_c::query_network_and_device_parameters()\n"), |
|
809 (m_is_client == true ? "client": "server"))); |
|
810 |
|
811 eap_status_e status = eap_status_process_general_error; |
|
812 |
|
813 m_simple_config_state = state; |
|
814 |
|
815 // check if we already have done the query |
|
816 if( m_device_parameters_valid == true ) |
|
817 { |
|
818 |
|
819 EAP_TRACE_DEBUG_SYMBIAN( |
|
820 (_L("eap_am_type_protected_setup_symbian_c::query_network_and_device_parameters: Parameters exist, completing query immediately."))); |
|
821 |
|
822 // pass the parameters |
|
823 status = get_simple_config_am_partner()->complete_query_network_and_device_parameters( |
|
824 m_simple_config_state, |
|
825 &m_network_and_device_parameters, |
|
826 eap_status_ok); |
|
827 |
|
828 if (status == eap_status_ok || |
|
829 status == eap_status_pending_request) |
|
830 { |
|
831 // we completed the request successfully |
|
832 status = eap_status_completed_request; |
|
833 } |
|
834 |
|
835 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
836 return EAP_STATUS_RETURN(m_am_tools, status); |
|
837 } |
|
838 |
|
839 // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
|
840 |
|
841 m_network_and_device_parameters.reset(); |
|
842 |
|
843 if (m_simple_config_state == simple_config_state_process_simple_config_start) |
|
844 { |
|
845 status = m_network_and_device_parameters.copy_attribute_data( |
|
846 simple_config_Attribute_Type_UUID_E, |
|
847 true, |
|
848 m_UUID_E.get_data(), |
|
849 m_UUID_E.get_data_length()); |
|
850 if (status != eap_status_ok) |
|
851 { |
|
852 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
853 return EAP_STATUS_RETURN(m_am_tools, status); |
|
854 } |
|
855 } |
|
856 |
|
857 // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
|
858 |
|
859 { |
|
860 u16_t Authentication_Type( |
|
861 simple_config_Authentication_Type_Open |
|
862 | simple_config_Authentication_Type_WPAPSK |
|
863 | simple_config_Authentication_Type_Shared |
|
864 | simple_config_Authentication_Type_WPA2PSK); |
|
865 |
|
866 u16_t network_order_Authentication_Type(eap_htons(Authentication_Type)); |
|
867 |
|
868 status = m_network_and_device_parameters.copy_attribute_data( |
|
869 simple_config_Attribute_Type_Authentication_Type_Flags, |
|
870 true, |
|
871 &network_order_Authentication_Type, |
|
872 sizeof(network_order_Authentication_Type)); |
|
873 if (status != eap_status_ok) |
|
874 { |
|
875 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
876 return EAP_STATUS_RETURN(m_am_tools, status); |
|
877 } |
|
878 } |
|
879 |
|
880 // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
|
881 |
|
882 { |
|
883 u16_t Encryption_Type( |
|
884 simple_config_Encryption_Type_None |
|
885 | simple_config_Encryption_Type_WEP |
|
886 | simple_config_Encryption_Type_TKIP |
|
887 | simple_config_Encryption_Type_AES); |
|
888 |
|
889 u16_t network_order_Encryption_Type(eap_htons(Encryption_Type)); |
|
890 |
|
891 status = m_network_and_device_parameters.copy_attribute_data( |
|
892 simple_config_Attribute_Type_Encryption_Type_Flags, |
|
893 true, |
|
894 &network_order_Encryption_Type, |
|
895 sizeof(network_order_Encryption_Type)); |
|
896 if (status != eap_status_ok) |
|
897 { |
|
898 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
899 return EAP_STATUS_RETURN(m_am_tools, status); |
|
900 } |
|
901 } |
|
902 |
|
903 // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
|
904 |
|
905 { |
|
906 // We support ESS only. |
|
907 simple_config_Connection_Type_e Connection_Type(simple_config_Connection_Type_ESS); |
|
908 |
|
909 u8_t network_order_Encryption_Type(static_cast<u8_t>(Connection_Type)); |
|
910 |
|
911 status = m_network_and_device_parameters.copy_attribute_data( |
|
912 simple_config_Attribute_Type_Connection_Type_Flags, |
|
913 true, |
|
914 &network_order_Encryption_Type, |
|
915 sizeof(network_order_Encryption_Type)); |
|
916 if (status != eap_status_ok) |
|
917 { |
|
918 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
919 return EAP_STATUS_RETURN(m_am_tools, status); |
|
920 } |
|
921 } |
|
922 |
|
923 // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
|
924 |
|
925 EAP_TRACE_DEBUG( |
|
926 m_am_tools, |
|
927 TRACE_FLAGS_DEFAULT, |
|
928 (EAPL("eap_am_type_protected_setup_symbian_c::query_network_and_device_parameters() m_Device_Password_ID=%d\n"), |
|
929 m_Device_Password_ID)); |
|
930 |
|
931 { |
|
932 // This may be changed in future if more methods need to be supported. |
|
933 simple_config_Config_Methods_e Config_Methods(simple_config_Config_Methods_Display); |
|
934 |
|
935 // At the moment only PIN and PUSH-BUTTON. Default method is PIN. |
|
936 if(m_Device_Password_ID == simple_config_Device_Password_ID_PushButton) |
|
937 { |
|
938 Config_Methods = simple_config_Config_Methods_PushButton; |
|
939 } |
|
940 |
|
941 u16_t network_order_Config_Methods(eap_htons(static_cast<u16_t>(Config_Methods))); |
|
942 |
|
943 status = m_network_and_device_parameters.copy_attribute_data( |
|
944 simple_config_Attribute_Type_Config_Methods, |
|
945 true, |
|
946 &network_order_Config_Methods, |
|
947 sizeof(network_order_Config_Methods)); |
|
948 if (status != eap_status_ok) |
|
949 { |
|
950 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
951 return EAP_STATUS_RETURN(m_am_tools, status); |
|
952 } |
|
953 } |
|
954 |
|
955 // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
|
956 |
|
957 { |
|
958 simple_config_State_e State(simple_config_State_Not_Configured); |
|
959 |
|
960 u8_t network_order_State(static_cast<u8_t>(State)); |
|
961 |
|
962 status = m_network_and_device_parameters.copy_attribute_data( |
|
963 simple_config_Attribute_Type_Simple_Config_State, |
|
964 true, |
|
965 &network_order_State, |
|
966 sizeof(network_order_State)); |
|
967 if (status != eap_status_ok) |
|
968 { |
|
969 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
970 return EAP_STATUS_RETURN(m_am_tools, status); |
|
971 } |
|
972 } |
|
973 |
|
974 // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
|
975 |
|
976 { |
|
977 // See WPS spec for this. |
|
978 u8_t Primary_Device_Type[] |
|
979 = { 0x00, 0x0a, |
|
980 0x00, 0x50, 0xf2, 0x04, |
|
981 0x00, 0x02 }; |
|
982 |
|
983 status = m_network_and_device_parameters.copy_attribute_data( |
|
984 simple_config_Attribute_Type_Primary_Device_Type, |
|
985 true, |
|
986 Primary_Device_Type, |
|
987 sizeof(Primary_Device_Type)); |
|
988 if (status != eap_status_ok) |
|
989 { |
|
990 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
991 return EAP_STATUS_RETURN(m_am_tools, status); |
|
992 } |
|
993 } |
|
994 |
|
995 // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
|
996 |
|
997 { |
|
998 // 2.4 GHz band support only. |
|
999 u8_t RF_Band(simple_config_RF_Bands_2_4_GHz); |
|
1000 |
|
1001 status = m_network_and_device_parameters.copy_attribute_data( |
|
1002 simple_config_Attribute_Type_RF_Band, |
|
1003 true, |
|
1004 &RF_Band, |
|
1005 sizeof(RF_Band)); |
|
1006 if (status != eap_status_ok) |
|
1007 { |
|
1008 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
1009 return EAP_STATUS_RETURN(m_am_tools, status); |
|
1010 } |
|
1011 } |
|
1012 |
|
1013 // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
|
1014 |
|
1015 { |
|
1016 simple_config_Association_State_e Association_State(simple_config_Association_State_Not_Associated); |
|
1017 |
|
1018 u16_t network_order_Association_State(eap_htons(static_cast<u16_t>(Association_State))); |
|
1019 |
|
1020 status = m_network_and_device_parameters.copy_attribute_data( |
|
1021 simple_config_Attribute_Type_Association_State, |
|
1022 true, |
|
1023 &network_order_Association_State, |
|
1024 sizeof(network_order_Association_State)); |
|
1025 if (status != eap_status_ok) |
|
1026 { |
|
1027 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
1028 return EAP_STATUS_RETURN(m_am_tools, status); |
|
1029 } |
|
1030 } |
|
1031 |
|
1032 // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
|
1033 |
|
1034 { |
|
1035 // This is for authentication based on PIN method or PUSH-BUTTON method. |
|
1036 u16_t network_order_Device_Password_ID(eap_htons(static_cast<u16_t>(m_Device_Password_ID))); |
|
1037 |
|
1038 status = m_network_and_device_parameters.copy_attribute_data( |
|
1039 simple_config_Attribute_Type_Device_Password_ID, |
|
1040 true, |
|
1041 &network_order_Device_Password_ID, |
|
1042 sizeof(network_order_Device_Password_ID)); |
|
1043 if (status != eap_status_ok) |
|
1044 { |
|
1045 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
1046 return EAP_STATUS_RETURN(m_am_tools, status); |
|
1047 } |
|
1048 } |
|
1049 |
|
1050 // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
|
1051 |
|
1052 { |
|
1053 // No need for anything specific here. |
|
1054 u8_t OS_Version[] |
|
1055 = { 0xf0, 0x00, 0x00, 0x01 }; |
|
1056 |
|
1057 status = m_network_and_device_parameters.copy_attribute_data( |
|
1058 simple_config_Attribute_Type_OS_Version, |
|
1059 true, |
|
1060 OS_Version, |
|
1061 sizeof(OS_Version)); |
|
1062 if (status != eap_status_ok) |
|
1063 { |
|
1064 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
1065 return EAP_STATUS_RETURN(m_am_tools, status); |
|
1066 } |
|
1067 } |
|
1068 |
|
1069 // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
|
1070 |
|
1071 // Query the device details from the MMETEL connection. |
|
1072 TRAPD(error, m_prot_setup_if->QueryDeviceParametersL()); |
|
1073 if (error != KErrNone) |
|
1074 { |
|
1075 status = m_am_tools->convert_am_error_to_eapol_error(error); |
|
1076 if (status == eap_status_process_general_error) |
|
1077 { |
|
1078 status = eap_status_credential_query_failed; |
|
1079 } |
|
1080 |
|
1081 send_error_notification(status); |
|
1082 |
|
1083 // Query failed. |
|
1084 get_simple_config_am_partner()->complete_query_network_and_device_parameters( |
|
1085 m_simple_config_state, |
|
1086 &m_network_and_device_parameters, |
|
1087 status); |
|
1088 } |
|
1089 |
|
1090 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
1091 return EAP_STATUS_RETURN(m_am_tools, eap_status_pending_request); // Request is always pending here. |
|
1092 } |
|
1093 |
|
1094 //-------------------------------------------------- |
|
1095 |
|
1096 // This is always synchronous call. |
|
1097 EAP_FUNC_EXPORT eap_status_e eap_am_type_protected_setup_symbian_c::save_simple_config_session( |
|
1098 const simple_config_state_e state, |
|
1099 EAP_TEMPLATE_CONST eap_array_c<simple_config_credential_c> * const credential_array, |
|
1100 const eap_variable_data_c * const new_password, |
|
1101 const simple_config_Device_Password_ID_e Device_Password_ID, |
|
1102 const simple_config_payloads_c * const other_configuration) |
|
1103 { |
|
1104 EAP_TRACE_BEGIN(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
1105 |
|
1106 EAP_TRACE_DEBUG( |
|
1107 m_am_tools, |
|
1108 TRACE_FLAGS_DEFAULT, |
|
1109 (EAPL("SIMPLE_CONFIG: %s: message_function: save_simple_config_session()\n"), |
|
1110 (m_is_client == true ? "client": "server"))); |
|
1111 |
|
1112 for (u32_t ind = 0ul; ind < credential_array->get_object_count(); ind++) |
|
1113 { |
|
1114 simple_config_credential_c * const credential = credential_array->get_object(ind); |
|
1115 |
|
1116 if (credential != 0 |
|
1117 && credential->get_is_valid() == true) |
|
1118 { |
|
1119 EAP_TRACE_DEBUG( |
|
1120 m_am_tools, |
|
1121 TRACE_FLAGS_DEFAULT, |
|
1122 (EAPL("SIMPLE_CONFIG: network_index=%d\n"), |
|
1123 credential->get_network_index())); |
|
1124 |
|
1125 EAP_TRACE_DATA_DEBUG( |
|
1126 m_am_tools, |
|
1127 TRACE_FLAGS_DEFAULT, |
|
1128 (EAPL("SIMPLE_CONFIG: SSID"), |
|
1129 credential->get_SSID()->get_data(), |
|
1130 credential->get_SSID()->get_data_length())); |
|
1131 |
|
1132 EAP_TRACE_DEBUG( |
|
1133 m_am_tools, |
|
1134 TRACE_FLAGS_DEFAULT, |
|
1135 (EAPL("SIMPLE_CONFIG: Authentication_Type=%d\n"), |
|
1136 credential->get_Authentication_Type())); |
|
1137 |
|
1138 EAP_TRACE_DEBUG( |
|
1139 m_am_tools, |
|
1140 TRACE_FLAGS_DEFAULT, |
|
1141 (EAPL("SIMPLE_CONFIG: Encryption_Type=%d\n"), |
|
1142 credential->get_Encryption_Type())); |
|
1143 |
|
1144 for (u32_t ind = 0ul; ind < credential->get_network_keys()->get_object_count(); ++ind) |
|
1145 { |
|
1146 network_key_and_index_c * const key = credential->get_network_keys()->get_object(ind); |
|
1147 if (key != 0) |
|
1148 { |
|
1149 |
|
1150 EAP_TRACE_DEBUG( |
|
1151 m_am_tools, |
|
1152 TRACE_FLAGS_DEFAULT, |
|
1153 (EAPL("SIMPLE_CONFIG: network_key_index=%d\n"), |
|
1154 key->get_network_key_index())); |
|
1155 |
|
1156 EAP_TRACE_DATA_DEBUG( |
|
1157 m_am_tools, |
|
1158 TRACE_FLAGS_DEFAULT, |
|
1159 (EAPL("SIMPLE_CONFIG: Key"), |
|
1160 key->get_network_key()->get_data(), |
|
1161 key->get_network_key()->get_data_length())); |
|
1162 } |
|
1163 } |
|
1164 |
|
1165 EAP_TRACE_DATA_DEBUG( |
|
1166 m_am_tools, |
|
1167 TRACE_FLAGS_DEFAULT, |
|
1168 (EAPL("SIMPLE_CONFIG: MAC_address"), |
|
1169 credential->get_MAC_address()->get_data(), |
|
1170 credential->get_MAC_address()->get_data_length())); |
|
1171 } |
|
1172 } |
|
1173 |
|
1174 EAP_TRACE_DATA_DEBUG( |
|
1175 m_am_tools, |
|
1176 TRACE_FLAGS_DEFAULT, |
|
1177 (EAPL("SIMPLE_CONFIG: new_password"), |
|
1178 new_password->get_data(), |
|
1179 new_password->get_data_length())); |
|
1180 |
|
1181 EAP_TRACE_DEBUG( |
|
1182 m_am_tools, |
|
1183 TRACE_FLAGS_DEFAULT, |
|
1184 (EAPL("SIMPLE_CONFIG: Device_Password_ID=%d\n"), |
|
1185 Device_Password_ID)); |
|
1186 |
|
1187 eap_status_e status = m_configuration_if->save_simple_config_session( |
|
1188 state, |
|
1189 credential_array, |
|
1190 new_password, |
|
1191 Device_Password_ID, |
|
1192 other_configuration); |
|
1193 |
|
1194 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
1195 return EAP_STATUS_RETURN(m_am_tools, status); |
|
1196 } |
|
1197 |
|
1198 //-------------------------------------------------- |
|
1199 |
|
1200 EAP_FUNC_EXPORT eap_status_e eap_am_type_protected_setup_symbian_c::received_registrar_information( |
|
1201 EAP_TEMPLATE_CONST eap_array_c<simple_config_payloads_c> * const M2D_payloads) |
|
1202 { |
|
1203 EAP_TRACE_BEGIN(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
1204 |
|
1205 EAP_TRACE_DEBUG( |
|
1206 m_am_tools, |
|
1207 TRACE_FLAGS_DEFAULT, |
|
1208 (EAPL("\n"))); |
|
1209 EAP_TRACE_DEBUG( |
|
1210 m_am_tools, |
|
1211 TRACE_FLAGS_DEFAULT, |
|
1212 (EAPL("SIMPLE_CONFIG: %s: message_function: received_registrar_information()\n"), |
|
1213 (m_is_client == true ? "client": "server"))); |
|
1214 |
|
1215 eap_simple_config_trace_string_c debug_string; |
|
1216 |
|
1217 for (u32_t ind = 0ul; ind < M2D_payloads->get_object_count(); ind++) |
|
1218 { |
|
1219 EAP_TRACE_DEBUG( |
|
1220 m_am_tools, |
|
1221 TRACE_FLAGS_DEFAULT, |
|
1222 (EAPL("---------------------------------------------------------------\n"))); |
|
1223 |
|
1224 EAP_TRACE_DEBUG( |
|
1225 m_am_tools, |
|
1226 TRACE_FLAGS_DEFAULT, |
|
1227 (EAPL("M2D %d\n"), |
|
1228 ind)); |
|
1229 |
|
1230 simple_config_payloads_c * const payloads = M2D_payloads->get_object(ind); |
|
1231 if (payloads == 0) |
|
1232 { |
|
1233 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
1234 return EAP_STATUS_RETURN(m_am_tools, eap_status_illegal_parameter); |
|
1235 } |
|
1236 |
|
1237 const u32_t attribute_count(payloads->get_attribute_count()); |
|
1238 u32_t attribute_index(0ul); |
|
1239 |
|
1240 while (attribute_index < attribute_count) |
|
1241 { |
|
1242 simple_config_variable_data_c * attribute = payloads->get_attribute(attribute_index); |
|
1243 if (attribute == 0) |
|
1244 { |
|
1245 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
1246 return EAP_STATUS_RETURN(m_am_tools, eap_status_illegal_parameter); |
|
1247 } |
|
1248 |
|
1249 EAP_TRACE_DEBUG( |
|
1250 m_am_tools, |
|
1251 TRACE_FLAGS_DEFAULT, |
|
1252 (EAPL("\n"))); |
|
1253 |
|
1254 EAP_TRACE_DEBUG( |
|
1255 m_am_tools, TRACE_FLAGS_DEFAULT|TRACE_TEST_VECTORS, |
|
1256 (EAPL("%s (0x%08x): TLV type 0x%08x=%s, data length 0x%04x.\n"), |
|
1257 "M2D", (attribute)->get_data((attribute)->get_data_length()), |
|
1258 (attribute)->get_attribute_type(), |
|
1259 debug_string.get_attribute_type_string((attribute)->get_attribute_type()), |
|
1260 (attribute)->get_data_length())); |
|
1261 |
|
1262 EAP_TRACE_DATA_DEBUG(m_am_tools, TRACE_FLAGS_DEFAULT|TRACE_TEST_VECTORS, |
|
1263 (EAPL("M2D"), (attribute)->get_data((attribute)->get_data_length()), |
|
1264 (attribute)->get_data_length())); |
|
1265 |
|
1266 ++attribute_index; |
|
1267 } |
|
1268 |
|
1269 EAP_TRACE_DEBUG( |
|
1270 m_am_tools, |
|
1271 TRACE_FLAGS_DEFAULT, |
|
1272 (EAPL("\n"))); |
|
1273 } |
|
1274 |
|
1275 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
1276 return EAP_STATUS_RETURN(m_am_tools, eap_status_ok); |
|
1277 } |
|
1278 |
|
1279 //-------------------------------------------------- |
|
1280 |
|
1281 EAP_FUNC_EXPORT eap_status_e eap_am_type_protected_setup_symbian_c::cancel_query_network_and_device_parameters() |
|
1282 { |
|
1283 EAP_TRACE_BEGIN(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
1284 |
|
1285 EAP_TRACE_DEBUG( |
|
1286 m_am_tools, |
|
1287 TRACE_FLAGS_DEFAULT, |
|
1288 (EAPL("\n"))); |
|
1289 EAP_TRACE_DEBUG( |
|
1290 m_am_tools, |
|
1291 TRACE_FLAGS_DEFAULT, |
|
1292 (EAPL("SIMPLE_CONFIG: %s: message_function: cancel_query_dh_parameters()\n"), |
|
1293 (m_is_client == true ? "client": "server"))); |
|
1294 |
|
1295 if (m_is_client == true) |
|
1296 { |
|
1297 m_prot_setup_if->Cancel(); |
|
1298 } |
|
1299 |
|
1300 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
1301 return EAP_STATUS_RETURN(m_am_tools, eap_status_ok); |
|
1302 } |
|
1303 |
|
1304 //-------------------------------------------------- |
|
1305 |
|
1306 EAP_FUNC_EXPORT eap_status_e eap_am_type_protected_setup_symbian_c::load_module( |
|
1307 const eap_type_value_e eap_type, |
|
1308 const eap_type_value_e tunneling_type, |
|
1309 abs_eap_base_type_c * const partner, |
|
1310 eap_base_type_c ** const eap_type_if, |
|
1311 const bool is_client_when_true, |
|
1312 const eap_am_network_id_c * const receive_network_id) |
|
1313 { |
|
1314 EAP_TRACE_BEGIN(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
1315 EAP_TRACE_DEBUG( |
|
1316 m_am_tools, |
|
1317 TRACE_FLAGS_DEFAULT, |
|
1318 (EAPL("eap_am_type_protected_setup_symbian_c::load_module(0x%08x)\n"), |
|
1319 convert_eap_type_to_u32_t(eap_type))); |
|
1320 |
|
1321 eap_status_e status = m_partner->load_module( |
|
1322 eap_type, |
|
1323 tunneling_type, |
|
1324 partner, |
|
1325 eap_type_if, |
|
1326 is_client_when_true, |
|
1327 receive_network_id); |
|
1328 |
|
1329 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
1330 return EAP_STATUS_RETURN(m_am_tools, status); |
|
1331 } |
|
1332 |
|
1333 //-------------------------------------------------- |
|
1334 |
|
1335 EAP_FUNC_EXPORT eap_status_e eap_am_type_protected_setup_symbian_c::check_is_valid_eap_type(const eap_type_value_e eap_type) |
|
1336 { |
|
1337 EAP_TRACE_BEGIN(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
1338 EAP_TRACE_DEBUG( |
|
1339 m_am_tools, |
|
1340 TRACE_FLAGS_DEFAULT, |
|
1341 (EAPL("eap_am_type_protected_setup_symbian_c::check_is_valid_eap_type(0x%08x)\n"), |
|
1342 convert_eap_type_to_u32_t(eap_type))); |
|
1343 |
|
1344 eap_status_e status = m_partner->check_is_valid_eap_type( |
|
1345 eap_type); |
|
1346 |
|
1347 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
1348 return EAP_STATUS_RETURN(m_am_tools, status); |
|
1349 } |
|
1350 |
|
1351 //-------------------------------------------------- |
|
1352 |
|
1353 EAP_FUNC_EXPORT eap_status_e eap_am_type_protected_setup_symbian_c::get_eap_type_list( |
|
1354 eap_array_c<eap_type_value_e> * const eap_type_list) |
|
1355 { |
|
1356 EAP_TRACE_BEGIN(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
1357 |
|
1358 eap_status_e status = m_partner->get_eap_type_list(eap_type_list); |
|
1359 |
|
1360 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
1361 return EAP_STATUS_RETURN(m_am_tools, status); |
|
1362 } |
|
1363 |
|
1364 //-------------------------------------------------- |
|
1365 |
|
1366 EAP_FUNC_EXPORT eap_status_e eap_am_type_protected_setup_symbian_c::unload_module(const eap_type_value_e eap_type) |
|
1367 { |
|
1368 EAP_TRACE_BEGIN(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
1369 EAP_TRACE_DEBUG( |
|
1370 m_am_tools, |
|
1371 TRACE_FLAGS_DEFAULT, |
|
1372 (EAPL("eap_am_type_protected_setup_symbian_c::unload_module(0x%08x)\n"), |
|
1373 convert_eap_type_to_u32_t(eap_type))); |
|
1374 |
|
1375 eap_status_e status = m_partner->unload_module( |
|
1376 eap_type); |
|
1377 |
|
1378 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
1379 return EAP_STATUS_RETURN(m_am_tools, status); |
|
1380 } |
|
1381 |
|
1382 //-------------------------------------------------- |
|
1383 |
|
1384 EAP_FUNC_EXPORT eap_status_e eap_am_type_protected_setup_symbian_c::complete_protected_setup_device_paramsL( |
|
1385 const RMobilePhone::TMobilePhoneIdentityV1 &phone_identity, |
|
1386 const eap_status_e completion_status ) |
|
1387 { |
|
1388 EAP_TRACE_BEGIN(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
1389 eap_status_e status(eap_status_process_general_error); |
|
1390 |
|
1391 if (completion_status != eap_status_ok) |
|
1392 { |
|
1393 // Query failed |
|
1394 status = get_simple_config_am_partner()->complete_query_network_and_device_parameters( |
|
1395 m_simple_config_state, |
|
1396 &m_network_and_device_parameters, |
|
1397 completion_status); |
|
1398 |
|
1399 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
1400 return status; |
|
1401 } |
|
1402 |
|
1403 if(phone_identity.iManufacturer.Size() == 0 |
|
1404 || phone_identity.iModel.Size() == 0 |
|
1405 || phone_identity.iRevision.Size() == 0 |
|
1406 || phone_identity.iSerialNumber.Size() == 0 ) |
|
1407 { |
|
1408 // Some identies are missing. |
|
1409 status = get_simple_config_am_partner()->complete_query_network_and_device_parameters( |
|
1410 m_simple_config_state, |
|
1411 &m_network_and_device_parameters, |
|
1412 eap_status_process_general_error); |
|
1413 |
|
1414 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
1415 return status; |
|
1416 } |
|
1417 |
|
1418 // Copy device details to m_network_and_device_parameters |
|
1419 |
|
1420 // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
|
1421 |
|
1422 { |
|
1423 HBufC8* attribute_data = HBufC8::NewLC(phone_identity.iManufacturer.Size()); |
|
1424 |
|
1425 TPtr8 attribute_data_Ptr = attribute_data->Des(); |
|
1426 |
|
1427 EAP_TRACE_DATA_DEBUG_SYMBIAN( |
|
1428 ("Attribute data to convert:", |
|
1429 phone_identity.iManufacturer.Ptr(), |
|
1430 phone_identity.iManufacturer.Size())); |
|
1431 |
|
1432 ConvertUnicodeToAsciiL(phone_identity.iManufacturer, attribute_data_Ptr); |
|
1433 |
|
1434 status = m_network_and_device_parameters.copy_attribute_data( |
|
1435 simple_config_Attribute_Type_Manufacturer, |
|
1436 true, |
|
1437 attribute_data_Ptr.Ptr(), |
|
1438 attribute_data_Ptr.Size()); |
|
1439 |
|
1440 CleanupStack::PopAndDestroy(attribute_data); |
|
1441 |
|
1442 if (status != eap_status_ok) |
|
1443 { |
|
1444 status = get_simple_config_am_partner()->complete_query_network_and_device_parameters( |
|
1445 m_simple_config_state, |
|
1446 &m_network_and_device_parameters, |
|
1447 eap_status_process_general_error); |
|
1448 |
|
1449 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
1450 return EAP_STATUS_RETURN(m_am_tools, status); |
|
1451 } |
|
1452 } |
|
1453 |
|
1454 // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
|
1455 |
|
1456 { |
|
1457 HBufC8* attribute_data = HBufC8::NewLC(phone_identity.iModel.Size()); |
|
1458 |
|
1459 TPtr8 attribute_data_Ptr = attribute_data->Des(); |
|
1460 |
|
1461 EAP_TRACE_DATA_DEBUG_SYMBIAN( |
|
1462 ("Attribute data to convert:", |
|
1463 phone_identity.iModel.Ptr(), |
|
1464 phone_identity.iModel.Size())); |
|
1465 |
|
1466 ConvertUnicodeToAsciiL(phone_identity.iModel, attribute_data_Ptr); |
|
1467 |
|
1468 status = m_network_and_device_parameters.copy_attribute_data( |
|
1469 simple_config_Attribute_Type_Model_Name, |
|
1470 true, |
|
1471 attribute_data_Ptr.Ptr(), |
|
1472 attribute_data_Ptr.Size()); |
|
1473 |
|
1474 if (status != eap_status_ok) |
|
1475 { |
|
1476 CleanupStack::PopAndDestroy(attribute_data); |
|
1477 |
|
1478 status = get_simple_config_am_partner()->complete_query_network_and_device_parameters( |
|
1479 m_simple_config_state, |
|
1480 &m_network_and_device_parameters, |
|
1481 eap_status_process_general_error); |
|
1482 |
|
1483 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
1484 return EAP_STATUS_RETURN(m_am_tools, status); |
|
1485 } |
|
1486 |
|
1487 // Use model as the device name as well |
|
1488 // since there is nothing better for the purpose. |
|
1489 |
|
1490 EAP_TRACE_DEBUG_SYMBIAN( |
|
1491 (_L("eap_am_type_protected_setup_symbian_c::complete_protected_setup_device_paramsL: Uses model as device name."))); |
|
1492 |
|
1493 status = m_network_and_device_parameters.copy_attribute_data( |
|
1494 simple_config_Attribute_Type_Device_Name, |
|
1495 true, |
|
1496 attribute_data_Ptr.Ptr(), |
|
1497 attribute_data_Ptr.Size()); |
|
1498 |
|
1499 CleanupStack::PopAndDestroy(attribute_data); |
|
1500 |
|
1501 if (status != eap_status_ok) |
|
1502 { |
|
1503 status = get_simple_config_am_partner()->complete_query_network_and_device_parameters( |
|
1504 m_simple_config_state, |
|
1505 &m_network_and_device_parameters, |
|
1506 eap_status_process_general_error); |
|
1507 |
|
1508 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
1509 return EAP_STATUS_RETURN(m_am_tools, status); |
|
1510 } |
|
1511 } |
|
1512 |
|
1513 // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
|
1514 |
|
1515 { |
|
1516 HBufC8* attribute_data = HBufC8::NewLC(phone_identity.iRevision.Size()); |
|
1517 |
|
1518 TPtr8 attribute_data_Ptr = attribute_data->Des(); |
|
1519 |
|
1520 EAP_TRACE_DATA_DEBUG_SYMBIAN( |
|
1521 ("Attribute data to convert:", |
|
1522 phone_identity.iRevision.Ptr(), |
|
1523 phone_identity.iRevision.Size())); |
|
1524 |
|
1525 ConvertUnicodeToAsciiL(phone_identity.iRevision, attribute_data_Ptr); |
|
1526 |
|
1527 status = m_network_and_device_parameters.copy_attribute_data( |
|
1528 simple_config_Attribute_Type_Model_Number, |
|
1529 true, |
|
1530 attribute_data_Ptr.Ptr(), |
|
1531 attribute_data_Ptr.Size()); |
|
1532 |
|
1533 CleanupStack::PopAndDestroy(attribute_data); |
|
1534 |
|
1535 if (status != eap_status_ok) |
|
1536 { |
|
1537 status = get_simple_config_am_partner()->complete_query_network_and_device_parameters( |
|
1538 m_simple_config_state, |
|
1539 &m_network_and_device_parameters, |
|
1540 eap_status_process_general_error); |
|
1541 |
|
1542 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
1543 return EAP_STATUS_RETURN(m_am_tools, status); |
|
1544 } |
|
1545 } |
|
1546 |
|
1547 // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
|
1548 |
|
1549 { |
|
1550 HBufC8* attribute_data = HBufC8::NewLC(phone_identity.iSerialNumber.Size()); |
|
1551 |
|
1552 TPtr8 attribute_data_Ptr = attribute_data->Des(); |
|
1553 |
|
1554 EAP_TRACE_DATA_DEBUG_SYMBIAN( |
|
1555 ("Attribute data to convert:", |
|
1556 phone_identity.iSerialNumber.Ptr(), |
|
1557 phone_identity.iSerialNumber.Size())); |
|
1558 |
|
1559 ConvertUnicodeToAsciiL(phone_identity.iSerialNumber, attribute_data_Ptr); |
|
1560 |
|
1561 status = m_network_and_device_parameters.copy_attribute_data( |
|
1562 simple_config_Attribute_Type_Serial_Number, |
|
1563 true, |
|
1564 attribute_data_Ptr.Ptr(), |
|
1565 attribute_data_Ptr.Size()); |
|
1566 |
|
1567 CleanupStack::PopAndDestroy(attribute_data); |
|
1568 |
|
1569 if (status != eap_status_ok) |
|
1570 { |
|
1571 status = get_simple_config_am_partner()->complete_query_network_and_device_parameters( |
|
1572 m_simple_config_state, |
|
1573 &m_network_and_device_parameters, |
|
1574 eap_status_process_general_error); |
|
1575 |
|
1576 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
1577 return EAP_STATUS_RETURN(m_am_tools, status); |
|
1578 } |
|
1579 } |
|
1580 |
|
1581 // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
|
1582 |
|
1583 // Ok So far. Complete the request succesfully. |
|
1584 |
|
1585 status = get_simple_config_am_partner()->complete_query_network_and_device_parameters( |
|
1586 m_simple_config_state, |
|
1587 &m_network_and_device_parameters, |
|
1588 completion_status); |
|
1589 |
|
1590 if( status == eap_status_ok ) |
|
1591 { |
|
1592 // save the state |
|
1593 // no need to fetch the parameters again |
|
1594 m_device_parameters_valid = true; |
|
1595 } |
|
1596 |
|
1597 EAP_TRACE_END(m_am_tools, TRACE_FLAGS_DEFAULT); |
|
1598 return status; |
|
1599 } |
|
1600 |
|
1601 //-------------------------------------------------- |
|
1602 |
|
1603 void eap_am_type_protected_setup_symbian_c::ConvertUnicodeToAsciiL(const TDesC16& aFromUnicode, TDes8& aToAscii) |
|
1604 { |
|
1605 EAP_TRACE_DATA_DEBUG_SYMBIAN( |
|
1606 ("eap_am_type_protected_setup_symbian_c::ConvertUnicodeToAsciiL:From TEXT", |
|
1607 aFromUnicode.Ptr(), |
|
1608 aFromUnicode.Size())); |
|
1609 |
|
1610 if(aFromUnicode.Length() <= 0) |
|
1611 { |
|
1612 EAP_TRACE_DEBUG_SYMBIAN( |
|
1613 (_L("eap_am_type_protected_setup_symbian_c::ConvertUnicodeToAsciiL: Return: NOTHING TO CONVERT"))); |
|
1614 |
|
1615 return; |
|
1616 } |
|
1617 |
|
1618 EAP_TRACE_DEBUG_SYMBIAN( |
|
1619 (_L("eap_am_type_protected_setup_symbian_c::ConvertUnicodeToAsciiL, aFromUnicode.Length=%d, aFromUnicode.Size=%d"), |
|
1620 aFromUnicode.Length(), aFromUnicode.Size())); |
|
1621 |
|
1622 // Convert from Unicode to ascii. |
|
1623 HBufC8* aFromUnicodeBuf8 = HBufC8::NewLC(aFromUnicode.Length()); // Half times size of source (or length) is enough here. |
|
1624 TPtr8 aFromUnicodePtr8 = aFromUnicodeBuf8->Des(); |
|
1625 |
|
1626 EAP_TRACE_DEBUG_SYMBIAN( |
|
1627 (_L("eap_am_type_protected_setup_symbian_c::ConvertUnicodeToAsciiL, aFromUnicodePtr8.Length=%d, aFromUnicodePtr8.Size=%d, aFromUnicodePtr8.MaxLength=%d, aFromUnicodePtr8.MaxSize=%d"), |
|
1628 aFromUnicodePtr8.Length(), aFromUnicodePtr8.Size(), aFromUnicodePtr8.MaxLength(), aFromUnicodePtr8.MaxSize())); |
|
1629 |
|
1630 aFromUnicodePtr8.Copy(aFromUnicode); // Unicode -> ascii. |
|
1631 |
|
1632 aToAscii = aFromUnicodePtr8; |
|
1633 |
|
1634 CleanupStack::PopAndDestroy(aFromUnicodeBuf8); // Delete aFromUnicodeBuf8. |
|
1635 |
|
1636 EAP_TRACE_DATA_DEBUG_SYMBIAN( |
|
1637 ("eap_am_type_protected_setup_symbian_c::ConvertUnicodeToAsciiL:To ASCII", |
|
1638 aToAscii.Ptr(), |
|
1639 aToAscii.Size())); |
|
1640 } |
|
1641 |
|
1642 //-------------------------------------------------- |
|
1643 |
|
1644 // End of file. |