|
1 /* |
|
2 * Copyright (c) 2009-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 "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: |
|
15 * Implementation of WLAN Plugin interface implementation |
|
16 * for WLAN Bearer |
|
17 * |
|
18 */ |
|
19 |
|
20 |
|
21 #include <ecom/ecom.h> // For REComSession |
|
22 #include <wlancontainer.h> |
|
23 #include <wlanmgmtcommon.h> |
|
24 #include <cmpluginwlandef.h> |
|
25 #include <cmcommonconstants.h> |
|
26 #include <featmgr.h> |
|
27 |
|
28 #include "cmpluginwlan.h" |
|
29 #include "cmwlancoveragecheck.h" |
|
30 #include "cmmanagerdef.h" |
|
31 |
|
32 #include "OstTraceDefinitions.h" |
|
33 #ifdef OST_TRACE_COMPILER_IN_USE |
|
34 #include "cmpluginwlanTraces.h" |
|
35 #endif |
|
36 |
|
37 using namespace CMManager; |
|
38 |
|
39 enum TWlanWepKeyFormat |
|
40 { |
|
41 EWlanWepKeyFormatAscii = 0, |
|
42 EWlanWepKeyFormatHex |
|
43 }; |
|
44 |
|
45 // default values for fields... |
|
46 // CONSTANTS |
|
47 _LIT( KEmpty, ""); |
|
48 |
|
49 const TBool KDefIpAddrFromServer = ETrue; |
|
50 const TBool KDefIpDnsAddrFromServer = ETrue; |
|
51 const TBool KDefIp6DnsAddrFromServer = ETrue; |
|
52 |
|
53 const TInt KWlanServiceRecordIndex = 0; |
|
54 |
|
55 const TUint32 KDefaultPriorityWLan = 0; |
|
56 |
|
57 const TInt KWlanLastSocketActivityTimeout = -1; |
|
58 const TInt KWlanLastSessionClosedTimeout = 1; |
|
59 const TInt KWlanLastSocketClosedTimeout = -1; |
|
60 |
|
61 /// Modem bearer names for WLAN connection methods |
|
62 _LIT( KModemBearerWLAN, "WLANBearer" ); |
|
63 |
|
64 _LIT( KWlanBearerName, "WLANBearer" ); |
|
65 _LIT( KWlanBearerAgent, "wlanagt.agt" ); |
|
66 _LIT( KWlanBearerNif, "wlannif" ); |
|
67 |
|
68 _LIT( KWlanLDDName, "not used" ); |
|
69 _LIT( KWlanPDDName, "not used" ); |
|
70 |
|
71 |
|
72 // -------------------------------------------------------------------------- |
|
73 // CCmPluginWlan::NewL |
|
74 // -------------------------------------------------------------------------- |
|
75 // |
|
76 CCmPluginWlan* CCmPluginWlan::NewL( TCmPluginInitParam* aInitParam ) |
|
77 { |
|
78 OstTraceFunctionEntry0( CCMPLUGINWLAN_NEWL_ENTRY ); |
|
79 |
|
80 CCmPluginWlan* self = new( ELeave ) CCmPluginWlan( aInitParam ); |
|
81 CleanupStack::PushL( self ); |
|
82 self->ConstructL(); |
|
83 CleanupStack::Pop( self ); |
|
84 |
|
85 OstTraceFunctionExit0( CCMPLUGINWLAN_NEWL_EXIT ); |
|
86 return self; |
|
87 } |
|
88 |
|
89 // -------------------------------------------------------------------------- |
|
90 // CCmPluginWlan::~CCmPluginWlan |
|
91 // -------------------------------------------------------------------------- |
|
92 // |
|
93 CCmPluginWlan::~CCmPluginWlan() |
|
94 { |
|
95 OstTraceFunctionEntry0( CCMPLUGINWLAN_CCMPLUGINWLAN_ENTRY ); |
|
96 |
|
97 ResetBearerRecords(); |
|
98 FeatureManager::UnInitializeLib(); |
|
99 |
|
100 OstTraceFunctionExit0( CCMPLUGINWLAN_CCMPLUGINWLAN_EXIT ); |
|
101 } |
|
102 |
|
103 // -------------------------------------------------------------------------- |
|
104 // CCmPluginWlan::CreateInstanceL |
|
105 // -------------------------------------------------------------------------- |
|
106 // |
|
107 CCmPluginBaseEng* CCmPluginWlan::CreateInstanceL( TCmPluginInitParam& aInitParam ) const |
|
108 { |
|
109 OstTraceFunctionEntry0( CCMPLUGINWLAN_CREATEINSTANCEL_ENTRY ); |
|
110 |
|
111 CCmPluginWlan* self = new( ELeave ) CCmPluginWlan( &aInitParam ); |
|
112 CleanupStack::PushL( self ); |
|
113 self->ConstructL(); |
|
114 CleanupStack::Pop( self ); |
|
115 |
|
116 OstTraceFunctionExit0( CCMPLUGINWLAN_CREATEINSTANCEL_EXIT ); |
|
117 return self; |
|
118 } |
|
119 |
|
120 // -------------------------------------------------------------------------- |
|
121 // CCmPluginWlan::CCmPluginWlan |
|
122 // -------------------------------------------------------------------------- |
|
123 // |
|
124 CCmPluginWlan::CCmPluginWlan( TCmPluginInitParam* aInitParam ) |
|
125 : |
|
126 CCmPluginBaseEng( aInitParam ) |
|
127 { |
|
128 OstTraceFunctionEntry0( DUP1_CCMPLUGINWLAN_CCMPLUGINWLAN_ENTRY ); |
|
129 |
|
130 iBearerType = KUidWlanBearerType; |
|
131 iWlanServiceRecord = NULL; |
|
132 iWlanTableId = 0; |
|
133 iWAPISupported = EFalse; |
|
134 |
|
135 OstTraceFunctionExit0( DUP1_CCMPLUGINWLAN_CCMPLUGINWLAN_EXIT ); |
|
136 } |
|
137 |
|
138 // -------------------------------------------------------------------------- |
|
139 // CCmPluginWlan::ConstructL |
|
140 // -------------------------------------------------------------------------- |
|
141 // |
|
142 void CCmPluginWlan::ConstructL() |
|
143 { |
|
144 OstTraceFunctionEntry0( CCMPLUGINWLAN_CONSTRUCTL_ENTRY ); |
|
145 |
|
146 FeatureManager::InitializeLibL(); |
|
147 |
|
148 if ( ! FeatureManager::FeatureSupported( KFeatureIdProtocolWlan ) ) |
|
149 { |
|
150 FeatureManager::UnInitializeLib(); |
|
151 |
|
152 User::Leave( KErrNotSupported ); |
|
153 } |
|
154 |
|
155 CCmPluginBaseEng::ConstructL(); |
|
156 |
|
157 // get WLAN table id |
|
158 TRAP_IGNORE( iWlanTableId = CCDWlanServiceRecord::TableIdL( iSession ) ); |
|
159 |
|
160 if ( !iWlanTableId ) |
|
161 { |
|
162 iWlanTableId = CCDWlanServiceRecord::CreateTableL( iSession ); |
|
163 |
|
164 TMDBElementId tableId = 0; |
|
165 |
|
166 TRAP_IGNORE( tableId = CCDWlanDeviceSettingsRecord::TableIdL( iSession ) ); |
|
167 if ( !tableId ) |
|
168 { |
|
169 CCDWlanDeviceSettingsRecord::CreateTableL( iSession ); |
|
170 } |
|
171 |
|
172 TRAP_IGNORE( tableId = CCDWLANSecSSIDTable::TableIdL( iSession ) ); |
|
173 if ( !tableId ) |
|
174 { |
|
175 CCDWLANSecSSIDTable::CreateTableL( iSession ); |
|
176 } |
|
177 |
|
178 TRAP_IGNORE( tableId = CCDDestNWTable::TableIdL( iSession ) ); |
|
179 if ( !tableId ) |
|
180 { |
|
181 CCDDestNWTable::CreateTableL( iSession ); |
|
182 } |
|
183 } |
|
184 |
|
185 iWAPISupported = FeatureManager::FeatureSupported( KFeatureIdFfWlanWapi ); |
|
186 |
|
187 OstTraceFunctionExit0( CCMPLUGINWLAN_CONSTRUCTL_EXIT ); |
|
188 } |
|
189 |
|
190 // --------------------------------------------------------------------------- |
|
191 // CCmPluginWlan::ServiceRecord() |
|
192 // --------------------------------------------------------------------------- |
|
193 // |
|
194 CCDLANServiceRecord& CCmPluginWlan::ServiceRecord() const |
|
195 { |
|
196 return *static_cast<CCDLANServiceRecord*>( iServiceRecord ); |
|
197 } |
|
198 |
|
199 // --------------------------------------------------------------------------- |
|
200 // CCmPluginWlan::ServiceRecordId |
|
201 // --------------------------------------------------------------------------- |
|
202 // |
|
203 TUint32 CCmPluginWlan::ServiceRecordId() const |
|
204 { |
|
205 OstTraceFunctionEntry0( CCMPLUGINWLAN_SERVICERECORDID_ENTRY ); |
|
206 |
|
207 return ServiceRecord().RecordId(); |
|
208 } |
|
209 |
|
210 // --------------------------------------------------------------------------- |
|
211 // CCmPluginWlan::ServiceRecordIdLC |
|
212 // --------------------------------------------------------------------------- |
|
213 // |
|
214 void CCmPluginWlan::ServiceRecordNameLC( HBufC* &aName ) |
|
215 { |
|
216 OstTraceFunctionEntry0( CCMPLUGINWLAN_SERVICERECORDNAMELC_ENTRY ); |
|
217 |
|
218 aName = TPtrC( KCDTypeNameLANService ).AllocLC(); |
|
219 |
|
220 OstTraceFunctionExit0( CCMPLUGINWLAN_SERVICERECORDNAMELC_EXIT ); |
|
221 } |
|
222 |
|
223 // --------------------------------------------------------------------------- |
|
224 // CCmPluginWlan::BearerRecordIdL() |
|
225 // --------------------------------------------------------------------------- |
|
226 // |
|
227 void CCmPluginWlan::BearerRecordIdL( TUint32& aRecordId ) |
|
228 { |
|
229 OstTraceFunctionEntry0( CCMPLUGINWLAN_BEARERRECORDIDL_ENTRY ); |
|
230 |
|
231 CCDLANBearerRecord* lanBearerRecord = static_cast<CCDLANBearerRecord*> |
|
232 (CCDRecordBase::RecordFactoryL( KCDTIdLANBearerRecord )); |
|
233 CleanupStack::PushL( lanBearerRecord ); |
|
234 |
|
235 lanBearerRecord->iRecordName.SetL( TPtrC( KModemBearerWLAN ) ); |
|
236 if ( !lanBearerRecord->FindL( iSession ) ) |
|
237 { // bearer not found -> create dummy values |
|
238 lanBearerRecord->SetRecordId( KCDNewRecordRequest ); |
|
239 lanBearerRecord->iBearerAgent = KWlanBearerAgent; |
|
240 lanBearerRecord->iRecordName = KWlanBearerName; |
|
241 lanBearerRecord->iLanBearerNifName = KWlanBearerNif; |
|
242 lanBearerRecord->iLanBearerLddName = KWlanLDDName; |
|
243 lanBearerRecord->iLanBearerPddName = KWlanPDDName; |
|
244 lanBearerRecord->iLastSocketActivityTimeout = |
|
245 (TUint32)KWlanLastSocketActivityTimeout; |
|
246 lanBearerRecord->iLastSessionClosedTimeout = |
|
247 (TUint32)KWlanLastSessionClosedTimeout; |
|
248 lanBearerRecord->iLastSocketClosedTimeout = |
|
249 (TUint32)KWlanLastSocketClosedTimeout; |
|
250 |
|
251 lanBearerRecord->StoreL( iSession ); |
|
252 } |
|
253 |
|
254 aRecordId = lanBearerRecord->RecordId(); |
|
255 |
|
256 CleanupStack::PopAndDestroy( lanBearerRecord ); |
|
257 |
|
258 OstTraceFunctionExit0( CCMPLUGINWLAN_BEARERRECORDIDL_EXIT ); |
|
259 } |
|
260 |
|
261 // --------------------------------------------------------------------------- |
|
262 // CCmPluginWlan::BearerRecordNameLC() |
|
263 // --------------------------------------------------------------------------- |
|
264 // |
|
265 void CCmPluginWlan::BearerRecordNameLC( HBufC* &aBearerName ) |
|
266 { |
|
267 OstTraceFunctionEntry0( CCMPLUGINWLAN_BEARERRECORDNAMELC_ENTRY ); |
|
268 |
|
269 aBearerName = TPtrC( KCDTypeNameLANBearer ).AllocLC(); |
|
270 |
|
271 OstTraceFunctionExit0( CCMPLUGINWLAN_BEARERRECORDNAMELC_EXIT ); |
|
272 } |
|
273 |
|
274 // -------------------------------------------------------------------------- |
|
275 // CCmPluginWlan::GetBearerIntAttributeL |
|
276 // -------------------------------------------------------------------------- |
|
277 // |
|
278 TUint32 CCmPluginWlan::GetBearerIntAttributeL( |
|
279 TUint32 aAttribute, |
|
280 RPointerArray<CommsDat::CCDRecordBase>& aGenRecordArray, |
|
281 RPointerArray<CommsDat::CCDRecordBase>& aBearerSpecRecordArray ) |
|
282 { |
|
283 OstTraceFunctionEntry0( CCMPLUGINWLAN_GETBEARERINTATTRIBUTEL_ENTRY ); |
|
284 |
|
285 TUint32 retVal( 0 ); |
|
286 |
|
287 CCDLANServiceRecord* serviceRecord = |
|
288 static_cast<CCDLANServiceRecord*>( |
|
289 aGenRecordArray[KServiceRecordIndex] ); |
|
290 |
|
291 CCDWlanServiceRecord* wlanServiceRecord = |
|
292 static_cast<CCDWlanServiceRecord*>( |
|
293 aBearerSpecRecordArray[KWlanServiceRecordIndex] ); |
|
294 |
|
295 switch ( aAttribute ) |
|
296 { |
|
297 case ECmInvalidAttribute: |
|
298 { |
|
299 retVal = 0; |
|
300 } |
|
301 break; |
|
302 case ECmExtensionLevel: |
|
303 { |
|
304 // This is extension from LAN plugin |
|
305 retVal = KExtensionBaseLevel + 1; |
|
306 } |
|
307 break; |
|
308 case ECmCommsDBBearerType: |
|
309 { |
|
310 retVal = KCommDbBearerWLAN; |
|
311 } |
|
312 break; |
|
313 case ECmDefaultUiPriority: |
|
314 { |
|
315 retVal = KDefaultPriorityWLan; |
|
316 } |
|
317 break; |
|
318 case ECmDefaultPriority: |
|
319 { |
|
320 retVal = KDefaultPriorityWLan; |
|
321 } |
|
322 break; |
|
323 case EWlanServiceId: |
|
324 { |
|
325 retVal = wlanServiceRecord->iWlanServiceId; |
|
326 } |
|
327 break; |
|
328 case EWlanConnectionMode: |
|
329 { |
|
330 retVal = wlanServiceRecord->iWlanConnMode; |
|
331 } |
|
332 break; |
|
333 case EWlanSecurityMode: |
|
334 { |
|
335 retVal = wlanServiceRecord->iWlanSecMode; |
|
336 } |
|
337 break; |
|
338 case EWlanAuthenticationMode: |
|
339 { |
|
340 retVal = wlanServiceRecord->iWlanAuthMode; |
|
341 } |
|
342 break; |
|
343 case EWlanChannelID: |
|
344 { |
|
345 retVal = wlanServiceRecord->iWlanChannelID; |
|
346 } |
|
347 break; |
|
348 case EWlanServiceExtensionTableRecordId: |
|
349 { |
|
350 retVal = serviceRecord->iServiceExtensionTableRecordId; |
|
351 } |
|
352 break; |
|
353 case EWlanWepKeyIndex: |
|
354 { |
|
355 retVal = wlanServiceRecord->iWlanWepIndex; |
|
356 } |
|
357 break; |
|
358 case EWlanWapiPskFormat: |
|
359 { |
|
360 retVal = wlanServiceRecord->iWlanFormatKey1; |
|
361 } |
|
362 break; |
|
363 default: |
|
364 { |
|
365 User::Leave( KErrNotSupported ); |
|
366 } |
|
367 break; |
|
368 } |
|
369 |
|
370 OstTraceFunctionExit0( CCMPLUGINWLAN_GETBEARERINTATTRIBUTEL_EXIT ); |
|
371 return retVal; |
|
372 } |
|
373 |
|
374 // -------------------------------------------------------------------------- |
|
375 // CCmPluginWlan::GetBearerBoolAttributeL |
|
376 // -------------------------------------------------------------------------- |
|
377 // |
|
378 TBool CCmPluginWlan::GetBearerBoolAttributeL( |
|
379 TUint32 aAttribute, |
|
380 RPointerArray<CommsDat::CCDRecordBase>& aGenRecordArray, |
|
381 RPointerArray<CommsDat::CCDRecordBase>& aBearerSpecRecordArray ) |
|
382 { |
|
383 OstTraceFunctionEntry0( CCMPLUGINWLAN_GETBEARERBOOLATTRIBUTEL_ENTRY ); |
|
384 |
|
385 TBool retVal( EFalse ); |
|
386 |
|
387 CCDWlanServiceRecord* wlanServiceRecord = |
|
388 static_cast<CCDWlanServiceRecord*>( |
|
389 aBearerSpecRecordArray[KWlanServiceRecordIndex] ); |
|
390 |
|
391 CCDLANServiceRecord* serviceRecord = |
|
392 static_cast<CCDLANServiceRecord*>( |
|
393 aGenRecordArray[KServiceRecordIndex] ); |
|
394 |
|
395 switch ( aAttribute ) |
|
396 { |
|
397 case ECmCoverage: |
|
398 { |
|
399 #ifndef __WINS__ |
|
400 retVal = CheckNetworkCoverageL(); |
|
401 #else |
|
402 retVal = ETrue; |
|
403 #endif |
|
404 } |
|
405 break; |
|
406 case ECmDestination: |
|
407 { |
|
408 retVal = EFalse; |
|
409 } |
|
410 break; |
|
411 case ECmBearerHasUi: |
|
412 { |
|
413 retVal = ETrue; |
|
414 } |
|
415 break; |
|
416 case ECmIPv6Supported: |
|
417 { |
|
418 retVal = FeatureManager::FeatureSupported( KFeatureIdIPv6 ); |
|
419 } |
|
420 break; |
|
421 case EWlanScanSSID: |
|
422 { |
|
423 retVal = wlanServiceRecord->iWlanScanSSID; |
|
424 } |
|
425 break; |
|
426 case EWlanAllowSSIDRoaming: |
|
427 { |
|
428 retVal = wlanServiceRecord->iWlanAllowSSIDRoaming; |
|
429 } |
|
430 break; |
|
431 case ECmIPAddFromServer: |
|
432 case EWlanIpAddrFromServer: |
|
433 { |
|
434 retVal = serviceRecord->iIpAddrFromServer; |
|
435 } |
|
436 break; |
|
437 case ECmIPDNSAddrFromServer: |
|
438 case EWlanIpDNSAddrFromServer: |
|
439 { |
|
440 retVal = serviceRecord->iIpDnsAddrFromServer; |
|
441 } |
|
442 break; |
|
443 case ECmIP6DNSAddrFromServer: |
|
444 case EWlanIp6DNSAddrFromServer: |
|
445 { |
|
446 retVal = serviceRecord->iIp6DnsAddrFromServer; |
|
447 } |
|
448 break; |
|
449 case EWlanEnableWpaPsk: |
|
450 { |
|
451 retVal = static_cast<TBool>( wlanServiceRecord->iWlanEnableWpaPsk ); |
|
452 } |
|
453 break; |
|
454 case EWlan802_1xAllowUnencrypted: |
|
455 { |
|
456 retVal = static_cast<TBool>( wlanServiceRecord->iWlanWpaKeyLength ); |
|
457 } |
|
458 break; |
|
459 default: |
|
460 { |
|
461 User::Leave( KErrNotSupported ); |
|
462 break; |
|
463 } |
|
464 } |
|
465 |
|
466 OstTraceFunctionExit0( CCMPLUGINWLAN_GETBEARERBOOLATTRIBUTEL_EXIT ); |
|
467 return retVal; |
|
468 } |
|
469 |
|
470 // -------------------------------------------------------------------------- |
|
471 // CCmPluginWlan::GetBearerStringAttributeL |
|
472 // -------------------------------------------------------------------------- |
|
473 // |
|
474 HBufC* CCmPluginWlan::GetBearerStringAttributeL( |
|
475 TUint32 aAttribute, |
|
476 RPointerArray<CommsDat::CCDRecordBase>& aGenRecordArray, |
|
477 RPointerArray<CommsDat::CCDRecordBase>& aBearerSpecRecordArray ) |
|
478 { |
|
479 OstTraceFunctionEntry0( CCMPLUGINWLAN_GETBEARERSTRINGATTRIBUTEL_ENTRY ); |
|
480 |
|
481 HBufC* retVal = NULL; |
|
482 |
|
483 CCDWlanServiceRecord* wlanServiceRecord = |
|
484 static_cast<CCDWlanServiceRecord*>( |
|
485 aBearerSpecRecordArray[KWlanServiceRecordIndex] ); |
|
486 |
|
487 CCDLANServiceRecord* serviceRecord = |
|
488 static_cast<CCDLANServiceRecord*>( |
|
489 aGenRecordArray[KServiceRecordIndex] ); |
|
490 |
|
491 switch ( aAttribute ) |
|
492 { |
|
493 case ECmIFNetworks: |
|
494 case EWlanIfNetworks: |
|
495 { |
|
496 if ( !serviceRecord->iIfNetworks.IsNull() ) |
|
497 { |
|
498 retVal = ( serviceRecord->iIfNetworks.GetL() ).AllocL(); |
|
499 } |
|
500 } |
|
501 break; |
|
502 case ECmIPNetmask: |
|
503 case EWlanIpNetMask: |
|
504 { |
|
505 if ( !serviceRecord->iIpNetmask.IsNull() ) |
|
506 { |
|
507 retVal = ( serviceRecord->iIpNetmask.GetL() ).AllocL(); |
|
508 } |
|
509 } |
|
510 break; |
|
511 case ECmIPGateway: |
|
512 case EWlanIpGateway: |
|
513 { |
|
514 if ( !serviceRecord->iIpGateway.IsNull() ) |
|
515 { |
|
516 retVal = ( serviceRecord->iIpGateway.GetL() ).AllocL(); |
|
517 } |
|
518 } |
|
519 break; |
|
520 case ECmIPAddress: |
|
521 case EWlanIpAddr: |
|
522 { |
|
523 if ( !serviceRecord->iIpAddr.IsNull() ) |
|
524 { |
|
525 retVal = ( serviceRecord->iIpAddr.GetL() ).AllocL(); |
|
526 } |
|
527 } |
|
528 break; |
|
529 case ECmIPNameServer1: |
|
530 case EWlanIpNameServer1: |
|
531 { |
|
532 if ( !serviceRecord->iIpNameServer1.IsNull() ) |
|
533 { |
|
534 retVal = ( serviceRecord->iIpNameServer1.GetL() ).AllocL(); |
|
535 } |
|
536 } |
|
537 break; |
|
538 case ECmIPNameServer2: |
|
539 case EWlanIpNameServer2: |
|
540 { |
|
541 if ( !serviceRecord->iIpNameServer2.IsNull() ) |
|
542 { |
|
543 retVal = ( serviceRecord->iIpNameServer2.GetL() ).AllocL(); |
|
544 } |
|
545 } |
|
546 break; |
|
547 case ECmIP6NameServer1: |
|
548 case EWlanIp6NameServer1: |
|
549 { |
|
550 if ( !serviceRecord->iIp6NameServer1.IsNull() ) |
|
551 { |
|
552 retVal = ( serviceRecord->iIp6NameServer1.GetL() ).AllocL(); |
|
553 } |
|
554 } |
|
555 break; |
|
556 case ECmIP6NameServer2: |
|
557 case EWlanIp6NameServer2: |
|
558 { |
|
559 if ( !serviceRecord->iIp6NameServer2.IsNull() ) |
|
560 { |
|
561 retVal = ( serviceRecord->iIp6NameServer2.GetL() ).AllocL(); |
|
562 } |
|
563 } |
|
564 break; |
|
565 case ECmIPAddrLeaseValidFrom: |
|
566 case EWlanIpAddrLeaseValidFrom: |
|
567 { |
|
568 if ( !serviceRecord->iIpAddrLeaseValidFrom.IsNull() ) |
|
569 { |
|
570 retVal = ( serviceRecord->iIpAddrLeaseValidFrom.GetL() ).AllocL(); |
|
571 } |
|
572 } |
|
573 break; |
|
574 case ECmIPAddrLeaseValidTo: |
|
575 case EWlanIpAddrLeaseValidTo: |
|
576 { |
|
577 if ( !serviceRecord->iIpAddrLeaseValidTo.IsNull() ) |
|
578 { |
|
579 retVal = ( serviceRecord->iIpAddrLeaseValidTo.GetL() ).AllocL(); |
|
580 } |
|
581 } |
|
582 break; |
|
583 case ECmConfigDaemonManagerName: |
|
584 case EWlanConfigDaemonManagerName: |
|
585 { |
|
586 if ( !serviceRecord->iConfigDaemonManagerName.IsNull() ) |
|
587 { |
|
588 retVal = ( serviceRecord->iConfigDaemonManagerName.GetL() ).AllocL(); |
|
589 } |
|
590 } |
|
591 break; |
|
592 case ECmConfigDaemonName: |
|
593 case EWlanConfigDaemonName: |
|
594 { |
|
595 if ( !serviceRecord->iConfigDaemonName.IsNull() ) |
|
596 { |
|
597 retVal = ( serviceRecord->iConfigDaemonName.GetL() ).AllocL(); |
|
598 } |
|
599 } |
|
600 break; |
|
601 case EWlanServiceExtensionTableName: |
|
602 { |
|
603 if ( !serviceRecord->iServiceExtensionTableName.IsNull() ) |
|
604 { |
|
605 retVal = ( serviceRecord->iServiceExtensionTableName.GetL() ).AllocL(); |
|
606 } |
|
607 } |
|
608 break; |
|
609 case EWlanSSID: |
|
610 { |
|
611 if ( !wlanServiceRecord->iWLanSSID.IsNull() ) |
|
612 { |
|
613 retVal = ( wlanServiceRecord->iWLanSSID.GetL() ).AllocL(); |
|
614 } |
|
615 } |
|
616 break; |
|
617 case EWlanUsedSSID: |
|
618 { |
|
619 if ( !wlanServiceRecord->iWLanUsedSSID.IsNull() ) |
|
620 { |
|
621 retVal = ( wlanServiceRecord->iWLanUsedSSID.GetL() ).AllocL(); |
|
622 } |
|
623 } |
|
624 break; |
|
625 default: |
|
626 { |
|
627 User::Leave( KErrNotSupported ); |
|
628 } |
|
629 break; |
|
630 } |
|
631 |
|
632 OstTraceFunctionExit0( CCMPLUGINWLAN_GETBEARERSTRINGATTRIBUTEL_EXIT ); |
|
633 return retVal; |
|
634 } |
|
635 |
|
636 // -------------------------------------------------------------------------- |
|
637 // CCmPluginWlan::GetBearerString8AttributeL |
|
638 // -------------------------------------------------------------------------- |
|
639 // |
|
640 HBufC8* CCmPluginWlan::GetBearerString8AttributeL( |
|
641 TUint32 aAttribute, |
|
642 RPointerArray<CommsDat::CCDRecordBase>& /*aGenRecordArray*/, |
|
643 RPointerArray<CommsDat::CCDRecordBase>& aBearerSpecRecordArray ) |
|
644 { |
|
645 OstTraceFunctionEntry0( CCMPLUGINWLAN_GETBEARERSTRING8ATTRIBUTEL_ENTRY ); |
|
646 |
|
647 HBufC8* retVal( NULL ); |
|
648 |
|
649 CCDWlanServiceRecord* wlanServiceRecord = |
|
650 static_cast<CCDWlanServiceRecord*>( |
|
651 aBearerSpecRecordArray[KWlanServiceRecordIndex] ); |
|
652 |
|
653 switch ( aAttribute ) |
|
654 { |
|
655 case EWlanWpaPreSharedKey: |
|
656 { |
|
657 if ( !wlanServiceRecord->iWLanWpaPreSharedKey.IsNull() ) |
|
658 { |
|
659 retVal = ( wlanServiceRecord->iWLanWpaPreSharedKey.GetL() ).AllocL(); |
|
660 } |
|
661 } |
|
662 break; |
|
663 case EWlanWepKey1InHex: |
|
664 { |
|
665 if ( !wlanServiceRecord->iWlanFormatKey1.IsNull() && |
|
666 !wlanServiceRecord->iWLanWepKey1.IsNull() ) |
|
667 { |
|
668 if ( wlanServiceRecord->iWlanFormatKey1 == EWlanWepKeyFormatAscii ) |
|
669 { |
|
670 // Format is ascii. |
|
671 retVal = ConvertAsciiToHexL( wlanServiceRecord->iWLanWepKey1.GetL() ); |
|
672 } |
|
673 else |
|
674 { |
|
675 // Format is hex. |
|
676 retVal = ( wlanServiceRecord->iWLanWepKey1.GetL() ).AllocL(); |
|
677 } |
|
678 } |
|
679 } |
|
680 break; |
|
681 case EWlanWepKey2InHex: |
|
682 { |
|
683 if ( !wlanServiceRecord->iWlanFormatKey2.IsNull() && |
|
684 !wlanServiceRecord->iWLanWepKey2.IsNull() ) |
|
685 { |
|
686 if ( wlanServiceRecord->iWlanFormatKey2 == EWlanWepKeyFormatAscii ) |
|
687 { |
|
688 // Format is ascii. |
|
689 retVal = ConvertAsciiToHexL( wlanServiceRecord->iWLanWepKey2.GetL() ); |
|
690 } |
|
691 else |
|
692 { |
|
693 // Format is hex. |
|
694 retVal = ( wlanServiceRecord->iWLanWepKey2.GetL() ).AllocL(); |
|
695 } |
|
696 } |
|
697 } |
|
698 break; |
|
699 case EWlanWepKey3InHex: |
|
700 { |
|
701 if ( !wlanServiceRecord->iWlanFormatKey3.IsNull() && |
|
702 !wlanServiceRecord->iWLanWepKey3.IsNull() ) |
|
703 { |
|
704 if ( wlanServiceRecord->iWlanFormatKey3 == EWlanWepKeyFormatAscii ) |
|
705 { |
|
706 // Format is ascii. |
|
707 retVal = ConvertAsciiToHexL( wlanServiceRecord->iWLanWepKey3.GetL() ); |
|
708 } |
|
709 else |
|
710 { |
|
711 // Format is hex. |
|
712 retVal = ( wlanServiceRecord->iWLanWepKey3.GetL() ).AllocL(); |
|
713 } |
|
714 } |
|
715 } |
|
716 break; |
|
717 case EWlanWepKey4InHex: |
|
718 { |
|
719 if ( !wlanServiceRecord->iWlanFormatKey4.IsNull() && |
|
720 !wlanServiceRecord->iWLanWepKey4.IsNull() ) |
|
721 { |
|
722 if ( wlanServiceRecord->iWlanFormatKey4 == EWlanWepKeyFormatAscii ) |
|
723 { |
|
724 // Format is ascii. |
|
725 retVal = ConvertAsciiToHexL( wlanServiceRecord->iWLanWepKey4.GetL() ); |
|
726 } |
|
727 else |
|
728 { |
|
729 // Format is hex. |
|
730 retVal = ( wlanServiceRecord->iWLanWepKey4.GetL() ).AllocL(); |
|
731 } |
|
732 } |
|
733 } |
|
734 break; |
|
735 case EWlanWepKey1InAscii: |
|
736 { |
|
737 if ( !wlanServiceRecord->iWlanFormatKey1.IsNull() && |
|
738 !wlanServiceRecord->iWLanWepKey1.IsNull() ) |
|
739 { |
|
740 if ( wlanServiceRecord->iWlanFormatKey1 == EWlanWepKeyFormatAscii ) |
|
741 { |
|
742 // Format is ascii. |
|
743 retVal = ( wlanServiceRecord->iWLanWepKey1.GetL() ).AllocL(); |
|
744 } |
|
745 else |
|
746 { |
|
747 // Format is hex. |
|
748 retVal = ConvertHexToAsciiL( wlanServiceRecord->iWLanWepKey1.GetL() ); |
|
749 } |
|
750 } |
|
751 } |
|
752 break; |
|
753 case EWlanWepKey2InAscii: |
|
754 { |
|
755 if ( !wlanServiceRecord->iWlanFormatKey2.IsNull() && |
|
756 !wlanServiceRecord->iWLanWepKey2.IsNull() ) |
|
757 { |
|
758 if ( wlanServiceRecord->iWlanFormatKey2 == EWlanWepKeyFormatAscii ) |
|
759 { |
|
760 // Format is ascii. |
|
761 retVal = ( wlanServiceRecord->iWLanWepKey2.GetL() ).AllocL(); |
|
762 } |
|
763 else |
|
764 { |
|
765 // Format is hex. |
|
766 retVal = ConvertHexToAsciiL( wlanServiceRecord->iWLanWepKey2.GetL() ); |
|
767 } |
|
768 } |
|
769 } |
|
770 break; |
|
771 case EWlanWepKey3InAscii: |
|
772 { |
|
773 if ( !wlanServiceRecord->iWlanFormatKey3.IsNull() && |
|
774 !wlanServiceRecord->iWLanWepKey3.IsNull() ) |
|
775 { |
|
776 if ( wlanServiceRecord->iWlanFormatKey3 == EWlanWepKeyFormatAscii ) |
|
777 { |
|
778 // Format is ascii. |
|
779 retVal = ( wlanServiceRecord->iWLanWepKey3.GetL() ).AllocL(); |
|
780 } |
|
781 else |
|
782 { |
|
783 // Format is hex. |
|
784 retVal = ConvertHexToAsciiL( wlanServiceRecord->iWLanWepKey3.GetL() ); |
|
785 } |
|
786 } |
|
787 } |
|
788 break; |
|
789 case EWlanWepKey4InAscii: |
|
790 { |
|
791 if ( !wlanServiceRecord->iWlanFormatKey4.IsNull() && |
|
792 !wlanServiceRecord->iWLanWepKey4.IsNull() ) |
|
793 { |
|
794 if ( wlanServiceRecord->iWlanFormatKey4 == EWlanWepKeyFormatAscii ) |
|
795 { |
|
796 // Format is ascii. |
|
797 retVal = ( wlanServiceRecord->iWLanWepKey4.GetL() ).AllocL(); |
|
798 } |
|
799 else |
|
800 { |
|
801 // Format is hex. |
|
802 retVal = ConvertHexToAsciiL( wlanServiceRecord->iWLanWepKey4.GetL() ); |
|
803 } |
|
804 } |
|
805 } |
|
806 break; |
|
807 case EWlanWapiPsk: |
|
808 { |
|
809 if ( !wlanServiceRecord->iWLanWpaPreSharedKey.IsNull() ) |
|
810 { |
|
811 retVal = ( wlanServiceRecord->iWLanWpaPreSharedKey.GetL() ).AllocL(); |
|
812 } |
|
813 } |
|
814 break; |
|
815 |
|
816 default: |
|
817 { |
|
818 User::Leave( KErrNotSupported ); |
|
819 } |
|
820 break; |
|
821 } |
|
822 |
|
823 OstTraceFunctionExit0( CCMPLUGINWLAN_GETBEARERSTRING8ATTRIBUTEL_EXIT ); |
|
824 return retVal; |
|
825 } |
|
826 |
|
827 // -------------------------------------------------------------------------- |
|
828 // CCmPluginWlan::SetBearerIntAttributeL |
|
829 // -------------------------------------------------------------------------- |
|
830 // |
|
831 void CCmPluginWlan::SetBearerIntAttributeL( |
|
832 TUint32 aAttribute, |
|
833 TUint32 aValue, |
|
834 RPointerArray<CommsDat::CCDRecordBase>& aGenRecordArray, |
|
835 RPointerArray<CommsDat::CCDRecordBase>& aBearerSpecRecordArray ) |
|
836 { |
|
837 OstTraceFunctionEntry0( CCMPLUGINWLAN_SETBEARERINTATTRIBUTEL_ENTRY ); |
|
838 |
|
839 CCDLANServiceRecord* serviceRecord = |
|
840 static_cast<CCDLANServiceRecord*>( |
|
841 aGenRecordArray[KServiceRecordIndex] ); |
|
842 |
|
843 CCDWlanServiceRecord* wlanServiceRecord = |
|
844 static_cast<CCDWlanServiceRecord*>( |
|
845 aBearerSpecRecordArray[KWlanServiceRecordIndex] ); |
|
846 |
|
847 switch ( aAttribute ) |
|
848 { |
|
849 case ECmExtensionLevel: |
|
850 case ECmCommsDBBearerType: |
|
851 case ECmDefaultUiPriority: |
|
852 case ECmDefaultPriority: |
|
853 { |
|
854 User::Leave( KErrArgument ); |
|
855 } |
|
856 break; |
|
857 case EWlanServiceId: |
|
858 { |
|
859 wlanServiceRecord->iWlanServiceId.SetL( aValue ); |
|
860 } |
|
861 break; |
|
862 case EWlanConnectionMode: |
|
863 { |
|
864 wlanServiceRecord->iWlanConnMode.SetL( aValue ); |
|
865 } |
|
866 break; |
|
867 case EWlanSecurityMode: |
|
868 { |
|
869 CheckSecurityAttributeValidityL( aAttribute, aValue ); |
|
870 wlanServiceRecord->iWlanSecMode.SetL( aValue ); |
|
871 // When setting security mode, also reset authentication mode to open. |
|
872 wlanServiceRecord->iWlanAuthMode.SetL( CMManager::EWlanAuthModeOpen ); |
|
873 if ( aValue == EWlanSecMode802_1x ) |
|
874 { |
|
875 // By default, do not allow unencrypted mode for 802.1x (Korea). |
|
876 wlanServiceRecord->iWlanWpaKeyLength.SetL( 0 ); |
|
877 } |
|
878 } |
|
879 break; |
|
880 case EWlanAuthenticationMode: |
|
881 { |
|
882 CheckSecurityAttributeValidityL( aAttribute, aValue ); |
|
883 wlanServiceRecord->iWlanAuthMode.SetL( aValue ); |
|
884 } |
|
885 break; |
|
886 case EWlanChannelID: |
|
887 { |
|
888 wlanServiceRecord->iWlanChannelID.SetL( aValue ); |
|
889 } |
|
890 break; |
|
891 case EWlanServiceExtensionTableRecordId: |
|
892 { |
|
893 serviceRecord->iServiceExtensionTableRecordId.SetL( aValue ); |
|
894 } |
|
895 break; |
|
896 case EWlanWepKeyIndex: |
|
897 { |
|
898 CheckSecurityAttributeValidityL( aAttribute, aValue ); |
|
899 wlanServiceRecord->iWlanWepIndex.SetL( aValue ); |
|
900 } |
|
901 break; |
|
902 case EWlanWapiPskFormat: |
|
903 { |
|
904 CheckSecurityAttributeValidityL( aAttribute, aValue ); |
|
905 wlanServiceRecord->iWlanFormatKey1.SetL( aValue ); |
|
906 } |
|
907 break; |
|
908 default: |
|
909 { |
|
910 User::Leave( KErrNotSupported ); |
|
911 } |
|
912 break; |
|
913 } |
|
914 |
|
915 OstTraceFunctionExit0( CCMPLUGINWLAN_SETBEARERINTATTRIBUTEL_EXIT ); |
|
916 } |
|
917 |
|
918 // -------------------------------------------------------------------------- |
|
919 // CCmPluginWlan::SetBearerBoolAttributeL |
|
920 // -------------------------------------------------------------------------- |
|
921 // |
|
922 void CCmPluginWlan::SetBearerBoolAttributeL( |
|
923 TUint32 aAttribute, |
|
924 TBool aValue, |
|
925 RPointerArray<CommsDat::CCDRecordBase>& aGenRecordArray, |
|
926 RPointerArray<CommsDat::CCDRecordBase>& aBearerSpecRecordArray ) |
|
927 { |
|
928 OstTraceFunctionEntry0( CCMPLUGINWLAN_SETBEARERBOOLATTRIBUTEL_ENTRY ); |
|
929 |
|
930 CCDWlanServiceRecord* wlanServiceRecord = |
|
931 static_cast<CCDWlanServiceRecord*>( |
|
932 aBearerSpecRecordArray[KWlanServiceRecordIndex] ); |
|
933 |
|
934 CCDLANServiceRecord* serviceRecord = |
|
935 static_cast<CCDLANServiceRecord*>( |
|
936 aGenRecordArray[KServiceRecordIndex] ); |
|
937 |
|
938 switch ( aAttribute ) |
|
939 { |
|
940 case EWlanScanSSID: |
|
941 { |
|
942 wlanServiceRecord->iWlanScanSSID.SetL( aValue ); |
|
943 } |
|
944 break; |
|
945 case EWlanAllowSSIDRoaming: |
|
946 { |
|
947 wlanServiceRecord->iWlanAllowSSIDRoaming.SetL( aValue ); |
|
948 } |
|
949 break; |
|
950 case ECmIPAddFromServer: |
|
951 case EWlanIpAddrFromServer: |
|
952 { |
|
953 serviceRecord->iIpAddrFromServer.SetL( aValue ); |
|
954 } |
|
955 break; |
|
956 case ECmIPDNSAddrFromServer: |
|
957 case EWlanIpDNSAddrFromServer: |
|
958 { |
|
959 serviceRecord->iIpDnsAddrFromServer.SetL( aValue ); |
|
960 } |
|
961 break; |
|
962 case ECmIP6DNSAddrFromServer: |
|
963 case EWlanIp6DNSAddrFromServer: |
|
964 { |
|
965 serviceRecord->iIp6DnsAddrFromServer.SetL( aValue ); |
|
966 } |
|
967 break; |
|
968 case EWlanEnableWpaPsk: |
|
969 { |
|
970 wlanServiceRecord->iWlanEnableWpaPsk.SetL( static_cast<TUint>( aValue ) ); |
|
971 } |
|
972 break; |
|
973 case EWlan802_1xAllowUnencrypted: |
|
974 { |
|
975 wlanServiceRecord->iWlanWpaKeyLength.SetL( static_cast<TUint>( aValue ) ); |
|
976 } |
|
977 break; |
|
978 default: |
|
979 { |
|
980 User::Leave( KErrNotSupported ); |
|
981 } |
|
982 break; |
|
983 } |
|
984 |
|
985 OstTraceFunctionExit0( CCMPLUGINWLAN_SETBEARERBOOLATTRIBUTEL_EXIT ); |
|
986 } |
|
987 |
|
988 // -------------------------------------------------------------------------- |
|
989 // CCmPluginWlan::SetBearerStringAttributeL |
|
990 // -------------------------------------------------------------------------- |
|
991 // |
|
992 void CCmPluginWlan::SetBearerStringAttributeL( |
|
993 TUint32 aAttribute, |
|
994 const TDesC16& aValue, |
|
995 RPointerArray<CommsDat::CCDRecordBase>& aGenRecordArray, |
|
996 RPointerArray<CommsDat::CCDRecordBase>& aBearerSpecRecordArray ) |
|
997 { |
|
998 OstTraceFunctionEntry0( CCMPLUGINWLAN_SETBEARERSTRINGATTRIBUTEL_ENTRY ); |
|
999 |
|
1000 CCDWlanServiceRecord* wlanServiceRecord = |
|
1001 static_cast<CCDWlanServiceRecord*>( |
|
1002 aBearerSpecRecordArray[KWlanServiceRecordIndex] ); |
|
1003 |
|
1004 CCDLANServiceRecord* serviceRecord = |
|
1005 static_cast<CCDLANServiceRecord*>( |
|
1006 aGenRecordArray[KServiceRecordIndex] ); |
|
1007 |
|
1008 switch ( aAttribute ) |
|
1009 { |
|
1010 case ECmIFNetworks: |
|
1011 case EWlanIfNetworks: |
|
1012 { |
|
1013 serviceRecord->iIfNetworks.SetL( aValue ); |
|
1014 } |
|
1015 break; |
|
1016 case ECmIPNetmask: |
|
1017 case EWlanIpNetMask: |
|
1018 { |
|
1019 serviceRecord->iIpNetmask.SetL( aValue ); |
|
1020 } |
|
1021 break; |
|
1022 case ECmIPGateway: |
|
1023 case EWlanIpGateway: |
|
1024 { |
|
1025 serviceRecord->iIpGateway.SetL( aValue ); |
|
1026 } |
|
1027 break; |
|
1028 case ECmIPAddress: |
|
1029 case EWlanIpAddr: |
|
1030 { |
|
1031 if ( ( aValue.Compare( KUnspecifiedIPv4 ) == 0 ) || |
|
1032 ( aValue.Compare( KNullDesC ) == 0 ) ) |
|
1033 { |
|
1034 // If unspecified or NULL address is set dynamic |
|
1035 // IP must be enabled. |
|
1036 SetBearerBoolAttributeL( EWlanIpAddrFromServer, |
|
1037 ETrue, |
|
1038 aGenRecordArray, |
|
1039 aBearerSpecRecordArray ); |
|
1040 } |
|
1041 else |
|
1042 { |
|
1043 // If valid address is set dynamic IP is disabled. |
|
1044 SetBearerBoolAttributeL( EWlanIpAddrFromServer, |
|
1045 EFalse, |
|
1046 aGenRecordArray, |
|
1047 aBearerSpecRecordArray ); |
|
1048 } |
|
1049 serviceRecord->iIpAddr.SetL( aValue ); |
|
1050 } |
|
1051 break; |
|
1052 case ECmIPNameServer1: |
|
1053 case EWlanIpNameServer1: |
|
1054 { |
|
1055 serviceRecord->iIpNameServer1.SetL( aValue ); |
|
1056 } |
|
1057 break; |
|
1058 case ECmIPNameServer2: |
|
1059 case EWlanIpNameServer2: |
|
1060 { |
|
1061 serviceRecord->iIpNameServer2.SetL( aValue ); |
|
1062 } |
|
1063 break; |
|
1064 case ECmIP6NameServer1: |
|
1065 case EWlanIp6NameServer1: |
|
1066 { |
|
1067 serviceRecord->iIp6NameServer1.SetL( aValue ); |
|
1068 } |
|
1069 break; |
|
1070 case ECmIP6NameServer2: |
|
1071 case EWlanIp6NameServer2: |
|
1072 { |
|
1073 serviceRecord->iIp6NameServer2.SetL( aValue ); |
|
1074 } |
|
1075 break; |
|
1076 case ECmIPAddrLeaseValidFrom: |
|
1077 case EWlanIpAddrLeaseValidFrom: |
|
1078 { |
|
1079 serviceRecord->iIpAddrLeaseValidFrom.SetL( aValue ); |
|
1080 } |
|
1081 break; |
|
1082 case ECmIPAddrLeaseValidTo: |
|
1083 case EWlanIpAddrLeaseValidTo: |
|
1084 { |
|
1085 serviceRecord->iIpAddrLeaseValidTo.SetL( aValue ); |
|
1086 } |
|
1087 break; |
|
1088 case ECmConfigDaemonManagerName: |
|
1089 case EWlanConfigDaemonManagerName: |
|
1090 { |
|
1091 serviceRecord->iConfigDaemonManagerName.SetL( aValue ); |
|
1092 } |
|
1093 break; |
|
1094 case ECmConfigDaemonName: |
|
1095 case EWlanConfigDaemonName: |
|
1096 { |
|
1097 serviceRecord->iConfigDaemonName.SetL( aValue ); |
|
1098 } |
|
1099 break; |
|
1100 case EWlanServiceExtensionTableName: |
|
1101 { |
|
1102 serviceRecord->iServiceExtensionTableName.SetL( aValue ); |
|
1103 } |
|
1104 break; |
|
1105 case EWlanSSID: |
|
1106 { |
|
1107 wlanServiceRecord->iWLanSSID.SetL( aValue ); |
|
1108 } |
|
1109 break; |
|
1110 case EWlanUsedSSID: |
|
1111 { |
|
1112 wlanServiceRecord->iWLanUsedSSID.SetL( aValue ); |
|
1113 } |
|
1114 break; |
|
1115 default: |
|
1116 { |
|
1117 User::Leave( KErrNotSupported ); |
|
1118 } |
|
1119 break; |
|
1120 } |
|
1121 |
|
1122 OstTraceFunctionExit0( CCMPLUGINWLAN_SETBEARERSTRINGATTRIBUTEL_EXIT ); |
|
1123 } |
|
1124 |
|
1125 // -------------------------------------------------------------------------- |
|
1126 // CCmPluginWlan::SetBearerString8AttributeL |
|
1127 // -------------------------------------------------------------------------- |
|
1128 // |
|
1129 void CCmPluginWlan::SetBearerString8AttributeL( |
|
1130 TUint32 aAttribute, |
|
1131 const TDesC8& aValue, |
|
1132 RPointerArray<CommsDat::CCDRecordBase>& /*aGenRecordArray*/, |
|
1133 RPointerArray<CommsDat::CCDRecordBase>& aBearerSpecRecordArray ) |
|
1134 { |
|
1135 OstTraceFunctionEntry0( CCMPLUGINWLAN_SETBEARERSTRING8ATTRIBUTEL_ENTRY ); |
|
1136 |
|
1137 CCDWlanServiceRecord* wlanServiceRecord = |
|
1138 static_cast<CCDWlanServiceRecord*>( |
|
1139 aBearerSpecRecordArray[KWlanServiceRecordIndex] ); |
|
1140 |
|
1141 switch ( aAttribute ) |
|
1142 { |
|
1143 case EWlanWpaPreSharedKey: |
|
1144 { |
|
1145 wlanServiceRecord->iWLanWpaPreSharedKey.SetL( aValue ); |
|
1146 wlanServiceRecord->iWlanWpaKeyLength.SetL( static_cast<TUint>( aValue.Length() ) ); |
|
1147 } |
|
1148 break; |
|
1149 case EWlanWepKey1InHex: |
|
1150 { |
|
1151 wlanServiceRecord->iWLanWepKey1.SetL( aValue ); |
|
1152 wlanServiceRecord->iWlanFormatKey1.SetL( EWlanWepKeyFormatHex ); |
|
1153 } |
|
1154 break; |
|
1155 case EWlanWepKey2InHex: |
|
1156 { |
|
1157 wlanServiceRecord->iWLanWepKey2.SetL( aValue ); |
|
1158 wlanServiceRecord->iWlanFormatKey2.SetL( EWlanWepKeyFormatHex ); |
|
1159 } |
|
1160 break; |
|
1161 case EWlanWepKey3InHex: |
|
1162 { |
|
1163 wlanServiceRecord->iWLanWepKey3.SetL( aValue ); |
|
1164 wlanServiceRecord->iWlanFormatKey3.SetL( EWlanWepKeyFormatHex ); |
|
1165 } |
|
1166 break; |
|
1167 case EWlanWepKey4InHex: |
|
1168 { |
|
1169 wlanServiceRecord->iWLanWepKey4.SetL( aValue ); |
|
1170 wlanServiceRecord->iWlanFormatKey4.SetL( EWlanWepKeyFormatHex ); |
|
1171 } |
|
1172 break; |
|
1173 case EWlanWepKey1InAscii: |
|
1174 { |
|
1175 HBufC8* valueInHex = ConvertAsciiToHexL( aValue ); |
|
1176 CleanupStack::PushL( valueInHex ); |
|
1177 wlanServiceRecord->iWLanWepKey1.SetL( *valueInHex ); |
|
1178 wlanServiceRecord->iWlanFormatKey1.SetL( EWlanWepKeyFormatHex ); |
|
1179 CleanupStack::PopAndDestroy( valueInHex ); |
|
1180 } |
|
1181 break; |
|
1182 case EWlanWepKey2InAscii: |
|
1183 { |
|
1184 HBufC8* valueInHex = ConvertAsciiToHexL( aValue ); |
|
1185 CleanupStack::PushL( valueInHex ); |
|
1186 wlanServiceRecord->iWLanWepKey2.SetL( *valueInHex ); |
|
1187 wlanServiceRecord->iWlanFormatKey2.SetL( EWlanWepKeyFormatHex ); |
|
1188 CleanupStack::PopAndDestroy( valueInHex ); |
|
1189 } |
|
1190 break; |
|
1191 case EWlanWepKey3InAscii: |
|
1192 { |
|
1193 HBufC8* valueInHex = ConvertAsciiToHexL( aValue ); |
|
1194 CleanupStack::PushL( valueInHex ); |
|
1195 wlanServiceRecord->iWLanWepKey3.SetL( *valueInHex ); |
|
1196 wlanServiceRecord->iWlanFormatKey3.SetL( EWlanWepKeyFormatHex ); |
|
1197 CleanupStack::PopAndDestroy( valueInHex ); |
|
1198 } |
|
1199 break; |
|
1200 case EWlanWepKey4InAscii: |
|
1201 { |
|
1202 HBufC8* valueInHex = ConvertAsciiToHexL( aValue ); |
|
1203 CleanupStack::PushL( valueInHex ); |
|
1204 wlanServiceRecord->iWLanWepKey4.SetL( *valueInHex ); |
|
1205 wlanServiceRecord->iWlanFormatKey4.SetL( EWlanWepKeyFormatHex ); |
|
1206 CleanupStack::PopAndDestroy( valueInHex ); |
|
1207 } |
|
1208 break; |
|
1209 case EWlanWapiPsk: |
|
1210 { |
|
1211 wlanServiceRecord->iWLanWpaPreSharedKey.SetL( aValue ); |
|
1212 } |
|
1213 break; |
|
1214 |
|
1215 default: |
|
1216 { |
|
1217 User::Leave( KErrNotSupported ); |
|
1218 } |
|
1219 break; |
|
1220 } |
|
1221 |
|
1222 OstTraceFunctionExit0( CCMPLUGINWLAN_SETBEARERSTRING8ATTRIBUTEL_EXIT ); |
|
1223 } |
|
1224 |
|
1225 // -------------------------------------------------------------------------- |
|
1226 // CCmPluginWlan::CanHandleIapIdL |
|
1227 // -------------------------------------------------------------------------- |
|
1228 // |
|
1229 TBool CCmPluginWlan::CanHandleIapIdL( TUint32 aIapId ) const |
|
1230 { |
|
1231 OstTraceFunctionEntry0( CCMPLUGINWLAN_CANHANDLEIAPIDL_ENTRY ); |
|
1232 |
|
1233 TBool retVal( EFalse ); |
|
1234 |
|
1235 CCDIAPRecord *iapRecord = static_cast<CCDIAPRecord *> |
|
1236 ( CCDRecordBase::RecordFactoryL(KCDTIdIAPRecord) ); |
|
1237 |
|
1238 CleanupStack::PushL( iapRecord ); |
|
1239 iapRecord->SetRecordId( aIapId ); |
|
1240 |
|
1241 TRAPD( err, iapRecord->LoadL( iSession ) ); |
|
1242 |
|
1243 if ( !err ) |
|
1244 { |
|
1245 retVal = CanHandleIapIdL( iapRecord ); |
|
1246 } |
|
1247 |
|
1248 CleanupStack::PopAndDestroy( iapRecord ); |
|
1249 |
|
1250 OstTraceFunctionExit0( CCMPLUGINWLAN_CANHANDLEIAPIDL_EXIT ); |
|
1251 return retVal; |
|
1252 } |
|
1253 |
|
1254 // -------------------------------------------------------------------------- |
|
1255 // CCmPluginWlan::CanHandleIapIdL |
|
1256 // -------------------------------------------------------------------------- |
|
1257 // |
|
1258 TBool CCmPluginWlan::CanHandleIapIdL( CCDIAPRecord *aIapRecord ) const |
|
1259 { |
|
1260 OstTraceFunctionEntry0( DUP1_CCMPLUGINWLAN_CANHANDLEIAPIDL_ENTRY ); |
|
1261 |
|
1262 TBool retVal( EFalse ); |
|
1263 |
|
1264 if ( (TPtrC(aIapRecord->iServiceType) == TPtrC(KCDTypeNameLANService) ) && |
|
1265 TPtrC(aIapRecord->iBearerType) == TPtrC(KCDTypeNameLANBearer) ) |
|
1266 { |
|
1267 // Check if there is a WLAN record with an iServiceId == iIapRecord->iService. |
|
1268 CCDWlanServiceRecord* tmprec = new( ELeave ) CCDWlanServiceRecord ( iWlanTableId ); |
|
1269 CleanupStack::PushL( tmprec ); |
|
1270 |
|
1271 TInt service = aIapRecord->iService; |
|
1272 |
|
1273 tmprec->iWlanServiceId.SetL( (TUint32)service ); |
|
1274 if ( tmprec->FindL( iSession ) ) |
|
1275 { |
|
1276 // we found at least one WLAN using this IAP, |
|
1277 retVal = ETrue; |
|
1278 } |
|
1279 |
|
1280 CleanupStack::PopAndDestroy(tmprec); |
|
1281 } |
|
1282 |
|
1283 OstTraceFunctionExit0( DUP1_CCMPLUGINWLAN_CANHANDLEIAPIDL_EXIT ); |
|
1284 return retVal; |
|
1285 } |
|
1286 |
|
1287 // -------------------------------------------------------------------------- |
|
1288 // CCmPluginWlan::DeleteBearerRecordsL |
|
1289 // -------------------------------------------------------------------------- |
|
1290 // |
|
1291 void CCmPluginWlan::DeleteBearerRecordsL() |
|
1292 { |
|
1293 OstTraceFunctionEntry0( CCMPLUGINWLAN_DELETEBEARERRECORDSL_ENTRY ); |
|
1294 |
|
1295 // as base class deletes service record, in this case LAN, |
|
1296 // only WLAN related stuff needs to be deleted |
|
1297 iWlanServiceRecord->DeleteL( iSession ); |
|
1298 iWlanServiceRecord = NULL; |
|
1299 |
|
1300 OstTraceFunctionExit0( CCMPLUGINWLAN_DELETEBEARERRECORDSL_EXIT ); |
|
1301 } |
|
1302 |
|
1303 // -------------------------------------------------------------------------- |
|
1304 // CCmPluginWlan::LoadServiceRecordL |
|
1305 // -------------------------------------------------------------------------- |
|
1306 // |
|
1307 void CCmPluginWlan::LoadServiceRecordL() |
|
1308 { |
|
1309 OstTraceFunctionEntry0( CCMPLUGINWLAN_LOADSERVICERECORDL_ENTRY ); |
|
1310 |
|
1311 if ( TPtrC( KCDTypeNameLANService ) == iIapRecord->iServiceType ) |
|
1312 { |
|
1313 iServiceRecord = static_cast<CCDLANServiceRecord *> |
|
1314 ( CCDRecordBase::RecordFactoryL( KCDTIdLANServiceRecord ) ); |
|
1315 |
|
1316 ServiceRecord().SetRecordId( iIapRecord->iService ); |
|
1317 ServiceRecord().LoadL( iSession ); |
|
1318 } |
|
1319 else |
|
1320 // this IAP service is not supported by this plugin. |
|
1321 { |
|
1322 User::Leave( KErrNotSupported ); |
|
1323 } |
|
1324 |
|
1325 OstTraceFunctionExit0( CCMPLUGINWLAN_LOADSERVICERECORDL_EXIT ); |
|
1326 } |
|
1327 |
|
1328 // -------------------------------------------------------------------------- |
|
1329 // CCmPluginWlan::LoadBearerRecordsL |
|
1330 // -------------------------------------------------------------------------- |
|
1331 // |
|
1332 void CCmPluginWlan::LoadBearerRecordsL() |
|
1333 { |
|
1334 OstTraceFunctionEntry0( CCMPLUGINWLAN_LOADBEARERRECORDSL_ENTRY ); |
|
1335 |
|
1336 if ( !iWlanServiceRecord ) |
|
1337 { |
|
1338 iWlanServiceRecord = new( ELeave ) CCDWlanServiceRecord ( iWlanTableId ); |
|
1339 } |
|
1340 iWlanServiceRecord->SetRecordId( 0 ); |
|
1341 |
|
1342 iWlanServiceRecord->iWlanServiceId.SetL( ( TUint32 )( iIapRecord->iService ) ); |
|
1343 |
|
1344 if ( iWlanServiceRecord->FindL( iSession ) ) |
|
1345 { |
|
1346 iWlanServiceRecord->LoadL( iSession ); |
|
1347 } |
|
1348 else |
|
1349 { |
|
1350 // not found -> error |
|
1351 User::Leave( KErrNotFound ); |
|
1352 } |
|
1353 |
|
1354 OstTraceFunctionExit0( CCMPLUGINWLAN_LOADBEARERRECORDSL_EXIT ); |
|
1355 } |
|
1356 |
|
1357 // -------------------------------------------------------------------------- |
|
1358 // CCmPluginWlan::CreateServiceRecordL |
|
1359 // -------------------------------------------------------------------------- |
|
1360 // |
|
1361 void CCmPluginWlan::CreateServiceRecordL() |
|
1362 { |
|
1363 OstTraceFunctionEntry0( CCMPLUGINWLAN_CREATESERVICERECORDL_ENTRY ); |
|
1364 |
|
1365 delete iServiceRecord; |
|
1366 iServiceRecord = NULL; |
|
1367 |
|
1368 iServiceRecord = static_cast<CCDLANServiceRecord*> |
|
1369 (CCDRecordBase::RecordFactoryL( KCDTIdLANServiceRecord ) ); |
|
1370 |
|
1371 CCDLANServiceRecord* lanServiceRecord = static_cast<CCDLANServiceRecord *>( iServiceRecord ); |
|
1372 |
|
1373 |
|
1374 if ( FeatureManager::FeatureSupported( KFeatureIdIPv6 ) ) |
|
1375 { |
|
1376 lanServiceRecord->iIfNetworks.SetL( KDefIspIfNetworksIPv4IPv6 ); |
|
1377 } |
|
1378 else |
|
1379 { |
|
1380 lanServiceRecord->iIfNetworks.SetL( KDefIspIfNetworksIPv4 ); |
|
1381 } |
|
1382 |
|
1383 lanServiceRecord->iIpGateway.SetL( KUnspecifiedIPv4 ); |
|
1384 lanServiceRecord->iIpAddrFromServer.SetL( KDefIpAddrFromServer ); |
|
1385 |
|
1386 lanServiceRecord->iIpAddr.SetL( KUnspecifiedIPv4 ); |
|
1387 |
|
1388 lanServiceRecord->iIpDnsAddrFromServer.SetL( KDefIpDnsAddrFromServer ); |
|
1389 |
|
1390 lanServiceRecord->iIpNameServer1.SetL( KUnspecifiedIPv4 ); |
|
1391 lanServiceRecord->iIpNameServer2.SetL( KUnspecifiedIPv4 ); |
|
1392 lanServiceRecord->iIp6DnsAddrFromServer.SetL( KDefIp6DnsAddrFromServer ); |
|
1393 lanServiceRecord->iIp6NameServer1.SetL( KDynamicIpv6Address ); |
|
1394 lanServiceRecord->iIp6NameServer2.SetL( KDynamicIpv6Address ); |
|
1395 |
|
1396 if ( KDefIpAddrFromServer ) |
|
1397 { |
|
1398 lanServiceRecord->iConfigDaemonManagerName.SetL( KDaemonManagerName ); |
|
1399 lanServiceRecord->iConfigDaemonName.SetL( KConfigDaemonName ); |
|
1400 } |
|
1401 else |
|
1402 { |
|
1403 lanServiceRecord->iConfigDaemonManagerName.SetL( KEmpty ); |
|
1404 lanServiceRecord->iConfigDaemonName.SetL( KEmpty ); |
|
1405 } |
|
1406 |
|
1407 // create WLAN service record |
|
1408 CreateWlanServiceRecordL(); |
|
1409 |
|
1410 OstTraceFunctionExit0( CCMPLUGINWLAN_CREATESERVICERECORDL_EXIT ); |
|
1411 } |
|
1412 |
|
1413 // -------------------------------------------------------------------------- |
|
1414 // CCmPluginWlan::CreateWlanServiceRecordL |
|
1415 // -------------------------------------------------------------------------- |
|
1416 // |
|
1417 void CCmPluginWlan::CreateWlanServiceRecordL() |
|
1418 { |
|
1419 OstTraceFunctionEntry0( CCMPLUGINWLAN_CREATEWLANSERVICERECORDL_ENTRY ); |
|
1420 |
|
1421 delete iWlanServiceRecord; |
|
1422 |
|
1423 iWlanServiceRecord = NULL; |
|
1424 |
|
1425 iWlanServiceRecord = new( ELeave ) CCDWlanServiceRecord ( iWlanTableId ); |
|
1426 iWlanServiceRecord->SetRecordId( KCDNewRecordRequest ); |
|
1427 |
|
1428 iWlanServiceRecord->iRecordName.SetL( iIapRecord->iRecordName ); |
|
1429 iWlanServiceRecord->iWlanConnMode.SetL( CMManager::EInfra ); |
|
1430 iWlanServiceRecord->iWlanSecMode.SetL( CMManager::EWlanSecModeOpen ); |
|
1431 iWlanServiceRecord->iWlanScanSSID.SetL( EFalse ); |
|
1432 |
|
1433 OstTraceFunctionExit0( CCMPLUGINWLAN_CREATEWLANSERVICERECORDL_EXIT ); |
|
1434 } |
|
1435 |
|
1436 // ---------------------------------------------------------------------------- |
|
1437 // CCmPluginWlan::PreparePluginToUpdateRecordsL() |
|
1438 // ---------------------------------------------------------------------------- |
|
1439 // |
|
1440 void CCmPluginWlan::PreparePluginToLoadRecordsL() |
|
1441 { |
|
1442 OstTraceFunctionEntry0( CCMPLUGINWLAN_PREPAREPLUGINTOLOADRECORDSL_ENTRY ); |
|
1443 |
|
1444 OstTraceFunctionExit0( CCMPLUGINWLAN_PREPAREPLUGINTOLOADRECORDSL_EXIT ); |
|
1445 } |
|
1446 |
|
1447 // ---------------------------------------------------------------------------- |
|
1448 // CCmPluginWlan::PreparePluginToUpdateRecordsL() |
|
1449 // ---------------------------------------------------------------------------- |
|
1450 // |
|
1451 void CCmPluginWlan::PreparePluginToUpdateRecordsL( |
|
1452 RPointerArray<CommsDat::CCDRecordBase>& aGenRecordArray, |
|
1453 RPointerArray<CommsDat::CCDRecordBase>& aBearerSpecRecordArray ) |
|
1454 { |
|
1455 OstTraceFunctionEntry0( CCMPLUGINWLAN_PREPAREPLUGINTOUPDATERECORDSL_ENTRY ); |
|
1456 |
|
1457 CCDWlanServiceRecord* wlanServiceRecord = |
|
1458 static_cast<CCDWlanServiceRecord*>( |
|
1459 aBearerSpecRecordArray[KWlanServiceRecordIndex] ); |
|
1460 |
|
1461 CCDIAPRecord* iapRecord = |
|
1462 static_cast<CCDIAPRecord*>( |
|
1463 aGenRecordArray[KIapRecordIndex] ); |
|
1464 |
|
1465 CheckIfNameModifiedL( iapRecord, wlanServiceRecord ); |
|
1466 wlanServiceRecord->iWlanServiceId.SetL( iapRecord->iService ); |
|
1467 |
|
1468 CCDLANServiceRecord* serviceRecord = |
|
1469 static_cast<CCDLANServiceRecord*>( |
|
1470 aGenRecordArray[KServiceRecordIndex] ); |
|
1471 |
|
1472 CheckIfNameModifiedL( iapRecord, serviceRecord ); |
|
1473 |
|
1474 CheckDNSServerAddressL( ETrue, |
|
1475 serviceRecord->iIp6NameServer1, |
|
1476 serviceRecord->iIp6NameServer2, |
|
1477 serviceRecord->iIp6DnsAddrFromServer ); |
|
1478 |
|
1479 CheckDNSServerAddressL( EFalse, |
|
1480 serviceRecord->iIpNameServer1, |
|
1481 serviceRecord->iIpNameServer2, |
|
1482 serviceRecord->iIpDnsAddrFromServer ); |
|
1483 |
|
1484 SetDaemonNameL( aGenRecordArray, aBearerSpecRecordArray ); |
|
1485 |
|
1486 OstTraceFunctionExit0( CCMPLUGINWLAN_PREPAREPLUGINTOUPDATERECORDSL_EXIT ); |
|
1487 } |
|
1488 |
|
1489 // ---------------------------------------------------------------------------- |
|
1490 // CCmPluginWlan::UpdateServiceRecordL() |
|
1491 // ---------------------------------------------------------------------------- |
|
1492 // |
|
1493 void CCmPluginWlan::UpdateServiceRecordL( |
|
1494 RPointerArray<CommsDat::CCDRecordBase>& aGenRecordArray, |
|
1495 RPointerArray<CommsDat::CCDRecordBase>& aBearerSpecRecordArray ) |
|
1496 { |
|
1497 OstTraceFunctionEntry0( CCMPLUGINWLAN_UPDATESERVICERECORDL_ENTRY ); |
|
1498 |
|
1499 // Delete the original record and create a copy from the parameter |
|
1500 delete iServiceRecord; |
|
1501 iServiceRecord = NULL; |
|
1502 |
|
1503 iServiceRecord = static_cast<CCDLANServiceRecord*> |
|
1504 (CCDRecordBase::RecordFactoryL( KCDTIdLANServiceRecord ) ); |
|
1505 |
|
1506 // LAN Service copy does not work so we have to copy it manually |
|
1507 |
|
1508 CCDLANServiceRecord* lanServiceRecordTo = |
|
1509 static_cast<CCDLANServiceRecord *>( |
|
1510 iServiceRecord ); |
|
1511 |
|
1512 CCDLANServiceRecord* lanServiceRecordFrom = |
|
1513 static_cast<CCDLANServiceRecord *>( |
|
1514 aGenRecordArray[KServiceRecordIndex] ); |
|
1515 |
|
1516 if ( !lanServiceRecordFrom->iRecordName.IsNull() ) |
|
1517 { |
|
1518 lanServiceRecordTo->iRecordName.SetL( lanServiceRecordFrom->iRecordName ); |
|
1519 } |
|
1520 if ( !lanServiceRecordFrom->iIfNetworks.IsNull() ) |
|
1521 { |
|
1522 lanServiceRecordTo->iIfNetworks.SetL( lanServiceRecordFrom->iIfNetworks ); |
|
1523 } |
|
1524 if ( !lanServiceRecordFrom->iIpGateway.IsNull() ) |
|
1525 { |
|
1526 lanServiceRecordTo->iIpGateway.SetL( lanServiceRecordFrom->iIpGateway ); |
|
1527 } |
|
1528 if ( !lanServiceRecordFrom->iIpAddrFromServer.IsNull() ) |
|
1529 { |
|
1530 lanServiceRecordTo->iIpAddrFromServer.SetL( lanServiceRecordFrom->iIpAddrFromServer ); |
|
1531 } |
|
1532 if ( !lanServiceRecordFrom->iIpAddr.IsNull() ) |
|
1533 { |
|
1534 lanServiceRecordTo->iIpAddr.SetL( lanServiceRecordFrom->iIpAddr ); |
|
1535 } |
|
1536 if ( !lanServiceRecordFrom->iIpDnsAddrFromServer.IsNull() ) |
|
1537 { |
|
1538 lanServiceRecordTo->iIpDnsAddrFromServer.SetL( lanServiceRecordFrom->iIpDnsAddrFromServer ); |
|
1539 } |
|
1540 if ( !lanServiceRecordFrom->iIpNameServer1.IsNull() ) |
|
1541 { |
|
1542 lanServiceRecordTo->iIpNameServer1.SetL( lanServiceRecordFrom->iIpNameServer1 ); |
|
1543 } |
|
1544 if ( !lanServiceRecordFrom->iIpNameServer2.IsNull() ) |
|
1545 { |
|
1546 lanServiceRecordTo->iIpNameServer2.SetL( lanServiceRecordFrom->iIpNameServer2 ); |
|
1547 } |
|
1548 if ( !lanServiceRecordFrom->iIp6DnsAddrFromServer.IsNull() ) |
|
1549 { |
|
1550 lanServiceRecordTo->iIp6DnsAddrFromServer.SetL( lanServiceRecordFrom->iIp6DnsAddrFromServer ); |
|
1551 } |
|
1552 if ( !lanServiceRecordFrom->iIp6NameServer1.IsNull() ) |
|
1553 { |
|
1554 lanServiceRecordTo->iIp6NameServer1.SetL( lanServiceRecordFrom->iIp6NameServer1 ); |
|
1555 } |
|
1556 if ( !lanServiceRecordFrom->iIp6NameServer2.IsNull() ) |
|
1557 { |
|
1558 lanServiceRecordTo->iIp6NameServer2.SetL( lanServiceRecordFrom->iIp6NameServer2 ); |
|
1559 } |
|
1560 if ( !lanServiceRecordFrom->iConfigDaemonManagerName.IsNull() ) |
|
1561 { |
|
1562 lanServiceRecordTo->iConfigDaemonManagerName.SetL( lanServiceRecordFrom->iConfigDaemonManagerName ); |
|
1563 } |
|
1564 if ( !lanServiceRecordFrom->iConfigDaemonName.IsNull() ) |
|
1565 { |
|
1566 lanServiceRecordTo->iConfigDaemonName.SetL( lanServiceRecordFrom->iConfigDaemonName ); |
|
1567 } |
|
1568 |
|
1569 lanServiceRecordTo->SetElementId( lanServiceRecordFrom->ElementId() ); |
|
1570 // this is shared between wlan iaps so it cannot be hidden or protected |
|
1571 lanServiceRecordTo->ClearAttributes( ECDHidden ); |
|
1572 lanServiceRecordTo->ClearAttributes( ECDProtectedWrite ); |
|
1573 |
|
1574 if ( !ServiceRecord().RecordId() ) |
|
1575 { |
|
1576 ServiceRecord().SetRecordId( KCDNewRecordRequest ); |
|
1577 ServiceRecord().StoreL( iSession ); |
|
1578 |
|
1579 // Update needed values to record tables too( lanservice and wlanservice ) |
|
1580 lanServiceRecordFrom->SetElementId( ServiceRecord().ElementId() ); |
|
1581 CCDWlanServiceRecord* wlanServiceRecord = |
|
1582 static_cast<CCDWlanServiceRecord *>( |
|
1583 aBearerSpecRecordArray[KWlanServiceRecordIndex] ); |
|
1584 wlanServiceRecord->iWlanServiceId.SetL( ServiceRecord().RecordId() ); |
|
1585 } |
|
1586 else |
|
1587 { |
|
1588 ServiceRecord().ModifyL( iSession ); |
|
1589 } |
|
1590 |
|
1591 OstTraceFunctionExit0( CCMPLUGINWLAN_UPDATESERVICERECORDL_EXIT ); |
|
1592 } |
|
1593 |
|
1594 // ---------------------------------------------------------------------------- |
|
1595 // CCmPluginWlan::UpdateBearerRecordsL() |
|
1596 // ---------------------------------------------------------------------------- |
|
1597 // |
|
1598 void CCmPluginWlan::UpdateBearerRecordsL( |
|
1599 RPointerArray<CommsDat::CCDRecordBase>& /*aGenRecordArray*/, |
|
1600 RPointerArray<CommsDat::CCDRecordBase>& aBearerSpecRecordArray ) |
|
1601 { |
|
1602 OstTraceFunctionEntry0( CCMPLUGINWLAN_UPDATEBEARERRECORDSL_ENTRY ); |
|
1603 |
|
1604 delete iWlanServiceRecord; |
|
1605 iWlanServiceRecord = NULL; |
|
1606 |
|
1607 CCDWlanServiceRecord* wlanServiceRecord = |
|
1608 static_cast<CCDWlanServiceRecord*>( |
|
1609 aBearerSpecRecordArray[KWlanServiceRecordIndex] ); |
|
1610 |
|
1611 iWlanServiceRecord = new( ELeave ) CCDWlanServiceRecord ( iWlanTableId ); |
|
1612 |
|
1613 iWlanServiceRecord->SetElementId( wlanServiceRecord->ElementId() ); |
|
1614 iWlanServiceRecord->iRecordName.SetL( wlanServiceRecord->iRecordName ); |
|
1615 |
|
1616 iWlanServiceRecord->iWlanServiceId.SetL( wlanServiceRecord->iWlanServiceId ); |
|
1617 iWlanServiceRecord->iWlanConnMode.SetL( wlanServiceRecord->iWlanConnMode ); |
|
1618 if ( !wlanServiceRecord->iWLanSSID.IsNull() ) |
|
1619 { |
|
1620 iWlanServiceRecord->iWLanSSID.SetL( wlanServiceRecord->iWLanSSID ); |
|
1621 } |
|
1622 if ( !wlanServiceRecord->iWLanUsedSSID.IsNull() ) |
|
1623 { |
|
1624 iWlanServiceRecord->iWLanUsedSSID.SetL( wlanServiceRecord->iWLanUsedSSID ); |
|
1625 } |
|
1626 if ( !wlanServiceRecord->iWLanWepKey1.IsNull() ) |
|
1627 { |
|
1628 iWlanServiceRecord->iWLanWepKey1.SetL( wlanServiceRecord->iWLanWepKey1 ); |
|
1629 } |
|
1630 if ( !wlanServiceRecord->iWLanWepKey2.IsNull() ) |
|
1631 { |
|
1632 iWlanServiceRecord->iWLanWepKey2.SetL( wlanServiceRecord->iWLanWepKey2 ); |
|
1633 } |
|
1634 if ( !wlanServiceRecord->iWLanWepKey3.IsNull() ) |
|
1635 { |
|
1636 iWlanServiceRecord->iWLanWepKey3.SetL( wlanServiceRecord->iWLanWepKey3 ); |
|
1637 } |
|
1638 if ( !wlanServiceRecord->iWLanWepKey4.IsNull() ) |
|
1639 { |
|
1640 iWlanServiceRecord->iWLanWepKey4.SetL( wlanServiceRecord->iWLanWepKey4 ); |
|
1641 } |
|
1642 if ( !wlanServiceRecord->iWlanWepIndex.IsNull() ) |
|
1643 { |
|
1644 iWlanServiceRecord->iWlanWepIndex.SetL( wlanServiceRecord->iWlanWepIndex ); |
|
1645 } |
|
1646 if ( !wlanServiceRecord->iWlanSecMode.IsNull() ) |
|
1647 { |
|
1648 iWlanServiceRecord->iWlanSecMode.SetL( wlanServiceRecord->iWlanSecMode ); |
|
1649 } |
|
1650 if ( !wlanServiceRecord->iWlanAuthMode.IsNull() ) |
|
1651 { |
|
1652 iWlanServiceRecord->iWlanAuthMode.SetL( wlanServiceRecord->iWlanAuthMode ); |
|
1653 } |
|
1654 if ( !wlanServiceRecord->iWlanEnableWpaPsk.IsNull() ) |
|
1655 { |
|
1656 iWlanServiceRecord->iWlanEnableWpaPsk.SetL( wlanServiceRecord->iWlanEnableWpaPsk ); |
|
1657 } |
|
1658 if ( !wlanServiceRecord->iWLanWpaPreSharedKey.IsNull() ) |
|
1659 { |
|
1660 iWlanServiceRecord->iWLanWpaPreSharedKey.SetL( wlanServiceRecord->iWLanWpaPreSharedKey ); |
|
1661 } |
|
1662 if ( !wlanServiceRecord->iWlanWpaKeyLength.IsNull() ) |
|
1663 { |
|
1664 iWlanServiceRecord->iWlanWpaKeyLength.SetL( wlanServiceRecord->iWlanWpaKeyLength ); |
|
1665 } |
|
1666 if ( !wlanServiceRecord->iWLanEaps.IsNull() ) |
|
1667 { |
|
1668 iWlanServiceRecord->iWLanEaps.SetL( wlanServiceRecord->iWLanEaps ); |
|
1669 } |
|
1670 if ( !wlanServiceRecord->iWlanScanSSID.IsNull() ) |
|
1671 { |
|
1672 iWlanServiceRecord->iWlanScanSSID.SetL( wlanServiceRecord->iWlanScanSSID ); |
|
1673 } |
|
1674 if ( !wlanServiceRecord->iWlanChannelID.IsNull() ) |
|
1675 { |
|
1676 iWlanServiceRecord->iWlanChannelID.SetL( wlanServiceRecord->iWlanChannelID ); |
|
1677 } |
|
1678 if ( !wlanServiceRecord->iWlanFormatKey1.IsNull() ) |
|
1679 { |
|
1680 iWlanServiceRecord->iWlanFormatKey1.SetL( wlanServiceRecord->iWlanFormatKey1 ); |
|
1681 } |
|
1682 if ( !wlanServiceRecord->iWlanFormatKey2.IsNull() ) |
|
1683 { |
|
1684 iWlanServiceRecord->iWlanFormatKey2.SetL( wlanServiceRecord->iWlanFormatKey2 ); |
|
1685 } |
|
1686 if ( !wlanServiceRecord->iWlanFormatKey3.IsNull() ) |
|
1687 { |
|
1688 iWlanServiceRecord->iWlanFormatKey3.SetL( wlanServiceRecord->iWlanFormatKey3 ); |
|
1689 } |
|
1690 if ( !wlanServiceRecord->iWlanFormatKey4.IsNull() ) |
|
1691 { |
|
1692 iWlanServiceRecord->iWlanFormatKey4.SetL( wlanServiceRecord->iWlanFormatKey4 ); |
|
1693 } |
|
1694 if ( !wlanServiceRecord->iWlanAllowSSIDRoaming.IsNull() ) |
|
1695 { |
|
1696 iWlanServiceRecord->iWlanAllowSSIDRoaming.SetL( wlanServiceRecord->iWlanAllowSSIDRoaming ); |
|
1697 } |
|
1698 if ( !wlanServiceRecord->iWLanEnabledEaps.IsNull() ) |
|
1699 { |
|
1700 iWlanServiceRecord->iWLanEnabledEaps.SetL( wlanServiceRecord->iWLanEnabledEaps ); |
|
1701 } |
|
1702 if ( !wlanServiceRecord->iWLanDisabledEaps.IsNull() ) |
|
1703 { |
|
1704 iWlanServiceRecord->iWLanDisabledEaps.SetL( wlanServiceRecord->iWLanDisabledEaps ); |
|
1705 } |
|
1706 |
|
1707 if ( !iWlanServiceRecord->RecordId() ) |
|
1708 { |
|
1709 iWlanServiceRecord->SetRecordId( KCDNewRecordRequest ); |
|
1710 iWlanServiceRecord->StoreL( iSession ); |
|
1711 wlanServiceRecord->SetElementId( iWlanServiceRecord->ElementId() ); |
|
1712 } |
|
1713 else |
|
1714 { |
|
1715 iWlanServiceRecord->ModifyL( iSession ); |
|
1716 } |
|
1717 |
|
1718 OstTraceFunctionExit0( CCMPLUGINWLAN_UPDATEBEARERRECORDSL_EXIT ); |
|
1719 } |
|
1720 |
|
1721 // --------------------------------------------------------------------------- |
|
1722 // CCmPluginWlan::GetBearerSpecificRecordsL |
|
1723 // --------------------------------------------------------------------------- |
|
1724 // |
|
1725 void CCmPluginWlan::GetBearerSpecificRecordsL( |
|
1726 RPointerArray<CommsDat::CCDRecordBase>& aRecordArray ) |
|
1727 { |
|
1728 OstTraceFunctionEntry0( CCMPLUGINWLAN_GETBEARERSPECIFICRECORDSL_ENTRY ); |
|
1729 |
|
1730 if ( !iWlanServiceRecord ) |
|
1731 { |
|
1732 // IAP not yet in CommDat |
|
1733 GetDefaultWlanServiceRecordL( aRecordArray ); |
|
1734 } |
|
1735 else |
|
1736 { |
|
1737 CCDWlanServiceRecord* wlanServiceRecord = new( ELeave ) CCDWlanServiceRecord ( iWlanTableId ); |
|
1738 CleanupStack::PushL( wlanServiceRecord ); |
|
1739 CopyWlanServiceRecordL( iWlanServiceRecord, wlanServiceRecord ); |
|
1740 wlanServiceRecord->SetElementId( iWlanServiceRecord->ElementId() ); |
|
1741 wlanServiceRecord->iWlanServiceId.SetL( iWlanServiceRecord->iWlanServiceId ); |
|
1742 aRecordArray.AppendL( wlanServiceRecord ); |
|
1743 CleanupStack::Pop( wlanServiceRecord ); |
|
1744 } |
|
1745 |
|
1746 OstTraceFunctionExit0( CCMPLUGINWLAN_GETBEARERSPECIFICRECORDSL_EXIT ); |
|
1747 } |
|
1748 |
|
1749 // --------------------------------------------------------------------------- |
|
1750 // CCmPluginWlan::CopyServiceRecordL |
|
1751 // --------------------------------------------------------------------------- |
|
1752 // |
|
1753 CommsDat::CCDRecordBase* CCmPluginWlan::CopyServiceRecordL() |
|
1754 { |
|
1755 OstTraceFunctionEntry0( CCMPLUGINWLAN_COPYSERVICERECORDL_ENTRY ); |
|
1756 |
|
1757 __ASSERT_DEBUG( iServiceRecord != NULL, User::Leave( KErrNotFound )); |
|
1758 |
|
1759 CCDRecordBase* serviceRecord = |
|
1760 static_cast<CCDLANServiceRecord*>( |
|
1761 CCDRecordBase::CreateCopyRecordL( *iServiceRecord ) ); |
|
1762 |
|
1763 OstTraceFunctionExit0( CCMPLUGINWLAN_COPYSERVICERECORDL_EXIT ); |
|
1764 return serviceRecord; |
|
1765 } |
|
1766 |
|
1767 // ---------------------------------------------------------------------------- |
|
1768 // CCmPluginWlan::CheckNetworkCoverageL() |
|
1769 // ---------------------------------------------------------------------------- |
|
1770 // |
|
1771 TBool CCmPluginWlan::CheckNetworkCoverageL() const |
|
1772 { |
|
1773 OstTraceFunctionEntry0( CCMPLUGINWLAN_CHECKNETWORKCOVERAGEL_ENTRY ); |
|
1774 |
|
1775 #ifdef __WINS__ |
|
1776 OstTraceFunctionExit0( CCMPLUGINWLAN_CHECKNETWORKCOVERAGEL_EXIT ); |
|
1777 |
|
1778 return ETrue; |
|
1779 #else |
|
1780 CCmWlanCoverageCheck* coverage = new (ELeave) CCmWlanCoverageCheck; |
|
1781 CleanupStack::PushL( coverage ); |
|
1782 |
|
1783 TBool retVal( EFalse ); |
|
1784 retVal = coverage->GetCoverageL(); |
|
1785 |
|
1786 CleanupStack::PopAndDestroy( coverage ); |
|
1787 |
|
1788 OstTraceFunctionExit0( DUP1_CCMPLUGINWLAN_CHECKNETWORKCOVERAGEL_EXIT ); |
|
1789 |
|
1790 return retVal; |
|
1791 #endif // __WINS |
|
1792 } |
|
1793 |
|
1794 // --------------------------------------------------------------------------- |
|
1795 // CCmPluginWlan::SetDaemonNameL |
|
1796 // --------------------------------------------------------------------------- |
|
1797 // |
|
1798 void CCmPluginWlan::SetDaemonNameL( |
|
1799 RPointerArray<CommsDat::CCDRecordBase>& aGenRecordArray, |
|
1800 RPointerArray<CommsDat::CCDRecordBase>& aBearerSpecRecordArray ) |
|
1801 { |
|
1802 OstTraceFunctionEntry0( CCMPLUGINWLAN_SETDAEMONNAMEL_ENTRY ); |
|
1803 |
|
1804 // we have to check first that these values has not been |
|
1805 // set(or changed) by any 3rd party sw to ensure that |
|
1806 // we don't break their settings |
|
1807 HBufC* daemonName = GetBearerStringAttributeL( ECmConfigDaemonManagerName, |
|
1808 aGenRecordArray, |
|
1809 aBearerSpecRecordArray ); |
|
1810 if ( daemonName ) |
|
1811 { |
|
1812 if ( daemonName->Compare( KDaemonManagerName ) != 0 ) |
|
1813 { |
|
1814 delete daemonName; |
|
1815 |
|
1816 OstTraceFunctionExit0( CCMPLUGINWLAN_SETDAEMONNAMEL_EXIT ); |
|
1817 |
|
1818 return; |
|
1819 } |
|
1820 delete daemonName; |
|
1821 } |
|
1822 |
|
1823 // use DHCP if we can |
|
1824 TBool ipfromSrv = GetBearerBoolAttributeL( ECmIPAddFromServer, |
|
1825 aGenRecordArray, |
|
1826 aBearerSpecRecordArray ); |
|
1827 if ( ipfromSrv ) |
|
1828 { |
|
1829 SetBearerStringAttributeL( ECmConfigDaemonManagerName, |
|
1830 KDaemonManagerName, |
|
1831 aGenRecordArray, |
|
1832 aBearerSpecRecordArray ); |
|
1833 |
|
1834 SetBearerStringAttributeL( ECmConfigDaemonName, |
|
1835 KConfigDaemonName, |
|
1836 aGenRecordArray, |
|
1837 aBearerSpecRecordArray ); |
|
1838 |
|
1839 } |
|
1840 else |
|
1841 { |
|
1842 if ( FeatureManager::FeatureSupported( KFeatureIdIPv6 ) ) |
|
1843 { |
|
1844 SetBearerStringAttributeL( ECmConfigDaemonManagerName, |
|
1845 KDaemonManagerName, |
|
1846 aGenRecordArray, |
|
1847 aBearerSpecRecordArray ); |
|
1848 |
|
1849 SetBearerStringAttributeL( ECmConfigDaemonName, |
|
1850 KConfigDaemonName, |
|
1851 aGenRecordArray, |
|
1852 aBearerSpecRecordArray ); |
|
1853 } |
|
1854 else |
|
1855 { |
|
1856 SetBearerStringAttributeL( ECmConfigDaemonManagerName, |
|
1857 KNullDesC(), |
|
1858 aGenRecordArray, |
|
1859 aBearerSpecRecordArray ); |
|
1860 |
|
1861 SetBearerStringAttributeL( ECmConfigDaemonName, |
|
1862 KNullDesC(), |
|
1863 aGenRecordArray, |
|
1864 aBearerSpecRecordArray ); |
|
1865 } |
|
1866 } |
|
1867 |
|
1868 OstTraceFunctionExit0( DUP1_CCMPLUGINWLAN_SETDAEMONNAMEL_EXIT ); |
|
1869 } |
|
1870 |
|
1871 // --------------------------------------------------------------------------- |
|
1872 // CCmPluginWlan::ResetBearerRecords |
|
1873 // --------------------------------------------------------------------------- |
|
1874 // |
|
1875 void CCmPluginWlan::ResetBearerRecords() |
|
1876 { |
|
1877 OstTraceFunctionEntry0( CCMPLUGINWLAN_RESETBEARERRECORDS_ENTRY ); |
|
1878 |
|
1879 delete iWlanServiceRecord; |
|
1880 iWlanServiceRecord = NULL; |
|
1881 |
|
1882 OstTraceFunctionExit0( CCMPLUGINWLAN_RESETBEARERRECORDS_EXIT ); |
|
1883 } |
|
1884 |
|
1885 // --------------------------------------------------------------------------- |
|
1886 // CCmPluginWlan::CopyWlanServiceRecordL |
|
1887 // --------------------------------------------------------------------------- |
|
1888 // |
|
1889 void CCmPluginWlan::CopyWlanServiceRecordL( |
|
1890 CCDWlanServiceRecord* aSourceRecord, |
|
1891 CCDWlanServiceRecord* aDestRecord ) |
|
1892 { |
|
1893 OstTraceFunctionEntry0( CCMPLUGINWLAN_COPYWLANSERVICERECORDL_ENTRY ); |
|
1894 |
|
1895 if ( !( aSourceRecord && aDestRecord ) ) |
|
1896 { |
|
1897 User::Leave( KErrArgument ); |
|
1898 } |
|
1899 |
|
1900 aDestRecord->iRecordName.SetL( aSourceRecord->iRecordName ); |
|
1901 aDestRecord->iRecordTag.SetL( aSourceRecord->iRecordTag ); |
|
1902 aDestRecord->iWlanConnMode.SetL( aSourceRecord->iWlanConnMode ); |
|
1903 |
|
1904 if ( !aSourceRecord->iWLanSSID.IsNull() ) |
|
1905 { |
|
1906 aDestRecord->iWLanSSID.SetL( aSourceRecord->iWLanSSID ); |
|
1907 } |
|
1908 if ( !aSourceRecord->iWLanUsedSSID.IsNull() ) |
|
1909 { |
|
1910 aDestRecord->iWLanUsedSSID.SetL( aSourceRecord->iWLanUsedSSID ); |
|
1911 } |
|
1912 if ( !aSourceRecord->iWLanWepKey1.IsNull() ) |
|
1913 { |
|
1914 aDestRecord->iWLanWepKey1.SetL( aSourceRecord->iWLanWepKey1 ); |
|
1915 } |
|
1916 if ( !aSourceRecord->iWLanWepKey2.IsNull() ) |
|
1917 { |
|
1918 aDestRecord->iWLanWepKey2.SetL( aSourceRecord->iWLanWepKey2 ); |
|
1919 } |
|
1920 if ( !aSourceRecord->iWLanWepKey3.IsNull() ) |
|
1921 { |
|
1922 aDestRecord->iWLanWepKey3.SetL( aSourceRecord->iWLanWepKey3 ); |
|
1923 } |
|
1924 if ( !aSourceRecord->iWLanWepKey4.IsNull() ) |
|
1925 { |
|
1926 aDestRecord->iWLanWepKey4.SetL( aSourceRecord->iWLanWepKey4 ); |
|
1927 } |
|
1928 if ( !aSourceRecord->iWlanWepIndex.IsNull() ) |
|
1929 { |
|
1930 aDestRecord->iWlanWepIndex.SetL( aSourceRecord->iWlanWepIndex ); |
|
1931 } |
|
1932 if ( !aSourceRecord->iWlanSecMode.IsNull() ) |
|
1933 { |
|
1934 aDestRecord->iWlanSecMode.SetL( aSourceRecord->iWlanSecMode ); |
|
1935 } |
|
1936 if ( !aSourceRecord->iWlanAuthMode.IsNull() ) |
|
1937 { |
|
1938 aDestRecord->iWlanAuthMode.SetL( aSourceRecord->iWlanAuthMode ); |
|
1939 } |
|
1940 if ( !aSourceRecord->iWlanEnableWpaPsk.IsNull() ) |
|
1941 { |
|
1942 aDestRecord->iWlanEnableWpaPsk.SetL( aSourceRecord->iWlanEnableWpaPsk ); |
|
1943 } |
|
1944 if ( !aSourceRecord->iWLanWpaPreSharedKey.IsNull() ) |
|
1945 { |
|
1946 aDestRecord->iWLanWpaPreSharedKey.SetL( aSourceRecord->iWLanWpaPreSharedKey ); |
|
1947 } |
|
1948 if ( !aSourceRecord->iWlanWpaKeyLength.IsNull() ) |
|
1949 { |
|
1950 aDestRecord->iWlanWpaKeyLength.SetL( aSourceRecord->iWlanWpaKeyLength ); |
|
1951 } |
|
1952 if ( !aSourceRecord->iWLanEaps.IsNull() ) |
|
1953 { |
|
1954 aDestRecord->iWLanEaps.SetL( aSourceRecord->iWLanEaps ); |
|
1955 } |
|
1956 if ( !aSourceRecord->iWlanScanSSID.IsNull() ) |
|
1957 { |
|
1958 aDestRecord->iWlanScanSSID.SetL( aSourceRecord->iWlanScanSSID ); |
|
1959 } |
|
1960 if ( !aSourceRecord->iWlanChannelID.IsNull() ) |
|
1961 { |
|
1962 aDestRecord->iWlanChannelID.SetL( aSourceRecord->iWlanChannelID ); |
|
1963 } |
|
1964 if ( !aSourceRecord->iWlanFormatKey1.IsNull() ) |
|
1965 { |
|
1966 aDestRecord->iWlanFormatKey1.SetL( aSourceRecord->iWlanFormatKey1 ); |
|
1967 } |
|
1968 if ( !aSourceRecord->iWlanFormatKey2.IsNull() ) |
|
1969 { |
|
1970 aDestRecord->iWlanFormatKey2.SetL( aSourceRecord->iWlanFormatKey2 ); |
|
1971 } |
|
1972 if ( !aSourceRecord->iWlanFormatKey3.IsNull() ) |
|
1973 { |
|
1974 aDestRecord->iWlanFormatKey3.SetL( aSourceRecord->iWlanFormatKey3 ); |
|
1975 } |
|
1976 if ( !aSourceRecord->iWlanFormatKey4.IsNull() ) |
|
1977 { |
|
1978 aDestRecord->iWlanFormatKey4.SetL( aSourceRecord->iWlanFormatKey4 ); |
|
1979 } |
|
1980 if ( !aSourceRecord->iWlanAllowSSIDRoaming.IsNull() ) |
|
1981 { |
|
1982 aDestRecord->iWlanAllowSSIDRoaming.SetL( aSourceRecord->iWlanAllowSSIDRoaming ); |
|
1983 } |
|
1984 if ( !aSourceRecord->iWLanEnabledEaps.IsNull() ) |
|
1985 { |
|
1986 aDestRecord->iWLanEnabledEaps.SetL( aSourceRecord->iWLanEnabledEaps ); |
|
1987 } |
|
1988 if ( !aSourceRecord->iWLanDisabledEaps.IsNull() ) |
|
1989 { |
|
1990 aDestRecord->iWLanDisabledEaps.SetL( aSourceRecord->iWLanDisabledEaps ); |
|
1991 } |
|
1992 |
|
1993 OstTraceFunctionExit0( CCMPLUGINWLAN_COPYWLANSERVICERECORDL_EXIT ); |
|
1994 } |
|
1995 |
|
1996 // --------------------------------------------------------------------------- |
|
1997 // CCmPluginWlan::GetDefaultWlanServiceRecordL |
|
1998 // --------------------------------------------------------------------------- |
|
1999 // |
|
2000 void CCmPluginWlan::GetDefaultWlanServiceRecordL( |
|
2001 RPointerArray<CommsDat::CCDRecordBase>& aRecordArray ) |
|
2002 { |
|
2003 OstTraceFunctionEntry0( CCMPLUGINWLAN_GETDEFAULTWLANSERVICERECORDL_ENTRY ); |
|
2004 |
|
2005 CCDWlanServiceRecord* wlanServiceRecord = new( ELeave ) CCDWlanServiceRecord ( iWlanTableId ); |
|
2006 CleanupStack::PushL( wlanServiceRecord ); |
|
2007 |
|
2008 wlanServiceRecord->SetRecordId( KCDNewRecordRequest ); |
|
2009 |
|
2010 wlanServiceRecord->iRecordTag.SetL( 1 ); |
|
2011 wlanServiceRecord->iRecordName.SetL( iIapRecord->iRecordName ); |
|
2012 wlanServiceRecord->iWlanConnMode.SetL( CMManager::EInfra ); |
|
2013 wlanServiceRecord->iWlanSecMode.SetL( CMManager::EWlanSecModeOpen ); |
|
2014 wlanServiceRecord->iWlanScanSSID.SetL( EFalse ); |
|
2015 |
|
2016 aRecordArray.AppendL( wlanServiceRecord ); |
|
2017 |
|
2018 CleanupStack::Pop( wlanServiceRecord ); |
|
2019 |
|
2020 OstTraceFunctionExit0( CCMPLUGINWLAN_GETDEFAULTWLANSERVICERECORDL_EXIT ); |
|
2021 } |
|
2022 |
|
2023 // --------------------------------------------------------------------------- |
|
2024 // CCmPluginWlan::GetBearerInfoIntL |
|
2025 // --------------------------------------------------------------------------- |
|
2026 // |
|
2027 TUint32 CCmPluginWlan::GetBearerInfoIntL( TUint32 aAttribute ) const |
|
2028 { |
|
2029 OstTraceFunctionEntry0( CCMPLUGINWLAN_GETBEARERINFOINTL_ENTRY ); |
|
2030 |
|
2031 TUint32 retVal( 0 ); |
|
2032 switch ( aAttribute ) |
|
2033 { |
|
2034 case ECmBearerType: |
|
2035 { |
|
2036 retVal = iBearerType; |
|
2037 } |
|
2038 break; |
|
2039 case ECmCommsDBBearerType: |
|
2040 { |
|
2041 retVal = KCommDbBearerWLAN; |
|
2042 } |
|
2043 break; |
|
2044 case ECmDefaultUiPriority: |
|
2045 case ECmDefaultPriority: |
|
2046 { |
|
2047 retVal = KDefaultPriorityWLan; |
|
2048 } |
|
2049 break; |
|
2050 case ECmExtensionLevel: |
|
2051 { |
|
2052 // This is extension from LAN plugin. |
|
2053 retVal = KExtensionBaseLevel + 1; |
|
2054 } |
|
2055 break; |
|
2056 case ECmSeamlessnessLevel: |
|
2057 { |
|
2058 retVal = ESeamlessnessShowprogress; |
|
2059 } |
|
2060 break; |
|
2061 default: |
|
2062 { |
|
2063 User::Leave( KErrNotSupported ); |
|
2064 } |
|
2065 break; |
|
2066 } |
|
2067 |
|
2068 OstTraceFunctionExit0( CCMPLUGINWLAN_GETBEARERINFOINTL_EXIT ); |
|
2069 return retVal; |
|
2070 } |
|
2071 |
|
2072 // --------------------------------------------------------------------------- |
|
2073 // CCmPluginWlan::GetBearerInfoBoolL |
|
2074 // --------------------------------------------------------------------------- |
|
2075 // |
|
2076 TBool CCmPluginWlan::GetBearerInfoBoolL( TUint32 aAttribute ) const |
|
2077 { |
|
2078 OstTraceFunctionEntry0( CCMPLUGINWLAN_GETBEARERINFOBOOLL_ENTRY ); |
|
2079 |
|
2080 TBool retVal( EFalse ); |
|
2081 |
|
2082 switch ( aAttribute ) |
|
2083 { |
|
2084 case ECmCoverage: |
|
2085 { |
|
2086 #ifndef __WINS__ |
|
2087 retVal = CheckNetworkCoverageL(); |
|
2088 #else |
|
2089 retVal = ETrue; |
|
2090 #endif |
|
2091 } |
|
2092 break; |
|
2093 case ECmDestination: |
|
2094 { |
|
2095 retVal = EFalse; |
|
2096 } |
|
2097 break; |
|
2098 case ECmBearerHasUi: |
|
2099 { |
|
2100 retVal = EFalse; |
|
2101 } |
|
2102 break; |
|
2103 case ECmIPv6Supported: |
|
2104 { |
|
2105 retVal = FeatureManager::FeatureSupported( KFeatureIdIPv6 ); |
|
2106 } |
|
2107 break; |
|
2108 case ECmVirtual: |
|
2109 { |
|
2110 retVal = EFalse; |
|
2111 } |
|
2112 break; |
|
2113 default: |
|
2114 { |
|
2115 User::Leave( KErrNotSupported ); |
|
2116 } |
|
2117 break; |
|
2118 } |
|
2119 |
|
2120 OstTraceFunctionExit0( CCMPLUGINWLAN_GETBEARERINFOBOOLL_EXIT ); |
|
2121 return retVal; |
|
2122 } |
|
2123 |
|
2124 // --------------------------------------------------------------------------- |
|
2125 // CCmPluginWlan::GetBearerInfoStringL |
|
2126 // --------------------------------------------------------------------------- |
|
2127 // |
|
2128 HBufC* CCmPluginWlan::GetBearerInfoStringL( TUint32 aAttribute ) const |
|
2129 { |
|
2130 OstTraceFunctionEntry0( CCMPLUGINWLAN_GETBEARERINFOSTRINGL_ENTRY ); |
|
2131 |
|
2132 HBufC* retVal( NULL ); |
|
2133 switch ( aAttribute ) |
|
2134 { |
|
2135 default: |
|
2136 { |
|
2137 User::Leave( KErrNotSupported ); |
|
2138 } |
|
2139 break; |
|
2140 } |
|
2141 |
|
2142 OstTraceFunctionExit0( CCMPLUGINWLAN_GETBEARERINFOSTRINGL_EXIT ); |
|
2143 return retVal; |
|
2144 } |
|
2145 |
|
2146 // --------------------------------------------------------------------------- |
|
2147 // CCmPluginWlan::GetBearerInfoString8L |
|
2148 // --------------------------------------------------------------------------- |
|
2149 // |
|
2150 HBufC8* CCmPluginWlan::GetBearerInfoString8L( TUint32 aAttribute ) const |
|
2151 { |
|
2152 OstTraceFunctionEntry0( CCMPLUGINWLAN_GETBEARERINFOSTRING8L_ENTRY ); |
|
2153 |
|
2154 HBufC8* retVal( NULL ); |
|
2155 switch ( aAttribute ) |
|
2156 { |
|
2157 default: |
|
2158 { |
|
2159 User::Leave( KErrNotSupported ); |
|
2160 } |
|
2161 break; |
|
2162 } |
|
2163 |
|
2164 OstTraceFunctionExit0( CCMPLUGINWLAN_GETBEARERINFOSTRING8L_EXIT ); |
|
2165 return retVal; |
|
2166 } |
|
2167 |
|
2168 // --------------------------------------------------------------------------- |
|
2169 // CCmPluginWlan::CheckSecurityAttributeValidityL |
|
2170 // --------------------------------------------------------------------------- |
|
2171 // |
|
2172 void CCmPluginWlan::CheckSecurityAttributeValidityL( |
|
2173 const TUint32 aAttribute, |
|
2174 const TUint32 aValue ) |
|
2175 { |
|
2176 OstTraceFunctionEntry0( CCMPLUGINWLAN_CHECKSECURITYATTRIBUTEVALIDITYL_ENTRY ); |
|
2177 |
|
2178 switch ( aAttribute ) |
|
2179 { |
|
2180 case CMManager::EWlanConnectionMode: |
|
2181 { |
|
2182 switch ( aValue ) |
|
2183 { |
|
2184 case CMManager::EAdhoc: |
|
2185 case CMManager::EInfra: |
|
2186 break; |
|
2187 default: |
|
2188 User::Leave( KErrArgument ); |
|
2189 break; |
|
2190 } |
|
2191 } |
|
2192 break; |
|
2193 |
|
2194 case CMManager::EWlanSecurityMode: |
|
2195 { |
|
2196 switch ( aValue ) |
|
2197 { |
|
2198 case CMManager::EWlanSecModeOpen: |
|
2199 case CMManager::EWlanSecModeWep: |
|
2200 case CMManager::EWlanSecMode802_1x: |
|
2201 case CMManager::EWlanSecModeWpa: |
|
2202 case CMManager::EWlanSecModeWpa2: |
|
2203 case CMManager::EWlanSecModeWAPI: |
|
2204 break; |
|
2205 default: |
|
2206 User::Leave( KErrArgument ); |
|
2207 break; |
|
2208 } |
|
2209 } |
|
2210 break; |
|
2211 |
|
2212 case CMManager::EWlanAuthenticationMode: |
|
2213 { |
|
2214 switch ( aValue ) |
|
2215 { |
|
2216 case CMManager::EWlanAuthModeOpen: |
|
2217 case CMManager::EWlanAuthModeShared: |
|
2218 break; |
|
2219 default: |
|
2220 User::Leave( KErrArgument ); |
|
2221 break; |
|
2222 } |
|
2223 } |
|
2224 break; |
|
2225 |
|
2226 case CMManager::EWlanEnableWpaPsk: // Boolean |
|
2227 case CMManager::EWlanWpaPreSharedKey: // Valid values: 0, 1, 8-64 |
|
2228 break; |
|
2229 |
|
2230 case CMManager::EWlanWepKey1InHex: // Length should be 10 or 26. |
|
2231 case CMManager::EWlanWepKey2InHex: |
|
2232 case CMManager::EWlanWepKey3InHex: |
|
2233 case CMManager::EWlanWepKey4InHex: |
|
2234 case CMManager::EWlanWepKey1InAscii: // Length should be 5 or 13. |
|
2235 case CMManager::EWlanWepKey2InAscii: |
|
2236 case CMManager::EWlanWepKey3InAscii: |
|
2237 case CMManager::EWlanWepKey4InAscii: |
|
2238 break; |
|
2239 |
|
2240 case CMManager::EWlanWepKeyIndex: |
|
2241 { |
|
2242 switch ( aValue ) |
|
2243 { |
|
2244 case CMManager::EWepKeyIndex1: |
|
2245 case CMManager::EWepKeyIndex2: |
|
2246 case CMManager::EWepKeyIndex3: |
|
2247 case CMManager::EWepKeyIndex4: |
|
2248 break; |
|
2249 default: |
|
2250 User::Leave( KErrArgument ); |
|
2251 break; |
|
2252 } |
|
2253 } |
|
2254 break; |
|
2255 |
|
2256 case CMManager::EWlanWapiPsk: |
|
2257 break; |
|
2258 |
|
2259 case CMManager::EWlanWapiPskFormat: |
|
2260 { |
|
2261 switch ( aValue ) |
|
2262 { |
|
2263 case CMManager::EWlanWapiPskFormatAscii: |
|
2264 case CMManager::EWlanWapiPskFormatHex: |
|
2265 break; |
|
2266 default: |
|
2267 User::Leave( KErrArgument ); |
|
2268 break; |
|
2269 } |
|
2270 } |
|
2271 break; |
|
2272 |
|
2273 case CMManager::EWlan802_1xAllowUnencrypted: // Boolean |
|
2274 break; |
|
2275 |
|
2276 default: |
|
2277 User::Leave( KErrArgument ); |
|
2278 break; |
|
2279 } |
|
2280 |
|
2281 OstTraceFunctionExit0( CCMPLUGINWLAN_CHECKSECURITYATTRIBUTEVALIDITYL_EXIT ); |
|
2282 } |
|
2283 |
|
2284 // --------------------------------------------------------------------------- |
|
2285 // CCmPluginWlan::CopyBearerRecordsL |
|
2286 // --------------------------------------------------------------------------- |
|
2287 // |
|
2288 void CCmPluginWlan::CopyBearerRecordsL( CCmPluginBaseEng* aCopyInstance ) |
|
2289 { |
|
2290 OstTraceFunctionEntry0( CCMPLUGINWLAN_COPYBEARERRECORDSL_ENTRY ); |
|
2291 |
|
2292 CCmPluginWlan* plugin = static_cast<CCmPluginWlan*>( aCopyInstance ); |
|
2293 plugin->iWlanServiceRecord = new( ELeave ) CCDWlanServiceRecord ( iWlanTableId ); |
|
2294 |
|
2295 CopyWlanServiceRecordL( iWlanServiceRecord, plugin->iWlanServiceRecord ); |
|
2296 plugin->iWAPISupported = iWAPISupported; |
|
2297 |
|
2298 OstTraceFunctionExit0( CCMPLUGINWLAN_COPYBEARERRECORDSL_EXIT ); |
|
2299 } |
|
2300 |
|
2301 // --------------------------------------------------------------------------- |
|
2302 // CCmPluginWlan::PrepareToCopyDataL |
|
2303 // --------------------------------------------------------------------------- |
|
2304 // |
|
2305 void CCmPluginWlan::PrepareToCopyDataL( CCmPluginBaseEng* /*aCopyInstance*/ ) |
|
2306 { |
|
2307 OstTraceFunctionEntry0( CCMPLUGINWLAN_PREPARETOCOPYDATAL_ENTRY ); |
|
2308 |
|
2309 OstTraceFunctionExit0( CCMPLUGINWLAN_PREPARETOCOPYDATAL_EXIT ); |
|
2310 } |
|
2311 |
|
2312 // --------------------------------------------------------------------------- |
|
2313 // CCmPluginWlan::GetBearerTableIdsToBeObserved |
|
2314 // --------------------------------------------------------------------------- |
|
2315 // |
|
2316 void CCmPluginWlan::GetBearerTableIdsToBeObservedL( |
|
2317 RArray<TUint32>& aTableIdArray ) const |
|
2318 { |
|
2319 OstTraceFunctionEntry0( CCMPLUGINWLAN_GETBEARERTABLEIDSTOBEOBSERVEDL_ENTRY ); |
|
2320 |
|
2321 aTableIdArray.AppendL( KCDTIdLANServiceRecord ); |
|
2322 aTableIdArray.AppendL( KCDTIdLANBearerRecord ); |
|
2323 aTableIdArray.AppendL( iWlanTableId ); |
|
2324 |
|
2325 OstTraceFunctionExit0( CCMPLUGINWLAN_GETBEARERTABLEIDSTOBEOBSERVEDL_EXIT ); |
|
2326 } |
|
2327 |
|
2328 // --------------------------------------------------------------------------- |
|
2329 // CCmPluginWlan::ConvertAsciiToHexL |
|
2330 // --------------------------------------------------------------------------- |
|
2331 // |
|
2332 HBufC8* CCmPluginWlan::ConvertAsciiToHexL( const TDesC8& aSource ) |
|
2333 { |
|
2334 // Characters used in hex-format. |
|
2335 _LIT( hex, "0123456789ABCDEF" ); |
|
2336 |
|
2337 // Length of ascii-format source string. |
|
2338 TInt length = aSource.Length(); |
|
2339 //TInt length = aSource.Size(); |
|
2340 |
|
2341 if ( length <= 0 ) |
|
2342 { |
|
2343 HBufC8* result = KNullDesC8().AllocL(); |
|
2344 return result; |
|
2345 } |
|
2346 |
|
2347 HBufC8* result = HBufC8::NewLC( length * 2 ); |
|
2348 TPtr8 ptr = result->Des(); |
|
2349 |
|
2350 // Iterate for each character in ascii-format source string. |
|
2351 for ( TInt i = 0; i < length; i++ ) |
|
2352 { |
|
2353 // Next character in ascii-format source string to be converted. |
|
2354 TText8 ch = aSource[i]; |
|
2355 |
|
2356 // Convert and append the higher 4 bits of the character. |
|
2357 ptr.Append( hex()[ ( ch / 16 ) & 0x0f ] ); |
|
2358 |
|
2359 // Convert and append the lower 4 bits of the character. |
|
2360 ptr.Append( hex()[ ch & 0x0f ] ); |
|
2361 } |
|
2362 |
|
2363 CleanupStack::Pop( result ); |
|
2364 return result; // Ownership is transfered. |
|
2365 } |
|
2366 |
|
2367 // --------------------------------------------------------------------------- |
|
2368 // CCmPluginWlan::ConvertHexToAsciiL |
|
2369 // --------------------------------------------------------------------------- |
|
2370 // |
|
2371 HBufC8* CCmPluginWlan::ConvertHexToAsciiL( const TDesC8& aSource ) |
|
2372 { |
|
2373 // Length of hex-format source string. |
|
2374 TInt length = aSource.Length(); |
|
2375 |
|
2376 if ( length <= 0 ) |
|
2377 { |
|
2378 HBufC8* result = KNullDesC8().AllocL(); |
|
2379 return result; |
|
2380 } |
|
2381 |
|
2382 HBufC8* result = HBufC8::NewLC( ( length + 1 ) / 2 ); |
|
2383 TPtr8 ptr = result->Des(); |
|
2384 |
|
2385 TInt i( 0 ); |
|
2386 TUint8 ch( 0 ); |
|
2387 if ( length % 2 ) |
|
2388 { |
|
2389 ch = ConvertHexCharToNumberL( aSource[i] ); |
|
2390 ptr.Append( ch ); |
|
2391 i++; |
|
2392 } |
|
2393 for ( ; i < length; ) |
|
2394 { |
|
2395 ch = ConvertHexCharToNumberL( aSource[i] ) << 4; |
|
2396 i++; |
|
2397 ch += ConvertHexCharToNumberL( aSource[i] ); |
|
2398 i++; |
|
2399 ptr.Append( ch ); |
|
2400 } |
|
2401 |
|
2402 CleanupStack::Pop( result ); |
|
2403 return result; // Ownership is transfered. |
|
2404 } |
|
2405 |
|
2406 // --------------------------------------------------------------------------- |
|
2407 // CCmPluginWlan::ConvertHexCharToNumberL |
|
2408 // --------------------------------------------------------------------------- |
|
2409 // |
|
2410 TUint8 CCmPluginWlan::ConvertHexCharToNumberL( const TUint8 aHexChar ) |
|
2411 { |
|
2412 TUint8 result( 0 ); |
|
2413 if ( '0' <= aHexChar && aHexChar <= '9' ) |
|
2414 { |
|
2415 result = aHexChar - '0'; |
|
2416 } |
|
2417 else if ( 'a' <= aHexChar && aHexChar <= 'f' ) |
|
2418 { |
|
2419 result = aHexChar - 'a' + 10u; |
|
2420 } |
|
2421 else if ( 'A' <= aHexChar && aHexChar <= 'F' ) |
|
2422 { |
|
2423 result = aHexChar - 'A' + 10u; |
|
2424 } |
|
2425 else |
|
2426 { |
|
2427 User::Leave( KErrArgument ); |
|
2428 } |
|
2429 return result; |
|
2430 } |
|
2431 |
|
2432 // End of File |