|
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 VPN CmManager Plugin interface implementation |
|
16 * |
|
17 * |
|
18 */ |
|
19 |
|
20 |
|
21 // INCLUDE FILES |
|
22 #include <commsdattypesv1_1.h> |
|
23 #include <datamobilitycommsdattypes.h> |
|
24 #include <cmconnectionmethoddef.h> |
|
25 #include <cmpluginvpndef.h> |
|
26 #include <featmgr.h> |
|
27 #include <publicruntimeids.hrh> |
|
28 |
|
29 #include "cmpluginvpn.h" |
|
30 #include "cmmserverdefs.h" |
|
31 #include "OstTraceDefinitions.h" |
|
32 #ifdef OST_TRACE_COMPILER_IN_USE |
|
33 #include "cmpluginvpnTraces.h" |
|
34 #endif |
|
35 |
|
36 using namespace CommsDat; |
|
37 using namespace CMManager; |
|
38 |
|
39 |
|
40 |
|
41 _LIT( KVpnVirtualBearerName, "vpnbearer" ); |
|
42 _LIT( KVpnVirtualBearerAgent, "vpnconnagt.agt" ); |
|
43 _LIT( KVpnVirtualBearerNif, "tunnelnif" ); |
|
44 |
|
45 static const TInt KVirtualIAPNextLayerRecordIndex = 0; |
|
46 |
|
47 // constants needed for the virtualbearer table |
|
48 static const TInt KNoTimeout = -1; |
|
49 static const TUint32 KLastSessionTimeout = 3; |
|
50 |
|
51 // --------------------------------------------------------------------------- |
|
52 // CCmPluginVpn::NewL |
|
53 // --------------------------------------------------------------------------- |
|
54 // |
|
55 CCmPluginVpn* CCmPluginVpn::NewL( TCmPluginInitParam* aInitParam ) |
|
56 { |
|
57 OstTraceFunctionEntry0( CCMPLUGINVPN_NEWL_ENTRY ); |
|
58 |
|
59 CCmPluginVpn* self = new( ELeave ) CCmPluginVpn( aInitParam ); |
|
60 CleanupStack::PushL( self ); |
|
61 self->ConstructL(); |
|
62 CleanupStack::Pop( self ); |
|
63 |
|
64 OstTraceFunctionExit0( CCMPLUGINVPN_NEWL_EXIT ); |
|
65 return self; |
|
66 } |
|
67 |
|
68 // --------------------------------------------------------------------------- |
|
69 // CCmPluginVpn::CreateInstanceL |
|
70 // --------------------------------------------------------------------------- |
|
71 // |
|
72 CCmPluginBaseEng* CCmPluginVpn::CreateInstanceL( TCmPluginInitParam& aInitParam ) const |
|
73 { |
|
74 OstTraceFunctionEntry0( CCMPLUGINVPN_CREATEINSTANCEL_ENTRY ); |
|
75 |
|
76 CCmPluginVpn* self = new( ELeave ) CCmPluginVpn( &aInitParam ); |
|
77 CleanupStack::PushL( self ); |
|
78 self->ConstructL(); |
|
79 CleanupStack::Pop( self ); |
|
80 |
|
81 OstTraceFunctionExit0( CCMPLUGINVPN_CREATEINSTANCEL_EXIT ); |
|
82 return self; |
|
83 } |
|
84 |
|
85 // --------------------------------------------------------------------------- |
|
86 // CCmPluginVpn::~CCmPluginVpn |
|
87 // --------------------------------------------------------------------------- |
|
88 // |
|
89 CCmPluginVpn::~CCmPluginVpn() |
|
90 { |
|
91 OstTraceFunctionEntry0( CCMPLUGINVPN_CCMPLUGINVPN_ENTRY ); |
|
92 |
|
93 ResetBearerRecords(); |
|
94 |
|
95 OstTraceFunctionExit0( CCMPLUGINVPN_CCMPLUGINVPN_EXIT ); |
|
96 } |
|
97 |
|
98 // --------------------------------------------------------------------------- |
|
99 // CCmPluginVpn::CCmPluginVpn |
|
100 // --------------------------------------------------------------------------- |
|
101 // |
|
102 CCmPluginVpn::CCmPluginVpn( TCmPluginInitParam* aInitParam ) |
|
103 : CCmPluginBaseEng( aInitParam ), iVirtualTableId(0), |
|
104 iBearerPriorityTableId(0), iVirtualIapNextLayerRecord(NULL) |
|
105 { |
|
106 OstTraceFunctionEntry0( DUP1_CCMPLUGINVPN_CCMPLUGINVPN_ENTRY ); |
|
107 |
|
108 iBearerType = KPluginVPNBearerTypeUid; |
|
109 |
|
110 OstTraceFunctionExit0( DUP1_CCMPLUGINVPN_CCMPLUGINVPN_EXIT ); |
|
111 } |
|
112 |
|
113 // --------------------------------------------------------------------------- |
|
114 // CCmPluginVpn::ConstructL |
|
115 // --------------------------------------------------------------------------- |
|
116 // |
|
117 void CCmPluginVpn::ConstructL() |
|
118 { |
|
119 OstTraceFunctionEntry0( CCMPLUGINVPN_CONSTRUCTL_ENTRY ); |
|
120 |
|
121 if (!FeatureManager::FeatureSupported( KFeatureIdFfVpnClient ) ) |
|
122 { |
|
123 User::Leave( KErrNotSupported ); |
|
124 } |
|
125 |
|
126 TRAP_IGNORE( iVirtualTableId = |
|
127 CCDVirtualIAPNextLayerRecord::TableIdL( iSession ) ); |
|
128 |
|
129 if( !iVirtualTableId ) |
|
130 { |
|
131 iVirtualTableId = CCDVirtualIAPNextLayerRecord::CreateTableL( iSession ); |
|
132 } |
|
133 |
|
134 TRAP_IGNORE( iBearerPriorityTableId = |
|
135 CCDGlobalBearerTypePriorizationRecord::TableIdL( iSession ) ); |
|
136 |
|
137 if ( !iBearerPriorityTableId ) |
|
138 { |
|
139 iBearerPriorityTableId = |
|
140 CCDGlobalBearerTypePriorizationRecord::CreateTableL( iSession ); |
|
141 } |
|
142 |
|
143 CCmPluginBaseEng::ConstructL(); |
|
144 |
|
145 OstTraceFunctionExit0( CCMPLUGINVPN_CONSTRUCTL_EXIT ); |
|
146 } |
|
147 |
|
148 // --------------------------------------------------------------------------- |
|
149 // CCmPluginVpn::GetBearerInfoIntL |
|
150 // --------------------------------------------------------------------------- |
|
151 // |
|
152 TUint32 CCmPluginVpn::GetBearerInfoIntL( TUint32 aAttribute ) const |
|
153 { |
|
154 OstTraceFunctionEntry0( CCMPLUGINVPN_GETBEARERINFOINTL_ENTRY ); |
|
155 |
|
156 TUint32 retVal( 0 ); |
|
157 switch ( aAttribute ) |
|
158 { |
|
159 case ECmSeamlessnessLevel: |
|
160 { |
|
161 retVal = ESeamlessnessShowprogress; |
|
162 } |
|
163 break; |
|
164 case ECmBearerType: |
|
165 { |
|
166 retVal = iBearerType; |
|
167 } |
|
168 break; |
|
169 case ECmCommsDBBearerType: |
|
170 { |
|
171 retVal = KCommDbBearerVirtual; |
|
172 } |
|
173 break; |
|
174 case ECmExtensionLevel: |
|
175 { |
|
176 retVal = KExtensionBaseLevel; |
|
177 } |
|
178 break; |
|
179 case ECmDefaultUiPriority: //falls through |
|
180 case ECmDefaultPriority: |
|
181 { |
|
182 retVal = GetDefPriorityL( aAttribute ); |
|
183 } |
|
184 break; |
|
185 |
|
186 default: |
|
187 { |
|
188 User::Leave( KErrNotSupported ); |
|
189 } |
|
190 break; |
|
191 } |
|
192 |
|
193 OstTraceFunctionExit0( CCMPLUGINVPN_GETBEARERINFOINTL_EXIT ); |
|
194 return retVal; |
|
195 } |
|
196 |
|
197 // --------------------------------------------------------------------------- |
|
198 // CCmPluginVpn::GetBearerInfoBoolL |
|
199 // --------------------------------------------------------------------------- |
|
200 // |
|
201 TBool CCmPluginVpn::GetBearerInfoBoolL( TUint32 aAttribute ) const |
|
202 { |
|
203 OstTraceFunctionEntry0( CCMPLUGINVPN_GETBEARERINFOBOOLL_ENTRY ); |
|
204 |
|
205 TBool retVal( EFalse ); |
|
206 |
|
207 switch ( aAttribute ) |
|
208 { |
|
209 case ECmCoverage: |
|
210 { |
|
211 //This parameter is not actually in use for the VPN. |
|
212 //ConnMon component can make a proper coverage discovery for the VPN, |
|
213 //but CmManager just returns the default value. |
|
214 retVal = EFalse; |
|
215 } |
|
216 break; |
|
217 case ECmDestination: |
|
218 { |
|
219 retVal = EFalse; |
|
220 } |
|
221 break; |
|
222 case ECmBearerHasUi: |
|
223 { |
|
224 retVal = EFalse; |
|
225 } |
|
226 break; |
|
227 case ECmIPv6Supported: |
|
228 { |
|
229 retVal = EFalse; |
|
230 } |
|
231 break; |
|
232 case ECmVirtual: |
|
233 { |
|
234 retVal = ETrue; |
|
235 } |
|
236 break; |
|
237 default: |
|
238 { |
|
239 User::Leave( KErrNotSupported ); |
|
240 } |
|
241 break; |
|
242 } |
|
243 |
|
244 OstTraceFunctionExit0( CCMPLUGINVPN_GETBEARERINFOBOOLL_EXIT ); |
|
245 return retVal; |
|
246 } |
|
247 |
|
248 // --------------------------------------------------------------------------- |
|
249 // CCmPluginVpn::GetBearerInfoStringL |
|
250 // --------------------------------------------------------------------------- |
|
251 // |
|
252 HBufC* CCmPluginVpn::GetBearerInfoStringL( TUint32 /*aAttribute*/ ) const |
|
253 { |
|
254 OstTraceFunctionEntry0( CCMPLUGINVPN_GETBEARERINFOSTRINGL_ENTRY ); |
|
255 |
|
256 User::Leave( KErrNotSupported ); |
|
257 |
|
258 OstTraceFunctionExit0( CCMPLUGINVPN_GETBEARERINFOSTRINGL_EXIT ); |
|
259 |
|
260 return NULL; |
|
261 } |
|
262 |
|
263 // --------------------------------------------------------------------------- |
|
264 // CCmPluginVpn::GetBearerInfoString8L |
|
265 // --------------------------------------------------------------------------- |
|
266 // |
|
267 HBufC8* CCmPluginVpn::GetBearerInfoString8L( TUint32 /*aAttribute*/ ) const |
|
268 { |
|
269 OstTraceFunctionEntry0( CCMPLUGINVPN_GETBEARERINFOSTRING8L_ENTRY ); |
|
270 |
|
271 User::Leave( KErrNotSupported ); |
|
272 |
|
273 OstTraceFunctionExit0( CCMPLUGINVPN_GETBEARERINFOSTRING8L_EXIT ); |
|
274 |
|
275 return NULL; |
|
276 } |
|
277 |
|
278 // --------------------------------------------------------------------------- |
|
279 // CCmPluginVpn::CanHandleIapIdL |
|
280 // --------------------------------------------------------------------------- |
|
281 // |
|
282 TBool CCmPluginVpn::CanHandleIapIdL( TUint32 aIapId ) const |
|
283 { |
|
284 OstTraceFunctionEntry0( CCMPLUGINVPN_CANHANDLEIAPIDL_ENTRY ); |
|
285 |
|
286 TBool retVal( EFalse ); |
|
287 |
|
288 CCDIAPRecord *iapRecord = static_cast<CCDIAPRecord *> |
|
289 ( CCDRecordBase::RecordFactoryL( KCDTIdIAPRecord ) ); |
|
290 |
|
291 CleanupStack::PushL( iapRecord ); |
|
292 iapRecord->SetRecordId( aIapId ); |
|
293 |
|
294 iapRecord->LoadL( iSession ); |
|
295 retVal = CanHandleIapIdL( iapRecord ); |
|
296 |
|
297 CleanupStack::PopAndDestroy( iapRecord ); |
|
298 |
|
299 OstTraceFunctionExit0( CCMPLUGINVPN_CANHANDLEIAPIDL_EXIT ); |
|
300 return retVal; |
|
301 } |
|
302 |
|
303 // --------------------------------------------------------------------------- |
|
304 // CCmPluginVpn::CanHandleIapIdL |
|
305 // --------------------------------------------------------------------------- |
|
306 // |
|
307 TBool CCmPluginVpn::CanHandleIapIdL( CommsDat::CCDIAPRecord* aIapRecord ) const |
|
308 { |
|
309 OstTraceFunctionEntry0( DUP1_CCMPLUGINVPN_CANHANDLEIAPIDL_ENTRY ); |
|
310 TBool retVal( EFalse ); |
|
311 |
|
312 if( TPtrC(aIapRecord->iServiceType) == TPtrC(KCDTypeNameVPNService) || |
|
313 TPtrC(aIapRecord->iBearerType) == TPtrC(KCDTypeNameVirtualBearer) ) |
|
314 { |
|
315 // Further comparision is to find exact info that the IAP can handle by this plugin |
|
316 CMDBRecordSet<CCDVirtualBearerRecord>* bearersRS = |
|
317 new(ELeave) CMDBRecordSet<CCDVirtualBearerRecord> |
|
318 (KCDTIdVirtualBearerRecord); |
|
319 CleanupStack::PushL( bearersRS ); |
|
320 |
|
321 CCDVirtualBearerRecord* bearerRecord = |
|
322 static_cast<CCDVirtualBearerRecord *> |
|
323 (CCDRecordBase::RecordFactoryL(KCDTIdVirtualBearerRecord)); |
|
324 |
|
325 CleanupStack::PushL( bearerRecord ); |
|
326 |
|
327 // Find entries used "vpnconnagt.agt" as agent from Table VirtualBearer |
|
328 bearerRecord->iBearerAgent.SetL( KVpnVirtualBearerAgent ); |
|
329 |
|
330 bearersRS->iRecords.AppendL( bearerRecord ); |
|
331 |
|
332 CleanupStack::Pop( bearerRecord ); |
|
333 bearerRecord = NULL; |
|
334 |
|
335 if ( bearersRS->FindL( iSession ) ) |
|
336 { |
|
337 TUint32 recordId = (*bearersRS)[0]->RecordId(); |
|
338 TPtrC bearerName( (*bearersRS)[0]->iRecordName.GetL() ); |
|
339 |
|
340 // Further comparing record ID referred to by this VPN IAP with entry ID in table VirtualBearer |
|
341 // And also comparing bear name with our expected one "vpnbearer" |
|
342 if( recordId == aIapRecord->iBearer && |
|
343 bearerName == TPtrC( KVpnVirtualBearerName ) ) |
|
344 { |
|
345 retVal = ETrue; |
|
346 } |
|
347 } |
|
348 CleanupStack::PopAndDestroy( bearersRS ); |
|
349 } |
|
350 |
|
351 OstTraceFunctionExit0( DUP1_CCMPLUGINVPN_CANHANDLEIAPIDL_EXIT ); |
|
352 return retVal; |
|
353 } |
|
354 |
|
355 // --------------------------------------------------------------------------- |
|
356 // CCmPluginVpn::GetBearerTableIdsToBeObservedL |
|
357 // --------------------------------------------------------------------------- |
|
358 // |
|
359 void CCmPluginVpn::GetBearerTableIdsToBeObservedL( RArray<TUint32>& aTableIdArray ) const |
|
360 { |
|
361 OstTraceFunctionEntry0( CCMPLUGINVPN_GETBEARERTABLEIDSTOBEOBSERVEDL_ENTRY ); |
|
362 |
|
363 aTableIdArray.AppendL( KCDTIdVirtualBearerRecord ); |
|
364 aTableIdArray.AppendL( iVirtualTableId ); |
|
365 |
|
366 OstTraceFunctionExit0( CCMPLUGINVPN_GETBEARERTABLEIDSTOBEOBSERVEDL_EXIT ); |
|
367 } |
|
368 |
|
369 // --------------------------------------------------------------------------- |
|
370 // CCmPluginVpn::GetBearerSpecificRecordsL |
|
371 // --------------------------------------------------------------------------- |
|
372 // |
|
373 void CCmPluginVpn::GetBearerSpecificRecordsL(RPointerArray<CommsDat::CCDRecordBase>& aRecordArray ) |
|
374 { |
|
375 OstTraceFunctionEntry0( CCMPLUGINVPN_GETBEARERSPECIFICRECORDSL_ENTRY ); |
|
376 |
|
377 __ASSERT_DEBUG( iVirtualIapNextLayerRecord != NULL, User::Invariant() ); |
|
378 |
|
379 CCDVirtualIAPNextLayerRecord* virtualIapNextLayerRecordCopy = |
|
380 new (ELeave) CCDVirtualIAPNextLayerRecord( iVirtualTableId ); |
|
381 CleanupStack::PushL( virtualIapNextLayerRecordCopy ); |
|
382 |
|
383 TUint value = iVirtualIapNextLayerRecord->iIAP; |
|
384 virtualIapNextLayerRecordCopy->iIAP = value; |
|
385 |
|
386 value = iVirtualIapNextLayerRecord->iNextLayerSNAP; |
|
387 virtualIapNextLayerRecordCopy->iNextLayerSNAP = value; |
|
388 |
|
389 value = iVirtualIapNextLayerRecord->iNextLayerIAP; |
|
390 virtualIapNextLayerRecordCopy->iNextLayerIAP = value; |
|
391 |
|
392 virtualIapNextLayerRecordCopy->SetElementId( iVirtualIapNextLayerRecord->ElementId() ); |
|
393 User::LeaveIfError( aRecordArray.Append( virtualIapNextLayerRecordCopy ) ); |
|
394 CleanupStack::Pop( virtualIapNextLayerRecordCopy ); |
|
395 OstTraceFunctionExit0( CCMPLUGINVPN_GETBEARERSPECIFICRECORDSL_EXIT ); |
|
396 } |
|
397 |
|
398 // --------------------------------------------------------------------------- |
|
399 // CCmPluginVpn::GetBearerIntAttributeL |
|
400 // --------------------------------------------------------------------------- |
|
401 // |
|
402 TUint32 CCmPluginVpn::GetBearerIntAttributeL( |
|
403 TUint32 aAttribute, |
|
404 RPointerArray<CommsDat::CCDRecordBase>& aGenRecordArray, |
|
405 RPointerArray<CommsDat::CCDRecordBase>& /*aBearerSpecRecordArray*/ ) |
|
406 { |
|
407 OstTraceFunctionEntry0( CCMPLUGINVPN_GETBEARERINTATTRIBUTEL_ENTRY ); |
|
408 |
|
409 CCDVPNServiceRecord* serviceRecord = static_cast<CCDVPNServiceRecord *> |
|
410 ( aGenRecordArray[KServiceRecordIndex] ); |
|
411 |
|
412 TUint32 retVal( 0 ); |
|
413 switch( aAttribute ) |
|
414 { |
|
415 case ECmExtensionLevel: |
|
416 { |
|
417 retVal = KExtensionBaseLevel; |
|
418 } |
|
419 break; |
|
420 case ECmCommsDBBearerType: |
|
421 { |
|
422 TCommsDBBearerTechnology bearer = KCommDbBearerVirtual; |
|
423 retVal = bearer; |
|
424 } |
|
425 break; |
|
426 case ECmNextLayerIapId: //falls through |
|
427 case EVpnIapId: |
|
428 { |
|
429 TUint recordId = serviceRecord->iServiceIAP; |
|
430 if (recordId != 0) |
|
431 { |
|
432 CCDIAPRecord *iapRecord = static_cast<CCDIAPRecord *> |
|
433 ( CCDRecordBase::RecordFactoryL( KCDTIdIAPRecord ) ); |
|
434 |
|
435 CleanupStack::PushL( iapRecord ); |
|
436 iapRecord->SetRecordId( recordId ); |
|
437 iapRecord->LoadL( iSession ); |
|
438 retVal = iapRecord->RecordId(); |
|
439 CleanupStack::PopAndDestroy( iapRecord ); |
|
440 } |
|
441 } |
|
442 break; |
|
443 case EVpnNetworkId: //falls through |
|
444 case ECmNextLayerSNAPId: |
|
445 { |
|
446 TUint recordId = serviceRecord->iServiceSNAP; |
|
447 if (recordId != 0) |
|
448 { |
|
449 CCDAccessPointRecord* accessPointRecord = static_cast<CCDAccessPointRecord *> |
|
450 ( CCDRecordBase::RecordFactoryL( KCDTIdAccessPointRecord ) ); |
|
451 CleanupStack::PushL( accessPointRecord ); |
|
452 accessPointRecord->SetRecordId( recordId ); |
|
453 accessPointRecord->LoadL( iSession ); |
|
454 retVal = accessPointRecord->iRecordTag; |
|
455 CleanupStack::PopAndDestroy( accessPointRecord ); |
|
456 |
|
457 if (aAttribute == EVpnNetworkId) |
|
458 { |
|
459 __ASSERT_DEBUG( retVal >= KCmmDestIdIntervalMin, User::Invariant() ); |
|
460 retVal -= KCmmDestIdIntervalMin; |
|
461 } |
|
462 } |
|
463 } |
|
464 break; |
|
465 default: |
|
466 { |
|
467 retVal = GetBearerInfoIntL( aAttribute ); |
|
468 } |
|
469 break; |
|
470 } |
|
471 |
|
472 |
|
473 OstTraceFunctionExit0( CCMPLUGINVPN_GETBEARERINTATTRIBUTEL_EXIT ); |
|
474 return retVal; |
|
475 } |
|
476 |
|
477 // --------------------------------------------------------------------------- |
|
478 // CCmPluginVpn::GetBearerBoolAttributeL |
|
479 // --------------------------------------------------------------------------- |
|
480 // |
|
481 TBool CCmPluginVpn::GetBearerBoolAttributeL( |
|
482 TUint32 aAttribute, |
|
483 RPointerArray<CommsDat::CCDRecordBase>& /*aGenRecordArray*/, |
|
484 RPointerArray<CommsDat::CCDRecordBase>& /*aBearerSpecRecordArray*/ ) |
|
485 { |
|
486 OstTraceFunctionEntry0( CCMPLUGINVPN_GETBEARERBOOLATTRIBUTEL_ENTRY ); |
|
487 //We don't have IAP specific bool attributes, but the bearer specific |
|
488 //attributes may also be asked this way... |
|
489 TBool retVal = GetBearerInfoBoolL( aAttribute ); |
|
490 OstTraceFunctionExit0( CCMPLUGINVPN_GETBEARERBOOLATTRIBUTEL_EXIT ); |
|
491 return retVal; |
|
492 } |
|
493 |
|
494 // --------------------------------------------------------------------------- |
|
495 // CCmPluginVpn::GetBearerStringAttributeL |
|
496 // --------------------------------------------------------------------------- |
|
497 // |
|
498 HBufC* CCmPluginVpn::GetBearerStringAttributeL( |
|
499 TUint32 aAttribute, |
|
500 RPointerArray<CommsDat::CCDRecordBase>& aGenRecordArray, |
|
501 RPointerArray<CommsDat::CCDRecordBase>& /*aBearerSpecRecordArray*/ ) |
|
502 { |
|
503 OstTraceFunctionEntry0( CCMPLUGINVPN_GETBEARERSTRINGATTRIBUTEL_ENTRY ); |
|
504 |
|
505 CCDVPNServiceRecord* serviceRecord = static_cast<CCDVPNServiceRecord *> |
|
506 ( aGenRecordArray[KServiceRecordIndex] ); |
|
507 |
|
508 HBufC* retVal = NULL; |
|
509 switch( aAttribute ) |
|
510 { |
|
511 case EVpnServicePolicy: |
|
512 { |
|
513 retVal = TPtrC( serviceRecord->iServicePolicy ).AllocL(); |
|
514 } |
|
515 break; |
|
516 default: |
|
517 { |
|
518 retVal = GetBearerInfoStringL( aAttribute ); |
|
519 } |
|
520 break; |
|
521 } |
|
522 OstTraceFunctionExit0( CCMPLUGINVPN_GETBEARERSTRINGATTRIBUTEL_EXIT ); |
|
523 return retVal; |
|
524 } |
|
525 |
|
526 // --------------------------------------------------------------------------- |
|
527 // CCmPluginVpn::GetBearerString8AttributeL |
|
528 // --------------------------------------------------------------------------- |
|
529 // |
|
530 HBufC8* CCmPluginVpn::GetBearerString8AttributeL( |
|
531 TUint32 aAttribute, |
|
532 RPointerArray<CommsDat::CCDRecordBase>& /*aGenRecordArray*/, |
|
533 RPointerArray<CommsDat::CCDRecordBase>& /*aBearerSpecRecordArray*/ ) |
|
534 { |
|
535 OstTraceFunctionEntry0( CCMPLUGINVPN_GETBEARERSTRING8ATTRIBUTEL_ENTRY ); |
|
536 |
|
537 HBufC8* retVal = GetBearerInfoString8L( aAttribute ); |
|
538 |
|
539 OstTraceFunctionExit0( CCMPLUGINVPN_GETBEARERSTRING8ATTRIBUTEL_EXIT ); |
|
540 return retVal; |
|
541 } |
|
542 |
|
543 // --------------------------------------------------------------------------- |
|
544 // CCmPluginVpn::SetBearerIntAttributeL |
|
545 // --------------------------------------------------------------------------- |
|
546 // |
|
547 void CCmPluginVpn::SetBearerIntAttributeL( |
|
548 TUint32 aAttribute, |
|
549 TUint32 aValue, |
|
550 RPointerArray<CommsDat::CCDRecordBase>& aGenRecordArray, |
|
551 RPointerArray<CommsDat::CCDRecordBase>& aBearerSpecRecordArray ) |
|
552 { |
|
553 OstTraceFunctionEntry0( CCMPLUGINVPN_SETBEARERINTATTRIBUTEL_ENTRY ); |
|
554 |
|
555 CCDVPNServiceRecord* serviceRecord = static_cast<CCDVPNServiceRecord *> |
|
556 (aGenRecordArray[KServiceRecordIndex]); |
|
557 |
|
558 CCDVirtualIAPNextLayerRecord* virtualIapNextLayerRecord = static_cast<CCDVirtualIAPNextLayerRecord*> |
|
559 (aBearerSpecRecordArray[KVirtualIAPNextLayerRecordIndex]); |
|
560 |
|
561 |
|
562 switch(aAttribute) |
|
563 { |
|
564 case ECmNextLayerIapId: //falls through |
|
565 case EVpnIapId: |
|
566 { |
|
567 if( aValue == 0 || aValue >= (KCmmConnMethodIdIntervalMax - 2) ) |
|
568 { |
|
569 User::Leave( KErrArgument ); |
|
570 } |
|
571 |
|
572 //Tries to find corresponding IAP record. |
|
573 CCDIAPRecord *iapRecord = static_cast<CCDIAPRecord *> |
|
574 ( CCDRecordBase::RecordFactoryL( KCDTIdIAPRecord ) ); |
|
575 |
|
576 CleanupStack::PushL( iapRecord ); |
|
577 iapRecord->SetRecordId( aValue ); |
|
578 TRAPD(err, iapRecord->LoadL( iSession )); |
|
579 if ( err == KErrNotFound ) |
|
580 { |
|
581 User::Leave( KErrArgument ); |
|
582 } |
|
583 User::LeaveIfError( err ); |
|
584 |
|
585 serviceRecord->iServiceIAP = iapRecord->RecordId(); |
|
586 serviceRecord->iServiceNetwork = 0; |
|
587 serviceRecord->iServiceSNAP = 0; |
|
588 virtualIapNextLayerRecord->iNextLayerIAP.SetL( aValue ); |
|
589 virtualIapNextLayerRecord->iNextLayerSNAP = 0; |
|
590 CleanupStack::PopAndDestroy( iapRecord ); |
|
591 } |
|
592 break; |
|
593 case EVpnNetworkId: //falls through |
|
594 { |
|
595 if ( aValue == 0 || aValue > (KCmmDestIdIntervalLegacyMax - 2) ) |
|
596 { |
|
597 User::Leave( KErrArgument ); |
|
598 } |
|
599 } //falls through |
|
600 case ECmNextLayerSNAPId: |
|
601 { |
|
602 if ( aValue <= (KCmmDestIdIntervalLegacyMax - 2) ) |
|
603 { |
|
604 aValue += KCmmDestIdIntervalMin; |
|
605 } |
|
606 |
|
607 if ( aValue <= KCmmDestIdIntervalMin || |
|
608 aValue > KCmmDestIdIntervalMax - 2 ) |
|
609 { |
|
610 User::Leave( KErrArgument ); |
|
611 } |
|
612 |
|
613 CCDAccessPointRecord* accessPointRecord = static_cast<CCDAccessPointRecord *> |
|
614 ( CCDRecordBase::RecordFactoryL( KCDTIdAccessPointRecord ) ); |
|
615 CleanupStack::PushL( accessPointRecord ); |
|
616 accessPointRecord->iRecordTag = aValue; |
|
617 if ( accessPointRecord->FindL( iSession ) ) |
|
618 { |
|
619 serviceRecord->iServiceIAP = 0; |
|
620 serviceRecord->iServiceNetwork = 0; |
|
621 serviceRecord->iServiceSNAP = accessPointRecord->RecordId(); |
|
622 virtualIapNextLayerRecord->iNextLayerIAP = 0; |
|
623 virtualIapNextLayerRecord->iNextLayerSNAP.SetL( aValue ); |
|
624 } |
|
625 else |
|
626 { |
|
627 User::Leave( KErrArgument ); |
|
628 } |
|
629 CleanupStack::PopAndDestroy( accessPointRecord ); |
|
630 } |
|
631 break; |
|
632 default: |
|
633 { |
|
634 User::Leave( KErrNotSupported ); |
|
635 } |
|
636 break; |
|
637 } |
|
638 |
|
639 OstTraceFunctionExit0( CCMPLUGINVPN_SETBEARERINTATTRIBUTEL_EXIT ); |
|
640 } |
|
641 |
|
642 // --------------------------------------------------------------------------- |
|
643 // CCmPluginVpn::SetBearerBoolAttributeL |
|
644 // --------------------------------------------------------------------------- |
|
645 // |
|
646 void CCmPluginVpn::SetBearerBoolAttributeL( |
|
647 TUint32 /*aAttribute*/, |
|
648 TBool /*aValue*/, |
|
649 RPointerArray<CommsDat::CCDRecordBase>& /*aGenRecordArray*/, |
|
650 RPointerArray<CommsDat::CCDRecordBase>& /*aBearerSpecRecordArray*/ ) |
|
651 { |
|
652 OstTraceFunctionEntry0( CCMPLUGINVPN_SETBEARERBOOLATTRIBUTEL_ENTRY ); |
|
653 |
|
654 User::Leave( KErrNotSupported ); |
|
655 |
|
656 OstTraceFunctionExit0( CCMPLUGINVPN_SETBEARERBOOLATTRIBUTEL_EXIT ); |
|
657 } |
|
658 |
|
659 // --------------------------------------------------------------------------- |
|
660 // CCmPluginVpn::SetBearerStringAttributeL |
|
661 // --------------------------------------------------------------------------- |
|
662 // |
|
663 void CCmPluginVpn::SetBearerStringAttributeL( |
|
664 TUint32 aAttribute, |
|
665 const TDesC16& aValue, |
|
666 RPointerArray<CommsDat::CCDRecordBase>& aGenRecordArray, |
|
667 RPointerArray<CommsDat::CCDRecordBase>& /*aBearerSpecRecordArray*/ ) |
|
668 { |
|
669 OstTraceFunctionEntry0( CCMPLUGINVPN_SETBEARERSTRINGATTRIBUTEL_ENTRY ); |
|
670 |
|
671 CCDVPNServiceRecord* serviceRecord = static_cast<CCDVPNServiceRecord *> |
|
672 ( aGenRecordArray[KServiceRecordIndex] ); |
|
673 |
|
674 switch(aAttribute) |
|
675 { |
|
676 case EVpnServicePolicyName: |
|
677 { |
|
678 User::Leave( KErrNotSupported ); |
|
679 } |
|
680 break; |
|
681 case EVpnServicePolicy: |
|
682 { |
|
683 serviceRecord->iServicePolicy.SetL( aValue ); |
|
684 } |
|
685 break; |
|
686 default: |
|
687 { |
|
688 User::Leave( KErrNotSupported ); |
|
689 } |
|
690 break; |
|
691 } |
|
692 |
|
693 OstTraceFunctionExit0( CCMPLUGINVPN_SETBEARERSTRINGATTRIBUTEL_EXIT ); |
|
694 } |
|
695 |
|
696 // --------------------------------------------------------------------------- |
|
697 // CCmPluginVpn::SetBearerString8AttributeL |
|
698 // --------------------------------------------------------------------------- |
|
699 // |
|
700 void CCmPluginVpn::SetBearerString8AttributeL( |
|
701 TUint32 /*aAttribute*/, |
|
702 const TDesC8& /*aValue*/, |
|
703 RPointerArray<CommsDat::CCDRecordBase>& /*aGenRecordArray*/, |
|
704 RPointerArray<CommsDat::CCDRecordBase>& /*aBearerSpecRecordArray*/ ) |
|
705 { |
|
706 OstTraceFunctionEntry0( CCMPLUGINVPN_SETBEARERSTRING8ATTRIBUTEL_ENTRY ); |
|
707 |
|
708 User::Leave( KErrNotSupported ); |
|
709 |
|
710 OstTraceFunctionExit0( CCMPLUGINVPN_SETBEARERSTRING8ATTRIBUTEL_EXIT ); |
|
711 } |
|
712 |
|
713 // --------------------------------------------------------------------------- |
|
714 // CCmPluginVpn::PreparePluginToLoadRecordsL |
|
715 // --------------------------------------------------------------------------- |
|
716 // |
|
717 void CCmPluginVpn::PreparePluginToLoadRecordsL() |
|
718 { |
|
719 } |
|
720 |
|
721 // --------------------------------------------------------------------------- |
|
722 // CCmPluginVpn::PrepareToCopyDataL |
|
723 // --------------------------------------------------------------------------- |
|
724 // |
|
725 void CCmPluginVpn::PrepareToCopyDataL( CCmPluginBaseEng* /*aCopyInstance*/ ) |
|
726 { |
|
727 } |
|
728 |
|
729 // --------------------------------------------------------------------------- |
|
730 // CCmPluginVpn::PreparePluginToUpdateRecordsL |
|
731 // --------------------------------------------------------------------------- |
|
732 // |
|
733 void CCmPluginVpn::PreparePluginToUpdateRecordsL( |
|
734 RPointerArray<CommsDat::CCDRecordBase>& /*aGenRecordArray*/, |
|
735 RPointerArray<CommsDat::CCDRecordBase>& /*aBearerSpecRecordArray*/ ) |
|
736 { |
|
737 } |
|
738 |
|
739 // --------------------------------------------------------------------------- |
|
740 // CCmPluginVpn::PrepareToDeleteRecordsL |
|
741 // --------------------------------------------------------------------------- |
|
742 // |
|
743 void CCmPluginVpn::PrepareToDeleteRecordsL() |
|
744 { |
|
745 } |
|
746 |
|
747 // --------------------------------------------------------------------------- |
|
748 // CCmPluginVpn::LoadServiceRecordL |
|
749 // --------------------------------------------------------------------------- |
|
750 // |
|
751 void CCmPluginVpn::LoadServiceRecordL() |
|
752 { |
|
753 OstTraceFunctionEntry0( CCMPLUGINVPN_LOADSERVICERECORDL_ENTRY ); |
|
754 |
|
755 __ASSERT_DEBUG( iServiceRecord == NULL, User::Invariant() ); |
|
756 |
|
757 if( TPtrC( KCDTypeNameVPNService ) == iIapRecord->iServiceType ) |
|
758 { |
|
759 iServiceRecord = static_cast<CCDVPNServiceRecord *> |
|
760 ( CCDRecordBase::RecordFactoryL(KCDTIdVPNServiceRecord) ); |
|
761 iServiceRecord->SetRecordId( iIapRecord->iService ); |
|
762 iServiceRecord->LoadL( iSession ); |
|
763 } |
|
764 else |
|
765 // this IAP service is not supported by this plugin. |
|
766 { |
|
767 User::Leave( KErrNotSupported ); |
|
768 } |
|
769 OstTraceFunctionExit0( CCMPLUGINVPN_LOADSERVICERECORDL_EXIT ); |
|
770 } |
|
771 |
|
772 // --------------------------------------------------------------------------- |
|
773 // CCmPluginVpn::CreateServiceRecordL |
|
774 // --------------------------------------------------------------------------- |
|
775 // |
|
776 void CCmPluginVpn::CreateServiceRecordL() |
|
777 { |
|
778 OstTraceFunctionEntry0( CCMPLUGINVPN_CREATESERVICERECORDL_ENTRY ); |
|
779 |
|
780 delete iServiceRecord; |
|
781 iServiceRecord = NULL; |
|
782 |
|
783 iServiceRecord = static_cast<CCDVPNServiceRecord *> |
|
784 ( CCDRecordBase::RecordFactoryL( KCDTIdVPNServiceRecord ) ); |
|
785 |
|
786 ServiceRecord().iServicePolicy.SetL( KNullDesC ); |
|
787 ServiceRecord().iServiceIAP = 0; |
|
788 ServiceRecord().iServiceNetwork = 0; |
|
789 ServiceRecord().iServiceSNAP = 0; |
|
790 |
|
791 OstTraceFunctionExit0( CCMPLUGINVPN_CREATESERVICERECORDL_EXIT ); |
|
792 } |
|
793 |
|
794 // --------------------------------------------------------------------------- |
|
795 // CCmPluginVpn::UpdateServiceRecordL |
|
796 // --------------------------------------------------------------------------- |
|
797 // |
|
798 void CCmPluginVpn::UpdateServiceRecordL( |
|
799 RPointerArray<CommsDat::CCDRecordBase>& aGenRecordArray, |
|
800 RPointerArray<CommsDat::CCDRecordBase>& /*aBearerSpecRecordArray*/ ) |
|
801 { |
|
802 OstTraceFunctionEntry0( CCMPLUGINVPN_UPDATESERVICERECORDL_ENTRY ); |
|
803 |
|
804 // Delete the original record and create a copy from the parameter |
|
805 delete iServiceRecord; |
|
806 iServiceRecord = NULL; |
|
807 |
|
808 CCDVPNServiceRecord* vpnServiceRecordFrom = |
|
809 static_cast<CCDVPNServiceRecord *>( aGenRecordArray[KServiceRecordIndex] ); |
|
810 |
|
811 |
|
812 iServiceRecord = static_cast<CCDVPNServiceRecord*> |
|
813 ( CCDRecordBase::CreateCopyRecordL( *vpnServiceRecordFrom ) ); |
|
814 iServiceRecord->SetElementId( vpnServiceRecordFrom->ElementId() ); |
|
815 |
|
816 if ( !iServiceRecord->RecordId() ) |
|
817 { |
|
818 iServiceRecord->SetRecordId( KCDNewRecordRequest ); |
|
819 iServiceRecord->StoreL( iSession ); |
|
820 |
|
821 vpnServiceRecordFrom->SetElementId( ServiceRecord().ElementId() ); |
|
822 } |
|
823 else |
|
824 { |
|
825 iServiceRecord->ModifyL( iSession ); |
|
826 } |
|
827 |
|
828 OstTraceFunctionExit0( CCMPLUGINVPN_UPDATESERVICERECORDL_EXIT ); |
|
829 } |
|
830 |
|
831 // --------------------------------------------------------------------------- |
|
832 // CCmPluginVpn::CopyServiceRecordL |
|
833 // --------------------------------------------------------------------------- |
|
834 // |
|
835 CommsDat::CCDRecordBase* CCmPluginVpn::CopyServiceRecordL() |
|
836 { |
|
837 OstTraceFunctionEntry0( CCMPLUGINVPN_COPYSERVICERECORDL_ENTRY ); |
|
838 |
|
839 __ASSERT_DEBUG( iServiceRecord != NULL, User::Invariant()); |
|
840 CCDRecordBase* serviceRecord = static_cast<CCDVPNServiceRecord*> |
|
841 ( CCDRecordBase::CreateCopyRecordL( *iServiceRecord ) ); |
|
842 OstTraceFunctionExit0( CCMPLUGINVPN_COPYSERVICERECORDL_EXIT ); |
|
843 return serviceRecord; |
|
844 } |
|
845 |
|
846 // --------------------------------------------------------------------------- |
|
847 // CCmPluginVpn::ServiceRecordId |
|
848 // --------------------------------------------------------------------------- |
|
849 // |
|
850 TUint32 CCmPluginVpn::ServiceRecordId() const |
|
851 { |
|
852 OstTraceFunctionEntry0( CCMPLUGINVPN_SERVICERECORDID_ENTRY ); |
|
853 |
|
854 TUint32 retVal = ServiceRecord().RecordId(); |
|
855 |
|
856 OstTraceFunctionExit0( CCMPLUGINVPN_SERVICERECORDID_EXIT ); |
|
857 return retVal; |
|
858 } |
|
859 |
|
860 // --------------------------------------------------------------------------- |
|
861 // CCmPluginVpn::ServiceRecordNameLC |
|
862 // --------------------------------------------------------------------------- |
|
863 // |
|
864 void CCmPluginVpn::ServiceRecordNameLC( HBufC* &aServiceName ) |
|
865 { |
|
866 OstTraceFunctionEntry0( CCMPLUGINVPN_SERVICERECORDNAMELC_ENTRY ); |
|
867 aServiceName = TPtrC( KCDTypeNameVPNService ).AllocLC(); |
|
868 OstTraceFunctionExit0( CCMPLUGINVPN_SERVICERECORDNAMELC_EXIT ); |
|
869 } |
|
870 |
|
871 // --------------------------------------------------------------------------- |
|
872 // CCmPluginVpn::LoadBearerRecordsL |
|
873 // --------------------------------------------------------------------------- |
|
874 // |
|
875 void CCmPluginVpn::LoadBearerRecordsL() |
|
876 { |
|
877 OstTraceFunctionEntry0( CCMPLUGINVPN_LOADBEARERRECORDSL_ENTRY ); |
|
878 |
|
879 delete iVirtualIapNextLayerRecord; |
|
880 iVirtualIapNextLayerRecord = NULL; |
|
881 |
|
882 CMDBRecordSet<CCDVirtualIAPNextLayerRecord>* virtualRS = |
|
883 new(ELeave) CMDBRecordSet<CCDVirtualIAPNextLayerRecord>( iVirtualTableId ); |
|
884 CleanupStack::PushL( virtualRS ); |
|
885 |
|
886 CCDVirtualIAPNextLayerRecord* record = |
|
887 new (ELeave) CCDVirtualIAPNextLayerRecord( iVirtualTableId ); |
|
888 |
|
889 record->iIAP = iIapRecord->RecordId(); |
|
890 CleanupStack::PushL( record ); |
|
891 virtualRS->iRecords.AppendL( record ); |
|
892 CleanupStack::Pop( record ); |
|
893 record = NULL; |
|
894 |
|
895 if( virtualRS->FindL( iSession ) ) |
|
896 { |
|
897 iVirtualIapNextLayerRecord = new (ELeave) CCDVirtualIAPNextLayerRecord( iVirtualTableId ); |
|
898 iVirtualIapNextLayerRecord->SetRecordId( (*virtualRS)[0]->RecordId() ); |
|
899 iVirtualIapNextLayerRecord->LoadL( iSession ); |
|
900 } |
|
901 else |
|
902 { |
|
903 User::Leave( KErrNotFound ); |
|
904 } |
|
905 |
|
906 CleanupStack::PopAndDestroy( virtualRS ); |
|
907 |
|
908 OstTraceFunctionExit0( CCMPLUGINVPN_LOADBEARERRECORDSL_EXIT ); |
|
909 } |
|
910 |
|
911 // --------------------------------------------------------------------------- |
|
912 // CCmPluginVpn::CreateBearerRecordsL |
|
913 // --------------------------------------------------------------------------- |
|
914 // |
|
915 void CCmPluginVpn::CreateBearerRecordsL() |
|
916 { |
|
917 OstTraceFunctionEntry0( CCMPLUGINVPN_CREATEBEARERRECORDSL_ENTRY ); |
|
918 |
|
919 delete iVirtualIapNextLayerRecord; |
|
920 iVirtualIapNextLayerRecord = NULL; |
|
921 |
|
922 iVirtualIapNextLayerRecord = new (ELeave) CCDVirtualIAPNextLayerRecord( iVirtualTableId ); |
|
923 |
|
924 OstTraceFunctionExit0( CCMPLUGINVPN_CREATEBEARERRECORDSL_EXIT ); |
|
925 } |
|
926 |
|
927 // --------------------------------------------------------------------------- |
|
928 // CCmPluginVpn::UpdateBearerRecordsL |
|
929 // --------------------------------------------------------------------------- |
|
930 // |
|
931 void CCmPluginVpn::UpdateBearerRecordsL( |
|
932 RPointerArray<CommsDat::CCDRecordBase>& aGenRecordArray, |
|
933 RPointerArray<CommsDat::CCDRecordBase>& aBearerSpecRecordArray ) |
|
934 { |
|
935 OstTraceFunctionEntry0( CCMPLUGINVPN_UPDATEBEARERRECORDSL_ENTRY ); |
|
936 |
|
937 delete iVirtualIapNextLayerRecord; |
|
938 iVirtualIapNextLayerRecord = NULL; |
|
939 |
|
940 iVirtualIapNextLayerRecord = new (ELeave) CCDVirtualIAPNextLayerRecord( iVirtualTableId ); |
|
941 |
|
942 CCDVirtualIAPNextLayerRecord* virtualIAPNextLayerRecordFrom = |
|
943 static_cast<CCDVirtualIAPNextLayerRecord*>(aBearerSpecRecordArray[KVirtualIAPNextLayerRecordIndex]); |
|
944 |
|
945 CCDIAPRecord *iapRecord = static_cast<CCDIAPRecord *> |
|
946 ( aGenRecordArray[KIapRecordIndex] ); |
|
947 |
|
948 |
|
949 TUint value = iapRecord->RecordId(); |
|
950 iVirtualIapNextLayerRecord->iIAP = value; |
|
951 value = virtualIAPNextLayerRecordFrom->iNextLayerSNAP; |
|
952 iVirtualIapNextLayerRecord->iNextLayerSNAP = value; |
|
953 value = virtualIAPNextLayerRecordFrom->iNextLayerIAP; |
|
954 iVirtualIapNextLayerRecord->iNextLayerIAP = value; |
|
955 iVirtualIapNextLayerRecord->SetElementId(virtualIAPNextLayerRecordFrom->ElementId()); |
|
956 |
|
957 if ( !iVirtualIapNextLayerRecord->RecordId() ) |
|
958 { |
|
959 iVirtualIapNextLayerRecord->SetRecordId( KCDNewRecordRequest ); |
|
960 iVirtualIapNextLayerRecord->StoreL( iSession ); |
|
961 virtualIAPNextLayerRecordFrom->SetElementId( iVirtualIapNextLayerRecord->ElementId() ); |
|
962 } |
|
963 else |
|
964 { |
|
965 iVirtualIapNextLayerRecord->ModifyL( iSession ); |
|
966 } |
|
967 |
|
968 OstTraceFunctionExit0( CCMPLUGINVPN_UPDATEBEARERRECORDSL_EXIT ); |
|
969 } |
|
970 |
|
971 // --------------------------------------------------------------------------- |
|
972 // CCmPluginVpn::DeleteBearerRecordsL |
|
973 // --------------------------------------------------------------------------- |
|
974 // |
|
975 void CCmPluginVpn::DeleteBearerRecordsL() |
|
976 { |
|
977 OstTraceFunctionEntry0( CCMPLUGINVPN_DELETEBEARERRECORDSL_ENTRY ); |
|
978 iVirtualIapNextLayerRecord->DeleteL( iSession ); |
|
979 OstTraceFunctionExit0( CCMPLUGINVPN_DELETEBEARERRECORDSL_EXIT ); |
|
980 } |
|
981 |
|
982 // --------------------------------------------------------------------------- |
|
983 // CCmPluginVpn::ResetBearerRecords |
|
984 // --------------------------------------------------------------------------- |
|
985 // |
|
986 void CCmPluginVpn::ResetBearerRecords() |
|
987 { |
|
988 OstTraceFunctionEntry0( CCMPLUGINVPN_RESETBEARERRECORDS_ENTRY ); |
|
989 |
|
990 delete iVirtualIapNextLayerRecord; |
|
991 iVirtualIapNextLayerRecord = NULL; |
|
992 OstTraceFunctionExit0( CCMPLUGINVPN_RESETBEARERRECORDS_EXIT ); |
|
993 } |
|
994 |
|
995 // --------------------------------------------------------------------------- |
|
996 // CCmPluginVpn::CopyBearerRecordsL |
|
997 // --------------------------------------------------------------------------- |
|
998 // |
|
999 void CCmPluginVpn::CopyBearerRecordsL( CCmPluginBaseEng* aCopyInstance ) |
|
1000 { |
|
1001 OstTraceFunctionEntry0( CCMPLUGINVPN_COPYBEARERRECORDSL_ENTRY ); |
|
1002 |
|
1003 __ASSERT_DEBUG(iVirtualIapNextLayerRecord != NULL, User::Invariant()); |
|
1004 |
|
1005 CCmPluginVpn* plugin = static_cast<CCmPluginVpn*>( aCopyInstance ); |
|
1006 |
|
1007 __ASSERT_DEBUG(plugin->iVirtualIapNextLayerRecord == NULL, User::Invariant()); |
|
1008 |
|
1009 plugin->iVirtualIapNextLayerRecord = new (ELeave) CCDVirtualIAPNextLayerRecord( iVirtualTableId ); |
|
1010 TUint value = iVirtualIapNextLayerRecord->iIAP; |
|
1011 plugin->iVirtualIapNextLayerRecord->iIAP = value; |
|
1012 value = iVirtualIapNextLayerRecord->iNextLayerSNAP; |
|
1013 plugin->iVirtualIapNextLayerRecord->iNextLayerSNAP = value; |
|
1014 value = iVirtualIapNextLayerRecord->iNextLayerIAP; |
|
1015 plugin->iVirtualIapNextLayerRecord->iNextLayerIAP = value; |
|
1016 |
|
1017 OstTraceFunctionExit0( CCMPLUGINVPN_COPYBEARERRECORDSL_EXIT ); |
|
1018 } |
|
1019 |
|
1020 // --------------------------------------------------------------------------- |
|
1021 // CCmPluginVpn::BearerRecordIdL |
|
1022 // --------------------------------------------------------------------------- |
|
1023 // |
|
1024 void CCmPluginVpn::BearerRecordIdL( TUint32& aRecordId ) |
|
1025 { |
|
1026 OstTraceFunctionEntry0( CCMPLUGINVPN_BEARERRECORDIDL_ENTRY ); |
|
1027 |
|
1028 CCDVirtualBearerRecord* bearerRecord = GetVirtualBearerRecordLC(); |
|
1029 aRecordId = bearerRecord->RecordId(); |
|
1030 CleanupStack::PopAndDestroy(bearerRecord); |
|
1031 |
|
1032 OstTraceFunctionExit0( CCMPLUGINVPN_BEARERRECORDIDL_EXIT ); |
|
1033 } |
|
1034 |
|
1035 // --------------------------------------------------------------------------- |
|
1036 // CCmPluginVpn::BearerRecordNameLC |
|
1037 // --------------------------------------------------------------------------- |
|
1038 // |
|
1039 void CCmPluginVpn::BearerRecordNameLC( HBufC* &aBearerName ) |
|
1040 { |
|
1041 OstTraceFunctionEntry0( CCMPLUGINVPN_BEARERRECORDNAMELC_ENTRY ); |
|
1042 |
|
1043 aBearerName = TPtrC( KCDTypeNameVirtualBearer ).AllocLC(); |
|
1044 |
|
1045 OstTraceFunctionExit0( CCMPLUGINVPN_BEARERRECORDNAMELC_EXIT ); |
|
1046 } |
|
1047 |
|
1048 // --------------------------------------------------------------------------- |
|
1049 // CCmPluginVpn::ServiceRecord |
|
1050 // --------------------------------------------------------------------------- |
|
1051 // |
|
1052 CCDVPNServiceRecord& CCmPluginVpn::ServiceRecord() const |
|
1053 { |
|
1054 OstTraceFunctionEntry0( CCMPLUGINVPN_SERVICERECORD_ENTRY ); |
|
1055 |
|
1056 CCDVPNServiceRecord& serviceRecord = *static_cast<CCDVPNServiceRecord*>( iServiceRecord ); |
|
1057 |
|
1058 OstTraceFunctionExit0( CCMPLUGINVPN_SERVICERECORD_EXIT ); |
|
1059 return serviceRecord; |
|
1060 } |
|
1061 |
|
1062 // --------------------------------------------------------------------------- |
|
1063 // CCmPluginVpn::GetVirtualBearerRecordLC |
|
1064 // --------------------------------------------------------------------------- |
|
1065 // |
|
1066 CCDVirtualBearerRecord* CCmPluginVpn::GetVirtualBearerRecordLC() const |
|
1067 { |
|
1068 OstTraceFunctionEntry0( CCMPLUGINVPN_GETVIRTUALBEARERRECORDLC_ENTRY ); |
|
1069 |
|
1070 //First tries to load the virtual bearer record. |
|
1071 //If the loading fails creates a new one. |
|
1072 CMDBRecordSet<CCDVirtualBearerRecord>* bearersRS = |
|
1073 new(ELeave) CMDBRecordSet<CCDVirtualBearerRecord> |
|
1074 (KCDTIdVirtualBearerRecord); |
|
1075 CleanupStack::PushL( bearersRS ); |
|
1076 |
|
1077 CCDVirtualBearerRecord* bearerRecord = |
|
1078 static_cast<CCDVirtualBearerRecord *> |
|
1079 (CCDRecordBase::RecordFactoryL(KCDTIdVirtualBearerRecord)); |
|
1080 |
|
1081 CleanupStack::PushL( bearerRecord ); |
|
1082 |
|
1083 // Find entries used "vpnconnagt.agt" as agent from Table VirtualBearer |
|
1084 bearerRecord->iBearerAgent.SetL( KVpnVirtualBearerAgent ); |
|
1085 bearersRS->iRecords.AppendL( bearerRecord ); |
|
1086 |
|
1087 CleanupStack::Pop( bearerRecord ); |
|
1088 bearerRecord = NULL; |
|
1089 |
|
1090 CCDVirtualBearerRecord* retVal = NULL; |
|
1091 if ( bearersRS->FindL( iSession ) ) |
|
1092 { |
|
1093 for (TInt i = 0; i < bearersRS->iRecords.Count(); ++i) |
|
1094 { |
|
1095 TPtrC bearerName( (*bearersRS)[i]->iRecordName.GetL() ); |
|
1096 |
|
1097 // Further comparing record ID referred to by this VPN IAP with entry ID in table VirtualBearer |
|
1098 // And also comparing bear name with our expected one "vpnbearer" |
|
1099 if( bearerName == TPtrC( KVpnVirtualBearerName ) ) |
|
1100 { |
|
1101 TUint32 recordId = (*bearersRS)[i]->RecordId(); |
|
1102 retVal = static_cast<CCDVirtualBearerRecord *> |
|
1103 (CCDRecordBase::RecordFactoryL(KCDTIdVirtualBearerRecord)); |
|
1104 CleanupStack::PushL(retVal); |
|
1105 retVal->SetRecordId( recordId ); |
|
1106 retVal->LoadL( iSession ); |
|
1107 CleanupStack::Pop(retVal); |
|
1108 break; |
|
1109 } |
|
1110 } |
|
1111 } |
|
1112 CleanupStack::PopAndDestroy( bearersRS ); |
|
1113 |
|
1114 //If iVirtualBearerRecord is still NULL the loading has failed we try to create a new |
|
1115 //entry to the table. |
|
1116 if (retVal == NULL) |
|
1117 { |
|
1118 retVal = static_cast<CCDVirtualBearerRecord *> |
|
1119 (CCDRecordBase::RecordFactoryL(KCDTIdVirtualBearerRecord)); |
|
1120 CleanupStack::PushL(retVal); |
|
1121 retVal->iRecordName.SetL( KVpnVirtualBearerName ); |
|
1122 retVal->iBearerAgent.SetL( KVpnVirtualBearerAgent ); |
|
1123 retVal->iVirtualBearerNifName.SetL(KVpnVirtualBearerNif); |
|
1124 retVal->iLastSocketActivityTimeout = (TUint32)KNoTimeout; |
|
1125 retVal->iLastSessionClosedTimeout = KLastSessionTimeout; |
|
1126 retVal->iLastSocketClosedTimeout = (TUint32)KNoTimeout; |
|
1127 retVal->iBearerTechnology = KCommDbBearerVirtual; |
|
1128 retVal->SetRecordId( KCDNewRecordRequest ); |
|
1129 |
|
1130 retVal->StoreL( iSession ); |
|
1131 } |
|
1132 else |
|
1133 { |
|
1134 CleanupStack::PushL(retVal); |
|
1135 } |
|
1136 |
|
1137 OstTraceFunctionExit0( CCMPLUGINVPN_GETVIRTUALBEARERRECORDLC_EXIT ); |
|
1138 return retVal; |
|
1139 } |
|
1140 |
|
1141 // --------------------------------------------------------------------------- |
|
1142 // CCmPluginVpn::GetDefPriorityL |
|
1143 // --------------------------------------------------------------------------- |
|
1144 // |
|
1145 TUint32 CCmPluginVpn::GetDefPriorityL( const TUint32 aAttribute ) const |
|
1146 { |
|
1147 OstTraceFunctionEntry0( CCMPLUGINVPN_GETDEFPRIORITYL_ENTRY ); |
|
1148 |
|
1149 TUint32 retVal( KDataMobilitySelectionPolicyPriorityWildCard ); |
|
1150 |
|
1151 CCDGlobalBearerTypePriorizationRecord* priorityRecord = |
|
1152 new( ELeave ) CCDGlobalBearerTypePriorizationRecord( iBearerPriorityTableId ); |
|
1153 CleanupStack::PushL( priorityRecord ); |
|
1154 |
|
1155 priorityRecord->iServiceType.SetL( TPtrC( KCDTypeNameVPNService ) ); |
|
1156 |
|
1157 if ( priorityRecord->FindL( iSession ) ) |
|
1158 { |
|
1159 priorityRecord->LoadL( iSession ); |
|
1160 |
|
1161 switch ( aAttribute ) |
|
1162 { |
|
1163 case ECmDefaultPriority: |
|
1164 { |
|
1165 retVal = priorityRecord->iPriority; |
|
1166 } |
|
1167 break; |
|
1168 case ECmDefaultUiPriority: |
|
1169 { |
|
1170 retVal = priorityRecord->iUIPriority; |
|
1171 } |
|
1172 break; |
|
1173 default: |
|
1174 break; |
|
1175 } |
|
1176 } |
|
1177 CleanupStack::PopAndDestroy( priorityRecord ); |
|
1178 |
|
1179 OstTraceFunctionExit0( CCMPLUGINVPN_GETDEFPRIORITYL_EXIT ); |
|
1180 return retVal; |
|
1181 } |