|
1 /* |
|
2 * Copyright (c) 2005 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: Internet-settings |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #include <commdb.h> |
|
20 #include <cdbstore.h> |
|
21 #include <cdbcols.h> // CommsDB columname defs |
|
22 #include <implementationproxy.h> // For TImplementationProxy definition |
|
23 #include <cdbpreftable.h> |
|
24 #include <etelpckt.h> // ISP enumerations |
|
25 #include <etelmm.h> // GPRS ProtocolType |
|
26 #include <nifvar.h> // CallbackType |
|
27 #include <etelqos.h> // GPRS enumeration |
|
28 #include <wappdef.h> // WAP enumeration |
|
29 #include <sysutil.h> // OOD checking |
|
30 #include <uriutils.h> // ipv4 + ipv6 checking |
|
31 #include <featmgr.h> |
|
32 #include "NSmlInternetAdapter.h" |
|
33 #include "NSmlWLanAdapter.h" |
|
34 #include "nsmldebug.h" |
|
35 #include "nsmldmtreedbclient.h" |
|
36 #include <comms-infras/commdb/protection/protectdb.h> |
|
37 #include <utf.h> |
|
38 |
|
39 |
|
40 #include <metadatabase.h> |
|
41 #include <cmmanagerext.h> |
|
42 #include <cmconnectionmethoddef.h> |
|
43 #include <cmconnectionmethodext.h> |
|
44 #include <cmpluginbaseeng.h> |
|
45 #include <centralrepository.h> |
|
46 #include <pdpcontextmanagerinternalcrkeys.h> |
|
47 |
|
48 const TUint KNSmlInternetAdapterImplUid = 0x101F6DE2; |
|
49 |
|
50 const TUint KIapColumn = 0x00000100; |
|
51 const TUint KLingerColumn = 0x00000200; |
|
52 const TUint KColumnMask = 0xFFFFFF00; |
|
53 const TUint KRowMask = 0x000000FF; |
|
54 |
|
55 |
|
56 #include <SettingEnforcementInfo.h> // VSettingEnforcementInfo |
|
57 |
|
58 class CNSmlWLanAdapter; |
|
59 |
|
60 _LIT( KDaemonManagerName, "NetCfgExtnDhcp" ); |
|
61 _LIT( KConfigDaemonName, "!DhcpServ" ); |
|
62 |
|
63 #ifndef __WINS__ |
|
64 // This lowers the unnecessary compiler warning (armv5) to remark. |
|
65 // "Warning: #174-D: expression has no effect..." is caused by |
|
66 // DBG_ARGS8 macro in no-debug builds. |
|
67 #pragma diag_remark 174 |
|
68 #endif |
|
69 |
|
70 const TInt KBeginTransRetryDelay = 1000000; // Delay for comms db begintransaction retry (microseconds) |
|
71 const TInt KBeginTransRetryCount = 7; // Maximum number of retries |
|
72 //----------------------------------------------------------------------------- |
|
73 // CSmlInternetAdapter* CSmlInternetAdapter::NewL( ) |
|
74 //----------------------------------------------------------------------------- |
|
75 |
|
76 CNSmlInternetAdapter* CNSmlInternetAdapter::NewL(MSmlDmCallback* aDmCallback ) |
|
77 { |
|
78 _DBG_FILE("CNSmlInternetAdapter::NewL(): begin"); |
|
79 |
|
80 CNSmlInternetAdapter* self = NewLC(aDmCallback); |
|
81 CleanupStack::Pop(); |
|
82 |
|
83 _DBG_FILE("CNSmlInternetAdapter::NewL(): end"); |
|
84 return self; |
|
85 } |
|
86 |
|
87 //------------------------------------------------------------------------------ |
|
88 // CNSmlInternetAdapter* CNSmlInternetAdapter::NewLC( ) |
|
89 //------------------------------------------------------------------------------ |
|
90 CNSmlInternetAdapter* CNSmlInternetAdapter::NewLC(MSmlDmCallback* aDmCallback ) |
|
91 { |
|
92 _DBG_FILE("CNSmlInternetAdapter::NewLC(): begin"); |
|
93 CNSmlInternetAdapter* self = new (ELeave) CNSmlInternetAdapter(aDmCallback); |
|
94 CleanupStack::PushL(self); |
|
95 |
|
96 self->iCallBack = aDmCallback; |
|
97 self->ConstructL(); |
|
98 |
|
99 _DBG_FILE("CNSmlInternetAdapter::NewLC(): end"); |
|
100 return self; |
|
101 } |
|
102 |
|
103 //------------------------------------------------------------------------------ |
|
104 // CNSmlInternetAdapter::CNSmlInternetAdapter() |
|
105 //------------------------------------------------------------------------------ |
|
106 CNSmlInternetAdapter::CNSmlInternetAdapter(TAny* aEcomArguments) |
|
107 : CSmlDmAdapter(aEcomArguments) |
|
108 { |
|
109 _DBG_FILE("CNSmlInternetAdapter::CNSmlInternetAdapter(): begin"); |
|
110 _DBG_FILE("CNSmlInternetAdapter::CNSmlInternetAdapter(): end"); |
|
111 } |
|
112 |
|
113 //------------------------------------------------------------------------------ |
|
114 // CNSmlInternetAdapter::~CNSmlInternetAdapter(TAny* aEcomArguments) |
|
115 //------------------------------------------------------------------------------ |
|
116 CNSmlInternetAdapter::~CNSmlInternetAdapter() |
|
117 { |
|
118 _DBG_FILE("CNSmlInternetAdapter::~CNSmlInternetAdapter(): begin"); |
|
119 |
|
120 delete iField; |
|
121 |
|
122 delete iPrevURI; |
|
123 |
|
124 // Command buffer cleaning if leave happend |
|
125 if (iBuffer) |
|
126 { |
|
127 for(TInt i=0;i<iBuffer->Count();i++) |
|
128 { |
|
129 delete iBuffer->At(i).iMappingName; |
|
130 delete iBuffer->At(i).iName; |
|
131 |
|
132 ClearBuffer( iBuffer->At(iExecutionIndex).iNodeBuf ); |
|
133 delete iBuffer->At(i).iNodeBuf; |
|
134 |
|
135 ClearBuffer( iBuffer->At(iExecutionIndex).iWlanNodeBuf ); |
|
136 delete iBuffer->At(i).iWlanNodeBuf; |
|
137 } |
|
138 |
|
139 iBuffer->Reset(); |
|
140 delete iBuffer; |
|
141 } |
|
142 |
|
143 if ( iWlanSupported ) |
|
144 { |
|
145 delete iWlanAdapter; |
|
146 } |
|
147 |
|
148 delete iDatabase; |
|
149 FeatureManager::UnInitializeLib(); |
|
150 _DBG_FILE("CNSmlInternetAdapter::~CNSmlInternetAdapter(): end"); |
|
151 } |
|
152 |
|
153 //============================================= |
|
154 // CNSmlInternetAdapter::ConstructL() |
|
155 // Second phase constructor. |
|
156 //============================================= |
|
157 void CNSmlInternetAdapter::ConstructL() |
|
158 { |
|
159 FeatureManager::InitializeLibL(); |
|
160 iField = HBufC8::NewL( KNSmlMaxURLLength ); |
|
161 |
|
162 iPrevURI = HBufC8::NewL( KNSmlMaxURLLength ); |
|
163 |
|
164 iDatabase = CCommsDatabase::NewL(); |
|
165 // iDatabase->BeginTransaction(); //+++ |
|
166 iTransactionCommitted=ETrue; |
|
167 i3GPPPS = EFalse; |
|
168 |
|
169 iLeafType = EDMUnset; // Default for leaf handling |
|
170 |
|
171 // Reset identification data |
|
172 |
|
173 iDirection = ECommDbConnectionDirectionUnknown; |
|
174 |
|
175 // |
|
176 // Command buffering used for AddNode + AddLeaf |
|
177 // |
|
178 iBuffer = new (ELeave) CArrayFixFlat <TNSmlAPBufferElement> (KNSmlAPGranularity); |
|
179 |
|
180 // checks if Wlan feature is supported |
|
181 iWlanSupported = FeatureManager::FeatureSupported( KFeatureIdProtocolWlan ); |
|
182 |
|
183 // WlanAdapter |
|
184 // |
|
185 if ( iWlanSupported ) |
|
186 { |
|
187 iWlanAdapter = CNSmlWLanAdapter::NewL(iCallBack, *iDatabase); |
|
188 } |
|
189 |
|
190 iNetworkId = KErrNotFound; |
|
191 iLingerValue = NULL; |
|
192 iLingerFlag = ETrue; |
|
193 isAdd = EFalse; |
|
194 } |
|
195 |
|
196 //------------------------------------------------------------------------------ |
|
197 // void CNSmlInternetAdapter::DDFVersionL() |
|
198 //------------------------------------------------------------------------------ |
|
199 void CNSmlInternetAdapter::DDFVersionL(CBufBase& aDDFVersion) |
|
200 { |
|
201 aDDFVersion.InsertL(0,KNSmlInternetAdapterDDFversion); |
|
202 } |
|
203 //------------------------------------------------------------------------------ |
|
204 // void CNSmlInternetAdapter::DDFStructureL() |
|
205 //------------------------------------------------------------------------------ |
|
206 void CNSmlInternetAdapter::DDFStructureL( MSmlDmDDFObject& aDDF ) |
|
207 { |
|
208 _DBG_FILE("CNSmlInternetAdapter::DDFStructureL(): begin"); |
|
209 |
|
210 // |
|
211 // Set rest acceptable operations for data itself |
|
212 // |
|
213 |
|
214 TSmlDmAccessTypes aclTypesAddGetDel; |
|
215 aclTypesAddGetDel.SetGet(); |
|
216 aclTypesAddGetDel.SetAdd(); |
|
217 aclTypesAddGetDel.SetDelete(); |
|
218 |
|
219 TSmlDmAccessTypes aclTypesAddGet; |
|
220 aclTypesAddGet.SetGet(); |
|
221 aclTypesAddGet.SetAdd(); |
|
222 |
|
223 TSmlDmAccessTypes aclTypesNoDelete; |
|
224 aclTypesNoDelete.SetGet(); |
|
225 aclTypesNoDelete.SetReplace(); |
|
226 aclTypesNoDelete.SetAdd(); |
|
227 |
|
228 TSmlDmAccessTypes aclTypesNoGet; |
|
229 aclTypesNoGet.SetReplace(); |
|
230 aclTypesNoGet.SetAdd(); |
|
231 aclTypesNoGet.SetDelete(); |
|
232 |
|
233 TSmlDmAccessTypes aclTypesAddReplace; |
|
234 aclTypesAddReplace.SetReplace(); |
|
235 aclTypesAddReplace.SetAdd(); |
|
236 |
|
237 TSmlDmAccessTypes aclTypesOnlyGet; |
|
238 aclTypesOnlyGet.SetGet(); |
|
239 |
|
240 TSmlDmAccessTypes aclTypesAll; |
|
241 aclTypesAll.SetGet(); |
|
242 aclTypesAll.SetReplace(); |
|
243 aclTypesAll.SetAdd(); |
|
244 aclTypesAll.SetDelete(); |
|
245 |
|
246 MSmlDmDDFObject* ddfRoot = &aDDF; |
|
247 MSmlDmDDFObject& ddf = ddfRoot->AddChildObjectL(KNSmlDdfAP); |
|
248 |
|
249 _LIT8(KDescription,"AP-Settings DDF description"); |
|
250 _LIT8(KDFTitle,"AP-settings title"); |
|
251 |
|
252 FillNodeInfoL( ddf, |
|
253 aclTypesOnlyGet, |
|
254 MSmlDmDDFObject::EOne, |
|
255 MSmlDmDDFObject::EPermanent, |
|
256 MSmlDmDDFObject::ENode, |
|
257 KDescription); |
|
258 |
|
259 ddf.SetDFTitleL(KDFTitle); |
|
260 ddf.SetDefaultValueL(KNullDesC8); |
|
261 |
|
262 MSmlDmDDFObject& nApDDF = ddf.AddChildObjectGroupL(); // For AP/<X> |
|
263 |
|
264 FillNodeInfoL( nApDDF, |
|
265 aclTypesAll, |
|
266 MSmlDmDDFObject::EZeroOrMore, |
|
267 MSmlDmDDFObject::EDynamic, |
|
268 MSmlDmDDFObject::ENode, |
|
269 KNullDesC8); |
|
270 |
|
271 MSmlDmDDFObject& nNAPDefRootDDF = nApDDF.AddChildObjectL(KNSmlDdfNAPDef); // NAPDef |
|
272 FillNodeInfoL( nNAPDefRootDDF, |
|
273 aclTypesAddGet, |
|
274 MSmlDmDDFObject::EZeroOrOne, // EZeroOrMore |
|
275 MSmlDmDDFObject::EDynamic, |
|
276 MSmlDmDDFObject::ENode, |
|
277 KNullDesC8); |
|
278 |
|
279 MSmlDmDDFObject& nNAPDefDDF = nNAPDefRootDDF.AddChildObjectGroupL(); // For NAPDef<x> |
|
280 FillNodeInfoL( nNAPDefDDF, |
|
281 aclTypesAddGet, |
|
282 MSmlDmDDFObject::EOne, |
|
283 MSmlDmDDFObject::EDynamic, |
|
284 MSmlDmDDFObject::ENode, |
|
285 KNullDesC8); |
|
286 |
|
287 MSmlDmDDFObject& nPxRootDDF = nApDDF.AddChildObjectL(KNSmlDdfPx); // Px |
|
288 FillNodeInfoL( nPxRootDDF, |
|
289 aclTypesAddGet, |
|
290 MSmlDmDDFObject::EZeroOrOne, |
|
291 MSmlDmDDFObject::EDynamic, |
|
292 MSmlDmDDFObject::ENode, |
|
293 KNullDesC8); |
|
294 |
|
295 MSmlDmDDFObject& nPxDDF = nPxRootDDF.AddChildObjectGroupL(); // For Px<x> |
|
296 FillNodeInfoL( nPxDDF, |
|
297 aclTypesAddGetDel,//aclTypesAddGet |
|
298 MSmlDmDDFObject::EOne, |
|
299 MSmlDmDDFObject::EDynamic, |
|
300 MSmlDmDDFObject::ENode, |
|
301 KNullDesC8); |
|
302 // |
|
303 // NAPDef-node fields |
|
304 // |
|
305 MSmlDmDDFObject& nNameDDF = nNAPDefDDF.AddChildObjectL(KNSmlDdfNAPName); // Name |
|
306 FillNodeInfoL( nNameDDF, |
|
307 aclTypesNoDelete, |
|
308 MSmlDmDDFObject::EZeroOrOne, |
|
309 MSmlDmDDFObject::EDynamic, |
|
310 MSmlDmDDFObject::EChr, |
|
311 KNSmlDdfNAPNameDesc); |
|
312 |
|
313 MSmlDmDDFObject& nNAPIDDDF = nNAPDefDDF.AddChildObjectL(KNSmlDdfNAPID); // NAPID |
|
314 FillNodeInfoL( nNAPIDDDF, |
|
315 aclTypesOnlyGet, |
|
316 MSmlDmDDFObject::EOne, |
|
317 MSmlDmDDFObject::EDynamic, |
|
318 MSmlDmDDFObject::EChr, |
|
319 KNSmlDdfNAPIDDesc); |
|
320 |
|
321 MSmlDmDDFObject& nNAPLingerDDF = nNAPDefDDF.AddChildObjectL(KNSmlDdfNAPLinger); // Linger |
|
322 FillNodeInfoL( nNAPLingerDDF, |
|
323 aclTypesNoDelete, |
|
324 MSmlDmDDFObject::EZeroOrOne, |
|
325 MSmlDmDDFObject::EDynamic, |
|
326 MSmlDmDDFObject::EInt, |
|
327 KNSmlDdfNAPLingerDesc); |
|
328 |
|
329 MSmlDmDDFObject& nNAPStartpgDDF = nNAPDefDDF.AddChildObjectL(KNSmlDdfStartpg); // Startpg |
|
330 FillNodeInfoL( nNAPStartpgDDF, |
|
331 aclTypesNoDelete, |
|
332 MSmlDmDDFObject::EZeroOrOne, |
|
333 MSmlDmDDFObject::EDynamic, |
|
334 MSmlDmDDFObject::EChr, |
|
335 KNSmlDdfStartpgDesc); |
|
336 |
|
337 MSmlDmDDFObject& nBearerRootDDF = nNAPDefDDF.AddChildObjectL(KNSmlDdfBearer); // Bearer |
|
338 FillNodeInfoL( nBearerRootDDF, |
|
339 aclTypesAddGet, |
|
340 MSmlDmDDFObject::EZeroOrOne, |
|
341 MSmlDmDDFObject::EDynamic, |
|
342 MSmlDmDDFObject::ENode, |
|
343 KNullDesC8); |
|
344 |
|
345 MSmlDmDDFObject& nBearerDDF = nBearerRootDDF.AddChildObjectGroupL(); // Bearer/<x> |
|
346 FillNodeInfoL( nBearerDDF, |
|
347 aclTypesAddGet, |
|
348 MSmlDmDDFObject::EZeroOrOne, |
|
349 MSmlDmDDFObject::EDynamic, |
|
350 MSmlDmDDFObject::ENode, |
|
351 KNullDesC8); |
|
352 |
|
353 MSmlDmDDFObject& nBearerLDDF = nBearerDDF.AddChildObjectL(KNSmlDdfBearerL); // BearerL |
|
354 FillNodeInfoL( nBearerLDDF, |
|
355 aclTypesAddGet, |
|
356 MSmlDmDDFObject::EOne, |
|
357 MSmlDmDDFObject::EDynamic, |
|
358 MSmlDmDDFObject::EChr, |
|
359 KNSmlDdfBearerLDesc); |
|
360 |
|
361 MSmlDmDDFObject& nDirectionDDF = nBearerDDF.AddChildObjectL(KNSmlDdfDirection); // Direction |
|
362 FillNodeInfoL( nDirectionDDF, |
|
363 aclTypesAddGet, |
|
364 MSmlDmDDFObject::EOne, |
|
365 MSmlDmDDFObject::EDynamic, |
|
366 MSmlDmDDFObject::EChr, |
|
367 KNSmlDdfDirectionDesc); |
|
368 |
|
369 MSmlDmDDFObject& nNAPAddrDDF = nNAPDefDDF.AddChildObjectL(KNSmlDdfNAPAddr); // NAPAddr |
|
370 FillNodeInfoL( nNAPAddrDDF, |
|
371 aclTypesNoDelete, |
|
372 MSmlDmDDFObject::EZeroOrOne, |
|
373 MSmlDmDDFObject::EDynamic, |
|
374 MSmlDmDDFObject::EChr, |
|
375 KNSmlDdfNAPAddrDesc); |
|
376 |
|
377 MSmlDmDDFObject& nNAPAddrTyDDF = nNAPDefDDF.AddChildObjectL(KNSmlDdfNAPAddrTy); // NAPAddrTy |
|
378 FillNodeInfoL( nNAPAddrTyDDF, |
|
379 aclTypesNoDelete, |
|
380 MSmlDmDDFObject::EZeroOrOne, |
|
381 MSmlDmDDFObject::EDynamic, |
|
382 MSmlDmDDFObject::EChr, |
|
383 KNSmlDdfNAPAddrTyDesc); |
|
384 |
|
385 MSmlDmDDFObject& nDNSAddrRootDDF = nNAPDefDDF.AddChildObjectL(KNSmlDdfDNSAddr); // DNSAddr |
|
386 FillNodeInfoL( nDNSAddrRootDDF, |
|
387 aclTypesAddGet, |
|
388 MSmlDmDDFObject::EZeroOrOne, |
|
389 MSmlDmDDFObject::EDynamic, |
|
390 MSmlDmDDFObject::ENode, |
|
391 KNullDesC8); |
|
392 |
|
393 MSmlDmDDFObject& nDNSAddrDDF = nDNSAddrRootDDF.AddChildObjectGroupL(); // DNSAddr/<x> |
|
394 FillNodeInfoL( nDNSAddrDDF, |
|
395 aclTypesAddGet, |
|
396 MSmlDmDDFObject::EOneOrMore, |
|
397 MSmlDmDDFObject::EDynamic, |
|
398 MSmlDmDDFObject::ENode, |
|
399 KNullDesC8); |
|
400 |
|
401 MSmlDmDDFObject& nDNSAddrLDDF = nDNSAddrDDF.AddChildObjectL(KNSmlDdfDNSAddrL); // DNSAddrL |
|
402 FillNodeInfoL( nDNSAddrLDDF, |
|
403 aclTypesNoDelete, |
|
404 MSmlDmDDFObject::EOne, |
|
405 MSmlDmDDFObject::EDynamic, |
|
406 MSmlDmDDFObject::EChr, |
|
407 KNSmlDdfDNSAddrLDesc); |
|
408 |
|
409 MSmlDmDDFObject& nDNSAddrTyDDF = nDNSAddrDDF.AddChildObjectL(KNSmlDdfDNSAddrTy); // DNSAddrTy |
|
410 FillNodeInfoL( nDNSAddrTyDDF, |
|
411 aclTypesOnlyGet, |
|
412 MSmlDmDDFObject::EOne, |
|
413 MSmlDmDDFObject::EDynamic, |
|
414 MSmlDmDDFObject::EChr, |
|
415 KNSmlDdfDNSAddrTyDesc); |
|
416 |
|
417 MSmlDmDDFObject& nDNSPriorityDDF = nDNSAddrDDF.AddChildObjectL(KNSmlDdfDNSPriority); // DNSAddrPriority |
|
418 FillNodeInfoL( nDNSPriorityDDF, |
|
419 aclTypesNoDelete, |
|
420 MSmlDmDDFObject::EOne, |
|
421 MSmlDmDDFObject::EDynamic, |
|
422 MSmlDmDDFObject::EChr, |
|
423 KNSmlDdfDNSPriorityDesc); |
|
424 |
|
425 MSmlDmDDFObject& nNAPAuthInfRootDDF = nNAPDefDDF.AddChildObjectL(KNSmlDdfNAPAuthInf); // NAPAuthInf |
|
426 FillNodeInfoL( nNAPAuthInfRootDDF, |
|
427 aclTypesNoDelete, |
|
428 MSmlDmDDFObject::EZeroOrOne, |
|
429 MSmlDmDDFObject::EDynamic, |
|
430 MSmlDmDDFObject::ENode, |
|
431 KNullDesC8); |
|
432 |
|
433 MSmlDmDDFObject& nNAPAuthInfDDF = nNAPAuthInfRootDDF.AddChildObjectGroupL(); // NAPAuthInf/<x> |
|
434 FillNodeInfoL( nNAPAuthInfDDF, |
|
435 aclTypesNoDelete, |
|
436 MSmlDmDDFObject::EZeroOrOne, |
|
437 MSmlDmDDFObject::EDynamic, |
|
438 MSmlDmDDFObject::ENode, |
|
439 KNullDesC8); |
|
440 |
|
441 MSmlDmDDFObject& nAuthNameDDF = nNAPAuthInfDDF.AddChildObjectL(KNSmlDdfAuthName); // AuthName |
|
442 FillNodeInfoL( nAuthNameDDF, |
|
443 aclTypesNoDelete, |
|
444 MSmlDmDDFObject::EZeroOrOne, |
|
445 MSmlDmDDFObject::EDynamic, |
|
446 MSmlDmDDFObject::EChr, |
|
447 KNSmlDdfAuthNameDesc); |
|
448 |
|
449 MSmlDmDDFObject& nAuthSecrDDF = nNAPAuthInfDDF.AddChildObjectL(KNSmlDdfAuthSecr); // AuthSecr |
|
450 FillNodeInfoL( nAuthSecrDDF, |
|
451 aclTypesAddReplace, |
|
452 MSmlDmDDFObject::EZeroOrOne, |
|
453 MSmlDmDDFObject::EDynamic, |
|
454 MSmlDmDDFObject::EChr, |
|
455 KNSmlDdfAuthSecrDesc); |
|
456 |
|
457 MSmlDmDDFObject& nDefGWDDF = nNAPDefDDF.AddChildObjectL(KNSmlDdfDefGW); // DefGW |
|
458 FillNodeInfoL( nDefGWDDF, |
|
459 aclTypesNoDelete, |
|
460 MSmlDmDDFObject::EZeroOrOne, |
|
461 MSmlDmDDFObject::EDynamic, |
|
462 MSmlDmDDFObject::EChr, |
|
463 KNSmlDdfDefGWDesc); |
|
464 |
|
465 MSmlDmDDFObject& nNetworkMaskDDF = nNAPDefDDF.AddChildObjectL(KNSmlDdfNetworkMask); // NetworkMask |
|
466 FillNodeInfoL( nNetworkMaskDDF, |
|
467 aclTypesNoDelete, |
|
468 MSmlDmDDFObject::EZeroOrOne, |
|
469 MSmlDmDDFObject::EDynamic, |
|
470 MSmlDmDDFObject::EChr, |
|
471 KNSmlDdfNetworkMaskDesc); |
|
472 |
|
473 MSmlDmDDFObject& nUsePTxtLogDDF = nNAPDefDDF.AddChildObjectL(KNSmlDdfUsePTxtLog); // UsePTxtLog |
|
474 FillNodeInfoL( nUsePTxtLogDDF, |
|
475 aclTypesNoDelete, |
|
476 MSmlDmDDFObject::EZeroOrOne, |
|
477 MSmlDmDDFObject::EDynamic, |
|
478 MSmlDmDDFObject::EBool, |
|
479 KNSmlDdfUsePTxtLogDesc); |
|
480 |
|
481 MSmlDmDDFObject& nNetworksRootDDF = nNAPDefDDF.AddChildObjectL(KNSmlDdfNetworks); // Networks |
|
482 FillNodeInfoL( nNetworksRootDDF, |
|
483 aclTypesAddGet, |
|
484 MSmlDmDDFObject::EZeroOrOne, |
|
485 MSmlDmDDFObject::EDynamic, |
|
486 MSmlDmDDFObject::ENode, |
|
487 KNullDesC8 ); |
|
488 |
|
489 MSmlDmDDFObject& nNetworksDDF = nNetworksRootDDF.AddChildObjectGroupL(); // Networks/<x> |
|
490 FillNodeInfoL( nNetworksDDF, |
|
491 aclTypesAddGet, |
|
492 MSmlDmDDFObject::EOne, |
|
493 MSmlDmDDFObject::EDynamic, |
|
494 MSmlDmDDFObject::ENode, |
|
495 KNullDesC8); |
|
496 |
|
497 MSmlDmDDFObject& nNetworkNameDDF = nNetworksDDF.AddChildObjectL(KNSmlDdfNetworkName); // NetworkName |
|
498 FillNodeInfoL( nNetworkNameDDF, |
|
499 aclTypesNoDelete, |
|
500 MSmlDmDDFObject::EOne, |
|
501 MSmlDmDDFObject::EDynamic, |
|
502 MSmlDmDDFObject::EChr, |
|
503 KNSmlDdfNetworkNameDesc); |
|
504 |
|
505 MSmlDmDDFObject& nNetworkIDDDF = nNetworksDDF.AddChildObjectL(KNSmlDdfNetworkID); // NetworkID |
|
506 FillNodeInfoL( nNetworkIDDDF, |
|
507 aclTypesNoDelete, |
|
508 MSmlDmDDFObject::EOne, |
|
509 MSmlDmDDFObject::EDynamic, |
|
510 MSmlDmDDFObject::EInt, |
|
511 KNSmlDdfNetworkIDDesc); |
|
512 |
|
513 MSmlDmDDFObject& nPPPCompDDF = nNAPDefDDF.AddChildObjectL(KNSmlDdfPPPComp); // PPPComp |
|
514 FillNodeInfoL( nPPPCompDDF, |
|
515 aclTypesNoDelete, |
|
516 MSmlDmDDFObject::EZeroOrOne, |
|
517 MSmlDmDDFObject::EDynamic, |
|
518 MSmlDmDDFObject::EBool, |
|
519 KNSmlDdfPPPCompDesc); |
|
520 |
|
521 MSmlDmDDFObject& nGPRSPDPDDF = nNAPDefDDF.AddChildObjectL(KNSmlDdfGPRSPDP); // GPRSPDP |
|
522 FillNodeInfoL( nGPRSPDPDDF, |
|
523 aclTypesNoDelete, |
|
524 MSmlDmDDFObject::EZeroOrOne, |
|
525 MSmlDmDDFObject::EDynamic, |
|
526 MSmlDmDDFObject::EChr, |
|
527 KNSmlDdfGPRSPDPDesc); |
|
528 |
|
529 MSmlDmDDFObject& nIPAddrFromServerDDF = nNAPDefDDF.AddChildObjectL(KNSmlDdfIPAddrFromServer); // IPAddrFromServer |
|
530 FillNodeInfoL( nIPAddrFromServerDDF, |
|
531 aclTypesNoDelete, |
|
532 MSmlDmDDFObject::EZeroOrOne, |
|
533 MSmlDmDDFObject::EDynamic, |
|
534 MSmlDmDDFObject::EBool, |
|
535 KNSmlDdfIPAddrFromServerDesc); |
|
536 |
|
537 MSmlDmDDFObject& nIPAddrDDF = nNAPDefDDF.AddChildObjectL(KNSmlDdfIPAddr); // IPAddr |
|
538 FillNodeInfoL( nIPAddrDDF, |
|
539 aclTypesNoDelete, |
|
540 MSmlDmDDFObject::EZeroOrOne, |
|
541 MSmlDmDDFObject::EDynamic, |
|
542 MSmlDmDDFObject::EChr, |
|
543 KNSmlDdfIPAddrDesc); |
|
544 |
|
545 MSmlDmDDFObject& nDNSAddrFromServerDDF = nNAPDefDDF.AddChildObjectL(KNSmlDdfDNSAddrFromServer); // DNSAddrFromServer |
|
546 FillNodeInfoL( nDNSAddrFromServerDDF, |
|
547 aclTypesNoDelete, |
|
548 MSmlDmDDFObject::EZeroOrOne, |
|
549 MSmlDmDDFObject::EDynamic, |
|
550 MSmlDmDDFObject::EBool, |
|
551 KNSmlDdfDNSAddrFromServerDesc); |
|
552 |
|
553 MSmlDmDDFObject& nIPv6DNSAddrFromServerDDF = nNAPDefDDF.AddChildObjectL(KNSmlDdfIPv6DNSAddrFromServer); // IPv6DNSAddrFromServer |
|
554 FillNodeInfoL( nIPv6DNSAddrFromServerDDF, |
|
555 aclTypesNoDelete, |
|
556 MSmlDmDDFObject::EZeroOrOne, |
|
557 MSmlDmDDFObject::EDynamic, |
|
558 MSmlDmDDFObject::EBool, |
|
559 KNSmlDdfIPv6DNSAddrFromServerDesc); |
|
560 |
|
561 MSmlDmDDFObject& nIfNetworksDDF = nNAPDefDDF.AddChildObjectL(KNSmlDdfIfNetworks); // IfNetworks |
|
562 FillNodeInfoL( nIfNetworksDDF, |
|
563 aclTypesNoDelete, |
|
564 MSmlDmDDFObject::EZeroOrOne, |
|
565 MSmlDmDDFObject::EDynamic, |
|
566 MSmlDmDDFObject::EChr, |
|
567 KNSmlDdfIfNetworksDesc); |
|
568 |
|
569 MSmlDmDDFObject& nIAPServiceDDF = nNAPDefDDF.AddChildObjectL(KNSmlDdfIAPService); // IAPService |
|
570 FillNodeInfoL( nIAPServiceDDF, |
|
571 aclTypesOnlyGet, |
|
572 MSmlDmDDFObject::EZeroOrOne, |
|
573 MSmlDmDDFObject::EDynamic, |
|
574 MSmlDmDDFObject::EChr, |
|
575 KNSmlDdfIAPServiceDesc); |
|
576 |
|
577 |
|
578 |
|
579 MSmlDmDDFObject& nIAPSeamlessnessDDF = nNAPDefDDF.AddChildObjectL(KNSmlDdfIAPSeamlessness); // IAPService |
|
580 FillNodeInfoL( nIAPSeamlessnessDDF, |
|
581 aclTypesNoDelete, |
|
582 MSmlDmDDFObject::EZeroOrOne, |
|
583 MSmlDmDDFObject::EDynamic, |
|
584 MSmlDmDDFObject::EInt, |
|
585 KNSmlDdfIAPSeamlessnessDesc); |
|
586 MSmlDmDDFObject& nIAPMetaDataDDF = nNAPDefDDF.AddChildObjectL(KNSmlDdfIAPMetaData); // IAPService |
|
587 FillNodeInfoL( nIAPMetaDataDDF, |
|
588 aclTypesNoDelete, |
|
589 MSmlDmDDFObject::EZeroOrOne, |
|
590 MSmlDmDDFObject::EDynamic, |
|
591 MSmlDmDDFObject::EInt, |
|
592 KNSmlDdfIAPMetaDataDesc); |
|
593 |
|
594 if ( iWlanSupported ) |
|
595 { |
|
596 iWlanAdapter->DDFStructureL( nNAPDefDDF ); // Adds WLAN fields to DDF |
|
597 } |
|
598 |
|
599 // |
|
600 // Px-node fields |
|
601 // |
|
602 MSmlDmDDFObject& nPxNameDDF = nPxDDF.AddChildObjectL(KNSmlDdfPxName); // Name |
|
603 FillNodeInfoL( nPxNameDDF, |
|
604 aclTypesNoDelete, |
|
605 MSmlDmDDFObject::EZeroOrOne, |
|
606 MSmlDmDDFObject::EDynamic, |
|
607 MSmlDmDDFObject::EChr, |
|
608 KNSmlDdfPxDesc); |
|
609 |
|
610 MSmlDmDDFObject& nPxIdDDF = nPxDDF.AddChildObjectL(KNSmlDdfPxId); // PxId |
|
611 FillNodeInfoL( nPxIdDDF, |
|
612 aclTypesOnlyGet, |
|
613 MSmlDmDDFObject::EOne, |
|
614 MSmlDmDDFObject::EDynamic, |
|
615 MSmlDmDDFObject::EChr, |
|
616 KNSmlDdfPxIdDesc); |
|
617 |
|
618 MSmlDmDDFObject& nDomainRootDDF = nPxDDF.AddChildObjectL(KNSmlDdfDomain); // Domain |
|
619 FillNodeInfoL( nDomainRootDDF, |
|
620 aclTypesAddGet, |
|
621 MSmlDmDDFObject::EZeroOrOne, |
|
622 MSmlDmDDFObject::EDynamic, |
|
623 MSmlDmDDFObject::ENode, |
|
624 KNSmlDdfDomainDesc); |
|
625 |
|
626 MSmlDmDDFObject& nDomainDDF = nDomainRootDDF.AddChildObjectGroupL(); // Domain<x> |
|
627 FillNodeInfoL( nDomainDDF, |
|
628 aclTypesAddGet, |
|
629 MSmlDmDDFObject::EOneOrMore, |
|
630 MSmlDmDDFObject::EDynamic, |
|
631 MSmlDmDDFObject::ENode, |
|
632 KNullDesC8); |
|
633 |
|
634 MSmlDmDDFObject& nDomainLDDF = nDomainDDF.AddChildObjectL(KNSmlDdfDomainL); // DomainL (Get) |
|
635 FillNodeInfoL( nDomainLDDF, |
|
636 aclTypesNoDelete, |
|
637 MSmlDmDDFObject::EOne, |
|
638 MSmlDmDDFObject::EDynamic, |
|
639 MSmlDmDDFObject::EChr, |
|
640 KNSmlDdfDomainLDesc); |
|
641 |
|
642 MSmlDmDDFObject& nPxPWDDF = nPxDDF.AddChildObjectL(KNSmlDdfPxPW); // PxPW |
|
643 FillNodeInfoL( nPxPWDDF, |
|
644 aclTypesNoDelete, |
|
645 MSmlDmDDFObject::EZeroOrOne, |
|
646 MSmlDmDDFObject::EDynamic, |
|
647 MSmlDmDDFObject::EChr, |
|
648 KNSmlDdfPxPWDesc); |
|
649 |
|
650 MSmlDmDDFObject& nPxAddrDDF = nPxDDF.AddChildObjectL(KNSmlDdfPxAddr); // PxAddr |
|
651 FillNodeInfoL( nPxAddrDDF, |
|
652 aclTypesNoDelete, |
|
653 MSmlDmDDFObject::EOne, |
|
654 MSmlDmDDFObject::EDynamic, |
|
655 MSmlDmDDFObject::EChr, |
|
656 KNSmlDdfPxAddrDesc); |
|
657 |
|
658 MSmlDmDDFObject& nPortRootDDF = nPxDDF.AddChildObjectL(KNSmlDdfPort); // Port |
|
659 FillNodeInfoL( nPortRootDDF, |
|
660 aclTypesAddGet, |
|
661 MSmlDmDDFObject::EZeroOrOne, |
|
662 MSmlDmDDFObject::EDynamic, |
|
663 MSmlDmDDFObject::ENode, |
|
664 KNSmlDdfPortDesc); |
|
665 |
|
666 MSmlDmDDFObject& nPortDDF = nPortRootDDF.AddChildObjectGroupL(); // Port<x> |
|
667 FillNodeInfoL( nPortDDF, |
|
668 aclTypesAddGet, |
|
669 MSmlDmDDFObject::EOneOrMore, |
|
670 MSmlDmDDFObject::EDynamic, |
|
671 MSmlDmDDFObject::ENode, |
|
672 KNullDesC8); |
|
673 |
|
674 MSmlDmDDFObject& nPortNbrDDF = nPortDDF.AddChildObjectL(KNSmlDdfPortNbr); // PortNbr (Get) |
|
675 FillNodeInfoL( nPortNbrDDF, |
|
676 aclTypesNoDelete, |
|
677 MSmlDmDDFObject::EOne, |
|
678 MSmlDmDDFObject::EDynamic, |
|
679 MSmlDmDDFObject::EInt, |
|
680 KNSmlDdfPortNbrDesc); |
|
681 |
|
682 MSmlDmDDFObject& nToNAPIDRootDDF = nPxDDF.AddChildObjectL(KNSmlDdfToNAPID); // ToNAPID |
|
683 FillNodeInfoL( nToNAPIDRootDDF, |
|
684 aclTypesOnlyGet, |
|
685 MSmlDmDDFObject::EZeroOrOne, |
|
686 MSmlDmDDFObject::EDynamic, |
|
687 MSmlDmDDFObject::ENode, |
|
688 KNSmlDdfToNAPIDDesc); |
|
689 |
|
690 MSmlDmDDFObject& nToNAPIDDDF = nToNAPIDRootDDF.AddChildObjectGroupL(); // ToNAPID<x> |
|
691 FillNodeInfoL( nToNAPIDDDF, |
|
692 aclTypesOnlyGet, |
|
693 MSmlDmDDFObject::EOne, |
|
694 MSmlDmDDFObject::EDynamic, |
|
695 MSmlDmDDFObject::ENode, |
|
696 KNullDesC8); |
|
697 |
|
698 MSmlDmDDFObject& nToNAPIDLDDF = nToNAPIDDDF.AddChildObjectL(KNSmlDdfToNAPIDL); // ToNAPIDL (Get) |
|
699 FillNodeInfoL( nToNAPIDLDDF, |
|
700 aclTypesOnlyGet, |
|
701 MSmlDmDDFObject::EOne, |
|
702 MSmlDmDDFObject::EDynamic, |
|
703 MSmlDmDDFObject::EChr, |
|
704 KNSmlDdfToNAPIDLDesc); |
|
705 |
|
706 MSmlDmDDFObject& nPxStartpgDDF = nPxDDF.AddChildObjectL(KNSmlDdfStartpg); // Startpg |
|
707 FillNodeInfoL( nPxStartpgDDF, |
|
708 aclTypesNoDelete, |
|
709 MSmlDmDDFObject::EZeroOrOne, |
|
710 MSmlDmDDFObject::EDynamic, |
|
711 MSmlDmDDFObject::EChr, |
|
712 KNSmlDdfStartpgDesc); |
|
713 |
|
714 MSmlDmDDFObject& nPxAuthInfRootDDF = nPxDDF.AddChildObjectL(KNSmlDdfPxAuthInf); // PxAuthInf |
|
715 FillNodeInfoL( nPxAuthInfRootDDF, |
|
716 aclTypesAddGet, |
|
717 MSmlDmDDFObject::EZeroOrOne, |
|
718 MSmlDmDDFObject::EDynamic, |
|
719 MSmlDmDDFObject::ENode, |
|
720 KNullDesC8); |
|
721 |
|
722 MSmlDmDDFObject& nPxAuthInfDDF = nPxAuthInfRootDDF.AddChildObjectGroupL(); // PxAuthInf/<x> |
|
723 FillNodeInfoL( nPxAuthInfDDF, |
|
724 aclTypesAddGet, |
|
725 MSmlDmDDFObject::EOneOrMore, |
|
726 MSmlDmDDFObject::EDynamic, |
|
727 MSmlDmDDFObject::ENode, |
|
728 KNullDesC8); |
|
729 |
|
730 MSmlDmDDFObject& nPxAuthIdDDF = nPxAuthInfDDF.AddChildObjectL(KNSmlDdfPxAuthId); // PxAuthId |
|
731 FillNodeInfoL( nPxAuthIdDDF, |
|
732 aclTypesNoDelete, |
|
733 MSmlDmDDFObject::EZeroOrOne, |
|
734 MSmlDmDDFObject::EDynamic, |
|
735 MSmlDmDDFObject::EChr, |
|
736 KNSmlDdfPxAuthIdDesc); |
|
737 |
|
738 MSmlDmDDFObject& nPxAuthPWDDF = nPxAuthInfDDF.AddChildObjectL(KNSmlDdfPxAuthPW); // PxAuthPW |
|
739 FillNodeInfoL( nPxAuthPWDDF, |
|
740 aclTypesAddReplace, |
|
741 MSmlDmDDFObject::EZeroOrOne, |
|
742 MSmlDmDDFObject::EDynamic, |
|
743 MSmlDmDDFObject::EChr, |
|
744 KNSmlDdfPxAuthPWDesc); |
|
745 |
|
746 MSmlDmDDFObject& nNoPxForRootDDF = nPxDDF.AddChildObjectL(KNSmlDdfNoPxFor); // NoPxFor |
|
747 FillNodeInfoL( nNoPxForRootDDF, |
|
748 aclTypesAddGet, |
|
749 MSmlDmDDFObject::EZeroOrOne, |
|
750 MSmlDmDDFObject::EDynamic, |
|
751 MSmlDmDDFObject::ENode, |
|
752 KNSmlDdfNoPxForDesc); |
|
753 |
|
754 MSmlDmDDFObject& nNoPxForDDF = nNoPxForRootDDF.AddChildObjectGroupL(); // NoPxFor<x> |
|
755 FillNodeInfoL( nNoPxForDDF, |
|
756 aclTypesAddGet, |
|
757 MSmlDmDDFObject::EOne, |
|
758 MSmlDmDDFObject::EDynamic, |
|
759 MSmlDmDDFObject::ENode, |
|
760 KNullDesC8); |
|
761 |
|
762 MSmlDmDDFObject& nNoPxForLDDF = nNoPxForDDF.AddChildObjectL(KNSmlDdfNoPxForL); // NoPxForL (Get) |
|
763 FillNodeInfoL( nNoPxForLDDF, |
|
764 aclTypesNoDelete, |
|
765 MSmlDmDDFObject::EOne, |
|
766 MSmlDmDDFObject::EDynamic, |
|
767 MSmlDmDDFObject::EChr, |
|
768 KNSmlDdfNoPxForLDesc); |
|
769 |
|
770 |
|
771 _DBG_FILE("CNSmlInternetAdapter::DDFStructureL(): end"); |
|
772 } |
|
773 |
|
774 //------------------------------------------------------------------------------ |
|
775 // CNSmlInternetAdapter::LingerValueL() |
|
776 //------------------------------------------------------------------------------ |
|
777 |
|
778 void CNSmlInternetAdapter::LingerValueL( const TDesC8& aObject ) |
|
779 { |
|
780 |
|
781 TBuf<100> desObj; |
|
782 CnvUtfConverter::ConvertToUnicodeFromUtf8(desObj, aObject); |
|
783 TInt err(KErrNone); |
|
784 //const TDesC& value = desObj; |
|
785 if(!Notalpha(desObj)) |
|
786 { |
|
787 TLex lex( desObj ); |
|
788 TUint Linger = 0; |
|
789 TInt lingerint; |
|
790 err = lex.Val( Linger, EDecimal ); |
|
791 if( err == KErrNone ) |
|
792 { |
|
793 lingerint = Linger; |
|
794 if( lingerint >= 0 ) |
|
795 { |
|
796 iLingerValue = lingerint; |
|
797 iLingerFlag = EFalse; |
|
798 } |
|
799 } |
|
800 } |
|
801 } |
|
802 |
|
803 |
|
804 // ----------------------------------------------------------------------------- |
|
805 // CWPAPNapdef::UdateligerValueL |
|
806 // |
|
807 // ----------------------------------------------------------------------------- |
|
808 // |
|
809 TBool CNSmlInternetAdapter::Notalpha(const TDesC& aValue) |
|
810 { |
|
811 TBool NotAlpha = EFalse; |
|
812 TChar character; |
|
813 for(TInt i = 0 ; i < aValue.Length(); i++) |
|
814 { |
|
815 character = aValue[i]; |
|
816 NotAlpha = character.IsAlpha(); |
|
817 if(NotAlpha) |
|
818 break; |
|
819 } |
|
820 |
|
821 return NotAlpha; |
|
822 } |
|
823 // CNSmlInternetAdapter::AddLeafObjectL() |
|
824 //------------------------------------------------------------------------------ |
|
825 void CNSmlInternetAdapter::AddLeafObjectL( const TDesC8& aURI, |
|
826 const TDesC8& aParentLUID, |
|
827 const TDesC8& aObject, |
|
828 const TDesC8& aType, |
|
829 const TInt aStatusRef ) |
|
830 { |
|
831 _DBG_FILE("CNSmlInternetAdapter::AddLeafObjectL(): begin"); |
|
832 DBG_ARGS8(_S8("AP:add aURI AddLeafObjectL - %S - %S"), &aURI, &aParentLUID); |
|
833 DBG_ARGS8(_S8("AP:Object %S"), &aObject); |
|
834 |
|
835 isAdd = ETrue; |
|
836 |
|
837 TInt parentLUID(0); |
|
838 if(aParentLUID.Length()<=0 ) |
|
839 { |
|
840 if (aURI.Match(_L8("AP/*/Px/*" ))!= KErrNotFound) |
|
841 { |
|
842 if(!GetProxyIdL(aURI)) |
|
843 { |
|
844 _DBG_FILE("CNSmlInternetAdapter::FetchLeafObjectL(internal)()(): ENotFound end"); |
|
845 return; |
|
846 } |
|
847 } |
|
848 if(!iLUID) |
|
849 iLUID = IntLUID(aParentLUID); |
|
850 parentLUID = GetAPIdFromURIL(aURI); |
|
851 if( parentLUID == 0 ) |
|
852 { |
|
853 if( IsAPUriFormatMatchPredefined(aURI) ) |
|
854 { |
|
855 iLUID = ConstructTreeL(aURI); |
|
856 parentLUID = GetAPIdFromURIL(aURI); |
|
857 } |
|
858 } |
|
859 |
|
860 } |
|
861 else |
|
862 { |
|
863 _DBG_FILE("CNSmlInternetAdapter::AddLeafObjectL(): PParentLUID set to parentLUID"); |
|
864 parentLUID = IntLUID(aParentLUID); |
|
865 } |
|
866 // Always buffer DNSAddr/<X>/* |
|
867 if( ( parentLUID ==0 || |
|
868 aURI.Find(KNSmlDdfDNSPriority ) >= 0 || |
|
869 aURI.Find(KNSmlDdfDNSAddrL ) >= 0 ) && !iExecutingBuffer ) |
|
870 // Update as add |
|
871 { |
|
872 iLeafType = EDMUnset; // Default for leaf handling |
|
873 AddLeafBufferL(aURI,aParentLUID,aObject,aType,aStatusRef); |
|
874 _DBG_FILE("CNSmlInternetAdapter::AddLeafObjectL(): end"); |
|
875 return; |
|
876 } |
|
877 |
|
878 if(parentLUID == KNSmlIncompleteAP) |
|
879 { |
|
880 _DBG_FILE("CNSmlInternetAdapter::AddLeafObjectL(): EError end"); |
|
881 iCallBack->SetStatusL(aStatusRef,CSmlDmAdapter::EError); |
|
882 return; |
|
883 } |
|
884 |
|
885 //check if Stale and add leaf buffer |
|
886 if (parentLUID > 0 && !iExecutingBuffer ) |
|
887 { |
|
888 _DBG_FILE("CNSmlInternetAdapter::AddLeafObjectL(): parentLUID > 0 && !iExecutingBuffer"); |
|
889 TUint32 apID = GetAPIdFromURIL(aURI); |
|
890 if(!APExistsL(apID)) |
|
891 { |
|
892 AddLeafBufferL(aURI,aParentLUID,aObject,aType,aStatusRef); |
|
893 iStaleMapUpdate=ETrue; |
|
894 _DBG_FILE("CNSmlInternetAdapter::AddLeafObjectL(): end"); |
|
895 return; |
|
896 } |
|
897 } |
|
898 TInt pushed = 0; |
|
899 // |
|
900 // Check which field going to be handled |
|
901 // |
|
902 SetField(aURI); |
|
903 if((iField->Compare(KNSmlDdfNAPLinger) == 0)) |
|
904 { |
|
905 TUint32 apID = GetAPIdFromURIL(aURI); |
|
906 if( aObject.Size()==0 ) |
|
907 { |
|
908 DeleteLingerL( apID ); |
|
909 iCallBack->SetStatusL(aStatusRef,CSmlDmAdapter::EOk); |
|
910 return; |
|
911 } |
|
912 LingerValueL( aObject ); |
|
913 |
|
914 if ( !iLingerFlag ) |
|
915 { |
|
916 iLingerFlag = ETrue; |
|
917 TRAPD (error, AddLingerL( apID , iLingerValue )); |
|
918 if( error == !KErrNone) |
|
919 { |
|
920 iCallBack->SetStatusL(aStatusRef,CSmlDmAdapter::EError); |
|
921 } |
|
922 else |
|
923 { |
|
924 iCallBack->SetStatusL(aStatusRef,CSmlDmAdapter::EOk); |
|
925 } |
|
926 } |
|
927 else |
|
928 { |
|
929 iCallBack->SetStatusL(aStatusRef,CSmlDmAdapter::EError); |
|
930 } |
|
931 return; |
|
932 } |
|
933 |
|
934 // |
|
935 // On leaf handling and add, must be checked that value not set before |
|
936 // |
|
937 if (iLeafType != EDMUpdate && |
|
938 iLeafType != EDMDelete ) |
|
939 { |
|
940 iLeafType = EDMAdd; |
|
941 } |
|
942 if (iStaleMapUpdate) |
|
943 { |
|
944 iLeafType = EDMAdd; |
|
945 } |
|
946 |
|
947 TPtrC qTable = TPtrC(KNullDesC); |
|
948 TPtrC qColumn = TPtrC(KNullDesC); |
|
949 TPtrC qDB = TPtrC(COMMDB_ID); |
|
950 |
|
951 if(aURI.Find(KNSmlDdfPortNbr) >= 0) |
|
952 { |
|
953 IsWapPort(aObject); |
|
954 } |
|
955 // |
|
956 // Get Database field type |
|
957 // |
|
958 |
|
959 if(parentLUID > 0) |
|
960 { |
|
961 // Get IAP nbr for servicetype |
|
962 TUint32 iapIDs = GetAPIdFromURIL(aURI); |
|
963 |
|
964 DBG_ARGS8(_S8("CNSmlInternetAdapter::AddLeafObjectL(): checkluid is %d and iapId %d "),parentLUID, iapIDs ); |
|
965 |
|
966 // IAP-table search serviceType (=Bearer) |
|
967 CCommsDbTableView* iapViews = iDatabase->OpenViewMatchingUintLC(TPtrC(IAP), |
|
968 TPtrC(COMMDB_ID), |
|
969 iapIDs); |
|
970 |
|
971 TBuf<KCommsDbSvrMaxFieldLength> serviceType; |
|
972 |
|
973 TInt errorCode = iapViews->GotoFirstRecord(); |
|
974 |
|
975 // Read iapService from (IAP) |
|
976 if ( errorCode == KErrNone ) |
|
977 { |
|
978 iapViews->ReadTextL(TPtrC(IAP_SERVICE_TYPE), serviceType); |
|
979 CleanupStack::PopAndDestroy(); // iapViews |
|
980 qTable.Set(serviceType); |
|
981 } |
|
982 else |
|
983 { |
|
984 CleanupStack::PopAndDestroy(); // iapViews |
|
985 iCallBack->SetStatusL(aStatusRef,CSmlDmAdapter::ENotFound); |
|
986 _DBG_FILE("CNSmlInternetAdapter::AddLeafObjectL(): ENotFound 1 end"); |
|
987 return; |
|
988 } |
|
989 } |
|
990 |
|
991 if ( iWlanSupported ) |
|
992 { |
|
993 TBool wLANfield = IsWLANfield(aURI); |
|
994 if( wLANfield ) |
|
995 { |
|
996 iWlanAdapter->AddLeafObjectL( aURI, aParentLUID, aObject, aType, aStatusRef ); |
|
997 CleanupStack::PopAndDestroy(pushed); |
|
998 return; |
|
999 } |
|
1000 } |
|
1001 |
|
1002 TInt fType = GetAPFieldType( aURI ); |
|
1003 if (fType == EWrong) // Error if leaf not supported |
|
1004 { |
|
1005 _DBG_FILE("CNSmlInternetAdapter::AddLeafObjectL(): EError end"); |
|
1006 iCallBack->SetStatusL(aStatusRef,CSmlDmAdapter::EError); |
|
1007 return; |
|
1008 } |
|
1009 |
|
1010 TBool fieldOK = GetAPField(qTable,qColumn); |
|
1011 if(!fieldOK ) // OK if column for table not supported |
|
1012 { |
|
1013 _DBG_FILE("CNSmlInternetAdapter::AddLeafObjectL(): EOk end"); |
|
1014 iCallBack->SetStatusL(aStatusRef,CSmlDmAdapter::EOk); |
|
1015 return; |
|
1016 } |
|
1017 |
|
1018 iISPId = parentLUID; |
|
1019 if(aURI.Match(_L8("AP/*/Px/*/*" ))!= KErrNotFound) |
|
1020 { |
|
1021 if(iProxyId == 0) |
|
1022 iProxyId = parentLUID; |
|
1023 } |
|
1024 |
|
1025 if (( fType == CNSmlInternetAdapter::EStr ) || |
|
1026 ( fType == CNSmlInternetAdapter::EInt && aURI.Find(KNSmlDdfGPRSPDP) >= 0) || // KNSmlDdfNAPAddrTy |
|
1027 ( fType == CNSmlInternetAdapter::EInt && aURI.Find(KNSmlDdfNAPAddrTy) >= 0)) // KNSmlDdfNAPAddrTy |
|
1028 { // Name + NAPAddr + DNSAddr + Networks/*/Name |
|
1029 |
|
1030 if(aURI.Match(_L8("AP/*/Networks/*/Name"))!= KErrNotFound) |
|
1031 { |
|
1032 TUint32 checkLUID = 0; |
|
1033 TUint32 iapID1 = GetAPIdFromURIL(aURI); |
|
1034 |
|
1035 |
|
1036 // IAP-table NetworkId Update |
|
1037 CCommsDbTableView* iapUpdate = iDatabase->OpenViewMatchingUintLC(TPtrC(IAP),TPtrC(COMMDB_ID),iapID1); |
|
1038 TInt iapExists = iapUpdate->GotoFirstRecord(); |
|
1039 |
|
1040 if (iapExists == KErrNone) |
|
1041 { |
|
1042 _DBG_FILE("CNSmlInternetAdapter::AddLeafObjectL, Get network id"); |
|
1043 iapUpdate->ReadUintL(TPtrC(IAP_NETWORK),checkLUID); |
|
1044 DBG_ARGS8(_S8("CNSmlInternetAdapter::AddLeafObjectL(): networks is %d"),checkLUID); |
|
1045 _DBG_FILE("CNSmlInternetAdapter::AddLeafObjectL, IAP exists"); |
|
1046 if( checkLUID >0 ) |
|
1047 { |
|
1048 _DBG_FILE("CNSmlInternetAdapter::AddLeafObjectL, network id > 0"); |
|
1049 //check if network exist in NETWORK TABLE |
|
1050 CCommsDbTableView* checknetView; |
|
1051 checknetView = iDatabase->OpenViewMatchingUintLC(TPtrC(NETWORK),TPtrC(COMMDB_ID),checkLUID); |
|
1052 TInt error = checknetView->GotoFirstRecord(); |
|
1053 if (error == KErrNotFound) |
|
1054 { |
|
1055 _DBG_FILE("CNSmlInternetAdapter::AddLeafObjectL: Network does not exist, create it"); |
|
1056 AddNetworkL(checkLUID,aObject); |
|
1057 if( checkLUID > 0 ) |
|
1058 { |
|
1059 _DBG_FILE("CNSmlInternetAdapter::AddLeafObjectL: network generation ok"); |
|
1060 DBG_ARGS8(_S8("CNSmlInternetAdapter::AddLeafObjectL(): network id is %d"),checkLUID); |
|
1061 //iapUpdate->WriteUintL(TPtrC(IAP_NETWORK),checkLUID); |
|
1062 } |
|
1063 else |
|
1064 { |
|
1065 _DBG_FILE("CNSmlInternetAdapter::AddLeafObjectL(): network generation failed"); |
|
1066 iCallBack->SetStatusL(aStatusRef,CSmlDmAdapter::EError); |
|
1067 return; |
|
1068 } |
|
1069 } |
|
1070 // Network was found, update the name to the given name. |
|
1071 else |
|
1072 { |
|
1073 if(checknetView->UpdateRecord()==KErrNone) |
|
1074 { |
|
1075 _DBG_FILE("CNSmlInternetAdapter::AddLeafObjectL: network found, update name"); |
|
1076 checknetView->WriteTextL(TPtrC(COMMDB_NAME), ConvertTo16LC(aObject)); |
|
1077 _DBG_FILE("CNSmlInternetAdapter::AddLeafObjectL: network name updated"); |
|
1078 checknetView->PutRecordChanges(); |
|
1079 CleanupStack::PopAndDestroy(); //ConvertTo16LC |
|
1080 } |
|
1081 // writing failed for some reason |
|
1082 else |
|
1083 { |
|
1084 _DBG_FILE("CNSmlInternetAdapter::AddLeafObjectL(): network generation failed"); |
|
1085 iCallBack->SetStatusL(aStatusRef,CSmlDmAdapter::EError); |
|
1086 return; |
|
1087 } |
|
1088 } |
|
1089 _DBG_FILE("CNSmlInternetAdapter::AddLeafObjectL: network ok"); |
|
1090 CleanupStack::PopAndDestroy(); //checknetView |
|
1091 } |
|
1092 } |
|
1093 // IAP does not exist yet, create network, network id will be updated later using checkLUID |
|
1094 else |
|
1095 { |
|
1096 _DBG_FILE("CNSmlInternetAdapter::AddLeafObjectL: network does not exist, creation 2"); |
|
1097 AddNetworkL(checkLUID,aObject); |
|
1098 DBG_ARGS8(_S8("CNSmlInternetAdapter::AddLeafObjectL(): network id is %d"),checkLUID); |
|
1099 } |
|
1100 CleanupStack::PopAndDestroy(); // iapUpdate |
|
1101 _DBG_FILE("CNSmlInternetAdapter::AddLeafObjectL: network addition handled"); |
|
1102 |
|
1103 |
|
1104 // IAP-table NetworkId Update |
|
1105 CCommsDbTableView* iapView = iDatabase->OpenViewMatchingUintLC(TPtrC(IAP), |
|
1106 TPtrC(COMMDB_ID), |
|
1107 iapID1); |
|
1108 TInt iapFound = iapView->GotoFirstRecord(); |
|
1109 _DBG_FILE("CNSmlInternetAdapter::AddLeafObjectL: network id update begin"); |
|
1110 if(iapFound==KErrNone) |
|
1111 { |
|
1112 TBool iapReLock = EFalse; |
|
1113 if(FeatureManager::FeatureSupported(KFeatureIdSapPolicyManagement)) |
|
1114 { |
|
1115 TBool apEnforce=EFalse; |
|
1116 TRAPD(eError,apEnforce=CheckEnforcementL()) |
|
1117 DBG_ARGS8(_S8("CNSmlInternetAdapter::AddLeafObjectL(): EError %d , APEnforcement is %d"),eError,apEnforce); |
|
1118 if(eError==KErrNone && apEnforce) |
|
1119 { |
|
1120 DoLockIAPTablesL(EFalse); |
|
1121 ((CCommsDbProtectTableView*)iapView)->UnprotectRecord(); |
|
1122 iWAPRelock = ETrue; |
|
1123 } |
|
1124 } |
|
1125 |
|
1126 if(IsIAPRecordLockedL(iapID1)) |
|
1127 { |
|
1128 _DBG_FILE("CNSmlInternetAdapter::AddLeafObjectL(): apaccesspoint record is LOCKED"); |
|
1129 TInt reclockerr = ((CCommsDbProtectTableView*)iapView)->UnprotectRecord(); |
|
1130 DBG_ARGS8(_S8("CNSmlInternetAdapter::AddLeafObjectL ,UnProtecting IAPAccessRecord returned code = %d"),reclockerr); |
|
1131 if(reclockerr==KErrNone) |
|
1132 iapReLock = ETrue; |
|
1133 } |
|
1134 else |
|
1135 { |
|
1136 _DBG_FILE("CNSmlInternetAdapter::AddLeafObjectL(): apaccesspoint record is not write protected"); |
|
1137 } |
|
1138 |
|
1139 if(iapView->UpdateRecord()==KErrNone) |
|
1140 { |
|
1141 iapView->WriteUintL(TPtrC(IAP_NETWORK), checkLUID); |
|
1142 DBG_ARGS8(_S8("CNSmlInternetAdapter::AddLeafObject(): checkLUID is %d"),checkLUID); |
|
1143 _DBG_FILE("CNSmlInternetAdapter::AddLeafObject, IAP_NETWORK set to checkLUID "); |
|
1144 iapView->PutRecordChanges(); |
|
1145 _DBG_FILE("CNSmlInternetAdapter::AddLeafObject, iap found, set iNetworkId to checkLUID"); |
|
1146 iNetworkId = checkLUID; |
|
1147 iCallBack->SetStatusL(aStatusRef,CSmlDmAdapter::EOk); |
|
1148 } |
|
1149 else |
|
1150 { |
|
1151 iCallBack->SetStatusL(aStatusRef,CSmlDmAdapter::EError); |
|
1152 } |
|
1153 |
|
1154 if(FeatureManager::FeatureSupported(KFeatureIdSapPolicyManagement)) |
|
1155 { |
|
1156 if(iWAPRelock) |
|
1157 { |
|
1158 DoLockIAPTablesL(ETrue); |
|
1159 ((CCommsDbProtectTableView*)iapView)->ProtectRecord(); |
|
1160 iWAPRelock = EFalse; |
|
1161 } |
|
1162 } |
|
1163 if(iapReLock) |
|
1164 { |
|
1165 TInt reclockerr = DoProtectIAPRecordL(iapID1,ETrue); |
|
1166 DBG_ARGS8(_S8("CNSmlInternetAdapter::AddLeafObjectL ,Protecting IAPAccessRecord returned code = %d"),reclockerr); |
|
1167 if(reclockerr==KErrNone) |
|
1168 iapReLock = EFalse; |
|
1169 } |
|
1170 } |
|
1171 else if (iapFound==KErrNotFound) |
|
1172 { |
|
1173 _DBG_FILE("CNSmlInternetAdapter::AddLeafObject, iap not found, set iNetworkId"); |
|
1174 DBG_ARGS8(_S8("CNSmlInternetAdapter::AddLeafObject(): checkLUID is %d"),checkLUID); |
|
1175 iNetworkId = checkLUID; |
|
1176 iCallBack->SetStatusL(aStatusRef,CSmlDmAdapter::EOk); |
|
1177 } |
|
1178 else |
|
1179 { |
|
1180 _DBG_FILE("CNSmlInternetAdapter::AddLeafObject, iap found"); |
|
1181 iCallBack->SetStatusL(aStatusRef,CSmlDmAdapter::EError); |
|
1182 } |
|
1183 |
|
1184 CleanupStack::PopAndDestroy(); // iapView |
|
1185 CleanupStack::PopAndDestroy(pushed); |
|
1186 |
|
1187 _DBG_FILE("CNSmlInternetAdapter::AddLeafObjectL(): OK end"); |
|
1188 return; |
|
1189 } |
|
1190 |
|
1191 else if(((aURI.Match(_L8("AP/*/Px/*/Name")) != KErrNotFound || // ProxyName |
|
1192 aURI.Match(_L8("AP/*/Px/*/PxAddr")) != KErrNotFound || // ProxyAddr |
|
1193 aURI.Match(_L8("AP/*/Px/*/DomainL")) != KErrNotFound ) // DomainL (PROXY_PROTOCOL_NAME) |
|
1194 && iLeafType == EDMUpdate) || |
|
1195 ((aURI.Match(_L8("AP/*/Px/*/PxAddr")) != KErrNotFound |
|
1196 || aURI.Match(_L8("AP/*/Px/*/DomainL")) != KErrNotFound ) |
|
1197 && iLeafType == EDMAdd)) |
|
1198 { |
|
1199 CCommsDbTableView* tableView = iDatabase->OpenViewMatchingUintLC(TPtrC(PROXIES), |
|
1200 TPtrC(COMMDB_ID), |
|
1201 iProxyId); |
|
1202 TBool proxyReLock = EFalse; |
|
1203 if(IsProxyRecordLockedL(iProxyId)) |
|
1204 { |
|
1205 _DBG_FILE("CNSmlInternetAdapter::AddLeafObjectL(): proxy record is LOCKED"); |
|
1206 TInt reclockerr = ((CCommsDbProtectTableView*)tableView)->UnprotectRecord(); |
|
1207 DBG_ARGS8(_S8("CNSmlInternetAdapter::AddLeafObjectL ,UnProtecting ProxyRecord returned code = %d"),reclockerr); |
|
1208 if(reclockerr==KErrNone) |
|
1209 proxyReLock = ETrue; |
|
1210 } |
|
1211 else |
|
1212 { |
|
1213 _DBG_FILE("CNSmlInternetAdapter::AddLeafObjectL(): apaccesspoint record is not write protected"); |
|
1214 } |
|
1215 |
|
1216 TInt errorCode = tableView->GotoFirstRecord(); |
|
1217 if ( errorCode == KErrNone ) |
|
1218 { |
|
1219 if (tableView->UpdateRecord() == KErrNone ) |
|
1220 { |
|
1221 if (aURI.Match(_L8("AP/*/Px/*/PxAddr")) != KErrNotFound ) |
|
1222 { |
|
1223 tableView->WriteLongTextL(TPtrC(PROXY_SERVER_NAME), ConvertTo16LC(aObject)); |
|
1224 pushed++; |
|
1225 } |
|
1226 else if (aURI.Match(_L8("AP/*/Px/*/DomainL")) != KErrNotFound ) |
|
1227 { |
|
1228 // Accepted values are (http, https, ftp, ftps) |
|
1229 _LIT8(KProxyProtocol,"http, https, ftp, ftps"); |
|
1230 |
|
1231 TInt protocolFound = 0; |
|
1232 if(aObject.Length() > 0) |
|
1233 { |
|
1234 protocolFound = KProxyProtocol().Find(aObject); |
|
1235 } |
|
1236 if( protocolFound == KErrNotFound && aObject.Length() > 0) |
|
1237 { |
|
1238 CleanupStack::PopAndDestroy(); // tableView |
|
1239 CleanupStack::PopAndDestroy(pushed); |
|
1240 iCallBack->SetStatusL(aStatusRef,CSmlDmAdapter::EError); |
|
1241 _DBG_FILE("CNSmlInternetAdapter::AddLeafObjectL(): EError end"); |
|
1242 return; |
|
1243 } |
|
1244 if(aObject.Length() == 0) |
|
1245 { |
|
1246 tableView->SetNullL(TPtrC(PROXY_PROTOCOL_NAME)); |
|
1247 } |
|
1248 else |
|
1249 { |
|
1250 tableView->WriteTextL(TPtrC(PROXY_PROTOCOL_NAME), ConvertTo16LC(aObject)); |
|
1251 CleanupStack::PopAndDestroy(); //ConvertTo16LC |
|
1252 } |
|
1253 } |
|
1254 tableView->PutRecordChanges(); |
|
1255 CleanupStack::PopAndDestroy(); // tableView |
|
1256 } |
|
1257 else |
|
1258 { |
|
1259 CleanupStack::PopAndDestroy(); // tableView |
|
1260 CleanupStack::PopAndDestroy(pushed); |
|
1261 iCallBack->SetStatusL(aStatusRef,CSmlDmAdapter::EError); |
|
1262 _DBG_FILE("CNSmlInternetAdapter::AddLeafObjectL(): EError end"); |
|
1263 return; |
|
1264 } |
|
1265 } |
|
1266 else |
|
1267 { |
|
1268 CleanupStack::PopAndDestroy(); // tableView |
|
1269 CleanupStack::PopAndDestroy(pushed); |
|
1270 iCallBack->SetStatusL(aStatusRef,CSmlDmAdapter::ENotFound); |
|
1271 _DBG_FILE("CNSmlInternetAdapter::AddLeafObjectL(): ENotFound end"); |
|
1272 return; |
|
1273 } |
|
1274 if(proxyReLock) |
|
1275 { |
|
1276 TInt reclockerr = DoProtectProxyRecordL(iProxyId,ETrue); |
|
1277 DBG_ARGS8(_S8("CNSmlInternetAdapter::AddLeafObjectL ,UnProtecting Proxy returned code = %d"),reclockerr); |
|
1278 if(reclockerr==KErrNone) |
|
1279 proxyReLock = EFalse; |
|
1280 } |
|
1281 CleanupStack::PopAndDestroy(pushed); |
|
1282 iCallBack->SetStatusL(aStatusRef,CSmlDmAdapter::EOk); |
|
1283 _DBG_FILE("CNSmlInternetAdapter::AddLeafObjectL(): EOk end"); |
|
1284 return; |
|
1285 } |
|
1286 |
|
1287 if (iLeafType == EDMUpdate || |
|
1288 (iLeafType == EDMAdd && |
|
1289 (aURI.Find(KNSmlDdfNAPName) >= 0 && |
|
1290 aURI.Find(KNSmlDdfNAPDef) >= 0) || |
|
1291 aURI.Find(KNSmlDdfNAPAddr) >= 0 || |
|
1292 aURI.Find(KNSmlDdfGPRSPDP) >= 0 || |
|
1293 aURI.Find(KNSmlDdfDNSAddrL) >= 0 || |
|
1294 aURI.Find(KNSmlDdfAuthSecr) >= 0 || |
|
1295 aURI.Find(KNSmlDdfDefGW) >= 0 || |
|
1296 aURI.Find(KNSmlDdfNetworkMask) >= 0 || |
|
1297 aURI.Find(KNSmlDdfIPAddr) >= 0 || |
|
1298 aURI.Find(KNSmlDdfNAPAddrTy)>= 0 )) |
|
1299 { |
|
1300 // Get IAP nbr for servicetype |
|
1301 |
|
1302 TUint32 iapID2 = GetAPIdFromURIL(aURI); |
|
1303 |
|
1304 // IAP-table search serviceType (=Bearer) |
|
1305 CCommsDbTableView* serviceView = iDatabase->OpenViewMatchingUintLC(TPtrC(IAP), |
|
1306 qDB, |
|
1307 iapID2); |
|
1308 |
|
1309 TBuf<KCommsDbSvrMaxFieldLength> serviceType; |
|
1310 |
|
1311 TInt errorCode = serviceView->GotoFirstRecord(); |
|
1312 |
|
1313 // Read serviceType from (IAP) |
|
1314 if ( errorCode == KErrNone ) |
|
1315 { |
|
1316 serviceView->ReadTextL(TPtrC(IAP_SERVICE_TYPE), serviceType); |
|
1317 serviceView->ReadTextL(TPtrC(IAP_SERVICE_TYPE), iProxyServiceType); // for locking |
|
1318 |
|
1319 serviceView->ReadUintL(TPtrC(IAP_SERVICE), iISPId); |
|
1320 |
|
1321 CleanupStack::PopAndDestroy(); // serviceView |
|
1322 } |
|
1323 else |
|
1324 { |
|
1325 CleanupStack::PopAndDestroy(); // serviceView |
|
1326 CleanupStack::PopAndDestroy(pushed); |
|
1327 iCallBack->SetStatusL(aStatusRef,CSmlDmAdapter::ENotFound); |
|
1328 _DBG_FILE("CNSmlInternetAdapter::AddLeafObjectL(): ENotFound end"); |
|
1329 return; |
|
1330 } |
|
1331 qTable.Set(serviceType); |
|
1332 |
|
1333 CCommsDbTableView* tableView = iDatabase->OpenViewMatchingUintLC(serviceType, |
|
1334 qDB, |
|
1335 iISPId); |
|
1336 |
|
1337 errorCode = tableView->GotoFirstRecord(); |
|
1338 |
|
1339 if ( errorCode == KErrNone ) |
|
1340 { |
|
1341 TBool serviceReLock = EFalse; |
|
1342 if(IsServiceRecordLockedL(iISPId)) |
|
1343 { |
|
1344 _DBG_FILE("CNSmlInternetAdapter::AddLeafObjectL(): apaccesspoint record is LOCKED"); |
|
1345 TInt reclockerr = ( (CCommsDbProtectTableView*) tableView )->UnprotectRecord(); |
|
1346 DBG_ARGS8(_S8("CNSmlInternetAdapter::AddLeafObjectL ,UnProtecting WAPAccessRecord returned code = %d"),reclockerr); |
|
1347 if(reclockerr==KErrNone) |
|
1348 serviceReLock = ETrue; |
|
1349 } |
|
1350 else |
|
1351 { |
|
1352 _DBG_FILE("CNSmlInternetAdapter::AddLeafObjectL(): apaccesspoint record is not write protected"); |
|
1353 } |
|
1354 |
|
1355 if(tableView->UpdateRecord()!=KErrNone) |
|
1356 { |
|
1357 //database locked |
|
1358 CleanupStack::PopAndDestroy(); // tableView |
|
1359 CleanupStack::PopAndDestroy(pushed); |
|
1360 iCallBack->SetStatusL(aStatusRef,CSmlDmAdapter::EError); |
|
1361 _DBG_FILE("CNSmlInternetAdapter::AddLeafObjectL(): Update failed end"); |
|
1362 return; |
|
1363 } |
|
1364 if ( fType == CNSmlInternetAdapter::EInt) |
|
1365 { |
|
1366 TUint32 object32; |
|
1367 if (aURI.Find(KNSmlDdfGPRSPDP) >= 0 || /* GPRSPDP handling */ |
|
1368 aURI.Find(KNSmlDdfNAPAddrTy) >= 0) /* NAPAddrTy handling */ |
|
1369 { |
|
1370 if(aObject.MatchF(KNSmlDmApValIpv4) != KErrNotFound ) |
|
1371 { |
|
1372 object32 = RPacketContext::EPdpTypeIPv4; |
|
1373 } |
|
1374 else if (aObject.MatchF(KNSmlDmApValIpv6) != KErrNotFound ) |
|
1375 { |
|
1376 object32 = RPacketContext::EPdpTypeIPv6; |
|
1377 } |
|
1378 else if (aObject.MatchF(_L8("PPP")) != KErrNotFound ) |
|
1379 { |
|
1380 object32 = RPacketContext::EPdpTypePPP; |
|
1381 } |
|
1382 else |
|
1383 { // NotValid value |
|
1384 tableView->CancelRecordChanges(); |
|
1385 CleanupStack::PopAndDestroy(); // tableView |
|
1386 CleanupStack::PopAndDestroy(pushed); |
|
1387 iCallBack->SetStatusL(aStatusRef,CSmlDmAdapter::EError); |
|
1388 _DBG_FILE("CNSmlInternetAdapter::AddLeafObjectL(): Update failed end"); |
|
1389 return; |
|
1390 } |
|
1391 } |
|
1392 else |
|
1393 { |
|
1394 object32 = GetIntObject8(aObject); |
|
1395 } |
|
1396 |
|
1397 tableView->WriteUintL(qColumn, object32); |
|
1398 } |
|
1399 else |
|
1400 { |
|
1401 // This should be executed only when executing buffered cmds |
|
1402 if(aURI.Find(KNSmlDdfDNSAddrL) >= 0 ) |
|
1403 // DNS address |
|
1404 { |
|
1405 TPtrC8 parentUri = RemoveLastSeg(aURI); |
|
1406 TInt dnsPri = 0; |
|
1407 TBool found = InitializeDNSParamsFromBuffL( parentUri, dnsPri ); |
|
1408 UriUtils::TUriHostType dnsAddrTy = UriUtils::HostType(aObject); |
|
1409 |
|
1410 if (!found ) |
|
1411 { |
|
1412 UriUtils::TUriHostType dnsLuidType; |
|
1413 TInt dnsLuidPriority; |
|
1414 if ( LuidToDns(dnsLuidType, dnsLuidPriority, parentLUID ) != KErrNone ) |
|
1415 { |
|
1416 if ( dnsAddrTy == UriUtils::EIPv4Host ) |
|
1417 { |
|
1418 iDnsIpv4Pri = (iDnsIpv4Pri % 2 ) + 1; |
|
1419 dnsPri = iDnsIpv4Pri; |
|
1420 } |
|
1421 else if ( dnsAddrTy == UriUtils::EIPv6Host ) |
|
1422 { |
|
1423 iDnsIpv6Pri = (iDnsIpv6Pri % 2 ) + 1; |
|
1424 dnsPri = iDnsIpv6Pri; |
|
1425 } |
|
1426 } |
|
1427 else |
|
1428 { |
|
1429 // update |
|
1430 dnsPri = dnsLuidPriority; |
|
1431 } |
|
1432 |
|
1433 } |
|
1434 if ( dnsPri != 0 ) |
|
1435 { |
|
1436 if ( dnsPri == 1) |
|
1437 { |
|
1438 if ( dnsAddrTy == UriUtils::EIPv4Host ) |
|
1439 { |
|
1440 qColumn.Set( TPtrC(SERVICE_IP_NAME_SERVER1 )); |
|
1441 } |
|
1442 else |
|
1443 { |
|
1444 qColumn.Set( TPtrC(SERVICE_IP6_NAME_SERVER1 )); |
|
1445 |
|
1446 } |
|
1447 } |
|
1448 else |
|
1449 { |
|
1450 if ( dnsAddrTy == UriUtils::EIPv4Host ) |
|
1451 { |
|
1452 qColumn.Set( TPtrC(SERVICE_IP_NAME_SERVER2 )); |
|
1453 } |
|
1454 else |
|
1455 { |
|
1456 qColumn.Set( TPtrC(SERVICE_IP6_NAME_SERVER2 )); |
|
1457 |
|
1458 } |
|
1459 } |
|
1460 tableView->WriteTextL(qColumn, ConvertTo16LC(aObject)); |
|
1461 pushed++; |
|
1462 TInt dnsLuid = DnsToLuid( dnsAddrTy, dnsPri); |
|
1463 iCallBack->SetMappingL(parentUri, SetIntObjectLC( dnsLuid )); |
|
1464 pushed++; |
|
1465 } |
|
1466 else |
|
1467 { |
|
1468 CleanupStack::PopAndDestroy(); // tableView |
|
1469 CleanupStack::PopAndDestroy(pushed); |
|
1470 iCallBack->SetStatusL(aStatusRef,CSmlDmAdapter::EError); |
|
1471 _DBG_FILE("CNSmlInternetAdapter::AddLeafObjectL(): Update failed end"); |
|
1472 return; |
|
1473 } |
|
1474 |
|
1475 } |
|
1476 |
|
1477 else |
|
1478 { |
|
1479 if(( serviceType == TPtrC( LAN_SERVICE ) ) && (iField->Compare(KNSmlDdfNAPAddr) == 0 ) ) |
|
1480 { |
|
1481 if(!IsValidIPv4AddressL(aObject)) |
|
1482 { |
|
1483 iCallBack->SetStatusL(aStatusRef,CSmlDmAdapter::EInvalidObject); |
|
1484 _DBG_FILE("CNSmlInternetAdapter::AddLeafObjectL(): EInvalidObject end"); |
|
1485 CleanupStack::PopAndDestroy(); // tableView |
|
1486 CleanupStack::PopAndDestroy(pushed); |
|
1487 return; |
|
1488 } |
|
1489 |
|
1490 } |
|
1491 tableView->WriteTextL(qColumn, ConvertTo16LC(aObject)); |
|
1492 pushed++; |
|
1493 |
|
1494 } |
|
1495 // DNSAddrL <> 0.0.0.0 or empty => |
|
1496 if(aURI.Find(KNSmlDdfDNSAddrL) >= 0 ) /* DNS serviceFlag handling */ |
|
1497 { |
|
1498 if( aObject.Match(_L8("fec0:0:0:ffff::1")) == KErrNotFound || |
|
1499 aObject.Match(_L8("fec0:0:0:ffff::2")) == KErrNotFound ) |
|
1500 { |
|
1501 tableView->WriteBoolL(TPtrC(SERVICE_IP6_DNS_ADDR_FROM_SERVER),EFalse); |
|
1502 } |
|
1503 else |
|
1504 { |
|
1505 tableView->WriteBoolL(TPtrC(SERVICE_IP6_DNS_ADDR_FROM_SERVER),ETrue); |
|
1506 } |
|
1507 |
|
1508 |
|
1509 } |
|
1510 } |
|
1511 TInt putOk = tableView->PutRecordChanges(); |
|
1512 if ( putOk != KErrNone ) |
|
1513 { |
|
1514 TInt retry = KBeginTransRetryCount; |
|
1515 while ( retry > 0 && putOk == KErrLocked ) |
|
1516 { |
|
1517 User::After(KBeginTransRetryDelay); |
|
1518 putOk = tableView->PutRecordChanges(); |
|
1519 retry--; |
|
1520 } |
|
1521 if(putOk != KErrNone) |
|
1522 { |
|
1523 CleanupStack::PopAndDestroy(); // tableView |
|
1524 CleanupStack::PopAndDestroy(pushed); |
|
1525 iCallBack->SetStatusL(aStatusRef,CSmlDmAdapter::EError); |
|
1526 _DBG_FILE("CNSmlInternetAdapter::AddLeafObjectL(): Update failed end"); |
|
1527 DBG_ARGS(_S16("CNSmlInternetAdapter::AddLeafObjectL(): Update failed with Code %d"),putOk); |
|
1528 return; |
|
1529 } |
|
1530 } |
|
1531 if (aURI.Find(KNSmlDdfNAPName) >= 0 && |
|
1532 aURI.Find(KNSmlDdfAuthName) <= 0 ) /* NAPName */ |
|
1533 { |
|
1534 if(UpdateIAPnameL(iapID2,aObject) != KErrNone ) |
|
1535 { |
|
1536 iCallBack->SetStatusL(aStatusRef,CSmlDmAdapter::EError); |
|
1537 } |
|
1538 } |
|
1539 if(serviceReLock) |
|
1540 { |
|
1541 TInt reclockerr = DoProtectServiceRecordL(iISPId,ETrue); |
|
1542 DBG_ARGS8(_S8("CNSmlInternetAdapter::AddLeafObjectL ,UnProtecting WAPAccessRecord returned code = %d"),reclockerr); |
|
1543 if(reclockerr==KErrNone) |
|
1544 serviceReLock = EFalse; |
|
1545 } |
|
1546 } |
|
1547 else |
|
1548 { |
|
1549 CleanupStack::PopAndDestroy(); // tableView |
|
1550 CleanupStack::PopAndDestroy(pushed); |
|
1551 iCallBack->SetStatusL(aStatusRef,CSmlDmAdapter::ENotFound); |
|
1552 _DBG_FILE("CNSmlInternetAdapter::AddLeafObjectL(): ENotFound end"); |
|
1553 return; |
|
1554 } |
|
1555 |
|
1556 CleanupStack::PopAndDestroy(); // tableView |
|
1557 } |
|
1558 |
|
1559 } |
|
1560 else if (fType == CNSmlInternetAdapter::EBool) |
|
1561 { // UseCB + UseIPSec |
|
1562 TUint32 iapID3 = GetAPIdFromURIL(aURI); |
|
1563 |
|
1564 // IAP-table search serviceType (=Bearer) |
|
1565 CCommsDbTableView* boolView = iDatabase->OpenViewMatchingUintLC(TPtrC(IAP), |
|
1566 TPtrC(COMMDB_ID), |
|
1567 iapID3); |
|
1568 TInt errorCode = boolView->GotoFirstRecord(); |
|
1569 |
|
1570 TBuf<KCommsDbSvrMaxFieldLength> serviceType; |
|
1571 |
|
1572 errorCode = boolView->GotoFirstRecord(); |
|
1573 |
|
1574 // Read serviceType from (IAP) |
|
1575 if ( errorCode == KErrNone ) |
|
1576 { |
|
1577 boolView->ReadTextL(TPtrC(IAP_SERVICE_TYPE), serviceType); |
|
1578 boolView->ReadTextL(TPtrC(IAP_SERVICE_TYPE), iProxyServiceType); // for locking |
|
1579 boolView->ReadUintL(TPtrC(IAP_SERVICE), iISPId); |
|
1580 } |
|
1581 else |
|
1582 { |
|
1583 CleanupStack::PopAndDestroy(); // boolView |
|
1584 CleanupStack::PopAndDestroy(pushed); |
|
1585 iCallBack->SetStatusL(aStatusRef,CSmlDmAdapter::ENotFound); |
|
1586 _DBG_FILE("CNSmlInternetAdapter::AddLeafObjectL(): ENotFound end"); |
|
1587 return; |
|
1588 } |
|
1589 |
|
1590 CleanupStack::PopAndDestroy(); // boolView |
|
1591 |
|
1592 qTable.Set(serviceType); |
|
1593 TBool ret = GetAPField(qTable,qColumn); |
|
1594 if(!ret) |
|
1595 { |
|
1596 CleanupStack::PopAndDestroy(pushed); |
|
1597 iCallBack->SetStatusL(aStatusRef,CSmlDmAdapter::EInvalidObject); |
|
1598 _DBG_FILE("CNSmlInternetAdapter::AddLeafObjectL(): EInvalidObject end"); |
|
1599 return; |
|
1600 } |
|
1601 |
|
1602 |
|
1603 CCommsDbTableView* tableView = iDatabase->OpenViewMatchingUintLC(serviceType, |
|
1604 TPtrC(COMMDB_ID), |
|
1605 iISPId); |
|
1606 |
|
1607 errorCode = tableView->GotoFirstRecord(); |
|
1608 |
|
1609 if ( errorCode == KErrNone ) |
|
1610 { |
|
1611 TBool serviceReLock = EFalse; |
|
1612 if(IsServiceRecordLockedL(iISPId)) |
|
1613 { |
|
1614 _DBG_FILE("CNSmlInternetAdapter::AddLeafObjectL(): apaccesspoint record is LOCKED"); |
|
1615 TInt reclockerr = ( (CCommsDbProtectTableView*) tableView )->UnprotectRecord(); |
|
1616 DBG_ARGS8(_S8("CNSmlInternetAdapter::AddLeafObjectL ,UnProtecting WAPAccessRecord returned code = %d"),reclockerr); |
|
1617 if(reclockerr==KErrNone) |
|
1618 serviceReLock = ETrue; |
|
1619 } |
|
1620 else |
|
1621 { |
|
1622 _DBG_FILE("CNSmlInternetAdapter::AddLeafObjectL(): apaccesspoint record is not write protected"); |
|
1623 } |
|
1624 if(tableView->UpdateRecord()!=KErrNone) |
|
1625 { |
|
1626 //database locked |
|
1627 CleanupStack::PopAndDestroy(); // tableView |
|
1628 CleanupStack::PopAndDestroy(pushed); |
|
1629 iCallBack->SetStatusL(aStatusRef,CSmlDmAdapter::EError); |
|
1630 _DBG_FILE("CNSmlInternetAdapter::AddLeafObjectL(): Update failed end"); |
|
1631 return; |
|
1632 } |
|
1633 TBool tObject = EFalse; |
|
1634 |
|
1635 if(aObject.CompareF(KNSmlDmApValTrue) == 0) |
|
1636 { |
|
1637 tObject = ETrue; |
|
1638 } |
|
1639 if(aURI.Right(10).Compare(KNSmlDdfUsePTxtLog)==0) |
|
1640 { |
|
1641 tObject=!tObject; |
|
1642 } |
|
1643 if( qColumn.Match(TPtrC(SERVICE_IP_ADDR_FROM_SERVER)) != KErrNotFound ) |
|
1644 { |
|
1645 if ( serviceType == TPtrC( LAN_SERVICE ) ) // Is WLAN service |
|
1646 { |
|
1647 if( tObject ) |
|
1648 { |
|
1649 tableView->WriteTextL( TPtrC(SERVICE_CONFIG_DAEMON_MANAGER_NAME), |
|
1650 KDaemonManagerName ); |
|
1651 tableView->WriteTextL( TPtrC(SERVICE_CONFIG_DAEMON_NAME), |
|
1652 KConfigDaemonName ); |
|
1653 } |
|
1654 else |
|
1655 { |
|
1656 tableView->WriteTextL( TPtrC(SERVICE_CONFIG_DAEMON_MANAGER_NAME), KNullDesC ); |
|
1657 tableView->WriteTextL( TPtrC(SERVICE_CONFIG_DAEMON_NAME), KNullDesC ); |
|
1658 } |
|
1659 } |
|
1660 } // Is WLAN service |
|
1661 |
|
1662 tableView->WriteBoolL(qColumn, tObject ); |
|
1663 tableView->PutRecordChanges(); |
|
1664 CleanupStack::PopAndDestroy(); // tableView |
|
1665 if(serviceReLock) |
|
1666 { |
|
1667 TInt reclockerr = DoProtectServiceRecordL(iISPId,ETrue); |
|
1668 DBG_ARGS8(_S8("CNSmlInternetAdapter::AddLeafObjectL ,UnProtecting ServiceRecord returned code = %d"),reclockerr); |
|
1669 if(reclockerr==KErrNone) |
|
1670 serviceReLock = EFalse; |
|
1671 } |
|
1672 } |
|
1673 else |
|
1674 { |
|
1675 tableView->CancelRecordChanges(); |
|
1676 CleanupStack::PopAndDestroy(); // tableView |
|
1677 CleanupStack::PopAndDestroy(pushed); |
|
1678 iCallBack->SetStatusL(aStatusRef,CSmlDmAdapter::EError); |
|
1679 _DBG_FILE("CNSmlInternetAdapter::AddLeafObjectL(): EError end"); |
|
1680 return; |
|
1681 } |
|
1682 } |
|
1683 else if (fType == CNSmlInternetAdapter::EInt) |
|
1684 { // UsePTxtLog + PortNbr + seamlessness and metadata |
|
1685 iObject = GetIntObject8(aObject); |
|
1686 |
|
1687 if(aURI.Find(KNSmlDdfIAPSeamlessness) >= 0 ) |
|
1688 { |
|
1689 // TUint32 setSeam = GetIntObject8(aObject); |
|
1690 TUint32 apMetaID = GetAPIdFromURIL(aURI); |
|
1691 SetIAPSeamlessnessL(apMetaID,iObject,aStatusRef); |
|
1692 return; |
|
1693 } |
|
1694 |
|
1695 else if (aURI.Find(KNSmlDdfIAPMetaData) >= 0) |
|
1696 { |
|
1697 // TUint32 setMeta = GetIntObject8(aObject); |
|
1698 TUint32 apMetaID = GetAPIdFromURIL(aURI); |
|
1699 SetIAPMetaDataL(apMetaID,iObject,aStatusRef); |
|
1700 return; |
|
1701 } |
|
1702 |
|
1703 |
|
1704 if (aURI.Find(KNSmlDdfUsePTxtLog) >= 0) |
|
1705 { |
|
1706 TUint32 iapID4 = GetAPIdFromURIL(aURI); |
|
1707 |
|
1708 // IAP-table search serviceType (=Bearer) |
|
1709 CCommsDbTableView* iapView4 = iDatabase->OpenViewMatchingUintLC(TPtrC(IAP), |
|
1710 TPtrC(COMMDB_ID), |
|
1711 iapID4); |
|
1712 TInt errorCode = iapView4->GotoFirstRecord(); |
|
1713 |
|
1714 TBuf<KCommsDbSvrMaxFieldLength> serviceType; |
|
1715 |
|
1716 errorCode = iapView4->GotoFirstRecord(); |
|
1717 |
|
1718 // Read serviceType from (IAP) |
|
1719 if ( errorCode == KErrNone ) |
|
1720 { |
|
1721 iapView4->ReadTextL(TPtrC(IAP_SERVICE_TYPE), serviceType); |
|
1722 iapView4->ReadTextL(TPtrC(IAP_SERVICE_TYPE), iProxyServiceType); // for locking |
|
1723 iapView4->ReadUintL(TPtrC(IAP_SERVICE), iISPId); |
|
1724 CleanupStack::PopAndDestroy(); // iapView4 |
|
1725 } |
|
1726 else |
|
1727 { |
|
1728 CleanupStack::PopAndDestroy(); // iapView4 |
|
1729 CleanupStack::PopAndDestroy(pushed); |
|
1730 iCallBack->SetStatusL(aStatusRef,CSmlDmAdapter::ENotFound); |
|
1731 _DBG_FILE("CNSmlInternetAdapter::AddLeafObjectL(): ENotFound end"); |
|
1732 return; |
|
1733 } |
|
1734 |
|
1735 CCommsDbTableView* tableView = iDatabase->OpenViewMatchingUintLC(serviceType, |
|
1736 TPtrC(COMMDB_ID), |
|
1737 iISPId); |
|
1738 |
|
1739 errorCode = tableView->GotoFirstRecord(); |
|
1740 |
|
1741 if ( errorCode == KErrNone ) |
|
1742 { |
|
1743 TBool serviceReLock = EFalse; |
|
1744 if(IsServiceRecordLockedL(iISPId)) |
|
1745 { |
|
1746 |
|
1747 _DBG_FILE("CNSmlInternetAdapter::AddLeafObjectL(): apaccesspoint record is LOCKED"); |
|
1748 TInt reclockerr = ( (CCommsDbProtectTableView*) tableView )->UnprotectRecord(); |
|
1749 DBG_ARGS8(_S8("CNSmlInternetAdapter::AddLeafObjectL ,UnProtecting WAPAccessRecord returned code = %d"),reclockerr); |
|
1750 if(reclockerr==KErrNone) |
|
1751 serviceReLock = ETrue; |
|
1752 } |
|
1753 else |
|
1754 { |
|
1755 _DBG_FILE("CNSmlInternetAdapter::AddLeafObjectL(): apaccesspoint record is not write protected"); |
|
1756 } |
|
1757 if(tableView->UpdateRecord()!=KErrNone) |
|
1758 { |
|
1759 //database locked |
|
1760 CleanupStack::PopAndDestroy(); // tableView |
|
1761 CleanupStack::PopAndDestroy(pushed); |
|
1762 iCallBack->SetStatusL(aStatusRef,CSmlDmAdapter::EError); |
|
1763 _DBG_FILE("CNSmlInternetAdapter::AddLeafObjectL(): Update failed end"); |
|
1764 return; |
|
1765 } |
|
1766 TBool tObject = EFalse; |
|
1767 if(iObject) |
|
1768 { |
|
1769 tObject = ETrue; // <> 0 |
|
1770 } |
|
1771 tableView->WriteBoolL(TPtrC(SERVICE_DISABLE_PLAIN_TEXT_AUTH), tObject ); |
|
1772 tableView->PutRecordChanges(); |
|
1773 if(serviceReLock) |
|
1774 { |
|
1775 DoProtectIAPRecordL(iapID4,ETrue); |
|
1776 TInt reclockerr = DoProtectServiceRecordL(iISPId,ETrue); |
|
1777 DBG_ARGS8(_S8("CNSmlInternetAdapter::AddLeafObjectL ,UnProtecting ServiceRecord returned code = %d"),reclockerr); |
|
1778 if(reclockerr==KErrNone) |
|
1779 serviceReLock = EFalse; |
|
1780 } |
|
1781 CleanupStack::PopAndDestroy(); // tableView |
|
1782 } |
|
1783 else |
|
1784 { |
|
1785 tableView->CancelRecordChanges(); |
|
1786 CleanupStack::PopAndDestroy(); // tableView |
|
1787 CleanupStack::PopAndDestroy(pushed); |
|
1788 iCallBack->SetStatusL(aStatusRef,CSmlDmAdapter::EError); |
|
1789 _DBG_FILE("CNSmlInternetAdapter::AddLeafObjectL(): EError end"); |
|
1790 return; |
|
1791 } |
|
1792 } |
|
1793 else if (aURI.Find(KNSmlDdfPortNbr) >= 0) |
|
1794 { |
|
1795 if(GetProxyIdL(aURI)) |
|
1796 { |
|
1797 iProxyISP = GetAPIdFromURIL(aURI); |
|
1798 |
|
1799 CCommsDbTableView* tableView = iDatabase->OpenViewMatchingUintLC(TPtrC(PROXIES), |
|
1800 TPtrC(COMMDB_ID), |
|
1801 iProxyId); |
|
1802 TInt errorCode = tableView->GotoFirstRecord(); |
|
1803 TBool proxyReLock = EFalse; |
|
1804 // Read all columns needed. |
|
1805 if ( errorCode == KErrNone ) |
|
1806 { |
|
1807 if(IsProxyRecordLockedL(iProxyId)) |
|
1808 { |
|
1809 _DBG_FILE("CNSmlInternetAdapter::AddLeafObjectL(): proxy record is LOCKED"); |
|
1810 TInt reclockerr = ((CCommsDbProtectTableView*)tableView)->UnprotectRecord(); |
|
1811 DBG_ARGS8(_S8("CNSmlInternetAdapter::AddLeafObjectL ,UnProtecting Proxy Record returned code = %d"),reclockerr); |
|
1812 if(reclockerr==KErrNone) |
|
1813 proxyReLock = ETrue; |
|
1814 } |
|
1815 else |
|
1816 { |
|
1817 _DBG_FILE("CNSmlInternetAdapter::AddLeafObjectL(): apaccesspoint record is not write protected"); |
|
1818 } |
|
1819 if(tableView->UpdateRecord()!=KErrNone) |
|
1820 { |
|
1821 //database locked |
|
1822 CleanupStack::PopAndDestroy(); // tableView |
|
1823 CleanupStack::PopAndDestroy(pushed); |
|
1824 iCallBack->SetStatusL(aStatusRef,CSmlDmAdapter::EError); |
|
1825 _DBG_FILE("CNSmlInternetAdapter::AddLeafObjectL(): Update failed end"); |
|
1826 return; |
|
1827 } |
|
1828 iObject = GetIntObject8(aObject); |
|
1829 |
|
1830 tableView->WriteUintL(TPtrC(PROXY_PORT_NUMBER), iObject); |
|
1831 } |
|
1832 tableView->PutRecordChanges(); |
|
1833 if(proxyReLock) |
|
1834 { |
|
1835 TInt reclockerr = DoProtectProxyRecordL(iProxyId,ETrue); |
|
1836 DBG_ARGS8(_S8("CNSmlInternetAdapter::AddLeafObjectL ,UnProtecting Proxy Record returned code = %d"),reclockerr); |
|
1837 if(reclockerr==KErrNone) |
|
1838 proxyReLock = EFalse; |
|
1839 } |
|
1840 CleanupStack::PopAndDestroy(); // tableView |
|
1841 } |
|
1842 else |
|
1843 { |
|
1844 CleanupStack::PopAndDestroy(pushed); |
|
1845 iCallBack->SetStatusL(aStatusRef,CSmlDmAdapter::EError); |
|
1846 _DBG_FILE("CNSmlInternetAdapter::AddLeafObjectL(): PortNbr Error end"); |
|
1847 return; |
|
1848 } |
|
1849 } |
|
1850 else |
|
1851 { |
|
1852 CleanupStack::PopAndDestroy(pushed); |
|
1853 iCallBack->SetStatusL(aStatusRef,CSmlDmAdapter::EError); |
|
1854 _DBG_FILE("CNSmlInternetAdapter::AddLeafObjectL(): PortNbr Error end"); |
|
1855 return; |
|
1856 } |
|
1857 |
|
1858 } |
|
1859 |
|
1860 else if (fType == CNSmlInternetAdapter::EWap) |
|
1861 { // Startpg + PxAuthId + PxAuthPW (WAP-settings) (BasAuthId + BasAuthPW) |
|
1862 TUint32 iapID5 = GetAPIdFromURIL(aURI); |
|
1863 // |
|
1864 // Without iapID5 no insert possible, set on buffer |
|
1865 // |
|
1866 if(iapID5 < 1) |
|
1867 { |
|
1868 AddLeafBufferL(aURI,aParentLUID,aObject,aType,aStatusRef); |
|
1869 _DBG_FILE("CNSmlInternetAdapter::AddLeafObjectL(): end"); |
|
1870 return; |
|
1871 } |
|
1872 |
|
1873 GetAPField(qTable,qColumn); |
|
1874 if(WapAPExistsL(iapID5)) |
|
1875 { // Update handled |
|
1876 TBool iapReLock = EFalse; |
|
1877 if(FeatureManager::FeatureSupported(KFeatureIdSapPolicyManagement)) |
|
1878 { |
|
1879 TBool apEnforce=EFalse; |
|
1880 TRAPD(eError,apEnforce=CheckEnforcementL()) |
|
1881 DBG_ARGS8(_S8("CNSmlInternetAdapter::AddLeafObjectL(): EError %d , APEnforcement is %d"),eError,apEnforce); |
|
1882 if(eError==KErrNone && apEnforce) |
|
1883 { |
|
1884 DoLockIAPTablesL(EFalse); |
|
1885 iWAPRelock = ETrue; |
|
1886 } |
|
1887 } |
|
1888 if(IsIAPRecordLockedL(iapID5)) |
|
1889 { |
|
1890 _DBG_FILE("CNSmlInternetAdapter::AddLeafObjectL(): apaccesspoint record is LOCKED"); |
|
1891 TInt reclockerr = DoProtectIAPRecordL(iapID5,EFalse); |
|
1892 DBG_ARGS8(_S8("CNSmlInternetAdapter::AddLeafObjectL ,UnProtecting IAPAccessRecord returned code = %d"),reclockerr); |
|
1893 if(reclockerr==KErrNone) |
|
1894 iapReLock = ETrue; |
|
1895 } |
|
1896 else |
|
1897 { |
|
1898 _DBG_FILE("CNSmlInternetAdapter::AddLeafObjectL(): apaccesspoint record is not write protected"); |
|
1899 } |
|
1900 CCommsDbTableView* wapView; |
|
1901 TBool wapaccesspointTableLocked = EFalse; |
|
1902 |
|
1903 if(qColumn == TPtrC(WAP_START_PAGE)) |
|
1904 { |
|
1905 _DBG_FILE("CNSmlInternetAdapter::AddLeafObjectL(): record to be added WAP_START_PAGE, check for lock status"); |
|
1906 DBG_ARGS8(_S8("CNSmlInternetAdapter::AddLeafObjectL Get WapAccessPoint record access for ID = %d"),iWapId); |
|
1907 if(IsWAPAccessPointRecordLockedL(iWapId)) |
|
1908 { |
|
1909 _DBG_FILE("CNSmlInternetAdapter::AddLeafObjectL(): wapaccesspoint record is LOCKED"); |
|
1910 TInt reclockerr = DoProtectWAPAccessRecordL(iWapId,EFalse); |
|
1911 DBG_ARGS8(_S8("CNSmlInternetAdapter::AddLeafObjectL ,UnProtecting IAPAccessRecord returned code = %d"),reclockerr); |
|
1912 if(reclockerr==KErrNone) |
|
1913 wapaccesspointTableLocked = ETrue; |
|
1914 } |
|
1915 else |
|
1916 { |
|
1917 _DBG_FILE("CNSmlInternetAdapter::AddLeafObjectL(): wapaccesspoint record is not write protected"); |
|
1918 } |
|
1919 wapView = iDatabase->OpenViewMatchingUintLC(TPtrC(WAP_ACCESS_POINT), |
|
1920 TPtrC(COMMDB_ID), |
|
1921 iWapId); |
|
1922 pushed++; |
|
1923 } |
|
1924 else // Other WAP-data |
|
1925 { |
|
1926 wapView = iDatabase->OpenViewMatchingUintLC(TPtrC(WAP_IP_BEARER), |
|
1927 TPtrC(WAP_ACCESS_POINT_ID), |
|
1928 iWapId); |
|
1929 pushed++; |
|
1930 } |
|
1931 |
|
1932 TInt errorCode = wapView->GotoFirstRecord(); |
|
1933 |
|
1934 // Read all columns needed. |
|
1935 if ( errorCode == KErrNone ) |
|
1936 { |
|
1937 if(wapView->UpdateRecord()!=KErrNone) |
|
1938 { |
|
1939 //database locked |
|
1940 CleanupStack::PopAndDestroy(pushed); |
|
1941 iCallBack->SetStatusL(aStatusRef,CSmlDmAdapter::EError); |
|
1942 _DBG_FILE("CNSmlInternetAdapter::AddLeafObjectL(): Wapview Update failed end"); |
|
1943 if(wapaccesspointTableLocked) |
|
1944 { |
|
1945 _DBG_FILE("CNSmlInternetAdapter::AddLeafObjectL(): wapaccesspoint record to be locked again "); |
|
1946 DoProtectWAPAccessRecordL(iWapId,ETrue); |
|
1947 wapaccesspointTableLocked = EFalse; |
|
1948 } |
|
1949 if(FeatureManager::FeatureSupported(KFeatureIdSapPolicyManagement)) |
|
1950 { |
|
1951 if(iWAPRelock) |
|
1952 { |
|
1953 DoLockIAPTablesL(ETrue); |
|
1954 iWAPRelock = EFalse; |
|
1955 } |
|
1956 } |
|
1957 if(iapReLock) |
|
1958 { |
|
1959 TInt reclockerr = DoProtectIAPRecordL(iapID5,ETrue); |
|
1960 DBG_ARGS8(_S8("CNSmlInternetAdapter::AddLeafObjectL ,UnProtecting WAPAccessRecord returned code = %d"),reclockerr); |
|
1961 if(reclockerr==KErrNone) |
|
1962 iapReLock = EFalse; |
|
1963 } |
|
1964 return; |
|
1965 } |
|
1966 |
|
1967 if(qColumn == TPtrC(WAP_PROXY_PORT)) |
|
1968 { |
|
1969 TBool security = EFalse; // => 9200 + 9201, ETrue 9202 + 9203 |
|
1970 TUint32 object32; |
|
1971 TPtrC object16 = ConvertTo16LC(aObject); |
|
1972 pushed++; |
|
1973 if(object16.Match(KWappPort9200) != KErrNotFound ) |
|
1974 { |
|
1975 object32 = KWAPP_PORT_9200; // wappdef.h |
|
1976 } |
|
1977 else if(object16.Match(KWappPort9201) != KErrNotFound ) |
|
1978 { |
|
1979 object32 = KWAPP_PORT_9201; |
|
1980 } |
|
1981 else if(object16.Match(KWappPort9202) != KErrNotFound ) |
|
1982 { |
|
1983 object32 = KWAPP_PORT_9202; |
|
1984 security = ETrue; |
|
1985 } |
|
1986 else if(object16.Match(KWappPort9203) != KErrNotFound ) |
|
1987 { |
|
1988 object32 = KWAPP_PORT_9203; |
|
1989 security = ETrue; |
|
1990 } |
|
1991 else |
|
1992 { |
|
1993 wapView->CancelRecordChanges(); |
|
1994 CleanupStack::PopAndDestroy(pushed); |
|
1995 iCallBack->SetStatusL(aStatusRef,CSmlDmAdapter::EError); |
|
1996 _DBG_FILE("CNSmlInternetAdapter::AddLeafObjectL(): EError end"); |
|
1997 if(FeatureManager::FeatureSupported(KFeatureIdSapPolicyManagement)) |
|
1998 { |
|
1999 if(iWAPRelock) |
|
2000 { |
|
2001 DoLockIAPTablesL(ETrue); |
|
2002 iWAPRelock = EFalse; |
|
2003 } |
|
2004 } |
|
2005 if(iapReLock) |
|
2006 { |
|
2007 TInt reclockerr = DoProtectIAPRecordL(iapID5,ETrue); |
|
2008 DBG_ARGS8(_S8("CNSmlInternetAdapter::AddLeafObjectL ,UnProtecting IAPAccessRecord returned code = %d"),reclockerr); |
|
2009 if(reclockerr==KErrNone) |
|
2010 iapReLock = EFalse; |
|
2011 } |
|
2012 return; |
|
2013 } |
|
2014 wapView->WriteUintL(qColumn, object32); |
|
2015 wapView->WriteBoolL(TPtrC(WAP_SECURITY), security ); |
|
2016 } |
|
2017 else |
|
2018 { |
|
2019 wapView->WriteTextL(TPtrC(qColumn),ConvertTo16LC(aObject)); |
|
2020 pushed++; |
|
2021 } |
|
2022 } |
|
2023 wapView->PutRecordChanges(); |
|
2024 _DBG_FILE("CNSmlInternetAdapter::AddLeafObjectL(): wapaccesspoint record Changes DONE successfully "); |
|
2025 if(wapaccesspointTableLocked) |
|
2026 { |
|
2027 _DBG_FILE("CNSmlInternetAdapter::AddLeafObjectL(): wapaccesspoint record to be locked again "); |
|
2028 TInt reclockerr = DoProtectWAPAccessRecordL(iWapId,ETrue); |
|
2029 DBG_ARGS8(_S8("CNSmlInternetAdapter::AddLeafObjectL ,Protecting WAPAccessRecord %d , returned code = %d"),iWapId,reclockerr); |
|
2030 wapaccesspointTableLocked = EFalse; |
|
2031 } |
|
2032 if(FeatureManager::FeatureSupported(KFeatureIdSapPolicyManagement)) |
|
2033 { |
|
2034 if(iWAPRelock) |
|
2035 { |
|
2036 DoLockIAPTablesL(ETrue); |
|
2037 iWAPRelock = EFalse; |
|
2038 } |
|
2039 } |
|
2040 if(iapReLock) |
|
2041 { |
|
2042 TInt reclockerr = DoProtectIAPRecordL(iapID5,ETrue); |
|
2043 DBG_ARGS8(_S8("CNSmlInternetAdapter::AddLeafObjectL ,UnProtecting WAPAccessRecord returned code = %d"),reclockerr); |
|
2044 if(reclockerr==KErrNone) |
|
2045 iapReLock = EFalse; |
|
2046 } |
|
2047 CleanupStack::PopAndDestroy(pushed); |
|
2048 pushed = 0; |
|
2049 } |
|
2050 else |
|
2051 { // Insert handled |
|
2052 CCommsDbTableView* insView; |
|
2053 TInt wapInitOK = KErrCancel; |
|
2054 TBool iapReLock = EFalse; |
|
2055 |
|
2056 if(FeatureManager::FeatureSupported(KFeatureIdSapPolicyManagement)) |
|
2057 { |
|
2058 TBool apEnforce=EFalse; |
|
2059 TRAPD(eError,apEnforce=CheckEnforcementL()) |
|
2060 DBG_ARGS8(_S8("CNSmlInternetAdapter::AddLeafObjectL(): EError %d , APEnforcement is %d"),eError,apEnforce); |
|
2061 if(eError==KErrNone && apEnforce) |
|
2062 { |
|
2063 DoLockIAPTablesL(EFalse); |
|
2064 iWAPRelock = ETrue; |
|
2065 } |
|
2066 } |
|
2067 if(iapReLock) |
|
2068 { |
|
2069 TInt reclockerr = DoProtectIAPRecordL(iapID5,ETrue); |
|
2070 DBG_ARGS8(_S8("CNSmlInternetAdapter::AddLeafObjectL ,UnProtecting WAPAccessRecord returned code = %d"),reclockerr); |
|
2071 if(reclockerr==KErrNone) |
|
2072 iapReLock = EFalse; |
|
2073 } |
|
2074 insView = iDatabase->OpenTableLC(TPtrC(WAP_ACCESS_POINT)); |
|
2075 iWapId = 0; |
|
2076 wapInitOK = insView->InsertRecord(iWapId); |
|
2077 if(wapInitOK == KErrNone) |
|
2078 { |
|
2079 iWAPAccessPoint.Zero(); |
|
2080 iWapUserName.Zero(); |
|
2081 iWapPassword.Zero(); |
|
2082 |
|
2083 if(qColumn == TPtrC(WAP_START_PAGE)) |
|
2084 { |
|
2085 iWAPAccessPoint = aObject; |
|
2086 } |
|
2087 else if(qColumn == TPtrC(WAP_PROXY_LOGIN_NAME)) |
|
2088 { |
|
2089 iWapUserName = aObject; |
|
2090 } |
|
2091 else if(qColumn == TPtrC(WAP_PROXY_LOGIN_PASS)) |
|
2092 { |
|
2093 iWapPassword = aObject; |
|
2094 } |
|
2095 |
|
2096 iWapBearer = TPtrC(WAP_IP_BEARER); |
|
2097 iWapName = FirstURISeg(aURI); // Name needed !!! |
|
2098 |
|
2099 wapInitOK = InitializeWAPIAPL( insView, iIAPName ); |
|
2100 if( wapInitOK == KErrNone ) |
|
2101 { |
|
2102 insView->PutRecordChanges(); |
|
2103 CleanupStack::PopAndDestroy(); // insView |
|
2104 |
|
2105 CCommsDbTableView* updView; |
|
2106 TUint32 iWapId2 = 0; |
|
2107 iISPId = iapID5; // IAP number set |
|
2108 updView = iDatabase->OpenTableLC(TPtrC(WAP_IP_BEARER)); |
|
2109 if(updView->InsertRecord(iWapId2) == KErrNone ) |
|
2110 { |
|
2111 wapInitOK = InitializeWAPL( updView ); |
|
2112 } |
|
2113 else |
|
2114 { |
|
2115 wapInitOK = KErrGeneral; |
|
2116 } |
|
2117 if( wapInitOK == KErrNone ) |
|
2118 { |
|
2119 if( !PxExistsL(iapID5) ) |
|
2120 { |
|
2121 |
|
2122 // Set mapping-data |
|
2123 |
|
2124 TPtrC8 addURI = GetAddURISeg(aURI,KNSmlDdfStartpg); |
|
2125 TBuf8<16> addLUID; |
|
2126 _LIT8(KFormat,"%d"); |
|
2127 addLUID.Format(KFormat,iapID5); |
|
2128 iCallBack->SetMappingL(addURI,addLUID); |
|
2129 } |
|
2130 else if( !NAPDefExistsL(iapID5) ) |
|
2131 { |
|
2132 |
|
2133 // Set mapping-data |
|
2134 |
|
2135 TPtrC8 addURI = GetAddURISeg(aURI,KNSmlDdfStartpg); |
|
2136 TBuf8<16> addLUID; |
|
2137 _LIT8(KFormat,"%d"); |
|
2138 addLUID.Format(KFormat,iapID5); |
|
2139 iCallBack->SetMappingL(addURI,addLUID); |
|
2140 } |
|
2141 |
|
2142 updView->PutRecordChanges(); |
|
2143 CleanupStack::PopAndDestroy(); // updView |
|
2144 CleanupStack::PopAndDestroy(pushed); |
|
2145 iCallBack->SetStatusL(aStatusRef,CSmlDmAdapter::EOk); |
|
2146 |
|
2147 if(FeatureManager::FeatureSupported(KFeatureIdSapPolicyManagement)) |
|
2148 { |
|
2149 if(iWAPRelock) |
|
2150 { |
|
2151 DoLockIAPTablesL(ETrue); |
|
2152 iWAPRelock = EFalse; |
|
2153 } |
|
2154 } |
|
2155 if(iapReLock) |
|
2156 { |
|
2157 TInt reclockerr = DoProtectIAPRecordL(iapID5,ETrue); |
|
2158 DBG_ARGS8(_S8("CNSmlInternetAdapter::AddLeafObjectL ,UnProtecting IAPAccessRecord returned code = %d"),reclockerr); |
|
2159 if(reclockerr==KErrNone) |
|
2160 iapReLock = EFalse; |
|
2161 } |
|
2162 _DBG_FILE("CNSmlInternetAdapter::AddLeafObjectL(): EOk end"); |
|
2163 return; |
|
2164 } |
|
2165 else |
|
2166 { |
|
2167 CleanupStack::PopAndDestroy(); // updView |
|
2168 CleanupStack::PopAndDestroy(pushed); |
|
2169 iCallBack->SetStatusL(aStatusRef,CSmlDmAdapter::EError); |
|
2170 |
|
2171 if(FeatureManager::FeatureSupported(KFeatureIdSapPolicyManagement)) |
|
2172 { |
|
2173 if(iWAPRelock) |
|
2174 { |
|
2175 DoLockIAPTablesL(ETrue); |
|
2176 iWAPRelock = EFalse; |
|
2177 } |
|
2178 } |
|
2179 if(iapReLock) |
|
2180 { |
|
2181 TInt reclockerr = DoProtectIAPRecordL(iapID5,ETrue); |
|
2182 DBG_ARGS8(_S8("CNSmlInternetAdapter::AddLeafObjectL ,UnProtecting IAPAccessRecord returned code = %d"),reclockerr); |
|
2183 if(reclockerr==KErrNone) |
|
2184 iapReLock = EFalse; |
|
2185 } |
|
2186 _DBG_FILE("CNSmlInternetAdapter::AddLeafObjectL(): EError end"); |
|
2187 return; |
|
2188 } |
|
2189 } |
|
2190 else |
|
2191 { |
|
2192 insView->CancelRecordChanges(); |
|
2193 CleanupStack::PopAndDestroy(); // insView |
|
2194 CleanupStack::PopAndDestroy(pushed); |
|
2195 iCallBack->SetStatusL(aStatusRef,CSmlDmAdapter::EError); |
|
2196 |
|
2197 if(FeatureManager::FeatureSupported(KFeatureIdSapPolicyManagement)) |
|
2198 { |
|
2199 if(iWAPRelock) |
|
2200 { |
|
2201 DoLockIAPTablesL(ETrue); |
|
2202 iWAPRelock = EFalse; |
|
2203 } |
|
2204 } |
|
2205 if(iapReLock) |
|
2206 { |
|
2207 TInt reclockerr = DoProtectIAPRecordL(iapID5,ETrue); |
|
2208 DBG_ARGS8(_S8("CNSmlInternetAdapter::AddLeafObjectL ,UnProtecting IAPAccessRecord returned code = %d"),reclockerr); |
|
2209 if(reclockerr==KErrNone) |
|
2210 iapReLock = EFalse; |
|
2211 } |
|
2212 _DBG_FILE("CNSmlInternetAdapter::AddLeafObjectL(): EError end"); |
|
2213 return; |
|
2214 } |
|
2215 } |
|
2216 else |
|
2217 { |
|
2218 CleanupStack::PopAndDestroy(); // insView |
|
2219 CleanupStack::PopAndDestroy(pushed); |
|
2220 iCallBack->SetStatusL(aStatusRef,CSmlDmAdapter::EError); |
|
2221 if(FeatureManager::FeatureSupported(KFeatureIdSapPolicyManagement)) |
|
2222 { |
|
2223 if(iWAPRelock) |
|
2224 { |
|
2225 DoLockIAPTablesL(ETrue); |
|
2226 iWAPRelock = EFalse; |
|
2227 } |
|
2228 } |
|
2229 if(iapReLock) |
|
2230 { |
|
2231 TInt reclockerr = DoProtectIAPRecordL(iapID5,ETrue); |
|
2232 DBG_ARGS8(_S8("CNSmlInternetAdapter::AddLeafObjectL ,UnProtecting IAPAccessRecord returned code = %d"),reclockerr); |
|
2233 if(reclockerr==KErrNone) |
|
2234 iapReLock = EFalse; |
|
2235 } |
|
2236 _DBG_FILE("CNSmlInternetAdapter::AddLeafObjectL(): EError end"); |
|
2237 return; |
|
2238 } |
|
2239 } |
|
2240 } |
|
2241 else if ( fType == CNSmlInternetAdapter::ESpec ) |
|
2242 { // BearerL + NoPxForL + IAPService + Direction |
|
2243 if (aURI.Find(KNSmlDdfDirection) >= 0) |
|
2244 { |
|
2245 _LIT8(KDirection,"Outgoing"); |
|
2246 if(KDirection().Find(aObject) != KErrNotFound) |
|
2247 { |
|
2248 iDirection = ECommDbConnectionDirectionOutgoing; |
|
2249 } |
|
2250 else |
|
2251 { |
|
2252 iDirection = ECommDbConnectionDirectionIncoming; |
|
2253 if(iBearer == TPtrC(OUTGOING_GPRS)) |
|
2254 { |
|
2255 iBearer = TPtrC(INCOMING_GPRS); |
|
2256 } |
|
2257 } |
|
2258 } |
|
2259 else if (aURI.Find(KNSmlDdfIAPService) >= 0) |
|
2260 { |
|
2261 CleanupStack::PopAndDestroy(pushed); |
|
2262 iCallBack->SetStatusL(aStatusRef,CSmlDmAdapter::EError); |
|
2263 _DBG_FILE("CNSmlInternetAdapter::AddLeafObjectL(): EError end"); |
|
2264 return; |
|
2265 } |
|
2266 else if (aURI.Find(KNSmlDdfNoPxForL) >= 0) /* No proxies used field handling */ |
|
2267 { |
|
2268 TBool proxyFound = GetProxyIdL(aURI); |
|
2269 if(!proxyFound) |
|
2270 { |
|
2271 iCallBack->SetStatusL(aStatusRef,CSmlDmAdapter::EError); |
|
2272 _DBG_FILE("CNSmlInternetAdapter::AddLeafObjectL(): EError end"); |
|
2273 CleanupStack::PopAndDestroy(pushed); |
|
2274 return; |
|
2275 } |
|
2276 |
|
2277 CCommsDbTableView* specView = iDatabase->OpenViewMatchingUintLC(TPtrC(PROXIES), |
|
2278 TPtrC(COMMDB_ID), |
|
2279 iProxyId); |
|
2280 TInt errorCode = specView->GotoFirstRecord(); |
|
2281 |
|
2282 |
|
2283 if ( errorCode == KErrNone ) |
|
2284 { |
|
2285 TBool proxyReLock = EFalse; |
|
2286 if(IsProxyRecordLockedL(iProxyId)) |
|
2287 { |
|
2288 _DBG_FILE("CNSmlInternetAdapter::AddLeafObjectL(): apaccesspoint record is LOCKED"); |
|
2289 TInt reclockerr = ((CCommsDbProtectTableView*)specView)->UnprotectRecord(); |
|
2290 DBG_ARGS8(_S8("CNSmlInternetAdapter::AddLeafObjectL ,UnProtecting ProxyAccessRecord returned code = %d"),reclockerr); |
|
2291 if(reclockerr==KErrNone) |
|
2292 proxyReLock = ETrue; |
|
2293 } |
|
2294 else |
|
2295 { |
|
2296 _DBG_FILE("CNSmlInternetAdapter::AddLeafObjectL(): apaccesspoint record is not write protected"); |
|
2297 } |
|
2298 if(specView->UpdateRecord()==KErrNone) |
|
2299 { |
|
2300 //database not locked |
|
2301 specView->WriteLongTextL(TPtrC(PROXY_EXCEPTIONS), ConvertTo16LC(aObject)); |
|
2302 specView->PutRecordChanges(); |
|
2303 iCallBack->SetStatusL(aStatusRef,CSmlDmAdapter::EOk); |
|
2304 CleanupStack::PopAndDestroy(); // ConvertTo16LC |
|
2305 } |
|
2306 else |
|
2307 { |
|
2308 iCallBack->SetStatusL(aStatusRef,CSmlDmAdapter::EError); |
|
2309 } |
|
2310 if(proxyReLock) |
|
2311 { |
|
2312 TInt reclockerr = DoProtectProxyRecordL(iProxyId,ETrue); |
|
2313 DBG_ARGS8(_S8("CNSmlInternetAdapter::AddLeafObjectL ,UnProtecting ProxyAccessRecord returned code = %d"),reclockerr); |
|
2314 if(reclockerr==KErrNone) |
|
2315 proxyReLock = EFalse; |
|
2316 } |
|
2317 } |
|
2318 else |
|
2319 { |
|
2320 iCallBack->SetStatusL(aStatusRef,CSmlDmAdapter::EError); |
|
2321 } |
|
2322 CleanupStack::PopAndDestroy(); // specView |
|
2323 |
|
2324 CleanupStack::PopAndDestroy(pushed); |
|
2325 _DBG_FILE("CNSmlInternetAdapter::AddLeafObjectL(): EError end"); |
|
2326 return; |
|
2327 } |
|
2328 else if (aURI.Find(KNSmlDdfBearerL) >= 0) /* Bearer handling */ |
|
2329 { |
|
2330 if (aObject.Match(KNSmlDmApValGsmGprs) != KErrNotFound) |
|
2331 { |
|
2332 if(iDirection == ECommDbConnectionDirectionIncoming) |
|
2333 { |
|
2334 iBearer = TPtrC(INCOMING_GPRS); |
|
2335 } |
|
2336 else |
|
2337 { |
|
2338 iBearer = TPtrC(OUTGOING_GPRS); |
|
2339 } |
|
2340 } |
|
2341 |
|
2342 else if (aObject.Match(KNSmlDmApVal3Gppps) != KErrNotFound) |
|
2343 { |
|
2344 i3GPPPS = ETrue; |
|
2345 if(iDirection == ECommDbConnectionDirectionIncoming) |
|
2346 { |
|
2347 iBearer = TPtrC(INCOMING_GPRS); |
|
2348 } |
|
2349 else |
|
2350 { |
|
2351 iBearer = TPtrC(OUTGOING_GPRS); |
|
2352 } |
|
2353 } |
|
2354 else if (aObject.Match(KNSmlDmApValVpn) != KErrNotFound) |
|
2355 { |
|
2356 iBearer = TPtrC(VPN_SERVICE); |
|
2357 } |
|
2358 else if ( (aObject.Match(KNSmlDmApValWlan) != KErrNotFound ) |
|
2359 && iWlanSupported ) |
|
2360 { |
|
2361 iBearer = TPtrC(LAN_SERVICE); |
|
2362 } |
|
2363 else |
|
2364 { |
|
2365 CleanupStack::PopAndDestroy(pushed); |
|
2366 iCallBack->SetStatusL(aStatusRef,CSmlDmAdapter::EError); |
|
2367 _DBG_FILE("CNSmlInternetAdapter::AddLeafObjectL(): UNKNOWN Bearer Error end"); |
|
2368 return; |
|
2369 } |
|
2370 } |
|
2371 else if (aURI.Find( KNSmlDdfNAPName ) >= 0) |
|
2372 { |
|
2373 iIAPName.Copy( aObject ); |
|
2374 TUint32 iapID2 = GetAPIdFromURIL(aURI); |
|
2375 if( iapID2 > 0 && UpdateIAPnameL(iapID2,aObject) != KErrNone ) |
|
2376 { |
|
2377 CleanupStack::PopAndDestroy(pushed); |
|
2378 iCallBack->SetStatusL(aStatusRef,CSmlDmAdapter::EError); |
|
2379 return; |
|
2380 } |
|
2381 } |
|
2382 } |
|
2383 |
|
2384 CleanupStack::PopAndDestroy(pushed); |
|
2385 pushed = 0; |
|
2386 |
|
2387 // Update CommsDB IAP + insert iBearer Table |
|
2388 |
|
2389 if( IsInsertAllowedL() && iLeafType == EDMAdd && fType == CNSmlInternetAdapter::ESpec) //iIAPExists |
|
2390 { |
|
2391 TInt initOK = KErrCancel; |
|
2392 |
|
2393 iISPId = GetMaxIdL() + 1; // For new data |
|
2394 |
|
2395 SaveIAPDataL(aURI); // Level 1 Mapping inside |
|
2396 |
|
2397 CCommsDbTableView* newAPView; |
|
2398 |
|
2399 newAPView = iDatabase->OpenTableLC(iBearer); |
|
2400 // 3GPPPS = OUTGOING/INCOMING_GPRS |
|
2401 if (iBearer == TPtrC(OUTGOING_GPRS) || |
|
2402 iBearer == TPtrC(INCOMING_GPRS)) |
|
2403 { |
|
2404 if(newAPView->InsertRecord(iISPId)==KErrNone) |
|
2405 { |
|
2406 initOK = InitializeGPRSL(newAPView); |
|
2407 } |
|
2408 else |
|
2409 { |
|
2410 initOK = KErrGeneral; |
|
2411 } |
|
2412 } |
|
2413 |
|
2414 else if(iBearer == TPtrC(VPN_SERVICE) ) |
|
2415 { |
|
2416 if(newAPView->InsertRecord(iISPId)==KErrNone) |
|
2417 { |
|
2418 initOK = InitializeVPNServiceL(newAPView); |
|
2419 } |
|
2420 else |
|
2421 { |
|
2422 initOK = KErrGeneral; |
|
2423 } |
|
2424 } |
|
2425 else if( ( iBearer == TPtrC(LAN_SERVICE) ) && iWlanSupported ) |
|
2426 { |
|
2427 if(newAPView->InsertRecord(iISPId)==KErrNone) |
|
2428 { |
|
2429 initOK = InitializeLANServiceL(newAPView); |
|
2430 } |
|
2431 else |
|
2432 { |
|
2433 initOK = KErrGeneral; |
|
2434 } |
|
2435 } |
|
2436 else |
|
2437 { |
|
2438 initOK = KErrCancel; |
|
2439 } |
|
2440 |
|
2441 if ( initOK == KErrNone) |
|
2442 { |
|
2443 TUint32 newId = 0; |
|
2444 newAPView->PutRecordChanges(); |
|
2445 newAPView->ReadUintL(TPtrC(COMMDB_ID), newId); |
|
2446 |
|
2447 // To update right Id |
|
2448 |
|
2449 iISPId = newId; |
|
2450 |
|
2451 SaveIAPDataL(aURI); |
|
2452 |
|
2453 TUint32 iapID2 = GetAPIdFromURIL(aURI); |
|
2454 UpdateIAPnameL( iapID2, iIAPName ); |
|
2455 // |
|
2456 // Set mapping-data (levels 2 and 3 ) |
|
2457 // |
|
2458 TPtrC8 addURI = GetAddURISeg(aURI,KNSmlDdfNAPDef); |
|
2459 |
|
2460 TBuf8<16> addLUID; |
|
2461 _LIT8(KFormat,"%d"); |
|
2462 addLUID.Format(KFormat,newId); |
|
2463 |
|
2464 // Also NAPDef (level 2) |
|
2465 iCallBack->SetMappingL(addURI,addLUID); |
|
2466 DBG_ARGS8(_S8("AP:level2 URI - <%S> <%S> <%d>"), &addURI, &addLUID, newId ); |
|
2467 |
|
2468 // Also BearerL (level 3) |
|
2469 TPtrC8 addURI2 = GetAddURISeg(aURI,KNSmlDdfBearer); |
|
2470 if ( i3GPPPS ) |
|
2471 { |
|
2472 newId = KNSmlAp3gpppsLowerBase+newId; |
|
2473 addLUID.Format(KFormat,newId); |
|
2474 i3GPPPS = EFalse; |
|
2475 } |
|
2476 iCallBack->SetMappingL(addURI2,addLUID); |
|
2477 DBG_ARGS8(_S8("AP:level3 URI - <%S> <%S> <%d>"), &addURI2, &addLUID, newId ); |
|
2478 } |
|
2479 else |
|
2480 { |
|
2481 if(initOK==KErrCancel) |
|
2482 { |
|
2483 newAPView->CancelRecordChanges(); |
|
2484 } |
|
2485 CleanupStack::PopAndDestroy(newAPView); |
|
2486 CleanupStack::PopAndDestroy(pushed); |
|
2487 iCallBack->SetStatusL(aStatusRef,CSmlDmAdapter::EError); |
|
2488 _DBG_FILE("CNSmlInternetAdapter::AddLeafObjectL(): EError end"); |
|
2489 return; |
|
2490 } |
|
2491 |
|
2492 CleanupStack::PopAndDestroy(newAPView); |
|
2493 } |
|
2494 else if(IsInsertAllowedL() && |
|
2495 iLeafType == EDMAdd && |
|
2496 aURI.Find(KNSmlDdfBearerL) >= 0 ) |
|
2497 |
|
2498 { |
|
2499 CleanupStack::PopAndDestroy(pushed); |
|
2500 iCallBack->SetStatusL(aStatusRef,CSmlDmAdapter::EAlreadyExists); |
|
2501 _DBG_FILE("CNSmlInternetAdapter::AddLeafObjectL(): EAlreadyExists BearerL end"); |
|
2502 return; |
|
2503 } |
|
2504 CleanupStack::PopAndDestroy(pushed); |
|
2505 iCallBack->SetStatusL(aStatusRef,CSmlDmAdapter::EOk); |
|
2506 _DBG_FILE("CNSmlInternetAdapter::AddLeafObjectL(): OK end"); |
|
2507 return; |
|
2508 } |
|
2509 |
|
2510 //------------------------------------------------------------------------------ |
|
2511 // CNSmlInternetAdapter::UpdateLeafObjectL( const TDesC8& aURI, const TDesC8& aLUID, const TDesC8& aObject, const TDesC8& aType ) |
|
2512 //------------------------------------------------------------------------------ |
|
2513 void CNSmlInternetAdapter::UpdateLeafObjectL( const TDesC8& aURI, |
|
2514 const TDesC8& aLUID, |
|
2515 const TDesC8& aObject, |
|
2516 const TDesC8& aType, |
|
2517 const TInt aStatusRef ) |
|
2518 { |
|
2519 _DBG_FILE("CNSmlInternetAdapter::UpdateLeafObjectL(): begin"); |
|
2520 |
|
2521 DBG_ARGS8(_S8("AP:update aURI UpdateLeafObjectL - %S - %S"), &aURI, &aLUID); |
|
2522 DBG_ARGS8(_S8("AP:Object %S"), &aObject); |
|
2523 if( iTransactionCommitted ) |
|
2524 { |
|
2525 TInt dberr = iDatabase->BeginTransaction(); |
|
2526 if( dberr == KErrLocked ) |
|
2527 { |
|
2528 _DBG_FILE("UpdateLeafObjectL: CommsDat was locked."); |
|
2529 TInt retry = KBeginTransRetryCount; |
|
2530 while ( retry > 0 && dberr == KErrLocked ) |
|
2531 { |
|
2532 User::After(KBeginTransRetryDelay); |
|
2533 _DBG_FILE("UpdateLeafObjectL: Slept 1 second. Try again"); |
|
2534 dberr = iDatabase->BeginTransaction(); |
|
2535 retry--; |
|
2536 } |
|
2537 if(dberr != KErrNone) |
|
2538 { |
|
2539 _DBG_FILE("CNSmlInternetAdapter: BeginTransaction failed completely."); |
|
2540 User::Leave( dberr ); |
|
2541 } |
|
2542 } |
|
2543 iTransactionCommitted = EFalse; |
|
2544 } |
|
2545 if ( ( aURI.Match(_L8("*/WLAN*" )) != KErrNotFound ) && iWlanSupported ) |
|
2546 { |
|
2547 AddLeafBufferL( aURI, aLUID, aObject, aType, aStatusRef, ETrue ); |
|
2548 iDatabase->CommitTransaction(); |
|
2549 iTransactionCommitted = ETrue; |
|
2550 _DBG_FILE("CNSmlInternetAdapter::UpdateLeafObjectL(): WLAN end"); |
|
2551 |
|
2552 return; |
|
2553 } |
|
2554 // |
|
2555 // No direct update allowed only update as add |
|
2556 // |
|
2557 if( aLUID.Length() > 0 && |
|
2558 aURI.Find(KNSmlDdfNAPDef) >= 0 ) |
|
2559 /*( aURI.Find(KNSmlDdfBearerL) >= 0 || |
|
2560 aURI.Find(KNSmlDdfDirection) >= 0 || |
|
2561 aURI.Find(KNSmlDdfNAPName) >= 0 ) */ |
|
2562 { |
|
2563 _DBG_FILE("Bearer | direction CNSmlInternetAdapter::UpdatelaefObject ( ): EError end"); |
|
2564 |
|
2565 AddLeafBufferL( aURI, aLUID, aObject, aType, aStatusRef, EFalse ); |
|
2566 iDatabase->CommitTransaction(); |
|
2567 iTransactionCommitted = ETrue; |
|
2568 return; |
|
2569 } |
|
2570 |
|
2571 iLeafType = EDMUpdate; |
|
2572 |
|
2573 TRAP_IGNORE(AddLeafObjectL( aURI, aLUID, aObject, aType , aStatusRef )); |
|
2574 iDatabase->CommitTransaction(); |
|
2575 iTransactionCommitted = ETrue; |
|
2576 // |
|
2577 // If try to update field that has value which is not default errorvalue should be returned |
|
2578 // |
|
2579 iLeafType = EDMUnset; |
|
2580 |
|
2581 _DBG_FILE("CNSmlInternetAdapter::UpdateLeafObjectL(): end"); |
|
2582 |
|
2583 return; |
|
2584 } |
|
2585 |
|
2586 //------------------------------------------------------------------------------ |
|
2587 // CNSmlInternetAdapter::UpdateLeafObjectL( const TDesC8& aURI, |
|
2588 // const TDesC8& aLUID, const TDesC8& aObject, const TDesC8& aType ) |
|
2589 //------------------------------------------------------------------------------ |
|
2590 |
|
2591 void CNSmlInternetAdapter::UpdateLeafObjectL( const TDesC8& /*aURI*/, |
|
2592 const TDesC8& /*aLUID*/, |
|
2593 RWriteStream*& /*aStream*/, |
|
2594 const TDesC8& /*aType*/, |
|
2595 TInt aStatusRef ) |
|
2596 { |
|
2597 _DBG_FILE("CNSmlInternetAdapter::UpdateLeafObjectL(RWriteStream): begin"); |
|
2598 iCallBack->SetStatusL(aStatusRef,CSmlDmAdapter::EError); |
|
2599 _DBG_FILE("CNSmlInternetAdapter::UpdateLeafObjectL(RWriteStream): end"); |
|
2600 } |
|
2601 |
|
2602 //------------------------------------------------------------------------------ |
|
2603 // CNSmlInternetAdapter::DeleteObjectL( const TDesC& aURI, const TDesC& aLUID, |
|
2604 // const TInt aStatusRef ) |
|
2605 //------------------------------------------------------------------------------ |
|
2606 void CNSmlInternetAdapter::DeleteObjectL( const TDesC8& aURI, |
|
2607 const TDesC8& aLUID, |
|
2608 const TInt aStatusRef ) |
|
2609 { |
|
2610 _DBG_FILE("CNSmlInternetAdapter::DeleteObjectL( ): begin"); |
|
2611 if( iTransactionCommitted ) |
|
2612 { |
|
2613 TInt dberr = iDatabase->BeginTransaction(); |
|
2614 if( dberr == KErrLocked ) |
|
2615 { |
|
2616 _DBG_FILE("DeleteObjectL: CommsDat was locked."); |
|
2617 TInt retry = KBeginTransRetryCount; |
|
2618 while ( retry > 0 && dberr == KErrLocked ) |
|
2619 { |
|
2620 User::After(KBeginTransRetryDelay); |
|
2621 _DBG_FILE("DeleteObjectL: Slept 1 second. Try again"); |
|
2622 dberr = iDatabase->BeginTransaction(); |
|
2623 retry--; |
|
2624 } |
|
2625 if(dberr != KErrNone) |
|
2626 { |
|
2627 _DBG_FILE("CNSmlInternetAdapter: BeginTransaction failed completely."); |
|
2628 User::Leave( dberr ); |
|
2629 } |
|
2630 } |
|
2631 iTransactionCommitted = EFalse; |
|
2632 } |
|
2633 |
|
2634 if( ( aURI.Match( _L8( "AP/*/NAPDef/*/WLAN/*" ) ) != KErrNotFound ) && iWlanSupported ) |
|
2635 { |
|
2636 iWlanAdapter->DeleteObjectL( aURI, aLUID, aStatusRef ); |
|
2637 _DBG_FILE("CNSmlInternetAdapter::DeleteObjectL( ): end"); |
|
2638 return; |
|
2639 } |
|
2640 |
|
2641 // |
|
2642 // Check which field going to be handled |
|
2643 // |
|
2644 SetField(aURI); |
|
2645 |
|
2646 iLUID = IntLUID(aLUID); |
|
2647 |
|
2648 TUint32 checkLUID = IntLUID(aLUID); |
|
2649 // |
|
2650 // Check which kind node to be deleted (Leaf delete not supported) |
|
2651 // |
|
2652 if( aURI.Match(_L8("AP/*" ))!= KErrNotFound && |
|
2653 aURI.Match(_L8("AP/*/*"))== KErrNotFound ) |
|
2654 { |
|
2655 // Check if AP exists |
|
2656 if(!APExistsL(checkLUID)) |
|
2657 { |
|
2658 iCallBack->SetStatusL(aStatusRef,CSmlDmAdapter::ENotFound); |
|
2659 _DBG_FILE("CNSmlInternetAdapter::DeleteObjectL(): ENotFound end"); |
|
2660 return; |
|
2661 } |
|
2662 if(DeleteAPL(checkLUID)) |
|
2663 { |
|
2664 iPrevURI->Des().Format( KNullDesC8 ); |
|
2665 iPrevLUID = 0; |
|
2666 iCallBack->SetStatusL(aStatusRef,CSmlDmAdapter::EOk); |
|
2667 _DBG_FILE("CNSmlInternetAdapter::DeleteObjectL(): EOk end"); |
|
2668 return; |
|
2669 } |
|
2670 else |
|
2671 { |
|
2672 iPrevURI->Des().Format( KNullDesC8 ); |
|
2673 iPrevLUID = 0; |
|
2674 iCallBack->SetStatusL(aStatusRef,CSmlDmAdapter::EError); |
|
2675 _DBG_FILE("CNSmlInternetAdapter::DeleteObjectL(): EError end"); |
|
2676 return; |
|
2677 } |
|
2678 } |
|
2679 |
|
2680 if (aURI.Match(_L8("AP/*/Px/*/Startpg" ))!= KErrNotFound) //Key for WAP-delete |
|
2681 { |
|
2682 // Check if WAPAp exists |
|
2683 if(!WapAPExistsL(checkLUID)) |
|
2684 { |
|
2685 iCallBack->SetStatusL(aStatusRef,CSmlDmAdapter::ENotFound); |
|
2686 _DBG_FILE("CNSmlInternetAdapter::DeleteObjectL(): ENotFound end"); |
|
2687 return; |
|
2688 } |
|
2689 if(DeleteWapAPL(checkLUID)) |
|
2690 { |
|
2691 iCallBack->SetStatusL(aStatusRef,CSmlDmAdapter::EOk); |
|
2692 _DBG_FILE("CNSmlInternetAdapter::DeleteObjectL(): EOk end"); |
|
2693 return; |
|
2694 } |
|
2695 else |
|
2696 { |
|
2697 iCallBack->SetStatusL(aStatusRef,CSmlDmAdapter::EError); |
|
2698 _DBG_FILE("CNSmlInternetAdapter::DeleteObjectL(): EError end"); |
|
2699 return; |
|
2700 } |
|
2701 } |
|
2702 |
|
2703 if (aURI.Match(_L8("AP/*/NAPDef/*" ))!= KErrNotFound && |
|
2704 aURI.Match(_L8("AP/*/NAPDef/*/*"))== KErrNotFound ) |
|
2705 { |
|
2706 // Check if NAPDef exists |
|
2707 if(!NAPDefExistsL(checkLUID )) |
|
2708 { |
|
2709 iCallBack->SetStatusL(aStatusRef,CSmlDmAdapter::ENotFound); |
|
2710 _DBG_FILE("CNSmlInternetAdapter::DeleteObjectL(): ENotFound end"); |
|
2711 return; |
|
2712 } |
|
2713 if(DeleteNAPDefL(checkLUID)) |
|
2714 { |
|
2715 iCallBack->SetStatusL(aStatusRef,CSmlDmAdapter::EOk); |
|
2716 _DBG_FILE("CNSmlInternetAdapter::DeleteObjectL(): EOk end"); |
|
2717 return; |
|
2718 } |
|
2719 } |
|
2720 |
|
2721 if (aURI.Match(_L8("AP/*/Px/*" ))!= KErrNotFound && |
|
2722 aURI.Match(_L8("AP/*/Px/*/*"))== KErrNotFound ) |
|
2723 { |
|
2724 // Check if PX exists |
|
2725 if(!PxExistsL(checkLUID)) |
|
2726 { |
|
2727 iCallBack->SetStatusL(aStatusRef,CSmlDmAdapter::ENotFound); |
|
2728 _DBG_FILE("CNSmlInternetAdapter::DeleteObjectL(): ENotFound end"); |
|
2729 return; |
|
2730 } |
|
2731 if(DeleteProxyL(checkLUID)) |
|
2732 { |
|
2733 iCallBack->SetStatusL(aStatusRef,CSmlDmAdapter::EOk); |
|
2734 _DBG_FILE("CNSmlInternetAdapter::DeleteObjectL(): EOk end"); |
|
2735 return; |
|
2736 } |
|
2737 } |
|
2738 |
|
2739 iCallBack->SetStatusL(aStatusRef,CSmlDmAdapter::EError); |
|
2740 _DBG_FILE("CNSmlInternetAdapter::DeleteObjectL( ): end"); |
|
2741 return; |
|
2742 } |
|
2743 |
|
2744 //------------------------------------------------------------------------------ |
|
2745 // CNSmlInternetAdapter::FetchLeafObjectSizeL() |
|
2746 //------------------------------------------------------------------------------ |
|
2747 |
|
2748 void CNSmlInternetAdapter::FetchLeafObjectSizeL( const TDesC8& aURI, |
|
2749 const TDesC8& aLUID, |
|
2750 const TDesC8& aType, |
|
2751 TInt aResultsRef, |
|
2752 TInt aStatusRef ) |
|
2753 { |
|
2754 _DBG_FILE("CNSmlInternetAdapter::FetchLeafObjectSizeL(): begin"); |
|
2755 |
|
2756 DBG_ARGS8(_S8("AP:Fetch aURI - %S - %S"), &aURI, &aLUID); |
|
2757 CBufBase *lObject = CBufFlat::NewL(128); |
|
2758 CleanupStack::PushL(lObject); |
|
2759 |
|
2760 // call to internal fetchleafobj. |
|
2761 CSmlDmAdapter::TError status = FetchLeafObjectL( aURI, aLUID, aType, *lObject ); |
|
2762 |
|
2763 if ( status == CSmlDmAdapter::EOk ) |
|
2764 { |
|
2765 lObject->Compress(); |
|
2766 TBuf8<8> size; |
|
2767 size.Num( lObject->Size() ); |
|
2768 lObject->Reset(); |
|
2769 lObject->InsertL(0, size ); |
|
2770 iCallBack->SetResultsL(aResultsRef, *lObject, aType); |
|
2771 } |
|
2772 iCallBack->SetStatusL(aStatusRef, status); |
|
2773 |
|
2774 CleanupStack::PopAndDestroy(lObject); |
|
2775 _DBG_FILE("CNSmlInternetAdapter::FetchLeafObjectSizeL(): end"); |
|
2776 |
|
2777 return; |
|
2778 } |
|
2779 |
|
2780 |
|
2781 //------------------------------------------------------------------------------ |
|
2782 // CNSmlInternetAdapter::FetchLeafObjectL() |
|
2783 //------------------------------------------------------------------------------ |
|
2784 |
|
2785 void CNSmlInternetAdapter::FetchLeafObjectL( const TDesC8& aURI, |
|
2786 const TDesC8& aLUID, |
|
2787 const TDesC8& aType, |
|
2788 const TInt aResultsRef, |
|
2789 const TInt aStatusRef ) |
|
2790 { |
|
2791 _DBG_FILE("CNSmlInternetAdapter::FetchLeafObjectL(): begin"); |
|
2792 |
|
2793 DBG_ARGS8(_S8("AP:Fetch aURI - %S - %S"), &aURI, &aLUID); |
|
2794 CBufBase *lObject = CBufFlat::NewL(128); |
|
2795 CleanupStack::PushL(lObject); |
|
2796 |
|
2797 // Add call to internal fetchleafobj |
|
2798 CSmlDmAdapter::TError status = FetchLeafObjectL( aURI, aLUID, aType, *lObject ); |
|
2799 if ( status == CSmlDmAdapter::EOk ) |
|
2800 { |
|
2801 iCallBack->SetResultsL(aResultsRef,*lObject,aType); |
|
2802 } |
|
2803 iCallBack->SetStatusL(aStatusRef, status); |
|
2804 |
|
2805 CleanupStack::PopAndDestroy(); //lObject |
|
2806 _DBG_FILE("CNSmlInternetAdapter::FetchLeafObjectL(): end"); |
|
2807 return; |
|
2808 } |
|
2809 |
|
2810 |
|
2811 |
|
2812 //------------------------------------------------------------------------------ |
|
2813 // CSmlDmInternetAdapter::FetchLeafObjectL() |
|
2814 //------------------------------------------------------------------------------ |
|
2815 |
|
2816 CSmlDmAdapter::TError CNSmlInternetAdapter::FetchLeafObjectL( |
|
2817 const TDesC8& aURI, |
|
2818 const TDesC8& aLUID, |
|
2819 const TDesC8& aType, |
|
2820 CBufBase& aObject ) |
|
2821 { |
|
2822 _DBG_FILE("CNSmlInternetAdapter::FetchLeafObjectL(internal)(): begin"); |
|
2823 |
|
2824 TInt pushed = 0; |
|
2825 TUint32 iapID = 0; |
|
2826 TBool treeConstructed(EFalse); |
|
2827 // |
|
2828 // If no proxy no fetch allowed |
|
2829 // |
|
2830 if (aURI.Match(_L8("AP/*/Px/*" ))!= KErrNotFound) |
|
2831 { |
|
2832 if(!GetProxyIdL(aURI)) |
|
2833 { |
|
2834 _DBG_FILE("CNSmlInternetAdapter::FetchLeafObjectL(internal)()(): ENotFound end"); |
|
2835 return CSmlDmAdapter::ENotFound; |
|
2836 } |
|
2837 } |
|
2838 if(!iLUID) |
|
2839 iLUID = IntLUID(aLUID); |
|
2840 |
|
2841 iapID = GetAPIdFromURIL(aURI); |
|
2842 |
|
2843 if( iapID == 0 ) |
|
2844 { |
|
2845 if( IsAPUriFormatMatchPredefined(aURI) ) |
|
2846 { |
|
2847 iLUID = ConstructTreeL(aURI); |
|
2848 iapID = GetAPIdFromURIL(aURI); |
|
2849 treeConstructed = ETrue; |
|
2850 } |
|
2851 |
|
2852 } |
|
2853 // Check if values for Given LUID |
|
2854 if (!iLUID |
|
2855 && (!IsWLANfield( aURI ) || !iWlanSupported) ) |
|
2856 { |
|
2857 _DBG_FILE("CNSmlInternetAdapter::FetchLeafObjectL(internal)()(): ENotFound end"); |
|
2858 return CSmlDmAdapter::ENotFound; |
|
2859 } |
|
2860 // |
|
2861 // Check which field going to be handled |
|
2862 // |
|
2863 SetField(aURI); |
|
2864 |
|
2865 aObject.Reset(); |
|
2866 |
|
2867 //Linger value |
|
2868 if((iField->Compare(KNSmlDdfNAPLinger) == 0)) |
|
2869 { |
|
2870 TInt lingerInterval; |
|
2871 TRAPD (err, GetLingerL( iapID, lingerInterval )); |
|
2872 if(err == KErrNotFound) |
|
2873 { |
|
2874 |
|
2875 return CSmlDmAdapter::ENotFound; |
|
2876 } |
|
2877 else if( err !=KErrNone) |
|
2878 { |
|
2879 |
|
2880 return CSmlDmAdapter::EError; |
|
2881 |
|
2882 } |
|
2883 else |
|
2884 { |
|
2885 TBuf<10> slinger; |
|
2886 slinger.AppendNum(lingerInterval); |
|
2887 |
|
2888 aObject.InsertL(aObject.Size(),ConvertTo8LC(slinger)); |
|
2889 CleanupStack::PopAndDestroy(); |
|
2890 return CSmlDmAdapter::EOk; |
|
2891 } |
|
2892 } |
|
2893 TPtrC qTable = TPtrC(KNullDesC); |
|
2894 TPtrC qColumn = TPtrC(KNullDesC); |
|
2895 TPtrC qDB = TPtrC(COMMDB_ID); |
|
2896 |
|
2897 if(aURI.Find(KNSmlDdfPortNbr) >= 0) // Check if WAP or PROXY port asked |
|
2898 { |
|
2899 _LIT8( KWap, "/WAP" ); |
|
2900 if(aURI.Find(KWap) >= 0) |
|
2901 { |
|
2902 iWapPort = ETrue; |
|
2903 } |
|
2904 else |
|
2905 { |
|
2906 iWapPort = EFalse; |
|
2907 } |
|
2908 } |
|
2909 |
|
2910 |
|
2911 if ( iWlanSupported ) |
|
2912 { |
|
2913 TBool wLANfield = IsWLANfield(aURI); |
|
2914 if(wLANfield) |
|
2915 { |
|
2916 // |
|
2917 // WLAN-adapter handles all WLAN fields |
|
2918 // |
|
2919 return iWlanAdapter->FetchLeafObjectL(aURI, aLUID, aType, aObject); |
|
2920 } |
|
2921 } |
|
2922 |
|
2923 // |
|
2924 // Get Database field type |
|
2925 // |
|
2926 TInt fType = GetAPFieldType( aURI ); |
|
2927 |
|
2928 if (fType == EWrong) |
|
2929 { |
|
2930 _DBG_FILE("CNSmlInternetAdapter::FetchLeafObjectL(internal)()(): EError end"); |
|
2931 return CSmlDmAdapter::EError; |
|
2932 } |
|
2933 // |
|
2934 iISPId = iLUID; |
|
2935 // |
|
2936 // IAP-table search serviceType (=Bearer) |
|
2937 |
|
2938 CCommsDbTableView* serviceView = iDatabase->OpenViewMatchingUintLC(TPtrC(IAP), |
|
2939 qDB, |
|
2940 iapID); |
|
2941 |
|
2942 TBuf<KCommsDbSvrMaxFieldLength> serviceType; |
|
2943 TUint32 serviceId = 0; |
|
2944 |
|
2945 TInt errorCode = serviceView->GotoFirstRecord(); |
|
2946 |
|
2947 // Read serviceType from (IAP) |
|
2948 if ( errorCode == KErrNone ) |
|
2949 { |
|
2950 serviceView->ReadTextL(TPtrC(IAP_SERVICE_TYPE), serviceType); |
|
2951 serviceView->ReadUintL(TPtrC(IAP_SERVICE), serviceId); |
|
2952 CleanupStack::PopAndDestroy(); // serviceView |
|
2953 } |
|
2954 else |
|
2955 { |
|
2956 CleanupStack::PopAndDestroy(); // serviceView |
|
2957 _DBG_FILE("CNSmlInternetAdapter::FetchLeafObjectL(internal)()(): ENotFound end"); |
|
2958 CleanupStack::PopAndDestroy(pushed); |
|
2959 return CSmlDmAdapter::ENotFound; |
|
2960 } |
|
2961 qTable.Set(serviceType); |
|
2962 |
|
2963 TBool allowed = GetAPField(qTable,qColumn); |
|
2964 |
|
2965 if(!allowed) |
|
2966 { |
|
2967 if( aURI.Find(KNSmlDdfNAPAddrTy) >= 0) /* NAPAddrTy handling */ |
|
2968 { |
|
2969 if (serviceType == TPtrC(OUTGOING_GPRS) || |
|
2970 serviceType == TPtrC(INCOMING_GPRS)) |
|
2971 { |
|
2972 _LIT8( KApn, "APN" ); |
|
2973 aObject.InsertL(aObject.Size(), KApn ); |
|
2974 |
|
2975 } |
|
2976 CleanupStack::PopAndDestroy(pushed); |
|
2977 return CSmlDmAdapter::EOk; |
|
2978 |
|
2979 } |
|
2980 _DBG_FILE("CNSmlInternetAdapter::FetchLeafObjectL(internal)()(): FieldNot allowed"); |
|
2981 CleanupStack::PopAndDestroy(pushed); |
|
2982 return CSmlDmAdapter::EError; |
|
2983 } |
|
2984 |
|
2985 if (fType == CNSmlInternetAdapter::EStr) |
|
2986 { // Name + NAPAddr + DNSAddrL |
|
2987 if(aURI.Match(_L8("AP/*/Networks/*/Name"))!= KErrNotFound ) // Networks-name |
|
2988 { |
|
2989 // TUint32 iapID8 = IntLUID(aLUID); |
|
2990 |
|
2991 // IAP-table NetworkId Fetch |
|
2992 CCommsDbTableView* networkView = iDatabase->OpenViewMatchingUintLC(TPtrC(IAP), |
|
2993 TPtrC(COMMDB_ID), |
|
2994 iapID); |
|
2995 networkView->GotoFirstRecord(); |
|
2996 TRAPD(leavecode,networkView->ReadUintL(TPtrC(IAP_NETWORK), iISPId)); |
|
2997 CleanupStack::PopAndDestroy(); // networkView |
|
2998 if(leavecode != 0) |
|
2999 { |
|
3000 _DBG_FILE("CNSmlInternetAdapter::FetchLeafObjectL(internal)()(): ENotFound end"); |
|
3001 CleanupStack::PopAndDestroy(pushed); |
|
3002 return CSmlDmAdapter::ENotFound; |
|
3003 } |
|
3004 |
|
3005 CCommsDbTableView* tableView = iDatabase->OpenViewMatchingUintLC(TPtrC(NETWORK), |
|
3006 TPtrC(COMMDB_ID), |
|
3007 iISPId); |
|
3008 |
|
3009 errorCode = tableView->GotoFirstRecord(); |
|
3010 |
|
3011 |
|
3012 if ( errorCode == KErrNone ) |
|
3013 { |
|
3014 TBuf<KCommsDbSvrMaxFieldLength> columnValue; |
|
3015 |
|
3016 tableView->ReadTextL(qColumn, columnValue); |
|
3017 |
|
3018 aObject.InsertL(aObject.Size(),ConvertTo8LC(columnValue)); |
|
3019 pushed++; |
|
3020 } |
|
3021 else |
|
3022 { |
|
3023 CleanupStack::PopAndDestroy(); // tableView |
|
3024 _DBG_FILE("CNSmlInternetAdapter::FetchLeafObjectL(internal)()(): ENotFound end"); |
|
3025 CleanupStack::PopAndDestroy(pushed); |
|
3026 return CSmlDmAdapter::ENotFound; |
|
3027 } |
|
3028 } |
|
3029 else if(aURI.Match(_L8("AP/*/Px/*/Name")) != KErrNotFound || // ProxyName |
|
3030 aURI.Match(_L8("AP/*/Px/*/PxAddr")) != KErrNotFound || // ProxyAddr |
|
3031 aURI.Match(_L8("AP/*/Px/*/DomainL")) != KErrNotFound ) // DomainL (PROXY_PROTOCOL_NAME) |
|
3032 { |
|
3033 CCommsDbTableView* proxyView = iDatabase->OpenViewMatchingUintLC(TPtrC(PROXIES), |
|
3034 TPtrC(COMMDB_ID), |
|
3035 iProxyId); |
|
3036 |
|
3037 errorCode = proxyView->GotoFirstRecord(); |
|
3038 |
|
3039 |
|
3040 if ( errorCode == KErrNone ) |
|
3041 { |
|
3042 if(aURI.Match(_L8("AP/*/Px/*/DomainL"))!= KErrNotFound) |
|
3043 { |
|
3044 TBuf<KCommsDbSvrMaxFieldLength> columnValue; |
|
3045 |
|
3046 proxyView->ReadTextL(TPtrC(PROXY_PROTOCOL_NAME), columnValue); |
|
3047 |
|
3048 aObject.InsertL(aObject.Size(),ConvertTo8LC(columnValue)); |
|
3049 pushed++; |
|
3050 } |
|
3051 |
|
3052 else if(aURI.Match(_L8("AP/*/Px/*/PxAddr"))!= KErrNotFound) |
|
3053 { |
|
3054 HBufC* serverName = proxyView->ReadLongTextLC(TPtrC(PROXY_SERVER_NAME)); |
|
3055 pushed++; |
|
3056 |
|
3057 aObject.InsertL(aObject.Size(),ConvertTo8LC(*serverName)); |
|
3058 pushed++; |
|
3059 } |
|
3060 } |
|
3061 else |
|
3062 { |
|
3063 CleanupStack::PopAndDestroy(); // proxyView |
|
3064 CleanupStack::PopAndDestroy(pushed); |
|
3065 _DBG_FILE("CNSmlInternetAdapter::FetchLeafObjectL(internal)()(): ENotFound end"); |
|
3066 return CSmlDmAdapter::ENotFound; |
|
3067 } |
|
3068 } |
|
3069 else |
|
3070 { |
|
3071 CCommsDbTableView* tableView = iDatabase->OpenViewMatchingUintLC(serviceType, |
|
3072 qDB, |
|
3073 serviceId); |
|
3074 |
|
3075 errorCode = tableView->GotoFirstRecord(); |
|
3076 |
|
3077 |
|
3078 if ( errorCode == KErrNone ) |
|
3079 { |
|
3080 if ( aURI.Find(KNSmlDdfDNSPriority) >= 0) /* DNSPriority */ |
|
3081 { |
|
3082 UriUtils::TUriHostType theType; |
|
3083 TInt dnsPri; |
|
3084 |
|
3085 // This resets iLUID to match aLUID, which is needed in this case. |
|
3086 // Otherwise iLUID has a different value |
|
3087 if(!treeConstructed) |
|
3088 iLUID = IntLUID(aLUID); |
|
3089 |
|
3090 if ( LuidToDns( theType, dnsPri, iLUID ) == KErrNone ) |
|
3091 { |
|
3092 if ( dnsPri == 1 ) |
|
3093 { |
|
3094 aObject.InsertL( aObject.Size(), KNSmlFirstDNSPri ); |
|
3095 } |
|
3096 else |
|
3097 { |
|
3098 aObject.InsertL( aObject.Size(), KNSmlSecondDNSPri ); |
|
3099 } |
|
3100 } |
|
3101 else |
|
3102 { |
|
3103 CleanupStack::PopAndDestroy(tableView); // tableView |
|
3104 CleanupStack::PopAndDestroy(pushed); |
|
3105 _DBG_FILE("CNSmlInternetAdapter::FetchLeafObjectL(internal)()(): ENotFound end"); |
|
3106 return CSmlDmAdapter::ENotFound; |
|
3107 } |
|
3108 } |
|
3109 else if ( aURI.Find(KNSmlDdfDNSAddrTy) >= 0) /* DNSAddrTy */ |
|
3110 { |
|
3111 UriUtils::TUriHostType theType; |
|
3112 TInt dnsPri; |
|
3113 // This resets iLUID to match aLUID, which is needed in this case. |
|
3114 // Otherwise iLUID has a different value |
|
3115 if(!treeConstructed) |
|
3116 iLUID = IntLUID(aLUID); |
|
3117 if ( LuidToDns( theType, dnsPri, iLUID ) == KErrNone ) |
|
3118 { |
|
3119 if ( theType == UriUtils::EIPv4Host) |
|
3120 { |
|
3121 aObject.InsertL( aObject.Size(), KNSmlDNSIp ); |
|
3122 } |
|
3123 else |
|
3124 { |
|
3125 aObject.InsertL( aObject.Size(), KNSmlDNSIp6 ); |
|
3126 } |
|
3127 } |
|
3128 else |
|
3129 { |
|
3130 CleanupStack::PopAndDestroy(tableView); // tableView |
|
3131 CleanupStack::PopAndDestroy(pushed); |
|
3132 _DBG_FILE("CNSmlInternetAdapter::FetchLeafObjectL(internal)()(): ENotFound end"); |
|
3133 return CSmlDmAdapter::ENotFound; |
|
3134 } |
|
3135 } |
|
3136 else |
|
3137 { |
|
3138 TBuf<KCommsDbSvrMaxFieldLength> columnValue; |
|
3139 if ( aURI.Find(KNSmlDdfDNSAddrL ) >= 0) |
|
3140 { |
|
3141 UriUtils::TUriHostType theType; |
|
3142 TInt dnsPri; |
|
3143 |
|
3144 // This resets iLUID to match aLUID, which is needed in this case. |
|
3145 // Otherwise iLUID has a different value |
|
3146 if(!treeConstructed) |
|
3147 iLUID = IntLUID(aLUID); |
|
3148 if ( LuidToDns( theType, dnsPri, iLUID ) == KErrNone ) |
|
3149 { |
|
3150 if ( dnsPri == 1) |
|
3151 { |
|
3152 if ( theType == UriUtils::EIPv4Host ) |
|
3153 { |
|
3154 qColumn.Set( TPtrC(SERVICE_IP_NAME_SERVER1 )); |
|
3155 } |
|
3156 else |
|
3157 { |
|
3158 qColumn.Set( TPtrC(SERVICE_IP6_NAME_SERVER1 )); |
|
3159 |
|
3160 } |
|
3161 } |
|
3162 else |
|
3163 { |
|
3164 if ( theType == UriUtils::EIPv4Host ) |
|
3165 { |
|
3166 qColumn.Set( TPtrC(SERVICE_IP_NAME_SERVER2 )); |
|
3167 } |
|
3168 else |
|
3169 { |
|
3170 qColumn.Set( TPtrC(SERVICE_IP6_NAME_SERVER2 )); |
|
3171 |
|
3172 } |
|
3173 } |
|
3174 } |
|
3175 else |
|
3176 { |
|
3177 CleanupStack::PopAndDestroy(tableView); // tableView |
|
3178 CleanupStack::PopAndDestroy(pushed); |
|
3179 _DBG_FILE("CNSmlInternetAdapter::FetchLeafObjectL(internal)()(): ENotFound end"); |
|
3180 return CSmlDmAdapter::ENotFound; |
|
3181 } |
|
3182 } |
|
3183 TRAPD(leavecode,tableView->ReadTextL(qColumn, columnValue)); |
|
3184 if(leavecode != 0) |
|
3185 { |
|
3186 CleanupStack::PopAndDestroy(); // tableView |
|
3187 CleanupStack::PopAndDestroy(pushed); |
|
3188 _DBG_FILE("CNSmlInternetAdapter::FetchLeafObjectL(internal)()(): ENotFound end"); |
|
3189 return CSmlDmAdapter::ENotFound; |
|
3190 } |
|
3191 aObject.InsertL(aObject.Size(),ConvertTo8LC(columnValue)); |
|
3192 pushed++; |
|
3193 } |
|
3194 } |
|
3195 else |
|
3196 { |
|
3197 CleanupStack::PopAndDestroy(); // tableView |
|
3198 CleanupStack::PopAndDestroy(pushed); |
|
3199 _DBG_FILE("CNSmlInternetAdapter::FetchLeafObjectL(internal)()(): ENotFound end"); |
|
3200 return CSmlDmAdapter::ENotFound; |
|
3201 } |
|
3202 } |
|
3203 CleanupStack::PopAndDestroy(); // tableView |
|
3204 } |
|
3205 else if (fType == CNSmlInternetAdapter::EBool) |
|
3206 { // UseCB |
|
3207 CCommsDbTableView* boolView = iDatabase->OpenViewMatchingUintLC(serviceType, |
|
3208 qDB, |
|
3209 serviceId); |
|
3210 |
|
3211 errorCode = boolView->GotoFirstRecord(); |
|
3212 |
|
3213 TBool objectBool = EFalse; |
|
3214 if ( errorCode == KErrNone ) |
|
3215 { |
|
3216 TRAPD(leavecode,boolView->ReadBoolL(qColumn,objectBool )); |
|
3217 if(leavecode == KErrUnknown ) // value is null |
|
3218 { |
|
3219 } |
|
3220 } |
|
3221 else |
|
3222 { |
|
3223 CleanupStack::PopAndDestroy(); // boolView |
|
3224 CleanupStack::PopAndDestroy(pushed); |
|
3225 _DBG_FILE("CNSmlInternetAdapter::FetchLeafObjectL(internal)()(): EError end"); |
|
3226 return CSmlDmAdapter::EError; |
|
3227 } |
|
3228 |
|
3229 if (objectBool) |
|
3230 { |
|
3231 aObject.InsertL(aObject.Size(),KNSmlDmApValTrue); |
|
3232 } |
|
3233 else |
|
3234 { |
|
3235 aObject.InsertL(aObject.Size(),KNSmlDmApValFalse); |
|
3236 } |
|
3237 |
|
3238 CleanupStack::PopAndDestroy(); // boolView |
|
3239 } |
|
3240 else if (fType == CNSmlInternetAdapter::EInt) |
|
3241 { // NAPId +Bearer + NAPAddrTy + PxID + PortNbr + UsePTxtLog |
|
3242 // CBTy + LnkSpeed |
|
3243 |
|
3244 if(aURI.Match(_L8("AP/*/Px/*/PxID"))!= KErrNotFound ) |
|
3245 { |
|
3246 aObject.InsertL(aObject.Size(),SetIntObjectLC(iISPId)); |
|
3247 pushed++; |
|
3248 } |
|
3249 |
|
3250 else if (aURI.Find(KNSmlDdfIAPSeamlessness) >= 0 ) /* Seamlessness handling */ |
|
3251 { |
|
3252 TInt seam = GetIAPSeamlessnessL(iapID); |
|
3253 aObject.InsertL(aObject.Size(),SetIntObjectLC(seam)); |
|
3254 pushed++; |
|
3255 } |
|
3256 else if(aURI.Find(KNSmlDdfIAPMetaData) >= 0) |
|
3257 { |
|
3258 TInt meta = GetIAPMetaDataL(iapID); |
|
3259 aObject.InsertL(aObject.Size(),SetIntObjectLC(meta)); |
|
3260 pushed++; |
|
3261 } |
|
3262 |
|
3263 else if(aURI.Match(_L8("AP/*/Networks/*/ID"))!= KErrNotFound ) |
|
3264 { |
|
3265 |
|
3266 iISPId= IntLUID(aLUID); |
|
3267 |
|
3268 CCommsDbTableView* nwidView = iDatabase->OpenViewMatchingUintLC(TPtrC(IAP), |
|
3269 TPtrC(COMMDB_ID), |
|
3270 iISPId); |
|
3271 nwidView->GotoFirstRecord(); |
|
3272 nwidView->ReadUintL(TPtrC(IAP_NETWORK), iISPId); |
|
3273 CleanupStack::PopAndDestroy(); // nwidView |
|
3274 |
|
3275 aObject.InsertL(aObject.Size(),SetIntObjectLC(iISPId)); |
|
3276 pushed++; |
|
3277 } |
|
3278 else if(aURI.Match(_L8("AP/*/Px/*/PortNbr"))!= KErrNotFound ) |
|
3279 { |
|
3280 _DBG_FILE("CNSmlInternetAdapter::FetchLeafObjectL(internal)()(): PortNbr"); |
|
3281 DBG_ARGS8(_S8("iISPId = %d "), iISPId ); |
|
3282 DBG_ARGS8(_S8("proxyid = %d "), iProxyId ); |
|
3283 CCommsDbTableView* portView = iDatabase->OpenViewMatchingUintLC(TPtrC(PROXIES), |
|
3284 TPtrC(COMMDB_ID), |
|
3285 iProxyId); |
|
3286 |
|
3287 errorCode = portView->GotoFirstRecord(); |
|
3288 |
|
3289 |
|
3290 if ( errorCode == KErrNone ) |
|
3291 { |
|
3292 _DBG_FILE("CNSmlInternetAdapter::FetchLeafObjectL(internal)()(): Portview opened"); |
|
3293 TUint32 object32=0; |
|
3294 |
|
3295 TRAPD(leavecode,portView->ReadUintL(qColumn,object32 )); |
|
3296 if(leavecode == KErrNone) |
|
3297 { |
|
3298 aObject.InsertL(aObject.Size(),SetIntObjectLC(object32)); |
|
3299 pushed++; |
|
3300 } |
|
3301 else |
|
3302 { |
|
3303 _DBG_FILE("CNSmlInternetAdapter::FetchLeafObjectL(internal)()(): db read failed"); |
|
3304 CleanupStack::PopAndDestroy(); // portView |
|
3305 CleanupStack::PopAndDestroy(pushed); |
|
3306 _DBG_FILE("CNSmlInternetAdapter::FetchLeafObjectL(internal)()(): EError end"); |
|
3307 return CSmlDmAdapter::EError; |
|
3308 } |
|
3309 } |
|
3310 else |
|
3311 { |
|
3312 _DBG_FILE("CNSmlInternetAdapter::FetchLeafObjectL(internal)()(): Portview opening failed"); |
|
3313 CleanupStack::PopAndDestroy(); // portView |
|
3314 CleanupStack::PopAndDestroy(pushed); |
|
3315 _DBG_FILE("CNSmlInternetAdapter::FetchLeafObjectL(internal)()(): ENotFound end"); |
|
3316 return CSmlDmAdapter::ENotFound; |
|
3317 } |
|
3318 CleanupStack::PopAndDestroy(); // portView |
|
3319 } |
|
3320 else if(aURI.Match(_L8("AP/*/NAPID"))!= KErrNotFound || |
|
3321 aURI.Match(_L8("AP/*/ToNAPIDL"))!= KErrNotFound ) |
|
3322 { |
|
3323 iObject = iapID; |
|
3324 TPtrC8 napidUri = FirstURISeg(aURI); |
|
3325 aObject.InsertL(aObject.Size(),napidUri); |
|
3326 |
|
3327 } |
|
3328 else |
|
3329 { |
|
3330 iObject = 0; |
|
3331 |
|
3332 CCommsDbTableView* colView = iDatabase->OpenViewMatchingUintLC(serviceType, |
|
3333 qDB, |
|
3334 serviceId); |
|
3335 |
|
3336 errorCode = colView->GotoFirstRecord(); |
|
3337 |
|
3338 TUint32 object32 = 0; |
|
3339 if ( errorCode == KErrNone ) |
|
3340 { |
|
3341 if(aURI.Find(KNSmlDdfUsePTxtLog) >= 0) |
|
3342 { |
|
3343 TBool objectBool = EFalse; |
|
3344 TRAPD(leavecode,colView->ReadBoolL(qColumn,objectBool )); |
|
3345 errorCode = leavecode; |
|
3346 object32 = objectBool; |
|
3347 } |
|
3348 else |
|
3349 { |
|
3350 TRAPD(leavecode,colView->ReadUintL(qColumn,object32 )); |
|
3351 errorCode = leavecode; |
|
3352 } |
|
3353 } |
|
3354 |
|
3355 if ( errorCode == KErrNone ) |
|
3356 { |
|
3357 |
|
3358 if (aURI.Find(KNSmlDdfNAPAddrTy) >= 0 || /* NAPAddrTy handling */ |
|
3359 aURI.Find(KNSmlDdfGPRSPDP) >= 0) /* NAPAddrTy handling */ |
|
3360 { |
|
3361 if(object32 == RPacketContext::EPdpTypeIPv4) |
|
3362 { |
|
3363 aObject.InsertL(aObject.Size(),KNSmlDmApValIpv4); |
|
3364 } |
|
3365 else if (object32 == RPacketContext::EPdpTypeIPv6) |
|
3366 { |
|
3367 aObject.InsertL(aObject.Size(), KNSmlDmApValIpv6); |
|
3368 } |
|
3369 else if (object32 == RPacketContext::EPdpTypePPP) |
|
3370 { |
|
3371 _LIT8( KPpp, "PPP" ); |
|
3372 aObject.InsertL(aObject.Size(),KPpp); |
|
3373 } |
|
3374 else |
|
3375 { |
|
3376 aObject.InsertL(aObject.Size(),KNullDesC8); |
|
3377 } |
|
3378 } |
|
3379 else |
|
3380 { |
|
3381 aObject.InsertL(aObject.Size(),SetIntObjectLC(object32)); |
|
3382 pushed++; |
|
3383 } |
|
3384 } |
|
3385 else |
|
3386 { |
|
3387 CleanupStack::PopAndDestroy(); // colView |
|
3388 CleanupStack::PopAndDestroy(pushed); |
|
3389 _DBG_FILE("CNSmlInternetAdapter::FetchLeafObjectL(internal)()(): ENotFound end"); |
|
3390 return CSmlDmAdapter::ENotFound; |
|
3391 } |
|
3392 CleanupStack::PopAndDestroy(); // colView |
|
3393 } |
|
3394 } |
|
3395 |
|
3396 else if (fType == CNSmlInternetAdapter::EWap) |
|
3397 { // Startpg + PxAuthId + PxAuthPW + PortNbr (BasAuthId + BasAuthPW) |
|
3398 CCommsDbTableView* wapView = iDatabase->OpenViewMatchingUintLC(TPtrC(WAP_IP_BEARER), |
|
3399 TPtrC(WAP_IAP), |
|
3400 iapID); |
|
3401 |
|
3402 errorCode = wapView->GotoFirstRecord(); |
|
3403 |
|
3404 if ( errorCode == KErrNone ) |
|
3405 { |
|
3406 TBuf<KCommsDbSvrMaxFieldLength> columnValue; |
|
3407 |
|
3408 if(qColumn == TPtrC(WAP_START_PAGE)) |
|
3409 { |
|
3410 TRAPD(leavecode,wapView->ReadUintL(TPtrC(WAP_ACCESS_POINT_ID), iWapId)); |
|
3411 CleanupStack::PopAndDestroy(); // wapView |
|
3412 if(leavecode != KErrNone) |
|
3413 { |
|
3414 CleanupStack::PopAndDestroy(pushed); |
|
3415 _DBG_FILE("CNSmlInternetAdapter::FetchLeafObjectL(internal)()(): EError end"); |
|
3416 return CSmlDmAdapter::EError; |
|
3417 |
|
3418 } |
|
3419 |
|
3420 CCommsDbTableView* wapView2 = iDatabase->OpenViewMatchingUintLC(TPtrC(WAP_ACCESS_POINT), |
|
3421 TPtrC(COMMDB_ID), |
|
3422 iWapId); |
|
3423 |
|
3424 errorCode = wapView2->GotoFirstRecord(); |
|
3425 if ( errorCode != KErrNone ) |
|
3426 { |
|
3427 CleanupStack::PopAndDestroy(); // wapView2 |
|
3428 CleanupStack::PopAndDestroy(pushed); |
|
3429 _DBG_FILE("CNSmlInternetAdapter::FetchLeafObjectL(internal)()(): ENotFound end"); |
|
3430 return CSmlDmAdapter::ENotFound; |
|
3431 } |
|
3432 |
|
3433 HBufC* tmpVal = wapView2->ReadLongTextLC( qColumn ); |
|
3434 |
|
3435 aObject.InsertL(aObject.Size(),ConvertTo8LC(tmpVal->Des())); |
|
3436 CleanupStack::PopAndDestroy(); // ReadLongTextLC |
|
3437 CleanupStack::PopAndDestroy(); // wapView2 |
|
3438 pushed++; |
|
3439 } |
|
3440 else |
|
3441 { |
|
3442 if(qColumn == TPtrC(WAP_PROXY_PORT)) |
|
3443 { |
|
3444 TUint32 object32; |
|
3445 wapView->ReadUintL(qColumn, object32); |
|
3446 if(object32 == KWAPP_PORT_9200) // wappdef.h |
|
3447 { |
|
3448 aObject.InsertL(aObject.Size(),ConvertTo8LC(KWappPort9200)); |
|
3449 } |
|
3450 else if(object32 == KWAPP_PORT_9201) |
|
3451 { |
|
3452 aObject.InsertL(aObject.Size(),ConvertTo8LC(KWappPort9201)); |
|
3453 } |
|
3454 else if(object32 == KWAPP_PORT_9202) |
|
3455 { |
|
3456 aObject.InsertL(aObject.Size(),ConvertTo8LC(KWappPort9202)); |
|
3457 } |
|
3458 else if(object32 == KWAPP_PORT_9203) |
|
3459 { |
|
3460 aObject.InsertL(aObject.Size(),ConvertTo8LC(KWappPort9203)); |
|
3461 } |
|
3462 else |
|
3463 { |
|
3464 CleanupStack::PopAndDestroy(); // wapView |
|
3465 CleanupStack::PopAndDestroy(pushed); |
|
3466 _DBG_FILE("CNSmlInternetAdapter::FetchLeafObjectL(internal)()(): ENotFound end"); |
|
3467 return CSmlDmAdapter::ENotFound; |
|
3468 } |
|
3469 |
|
3470 pushed++; |
|
3471 } |
|
3472 else |
|
3473 { |
|
3474 wapView->ReadTextL(qColumn, columnValue); |
|
3475 aObject.InsertL(aObject.Size(),ConvertTo8LC(columnValue)); |
|
3476 pushed++; |
|
3477 } |
|
3478 CleanupStack::PopAndDestroy(); // wapView |
|
3479 } |
|
3480 } |
|
3481 else |
|
3482 { |
|
3483 CleanupStack::PopAndDestroy(); // wapView |
|
3484 CleanupStack::PopAndDestroy(pushed); |
|
3485 _DBG_FILE("CNSmlInternetAdapter::FetchLeafObjectL(internal)()(): ENotFound end"); |
|
3486 return CSmlDmAdapter::ENotFound; |
|
3487 } |
|
3488 } |
|
3489 else if (fType == CNSmlInternetAdapter::ESpec) |
|
3490 { |
|
3491 // name |
|
3492 if ( aURI.Find( KNSmlDdfNAPName ) >= 0 ) |
|
3493 { |
|
3494 TUint32 iapID10 = IntLUID(aLUID); |
|
3495 /* CCommsDbTableView* tableView = iDatabase->OpenViewMatchingUintLC(serviceType, |
|
3496 qDB, |
|
3497 serviceId);*/ |
|
3498 CCommsDbTableView* tableView = iDatabase->OpenViewMatchingUintLC(TPtrC(IAP), |
|
3499 TPtrC(COMMDB_ID), |
|
3500 iapID); |
|
3501 |
|
3502 errorCode = tableView->GotoFirstRecord(); |
|
3503 |
|
3504 if ( errorCode == KErrNone ) |
|
3505 { |
|
3506 TBuf<KCommsDbSvrMaxFieldLength> columnValue; |
|
3507 TRAPD(leavecode,tableView->ReadTextL(TPtrC(COMMDB_NAME ), columnValue)); |
|
3508 if(leavecode != 0) |
|
3509 { |
|
3510 CleanupStack::PopAndDestroy(); // tableView |
|
3511 CleanupStack::PopAndDestroy(pushed); |
|
3512 _DBG_FILE("CNSmlInternetAdapter::FetchLeafObjectL(internal)()(): ENotFound end"); |
|
3513 return CSmlDmAdapter::ENotFound; |
|
3514 } |
|
3515 aObject.InsertL(aObject.Size(),ConvertTo8LC(columnValue)); |
|
3516 pushed++; |
|
3517 } |
|
3518 CleanupStack::PopAndDestroy(); // tableView |
|
3519 CleanupStack::PopAndDestroy(pushed); |
|
3520 return CSmlDmAdapter::EOk; |
|
3521 } |
|
3522 // BearerL + NoPxForL + IAPService |
|
3523 else if (aURI.Find(KNSmlDdfIAPService) >= 0) |
|
3524 { |
|
3525 aObject.InsertL(aObject.Size(),SetIntObjectLC(serviceId)); |
|
3526 pushed++; |
|
3527 _DBG_FILE("CNSmlInternetAdapter::FetchLeafObjectL(internal)()(): EOk end"); |
|
3528 CleanupStack::PopAndDestroy(pushed); |
|
3529 return CSmlDmAdapter::EOk; |
|
3530 } |
|
3531 else if (aURI.Find(KNSmlDdfNoPxForL) >= 0) /* No proxies used handling */ |
|
3532 { |
|
3533 TBool proxyFound = GetProxyIdL(aURI); |
|
3534 if(!proxyFound) |
|
3535 { |
|
3536 _DBG_FILE("CNSmlInternetAdapter::FetchLeafObjectL(internal)()(): ENotFound end"); |
|
3537 CleanupStack::PopAndDestroy(pushed); |
|
3538 return CSmlDmAdapter::ENotFound; |
|
3539 } |
|
3540 |
|
3541 CCommsDbTableView* exeptionView = iDatabase->OpenViewMatchingUintLC(TPtrC(PROXIES), |
|
3542 TPtrC(COMMDB_ID), |
|
3543 iProxyId); |
|
3544 errorCode = exeptionView->GotoFirstRecord(); |
|
3545 |
|
3546 if ( errorCode == KErrNone ) |
|
3547 { |
|
3548 HBufC* proxyExceptions = exeptionView->ReadLongTextLC(TPtrC(PROXY_EXCEPTIONS)); |
|
3549 pushed++; |
|
3550 |
|
3551 aObject.InsertL(aObject.Size(),ConvertTo8LC(*proxyExceptions)); |
|
3552 pushed++; |
|
3553 } |
|
3554 else |
|
3555 { |
|
3556 _DBG_FILE("CNSmlInternetAdapter::FetchLeafObjectL(internal)()(): ENotFound end"); |
|
3557 CleanupStack::PopAndDestroy(pushed); |
|
3558 return CSmlDmAdapter::ENotFound; |
|
3559 } |
|
3560 CleanupStack::PopAndDestroy(); // exeptionView |
|
3561 |
|
3562 _DBG_FILE("CNSmlInternetAdapter::FetchLeafObjectL(internal)()(): EOk end"); |
|
3563 CleanupStack::PopAndDestroy(pushed); |
|
3564 return CSmlDmAdapter::EOk; |
|
3565 } |
|
3566 |
|
3567 if(aURI.Find(KNSmlDdfDirection) >= 0) |
|
3568 { |
|
3569 if (serviceType == TPtrC(OUTGOING_GPRS)) |
|
3570 { |
|
3571 aObject.InsertL(aObject.Size(),KNSmlDmApValOutgoing); |
|
3572 } |
|
3573 else if (serviceType == TPtrC(INCOMING_GPRS)) |
|
3574 { |
|
3575 aObject.InsertL(aObject.Size(),KNSmlDmApValIncoming); |
|
3576 } |
|
3577 else if (serviceType == TPtrC(LAN_SERVICE)) // Wlan ADD |
|
3578 { |
|
3579 aObject.InsertL(aObject.Size(),KNSmlDmApValOutgoing); |
|
3580 } |
|
3581 else if (serviceType == TPtrC(VPN_SERVICE)) |
|
3582 { |
|
3583 aObject.InsertL(aObject.Size(),KNSmlDmApValOutgoing); |
|
3584 } |
|
3585 else |
|
3586 { |
|
3587 _LIT8( KDirectionUnk, "DirectionUnknown"); |
|
3588 aObject.InsertL(aObject.Size(),KDirectionUnk); |
|
3589 } |
|
3590 } |
|
3591 else |
|
3592 { |
|
3593 if (serviceType == TPtrC(OUTGOING_GPRS) || |
|
3594 serviceType == TPtrC(INCOMING_GPRS)) |
|
3595 { |
|
3596 if (i3GPPPS) |
|
3597 { |
|
3598 aObject.InsertL(aObject.Size(),KNSmlDmApVal3Gppps); |
|
3599 i3GPPPS = EFalse; |
|
3600 } |
|
3601 else |
|
3602 { |
|
3603 aObject.InsertL(aObject.Size(),KNSmlDmApValGsmGprs); |
|
3604 } |
|
3605 |
|
3606 } |
|
3607 |
|
3608 else if (serviceType == TPtrC(OUTGOING_GPRS) || |
|
3609 serviceType == TPtrC(INCOMING_GPRS)) |
|
3610 { |
|
3611 if (i3GPPPS) |
|
3612 { |
|
3613 aObject.InsertL(aObject.Size(),KNSmlDmApVal3Gppps); |
|
3614 i3GPPPS = EFalse; |
|
3615 } |
|
3616 else |
|
3617 { |
|
3618 aObject.InsertL(aObject.Size(),KNSmlDmApValGsmGprs); |
|
3619 } |
|
3620 |
|
3621 } |
|
3622 else if (serviceType == TPtrC(VPN_SERVICE)) |
|
3623 { |
|
3624 aObject.InsertL(aObject.Size(),KNSmlDmApValVpn); |
|
3625 } |
|
3626 |
|
3627 else if ( ( serviceType == TPtrC(LAN_SERVICE) && iWlanSupported ) ) |
|
3628 { |
|
3629 aObject.InsertL(aObject.Size(),KNSmlDmApValWlan); |
|
3630 } |
|
3631 else |
|
3632 { |
|
3633 _LIT8( KUnkBearer, "Unknown Bearer"); |
|
3634 aObject.InsertL(aObject.Size(),KUnkBearer); |
|
3635 } |
|
3636 } |
|
3637 } |
|
3638 else |
|
3639 { |
|
3640 _DBG_FILE("CNSmlInternetAdapter::FetchLeafObjectL(internal)(): ENotFound end"); |
|
3641 CleanupStack::PopAndDestroy(pushed); |
|
3642 return CSmlDmAdapter::ENotFound; |
|
3643 } |
|
3644 |
|
3645 _DBG_FILE("CNSmlInternetAdapter::FetchLeafObjectL(internal)(): end"); |
|
3646 CleanupStack::PopAndDestroy(pushed); |
|
3647 return CSmlDmAdapter::EOk; |
|
3648 |
|
3649 } |
|
3650 |
|
3651 //------------------------------------------------------------------------------ |
|
3652 // CSmlDmAdapter::ChildURIListL() |
|
3653 //------------------------------------------------------------------------------ |
|
3654 void CNSmlInternetAdapter::ChildURIListL( const TDesC8& aURI, |
|
3655 const TDesC8& aLUID, |
|
3656 const CArrayFix<TSmlDmMappingInfo>& aPreviousURISegmentList, |
|
3657 const TInt aResultsRef, |
|
3658 const TInt aStatusRef ) |
|
3659 { |
|
3660 _DBG_FILE("CNSmlInternetAdapter::ChildURIListL(): begin"); |
|
3661 DBG_ARGS8(_S8("AP:ChildURIListL URI - <%S> <%S>"), &aURI, &aLUID ); |
|
3662 |
|
3663 CBufBase* currentURISegmentList = CBufFlat::NewL(128); |
|
3664 CleanupStack::PushL(currentURISegmentList); |
|
3665 |
|
3666 TUint32 checkLUID = IntLUID(aLUID); |
|
3667 |
|
3668 // If this is command to proxy node we'll need to make sure that |
|
3669 // the LUID is for proxy node and not AP node. |
|
3670 // If this command comes to predefined AP node then |
|
3671 // the LUID passed is inherited from that node and is not |
|
3672 // proper proxy node. |
|
3673 if ( aURI.Match(_L8("AP/*/Px/*" ))!= KErrNotFound ) |
|
3674 { |
|
3675 TLex8 lex(aLUID); |
|
3676 TUint tempLUID; |
|
3677 if ( !((lex.Val( tempLUID ) == KErrNone ) |
|
3678 && ( tempLUID > KNSmlApProxyLowerBase ) |
|
3679 && ( tempLUID < KNSmlApProxyUpperBase )) ) |
|
3680 { |
|
3681 // Non-proxy LUID |
|
3682 checkLUID = 0; |
|
3683 } |
|
3684 } |
|
3685 |
|
3686 // Fetch all data for child |
|
3687 if ( !checkLUID |
|
3688 && ( !IsWLANfield( aURI ) || !iWlanSupported ) ) |
|
3689 { |
|
3690 if(aURI.Match(KNSmlDdfAP)== KErrNotFound) // Not for AP |
|
3691 { |
|
3692 CleanupStack::PopAndDestroy(); // currentURISegmentList |
|
3693 iCallBack->SetStatusL(aStatusRef,CSmlDmAdapter::ENotFound); |
|
3694 _DBG_FILE("CNSmlInternetAdapter::ChildURIListL(): ENotFound end"); |
|
3695 return; |
|
3696 } |
|
3697 } |
|
3698 |
|
3699 TUint32 apId = GetAPIdFromURIL( aURI ); |
|
3700 |
|
3701 if( aURI.Match( _L8("AP/*") ) != KErrNotFound && |
|
3702 !APExistsL( apId ) ) |
|
3703 { |
|
3704 if ( aLUID.Length() > 0 ) |
|
3705 { |
|
3706 // Stale data, remove mapping. |
|
3707 TInt ret = iCallBack->RemoveMappingL( KNSmlInternetAdapterImplUid, |
|
3708 GetDynamicAPNodeUri( aURI ), ETrue ); |
|
3709 } |
|
3710 |
|
3711 iCallBack->SetStatusL( aStatusRef, CSmlDmAdapter::ENotFound ); |
|
3712 CleanupStack::PopAndDestroy(); // currentURISegmentList |
|
3713 _DBG_FILE("CNSmlInternetAdapter::ChildURIListL(): AP doesn't exist: ENotFound end"); |
|
3714 return; |
|
3715 } |
|
3716 |
|
3717 if( aURI.Match(_L8("AP/*" ))!= KErrNotFound && |
|
3718 aURI.Match(_L8("AP/*/*"))== KErrNotFound ) |
|
3719 { |
|
3720 // Check if AP exists |
|
3721 if(!APExistsL(checkLUID)) |
|
3722 { |
|
3723 iCallBack->SetStatusL(aStatusRef,CSmlDmAdapter::ENotFound); |
|
3724 CleanupStack::PopAndDestroy(); // currentURISegmentList |
|
3725 _DBG_FILE("CNSmlInternetAdapter::ChildURIListL(): ENotFound end"); |
|
3726 return; |
|
3727 } |
|
3728 currentURISegmentList->InsertL( 0, KNSmlAPnode); |
|
3729 iCallBack->SetStatusL(aStatusRef,CSmlDmAdapter::EOk); |
|
3730 iCallBack->SetResultsL(aResultsRef,*currentURISegmentList,KNullDesC8); |
|
3731 CleanupStack::PopAndDestroy(); // currentURISegmentList |
|
3732 _DBG_FILE("CNSmlInternetAdapter::ChildURIListL(): end"); |
|
3733 return; |
|
3734 } |
|
3735 |
|
3736 // Check that queried proxy exists |
|
3737 if (aURI.Match(_L8("AP/*/Px/*" ))!= KErrNotFound && |
|
3738 !PxExistsL(checkLUID)) |
|
3739 { |
|
3740 iCallBack->SetStatusL(aStatusRef,CSmlDmAdapter::ENotFound); |
|
3741 CleanupStack::PopAndDestroy(); // currentURISegmentList |
|
3742 _DBG_FILE("CNSmlInternetAdapter::ChildURIListL(): ENotFound end"); |
|
3743 return; |
|
3744 } |
|
3745 |
|
3746 if (aURI.Match(_L8("AP/*/Px/*" ))!= KErrNotFound && |
|
3747 aURI.Match(_L8("AP/*/Px/*/*"))== KErrNotFound ) |
|
3748 { |
|
3749 // Check if PX exists |
|
3750 if(!PxExistsL(checkLUID)) |
|
3751 { |
|
3752 // Only WAP-data |
|
3753 iCallBack->SetStatusL(aStatusRef,CSmlDmAdapter::ENotFound); |
|
3754 CleanupStack::PopAndDestroy(); // currentURISegmentList |
|
3755 _DBG_FILE("CNSmlInternetAdapter::ChildURIListL(): ENotFound end"); |
|
3756 return; |
|
3757 } |
|
3758 // List all Px |
|
3759 currentURISegmentList->InsertL( 0, KNSmlPxnode ); |
|
3760 iCallBack->SetStatusL(aStatusRef,CSmlDmAdapter::EOk); |
|
3761 iCallBack->SetResultsL(aResultsRef,*currentURISegmentList,KNullDesC8); |
|
3762 CleanupStack::PopAndDestroy(); // currentURISegmentList |
|
3763 _DBG_FILE("CNSmlInternetAdapter::ChildURIListL(): OK end"); |
|
3764 return; |
|
3765 } |
|
3766 |
|
3767 if (aURI.Match(_L8("AP/*/NAPDef/*" ))!= KErrNotFound && |
|
3768 aURI.Match(_L8("AP/*/NAPDef/*/*"))== KErrNotFound ) |
|
3769 { |
|
3770 // Check if IAP has luid mapped |
|
3771 HBufC8* iapIdBuf = iCallBack->GetLuidAllocL(RemoveLastSeg(aURI)); |
|
3772 TInt iapIdInt = GetIntObject8(iapIdBuf->Des()); |
|
3773 |
|
3774 delete iapIdBuf; |
|
3775 iapIdBuf = NULL; |
|
3776 |
|
3777 if ( iapIdInt > 0 ) |
|
3778 { |
|
3779 CCommsDbTableView* iapView = iDatabase->OpenViewMatchingUintLC( |
|
3780 TPtrC(IAP),TPtrC(COMMDB_ID), iapIdInt); |
|
3781 TInt error = iapView->GotoFirstRecord(); |
|
3782 TBuf<KCommsDbSvrMaxFieldLength> serviceType; |
|
3783 if (error == KErrNone) |
|
3784 { |
|
3785 iapView->ReadTextL(TPtrC(IAP_SERVICE_TYPE), serviceType); |
|
3786 } |
|
3787 CleanupStack::PopAndDestroy( iapView ); |
|
3788 |
|
3789 // Check if NAPDef exists |
|
3790 if(!NAPDefExistsL(checkLUID)) |
|
3791 { |
|
3792 iCallBack->SetStatusL(aStatusRef,CSmlDmAdapter::ENotFound); |
|
3793 CleanupStack::PopAndDestroy(); // currentURISegmentList |
|
3794 _DBG_FILE("CNSmlInternetAdapter::ChildURIListL(): ENotFound end"); |
|
3795 return; |
|
3796 } |
|
3797 // List all NAPDef |
|
3798 if(IsWlanL(aURI) && iWlanSupported ) |
|
3799 { |
|
3800 iWlanAdapter->ChildURIListL(aURI,aLUID,aPreviousURISegmentList,aResultsRef,aStatusRef); |
|
3801 CleanupStack::PopAndDestroy(); // currentURISegmentList |
|
3802 _DBG_FILE("CNSmlInternetAdapter::ChildURIListL(): WLAN end"); |
|
3803 return; |
|
3804 } |
|
3805 _LIT( KGprs, "*GPRS*"); |
|
3806 _LIT( K3gppps, "*3GPPPS*"); |
|
3807 if ( serviceType.Match(KGprs) != KErrNotFound || |
|
3808 serviceType.Match(K3gppps) != KErrNotFound) |
|
3809 { |
|
3810 currentURISegmentList->InsertL( 0 ,KNSmlNAPDefGPRSnode); |
|
3811 } |
|
3812 |
|
3813 #ifdef __SYNCML_DM_LSCRIPT |
|
3814 currentURISegmentList->InsertL(currentURISegmentList->Size(),KNSmlLoginscriptnode); |
|
3815 #endif |
|
3816 |
|
3817 iCallBack->SetStatusL(aStatusRef,CSmlDmAdapter::EOk); |
|
3818 iCallBack->SetResultsL(aResultsRef,*currentURISegmentList,KNullDesC8); |
|
3819 } |
|
3820 else |
|
3821 { |
|
3822 iCallBack->SetStatusL(aStatusRef,CSmlDmAdapter::EError); |
|
3823 } |
|
3824 CleanupStack::PopAndDestroy(); // currentURISegmentList |
|
3825 _DBG_FILE("CNSmlInternetAdapter::ChildURIListL(): end"); |
|
3826 return; |
|
3827 } |
|
3828 |
|
3829 |
|
3830 if ( ( aURI.Match(_L8("AP/*/WLAN")) != KErrNotFound |
|
3831 || aURI.Match(_L8("AP/*/WLAN/*"))!= KErrNotFound ) |
|
3832 && iWlanSupported ) |
|
3833 { |
|
3834 iWlanAdapter->ChildURIListL(aURI,aLUID,aPreviousURISegmentList,aResultsRef,aStatusRef); |
|
3835 CleanupStack::PopAndDestroy(); // currentURISegmentList |
|
3836 _DBG_FILE("CNSmlInternetAdapter::ChildURIListL(): WLAN end"); |
|
3837 return; |
|
3838 } |
|
3839 // |
|
3840 // Get all AP numbers from IAP-table |
|
3841 // |
|
3842 if (aURI.Match(KNSmlDdfAP)!= KErrNotFound) |
|
3843 { |
|
3844 TBool inDatabase = EFalse; |
|
3845 |
|
3846 CCommsDbTableView* apView = iDatabase->OpenTableLC(TPtrC(IAP)); |
|
3847 |
|
3848 TInt errorCode = apView->GotoFirstRecord(); |
|
3849 |
|
3850 while ( errorCode == KErrNone ) |
|
3851 { |
|
3852 TUint32 lValue; |
|
3853 TBool validService = EFalse; |
|
3854 TInt lLine(0); |
|
3855 apView->ReadUintL(TPtrC(COMMDB_ID),lValue); |
|
3856 |
|
3857 TBuf<KCommsDbSvrMaxFieldLength> serviceType; |
|
3858 apView->ReadTextL(TPtrC(IAP_SERVICE_TYPE), serviceType); |
|
3859 TUint32 bearerId = 0; |
|
3860 apView->ReadUintL(TPtrC(IAP_BEARER),bearerId); |
|
3861 // |
|
3862 // Skip other service types than GSM outgoing |
|
3863 // |
|
3864 if (serviceType == TPtrC(OUTGOING_GPRS) || |
|
3865 serviceType == TPtrC(INCOMING_GPRS)) |
|
3866 { |
|
3867 validService = ETrue; |
|
3868 } |
|
3869 |
|
3870 else if(serviceType == TPtrC(LAN_SERVICE) && |
|
3871 bearerId > 1) |
|
3872 { |
|
3873 validService = ETrue; |
|
3874 } |
|
3875 else if(serviceType == TPtrC(VPN_SERVICE)) |
|
3876 { |
|
3877 validService = ETrue; |
|
3878 } |
|
3879 else if( ( serviceType == TPtrC(LAN_SERVICE) ) && iWlanSupported ) |
|
3880 { |
|
3881 validService = ETrue; |
|
3882 } |
|
3883 |
|
3884 if(validService) |
|
3885 { |
|
3886 // Skip others |
|
3887 // |
|
3888 // Check if in aPreviousURISegmentList |
|
3889 // |
|
3890 while(!inDatabase && lLine < aPreviousURISegmentList.Count()) |
|
3891 { |
|
3892 TUint32 list = GetIntObject8(aPreviousURISegmentList.At(lLine).iURISegLUID); |
|
3893 if(list == lValue) |
|
3894 { |
|
3895 inDatabase = ETrue; |
|
3896 } |
|
3897 else |
|
3898 { |
|
3899 lLine++; |
|
3900 } |
|
3901 } |
|
3902 |
|
3903 if(inDatabase) |
|
3904 { |
|
3905 currentURISegmentList->InsertL(currentURISegmentList->Size(),aPreviousURISegmentList.At(lLine).iURISeg); |
|
3906 currentURISegmentList->InsertL(currentURISegmentList->Size(),KNSmlDmApValFSlash); |
|
3907 inDatabase = EFalse; |
|
3908 DBG_ARGS8(_S8("InList: Id = %d Name %S"), lValue, &aPreviousURISegmentList.At(lLine).iURISeg); |
|
3909 |
|
3910 } |
|
3911 else |
|
3912 { |
|
3913 _LIT8(Kprev,"APId"); |
|
3914 TBuf8<9> addNAME(Kprev); // APIdnnn , nnn = profileid |
|
3915 addNAME.AppendNumFixedWidth(lValue,EDecimal,3); |
|
3916 |
|
3917 currentURISegmentList->InsertL(currentURISegmentList->Size(),addNAME); |
|
3918 currentURISegmentList->InsertL(currentURISegmentList->Size(),KNSmlDmApValFSlash); |
|
3919 DBG_ARGS8(_S8("NotInList: Id = %d Name %S"), lValue, &addNAME); |
|
3920 |
|
3921 // KNSmlDMStart includes start text for URISeg |
|
3922 TBuf8<20> addURI; // AP/APIdnnn , nnn = profileid |
|
3923 addURI.Append(_L8("AP/APId")); |
|
3924 addURI.AppendNumFixedWidth(lValue,EDecimal,3); |
|
3925 |
|
3926 TBuf8<16> addLUID; |
|
3927 _LIT8(KFormat,"%d"); |
|
3928 addLUID.Format(KFormat,lValue); |
|
3929 |
|
3930 // Also added to mapping |
|
3931 iCallBack->SetMappingL(addURI,addLUID); |
|
3932 } |
|
3933 } // Skip |
|
3934 errorCode = apView->GotoNextRecord(); |
|
3935 } |
|
3936 |
|
3937 iCallBack->SetStatusL(aStatusRef,CSmlDmAdapter::EOk); |
|
3938 iCallBack->SetResultsL(aResultsRef,*currentURISegmentList,KNullDesC8); |
|
3939 |
|
3940 CleanupStack::PopAndDestroy(2); // apView, currentURISegmentList |
|
3941 |
|
3942 _DBG_FILE("CNSmlInternetAdapter::ChildURIListL(): AP end"); |
|
3943 return; |
|
3944 } |
|
3945 |
|
3946 iISPId = IntLUID(aLUID); |
|
3947 |
|
3948 // |
|
3949 // Get all NAPDef numbers |
|
3950 // |
|
3951 if (aURI.Match(_L8("AP/*/NAPDef"))!= KErrNotFound) |
|
3952 { |
|
3953 TBool inDatabase = EFalse; |
|
3954 TBuf<KCommsDbSvrMaxFieldLength> serviceType; |
|
3955 TUint32 serviceId; |
|
3956 |
|
3957 CCommsDbTableView* napdefView = iDatabase->OpenViewMatchingUintLC(TPtrC(IAP) |
|
3958 , |
|
3959 TPtrC(COMMDB_ID), |
|
3960 iISPId); |
|
3961 |
|
3962 TInt errorCode = napdefView->GotoFirstRecord(); |
|
3963 |
|
3964 if (errorCode != KErrNone ) |
|
3965 { |
|
3966 iCallBack->SetStatusL(aStatusRef,CSmlDmAdapter::EError); |
|
3967 _DBG_FILE("CNSmlInternetAdapter::ChildURIListL(): NAPDef error end"); |
|
3968 CleanupStack::PopAndDestroy(2); // napdefView, currentURISegmentList |
|
3969 return; |
|
3970 } |
|
3971 else |
|
3972 { |
|
3973 napdefView->ReadTextL(TPtrC(IAP_SERVICE_TYPE), serviceType); |
|
3974 napdefView->ReadUintL(TPtrC(IAP_SERVICE), serviceId); // ID |
|
3975 CleanupStack::PopAndDestroy(); // napdefView |
|
3976 } |
|
3977 |
|
3978 CCommsDbTableView* tableView = iDatabase->OpenViewMatchingUintLC(serviceType, |
|
3979 TPtrC(COMMDB_ID), |
|
3980 serviceId); |
|
3981 |
|
3982 errorCode = tableView->GotoFirstRecord(); |
|
3983 |
|
3984 while ( errorCode == KErrNone ) |
|
3985 { |
|
3986 TUint32 lValue; |
|
3987 TInt lLine(0); |
|
3988 tableView->ReadUintL(TPtrC(COMMDB_ID),lValue); |
|
3989 // |
|
3990 // Check if in aPreviousURISegmentList |
|
3991 // |
|
3992 while(!inDatabase && lLine<aPreviousURISegmentList.Count()) |
|
3993 { |
|
3994 TUint32 list = GetIntObject8(aPreviousURISegmentList.At(lLine).iURISegLUID); |
|
3995 if(list == lValue) |
|
3996 { |
|
3997 inDatabase = ETrue; |
|
3998 } |
|
3999 else |
|
4000 { |
|
4001 lLine++; |
|
4002 } |
|
4003 } |
|
4004 |
|
4005 if(inDatabase) |
|
4006 { |
|
4007 currentURISegmentList->InsertL(currentURISegmentList->Size(),aPreviousURISegmentList.At(lLine).iURISeg); |
|
4008 currentURISegmentList->InsertL(currentURISegmentList->Size(),KNSmlDmApValFSlash); |
|
4009 inDatabase = EFalse; |
|
4010 } |
|
4011 else |
|
4012 { |
|
4013 _LIT8(Kprev,"NAPId"); |
|
4014 TBuf8<15> addNAME(Kprev); // APIdnnn , nnn = profileid |
|
4015 addNAME.AppendNumFixedWidth(lValue,EDecimal,3); |
|
4016 |
|
4017 currentURISegmentList->InsertL(currentURISegmentList->Size(),addNAME); |
|
4018 currentURISegmentList->InsertL(currentURISegmentList->Size(),KNSmlDmApValFSlash); |
|
4019 |
|
4020 |
|
4021 |
|
4022 _LIT8(Kprev2,"/NAPId"); |
|
4023 TBuf8<80> addURI; // AP/xxx/NAPDef/NAPIdnnn , nnn = id nbr |
|
4024 addURI.Append(aURI); |
|
4025 addURI.Append(Kprev2); |
|
4026 addURI.AppendNumFixedWidth(lValue,EDecimal,3); |
|
4027 |
|
4028 TBuf8<16> addLUID; |
|
4029 _LIT8(KFormat,"%d"); |
|
4030 addLUID.Format(KFormat,lValue); |
|
4031 |
|
4032 // Also added to mapping |
|
4033 iCallBack->SetMappingL(addURI,addLUID); |
|
4034 } |
|
4035 errorCode = tableView->GotoNextRecord(); |
|
4036 } |
|
4037 |
|
4038 iCallBack->SetStatusL(aStatusRef,CSmlDmAdapter::EOk); |
|
4039 iCallBack->SetResultsL(aResultsRef,*currentURISegmentList,KNullDesC8); |
|
4040 |
|
4041 CleanupStack::PopAndDestroy(2); // tableView, currentURISegmentList |
|
4042 |
|
4043 _DBG_FILE("CNSmlInternetAdapter::ChildURIListL(): AP end"); |
|
4044 return; |
|
4045 } |
|
4046 |
|
4047 // Get all Px numbers |
|
4048 // Check also AP-nbr + serviceType and nbr for Proxy |
|
4049 // To get right data for AP |
|
4050 // |
|
4051 if (aURI.Match(_L8("AP/*/Px"))!= KErrNotFound) |
|
4052 { |
|
4053 TBool inDatabase = EFalse; |
|
4054 TBuf<KCommsDbSvrMaxFieldLength> serviceType; |
|
4055 TUint32 ServiceIsp; |
|
4056 |
|
4057 CCommsDbTableView* pxView = iDatabase->OpenViewMatchingUintLC(TPtrC(IAP), |
|
4058 TPtrC(COMMDB_ID), |
|
4059 iISPId); |
|
4060 |
|
4061 TInt errorCode = pxView->GotoFirstRecord(); |
|
4062 |
|
4063 if (errorCode != KErrNone ) |
|
4064 { |
|
4065 CleanupStack::PopAndDestroy(2); // pxView, currentURISegmentList |
|
4066 _DBG_FILE("CNSmlInternetAdapter::ChildURIListL(): NAPDef error end"); |
|
4067 iCallBack->SetStatusL(aStatusRef,CSmlDmAdapter::EError); |
|
4068 return; |
|
4069 } |
|
4070 else |
|
4071 { |
|
4072 pxView->ReadTextL(TPtrC(IAP_SERVICE_TYPE), serviceType); // Type |
|
4073 pxView->ReadUintL(TPtrC(IAP_SERVICE), ServiceIsp); // ID |
|
4074 CleanupStack::PopAndDestroy(); // pxView |
|
4075 } |
|
4076 |
|
4077 CCommsDbTableView* tableView = iDatabase->OpenViewMatchingTextLC(TPtrC(PROXIES), |
|
4078 TPtrC(PROXY_SERVICE_TYPE), |
|
4079 serviceType); |
|
4080 |
|
4081 errorCode = tableView->GotoFirstRecord(); |
|
4082 |
|
4083 TBool proxyFound(false); |
|
4084 while ( errorCode == KErrNone ) |
|
4085 { |
|
4086 TUint32 lProxyIspId; |
|
4087 TUint32 lProxyId; |
|
4088 TInt lLine(0); |
|
4089 tableView->ReadUintL(TPtrC(PROXY_ISP),lProxyIspId); |
|
4090 tableView->ReadUintL(TPtrC(COMMDB_ID),lProxyId); |
|
4091 if (lProxyIspId == ServiceIsp) // Right value ISP |
|
4092 { |
|
4093 proxyFound=true; |
|
4094 tableView->ReadUintL(TPtrC(COMMDB_ID),lProxyId); |
|
4095 // |
|
4096 // Check if in aPreviousURISegmentList |
|
4097 // |
|
4098 while(!inDatabase && lLine < aPreviousURISegmentList.Count()) |
|
4099 { |
|
4100 TUint32 list = GetIntObject8(aPreviousURISegmentList.At( |
|
4101 lLine).iURISegLUID) - KNSmlApProxyLowerBase; |
|
4102 if(list == lProxyId) |
|
4103 { |
|
4104 inDatabase = ETrue; |
|
4105 } |
|
4106 else |
|
4107 { |
|
4108 lLine++; |
|
4109 } |
|
4110 } |
|
4111 |
|
4112 if(inDatabase) |
|
4113 { |
|
4114 currentURISegmentList->InsertL(currentURISegmentList->Size(),aPreviousURISegmentList.At(lLine).iURISeg); |
|
4115 currentURISegmentList->InsertL(currentURISegmentList->Size(),KNSmlDmApValFSlash); |
|
4116 inDatabase = EFalse; |
|
4117 DBG_ARGS8(_S8("InList: Id = %d Name %S"), lProxyId + KNSmlApProxyLowerBase , &aPreviousURISegmentList.At(lLine).iURISeg); |
|
4118 } |
|
4119 else |
|
4120 { |
|
4121 _LIT8(Kprev,"PXId"); |
|
4122 TBuf8<9> addNAME(Kprev); // PXIdnnn , nnn = profileid |
|
4123 addNAME.AppendNumFixedWidth(lProxyId,EDecimal,3); |
|
4124 |
|
4125 currentURISegmentList->InsertL(currentURISegmentList->Size(),addNAME); |
|
4126 currentURISegmentList->InsertL(currentURISegmentList->Size(),KNSmlDmApValFSlash); |
|
4127 DBG_ARGS8(_S8("NotInList: Id = %d Name %S"), lProxyId, &addNAME); |
|
4128 TBuf8<80> addURI; // AP/xxx/Px/PXIdnnn , nnn = id nbr |
|
4129 addURI.Append(aURI); |
|
4130 _LIT8( KPxid, "/PXId"); |
|
4131 addURI.Append( KPxid ); |
|
4132 addURI.AppendNumFixedWidth(lProxyId,EDecimal,3); |
|
4133 |
|
4134 TBuf8<16> addLUID; |
|
4135 _LIT8(KFormat,"%d"); |
|
4136 addLUID.Format(KFormat, KNSmlApProxyLowerBase + lProxyId); // 100000 + lProxyId |
|
4137 |
|
4138 // Also added to mapping |
|
4139 iCallBack->SetMappingL(addURI,addLUID); |
|
4140 } |
|
4141 } |
|
4142 errorCode = tableView->GotoNextRecord(); |
|
4143 } |
|
4144 _DBG_FILE("CNSmlInternetAdapter::ChildURIListL(): AP end"); |
|
4145 if(proxyFound) |
|
4146 { |
|
4147 iCallBack->SetStatusL(aStatusRef,CSmlDmAdapter::EOk); |
|
4148 } |
|
4149 else |
|
4150 { |
|
4151 iCallBack->SetStatusL(aStatusRef,CSmlDmAdapter::ENotFound); |
|
4152 } |
|
4153 iCallBack->SetResultsL(aResultsRef,*currentURISegmentList,KNullDesC8); |
|
4154 |
|
4155 CleanupStack::PopAndDestroy(2); // tableView, currentURISegmentList |
|
4156 |
|
4157 return; |
|
4158 } |
|
4159 |
|
4160 if (aURI.Match(_L8("AP/*/Bearer/*" ))!= KErrNotFound && |
|
4161 aURI.Match(_L8("AP/*/Bearer/*/*"))== KErrNotFound ) |
|
4162 { |
|
4163 currentURISegmentList->InsertL(currentURISegmentList->Size(),(_L8("BearerL/Direction"))); // Direction |
|
4164 iCallBack->SetStatusL(aStatusRef,CSmlDmAdapter::EOk); |
|
4165 iCallBack->SetResultsL(aResultsRef,*currentURISegmentList,KNullDesC8); |
|
4166 CleanupStack::PopAndDestroy(); // currentURISegmentList |
|
4167 _DBG_FILE("CNSmlInternetAdapter::ChildURIListL(): BearerL end"); |
|
4168 return; |
|
4169 } |
|
4170 |
|
4171 if (aURI.Match(_L8("AP/*/Bearer"))!= KErrNotFound) |
|
4172 { |
|
4173 if(aPreviousURISegmentList.Count()>0) // Allready mapped |
|
4174 { |
|
4175 currentURISegmentList->InsertL(currentURISegmentList->Size(),aPreviousURISegmentList.At(0).iURISeg); |
|
4176 currentURISegmentList->InsertL(currentURISegmentList->Size(),KNSmlDmApValFSlash); |
|
4177 } |
|
4178 else |
|
4179 { |
|
4180 _LIT8(Kprev,"BId"); |
|
4181 TBuf8<9> addNAME(Kprev); // Id |
|
4182 addNAME.AppendNumFixedWidth(checkLUID,EDecimal,3); |
|
4183 |
|
4184 currentURISegmentList->InsertL(currentURISegmentList->Size(),addNAME); |
|
4185 currentURISegmentList->InsertL(currentURISegmentList->Size(),KNSmlDmApValFSlash); |
|
4186 |
|
4187 TBuf8<80> addURI; // AP/xxx/NapDef/Bearer/BIdn , n=aLUID |
|
4188 addURI.Append(aURI); |
|
4189 _LIT8( KBid, "/BId"); |
|
4190 addURI.Append( KBid ); |
|
4191 addURI.AppendNumFixedWidth(checkLUID,EDecimal,3); |
|
4192 |
|
4193 TBuf8<16> addLUID; |
|
4194 _LIT8(KFormat,"%d"); |
|
4195 addLUID.Format(KFormat,checkLUID); |
|
4196 |
|
4197 // Also added to mapping |
|
4198 iCallBack->SetMappingL(addURI,addLUID); |
|
4199 } |
|
4200 _DBG_FILE("CNSmlInternetAdapter::ChildURIListL(): Bearer end"); |
|
4201 iCallBack->SetStatusL(aStatusRef,CSmlDmAdapter::EOk); |
|
4202 iCallBack->SetResultsL(aResultsRef,*currentURISegmentList,KNullDesC8); |
|
4203 |
|
4204 CleanupStack::PopAndDestroy(); // currentURISegmentList |
|
4205 |
|
4206 return; |
|
4207 } |
|
4208 |
|
4209 if (aURI.Match(_L8("AP/*/DNSAddr/*" ))!= KErrNotFound && |
|
4210 aURI.Match(_L8("AP/*/DNSAddr/*/*"))== KErrNotFound ) |
|
4211 { |
|
4212 currentURISegmentList->InsertL(currentURISegmentList->Size(),KNSmlDNSAddrNode); |
|
4213 iCallBack->SetStatusL(aStatusRef,CSmlDmAdapter::EOk); |
|
4214 iCallBack->SetResultsL(aResultsRef,*currentURISegmentList,KNullDesC8); |
|
4215 CleanupStack::PopAndDestroy(); // currentURISegmentList |
|
4216 _DBG_FILE("CNSmlInternetAdapter::ChildURIListL(): DNSAddrL end"); |
|
4217 return; |
|
4218 } |
|
4219 |
|
4220 if (aURI.Match(_L8("AP/*/DNSAddr"))!= KErrNotFound) |
|
4221 { |
|
4222 |
|
4223 TBuf<KCommsDbSvrMaxFieldLength> ServType; |
|
4224 TUint32 servId; |
|
4225 |
|
4226 CCommsDbTableView* napdefView = iDatabase->OpenViewMatchingUintLC(TPtrC(IAP) , |
|
4227 TPtrC(COMMDB_ID), |
|
4228 iISPId); |
|
4229 |
|
4230 TInt errorCode = napdefView->GotoFirstRecord(); |
|
4231 |
|
4232 if (errorCode != KErrNone ) |
|
4233 { |
|
4234 iCallBack->SetStatusL(aStatusRef,CSmlDmAdapter::EError); |
|
4235 _DBG_FILE("CNSmlInternetAdapter::ChildURIListL(): DNSAddr error end"); |
|
4236 CleanupStack::PopAndDestroy(2); // napdefView, currentURISegmentList |
|
4237 return; |
|
4238 } |
|
4239 else |
|
4240 { |
|
4241 napdefView->ReadTextL(TPtrC(IAP_SERVICE_TYPE), ServType); |
|
4242 napdefView->ReadUintL(TPtrC(IAP_SERVICE), servId); // ID |
|
4243 CleanupStack::PopAndDestroy(napdefView); // napdefView |
|
4244 } |
|
4245 |
|
4246 CCommsDbTableView* tableView = iDatabase->OpenViewMatchingUintLC(ServType, |
|
4247 TPtrC(COMMDB_ID), |
|
4248 servId); |
|
4249 |
|
4250 errorCode = tableView->GotoFirstRecord(); |
|
4251 |
|
4252 if ( errorCode != KErrNone ) |
|
4253 { |
|
4254 iCallBack->SetStatusL(aStatusRef,CSmlDmAdapter::EError); |
|
4255 _DBG_FILE("CNSmlInternetAdapter::ChildURIListL(): DNSAddr error end"); |
|
4256 CleanupStack::PopAndDestroy(2); // tableView, currentURISegmentList |
|
4257 return; |
|
4258 } |
|
4259 else |
|
4260 { |
|
4261 // Now we can read DNSAddrL values |
|
4262 TInt leavecode; |
|
4263 TBuf<KCommsDbSvrMaxFieldLength> columnValue; |
|
4264 TBuf8<16> addLUID; |
|
4265 TBuf8<80> addURI; // AP/xxx/NAPDef/DNSAddr/DNSx |
|
4266 _LIT8(KFormat,"%d"); |
|
4267 TRAP(leavecode, tableView->ReadTextL( TPtrC(SERVICE_IP_NAME_SERVER1 ), columnValue)); |
|
4268 if ( ( leavecode == KErrNone ) && ( columnValue.Length() > 0 ) ) |
|
4269 { |
|
4270 addURI.Append(aURI); |
|
4271 addURI.Append(KNSmlDNS1); |
|
4272 _LIT8( KDns1, "DNS1"); |
|
4273 currentURISegmentList->InsertL(currentURISegmentList->Size(),KDns1); |
|
4274 addLUID.Format(KFormat, DnsToLuid( UriUtils::EIPv4Host, 1)); |
|
4275 iCallBack->SetMappingL(addURI,addLUID); |
|
4276 addURI.Zero(); |
|
4277 } |
|
4278 |
|
4279 TRAP(leavecode, tableView->ReadTextL( TPtrC(SERVICE_IP_NAME_SERVER2 ), columnValue)); |
|
4280 if ( leavecode == KErrNone && ( columnValue.Length() > 0 ) ) |
|
4281 { |
|
4282 if ( currentURISegmentList->Size() > 0 ) |
|
4283 { |
|
4284 currentURISegmentList->InsertL(currentURISegmentList->Size(), KNSmlDmApValFSlash); |
|
4285 } |
|
4286 addURI.Append(aURI); |
|
4287 addURI.Append(KNSmlDNS2); |
|
4288 _LIT8( KDns2, "DNS2"); |
|
4289 currentURISegmentList->InsertL(currentURISegmentList->Size(),KDns2); |
|
4290 addLUID.Format(KFormat, DnsToLuid( UriUtils::EIPv4Host, 2)); |
|
4291 iCallBack->SetMappingL(addURI,addLUID); |
|
4292 addURI.Zero(); |
|
4293 } |
|
4294 |
|
4295 TRAP(leavecode, tableView->ReadTextL( TPtrC(SERVICE_IP6_NAME_SERVER1 ), columnValue)); |
|
4296 if ( leavecode == KErrNone && ( columnValue.Length() > 0 ) ) |
|
4297 { |
|
4298 if ( currentURISegmentList->Size() > 0 ) |
|
4299 { |
|
4300 currentURISegmentList->InsertL(currentURISegmentList->Size(), KNSmlDmApValFSlash); |
|
4301 } |
|
4302 addURI.Append(aURI); |
|
4303 addURI.Append(KNSmlDNS3); |
|
4304 _LIT8( KDns3, "DNS3"); |
|
4305 currentURISegmentList->InsertL(currentURISegmentList->Size(),KDns3); |
|
4306 addLUID.Format(KFormat, DnsToLuid( UriUtils::EIPv6Host, 1)); |
|
4307 iCallBack->SetMappingL(addURI,addLUID); |
|
4308 addURI.Zero(); |
|
4309 } |
|
4310 |
|
4311 TRAP(leavecode, tableView->ReadTextL( TPtrC(SERVICE_IP6_NAME_SERVER2 ), columnValue)); |
|
4312 if ( leavecode == KErrNone && ( columnValue.Length() > 0 ) ) |
|
4313 { |
|
4314 if ( currentURISegmentList->Size() > 0 ) |
|
4315 { |
|
4316 currentURISegmentList->InsertL(currentURISegmentList->Size(), KNSmlDmApValFSlash); |
|
4317 } |
|
4318 addURI.Append(aURI); |
|
4319 addURI.Append(KNSmlDNS4); |
|
4320 _LIT8(KDns4, "DNS4" ); |
|
4321 currentURISegmentList->InsertL(currentURISegmentList->Size(),KDns4 ); |
|
4322 addLUID.Format(KFormat, DnsToLuid( UriUtils::EIPv6Host, 2)); |
|
4323 iCallBack->SetMappingL(addURI,addLUID); |
|
4324 } |
|
4325 |
|
4326 _DBG_FILE("CNSmlInternetAdapter::ChildURIListL(): DNSAddr end"); |
|
4327 iCallBack->SetStatusL(aStatusRef, CSmlDmAdapter::EOk); |
|
4328 iCallBack->SetResultsL(aResultsRef, *currentURISegmentList, KNullDesC8); |
|
4329 |
|
4330 CleanupStack::PopAndDestroy(tableView); |
|
4331 CleanupStack::PopAndDestroy(currentURISegmentList); // currentURISegmentList |
|
4332 } |
|
4333 return; |
|
4334 } |
|
4335 |
|
4336 |
|
4337 if (aURI.Match(_L8("AP/*/Port/*" ))!= KErrNotFound && |
|
4338 aURI.Match(_L8("AP/*/Port/*/*"))== KErrNotFound ) |
|
4339 { |
|
4340 currentURISegmentList->InsertL(currentURISegmentList->Size(),KNSmlDdfPortNbr); |
|
4341 iCallBack->SetStatusL(aStatusRef,CSmlDmAdapter::EOk); |
|
4342 iCallBack->SetResultsL(aResultsRef,*currentURISegmentList,KNullDesC8); |
|
4343 CleanupStack::PopAndDestroy(); // currentURISegmentList |
|
4344 _DBG_FILE("CNSmlInternetAdapter::ChildURIListL(): Port end"); |
|
4345 return; |
|
4346 } |
|
4347 |
|
4348 if (aURI.Match(_L8("AP/*/Port"))!= KErrNotFound) |
|
4349 { |
|
4350 |
|
4351 TUint32 iapID10 = GetAPIdFromURIL(aURI); |
|
4352 |
|
4353 if(WapAPExistsL(iapID10)) // WapPort |
|
4354 { |
|
4355 TBuf8<80> addURI; // AP/xxx/Px/Port/WAP |
|
4356 addURI.Append(aURI); |
|
4357 _LIT8( KWap, "/WAP"); |
|
4358 addURI.Append( KWap ); |
|
4359 _LIT8( KWap2, "WAP/"); |
|
4360 currentURISegmentList->InsertL(currentURISegmentList->Size(),KWap2); |
|
4361 } |
|
4362 |
|
4363 if(PxExistsL(checkLUID)) // ProxyPort |
|
4364 { |
|
4365 TBuf8<80> addURI; // AP/xxx/Px/Port/PROXY |
|
4366 addURI.Append(aURI); |
|
4367 _LIT8( KProxy, "/PROXY"); |
|
4368 addURI.Append( KProxy ); |
|
4369 _LIT8( KProxy2, "PROXY/"); |
|
4370 currentURISegmentList->InsertL(currentURISegmentList->Size(),KProxy2); |
|
4371 } |
|
4372 |
|
4373 _DBG_FILE("CNSmlInternetAdapter::ChildURIListL(): Port end"); |
|
4374 iCallBack->SetStatusL(aStatusRef,CSmlDmAdapter::EOk); |
|
4375 iCallBack->SetResultsL(aResultsRef,*currentURISegmentList,KNullDesC8); |
|
4376 |
|
4377 CleanupStack::PopAndDestroy(); // currentURISegmentList |
|
4378 |
|
4379 return; |
|
4380 } |
|
4381 |
|
4382 if (aURI.Match(_L8("AP/*/NAPAuthInf/*" ))!= KErrNotFound && |
|
4383 aURI.Match(_L8("AP/*/NAPAuthInf/*/*"))== KErrNotFound ) |
|
4384 { |
|
4385 _LIT8( KAuthFields, "AuthName/AuthSecr"); |
|
4386 currentURISegmentList->InsertL(currentURISegmentList->Size(),(KAuthFields)); |
|
4387 iCallBack->SetStatusL(aStatusRef,CSmlDmAdapter::EOk); |
|
4388 iCallBack->SetResultsL(aResultsRef,*currentURISegmentList,KNullDesC8); |
|
4389 CleanupStack::PopAndDestroy(); // currentURISegmentList |
|
4390 _DBG_FILE("CNSmlInternetAdapter::ChildURIListL(): NAPAuthInfL end"); |
|
4391 return; |
|
4392 } |
|
4393 |
|
4394 if (aURI.Match(_L8("AP/*/NAPAuthInf"))!= KErrNotFound) |
|
4395 { |
|
4396 _LIT8(Kprev,"AUId"); |
|
4397 TBuf8<9> addNAME(Kprev); // Id |
|
4398 addNAME.AppendNumFixedWidth(checkLUID,EDecimal,3); |
|
4399 |
|
4400 currentURISegmentList->InsertL(currentURISegmentList->Size(),addNAME); |
|
4401 currentURISegmentList->InsertL(currentURISegmentList->Size(),KNSmlDmApValFSlash); |
|
4402 |
|
4403 TBuf8<80> addURI; // AP/xxx/NapDef/NAPAuthInf/AUIdn , n=aLUID |
|
4404 addURI.Append(aURI); |
|
4405 _LIT8( KAuid, "/AUId" ); |
|
4406 addURI.Append( KAuid ); |
|
4407 addURI.AppendNumFixedWidth(checkLUID,EDecimal,3); |
|
4408 |
|
4409 TBuf8<16> addLUID; |
|
4410 _LIT8(KFormat,"%d"); |
|
4411 addLUID.Format(KFormat,checkLUID); |
|
4412 |
|
4413 // Also added to mapping |
|
4414 iCallBack->SetMappingL(addURI,addLUID); |
|
4415 _DBG_FILE("CNSmlInternetAdapter::ChildURIListL(): NAPAuthInf end"); |
|
4416 iCallBack->SetStatusL(aStatusRef,CSmlDmAdapter::EOk); |
|
4417 iCallBack->SetResultsL(aResultsRef,*currentURISegmentList,KNullDesC8); |
|
4418 |
|
4419 CleanupStack::PopAndDestroy(); // currentURISegmentList |
|
4420 |
|
4421 return; |
|
4422 } |
|
4423 |
|
4424 if (aURI.Match(_L8("AP/*/PxAuthInf/*" ))!= KErrNotFound && |
|
4425 aURI.Match(_L8("AP/*/PxAuthInf/*/*"))== KErrNotFound ) |
|
4426 { |
|
4427 _LIT8( KPxAuthFields, "PxAuthId/PxAuthPW"); |
|
4428 currentURISegmentList->InsertL(currentURISegmentList->Size(),(KPxAuthFields)); |
|
4429 iCallBack->SetStatusL(aStatusRef,CSmlDmAdapter::EOk); |
|
4430 iCallBack->SetResultsL(aResultsRef,*currentURISegmentList,KNullDesC8); |
|
4431 CleanupStack::PopAndDestroy(); // currentURISegmentList |
|
4432 _DBG_FILE("CNSmlInternetAdapter::ChildURIListL(): NAPAuthInfL end"); |
|
4433 return; |
|
4434 } |
|
4435 |
|
4436 if (aURI.Match(_L8("AP/*/PxAuthInf"))!= KErrNotFound) |
|
4437 { |
|
4438 _LIT8(Kprev,"AUPxId"); |
|
4439 TBuf8<11> addNAME(Kprev); // Id |
|
4440 addNAME.AppendNumFixedWidth(checkLUID,EDecimal,3); |
|
4441 |
|
4442 currentURISegmentList->InsertL(currentURISegmentList->Size(),addNAME); |
|
4443 currentURISegmentList->InsertL(currentURISegmentList->Size(),KNSmlDmApValFSlash); |
|
4444 |
|
4445 TBuf8<80> addURI; // AP/xxx/Px/PxAuthInf/AUPxIdn , n=aLUID |
|
4446 addURI.Append(aURI); |
|
4447 _LIT8( KAupxid, "/AUPxId" ); |
|
4448 addURI.Append( KAupxid ); |
|
4449 addURI.AppendNumFixedWidth(checkLUID,EDecimal,3); |
|
4450 |
|
4451 _DBG_FILE("CNSmlInternetAdapter::ChildURIListL(): NAPAuthInf end"); |
|
4452 iCallBack->SetStatusL(aStatusRef,CSmlDmAdapter::EOk); |
|
4453 iCallBack->SetResultsL(aResultsRef,*currentURISegmentList,KNullDesC8); |
|
4454 |
|
4455 CleanupStack::PopAndDestroy(); // currentURISegmentList |
|
4456 |
|
4457 return; |
|
4458 } |
|
4459 |
|
4460 if (aURI.Match(_L8("AP/*/ToNAPID/*" ))!= KErrNotFound && |
|
4461 aURI.Match(_L8("AP/*/ToNAPID/*/*"))== KErrNotFound ) |
|
4462 { |
|
4463 currentURISegmentList->InsertL(currentURISegmentList->Size(),(KNSmlDdfToNAPIDL)); |
|
4464 iCallBack->SetStatusL(aStatusRef,CSmlDmAdapter::EOk); |
|
4465 iCallBack->SetResultsL(aResultsRef,*currentURISegmentList,KNullDesC8); |
|
4466 CleanupStack::PopAndDestroy(); // currentURISegmentList |
|
4467 _DBG_FILE("CNSmlInternetAdapter::ChildURIListL(): ToNAPIDL end"); |
|
4468 return; |
|
4469 } |
|
4470 |
|
4471 if (aURI.Match(_L8("AP/*/ToNAPID"))!= KErrNotFound) |
|
4472 { |
|
4473 _LIT8(Kprev,"TId"); |
|
4474 TBuf8<9> addNAME(Kprev); // Id |
|
4475 addNAME.AppendNumFixedWidth(checkLUID,EDecimal,3); |
|
4476 |
|
4477 currentURISegmentList->InsertL(currentURISegmentList->Size(),addNAME); |
|
4478 currentURISegmentList->InsertL(currentURISegmentList->Size(),KNSmlDmApValFSlash); |
|
4479 |
|
4480 TBuf8<80> addURI; // AP/xxx/NapDef/ToNAPID/TIdn , n=aLUID |
|
4481 addURI.Append(aURI); |
|
4482 _LIT8( KTid, "/TId" ); |
|
4483 addURI.Append( KTid ); |
|
4484 addURI.AppendNumFixedWidth(checkLUID,EDecimal,3); |
|
4485 |
|
4486 _DBG_FILE("CNSmlInternetAdapter::ChildURIListL(): ToNAPID end"); |
|
4487 iCallBack->SetStatusL(aStatusRef,CSmlDmAdapter::EOk); |
|
4488 iCallBack->SetResultsL(aResultsRef,*currentURISegmentList,KNullDesC8); |
|
4489 |
|
4490 CleanupStack::PopAndDestroy(); // currentURISegmentList |
|
4491 |
|
4492 return; |
|
4493 } |
|
4494 |
|
4495 if (aURI.Match(_L8("AP/*/Networks/*" ))!= KErrNotFound && |
|
4496 aURI.Match(_L8("AP/*/Networks/*/*"))== KErrNotFound ) |
|
4497 { |
|
4498 _LIT8( KNameId, "Name/ID" ); |
|
4499 currentURISegmentList->InsertL(currentURISegmentList->Size(),(KNameId)); |
|
4500 iCallBack->SetStatusL(aStatusRef,CSmlDmAdapter::EOk); |
|
4501 iCallBack->SetResultsL(aResultsRef,*currentURISegmentList,KNullDesC8); |
|
4502 CleanupStack::PopAndDestroy(); // currentURISegmentList |
|
4503 _DBG_FILE("CNSmlInternetAdapter::ChildURIListL(): Networks end"); |
|
4504 return; |
|
4505 } |
|
4506 |
|
4507 if (aURI.Match(_L8("AP/*/Networks"))!= KErrNotFound) |
|
4508 { |
|
4509 checkLUID = GetAPIdFromURIL(aURI); |
|
4510 |
|
4511 CCommsDbTableView* tableView = iDatabase->OpenViewMatchingUintLC(TPtrC(IAP), |
|
4512 TPtrC(COMMDB_ID), |
|
4513 checkLUID); |
|
4514 |
|
4515 TInt errorCode = tableView->GotoFirstRecord(); |
|
4516 |
|
4517 if ( errorCode == KErrNone ) |
|
4518 { |
|
4519 TUint32 nwLUID = 0; |
|
4520 tableView->ReadUintL(TPtrC(IAP_NETWORK),nwLUID); // Networks luid |
|
4521 if(!NetworkExistsL(nwLUID)) |
|
4522 { |
|
4523 errorCode = KErrNotFound; |
|
4524 } |
|
4525 } |
|
4526 |
|
4527 CleanupStack::PopAndDestroy(); // tableView |
|
4528 |
|
4529 if(errorCode != KErrNone) |
|
4530 { |
|
4531 _DBG_FILE("CNSmlInternetAdapter::ChildURIListL(): Networks error end"); |
|
4532 iCallBack->SetStatusL(aStatusRef,CSmlDmAdapter::EError); |
|
4533 CleanupStack::PopAndDestroy(); // currentURISegmentList |
|
4534 return; |
|
4535 } |
|
4536 |
|
4537 if(aPreviousURISegmentList.Count()>0) // Allready mapped |
|
4538 { |
|
4539 currentURISegmentList->InsertL(currentURISegmentList->Size(),aPreviousURISegmentList.At(0).iURISeg); |
|
4540 currentURISegmentList->InsertL(currentURISegmentList->Size(),KNSmlDmApValFSlash); |
|
4541 } |
|
4542 else |
|
4543 { |
|
4544 _LIT8(Kprev,"NwId"); |
|
4545 TBuf8<9> addNAME(Kprev); // Id |
|
4546 addNAME.AppendNumFixedWidth(checkLUID,EDecimal,3); |
|
4547 |
|
4548 currentURISegmentList->InsertL(currentURISegmentList->Size(),addNAME); |
|
4549 currentURISegmentList->InsertL(currentURISegmentList->Size(),KNSmlDmApValFSlash); |
|
4550 |
|
4551 TBuf8<80> addURI; // AP/xxx/NapDef/Networks/NwIdn , n=aLUID |
|
4552 addURI.Append(aURI); |
|
4553 _LIT8( KNwid, "/NwId"); |
|
4554 addURI.Append(KNwid); |
|
4555 addURI.AppendNumFixedWidth(checkLUID,EDecimal,3); |
|
4556 |
|
4557 TBuf8<16> addLUID; |
|
4558 _LIT8(KFormat,"%d"); |
|
4559 addLUID.Format(KFormat,checkLUID); |
|
4560 |
|
4561 |
|
4562 // Also added to mapping |
|
4563 iCallBack->SetMappingL(addURI,addLUID); |
|
4564 } |
|
4565 _DBG_FILE("CNSmlInternetAdapter::ChildURIListL(): Networks end"); |
|
4566 iCallBack->SetStatusL(aStatusRef,CSmlDmAdapter::EOk); |
|
4567 iCallBack->SetResultsL(aResultsRef,*currentURISegmentList,KNullDesC8); |
|
4568 |
|
4569 CleanupStack::PopAndDestroy(); // currentURISegmentList |
|
4570 |
|
4571 return; |
|
4572 } |
|
4573 |
|
4574 if (aURI.Match(_L8("AP/*/NoPxFor/*" ))!= KErrNotFound && |
|
4575 aURI.Match(_L8("AP/*/NoPxFor/*/*"))== KErrNotFound ) |
|
4576 { |
|
4577 currentURISegmentList->InsertL(currentURISegmentList->Size(),(KNSmlDdfNoPxForL)); |
|
4578 iCallBack->SetStatusL(aStatusRef,CSmlDmAdapter::EOk); |
|
4579 iCallBack->SetResultsL(aResultsRef,*currentURISegmentList,KNullDesC8); |
|
4580 CleanupStack::PopAndDestroy(); // currentURISegmentList |
|
4581 _DBG_FILE("CNSmlInternetAdapter::ChildURIListL(): NoPxFor end"); |
|
4582 return; |
|
4583 } |
|
4584 |
|
4585 if (aURI.Match(_L8("AP/*/NoPxFor"))!= KErrNotFound) |
|
4586 { |
|
4587 if(aPreviousURISegmentList.Count()>0) // Allready mapped |
|
4588 { |
|
4589 currentURISegmentList->InsertL(currentURISegmentList->Size(),aPreviousURISegmentList.At(0).iURISeg); |
|
4590 currentURISegmentList->InsertL(currentURISegmentList->Size(),KNSmlDmApValFSlash); |
|
4591 } |
|
4592 else |
|
4593 { |
|
4594 _LIT8(KexepPrev,"eXC"); |
|
4595 currentURISegmentList->InsertL(currentURISegmentList->Size(),KexepPrev); |
|
4596 } |
|
4597 _DBG_FILE("CNSmlInternetAdapter::ChildURIListL(): NoPxFor end"); |
|
4598 iCallBack->SetStatusL(aStatusRef,CSmlDmAdapter::EOk); |
|
4599 iCallBack->SetResultsL(aResultsRef,*currentURISegmentList,KNullDesC8); |
|
4600 |
|
4601 CleanupStack::PopAndDestroy(); // currentURISegmentList |
|
4602 |
|
4603 return; |
|
4604 } |
|
4605 |
|
4606 if (aURI.Match(_L8("AP/*/Domain/*" ))!= KErrNotFound && |
|
4607 aURI.Match(_L8("AP/*/Domain/*/*"))== KErrNotFound ) |
|
4608 { |
|
4609 currentURISegmentList->InsertL(currentURISegmentList->Size(),(KNSmlDdfDomainL)); |
|
4610 iCallBack->SetStatusL(aStatusRef,CSmlDmAdapter::EOk); |
|
4611 iCallBack->SetResultsL(aResultsRef,*currentURISegmentList,KNullDesC8); |
|
4612 CleanupStack::PopAndDestroy(); // currentURISegmentList |
|
4613 _DBG_FILE("CNSmlInternetAdapter::ChildURIListL(): Domain end"); |
|
4614 return; |
|
4615 } |
|
4616 |
|
4617 if (aURI.Match(_L8("AP/*/Domain"))!= KErrNotFound) |
|
4618 { |
|
4619 if(aPreviousURISegmentList.Count()>0) // Allready mapped |
|
4620 { |
|
4621 currentURISegmentList->InsertL(currentURISegmentList->Size(),aPreviousURISegmentList.At(0).iURISeg); |
|
4622 currentURISegmentList->InsertL(currentURISegmentList->Size(),KNSmlDmApValFSlash); |
|
4623 } |
|
4624 else |
|
4625 { |
|
4626 _LIT8(KexepPrev,"dOM"); |
|
4627 currentURISegmentList->InsertL(currentURISegmentList->Size(),KexepPrev); |
|
4628 } |
|
4629 _DBG_FILE("CNSmlInternetAdapter::ChildURIListL(): Domain end"); |
|
4630 iCallBack->SetStatusL(aStatusRef,CSmlDmAdapter::EOk); |
|
4631 iCallBack->SetResultsL(aResultsRef,*currentURISegmentList,KNullDesC8); |
|
4632 |
|
4633 CleanupStack::PopAndDestroy(); // currentURISegmentList |
|
4634 |
|
4635 return; |
|
4636 } |
|
4637 |
|
4638 iCallBack->SetStatusL(aStatusRef,CSmlDmAdapter::EOk); |
|
4639 iCallBack->SetResultsL(aResultsRef,*currentURISegmentList,KNullDesC8); |
|
4640 _DBG_FILE("CNSmlInternetAdapter::ChildURIListL(): end"); |
|
4641 |
|
4642 CleanupStack::PopAndDestroy(); // currentURISegmentList |
|
4643 |
|
4644 return; |
|
4645 } |
|
4646 |
|
4647 //------------------------------------------------------------------------------ |
|
4648 // CNSmlInternetAdapter::AddNodeBufferL() |
|
4649 // Inserts new AP-data to database |
|
4650 //------------------------------------------------------------------------------ |
|
4651 void CNSmlInternetAdapter::AddNodeBufferL( const TDesC8& aURI, |
|
4652 const TDesC8& /*aParentLUID*/, |
|
4653 const TInt aStatusRef, |
|
4654 const TBool aDnsUpd, |
|
4655 const TBool aWlan ) |
|
4656 { |
|
4657 TInt index = -1; |
|
4658 |
|
4659 for(TInt i = 0; i<iBuffer->Count(); i++) |
|
4660 { |
|
4661 TPtrC8 parentUri = FirstURISeg(aURI); |
|
4662 if(iBuffer->At(i).iMappingName->Compare(parentUri) == 0 ) |
|
4663 { |
|
4664 index = i; |
|
4665 break; |
|
4666 } |
|
4667 } |
|
4668 |
|
4669 if(index<0) |
|
4670 { |
|
4671 TNSmlAPBufferElement newNode; |
|
4672 newNode.iMappingName = aURI.AllocLC(); |
|
4673 |
|
4674 NextAPNameL(*LastURISeg(aURI).AllocLC()); |
|
4675 CleanupStack::PopAndDestroy(); |
|
4676 |
|
4677 newNode.iName = iIAPName.AllocLC(); |
|
4678 newNode.iNodeBuf = new (ELeave) CArrayFixFlat <TNSmlAPAddElement> (KNSmlAPGranularity); |
|
4679 newNode.iWlanNodeBuf = new (ELeave) CArrayFixFlat <TNSmlAPAddElement> (KNSmlAPGranularity); |
|
4680 newNode.iExecuted = EFalse; |
|
4681 newNode.iBearer = EFalse; |
|
4682 newNode.iDirection = EFalse; |
|
4683 newNode.iNameReceived = EFalse; |
|
4684 if ( aDnsUpd ) |
|
4685 { |
|
4686 newNode.iDnsUpdateBuf = ETrue; |
|
4687 } |
|
4688 else |
|
4689 { |
|
4690 newNode.iDnsUpdateBuf = EFalse; |
|
4691 } |
|
4692 newNode.iLuid = 0; |
|
4693 iBuffer->AppendL(newNode); |
|
4694 CleanupStack::Pop(2); //newNode.iMappingName,newNode.iName |
|
4695 |
|
4696 index = iBuffer->Count() - 1; |
|
4697 } |
|
4698 |
|
4699 if ( !aDnsUpd ) |
|
4700 { |
|
4701 TNSmlAPAddElement newCommand; |
|
4702 newCommand.iUri = aURI.AllocLC(); |
|
4703 newCommand.iData = 0; |
|
4704 newCommand.iStatusRef = aStatusRef; |
|
4705 newCommand.iLeaf = EFalse; |
|
4706 newCommand.iDone = EFalse; |
|
4707 |
|
4708 TPtrC8 parentUri = FirstURISeg(aURI); |
|
4709 newCommand.iLuid = iCallBack->GetLuidAllocL( parentUri ); |
|
4710 |
|
4711 if ( aWlan ) |
|
4712 { |
|
4713 iBuffer->At(index).iWlanNodeBuf->AppendL(newCommand); |
|
4714 } |
|
4715 else |
|
4716 { |
|
4717 iBuffer->At(index).iNodeBuf->AppendL(newCommand); |
|
4718 } |
|
4719 CleanupStack::Pop(); //newCommand.iUri |
|
4720 } |
|
4721 } |
|
4722 |
|
4723 //------------------------------------------------------------------------------ |
|
4724 // CNSmlInternetAdapter::AddLeafBufferL() |
|
4725 //------------------------------------------------------------------------------ |
|
4726 void CNSmlInternetAdapter::AddLeafBufferL( const TDesC8& aURI, |
|
4727 const TDesC8& aParentLUID, |
|
4728 const TDesC8& aObject, |
|
4729 const TDesC8& /*aType*/, |
|
4730 const TInt aStatusRef, |
|
4731 const TBool aWlan ) |
|
4732 { |
|
4733 TInt index = -1; |
|
4734 |
|
4735 for(TInt i = 0; i<iBuffer->Count(); i++) |
|
4736 { |
|
4737 TPtrC8 parentUri = FirstURISeg(aURI); |
|
4738 if(iBuffer->At(i).iMappingName->Compare(parentUri) == 0 ) |
|
4739 { |
|
4740 index = i; |
|
4741 break; |
|
4742 } |
|
4743 } |
|
4744 |
|
4745 if( index<0 ) |
|
4746 { |
|
4747 if ( aParentLUID.Length() < 0 ) |
|
4748 { |
|
4749 DBG_ARGS8(_S8("AP:AddLeafBufferL URI - <%S> <%S> NOTFOUND"), &aURI, &aParentLUID ); |
|
4750 iCallBack->SetStatusL(aStatusRef, CSmlDmAdapter::ENotFound); |
|
4751 return; |
|
4752 } |
|
4753 else |
|
4754 { |
|
4755 // this means update to DNSAddr/<X> |
|
4756 TPtrC8 apURI = FirstURISeg(aURI); |
|
4757 HBufC8* luid = iCallBack->GetLuidAllocL(apURI); |
|
4758 CleanupStack::PushL( luid ); |
|
4759 |
|
4760 AddNodeBufferL( apURI, luid->Des(), -2, ETrue ); |
|
4761 iDnsIpv4Pri = 0; |
|
4762 iDnsIpv6Pri = 0; |
|
4763 |
|
4764 CleanupStack::PopAndDestroy( luid ); |
|
4765 index = 0; |
|
4766 } |
|
4767 } |
|
4768 |
|
4769 TNSmlAPAddElement newCommand; |
|
4770 |
|
4771 newCommand.iUri = aURI.AllocLC(); //aURI.AllocLC(); |
|
4772 newCommand.iData = aObject.AllocLC(); |
|
4773 newCommand.iStatusRef = aStatusRef; |
|
4774 newCommand.iLuid = aParentLUID.AllocLC(); |
|
4775 newCommand.iLeaf = ETrue; |
|
4776 newCommand.iDone = EFalse; |
|
4777 |
|
4778 if ( aWlan ) |
|
4779 { |
|
4780 iBuffer->At(index).iWlanNodeBuf->AppendL(newCommand); |
|
4781 } |
|
4782 else |
|
4783 { |
|
4784 iBuffer->At(index).iNodeBuf->AppendL(newCommand); |
|
4785 } |
|
4786 |
|
4787 CleanupStack::Pop(3); //newCommand.iLastUriSeg, newCommand.iData, newCommand.iLuid |
|
4788 |
|
4789 if (aURI.Find(KNSmlDdfBearerL) >= 0 ) // Bearer added |
|
4790 { |
|
4791 if (aObject.Match(KNSmlDmApValGsmGprs)!= KErrNotFound) |
|
4792 { |
|
4793 iBuffer->At(index).iBearer = ETrue; |
|
4794 } |
|
4795 |
|
4796 else if (aObject.Match(KNSmlDmApVal3Gppps) != KErrNotFound || |
|
4797 aObject.Match(KNSmlDmApValVpn) != KErrNotFound ) |
|
4798 { |
|
4799 iBuffer->At(index).iBearer = ETrue; |
|
4800 } |
|
4801 if ( ( aObject.Match(KNSmlDmApValWlan) != KErrNotFound ) && iWlanSupported ) // Valid Bearer |
|
4802 { |
|
4803 iBuffer->At(index).iBearer = ETrue; |
|
4804 } |
|
4805 } |
|
4806 |
|
4807 if (aURI.Find(KNSmlDdfDirection) >= 0 ) // Direction added |
|
4808 { |
|
4809 iBuffer->At(index).iDirection = ETrue; |
|
4810 } |
|
4811 |
|
4812 if ( aURI.Match(_L8("AP/*/NAPDef/*/*" ))!= KErrNotFound && |
|
4813 aURI.Match(_L8("AP/*/NAPDef/*/*/*"))== KErrNotFound && |
|
4814 LastURISeg(aURI).Compare( KNSmlDdfNAPName ) == 0 ) |
|
4815 { |
|
4816 iIAPExists = EFalse; |
|
4817 iBuffer->At(index).iNameReceived = ETrue; |
|
4818 |
|
4819 delete iBuffer->At(index).iName; |
|
4820 iBuffer->At(index).iName = 0; |
|
4821 |
|
4822 iBuffer->At(index).iName = aObject.AllocLC(); |
|
4823 iIAPName.Copy( aObject ); |
|
4824 CleanupStack::Pop(); |
|
4825 |
|
4826 // Check if Name and LUID match |
|
4827 TPtrC qTable = TPtrC(IAP); // Check if IAP-table free |
|
4828 TPtrC qDB = TPtrC(COMMDB_ID); |
|
4829 TPtrC8 parentUri = FirstURISeg(aURI); |
|
4830 HBufC8* luid = iCallBack->GetLuidAllocL( parentUri ); |
|
4831 CleanupStack::PushL( luid ); |
|
4832 |
|
4833 CCommsDbTableView* tableView = iDatabase->OpenViewMatchingUintLC(qTable, |
|
4834 qDB, |
|
4835 IntLUID( *luid ) ); |
|
4836 |
|
4837 |
|
4838 TInt errorCode = tableView->GotoFirstRecord(); |
|
4839 if( errorCode != KErrNotFound ) |
|
4840 { |
|
4841 // Check the name |
|
4842 TBuf8<KCommsDbSvrMaxFieldLength> name; |
|
4843 tableView->ReadTextL( TPtrC(COMMDB_NAME ), name); |
|
4844 if ( name.Compare( aObject ) != 0 ) |
|
4845 { |
|
4846 // Not correct name |
|
4847 // Remove all mappings from AP/xxx level |
|
4848 if(isAdd) |
|
4849 { |
|
4850 TInt ret = iCallBack->RemoveMappingL( KNSmlInternetAdapterImplUid, |
|
4851 GetDynamicAPNodeUri( aURI ) , ETrue ); |
|
4852 iPrevURI->Des().Format( KNullDesC8 ); |
|
4853 iPrevLUID = 0; |
|
4854 } |
|
4855 else |
|
4856 { |
|
4857 iIAPExists = ETrue; |
|
4858 iLeafType = EDMUpdate; |
|
4859 } |
|
4860 |
|
4861 } |
|
4862 else |
|
4863 { |
|
4864 iIAPExists = ETrue; |
|
4865 iLeafType = EDMUpdate; |
|
4866 } |
|
4867 } |
|
4868 CleanupStack::PopAndDestroy( tableView ); |
|
4869 CleanupStack::PopAndDestroy( luid ); |
|
4870 } |
|
4871 // |
|
4872 |
|
4873 // If Bearer data + Direction + name => add is possible for AP |
|
4874 // |
|
4875 if (iBuffer->At(index).iDirection && |
|
4876 iBuffer->At(index).iBearer && |
|
4877 iBuffer->At(index).iNameReceived && |
|
4878 !iExecutingBuffer ) |
|
4879 { |
|
4880 iBearer.Zero(); |
|
4881 iDirection = ECommDbConnectionDirectionUnknown; |
|
4882 ExecuteBufferL(aURI); |
|
4883 |
|
4884 } |
|
4885 } |
|
4886 |
|
4887 //------------------------------------------------------------------------------ |
|
4888 // CNSmlInternetAdapter::AddNodeObjectL() |
|
4889 // Inserts new AP-data to database |
|
4890 //------------------------------------------------------------------------------ |
|
4891 void CNSmlInternetAdapter::AddNodeObjectL( const TDesC8& aURI, |
|
4892 const TDesC8& aParentLUID, |
|
4893 const TInt aStatusRef ) |
|
4894 { |
|
4895 _DBG_FILE("CNSmlInternetAdapter::AddNodeObjectL(): begin"); |
|
4896 |
|
4897 DBG_ARGS8(_S8("CNSmlInternetAdapter::AddNodeObjectL(): aURI=<%S>, aParentLUID=<%S>"), &aURI, &aParentLUID); |
|
4898 |
|
4899 if (iLeafType == EDMUpdate && iExecutingBuffer ) |
|
4900 { |
|
4901 // This is an update to an old IAP. All node additions return KErrAlreadyExists. |
|
4902 iCallBack->SetStatusL(aStatusRef,CSmlDmAdapter::EAlreadyExists); // EError |
|
4903 _DBG_FILE("CNSmlInternetAdapter::AddNodeObjectL(): EAlreadyExists end"); |
|
4904 return; |
|
4905 } |
|
4906 |
|
4907 // Save LUID to local variable to be able to reset the value, if needed. |
|
4908 TBuf8<KSmlMaxURISegLen> parentLUID; |
|
4909 parentLUID.Zero(); |
|
4910 parentLUID = aParentLUID; |
|
4911 |
|
4912 TUint32 apId = GetAPIdFromURIL( aURI ); |
|
4913 |
|
4914 if( parentLUID.Length() > 0 && IntLUID(parentLUID) > 0 && |
|
4915 !APExistsL( apId ) ) |
|
4916 { |
|
4917 // AP has been deleted. Handle as new data. |
|
4918 _DBG_FILE("CNSmlInternetAdapter::AddNodeObjectL(): parentLUID.Length() > 0 && !APExistsL() -> Remove mapping "); |
|
4919 TInt ret = iCallBack->RemoveMappingL( KNSmlInternetAdapterImplUid, |
|
4920 GetDynamicAPNodeUri( aURI ) , ETrue ); |
|
4921 if(ret) |
|
4922 { |
|
4923 iCallBack->SetStatusL( aStatusRef, CSmlDmAdapter::EError ); |
|
4924 return; |
|
4925 } |
|
4926 parentLUID.Zero(); |
|
4927 iPrevURI->Des().Format( KNullDesC8 ); |
|
4928 iPrevLUID = 0; |
|
4929 } |
|
4930 |
|
4931 if(parentLUID.Length()<=0) |
|
4932 { |
|
4933 // Check OOD before saving new |
|
4934 RFs fs; |
|
4935 User::LeaveIfError( fs.Connect() ); |
|
4936 CleanupClosePushL(fs); |
|
4937 |
|
4938 if (SysUtil::FFSSpaceBelowCriticalLevelL(&fs, KNSmlInternetAdapterFatMinSize)) |
|
4939 { |
|
4940 CleanupStack::PopAndDestroy(); // fs |
|
4941 iCallBack->SetStatusL(aStatusRef,CSmlDmAdapter::EDiskFull); |
|
4942 _DBG_FILE("CNSmlInternetAdapter::AddNodeObjectL(): DISK FULL end"); |
|
4943 return; |
|
4944 // do not write |
|
4945 } |
|
4946 CleanupStack::PopAndDestroy(); //fs |
|
4947 } |
|
4948 // |
|
4949 // Check if AP-add |
|
4950 // |
|
4951 if(( aURI.Match(_L8("AP/*" ))!= KErrNotFound && |
|
4952 aURI.Match(_L8("AP/*/*"))== KErrNotFound ) || |
|
4953 ( aURI.Match(_L8("AP/*/NAPDef/*" ))!= KErrNotFound && |
|
4954 aURI.Match(_L8("AP/*/NAPDef/*/*"))== KErrNotFound ) || |
|
4955 aURI.Match(_L8("AP/*/NAPDef" ))!= KErrNotFound || |
|
4956 aURI.Match(_L8("AP/*/NAPDef/*/Bearer"))!= KErrNotFound || |
|
4957 ( aURI.Match(_L8("AP/*/NAPDef/*/Bearer/*" ))!= KErrNotFound && |
|
4958 aURI.Match(_L8("AP/*/NAPDef/*/Bearer/*/*"))== KErrNotFound ) || |
|
4959 aURI.Match(_L8("*/WLAN*" )) != KErrNotFound) |
|
4960 { |
|
4961 if( ( parentLUID.Length()<=0 ) && ( aURI.Match(_L8("*/WLAN*" )) != KErrNotFound ) ) |
|
4962 { |
|
4963 AddNodeBufferL(aURI,parentLUID,aStatusRef, EFalse, ETrue); |
|
4964 return; |
|
4965 } |
|
4966 if(parentLUID.Length()<=0) |
|
4967 { |
|
4968 AddNodeBufferL(aURI,parentLUID,aStatusRef, EFalse); |
|
4969 return; |
|
4970 } |
|
4971 |
|
4972 if( iTransactionCommitted && !iDatabase->InTransaction() ) |
|
4973 { |
|
4974 |
|
4975 _DBG_FILE("CNSmlInternetAdapter::AddNode object, begin commsdb transaction "); |
|
4976 TInt codeBegin = iDatabase->BeginTransaction(); |
|
4977 TInt retry = KBeginTransRetryCount; |
|
4978 if( codeBegin == KErrNone ) |
|
4979 { |
|
4980 iTransactionCommitted = EFalse; |
|
4981 } |
|
4982 DBG_ARGS8(_S8("CNSmlInternetAdapter::AddNode object iDatabase->Begintransaction start of addobjectL return code = %d"),codeBegin); |
|
4983 if( codeBegin == KErrLocked ) |
|
4984 { |
|
4985 _DBG_FILE("CNSmlInternetAdapter::Addnodeobject Database->Begintransaction has returned KErrLocked"); |
|
4986 while ( retry > 0 && codeBegin == KErrLocked ) |
|
4987 { |
|
4988 User::After(KBeginTransRetryDelay); |
|
4989 codeBegin = iDatabase->BeginTransaction(); |
|
4990 DBG_ARGS8(_S8("CNSmlInternetAdapter::AddNode object iDatabase->Begintransaction after 2 seconds of wait of addobjectL return code = %d"),codeBegin); |
|
4991 retry--; |
|
4992 } |
|
4993 |
|
4994 if( codeBegin == KErrNone ) |
|
4995 { |
|
4996 iTransactionCommitted = EFalse; |
|
4997 _DBG_FILE("CNSmlInternetAdapter::AddNode object transaction commited is false "); |
|
4998 } |
|
4999 |
|
5000 } |
|
5001 |
|
5002 |
|
5003 } |
|
5004 if ( ( aURI.Match(_L8("*/WLAN*" )) != KErrNotFound ) && iWlanSupported ) |
|
5005 { |
|
5006 DBG_ARGS8(_S8("To WlanAdapter::AddNodeObjectL - uri: <%S> to parentLUID: <%S>"), &aURI, &parentLUID ); |
|
5007 iWlanAdapter->AddNodeObjectL( aURI, parentLUID, aStatusRef ); |
|
5008 return; |
|
5009 } |
|
5010 |
|
5011 TInt pluid = IntLUID(parentLUID); |
|
5012 |
|
5013 if(pluid < 0) |
|
5014 { |
|
5015 iCallBack->SetStatusL(aStatusRef,CSmlDmAdapter::EOk); |
|
5016 _DBG_FILE("CNSmlInternetAdapter::AddNodeObjectL(): end"); |
|
5017 return; |
|
5018 } |
|
5019 iIAPId = pluid; |
|
5020 |
|
5021 TPtrC qTable = TPtrC(IAP); // Check if IAP-table free |
|
5022 TPtrC qDB = TPtrC(COMMDB_ID); |
|
5023 |
|
5024 //Check if URI is /AP/*/NAPDef/* then it should be check IAP ID in DB not IAPService |
|
5025 if(( iIAPId >= 0 ) && ((aURI.Match(_L8("AP/*/NAPDef/*" ))!= KErrNotFound) || (aURI.Match(_L8("AP/*/NAPDef/*/Bearer/*" ))!= KErrNotFound) || (aURI.Match(_L8("AP/*" ))!= KErrNotFound) ||(aURI.Match(_L8("AP/*/NAPDef" ))!= KErrNotFound))) |
|
5026 { |
|
5027 //Get parent UID and check if that exist if not add |
|
5028 iIAPId = GetAPIdFromURIL(aURI); |
|
5029 |
|
5030 } |
|
5031 CCommsDbTableView* tableView = iDatabase->OpenViewMatchingUintLC(qTable, |
|
5032 qDB, |
|
5033 iIAPId); |
|
5034 |
|
5035 TInt errorCode = tableView->GotoFirstRecord(); |
|
5036 |
|
5037 CleanupStack::PopAndDestroy(tableView); |
|
5038 |
|
5039 // Node allready exists => No adding possible |
|
5040 if ( errorCode == KErrNone ) |
|
5041 { |
|
5042 if ( !iExecutingBuffer ) |
|
5043 { |
|
5044 AddNodeBufferL(aURI,parentLUID,aStatusRef, EFalse); |
|
5045 } |
|
5046 else |
|
5047 { |
|
5048 iCallBack->SetStatusL(aStatusRef,CSmlDmAdapter::EAlreadyExists); // EError |
|
5049 _DBG_FILE("CNSmlInternetAdapter::AddNodeObjectL(): EAlreadyExists end"); |
|
5050 } |
|
5051 return; |
|
5052 } |
|
5053 else if ( iIAPId == 0 ) |
|
5054 { |
|
5055 iCallBack->SetStatusL(aStatusRef,CSmlDmAdapter::ENotFound); |
|
5056 _DBG_FILE("CNSmlInternetAdapter::AddNodeObjectL(): ENotFound end"); |
|
5057 return; |
|
5058 } |
|
5059 else if( iIAPId > 0 && errorCode == KErrNotFound) // Stale data, needs update |
|
5060 { |
|
5061 |
|
5062 _DBG_FILE("CNSmlInternetAdapter::AddNodeObjectL(): stale data Add to buffer"); |
|
5063 AddNodeBufferL(aURI,parentLUID,aStatusRef, EFalse); |
|
5064 iStaleMapUpdate=ETrue; |
|
5065 return; |
|
5066 } |
|
5067 |
|
5068 } |
|
5069 else if (aURI.Match(_L8("AP/*/Px/*" ))!= KErrNotFound && // How to check if already added |
|
5070 aURI.Match(_L8("AP/*/Px/*/*"))== KErrNotFound ) // dm-tree knows last LUID |
|
5071 { |
|
5072 if(parentLUID.Length()<=0) |
|
5073 { |
|
5074 AddNodeBufferL(aURI,parentLUID,aStatusRef, EFalse); |
|
5075 return; |
|
5076 } |
|
5077 |
|
5078 // Check if already exists on database (=> only One possible for AP) |
|
5079 if(GetProxyIdL(aURI)) |
|
5080 { |
|
5081 iCallBack->SetStatusL(aStatusRef,CSmlDmAdapter::EAlreadyExists); |
|
5082 _DBG_FILE("CNSmlInternetAdapter::AddNodeObjectL(): EAlreadyExists end"); |
|
5083 return; |
|
5084 } |
|
5085 |
|
5086 TUint32 iapID = GetAPIdFromURIL(aURI); |
|
5087 |
|
5088 // IAP-table search serviceType (=Bearer) |
|
5089 CCommsDbTableView* iapView = iDatabase->OpenViewMatchingUintLC(TPtrC(IAP), |
|
5090 TPtrC(COMMDB_ID), |
|
5091 iapID); |
|
5092 |
|
5093 TInt errorCode = iapView->GotoFirstRecord(); |
|
5094 |
|
5095 // Read serviceType from (IAP) |
|
5096 if ( errorCode == KErrNone ) |
|
5097 { |
|
5098 iapView->ReadTextL(TPtrC(IAP_SERVICE_TYPE), iProxyServiceType); |
|
5099 iapView->ReadUintL(TPtrC(IAP_SERVICE), iProxyISP); |
|
5100 CleanupStack::PopAndDestroy(); // iapView |
|
5101 } |
|
5102 else if( iapID > 0 && errorCode == KErrNotFound) // Stale data, needs update |
|
5103 { |
|
5104 |
|
5105 CleanupStack::PopAndDestroy(); // iapViewv |
|
5106 _DBG_FILE("CNSmlInternetAdapter::AddNodeObjectL(): stale data for proxy this as new AP "); |
|
5107 AddNodeBufferL(aURI,parentLUID,aStatusRef, EFalse); |
|
5108 iStaleMapUpdate=ETrue; |
|
5109 return; |
|
5110 } |
|
5111 else |
|
5112 { |
|
5113 CleanupStack::PopAndDestroy(); // iapView |
|
5114 iCallBack->SetStatusL(aStatusRef,CSmlDmAdapter::ENotFound); |
|
5115 _DBG_FILE("CNSmlInternetAdapter::AddNodeObjectL(): ENotFound end"); |
|
5116 return; |
|
5117 } |
|
5118 |
|
5119 CCommsDbTableView* proxyTable; |
|
5120 |
|
5121 proxyTable = iDatabase->OpenTableLC(TPtrC(PROXIES)); |
|
5122 |
|
5123 TInt initOK = proxyTable->InsertRecord(iapID); |
|
5124 |
|
5125 TInt retry = KBeginTransRetryCount; |
|
5126 while ( retry > 0 && initOK != KErrNone ) |
|
5127 { |
|
5128 User::After( KBeginTransRetryDelay ); |
|
5129 initOK = proxyTable->InsertRecord( iapID ); |
|
5130 retry--; |
|
5131 } |
|
5132 |
|
5133 if( initOK == KErrNone ) |
|
5134 { |
|
5135 iProxyServerName = LastURISeg(aURI); // Name from URI |
|
5136 initOK = InitializeProxyL( proxyTable ); |
|
5137 |
|
5138 User::After( KBeginTransRetryDelay ); |
|
5139 if ( initOK == KErrNone) |
|
5140 { |
|
5141 TUint32 newId = 0; |
|
5142 initOK = proxyTable->PutRecordChanges(); |
|
5143 |
|
5144 retry = KBeginTransRetryCount; |
|
5145 while ( retry > 0 && initOK != KErrNone ) |
|
5146 { |
|
5147 User::After( KBeginTransRetryDelay ); |
|
5148 initOK = proxyTable->PutRecordChanges(); |
|
5149 retry--; |
|
5150 } |
|
5151 |
|
5152 proxyTable->ReadUintL(TPtrC(COMMDB_ID), newId); |
|
5153 // |
|
5154 // Set mapping-data |
|
5155 // |
|
5156 TBuf8<16> addLUID; |
|
5157 _LIT8(KFormat,"%d"); |
|
5158 addLUID.Format(KFormat,KNSmlApProxyLowerBase + newId); // 100000 + lProxyId |
|
5159 |
|
5160 // Also added to mapping |
|
5161 iCallBack->SetMappingL(aURI,addLUID); |
|
5162 } |
|
5163 else |
|
5164 { |
|
5165 proxyTable->CancelRecordChanges(); |
|
5166 iCallBack->SetStatusL(aStatusRef,CSmlDmAdapter::EError); |
|
5167 _DBG_FILE("CNSmlInternetAdapter::AddNodeObjectL(): EError end"); |
|
5168 } |
|
5169 } |
|
5170 else |
|
5171 { |
|
5172 iCallBack->SetStatusL(aStatusRef,CSmlDmAdapter::EError); |
|
5173 _DBG_FILE("CNSmlInternetAdapter::AddNodeObjectL(): EError end Insert failed"); |
|
5174 } |
|
5175 CleanupStack::PopAndDestroy(); // proxyTable |
|
5176 |
|
5177 } |
|
5178 else if (aURI.Match(_L8("AP/*/Px/*/*"))!= KErrNotFound ) |
|
5179 { |
|
5180 if(parentLUID.Length()<=0) |
|
5181 { |
|
5182 AddNodeBufferL(aURI,parentLUID,aStatusRef, EFalse); |
|
5183 _DBG_FILE("CNSmlInternetAdapter::AddNodeObjectL(): end"); |
|
5184 return; |
|
5185 } |
|
5186 |
|
5187 TInt pluid = IntLUID(parentLUID); |
|
5188 |
|
5189 if(pluid < 0) |
|
5190 { |
|
5191 iCallBack->SetStatusL(aStatusRef,CSmlDmAdapter::EOk); |
|
5192 _DBG_FILE("CNSmlInternetAdapter::AddNodeObjectL(): end"); |
|
5193 return; |
|
5194 } |
|
5195 else |
|
5196 { |
|
5197 TUint32 apID = GetAPIdFromURIL(aURI); |
|
5198 CCommsDbTableView* tableView = iDatabase->OpenViewMatchingUintLC(TPtrC(IAP), |
|
5199 TPtrC(COMMDB_ID), |
|
5200 apID); |
|
5201 TInt errorCode = tableView->GotoFirstRecord(); |
|
5202 CleanupStack::PopAndDestroy(tableView); |
|
5203 if( apID > 0 && errorCode == KErrNotFound) // Stale data, needs update |
|
5204 { |
|
5205 _DBG_FILE("CNSmlInternetAdapter::AddNodeObjectL(): stale data for proxy this as new AP "); |
|
5206 AddNodeBufferL(aURI,parentLUID,aStatusRef, EFalse); |
|
5207 iStaleMapUpdate=ETrue; |
|
5208 return; |
|
5209 } |
|
5210 |
|
5211 } |
|
5212 } |
|
5213 |
|
5214 else if (aURI.Match(_L8("AP/*/Px"))!= KErrNotFound ) |
|
5215 { |
|
5216 if(parentLUID.Length()<=0) |
|
5217 { |
|
5218 AddNodeBufferL(aURI,parentLUID,aStatusRef, EFalse); |
|
5219 return; |
|
5220 } |
|
5221 |
|
5222 TInt pluid = IntLUID(parentLUID); |
|
5223 |
|
5224 if(pluid < 0) |
|
5225 { |
|
5226 iCallBack->SetStatusL(aStatusRef,CSmlDmAdapter::EOk); |
|
5227 _DBG_FILE("CNSmlInternetAdapter::AddNodeObjectL(): end"); |
|
5228 return; |
|
5229 } |
|
5230 else if(pluid == 0) |
|
5231 { |
|
5232 iCallBack->SetStatusL(aStatusRef,CSmlDmAdapter::EError); |
|
5233 _DBG_FILE("CNSmlInternetAdapter::AddNodeObjectL(): EError"); |
|
5234 return; |
|
5235 } |
|
5236 else |
|
5237 { |
|
5238 TUint32 apID = GetAPIdFromURIL(aURI); |
|
5239 CCommsDbTableView* tableView = iDatabase->OpenViewMatchingUintLC(TPtrC(IAP), |
|
5240 TPtrC(COMMDB_ID), |
|
5241 apID); |
|
5242 TInt errorCode = tableView->GotoFirstRecord(); |
|
5243 CleanupStack::PopAndDestroy(tableView); |
|
5244 if( apID > 0 && errorCode == KErrNotFound) // Stale data, needs update |
|
5245 { |
|
5246 _DBG_FILE("CNSmlInternetAdapter::AddNodeObjectL(): stale data for proxy this as new AP "); |
|
5247 AddNodeBufferL(aURI,parentLUID,aStatusRef, EFalse); |
|
5248 iStaleMapUpdate=ETrue; |
|
5249 return; |
|
5250 } |
|
5251 } |
|
5252 } |
|
5253 |
|
5254 else if (aURI.Match(_L8("AP/*/Networks/*" ))!= KErrNotFound && |
|
5255 aURI.Match(_L8("AP/*/Networks/*/*"))== KErrNotFound ) |
|
5256 { |
|
5257 iIAPId = IntLUID(parentLUID); |
|
5258 } |
|
5259 |
|
5260 |
|
5261 |
|
5262 iCallBack->SetStatusL(aStatusRef,CSmlDmAdapter::EOk); |
|
5263 _DBG_FILE("CNSmlInternetAdapter::AddNodeObjectL(): end"); |
|
5264 return; |
|
5265 } |
|
5266 |
|
5267 //------------------------------------------------------------------------------ |
|
5268 // CNSmlInternetAdapter::ExecuteCommandL |
|
5269 // not supported |
|
5270 //------------------------------------------------------------------------------ |
|
5271 |
|
5272 |
|
5273 void CNSmlInternetAdapter::ExecuteCommandL( const TDesC8&/* aURI*/, |
|
5274 const TDesC8& /*aLUID*/, |
|
5275 const TDesC8& /*aArgument*/, |
|
5276 const TDesC8& /*aType*/, |
|
5277 TInt aStatusRef ) |
|
5278 { |
|
5279 _DBG_FILE("CNSmlInternetAdapter::ExecuteCommandL(): begin"); |
|
5280 iCallBack->SetStatusL(aStatusRef, CSmlDmAdapter::EError); |
|
5281 _DBG_FILE("CNSmlInternetAdapter::ExecuteCommandL(): end"); |
|
5282 } |
|
5283 |
|
5284 //------------------------------------------------------------------------------ |
|
5285 // CNSmlInternetAdapter::ExecuteCommandL ( .. RWriteStream ..) |
|
5286 // not supported |
|
5287 //------------------------------------------------------------------------------ |
|
5288 |
|
5289 |
|
5290 void CNSmlInternetAdapter::ExecuteCommandL( const TDesC8& /*aURI*/, |
|
5291 const TDesC8& /*aLUID*/, |
|
5292 RWriteStream*& /*aStream*/, |
|
5293 const TDesC8& /*aType*/, |
|
5294 TInt aStatusref ) |
|
5295 { |
|
5296 _DBG_FILE("CNSmlInternetAdapter::ExecuteCommandL(): begin"); |
|
5297 iCallBack->SetStatusL(aStatusref, CSmlDmAdapter::EError); |
|
5298 _DBG_FILE("CNSmlInternetAdapter::ExecuteCommandL(): end"); |
|
5299 } |
|
5300 |
|
5301 //------------------------------------------------------------------------------ |
|
5302 // CNSmlInternetAdapter::CopyCommandL |
|
5303 // not supported |
|
5304 //------------------------------------------------------------------------------ |
|
5305 |
|
5306 |
|
5307 void CNSmlInternetAdapter::CopyCommandL( const TDesC8& /*aTargetURI*/, |
|
5308 const TDesC8& /*aTargetLUID*/, |
|
5309 const TDesC8& /*aSourceURI*/, |
|
5310 const TDesC8& /*aSourceLUID*/, |
|
5311 const TDesC8& /*aType*/, |
|
5312 TInt aStatusRef ) |
|
5313 { |
|
5314 _DBG_FILE("CNSmlInternetAdapter::CopyCommandL(): begin"); |
|
5315 iCallBack->SetStatusL(aStatusRef, CSmlDmAdapter::EError); |
|
5316 _DBG_FILE("CNSmlInternetAdapter::CopyCommandL(): end"); |
|
5317 } |
|
5318 |
|
5319 //------------------------------------------------------------------------------ |
|
5320 // CNSmlInternetAdapter::StartAtomicL |
|
5321 // not supported |
|
5322 //------------------------------------------------------------------------------ |
|
5323 |
|
5324 |
|
5325 void CNSmlInternetAdapter::StartAtomicL() |
|
5326 { |
|
5327 _DBG_FILE("CNSmlInternetAdapter::StartAtomicL(): begin"); |
|
5328 _DBG_FILE("CNSmlInternetAdapter::StartAtomicL(): end"); |
|
5329 } |
|
5330 |
|
5331 //------------------------------------------------------------------------------ |
|
5332 // CNSmlInternetAdapter::CommitAtomicL |
|
5333 // not supported |
|
5334 //------------------------------------------------------------------------------ |
|
5335 |
|
5336 |
|
5337 void CNSmlInternetAdapter::CommitAtomicL() |
|
5338 { |
|
5339 _DBG_FILE("CNSmlInternetAdapter::CommitAtomicL(): begin"); |
|
5340 _DBG_FILE("CNSmlInternetAdapter::CommitAtomicL(): end"); |
|
5341 } |
|
5342 |
|
5343 //------------------------------------------------------------------------------ |
|
5344 // CNSmlInternetAdapter::RollbackAtomicL |
|
5345 // not supported |
|
5346 //------------------------------------------------------------------------------ |
|
5347 |
|
5348 void CNSmlInternetAdapter::RollbackAtomicL() |
|
5349 { |
|
5350 _DBG_FILE("CNSmlInternetAdapter::RollbackAtomicL(): begin"); |
|
5351 _DBG_FILE("CNSmlInternetAdapter::RollbackAtomicL(): end"); |
|
5352 } |
|
5353 |
|
5354 //------------------------------------------------------------------------------ |
|
5355 // CNSmlInternetAdapter::StreamingSupport |
|
5356 // returns EFalse |
|
5357 //------------------------------------------------------------------------------ |
|
5358 |
|
5359 TBool CNSmlInternetAdapter::StreamingSupport( TInt& /*aItemSize*/ ) |
|
5360 { |
|
5361 _DBG_FILE("CNSmlInternetAdapter::StreamingSupport(): begin"); |
|
5362 _DBG_FILE("CNSmlInternetAdapter::StreamingSupport(): end"); |
|
5363 return EFalse; |
|
5364 } |
|
5365 |
|
5366 //------------------------------------------------------------------------------ |
|
5367 // CNSmlInternetAdapter::StreamCommittedL |
|
5368 // not used in this adapter |
|
5369 //------------------------------------------------------------------------------ |
|
5370 |
|
5371 void CNSmlInternetAdapter::StreamCommittedL() |
|
5372 { |
|
5373 _DBG_FILE("CNSmlInternetAdapter::StreamCommittedL(): begin"); |
|
5374 _DBG_FILE("CNSmlInternetAdapter::StreamCommittedL(): end"); |
|
5375 } |
|
5376 |
|
5377 //------------------------------------------------------------------------------ |
|
5378 // CNSmlInternetAdapter::CompleteOutstandingCmdsL |
|
5379 // |
|
5380 //------------------------------------------------------------------------------ |
|
5381 void CNSmlInternetAdapter::CompleteOutstandingCmdsL() |
|
5382 { |
|
5383 |
|
5384 _DBG_FILE("CNSmlInternetAdapter::CompleteOutstandingCmdsL(): begin"); |
|
5385 // |
|
5386 // Handle possible unhandled buffered nodes |
|
5387 // |
|
5388 if( !iDatabase->InTransaction() ) |
|
5389 { |
|
5390 _DBG_FILE("CompleteOutstandingCmds: Try first begintransaction."); |
|
5391 TInt err = iDatabase->BeginTransaction(); |
|
5392 if( err == KErrLocked ) |
|
5393 { |
|
5394 _DBG_FILE("CompleteOutstandingCmds: CommsDat was locked."); |
|
5395 TInt retry = KBeginTransRetryCount; |
|
5396 while ( retry > 0 && err == KErrLocked ) |
|
5397 { |
|
5398 User::After(KBeginTransRetryDelay); |
|
5399 _DBG_FILE("CompleteOutstandingCmds: Slept 1 second. Try again"); |
|
5400 err = iDatabase->BeginTransaction(); |
|
5401 retry--; |
|
5402 } |
|
5403 if(err != KErrNone) |
|
5404 { |
|
5405 _DBG_FILE("CNSmlInternetAdapter: BeginTransaction failed completely."); |
|
5406 User::Leave( err ); |
|
5407 } |
|
5408 } |
|
5409 } |
|
5410 _DBG_FILE("CompleteOutstandingCmds: BeginTransaction was successful"); |
|
5411 |
|
5412 iDnsIpv4Pri = 0; |
|
5413 iDnsIpv6Pri = 0; |
|
5414 _LIT8( KDummy, "/Dummy" ); |
|
5415 for(TInt h = iBuffer->Count()-1; h >= 0; h--) // Through buffers |
|
5416 { |
|
5417 TBuf8<80> commandURI; |
|
5418 commandURI.Append(iBuffer->At(h).iMappingName->Des()); |
|
5419 commandURI.Append( KDummy ); // Removed on execution |
|
5420 ExecuteBufferL(commandURI, ETrue); |
|
5421 } |
|
5422 iDnsUpdate = EFalse; |
|
5423 iDnsIpv4Pri = 0; |
|
5424 iDnsIpv6Pri = 0; |
|
5425 iBuffer->Reset(); |
|
5426 |
|
5427 if ( iWlanSupported ) |
|
5428 { |
|
5429 iWlanAdapter->CompleteOutstandingCmdsL(); // Execute possible unhandled WLAN commands |
|
5430 } |
|
5431 |
|
5432 iNetworkId = KErrNotFound; |
|
5433 |
|
5434 iDatabase->CommitTransaction(); |
|
5435 iTransactionCommitted = ETrue; |
|
5436 _DBG_FILE("CNSmlInternetAdapter::CompleteOutstandingCmdsL(): end"); |
|
5437 } |
|
5438 |
|
5439 //============================================= |
|
5440 // CNSmlInternetAdapter::GetAPField() |
|
5441 // Match URI fieldname to |
|
5442 // CommsDb table and column |
|
5443 // |
|
5444 //============================================= |
|
5445 TBool CNSmlInternetAdapter::GetAPField(TPtrC& aTableName,TPtrC& aColumn) const |
|
5446 { |
|
5447 _DBG_FILE("CNSmlInternetAdapter::GetAPField(): Start"); |
|
5448 |
|
5449 TBool fRet = EFalse; |
|
5450 |
|
5451 aColumn.Set(TPtrC(KNullDesC)); |
|
5452 |
|
5453 if (iField->Compare(KNSmlDdfAuthName) == 0) |
|
5454 { |
|
5455 if( aTableName == TPtrC(OUTGOING_GPRS) || |
|
5456 aTableName == TPtrC(INCOMING_GPRS)) |
|
5457 { |
|
5458 aColumn.Set(TPtrC(SERVICE_IF_AUTH_NAME)); |
|
5459 } |
|
5460 else |
|
5461 { |
|
5462 return fRet; |
|
5463 } |
|
5464 fRet = ETrue; |
|
5465 } |
|
5466 else if (iField->Compare(KNSmlDdfNAPName) == 0) |
|
5467 { |
|
5468 aColumn.Set(TPtrC(COMMDB_NAME)); |
|
5469 fRet = ETrue; |
|
5470 } |
|
5471 else if (iField->Compare(KNSmlDdfToNAPIDL) == 0) |
|
5472 { |
|
5473 aColumn.Set(TPtrC(COMMDB_ID)); |
|
5474 fRet = ETrue; |
|
5475 } |
|
5476 else if (iField->Compare(KNSmlDdfNAPID) == 0) |
|
5477 { |
|
5478 aColumn.Set(TPtrC(COMMDB_ID)); |
|
5479 fRet = ETrue; |
|
5480 } |
|
5481 else if (iField->Compare(KNSmlDdfPxId) == 0) |
|
5482 { |
|
5483 aColumn.Set(TPtrC(COMMDB_ID)); |
|
5484 fRet = ETrue; |
|
5485 } |
|
5486 else if (iField->Compare(KNSmlDdfPxAddr) == 0) |
|
5487 { |
|
5488 aTableName.Set(TPtrC(PROXIES)); |
|
5489 aColumn.Set(TPtrC(PROXY_SERVER_NAME)); |
|
5490 fRet = ETrue; |
|
5491 } |
|
5492 else if (iField->Compare(KNSmlDdfNAPAddrTy) == 0) // Is valid |
|
5493 { |
|
5494 return fRet; |
|
5495 } |
|
5496 else if (iField->Compare(KNSmlDdfDNSAddrL) == 0) |
|
5497 { |
|
5498 fRet = ETrue; |
|
5499 } |
|
5500 else if (iField->Compare(KNSmlDdfDNSPriority) == 0) |
|
5501 { |
|
5502 fRet = ETrue; |
|
5503 } |
|
5504 else if (iField->Compare(KNSmlDdfDNSAddrTy) == 0) |
|
5505 { |
|
5506 fRet = ETrue; |
|
5507 } |
|
5508 else if (iField->Compare(KNSmlDdfNAPAddr) == 0) |
|
5509 { |
|
5510 if( aTableName == TPtrC(OUTGOING_GPRS) || |
|
5511 aTableName == TPtrC(INCOMING_GPRS)) |
|
5512 { |
|
5513 aColumn.Set(TPtrC(GPRS_APN)); // GPRS_PDP_ADDRESS |
|
5514 } |
|
5515 else if(aTableName == TPtrC(LAN_SERVICE)) // Wlan ADD |
|
5516 { |
|
5517 aColumn.Set(TPtrC(ISP_IP_ADDR)); |
|
5518 // Leni: Should this be LAN_IP_ADDR ?? |
|
5519 } |
|
5520 else |
|
5521 { |
|
5522 return fRet; |
|
5523 } |
|
5524 fRet = ETrue; |
|
5525 } |
|
5526 else if (iField->Compare(KNSmlDdfBearerL) == 0) |
|
5527 { |
|
5528 aTableName.Set(TPtrC(IAP)); |
|
5529 fRet = ETrue; |
|
5530 } |
|
5531 else if (iField->Compare(KNSmlDdfDirection) == 0) |
|
5532 { |
|
5533 aTableName.Set(TPtrC(IAP)); |
|
5534 fRet = ETrue; |
|
5535 } |
|
5536 else if (iField->Compare(KNSmlDdfAuthSecr) == 0) |
|
5537 { |
|
5538 if( aTableName == TPtrC(OUTGOING_GPRS) || |
|
5539 aTableName == TPtrC(INCOMING_GPRS)) |
|
5540 { |
|
5541 aColumn.Set(TPtrC(SERVICE_IF_AUTH_PASS)); |
|
5542 } |
|
5543 else |
|
5544 { |
|
5545 return fRet; // NotValid |
|
5546 } |
|
5547 fRet = ETrue; |
|
5548 } |
|
5549 else if (iField->Compare(KNSmlDdfPortNbr) == 0) |
|
5550 { |
|
5551 if(iWapPort) |
|
5552 { |
|
5553 aTableName.Set(TPtrC(WAP_IP_BEARER)); |
|
5554 aColumn.Set(TPtrC(WAP_PROXY_PORT)); |
|
5555 } |
|
5556 else |
|
5557 { |
|
5558 aTableName.Set(TPtrC(PROXIES)); |
|
5559 aColumn.Set(TPtrC(PROXY_PORT_NUMBER)); |
|
5560 } |
|
5561 fRet = ETrue; |
|
5562 } |
|
5563 else if (iField->Compare(KNSmlDdfStartpg) == 0) |
|
5564 { |
|
5565 aTableName.Set(TPtrC(WAP_ACCESS_POINT)); |
|
5566 aColumn.Set(TPtrC(WAP_START_PAGE)); |
|
5567 fRet = ETrue; |
|
5568 } |
|
5569 else if (iField->Compare(KNSmlDdfPxAuthId) == 0) // No KNSmlDdfBasAuthId |
|
5570 { |
|
5571 aTableName.Set(TPtrC(WAP_IP_BEARER)); |
|
5572 aColumn.Set(TPtrC(WAP_PROXY_LOGIN_NAME)); |
|
5573 fRet = ETrue; |
|
5574 } |
|
5575 else if (iField->Compare(KNSmlDdfPxAuthPW) == 0) // No KNSmlDdfBasAuthPW |
|
5576 { |
|
5577 aTableName.Set(TPtrC(WAP_IP_BEARER)); |
|
5578 aColumn.Set(TPtrC(WAP_PROXY_LOGIN_PASS)); |
|
5579 fRet = ETrue; |
|
5580 } |
|
5581 else if (iField->Compare(KNSmlDdfUsePTxtLog) == 0) |
|
5582 { |
|
5583 if( aTableName == TPtrC(OUTGOING_GPRS) || |
|
5584 aTableName == TPtrC(INCOMING_GPRS)) |
|
5585 { |
|
5586 aColumn.Set(TPtrC(SERVICE_DISABLE_PLAIN_TEXT_AUTH)); |
|
5587 fRet = ETrue; |
|
5588 } |
|
5589 else |
|
5590 { |
|
5591 return fRet; // NotValid |
|
5592 } |
|
5593 } |
|
5594 else if (iField->Compare(KNSmlDdfDefGW) == 0) |
|
5595 { |
|
5596 aColumn.Set(TPtrC(SERVICE_IP_GATEWAY)); |
|
5597 fRet = ETrue; |
|
5598 } |
|
5599 else if (iField->Compare(KNSmlDdfNetworkMask) == 0) |
|
5600 { |
|
5601 aColumn.Set(TPtrC(SERVICE_IP_NETMASK)); |
|
5602 fRet = ETrue; |
|
5603 } |
|
5604 else if (iField->Compare(KNSmlDdfNetworkID) == 0) |
|
5605 { |
|
5606 aColumn.Set(TPtrC(COMMDB_ID)); |
|
5607 fRet = ETrue; |
|
5608 } |
|
5609 else if (iField->Compare(KNSmlDdfPPPComp) == 0) |
|
5610 { |
|
5611 if( aTableName == TPtrC(OUTGOING_GPRS) || |
|
5612 aTableName == TPtrC(INCOMING_GPRS)) |
|
5613 { |
|
5614 aColumn.Set(TPtrC(GPRS_DATA_COMPRESSION)); |
|
5615 } |
|
5616 else |
|
5617 { |
|
5618 return fRet; // NotValid |
|
5619 } |
|
5620 fRet = ETrue; |
|
5621 } |
|
5622 else if (iField->Compare(KNSmlDdfGPRSPDP) == 0) |
|
5623 { |
|
5624 if( aTableName == TPtrC(OUTGOING_GPRS) || |
|
5625 aTableName == TPtrC(INCOMING_GPRS)) |
|
5626 { |
|
5627 aColumn.Set(TPtrC(GPRS_PDP_TYPE)); |
|
5628 } |
|
5629 else |
|
5630 { |
|
5631 return fRet; // NotValid |
|
5632 } |
|
5633 fRet = ETrue; |
|
5634 } |
|
5635 else if (iField->Compare(KNSmlDdfNoPxForL) == 0) |
|
5636 { |
|
5637 aColumn.Set(TPtrC(PROXY_EXCEPTIONS)); |
|
5638 fRet = ETrue; |
|
5639 } |
|
5640 else if (iField->Compare(KNSmlDdfDomainL) == 0) |
|
5641 { |
|
5642 aColumn.Set(TPtrC(PROXY_PROTOCOL_NAME)); |
|
5643 fRet = ETrue; |
|
5644 } |
|
5645 else if (iField->Compare(KNSmlDdfIPAddrFromServer) == 0) |
|
5646 { |
|
5647 aColumn.Set(TPtrC(SERVICE_IP_ADDR_FROM_SERVER)); |
|
5648 fRet = ETrue; |
|
5649 } |
|
5650 else if (iField->Compare(KNSmlDdfIPAddr) == 0) |
|
5651 { |
|
5652 aColumn.Set(TPtrC(SERVICE_IP_ADDR)); |
|
5653 fRet = ETrue; |
|
5654 } |
|
5655 else if (iField->Compare(KNSmlDdfDNSAddrFromServer) == 0) |
|
5656 { |
|
5657 aColumn.Set(TPtrC(SERVICE_IP_DNS_ADDR_FROM_SERVER)); |
|
5658 fRet = ETrue; |
|
5659 } |
|
5660 else if (iField->Compare(KNSmlDdfIPv6DNSAddrFromServer) == 0) |
|
5661 { |
|
5662 aColumn.Set(TPtrC(SERVICE_IP6_DNS_ADDR_FROM_SERVER)); |
|
5663 fRet = ETrue; |
|
5664 } |
|
5665 else if (iField->Compare(KNSmlDdfIfNetworks) == 0) |
|
5666 { |
|
5667 aColumn.Set(TPtrC(SERVICE_IF_NETWORKS)); |
|
5668 fRet = ETrue; |
|
5669 } |
|
5670 else if (iField->Compare(KNSmlDdfIAPService) == 0) |
|
5671 { |
|
5672 aColumn.Set(TPtrC(IAP_SERVICE)); |
|
5673 fRet = ETrue; |
|
5674 } |
|
5675 |
|
5676 else if (iField->Compare(KNSmlDdfIAPSeamlessness) == 0) |
|
5677 { |
|
5678 fRet= ETrue; |
|
5679 } |
|
5680 else if (iField->Compare(KNSmlDdfIAPMetaData) == 0) |
|
5681 { |
|
5682 fRet= ETrue; |
|
5683 } |
|
5684 |
|
5685 DBG_ARGS(_S16("GetAPField: aURI - %S - %S - %S"),&aTableName, &aColumn, &*iField); |
|
5686 |
|
5687 _DBG_FILE("CNSmlInternetAdapter::GetAPField(): EOk"); |
|
5688 |
|
5689 return fRet; |
|
5690 } |
|
5691 |
|
5692 //============================================= |
|
5693 // CNSmlInternetAdapter::GetAPFieldType() |
|
5694 // Match fieldtype to Commsdb-database |
|
5695 // |
|
5696 //============================================= |
|
5697 CNSmlInternetAdapter::TNSmlAPFieldType CNSmlInternetAdapter::GetAPFieldType( const TDesC8& aURI ) const |
|
5698 { |
|
5699 if (iField->Compare(KNSmlDdfBearerL) == 0) |
|
5700 { |
|
5701 return CNSmlInternetAdapter::ESpec; |
|
5702 } |
|
5703 else if (iField->Compare(KNSmlDdfDirection) == 0) |
|
5704 { |
|
5705 return CNSmlInternetAdapter::ESpec; |
|
5706 } |
|
5707 else if (iField->Compare(KNSmlDdfBearer) == 0) |
|
5708 { |
|
5709 return CNSmlInternetAdapter::EInt; |
|
5710 } |
|
5711 else if (iField->Compare(KNSmlDdfToNAPIDL) == 0) |
|
5712 { |
|
5713 return CNSmlInternetAdapter::EInt; |
|
5714 } |
|
5715 else if (iField->Compare(KNSmlDdfNAPID) == 0) |
|
5716 { |
|
5717 return CNSmlInternetAdapter::EInt; |
|
5718 } |
|
5719 else if (iField->Compare(KNSmlDdfPxId) == 0) |
|
5720 { |
|
5721 return CNSmlInternetAdapter::EInt; |
|
5722 } |
|
5723 else if (iField->Compare(KNSmlDdfAuthName) == 0) |
|
5724 { |
|
5725 return CNSmlInternetAdapter::EStr; |
|
5726 } |
|
5727 else if (iField->Compare(KNSmlDdfNAPName) == 0 || |
|
5728 iField->Compare(KNSmlDdfPxName) == 0 || |
|
5729 iField->Compare(KNSmlDdfNetworkName) == 0 ) |
|
5730 { |
|
5731 if( aURI.Match(_L8("AP/*/Px/*/Name")) != KErrNotFound |
|
5732 || aURI.Match(_L8("AP/*/Networks/*/Name"))!= KErrNotFound ) |
|
5733 { |
|
5734 return CNSmlInternetAdapter::EStr; |
|
5735 } |
|
5736 else |
|
5737 { |
|
5738 return CNSmlInternetAdapter::ESpec; // For NAPName |
|
5739 } |
|
5740 } |
|
5741 else if (iField->Compare(KNSmlDdfNAPAddrTy) == 0) |
|
5742 { |
|
5743 return CNSmlInternetAdapter::EInt; |
|
5744 } |
|
5745 else if (iField->Compare(KNSmlDdfNAPAddr) == 0) |
|
5746 { |
|
5747 return CNSmlInternetAdapter::EStr; |
|
5748 } |
|
5749 else if (iField->Compare(KNSmlDdfStartpg) == 0) |
|
5750 { |
|
5751 return CNSmlInternetAdapter::EWap; |
|
5752 } |
|
5753 else if (iField->Compare(KNSmlDdfPxAuthId) == 0) |
|
5754 { |
|
5755 return CNSmlInternetAdapter::EWap; |
|
5756 } |
|
5757 else if (iField->Compare(KNSmlDdfPxAuthPW) == 0) |
|
5758 { |
|
5759 return CNSmlInternetAdapter::EWap; |
|
5760 } |
|
5761 else if (iField->Compare(KNSmlDdfPxAddr) == 0) |
|
5762 { |
|
5763 return CNSmlInternetAdapter::EStr; |
|
5764 } |
|
5765 else if (iField->Compare(KNSmlDdfDNSAddrFromServer) == 0) |
|
5766 { |
|
5767 return CNSmlInternetAdapter::EBool; |
|
5768 } |
|
5769 else if (iField->Compare(KNSmlDdfIPv6DNSAddrFromServer) == 0) |
|
5770 { |
|
5771 return CNSmlInternetAdapter::EBool; |
|
5772 } |
|
5773 else if (iField->Compare(KNSmlDdfDNSAddrL) == 0) |
|
5774 { |
|
5775 return CNSmlInternetAdapter::EStr; |
|
5776 } |
|
5777 else if (iField->Compare(KNSmlDdfDNSAddrTy) == 0) |
|
5778 { |
|
5779 return CNSmlInternetAdapter::EStr; |
|
5780 } |
|
5781 else if (iField->Compare(KNSmlDdfDNSPriority) == 0) |
|
5782 { |
|
5783 return CNSmlInternetAdapter::EStr; |
|
5784 } |
|
5785 else if (iField->Compare(KNSmlDdfPxName) == 0) |
|
5786 { |
|
5787 return CNSmlInternetAdapter::EStr; |
|
5788 } |
|
5789 else if (iField->Compare(KNSmlDdfAuthSecr) == 0) |
|
5790 { |
|
5791 return CNSmlInternetAdapter::EStr; |
|
5792 } |
|
5793 else if (iField->Compare(KNSmlDdfPxId) == 0) |
|
5794 { |
|
5795 return CNSmlInternetAdapter::EInt; |
|
5796 } |
|
5797 else if (iField->Compare(KNSmlDdfPxPW) == 0) |
|
5798 { |
|
5799 return CNSmlInternetAdapter::EStr; |
|
5800 } |
|
5801 else if (iField->Compare(KNSmlDdfPortNbr) == 0) |
|
5802 { |
|
5803 if(iWapPort) // Different handlig for WAP and Proxy PortNbr |
|
5804 { |
|
5805 return CNSmlInternetAdapter::EWap; |
|
5806 } |
|
5807 else |
|
5808 { |
|
5809 return CNSmlInternetAdapter::EInt; |
|
5810 } |
|
5811 } |
|
5812 else if (iField->Compare(KNSmlDdfUsePTxtLog) == 0) |
|
5813 { |
|
5814 return CNSmlInternetAdapter::EBool; |
|
5815 } |
|
5816 else if (iField->Compare(KNSmlDdfDefGW) == 0) |
|
5817 { |
|
5818 return CNSmlInternetAdapter::EStr; |
|
5819 } |
|
5820 else if (iField->Compare(KNSmlDdfNetworkMask) == 0) |
|
5821 { |
|
5822 return CNSmlInternetAdapter::EStr; |
|
5823 } |
|
5824 else if (iField->Compare(KNSmlDdfNetworkID) == 0) |
|
5825 { |
|
5826 return CNSmlInternetAdapter::EInt; |
|
5827 } |
|
5828 else if (iField->Compare(KNSmlDdfPPPComp) == 0) |
|
5829 { |
|
5830 return CNSmlInternetAdapter::EBool; |
|
5831 } |
|
5832 else if (iField->Compare(KNSmlDdfGPRSPDP) == 0) |
|
5833 { |
|
5834 return CNSmlInternetAdapter::EInt; |
|
5835 } |
|
5836 else if (iField->Compare(KNSmlDdfDomainL) == 0) |
|
5837 { |
|
5838 return CNSmlInternetAdapter::EStr; |
|
5839 } |
|
5840 else if (iField->Compare(KNSmlDdfNoPxForL) == 0) |
|
5841 { |
|
5842 return CNSmlInternetAdapter::ESpec; |
|
5843 } |
|
5844 else if (iField->Compare(KNSmlDdfIPAddrFromServer) == 0) |
|
5845 { |
|
5846 return CNSmlInternetAdapter::EBool; |
|
5847 } |
|
5848 else if (iField->Compare(KNSmlDdfIPAddr) == 0) |
|
5849 { |
|
5850 return EStr; |
|
5851 } |
|
5852 else if (iField->Compare(KNSmlDdfIfNetworks) == 0) |
|
5853 { |
|
5854 return CNSmlInternetAdapter::EStr; |
|
5855 } |
|
5856 else if (iField->Compare(KNSmlDdfIAPService) == 0) |
|
5857 { |
|
5858 return CNSmlInternetAdapter::ESpec; |
|
5859 } |
|
5860 |
|
5861 else if (iField->Compare(KNSmlDdfIAPSeamlessness) == 0) |
|
5862 { |
|
5863 return CNSmlInternetAdapter::EInt; |
|
5864 } |
|
5865 else if (iField->Compare(KNSmlDdfIAPMetaData) == 0) |
|
5866 { |
|
5867 return CNSmlInternetAdapter::EInt; |
|
5868 } |
|
5869 |
|
5870 _DBG_FILE("CNSmlInternetAdapter::GetAPFieldType(): Error"); |
|
5871 |
|
5872 return EWrong; |
|
5873 } |
|
5874 |
|
5875 //------------------------------------------------------------------------------ |
|
5876 // |
|
5877 //------------------------------------------------------------------------------ |
|
5878 #ifndef IMPLEMENTATION_PROXY_ENTRY |
|
5879 #define IMPLEMENTATION_PROXY_ENTRY(aUid, aFuncPtr) {{aUid},(aFuncPtr)} |
|
5880 #endif |
|
5881 |
|
5882 const TImplementationProxy ImplementationTable[] = |
|
5883 { |
|
5884 IMPLEMENTATION_PROXY_ENTRY(0x101F6DE2, CNSmlInternetAdapter::NewL) |
|
5885 }; |
|
5886 |
|
5887 //------------------------------------------------------------------------------ |
|
5888 // TImplementationProxy* ImplementationGroupProxy() |
|
5889 //------------------------------------------------------------------------------ |
|
5890 EXPORT_C const TImplementationProxy* ImplementationGroupProxy( TInt& aTableCount ) |
|
5891 { |
|
5892 _DBG_FILE("ImplementationGroupProxy() for CNSmlInternetAdapter: begin"); |
|
5893 |
|
5894 aTableCount = sizeof(ImplementationTable) / sizeof(TImplementationProxy); |
|
5895 |
|
5896 _DBG_FILE("ImplementationGroupProxy() for CNSmlInternetAdapter: end"); |
|
5897 return ImplementationTable; |
|
5898 } |
|
5899 |
|
5900 //============================================= |
|
5901 // CNSmlInternetAdapter::IntLUID() |
|
5902 // Returns IntValue for aLUID |
|
5903 //============================================= |
|
5904 TInt CNSmlInternetAdapter::IntLUID(const TDesC8& aLUID) |
|
5905 { |
|
5906 TLex8 lex(aLUID); |
|
5907 |
|
5908 if (lex.Val(iLUID) == KErrNone) |
|
5909 { |
|
5910 if ((iLUID > KNSmlApProxyUpperBase) && |
|
5911 (iLUID < KNSmlApDnsLuidUpperBase )) |
|
5912 { |
|
5913 iLUID = iLUID - KNSmlApProxyUpperBase; |
|
5914 } |
|
5915 else if ((iLUID > KNSmlApProxyLowerBase) && |
|
5916 (iLUID < KNSmlApProxyUpperBase )) |
|
5917 { |
|
5918 iProxyId = iLUID - KNSmlApProxyLowerBase; // Proxy |
|
5919 iLUID = iProxyId; |
|
5920 } |
|
5921 else if ((iLUID > KNSmlAp3gpppsLowerBase ) && |
|
5922 (iLUID <= KNSmlApProxyLowerBase) ) |
|
5923 { |
|
5924 iLUID = iLUID - KNSmlAp3gpppsLowerBase; |
|
5925 i3GPPPS = ETrue; |
|
5926 } |
|
5927 else |
|
5928 { |
|
5929 iProxyId = 0; |
|
5930 } |
|
5931 return iLUID; |
|
5932 } |
|
5933 else |
|
5934 { |
|
5935 return 0; |
|
5936 } |
|
5937 } |
|
5938 |
|
5939 //============================================= |
|
5940 // CNSmlInternetAdapter::GetIntObject8() |
|
5941 // Returns IntValue for aObject |
|
5942 //============================================= |
|
5943 TInt CNSmlInternetAdapter::GetIntObject8(const TDesC8& aObject) |
|
5944 { |
|
5945 TLex8 lex(aObject); |
|
5946 |
|
5947 TInt lValue = 0; |
|
5948 |
|
5949 if (lex.Val(lValue) == KErrNone) |
|
5950 { |
|
5951 return lValue; |
|
5952 } |
|
5953 else |
|
5954 { |
|
5955 return lValue; |
|
5956 } |
|
5957 } |
|
5958 //============================================= |
|
5959 // CNSmlInternetAdapter::SetIntObjectLC() |
|
5960 // Returns IntValue for aObject |
|
5961 //============================================= |
|
5962 TDesC8& CNSmlInternetAdapter::SetIntObjectLC(const TInt& aObject) |
|
5963 { |
|
5964 HBufC8* buf = HBufC8::NewLC(8); |
|
5965 TPtr8 ptrBuf = buf->Des(); |
|
5966 |
|
5967 ptrBuf.Num(aObject); |
|
5968 |
|
5969 return *buf; |
|
5970 } |
|
5971 |
|
5972 //============================================= |
|
5973 // CNSmlInternetAdapter::NotValidStrLenght() |
|
5974 // False if datalength is valid |
|
5975 //============================================= |
|
5976 TBool CNSmlInternetAdapter::NotValidStrLenght(const TDesC& aSource) |
|
5977 { |
|
5978 TInt len = aSource.Length(); |
|
5979 TBool theBool = EFalse; |
|
5980 |
|
5981 if(len > KCommsDbSvrMaxFieldLength) |
|
5982 { |
|
5983 theBool = ETrue; |
|
5984 } |
|
5985 return theBool; |
|
5986 } |
|
5987 |
|
5988 //============================================= |
|
5989 // CNSmlInternetAdapter::SetField() |
|
5990 // String after last '/' is returned |
|
5991 // |
|
5992 //============================================= |
|
5993 TInt CNSmlInternetAdapter::SetField( const TDesC8& aSource ) |
|
5994 { |
|
5995 if (aSource.LocateReverse('/') == KErrNotFound) |
|
5996 { |
|
5997 iField->Des().Format(aSource); |
|
5998 } |
|
5999 else |
|
6000 { |
|
6001 iField->Des().Format(aSource.Mid(aSource.LocateReverse('/')+1)); |
|
6002 } |
|
6003 |
|
6004 return KErrNone; |
|
6005 } |
|
6006 |
|
6007 //============================================= |
|
6008 // CNSmlInternetAdapter::ConvertTo8LC() |
|
6009 // Converts string value to 8-bit |
|
6010 // |
|
6011 //============================================= |
|
6012 TDesC8& CNSmlInternetAdapter::ConvertTo8LC( const TDesC& aSource ) |
|
6013 { |
|
6014 HBufC8* buf = HBufC8::NewLC( aSource.Length()*2); |
|
6015 TPtr8 bufPtr = buf->Des(); |
|
6016 CnvUtfConverter::ConvertFromUnicodeToUtf8( bufPtr, aSource ); |
|
6017 |
|
6018 return *buf; |
|
6019 } |
|
6020 |
|
6021 //============================================= |
|
6022 // CNSmlInternetAdapter::ConvertTo16LC() |
|
6023 // Converts string value to 16-bit |
|
6024 // |
|
6025 //============================================= |
|
6026 TDesC16& CNSmlInternetAdapter::ConvertTo16LC( const TDesC8& aSource) |
|
6027 { |
|
6028 HBufC16* buf16 = HBufC16::NewLC( aSource.Length() ); |
|
6029 TPtr bufPtr16 = buf16->Des(); |
|
6030 |
|
6031 CnvUtfConverter::ConvertToUnicodeFromUtf8(bufPtr16, aSource); |
|
6032 |
|
6033 return *buf16; |
|
6034 } |
|
6035 |
|
6036 |
|
6037 //============================================= |
|
6038 // CNSmlInternetAdapter::InitializeGPRSL() |
|
6039 // Initialize GPRS-data before insert |
|
6040 // |
|
6041 //============================================= |
|
6042 TInt CNSmlInternetAdapter::InitializeGPRSL( CCommsDbTableView* aTable ) |
|
6043 { |
|
6044 TBuf<KCommsDbSvrMaxFieldLength> user; |
|
6045 TBuf<KCommsDbSvrMaxFieldLength> pass; |
|
6046 |
|
6047 _LIT(Kdns6Address, "0:0:0:0:0:0:0:0"); |
|
6048 _LIT(KgifNetworks,"ip"); |
|
6049 |
|
6050 // COMMON DATA |
|
6051 aTable->WriteBoolL(TPtrC(SERVICE_DISABLE_PLAIN_TEXT_AUTH),EFalse); |
|
6052 |
|
6053 aTable->WriteTextL(TPtrC(GPRS_IF_NETWORKS), KgifNetworks); |
|
6054 |
|
6055 aTable->WriteTextL(TPtrC(COMMDB_NAME), ConvertTo16LC(iIAPName)); // Same as IAP |
|
6056 CleanupStack::PopAndDestroy(); //ConvertTo16LC |
|
6057 |
|
6058 aTable->WriteBoolL(TPtrC(GPRS_IF_PROMPT_FOR_AUTH), EFalse); |
|
6059 aTable->WriteTextL(TPtrC(GPRS_IF_AUTH_NAME), user); |
|
6060 aTable->WriteTextL(TPtrC(GPRS_IF_AUTH_PASS), pass); |
|
6061 |
|
6062 aTable->WriteBoolL(TPtrC(GPRS_IP_ADDR_FROM_SERVER), ETrue ); |
|
6063 aTable->WriteTextL(TPtrC(GPRS_IP_ADDR), KNSmlEmptyIpv4Address); |
|
6064 |
|
6065 aTable->WriteBoolL(TPtrC(GPRS_IP_DNS_ADDR_FROM_SERVER), ETrue ); |
|
6066 aTable->WriteTextL(TPtrC(GPRS_IP_NAME_SERVER1), KNSmlEmptyIpv4Address); |
|
6067 aTable->WriteTextL(TPtrC(GPRS_IP_NAME_SERVER2), KNSmlEmptyIpv4Address); |
|
6068 |
|
6069 aTable->WriteBoolL(TPtrC(GPRS_IP6_DNS_ADDR_FROM_SERVER), ETrue ); |
|
6070 aTable->WriteTextL(TPtrC(GPRS_IP6_NAME_SERVER1), Kdns6Address); |
|
6071 aTable->WriteTextL(TPtrC(GPRS_IP6_NAME_SERVER2), Kdns6Address); |
|
6072 // GPRS DATA |
|
6073 |
|
6074 aTable->WriteTextL(TPtrC(GPRS_APN), ConvertTo16LC(iIAPName)); // Same as IAP |
|
6075 CleanupStack::PopAndDestroy(); //ConvertTo16LC |
|
6076 |
|
6077 aTable->WriteUintL(TPtrC(GPRS_REQ_PRECEDENCE), 0); |
|
6078 aTable->WriteUintL(TPtrC(GPRS_REQ_DELAY), 0); |
|
6079 aTable->WriteUintL(TPtrC(GPRS_REQ_RELIABILITY), 0); |
|
6080 aTable->WriteUintL(TPtrC(GPRS_REQ_PEAK_THROUGHPUT), 0); |
|
6081 aTable->WriteUintL(TPtrC(GPRS_REQ_MEAN_THROUGHPUT), 0); |
|
6082 aTable->WriteUintL(TPtrC(GPRS_MIN_PRECEDENCE), 0); |
|
6083 aTable->WriteUintL(TPtrC(GPRS_MIN_DELAY), 0); |
|
6084 aTable->WriteUintL(TPtrC(GPRS_MIN_RELIABILITY), 0); |
|
6085 aTable->WriteUintL(TPtrC(GPRS_MIN_PEAK_THROUGHPUT), 0); |
|
6086 aTable->WriteUintL(TPtrC(GPRS_MIN_MEAN_THROUGHPUT), 0); |
|
6087 |
|
6088 aTable->WriteUintL(TPtrC(GPRS_IF_AUTH_RETRIES), 0); |
|
6089 |
|
6090 aTable->WriteBoolL(TPtrC(GPRS_DATA_COMPRESSION), EFalse ); |
|
6091 aTable->WriteUintL(TPtrC(GPRS_PDP_TYPE), RPacketContext::EPdpTypeIPv4); // IPV4 |
|
6092 |
|
6093 aTable->WriteBoolL(TPtrC(GPRS_ENABLE_LCP_EXTENSIONS), EFalse ); |
|
6094 aTable->WriteBoolL(TPtrC(GPRS_ANONYMOUS_ACCESS), EFalse ); |
|
6095 aTable->WriteBoolL(TPtrC(GPRS_HEADER_COMPRESSION), EFalse ); |
|
6096 |
|
6097 aTable->WriteBoolL(TPtrC(GPRS_IP_ADDR_FROM_SERVER), ETrue ); |
|
6098 aTable->WriteTextL(TPtrC(GPRS_IP_GATEWAY), KNSmlEmptyIpv4Address); |
|
6099 |
|
6100 aTable->WriteTextL(TPtrC(GPRS_IP_ADDR), KNSmlEmptyIpv4Address); |
|
6101 aTable->WriteTextL(TPtrC(GPRS_IF_PARAMS), KNullDesC); |
|
6102 aTable->WriteTextL(TPtrC(GPRS_IP_NETMASK), KNullDesC); |
|
6103 |
|
6104 aTable->WriteUintL(TPtrC(GPRS_QOS_WARNING_TIMEOUT), 0xffffffff); |
|
6105 |
|
6106 aTable->WriteUintL(TPtrC(GPRS_AP_TYPE), (TUint32)EIspTypeInternetAndWAP); |
|
6107 |
|
6108 |
|
6109 return KErrNone; |
|
6110 } |
|
6111 |
|
6112 //============================================= |
|
6113 // CNSmlInternetAdapter::InitializeProxyL() |
|
6114 // Initialize Proxy-data before insert |
|
6115 // |
|
6116 //============================================= |
|
6117 TInt CNSmlInternetAdapter::InitializeProxyL( CCommsDbTableView* aTable ) |
|
6118 { |
|
6119 _LIT(KprotocolName, "http"); // http, https, ftp, ftps |
|
6120 const TUint32 KPortNumber(80); |
|
6121 |
|
6122 aTable->WriteUintL(TPtrC(PROXY_ISP), iProxyISP); // ISP with which these proxies are associated |
|
6123 |
|
6124 aTable->WriteTextL(TPtrC(PROXY_SERVICE_TYPE), iProxyServiceType); // Type ISP/GPRS |
|
6125 aTable->WriteBoolL(TPtrC(PROXY_USE_PROXY_SERVER), ETrue ); |
|
6126 |
|
6127 TPtr proxyName16 = HBufC::NewLC( iProxyServerName.Length() )->Des(); |
|
6128 CnvUtfConverter::ConvertToUnicodeFromUtf8( proxyName16, iProxyServerName ); |
|
6129 |
|
6130 aTable->WriteLongTextL(TPtrC(PROXY_SERVER_NAME), proxyName16); // Name of the proxy server |
|
6131 aTable->WriteTextL(TPtrC(PROXY_PROTOCOL_NAME), KprotocolName); // also https + ftps |
|
6132 |
|
6133 aTable->WriteUintL(TPtrC(PROXY_PORT_NUMBER), KPortNumber); |
|
6134 |
|
6135 aTable->WriteLongTextL(TPtrC(PROXY_EXCEPTIONS), KNullDesC); |
|
6136 |
|
6137 CleanupStack::PopAndDestroy(); //proxyName16 |
|
6138 return KErrNone; |
|
6139 } |
|
6140 |
|
6141 |
|
6142 // CNSmlInternetAdapter::IsInsertAllowedL |
|
6143 // Check if possible to Add new AP |
|
6144 // |
|
6145 //============================================= |
|
6146 TBool CNSmlInternetAdapter::IsInsertAllowedL() |
|
6147 { |
|
6148 TBool theBool = EFalse; |
|
6149 // |
|
6150 // Id + Name + Bearer needed for Insert |
|
6151 // |
|
6152 if ( |
|
6153 iIAPName.Length() > 0 && |
|
6154 iBearer.Length() > 0 && |
|
6155 iDirection != ECommDbConnectionDirectionUnknown) |
|
6156 { |
|
6157 theBool = ETrue; |
|
6158 } |
|
6159 // |
|
6160 // Should check also if Name or iISPId in USE !!! |
|
6161 // |
|
6162 if(theBool) |
|
6163 { |
|
6164 CCommsDbTableView* tableView = iDatabase->OpenViewMatchingTextLC(iBearer, |
|
6165 TPtrC(COMMDB_NAME), |
|
6166 iIAPName); |
|
6167 TInt errorCode = tableView->GotoFirstRecord(); |
|
6168 |
|
6169 // Node allready exists => No adding possible |
|
6170 if ( errorCode == KErrNone ) |
|
6171 { |
|
6172 DBG_ARGS8(_S8("CNSmlInternetAdapter::NODE NAME <%S> ALLREADY(): error"), &iIAPName ); |
|
6173 theBool = EFalse; |
|
6174 } |
|
6175 CleanupStack::PopAndDestroy(tableView); |
|
6176 } |
|
6177 return theBool; |
|
6178 } |
|
6179 |
|
6180 //============================================= |
|
6181 // CNSmlInternetAdapter::SaveIAPDataL |
|
6182 // Saves data to IAP-table |
|
6183 // |
|
6184 //============================================= |
|
6185 void CNSmlInternetAdapter::SaveIAPDataL(const TDesC8& aURI) |
|
6186 { |
|
6187 TInt errorCode; |
|
6188 CCommsDbTableView* tableView; |
|
6189 |
|
6190 TBool apEnforce=EFalse; |
|
6191 TBool iapReLock = EFalse; |
|
6192 |
|
6193 |
|
6194 if(FeatureManager::FeatureSupported(KFeatureIdSapPolicyManagement)) |
|
6195 { |
|
6196 TRAPD(eError,apEnforce=CheckEnforcementL()) |
|
6197 DBG_ARGS8(_S8("CNSmlInternetAdapter::SaveIAPDataL(): EError %d , APEnforcement is %d"),eError,apEnforce); |
|
6198 if(eError==KErrNone && apEnforce) |
|
6199 { |
|
6200 DoLockIAPTablesL(EFalse); |
|
6201 iWAPRelock = ETrue; |
|
6202 } |
|
6203 } |
|
6204 if(iIAPExists) |
|
6205 { |
|
6206 tableView = iDatabase->OpenViewMatchingUintLC(TPtrC(IAP),TPtrC(COMMDB_ID), iIAPId); |
|
6207 if(IsIAPRecordLockedL(iIAPId)) |
|
6208 { |
|
6209 _DBG_FILE("CNSmlInternetAdapter::AddLeafObjectL(): apaccesspoint record is LOCKED"); |
|
6210 TInt reclockerr = ((CCommsDbProtectTableView*)tableView)->UnprotectRecord(); |
|
6211 DBG_ARGS8(_S8("CNSmlInternetAdapter::AddLeafObjectL ,UnProtecting IAPAccessRecord returned code = %d"),reclockerr); |
|
6212 if(reclockerr==KErrNone) |
|
6213 iapReLock = ETrue; |
|
6214 } |
|
6215 else |
|
6216 { |
|
6217 _DBG_FILE("CNSmlInternetAdapter::AddLeafObjectL(): apaccesspoint record is not write protected"); |
|
6218 } |
|
6219 |
|
6220 errorCode = tableView->GotoFirstRecord(); |
|
6221 |
|
6222 if ( errorCode == KErrNone ) |
|
6223 { |
|
6224 if(FeatureManager::FeatureSupported(KFeatureIdSapPolicyManagement)) |
|
6225 { |
|
6226 // if enforcement is on and rec exists, it needs to be unprotected |
|
6227 if ( apEnforce ) |
|
6228 { |
|
6229 ((CCommsDbProtectTableView*)tableView)->UnprotectRecord(); |
|
6230 } |
|
6231 } |
|
6232 errorCode = tableView->UpdateRecord(); |
|
6233 } |
|
6234 } |
|
6235 else |
|
6236 { |
|
6237 tableView = iDatabase->OpenTableLC(TPtrC(IAP)); |
|
6238 |
|
6239 errorCode = tableView->InsertRecord(iIAPId); |
|
6240 } |
|
6241 |
|
6242 if ( errorCode == KErrNone ) |
|
6243 { |
|
6244 TUint32 modemISPId = 1; // Default |
|
6245 TBuf<KCommsDbSvrMaxFieldLength> modemBearer = TPtrC(MODEM_BEARER); |
|
6246 if(iBearer == TPtrC(LAN_SERVICE)) |
|
6247 { |
|
6248 modemBearer = TPtrC(LAN_BEARER); |
|
6249 } |
|
6250 else if(iBearer == TPtrC(VPN_SERVICE)) |
|
6251 { |
|
6252 modemBearer = TPtrC(VIRTUAL_BEARER); |
|
6253 } |
|
6254 else |
|
6255 { |
|
6256 modemBearer = TPtrC(MODEM_BEARER); |
|
6257 } |
|
6258 |
|
6259 if(modemBearer == TPtrC(MODEM_BEARER)) |
|
6260 { |
|
6261 GetModemBearerL(modemISPId); |
|
6262 } |
|
6263 else if(modemBearer == TPtrC(VIRTUAL_BEARER)) |
|
6264 { |
|
6265 modemISPId = 1; |
|
6266 } |
|
6267 else if ( iWlanSupported ) |
|
6268 { |
|
6269 GetLanBearerL(modemISPId); |
|
6270 } |
|
6271 tableView->WriteTextL(TPtrC(COMMDB_NAME), ConvertTo16LC(iIAPName)); |
|
6272 CleanupStack::PopAndDestroy(); //ConvertTo16LC |
|
6273 |
|
6274 // ISP id must be written |
|
6275 tableView->WriteUintL(TPtrC(IAP_SERVICE), iISPId); |
|
6276 tableView->WriteTextL(TPtrC(IAP_SERVICE_TYPE), iBearer); |
|
6277 |
|
6278 tableView->WriteUintL(TPtrC(IAP_BEARER), modemISPId); |
|
6279 tableView->WriteTextL(TPtrC(IAP_BEARER_TYPE), modemBearer); |
|
6280 if( iNetworkId != KErrNotFound ) |
|
6281 { |
|
6282 tableView->WriteUintL(TPtrC(IAP_NETWORK), iNetworkId); // First name on network table |
|
6283 } |
|
6284 tableView->WriteUintL(TPtrC(IAP_NETWORK_WEIGHTING), 0); |
|
6285 tableView->WriteUintL(TPtrC(IAP_LOCATION), 2); // Minimum=2 |
|
6286 |
|
6287 |
|
6288 errorCode = tableView->PutRecordChanges(); |
|
6289 } |
|
6290 if(FeatureManager::FeatureSupported(KFeatureIdSapPolicyManagement)) |
|
6291 { |
|
6292 if(iWAPRelock) |
|
6293 { |
|
6294 DoLockIAPTablesL(ETrue); |
|
6295 ((CCommsDbProtectTableView*)tableView)->ProtectRecord(); |
|
6296 iWAPRelock = EFalse; |
|
6297 } |
|
6298 } |
|
6299 if(iapReLock) |
|
6300 { |
|
6301 TInt reclockerr = DoProtectIAPRecordL(iIAPId,ETrue); |
|
6302 DBG_ARGS8(_S8("CNSmlInternetAdapter::AddLeafObjectL ,UnProtecting IAPAccessRecord returned code = %d"),reclockerr); |
|
6303 if(reclockerr==KErrNone) |
|
6304 iapReLock = EFalse; |
|
6305 } |
|
6306 |
|
6307 if ( errorCode == KErrNone ) |
|
6308 { |
|
6309 if(!iIAPExists) |
|
6310 { |
|
6311 TUint32 lValue; |
|
6312 tableView->ReadUintL(TPtrC(COMMDB_ID),lValue); |
|
6313 |
|
6314 // Add AP |
|
6315 TPtrC8 addURI = GetAddURISeg(aURI,KNSmlDdfAP); |
|
6316 |
|
6317 TBuf8<16> addLUID; |
|
6318 _LIT8(KFormat,"%d"); |
|
6319 addLUID.Format(KFormat,lValue); |
|
6320 |
|
6321 // Also added to mapping |
|
6322 iCallBack->SetMappingL(addURI,addLUID); |
|
6323 DBG_ARGS8(_S8("AP:level1 URI - <%S> <%S> <%d>"), &addURI, &addLUID, lValue ); |
|
6324 } |
|
6325 |
|
6326 iIAPExists = ETrue; |
|
6327 } |
|
6328 |
|
6329 if (apEnforce) |
|
6330 apEnforce=EFalse; // to rget rid of warnings |
|
6331 |
|
6332 CleanupStack::PopAndDestroy(); // tableView |
|
6333 User::LeaveIfError(errorCode); |
|
6334 } |
|
6335 |
|
6336 //============================================= |
|
6337 // CNSmlInternetAdapter::GetMaxIdL |
|
6338 // Get max id from given bearer |
|
6339 // |
|
6340 //============================================= |
|
6341 TUint32 CNSmlInternetAdapter::GetMaxIdL() |
|
6342 { |
|
6343 CCommsDbTableView* checkView; |
|
6344 TUint32 maxGPRS(0); |
|
6345 checkView = iDatabase->OpenTableLC(iBearer); |
|
6346 TInt errorCodem = checkView->GotoFirstRecord(); |
|
6347 while (errorCodem == KErrNone) |
|
6348 { |
|
6349 TUint32 lValue; |
|
6350 checkView->ReadUintL(TPtrC(COMMDB_ID),lValue); |
|
6351 if(lValue > maxGPRS) |
|
6352 { |
|
6353 maxGPRS = lValue; |
|
6354 } |
|
6355 errorCodem = checkView->GotoNextRecord(); |
|
6356 } |
|
6357 |
|
6358 CleanupStack::PopAndDestroy(); // checkView |
|
6359 |
|
6360 return (maxGPRS); |
|
6361 } |
|
6362 |
|
6363 //============================================= |
|
6364 // CNSmlInternetAdapter::GetProxyIdL |
|
6365 // Get proxy id for given IAP |
|
6366 // |
|
6367 //============================================= |
|
6368 TBool CNSmlInternetAdapter::GetProxyIdL(const TDesC8& aURI) |
|
6369 { |
|
6370 TBool proxyFound = EFalse; |
|
6371 |
|
6372 CCommsDbTableView* checkView; |
|
6373 |
|
6374 // Get servicetype for IAP nbr |
|
6375 |
|
6376 TUint32 iapID = GetAPIdFromURIL(aURI); |
|
6377 if( iapID == 0 ) |
|
6378 { |
|
6379 if( IsAPUriFormatMatchPredefined(aURI) ) |
|
6380 { |
|
6381 iLUID = ConstructTreeL(aURI); |
|
6382 iapID = GetAPIdFromURIL(aURI); |
|
6383 } |
|
6384 |
|
6385 } |
|
6386 // IAP-table search serviceType + serviceId |
|
6387 CCommsDbTableView* iapView = iDatabase->OpenViewMatchingUintLC(TPtrC(IAP), |
|
6388 TPtrC(COMMDB_ID), |
|
6389 iapID); |
|
6390 |
|
6391 TBuf<KCommsDbSvrMaxFieldLength> serviceType; |
|
6392 TUint32 serviceId; |
|
6393 |
|
6394 TInt errorCode = iapView->GotoFirstRecord(); |
|
6395 |
|
6396 // Read serviceType from (IAP) |
|
6397 if ( errorCode == KErrNone ) |
|
6398 { |
|
6399 iapView->ReadTextL(TPtrC(IAP_SERVICE_TYPE), serviceType); |
|
6400 iapView->ReadUintL(TPtrC(IAP_SERVICE), serviceId); |
|
6401 CleanupStack::PopAndDestroy(); // iapView |
|
6402 } |
|
6403 else |
|
6404 { |
|
6405 CleanupStack::PopAndDestroy(); // iapView |
|
6406 return proxyFound; |
|
6407 } |
|
6408 |
|
6409 checkView = iDatabase->OpenViewMatchingTextLC(TPtrC(PROXIES), |
|
6410 TPtrC(PROXY_SERVICE_TYPE), |
|
6411 serviceType); |
|
6412 |
|
6413 TInt errorCodem = checkView->GotoFirstRecord(); |
|
6414 |
|
6415 while (errorCodem == KErrNone) |
|
6416 { |
|
6417 TUint32 lValue; |
|
6418 checkView->ReadUintL(TPtrC(PROXY_ISP),lValue); |
|
6419 if(lValue == serviceId) |
|
6420 { |
|
6421 checkView->ReadUintL(TPtrC(COMMDB_ID),iProxyId); |
|
6422 proxyFound = ETrue; |
|
6423 break; |
|
6424 } |
|
6425 errorCodem = checkView->GotoNextRecord(); |
|
6426 } |
|
6427 |
|
6428 CleanupStack::PopAndDestroy(); // checkView |
|
6429 |
|
6430 return proxyFound; |
|
6431 } |
|
6432 |
|
6433 //------------------------------------------------------------------------------ |
|
6434 // TBool CNSmlInternetAdapter::APExistsL() |
|
6435 //------------------------------------------------------------------------------ |
|
6436 TBool CNSmlInternetAdapter::APExistsL(TUint32 aId) |
|
6437 { |
|
6438 TBool ret = EFalse; |
|
6439 CCommsDbTableView* checkView; |
|
6440 |
|
6441 checkView = iDatabase->OpenViewMatchingUintLC(TPtrC(IAP),TPtrC(COMMDB_ID), aId); |
|
6442 TInt error = checkView->GotoFirstRecord(); |
|
6443 if (error == KErrNone) |
|
6444 { |
|
6445 ret = ETrue; |
|
6446 } |
|
6447 CleanupStack::PopAndDestroy(); // checkView |
|
6448 |
|
6449 return ret; |
|
6450 } |
|
6451 |
|
6452 //------------------------------------------------------------------------------ |
|
6453 // TBool CNSmlInternetAdapter::NetworkExistsL() |
|
6454 //------------------------------------------------------------------------------ |
|
6455 TBool CNSmlInternetAdapter::NetworkExistsL(TUint32 aId) |
|
6456 { |
|
6457 TBool ret = EFalse; |
|
6458 CCommsDbTableView* checkView; |
|
6459 |
|
6460 checkView = iDatabase->OpenViewMatchingUintLC(TPtrC(NETWORK),TPtrC(COMMDB_ID), aId); |
|
6461 TInt error = checkView->GotoFirstRecord(); |
|
6462 if (error == KErrNone) |
|
6463 { |
|
6464 ret = ETrue; |
|
6465 } |
|
6466 CleanupStack::PopAndDestroy(); // checkView |
|
6467 |
|
6468 return ret; |
|
6469 } |
|
6470 |
|
6471 //------------------------------------------------------------------------------ |
|
6472 // TBool CNSmlInternetAdapter::NetworkNameExistsL() |
|
6473 //------------------------------------------------------------------------------ |
|
6474 TBool CNSmlInternetAdapter::NetworkNameExistsL(TUint32& aId, const TDesC8& aObject) |
|
6475 { |
|
6476 TBool ret = EFalse; |
|
6477 CCommsDbTableView* checkView; |
|
6478 |
|
6479 checkView = iDatabase->OpenViewMatchingTextLC(TPtrC(NETWORK),TPtrC(COMMDB_NAME), ConvertTo16LC(aObject)); |
|
6480 TInt error = checkView->GotoFirstRecord(); |
|
6481 if (error == KErrNone) |
|
6482 { |
|
6483 checkView->ReadUintL(TPtrC(COMMDB_ID), aId); |
|
6484 ret = ETrue; |
|
6485 } |
|
6486 |
|
6487 CleanupStack::PopAndDestroy(2); // checkView ConvertTo16LC |
|
6488 |
|
6489 return ret; |
|
6490 } |
|
6491 |
|
6492 //------------------------------------------------------------------------------ |
|
6493 // TBool CNSmlInternetAdapter::AddNetworkL() |
|
6494 //------------------------------------------------------------------------------ |
|
6495 TBool CNSmlInternetAdapter::AddNetworkL(TUint32& aId, const TDesC8& aObject) |
|
6496 { |
|
6497 TBool ret = EFalse; |
|
6498 TUint32 newId; |
|
6499 CCommsDbTableView* networkView = iDatabase->OpenTableLC(TPtrC(NETWORK)); |
|
6500 |
|
6501 if( networkView->InsertRecord(newId) == KErrNone ) |
|
6502 { |
|
6503 networkView->WriteTextL(TPtrC(COMMDB_NAME), ConvertTo16LC(aObject)); |
|
6504 if(networkView->PutRecordChanges() == KErrNone) |
|
6505 { |
|
6506 networkView->ReadUintL(TPtrC(COMMDB_ID), aId); // New networks Id |
|
6507 ret = ETrue; |
|
6508 } |
|
6509 CleanupStack::PopAndDestroy(); //ConvertTo16LC |
|
6510 } |
|
6511 CleanupStack::PopAndDestroy(); // networkView |
|
6512 DBG_ARGS8(_S8("NsmlInternetAdapter: AddNetworkL:networkId %d"), aId); |
|
6513 |
|
6514 return ret; |
|
6515 } |
|
6516 //------------------------------------------------------------------------------ |
|
6517 // TBool CNSmlInternetAdapter::NAPDefExistsL() |
|
6518 //------------------------------------------------------------------------------ |
|
6519 TBool CNSmlInternetAdapter::NAPDefExistsL(TUint32 aId ) |
|
6520 { |
|
6521 TBool ret = EFalse; |
|
6522 CCommsDbTableView* checkView; |
|
6523 |
|
6524 |
|
6525 checkView = iDatabase->OpenViewMatchingUintLC(TPtrC(IAP),TPtrC(IAP_SERVICE), aId); |
|
6526 TInt error = checkView->GotoFirstRecord(); |
|
6527 if (error == KErrNone) |
|
6528 { |
|
6529 TBuf<KCommsDbSvrMaxFieldLength> serviceType; |
|
6530 |
|
6531 checkView->ReadTextL(TPtrC(IAP_SERVICE_TYPE), serviceType); |
|
6532 CCommsDbTableView* tableView = iDatabase->OpenViewMatchingUintLC(serviceType,TPtrC(COMMDB_ID), aId); |
|
6533 error = tableView->GotoFirstRecord(); |
|
6534 |
|
6535 if (error == KErrNone) |
|
6536 { |
|
6537 ret = ETrue; |
|
6538 } |
|
6539 CleanupStack::PopAndDestroy(); // tableView |
|
6540 } |
|
6541 |
|
6542 CleanupStack::PopAndDestroy(); // checkView |
|
6543 |
|
6544 return ret; |
|
6545 } |
|
6546 |
|
6547 //------------------------------------------------------------------------------ |
|
6548 // TBool CNSmlInternetAdapter::PxExistsL() |
|
6549 //------------------------------------------------------------------------------ |
|
6550 TBool CNSmlInternetAdapter::PxExistsL(TUint32 aId) |
|
6551 { |
|
6552 TBool ret = EFalse; |
|
6553 CCommsDbTableView* pxView; |
|
6554 |
|
6555 pxView = iDatabase->OpenViewMatchingUintLC( TPtrC(PROXIES),TPtrC(COMMDB_ID), aId); |
|
6556 |
|
6557 TInt errorCode = pxView->GotoFirstRecord(); |
|
6558 |
|
6559 if (errorCode == KErrNone ) |
|
6560 { |
|
6561 ret = ETrue; |
|
6562 } |
|
6563 CleanupStack::PopAndDestroy(); // pxView |
|
6564 |
|
6565 return ret; |
|
6566 } |
|
6567 |
|
6568 //------------------------------------------------------------------------------ |
|
6569 // TBool CNSmlInternetAdapter::WapAPExistsL() |
|
6570 //------------------------------------------------------------------------------ |
|
6571 TBool CNSmlInternetAdapter::WapAPExistsL(TUint32 aId) |
|
6572 { |
|
6573 TBool ret = EFalse; |
|
6574 CCommsDbTableView* wapView; |
|
6575 |
|
6576 wapView = iDatabase->OpenViewMatchingUintLC( TPtrC(WAP_IP_BEARER),TPtrC(WAP_IAP), aId); |
|
6577 |
|
6578 TInt errorCode = wapView->GotoFirstRecord(); |
|
6579 |
|
6580 if (errorCode == KErrNone ) |
|
6581 { |
|
6582 wapView->ReadUintL(TPtrC(WAP_ACCESS_POINT_ID), iWapId); |
|
6583 ret = ETrue; |
|
6584 } |
|
6585 CleanupStack::PopAndDestroy(); // wapView |
|
6586 |
|
6587 return ret; |
|
6588 } |
|
6589 |
|
6590 //------------------------------------------------------------------------------ |
|
6591 // TUint32 CNSmlInternetAdapter::GetAPIdFromURIL(const TDesC8& aURI) |
|
6592 // Get AP luid for given aURI |
|
6593 //------------------------------------------------------------------------------ |
|
6594 TUint32 CNSmlInternetAdapter::GetAPIdFromURIL(const TDesC8& aURI) |
|
6595 { |
|
6596 HBufC8* apURI = HBufC8::NewLC(aURI.Length()); |
|
6597 |
|
6598 _DBG_FILE("CNSmlInternetAdapter::GetAPIdFromURIL(): begin"); |
|
6599 DBG_ARGS8(_S8("AP:add aURI GetAPIdFromURIL - %S "), &aURI); |
|
6600 // |
|
6601 // Second slash after AP |
|
6602 // |
|
6603 TInt i= 0; |
|
6604 for( i=aURI.Find(KNSmlDdfAP)+3; i < aURI.Length(); i++ ) |
|
6605 { |
|
6606 if(aURI[i]=='/') |
|
6607 { |
|
6608 break; |
|
6609 } |
|
6610 } |
|
6611 DBG_ARGS8(_S8("AP:add aURI GetAPIdFromURIL i is %d "), i); |
|
6612 if(i>0) |
|
6613 { |
|
6614 apURI->Des().Format(aURI.Left(i)); |
|
6615 } |
|
6616 // |
|
6617 // Same profile as previous |
|
6618 // |
|
6619 if(iPrevURI->Match(*apURI) != KErrNotFound) |
|
6620 { |
|
6621 _DBG_FILE("CNSmlInternetAdapter::GetAPIdFromURIL(): previous uri"); |
|
6622 CleanupStack::PopAndDestroy(); // apURI |
|
6623 return iPrevLUID; |
|
6624 } |
|
6625 // |
|
6626 // Fetch AP-id for URI |
|
6627 // |
|
6628 HBufC8* apLUID = iCallBack->GetLuidAllocL(*apURI); |
|
6629 CleanupStack::PushL(apLUID); |
|
6630 |
|
6631 TUint32 resLUID = IntLUID(*apLUID); |
|
6632 DBG_ARGS8(_S8("AP:add aURI GetAPIdFromURIL luidallocation is %d "), resLUID); |
|
6633 |
|
6634 if ( resLUID > 0 ) |
|
6635 { |
|
6636 iPrevURI->Des().Format( *apURI ); |
|
6637 iPrevLUID = resLUID; |
|
6638 } |
|
6639 |
|
6640 CleanupStack::PopAndDestroy(2); // apURI, apLUID |
|
6641 |
|
6642 return resLUID; |
|
6643 } |
|
6644 |
|
6645 //------------------------------------------------------------------------------ |
|
6646 // TBool CNSmlInternetAdapter::DeleteProxyL() |
|
6647 //------------------------------------------------------------------------------ |
|
6648 TBool CNSmlInternetAdapter::DeleteProxyL(TUint32 aId) |
|
6649 { |
|
6650 TBool ret = EFalse; |
|
6651 CCommsDbTableView* pxView; |
|
6652 |
|
6653 pxView = iDatabase->OpenViewMatchingUintLC( TPtrC(PROXIES),TPtrC(COMMDB_ID), aId); |
|
6654 |
|
6655 TInt errorCode = pxView->GotoFirstRecord(); |
|
6656 |
|
6657 if (errorCode == KErrNone ) |
|
6658 { |
|
6659 errorCode = pxView->DeleteRecord(); |
|
6660 if (errorCode == KErrNone ) |
|
6661 { |
|
6662 ret = ETrue; |
|
6663 } |
|
6664 } |
|
6665 |
|
6666 CleanupStack::PopAndDestroy(); // pxView |
|
6667 return ret; |
|
6668 } |
|
6669 |
|
6670 //------------------------------------------------------------------------------ |
|
6671 // TBool CNSmlInternetAdapter::DeleteWapAPL() |
|
6672 //------------------------------------------------------------------------------ |
|
6673 TBool CNSmlInternetAdapter::DeleteWapAPL(TUint32 aId) |
|
6674 { |
|
6675 TBool ret = EFalse; |
|
6676 CCommsDbTableView* wapView; |
|
6677 |
|
6678 TUint32 wapId = 0; |
|
6679 |
|
6680 if(FeatureManager::FeatureSupported(KFeatureIdSapPolicyManagement)) |
|
6681 { |
|
6682 TBool apEnforce=EFalse; |
|
6683 TRAPD(eError,apEnforce=CheckEnforcementL()) |
|
6684 DBG_ARGS8(_S8("CNSmlInternetAdapter::DeleteWAPAPL(): EError %d , APEnforcement is %d"),eError,apEnforce); |
|
6685 if(eError==KErrNone && apEnforce) |
|
6686 { |
|
6687 DoLockIAPTablesL(EFalse); |
|
6688 iWAPRelock = ETrue; |
|
6689 } |
|
6690 } |
|
6691 wapView = iDatabase->OpenViewMatchingUintLC( TPtrC(WAP_IP_BEARER),TPtrC(WAP_IAP), aId); |
|
6692 |
|
6693 TInt errorCode = wapView->GotoFirstRecord(); |
|
6694 |
|
6695 if (errorCode == KErrNone ) |
|
6696 { |
|
6697 wapView->ReadUintL(TPtrC(WAP_ACCESS_POINT_ID), wapId); // WapIAP id |
|
6698 errorCode = wapView->DeleteRecord(); |
|
6699 if (errorCode == KErrNone ) |
|
6700 { |
|
6701 ret = ETrue; |
|
6702 } |
|
6703 } |
|
6704 |
|
6705 if(ret) |
|
6706 { |
|
6707 CCommsDbTableView* wapApView = iDatabase->OpenViewMatchingUintLC( TPtrC(WAP_ACCESS_POINT),TPtrC(COMMDB_ID), wapId); |
|
6708 |
|
6709 errorCode = wapApView->GotoFirstRecord(); |
|
6710 |
|
6711 if (errorCode == KErrNone ) |
|
6712 { |
|
6713 errorCode = wapApView->DeleteRecord(); |
|
6714 if (errorCode == KErrNone ) |
|
6715 { |
|
6716 ret = ETrue; |
|
6717 } |
|
6718 } |
|
6719 CleanupStack::PopAndDestroy(); // wapApView |
|
6720 } |
|
6721 |
|
6722 CleanupStack::PopAndDestroy(); // wapView |
|
6723 if(FeatureManager::FeatureSupported(KFeatureIdSapPolicyManagement)) |
|
6724 { |
|
6725 if(iWAPRelock) |
|
6726 { |
|
6727 DoLockIAPTablesL(ETrue); |
|
6728 iWAPRelock = EFalse; |
|
6729 } |
|
6730 } |
|
6731 return ret; |
|
6732 } |
|
6733 |
|
6734 //------------------------------------------------------------------------------ |
|
6735 // TBool CNSmlInternetAdapter::DeleteNAPDefL() |
|
6736 //------------------------------------------------------------------------------ |
|
6737 TBool CNSmlInternetAdapter::DeleteNAPDefL(TUint32 aId) |
|
6738 { |
|
6739 TBool ret = EFalse; |
|
6740 CCommsDbTableView* checkView; |
|
6741 TBool apEnforce=EFalse; |
|
6742 TBool iapReLock = EFalse; |
|
6743 |
|
6744 if(FeatureManager::FeatureSupported(KFeatureIdSapPolicyManagement)) |
|
6745 { |
|
6746 TRAPD( eError,apEnforce=CheckEnforcementL() ) |
|
6747 DBG_ARGS8(_S8("CNSmlInternetAdapter::DeleteNAPDefL(): EError %d , APEnforcement is %d"),eError,apEnforce); |
|
6748 if( eError==KErrNone && apEnforce ) |
|
6749 { |
|
6750 DoLockIAPTablesL(EFalse); |
|
6751 iWAPRelock = ETrue; |
|
6752 } |
|
6753 } |
|
6754 |
|
6755 checkView = iDatabase->OpenViewMatchingUintLC(TPtrC(IAP),TPtrC(IAP_SERVICE), aId); |
|
6756 if(IsIAPRecordLockedL(aId)) |
|
6757 { |
|
6758 _DBG_FILE("CNSmlInternetAdapter::AddLeafObjectL(): apaccesspoint record is LOCKED"); |
|
6759 TInt reclockerr = ((CCommsDbProtectTableView*)checkView)->UnprotectRecord(); |
|
6760 DBG_ARGS8(_S8("CNSmlInternetAdapter::AddLeafObjectL ,UnProtecting IAPAccessRecord returned code = %d"),reclockerr); |
|
6761 if(reclockerr==KErrNone) |
|
6762 iapReLock = ETrue; |
|
6763 } |
|
6764 else |
|
6765 { |
|
6766 _DBG_FILE("CNSmlInternetAdapter::AddLeafObjectL(): apaccesspoint record is not write protected"); |
|
6767 } |
|
6768 TInt error = checkView->GotoFirstRecord(); |
|
6769 if (error == KErrNone) |
|
6770 { |
|
6771 TBuf<KCommsDbSvrMaxFieldLength> serviceType; |
|
6772 |
|
6773 checkView->ReadTextL(TPtrC(IAP_SERVICE_TYPE), serviceType); |
|
6774 |
|
6775 CCommsDbTableView* tableView = iDatabase->OpenViewMatchingUintLC(serviceType,TPtrC(COMMDB_ID), aId); |
|
6776 error = tableView->GotoFirstRecord(); |
|
6777 |
|
6778 if (error == KErrNone) |
|
6779 { |
|
6780 if(FeatureManager::FeatureSupported(KFeatureIdSapPolicyManagement)) |
|
6781 { |
|
6782 if ( apEnforce ) |
|
6783 { |
|
6784 ((CCommsDbProtectTableView*)tableView)->UnprotectRecord(); |
|
6785 } |
|
6786 } |
|
6787 |
|
6788 error = tableView->DeleteRecord(); |
|
6789 if (error == KErrNone ) |
|
6790 { |
|
6791 ret = ETrue; |
|
6792 } |
|
6793 } |
|
6794 CleanupStack::PopAndDestroy(); // tableView |
|
6795 } |
|
6796 |
|
6797 CleanupStack::PopAndDestroy(); // checkView |
|
6798 |
|
6799 if(FeatureManager::FeatureSupported(KFeatureIdSapPolicyManagement)) |
|
6800 { |
|
6801 if(iWAPRelock) |
|
6802 { |
|
6803 DoLockIAPTablesL(ETrue); |
|
6804 iWAPRelock = EFalse; |
|
6805 } |
|
6806 } |
|
6807 |
|
6808 if(iapReLock) |
|
6809 { |
|
6810 TInt reclockerr = DoProtectIAPRecordL(aId,ETrue); |
|
6811 DBG_ARGS8(_S8("CNSmlInternetAdapter::AddLeafObjectL ,UnProtecting WAPAccessRecord returned code = %d"),reclockerr); |
|
6812 if(reclockerr==KErrNone) |
|
6813 iapReLock = EFalse; |
|
6814 } |
|
6815 if (apEnforce) |
|
6816 apEnforce=EFalse; // to get rid of warnings |
|
6817 |
|
6818 return ret; |
|
6819 } |
|
6820 |
|
6821 // --------------------------------------------------------------------------- |
|
6822 // Removes iapID and linger interval from CentralRepository |
|
6823 // --------------------------------------------------------------------------- |
|
6824 // |
|
6825 void CNSmlInternetAdapter::DeleteLingerL( const TInt aIapId ) |
|
6826 { |
|
6827 TInt err( KErrNone ); |
|
6828 |
|
6829 // Open repository |
|
6830 CRepository* repository = CRepository::NewLC( KCRUidPDPContextManager ); |
|
6831 |
|
6832 // Find if an entry for "iapId" already exists in CentRep |
|
6833 RArray< TUint32 > foundKeys; |
|
6834 foundKeys.Reset(); |
|
6835 |
|
6836 err = repository->FindEqL( KIapColumn, // partial key |
|
6837 KColumnMask, // key mask |
|
6838 aIapId, // value |
|
6839 foundKeys ); // found keys |
|
6840 |
|
6841 if ( err == KErrNone ) |
|
6842 { |
|
6843 if ( foundKeys.Count() > 0 ) |
|
6844 { |
|
6845 TInt arrayCount( 0 ); |
|
6846 |
|
6847 // Get number of iapId&linger entries in Centrep |
|
6848 err = repository->Get( KPdpContextManagerLingerArrayCount, arrayCount ); |
|
6849 |
|
6850 if ( err == KErrNone ) |
|
6851 { |
|
6852 TInt32 row = foundKeys[ 0 ] & KRowMask; |
|
6853 |
|
6854 // Shift existing entries one position left |
|
6855 for ( TInt i=row+1; i <= arrayCount; i++ ) |
|
6856 { |
|
6857 TInt iapId( 0 ); |
|
6858 TInt linger( 0 ); |
|
6859 |
|
6860 err = repository->Get( ( KIapColumn | i ), iapId ); |
|
6861 |
|
6862 if ( err == KErrNone ) |
|
6863 { |
|
6864 err = repository->Get( ( KLingerColumn | i ), linger ); |
|
6865 } |
|
6866 |
|
6867 if ( err == KErrNone ) |
|
6868 { |
|
6869 err = repository->Set( ( KIapColumn | (i-1) ), iapId ); |
|
6870 } |
|
6871 |
|
6872 if ( err == KErrNone ) |
|
6873 { |
|
6874 err = repository->Set( ( KLingerColumn | (i-1) ), linger ); |
|
6875 } |
|
6876 } |
|
6877 |
|
6878 // Remove the last entry on row arrayCount |
|
6879 if ( err == KErrNone ) |
|
6880 { |
|
6881 TUint32 errorKey( 0 ); |
|
6882 |
|
6883 err = repository->Delete( ( KIapColumn | arrayCount ), |
|
6884 0xFFFFFFFF, |
|
6885 errorKey); |
|
6886 |
|
6887 if ( err == KErrNone ) |
|
6888 { |
|
6889 err = repository->Delete( ( KLingerColumn | arrayCount ), |
|
6890 0xFFFFFFFF, |
|
6891 errorKey); |
|
6892 arrayCount--; |
|
6893 } |
|
6894 } |
|
6895 |
|
6896 // Update number of iapId&linger entries in Centrep |
|
6897 err = repository->Set( KPdpContextManagerLingerArrayCount, arrayCount ); |
|
6898 } |
|
6899 } |
|
6900 } |
|
6901 |
|
6902 foundKeys.Close(); |
|
6903 CleanupStack::PopAndDestroy( repository ); |
|
6904 |
|
6905 } |
|
6906 //------------------------------------------------------------------------------ |
|
6907 // TBool CNSmlInternetAdapter::DeleteAPL() |
|
6908 //------------------------------------------------------------------------------ |
|
6909 TBool CNSmlInternetAdapter::DeleteAPL(TUint32 aId) |
|
6910 { |
|
6911 TBool ret = EFalse; |
|
6912 |
|
6913 //Check MIP IAP first then go forward |
|
6914 if(FeatureManager::FeatureSupported(KFeatureIdSapPolicyManagement)) |
|
6915 { |
|
6916 TBool apEnforce=EFalse; |
|
6917 TBool wlanEnforce= EFalse; |
|
6918 TInt wError = KErrNone; |
|
6919 TRAP(wError,wlanEnforce=CheckWLANEnforcementL()); |
|
6920 TRAPD( eError,apEnforce=CheckEnforcementL() ) |
|
6921 if( wlanEnforce) |
|
6922 { |
|
6923 UnprotectWLANAPItemL(aId); |
|
6924 } |
|
6925 DBG_ARGS8(_S8("CNSmlInternetAdapter::DeleteAPL(): EError %d , APEnforcement is %d"),eError,apEnforce); |
|
6926 if( eError==KErrNone && apEnforce ) |
|
6927 { |
|
6928 DoLockIAPTablesL(EFalse); |
|
6929 iWAPRelock = ETrue; |
|
6930 } |
|
6931 } |
|
6932 |
|
6933 if(iDatabase->InTransaction()) |
|
6934 iDatabase->CommitTransaction(); |
|
6935 RCmManagerExt cmManagerExt; |
|
6936 cmManagerExt.OpenL(); |
|
6937 RCmConnectionMethodExt cmConMethodExt ; |
|
6938 TRAPD(err, cmConMethodExt= cmManagerExt.ConnectionMethodL( aId )); |
|
6939 CleanupClosePushL( cmConMethodExt ); |
|
6940 if(err == KErrNone) |
|
6941 { |
|
6942 TRAPD(dError,cmConMethodExt.DeleteL()); |
|
6943 if(dError == KErrNone) |
|
6944 { |
|
6945 DeleteLingerL( aId ); |
|
6946 ret= ETrue; |
|
6947 } |
|
6948 } |
|
6949 |
|
6950 CleanupStack::PopAndDestroy( ); |
|
6951 cmManagerExt.Close(); |
|
6952 if(!iDatabase->InTransaction()) |
|
6953 { |
|
6954 TInt dberr = iDatabase->BeginTransaction(); |
|
6955 if( dberr == KErrLocked ) |
|
6956 { |
|
6957 _DBG_FILE("DeleteAPL: CommsDat was locked."); |
|
6958 TInt retry = KBeginTransRetryCount; |
|
6959 while ( retry > 0 && dberr == KErrLocked ) |
|
6960 { |
|
6961 User::After(KBeginTransRetryDelay); |
|
6962 _DBG_FILE("DeleteAPL: Slept 1 second. Try again"); |
|
6963 dberr = iDatabase->BeginTransaction(); |
|
6964 retry--; |
|
6965 } |
|
6966 if(dberr != KErrNone) |
|
6967 { |
|
6968 _DBG_FILE("CNSmlInternetAdapter: BeginTransaction failed completely."); |
|
6969 User::Leave( dberr ); |
|
6970 } |
|
6971 } |
|
6972 } |
|
6973 |
|
6974 //The following code is kept under #ifndef , so that it can be removed |
|
6975 //after RD_DM_APPLICATION_LEVEL_ROAMING_SUPPORT becomes stable. |
|
6976 |
|
6977 /* #ifndef RD_DM_APPLICATION_LEVEL_ROAMING_SUPPORT |
|
6978 CCommsDbTableView* checkView; |
|
6979 CCommsDbTableView* proxyView; |
|
6980 |
|
6981 checkView = iDatabase->OpenViewMatchingUintLC(TPtrC(IAP),TPtrC(COMMDB_ID), aId); |
|
6982 TInt error = checkView->GotoFirstRecord(); |
|
6983 if (error == KErrNone) |
|
6984 { |
|
6985 // |
|
6986 // Remove possible NAPDef-data first if ONLY IAP |
|
6987 // |
|
6988 TBuf<KCommsDbSvrMaxFieldLength> serviceType; |
|
6989 TUint32 serviceId; |
|
6990 |
|
6991 checkView->ReadTextL(TPtrC(IAP_SERVICE_TYPE), serviceType); |
|
6992 checkView->ReadUintL(TPtrC(IAP_SERVICE), serviceId); |
|
6993 |
|
6994 |
|
6995 CCommsDbTableView* tableView; |
|
6996 tableView= iDatabase->OpenViewMatchingUintLC(serviceType, TPtrC(COMMDB_ID), serviceId); |
|
6997 error = tableView->GotoFirstRecord(); |
|
6998 if (error == KErrNone ) |
|
6999 { |
|
7000 error = tableView->DeleteRecord(); |
|
7001 } |
|
7002 CleanupStack::PopAndDestroy(); // tableView |
|
7003 |
|
7004 // |
|
7005 // Delete Proxies for AP also |
|
7006 // |
|
7007 proxyView = iDatabase->OpenViewMatchingTextLC(TPtrC(PROXIES), |
|
7008 TPtrC(PROXY_SERVICE_TYPE), |
|
7009 serviceType); |
|
7010 |
|
7011 TInt errorProxy = proxyView->GotoFirstRecord(); |
|
7012 |
|
7013 while (errorProxy == KErrNone) |
|
7014 { |
|
7015 TUint32 lValue; |
|
7016 proxyView->ReadUintL(TPtrC(PROXY_ISP),lValue); |
|
7017 if(lValue == serviceId) |
|
7018 { |
|
7019 proxyView->ReadUintL(TPtrC(COMMDB_ID),iProxyId); |
|
7020 DBG_ARGS8(_S8("DeleteAPL:Delete ServiceId=%d ProxyId=%d"),lValue, iProxyId); |
|
7021 error = proxyView->DeleteRecord(); |
|
7022 } |
|
7023 errorProxy = proxyView->GotoNextRecord(); |
|
7024 } |
|
7025 |
|
7026 CleanupStack::PopAndDestroy(); // proxyView |
|
7027 |
|
7028 error = checkView->DeleteRecord(); |
|
7029 if( error == KErrNone ) |
|
7030 { |
|
7031 ret = ETrue; |
|
7032 } |
|
7033 |
|
7034 // Delete WAP also |
|
7035 if(WapAPExistsL(aId)) |
|
7036 { |
|
7037 DeleteWapAPL(aId); |
|
7038 } |
|
7039 } |
|
7040 |
|
7041 CleanupStack::PopAndDestroy(); // checkView |
|
7042 #endif |
|
7043 */ |
|
7044 if(FeatureManager::FeatureSupported(KFeatureIdSapPolicyManagement)) |
|
7045 { |
|
7046 if(iWAPRelock) |
|
7047 { |
|
7048 DoLockIAPTablesL(ETrue); |
|
7049 iWAPRelock = EFalse; |
|
7050 } |
|
7051 } |
|
7052 return ret; |
|
7053 } |
|
7054 |
|
7055 //------------------------------------------------------------------------------ |
|
7056 // TPtrC8 CNSmlInternetAdapter::LastURISeg(const TDesC8& aURI) |
|
7057 // Returns only the last uri segment |
|
7058 //------------------------------------------------------------------------------ |
|
7059 TPtrC8 CNSmlInternetAdapter::LastURISeg(const TDesC8& aURI) |
|
7060 { |
|
7061 TInt i; |
|
7062 for(i=aURI.Length()-1;i>=0;i--) |
|
7063 { |
|
7064 if(aURI[i]=='/') |
|
7065 { |
|
7066 break; |
|
7067 } |
|
7068 } |
|
7069 if(i==0) |
|
7070 { |
|
7071 return aURI; |
|
7072 } |
|
7073 else |
|
7074 { |
|
7075 return aURI.Mid(i+1); |
|
7076 } |
|
7077 } |
|
7078 |
|
7079 //------------------------------------------------------------------------------ |
|
7080 // TPtrC8 CNSmlInternetAdapter::FirstURISeg(const TDesC8& aURI) |
|
7081 // returns parent uri, i.e. removes last uri segment |
|
7082 //------------------------------------------------------------------------------ |
|
7083 TPtrC8 CNSmlInternetAdapter::FirstURISeg(const TDesC8& aURI) |
|
7084 { |
|
7085 TInt j= 0; |
|
7086 for(TInt i=0;i<=aURI.Length()-1;i++) |
|
7087 { |
|
7088 if(aURI[i]=='/') |
|
7089 { |
|
7090 for(j=i+1;j<=aURI.Length()-1;j++) |
|
7091 { |
|
7092 if(aURI[j]=='/') // Second slash => AP/xxxx |
|
7093 break; |
|
7094 } |
|
7095 break; |
|
7096 } |
|
7097 } |
|
7098 return aURI.Left(j); |
|
7099 } |
|
7100 |
|
7101 //------------------------------------------------------------------------------ |
|
7102 // TPtrC8 CNSmlInternetAdapter::GetDynamicAPNodeUri( const TDesC8& aURI ) |
|
7103 // returns AP/xxx URI |
|
7104 //------------------------------------------------------------------------------ |
|
7105 TPtrC8 CNSmlInternetAdapter::GetDynamicAPNodeUri( const TDesC8& aURI ) |
|
7106 { |
|
7107 _DBG_FILE("CNSmlInternetAdapter::GetDynamicAPNodeUri(): begin"); |
|
7108 DBG_ARGS8(_S8("CNSmlInternetAdapter::GetDynamicAPNodeUri() - <%S> "), &aURI); |
|
7109 |
|
7110 TInt i= 0; |
|
7111 for ( i = aURI.Find( KNSmlDdfAP ) + 3; i < aURI.Length(); i++ ) |
|
7112 { |
|
7113 if( aURI[i] == '/' ) |
|
7114 { |
|
7115 break; |
|
7116 } |
|
7117 } |
|
7118 |
|
7119 _DBG_FILE("CNSmlInternetAdapter::GetDynamicAPNodeUri(): end"); |
|
7120 |
|
7121 return aURI.Left( i ); |
|
7122 } |
|
7123 |
|
7124 //------------------------------------------------------------------------------ |
|
7125 // CNSmlInternetAdapter::ExecuteBufferL(const TDesC8& aURI) |
|
7126 // Executes commands for AP after Bearer-data is set |
|
7127 //------------------------------------------------------------------------------ |
|
7128 void CNSmlInternetAdapter::ExecuteBufferL(const TDesC8& aURI, const TBool aCompleting) |
|
7129 { |
|
7130 // |
|
7131 // Choose AP according to aURI |
|
7132 // |
|
7133 iExecutingBuffer = ETrue; |
|
7134 for(TInt i = 0; i<iBuffer->Count(); i++) |
|
7135 { |
|
7136 TPtrC8 parentUri = FirstURISeg(aURI); |
|
7137 if(iBuffer->At(i).iMappingName->Compare(parentUri) == 0 ) |
|
7138 { |
|
7139 iExecutionIndex = i; |
|
7140 break; |
|
7141 } |
|
7142 } |
|
7143 |
|
7144 if((iExecutionIndex<0) || (iExecutionIndex >= iBuffer->Count())) |
|
7145 { |
|
7146 return; |
|
7147 } |
|
7148 |
|
7149 iISPId = 0; |
|
7150 // |
|
7151 // Execute all commands for One AP NAPDef |
|
7152 // |
|
7153 if ( iBuffer->At(iExecutionIndex).iDnsUpdateBuf ) |
|
7154 { |
|
7155 iDnsUpdate = ETrue; |
|
7156 } |
|
7157 |
|
7158 for(TInt cmd=iBuffer->At(iExecutionIndex).iNodeBuf->Count()-1;cmd>=0;cmd--) |
|
7159 { |
|
7160 TBuf8<16> addLUID; |
|
7161 _LIT8(KFormat,"%d"); |
|
7162 |
|
7163 if(iBuffer->At(iExecutionIndex).iNodeBuf->At(cmd).iUri->Match(_L8("AP/*/Px*")) != 0) |
|
7164 { |
|
7165 |
|
7166 if (!iBuffer->At(iExecutionIndex).iNodeBuf->At(cmd).iLeaf) |
|
7167 { |
|
7168 addLUID.Format(KFormat,0); |
|
7169 if(iBuffer->At(iExecutionIndex).iLuid > 0) |
|
7170 { |
|
7171 addLUID.Format(KFormat,-1); // Used for Status return |
|
7172 } |
|
7173 AddNodeObjectL(iBuffer->At(iExecutionIndex).iNodeBuf->At(cmd).iUri->Des(), |
|
7174 addLUID, |
|
7175 iBuffer->At(iExecutionIndex).iNodeBuf->At(cmd).iStatusRef); |
|
7176 |
|
7177 iBuffer->At(iExecutionIndex).iExecuted = ETrue; |
|
7178 } |
|
7179 else |
|
7180 { |
|
7181 if ( iBuffer->At(iExecutionIndex).iDnsUpdateBuf ) |
|
7182 { |
|
7183 addLUID.Zero(); |
|
7184 addLUID.Append(iBuffer->At(iExecutionIndex).iNodeBuf->At(cmd).iLuid->Des()); |
|
7185 } |
|
7186 else |
|
7187 { |
|
7188 addLUID.Format(KFormat,iBuffer->At(iExecutionIndex).iLuid); |
|
7189 if(!iBuffer->At(iExecutionIndex).iDirection || // The three values has to be set |
|
7190 !iBuffer->At(iExecutionIndex).iBearer || |
|
7191 !iBuffer->At(iExecutionIndex).iNameReceived ) // before new AP set |
|
7192 { |
|
7193 addLUID.Format(KFormat,KNSmlIncompleteAP); // (-1) Used for error |
|
7194 } // Status return |
|
7195 } |
|
7196 //iIAPName = iBuffer->At(iExecutionIndex).iName->Des(); |
|
7197 |
|
7198 AddLeafObjectL(iBuffer->At(iExecutionIndex).iNodeBuf->At(cmd).iUri->Des(), |
|
7199 addLUID, |
|
7200 iBuffer->At(iExecutionIndex).iNodeBuf->At(cmd).iData->Des(), |
|
7201 KNSmlMimeTypeTextPlain, |
|
7202 iBuffer->At(iExecutionIndex).iNodeBuf->At(cmd).iStatusRef); |
|
7203 |
|
7204 if(iBuffer->At(iExecutionIndex).iLuid == 0) // After BearerL |
|
7205 iBuffer->At(iExecutionIndex).iLuid = iISPId; |
|
7206 } |
|
7207 |
|
7208 TInt uidValue = IntLUID(addLUID); |
|
7209 if(( iBuffer->At(iExecutionIndex).iNodeBuf->At(cmd).iUri->Des().Match( _L8( "AP/*/NAPDef/*/NAPAddr" ) ) != KErrNotFound ) && (uidValue == KErrNone)) |
|
7210 { |
|
7211 iBuffer->At(iExecutionIndex).iNodeBuf->At(cmd).iDone = EFalse; |
|
7212 } |
|
7213 else |
|
7214 { |
|
7215 iBuffer->At(iExecutionIndex).iNodeBuf->At(cmd).iDone = ETrue; |
|
7216 } |
|
7217 |
|
7218 } |
|
7219 |
|
7220 } |
|
7221 // |
|
7222 // Execute all commands for One AP Px |
|
7223 // |
|
7224 for(TInt cmd2=0;cmd2 < iBuffer->At(iExecutionIndex).iNodeBuf->Count();cmd2++) |
|
7225 { |
|
7226 TBuf8<16> addLUID2; |
|
7227 _LIT8(KFormat,"%d"); |
|
7228 if(!iBuffer->At(iExecutionIndex).iNodeBuf->At(cmd2).iDone) |
|
7229 { |
|
7230 if (!iBuffer->At(iExecutionIndex).iNodeBuf->At(cmd2).iLeaf) |
|
7231 { |
|
7232 addLUID2.Format(KFormat,0); |
|
7233 if(iBuffer->At(iExecutionIndex).iLuid > 0) |
|
7234 { |
|
7235 addLUID2.Format(KFormat,-1); // Used for Status return |
|
7236 } |
|
7237 AddNodeObjectL(iBuffer->At(iExecutionIndex).iNodeBuf->At(cmd2).iUri->Des(), |
|
7238 addLUID2, |
|
7239 iBuffer->At(iExecutionIndex).iNodeBuf->At(cmd2).iStatusRef); |
|
7240 |
|
7241 iBuffer->At(iExecutionIndex).iExecuted = ETrue; |
|
7242 } |
|
7243 else |
|
7244 { |
|
7245 addLUID2.Format(KFormat,iBuffer->At(iExecutionIndex).iLuid); |
|
7246 iIAPName = iBuffer->At(iExecutionIndex).iName->Des(); |
|
7247 if(!iBuffer->At(iExecutionIndex).iDirection || // Allvalues has to be set |
|
7248 !iBuffer->At(iExecutionIndex).iBearer || |
|
7249 !iBuffer->At(iExecutionIndex).iName) // before new AP set |
|
7250 { |
|
7251 addLUID2.Format(KFormat,KNSmlIncompleteAP); // (-1) Used for error |
|
7252 } // Status return |
|
7253 |
|
7254 AddLeafObjectL(iBuffer->At(iExecutionIndex).iNodeBuf->At(cmd2).iUri->Des(), |
|
7255 addLUID2, |
|
7256 iBuffer->At(iExecutionIndex).iNodeBuf->At(cmd2).iData->Des(), |
|
7257 KNSmlMimeTypeTextPlain, |
|
7258 iBuffer->At(iExecutionIndex).iNodeBuf->At(cmd2).iStatusRef); |
|
7259 |
|
7260 if(iBuffer->At(iExecutionIndex).iLuid == 0) // After BearerL |
|
7261 iBuffer->At(iExecutionIndex).iLuid = iISPId; |
|
7262 } |
|
7263 } //++ |
|
7264 |
|
7265 iBuffer->At(iExecutionIndex).iNodeBuf->At(cmd2).iDone = ETrue; |
|
7266 |
|
7267 delete iBuffer->At(iExecutionIndex).iNodeBuf->At(cmd2).iUri; |
|
7268 iBuffer->At(iExecutionIndex).iNodeBuf->At(cmd2).iUri = NULL; |
|
7269 |
|
7270 if(iBuffer->At(iExecutionIndex).iNodeBuf->At(cmd2).iData) |
|
7271 { |
|
7272 delete iBuffer->At(iExecutionIndex).iNodeBuf->At(cmd2).iData; |
|
7273 iBuffer->At(iExecutionIndex).iNodeBuf->At(cmd2).iData = NULL; |
|
7274 } |
|
7275 } |
|
7276 |
|
7277 // Wlan buffer execution only when called from CompleteOutstandingCmdsL (= aCompleting) |
|
7278 for(TInt i = 0; aCompleting && i < iBuffer->At(iExecutionIndex).iWlanNodeBuf->Count(); ++i ) |
|
7279 { |
|
7280 TBuf8<16> addLUID; |
|
7281 _LIT8( KFormat,"%d" ); |
|
7282 |
|
7283 if ( !iBuffer->At( iExecutionIndex ).iWlanNodeBuf->At( i ).iLeaf ) |
|
7284 { |
|
7285 addLUID.Format( KFormat, 0 ); |
|
7286 |
|
7287 if( iBuffer->At( iExecutionIndex ).iLuid > 0 ) |
|
7288 { |
|
7289 addLUID.Format( KFormat, iBuffer->At(iExecutionIndex).iLuid ); |
|
7290 } |
|
7291 |
|
7292 AddNodeObjectL( iBuffer->At( iExecutionIndex ).iWlanNodeBuf->At( i ).iUri->Des(), |
|
7293 addLUID, |
|
7294 iBuffer->At( iExecutionIndex ).iWlanNodeBuf->At( i ).iStatusRef ); |
|
7295 |
|
7296 iBuffer->At( iExecutionIndex ).iExecuted = ETrue; |
|
7297 } |
|
7298 else |
|
7299 { |
|
7300 addLUID.Zero(); |
|
7301 addLUID.Append( iBuffer->At( iExecutionIndex ).iWlanNodeBuf->At( i ).iLuid->Des() ); |
|
7302 |
|
7303 iIAPName = iBuffer->At( iExecutionIndex ).iName->Des(); |
|
7304 |
|
7305 AddLeafObjectL( iBuffer->At( iExecutionIndex ).iWlanNodeBuf->At( i ).iUri->Des(), |
|
7306 addLUID, |
|
7307 iBuffer->At( iExecutionIndex ).iWlanNodeBuf->At( i ).iData->Des(), |
|
7308 KNSmlMimeTypeTextPlain, |
|
7309 iBuffer->At( iExecutionIndex ).iWlanNodeBuf->At( i ).iStatusRef); |
|
7310 |
|
7311 if( iBuffer->At( iExecutionIndex ).iLuid == 0 ) // After BearerL |
|
7312 { |
|
7313 iBuffer->At( iExecutionIndex ).iLuid = iISPId; |
|
7314 } |
|
7315 |
|
7316 } |
|
7317 |
|
7318 iBuffer->At( iExecutionIndex ).iWlanNodeBuf->At( i ).iDone = ETrue; |
|
7319 } |
|
7320 |
|
7321 // |
|
7322 // Remove data from handled AP-commands |
|
7323 // |
|
7324 |
|
7325 ClearBuffer( iBuffer->At(iExecutionIndex).iNodeBuf ); |
|
7326 |
|
7327 if ( aCompleting ) |
|
7328 { |
|
7329 delete iBuffer->At(iExecutionIndex).iNodeBuf; |
|
7330 |
|
7331 ClearBuffer( iBuffer->At(iExecutionIndex).iWlanNodeBuf ); |
|
7332 delete iBuffer->At(iExecutionIndex).iWlanNodeBuf; |
|
7333 |
|
7334 if(iBuffer->At(iExecutionIndex).iMappingName) |
|
7335 { |
|
7336 delete iBuffer->At(iExecutionIndex).iMappingName; |
|
7337 iBuffer->At(iExecutionIndex).iMappingName = NULL; |
|
7338 } |
|
7339 |
|
7340 if(iBuffer->At(iExecutionIndex).iName) |
|
7341 { |
|
7342 delete iBuffer->At(iExecutionIndex).iName; |
|
7343 iBuffer->At(iExecutionIndex).iName = NULL; |
|
7344 } |
|
7345 |
|
7346 iBuffer->Delete(iExecutionIndex); |
|
7347 iBuffer->Compress(); |
|
7348 } |
|
7349 |
|
7350 iExecutingBuffer = EFalse; |
|
7351 iStaleMapUpdate = EFalse; |
|
7352 } |
|
7353 |
|
7354 //------------------------------------------------------------------------------ |
|
7355 // TPtrC16 CNSmlInternetAdapter::GetAddURISeg(const TDesC8& aURI,const TDesC8 aName) |
|
7356 // Returns uri segment until the next segment after given aName |
|
7357 //------------------------------------------------------------------------------ |
|
7358 TPtrC8 CNSmlInternetAdapter::GetAddURISeg(const TDesC8& aURI,const TDesC8& aName) |
|
7359 { |
|
7360 TInt lStrt = aURI.Find(aName); |
|
7361 if (lStrt == KErrNotFound) |
|
7362 { |
|
7363 return aURI; |
|
7364 } |
|
7365 |
|
7366 lStrt += 1; |
|
7367 TInt i = 0; |
|
7368 for( i=lStrt+aName.Length(); i <= aURI.Length()-1; i++ ) |
|
7369 { |
|
7370 if(aURI[i]=='/') |
|
7371 { |
|
7372 break; |
|
7373 } |
|
7374 } |
|
7375 if(i==0) |
|
7376 { |
|
7377 return aURI; |
|
7378 } |
|
7379 else |
|
7380 { |
|
7381 return aURI.Left(i); |
|
7382 } |
|
7383 } |
|
7384 |
|
7385 //============================================= |
|
7386 // CNSmlInternetAdapter::InitializeWAPAIPL() |
|
7387 // Initialize WAP IAP-data before insert |
|
7388 // |
|
7389 //============================================= |
|
7390 TInt CNSmlInternetAdapter::InitializeWAPIAPL( CCommsDbTableView* aTable, |
|
7391 const TDesC8& aName ) |
|
7392 { |
|
7393 aTable->WriteTextL(TPtrC(COMMDB_NAME), ConvertTo16LC(aName)); // Same as IAP |
|
7394 |
|
7395 |
|
7396 aTable->WriteTextL(TPtrC(WAP_CURRENT_BEARER), iWapBearer); |
|
7397 aTable->WriteLongTextL(TPtrC(WAP_START_PAGE), ConvertTo16LC(iWAPAccessPoint)); |
|
7398 CleanupStack::PopAndDestroy(2); //ConvertTo16LC |
|
7399 return KErrNone; |
|
7400 } |
|
7401 |
|
7402 //============================================= |
|
7403 // CNSmlInternetAdapter::InitializeWAPL() |
|
7404 // Initialize WAP IP Bearer-data before insert |
|
7405 // |
|
7406 //============================================= |
|
7407 TInt CNSmlInternetAdapter::InitializeWAPL( CCommsDbTableView* aTable ) |
|
7408 { |
|
7409 TUint32 wapPortNumber = 0; |
|
7410 |
|
7411 aTable->WriteUintL(TPtrC(WAP_ACCESS_POINT_ID), iWapId); |
|
7412 aTable->WriteTextL(TPtrC(WAP_GATEWAY_ADDRESS), KNSmlEmptyIpv4Address); |
|
7413 |
|
7414 aTable->WriteUintL(TPtrC(WAP_WSP_OPTION), EWapWspOptionConnectionOriented); // EWapWspOptionConnectionless |
|
7415 aTable->WriteBoolL(TPtrC(WAP_SECURITY), EFalse ); // if 9200 => false |
|
7416 |
|
7417 aTable->WriteUintL(TPtrC(WAP_IAP), iISPId); |
|
7418 aTable->WriteUintL(TPtrC(WAP_PROXY_PORT), wapPortNumber); |
|
7419 |
|
7420 aTable->WriteTextL(TPtrC(WAP_PROXY_LOGIN_NAME), ConvertTo16LC(iWapUserName)); |
|
7421 aTable->WriteTextL(TPtrC(WAP_PROXY_LOGIN_PASS), ConvertTo16LC(iWapPassword)); |
|
7422 |
|
7423 CleanupStack::PopAndDestroy(2); //ConvertTo16LC |
|
7424 return KErrNone; |
|
7425 } |
|
7426 |
|
7427 //============================================= |
|
7428 // CNSmlInternetAdapter::IsWapPort() |
|
7429 // Check if portnbr for proxy or wap |
|
7430 // |
|
7431 //============================================= |
|
7432 void CNSmlInternetAdapter::IsWapPort( const TDesC8& aObject ) |
|
7433 { |
|
7434 iWapPort = EFalse; |
|
7435 TInt portNbr = GetIntObject8(aObject); |
|
7436 if( portNbr >= KNSmlApWapLowerBase && portNbr <= KNSmlApWapUpperBase ) |
|
7437 { |
|
7438 iWapPort = ETrue; |
|
7439 } |
|
7440 } |
|
7441 |
|
7442 // ------------------------------------------------------------------------------------- |
|
7443 // CNSmlInternetAdapter::FillNodeInfoL() |
|
7444 // Fills the node info in ddf structure |
|
7445 // ------------------------------------------------------------------------------------- |
|
7446 void CNSmlInternetAdapter::FillNodeInfoL( MSmlDmDDFObject& aNode, |
|
7447 TSmlDmAccessTypes aAccTypes, |
|
7448 MSmlDmDDFObject::TOccurence aOccurrence, |
|
7449 MSmlDmDDFObject::TScope aScope, |
|
7450 MSmlDmDDFObject::TDFFormat aFormat, |
|
7451 const TDesC8& aDescription ) |
|
7452 |
|
7453 { |
|
7454 aNode.SetAccessTypesL(aAccTypes); |
|
7455 aNode.SetOccurenceL(aOccurrence); |
|
7456 aNode.SetScopeL(aScope); |
|
7457 aNode.SetDFFormatL(aFormat); |
|
7458 if(aFormat!=MSmlDmDDFObject::ENode) |
|
7459 { |
|
7460 aNode.AddDFTypeMimeTypeL(KNSmlMimeType); |
|
7461 } |
|
7462 aNode.SetDescriptionL(aDescription); |
|
7463 } |
|
7464 |
|
7465 |
|
7466 //======================================================= |
|
7467 // CNSmlInternetAdapter::UpdateIAPnameL() |
|
7468 // Update IAP-table name add Network-table if needed |
|
7469 // Add/update WAP-table name also |
|
7470 // |
|
7471 //======================================================= |
|
7472 TInt CNSmlInternetAdapter::UpdateIAPnameL( TUint32 aId, const TDesC8& aObject ) |
|
7473 { |
|
7474 |
|
7475 TUint32 nwId=0; |
|
7476 TInt ret = KErrNone; |
|
7477 TBool iapReLock = EFalse; |
|
7478 |
|
7479 TBool apEnforce=EFalse; |
|
7480 TRAPD( eError,apEnforce=CheckEnforcementL() ) |
|
7481 DBG_ARGS8(_S8("CNSmlInternetAdapter::UpdateIAPNAme(): EError %d , APEnforcement is %d"),eError,apEnforce); |
|
7482 if( eError==KErrNone && apEnforce ) |
|
7483 { |
|
7484 DoLockIAPTablesL(EFalse); |
|
7485 iWAPRelock = ETrue; |
|
7486 } |
|
7487 |
|
7488 CCommsDbTableView* iapUpdate = iDatabase->OpenViewMatchingUintLC(TPtrC(IAP),TPtrC(COMMDB_ID), aId); |
|
7489 if(IsIAPRecordLockedL(aId)) |
|
7490 { |
|
7491 _DBG_FILE("CNSmlInternetAdapter::AddLeafObjectL(): apaccesspoint record is LOCKED"); |
|
7492 TInt reclockerr = ((CCommsDbProtectTableView*)iapUpdate)->UnprotectRecord(); |
|
7493 DBG_ARGS8(_S8("CNSmlInternetAdapter::AddLeafObjectL ,UnProtecting IAPAccessRecord returned code = %d"),reclockerr); |
|
7494 if(reclockerr==KErrNone) |
|
7495 iapReLock = ETrue; |
|
7496 } |
|
7497 else |
|
7498 { |
|
7499 _DBG_FILE("CNSmlInternetAdapter::AddLeafObjectL(): apaccesspoint record is not write protected"); |
|
7500 } |
|
7501 TInt error = iapUpdate->GotoFirstRecord(); |
|
7502 if (error == KErrNone) |
|
7503 { |
|
7504 _DBG_FILE("CNSmlInternetAdapter::UpdateIAPName, IAP_NETWORK set"); |
|
7505 TRAPD(err, iapUpdate->ReadUintL(TPtrC(IAP_NETWORK),nwId)); |
|
7506 |
|
7507 if(iapUpdate->UpdateRecord()==KErrNone) |
|
7508 { |
|
7509 iapUpdate->WriteTextL(TPtrC(COMMDB_NAME), ConvertTo16LC(aObject)); |
|
7510 |
|
7511 if( err != KErrNone ) // Network entry not yet created |
|
7512 { |
|
7513 AddNetworkL(nwId,aObject); |
|
7514 if( nwId > 0 ) |
|
7515 { |
|
7516 _DBG_FILE("CNSmlInternetAdapter::UpdateIAPName, IAP_NETWORK set"); |
|
7517 DBG_ARGS8(_S8("CNSmlInternetAdapter::UpdateIAPName(): networks is %d"),nwId); |
|
7518 iapUpdate->WriteUintL(TPtrC(IAP_NETWORK),nwId); |
|
7519 } |
|
7520 else |
|
7521 { |
|
7522 ret = KErrGeneral; |
|
7523 } |
|
7524 } |
|
7525 iapUpdate->PutRecordChanges(); |
|
7526 } |
|
7527 CleanupStack::PopAndDestroy(); //ConvertTo16LC |
|
7528 } |
|
7529 CleanupStack::PopAndDestroy(); // iapUpdate |
|
7530 |
|
7531 |
|
7532 if(WapAPExistsL(aId)) |
|
7533 { // Update handled |
|
7534 CCommsDbTableView* wapView; |
|
7535 wapView = iDatabase->OpenViewMatchingUintLC(TPtrC(WAP_ACCESS_POINT), |
|
7536 TPtrC(COMMDB_ID), |
|
7537 iWapId); |
|
7538 TInt errorCode = wapView->GotoFirstRecord(); |
|
7539 |
|
7540 // Read all columns needed. |
|
7541 if ( errorCode == KErrNone ) |
|
7542 { |
|
7543 if(wapView->UpdateRecord()==KErrNone) |
|
7544 { |
|
7545 wapView->WriteTextL(TPtrC(COMMDB_NAME), ConvertTo16LC(aObject)); |
|
7546 wapView->PutRecordChanges(); |
|
7547 CleanupStack::PopAndDestroy(); //ConvertTo16LC |
|
7548 } |
|
7549 } |
|
7550 CleanupStack::PopAndDestroy(); // wapView |
|
7551 } |
|
7552 else |
|
7553 { // Insert handled |
|
7554 CCommsDbTableView* insView; |
|
7555 TInt wapInitOK = KErrCancel; |
|
7556 |
|
7557 insView = iDatabase->OpenTableLC(TPtrC(WAP_ACCESS_POINT)); |
|
7558 iWapId = 0; |
|
7559 wapInitOK = insView->InsertRecord(iWapId); |
|
7560 if(wapInitOK == KErrNone) |
|
7561 { |
|
7562 iWAPAccessPoint.Zero(); |
|
7563 iWapUserName.Zero(); |
|
7564 iWapPassword.Zero(); |
|
7565 iWapBearer = TPtrC(WAP_IP_BEARER); |
|
7566 |
|
7567 wapInitOK = InitializeWAPIAPL( insView, aObject ); |
|
7568 wapInitOK = insView->PutRecordChanges(); |
|
7569 |
|
7570 if( wapInitOK == KErrNone ) |
|
7571 { |
|
7572 CCommsDbTableView* updView; |
|
7573 TUint32 iWapId2 = 0; |
|
7574 iISPId = aId; // IAP number set |
|
7575 updView = iDatabase->OpenTableLC(TPtrC(WAP_IP_BEARER)); |
|
7576 if(updView->InsertRecord(iWapId2) == KErrNone) |
|
7577 { |
|
7578 InitializeWAPL(updView); |
|
7579 updView->PutRecordChanges(); |
|
7580 } |
|
7581 CleanupStack::PopAndDestroy(); // updView |
|
7582 } |
|
7583 } |
|
7584 else |
|
7585 { |
|
7586 ret = KErrGeneral; |
|
7587 } |
|
7588 CleanupStack::PopAndDestroy(); // insView |
|
7589 } |
|
7590 if(FeatureManager::FeatureSupported(KFeatureIdSapPolicyManagement)) |
|
7591 { |
|
7592 if(iWAPRelock) |
|
7593 { |
|
7594 DoLockIAPTablesL(ETrue); |
|
7595 iWAPRelock = EFalse; |
|
7596 } |
|
7597 } |
|
7598 if(iapReLock) |
|
7599 { |
|
7600 TInt reclockerr = DoProtectIAPRecordL(aId,ETrue); |
|
7601 DBG_ARGS8(_S8("CNSmlInternetAdapter::AddLeafObjectL ,UnProtecting IAPAccessRecord returned code = %d"),reclockerr); |
|
7602 if(reclockerr==KErrNone) |
|
7603 iapReLock = EFalse; |
|
7604 } |
|
7605 return ret; |
|
7606 } |
|
7607 |
|
7608 //============================================= |
|
7609 // CNSmlInternetAdapter::InitializeVPNServiceL() |
|
7610 // Initialize VPNService-data before insert |
|
7611 //============================================= |
|
7612 TInt CNSmlInternetAdapter::InitializeVPNServiceL( CCommsDbTableView* aTable ) |
|
7613 { |
|
7614 _LIT(KdefPolicy, "Home"); |
|
7615 |
|
7616 aTable->WriteTextL(TPtrC(COMMDB_NAME) ,iIAPName); // Same as IAP |
|
7617 |
|
7618 aTable->WriteTextL(TPtrC(VPN_SERVICE_POLICY) ,KdefPolicy); |
|
7619 aTable->WriteUintL(TPtrC(VPN_SERVICE_IAP) ,1); |
|
7620 aTable->WriteUintL(TPtrC(VPN_SERVICE_NETWORKID) ,1); |
|
7621 |
|
7622 return KErrNone; |
|
7623 } |
|
7624 |
|
7625 |
|
7626 //============================================= |
|
7627 // CNSmlInternetAdapter::InitializeLANServiceL() |
|
7628 // Initialize LANService-data before insert |
|
7629 //============================================= |
|
7630 TInt CNSmlInternetAdapter::InitializeLANServiceL( CCommsDbTableView* aTable ) |
|
7631 { |
|
7632 if ( !iWlanSupported ) |
|
7633 { |
|
7634 _DBG_FILE("CNSmlInternetAdapter::InitializeLANServiceL, WLAN not supported."); |
|
7635 return KErrNotSupported; |
|
7636 } |
|
7637 _LIT(KgifNetworks, "ip,ip6"); |
|
7638 _LIT(Kdns6Address, "0:0:0:0:0:0:0:0"); |
|
7639 _LIT(KdefaultNetmask, "255.255.255.0"); |
|
7640 |
|
7641 aTable->WriteTextL(TPtrC(COMMDB_NAME) ,ConvertTo16LC(iIAPName)); // Same as IAP |
|
7642 aTable->WriteTextL(TPtrC(LAN_IF_NETWORKS) ,KgifNetworks); |
|
7643 aTable->WriteBoolL(TPtrC(SERVICE_IP_ADDR_FROM_SERVER),ETrue); // DHCP by default. |
|
7644 aTable->WriteTextL(TPtrC(SERVICE_IP_ADDR) ,KNSmlEmptyIpv4Address); |
|
7645 aTable->WriteTextL(TPtrC(SERVICE_IP_NETMASK) ,KdefaultNetmask); |
|
7646 aTable->WriteBoolL(TPtrC(SERVICE_IP_DNS_ADDR_FROM_SERVER),ETrue); |
|
7647 aTable->WriteTextL(TPtrC(SERVICE_IP_NAME_SERVER1),KNSmlEmptyIpv4Address); |
|
7648 aTable->WriteTextL(TPtrC(SERVICE_IP_NAME_SERVER2),KNSmlEmptyIpv4Address); |
|
7649 aTable->WriteTextL(TPtrC(SERVICE_IP_GATEWAY) ,KNSmlEmptyIpv4Address); |
|
7650 |
|
7651 aTable->WriteBoolL(TPtrC(SERVICE_IP6_DNS_ADDR_FROM_SERVER),ETrue ); |
|
7652 aTable->WriteTextL(TPtrC(SERVICE_IP6_NAME_SERVER1),Kdns6Address); |
|
7653 aTable->WriteTextL(TPtrC(SERVICE_IP6_NAME_SERVER2),Kdns6Address); |
|
7654 aTable->WriteTextL(TPtrC(SERVICE_CONFIG_DAEMON_MANAGER_NAME), KDaemonManagerName); |
|
7655 aTable->WriteTextL(TPtrC(SERVICE_CONFIG_DAEMON_NAME), KConfigDaemonName ); |
|
7656 |
|
7657 CleanupStack::PopAndDestroy(); //ConvertTo16LC |
|
7658 return KErrNone; |
|
7659 } |
|
7660 |
|
7661 //============================================= |
|
7662 // CNSmlInternetAdapter::IsWLANfield() |
|
7663 // Check if handled by WLAN-adapter |
|
7664 //============================================= |
|
7665 TBool CNSmlInternetAdapter::IsWLANfield( const TDesC8& aURI ) |
|
7666 { |
|
7667 TBool ret(EFalse); |
|
7668 |
|
7669 SetField(aURI); |
|
7670 |
|
7671 if(KNSmlDdfNetworkID().Match(*iField) == 0) // ID not valid |
|
7672 { |
|
7673 return ret; |
|
7674 } |
|
7675 if(KNSmlDdfAP().Match(*iField) == 0) // AP not valid |
|
7676 { |
|
7677 return ret; |
|
7678 } |
|
7679 if (aURI.Match(_L8("AP/*/NAPDef/*/WLAN/*")) != KErrNotFound) |
|
7680 { |
|
7681 DBG_ARGS8(_S8("AP:IsWLANfield URI - <%S> <%S> FOUND"), &aURI, iField ); |
|
7682 ret = ETrue; |
|
7683 } |
|
7684 |
|
7685 return ret; |
|
7686 } |
|
7687 |
|
7688 //============================================= |
|
7689 // CNSmlInternetAdapter::IsWlanL() |
|
7690 // Check if WLAN accesspoint |
|
7691 //============================================= |
|
7692 TBool CNSmlInternetAdapter::IsWlanL( const TDesC8& aURI ) |
|
7693 { |
|
7694 TBool ret(EFalse); |
|
7695 |
|
7696 if ( !iWlanSupported ) |
|
7697 { |
|
7698 _DBG_FILE("CNSmlInternetAdapter::IsWlanL, WLAN not supported."); |
|
7699 return ret; |
|
7700 } |
|
7701 |
|
7702 TBuf<KCommsDbSvrMaxFieldLength> serviceType; |
|
7703 |
|
7704 // Get IAP nbr for servicetype |
|
7705 TUint32 apWlan = GetAPIdFromURIL(aURI); |
|
7706 |
|
7707 // IAP-table search serviceType (=Bearer) |
|
7708 CCommsDbTableView* iapViews = iDatabase->OpenViewMatchingUintLC(TPtrC(IAP), |
|
7709 TPtrC(COMMDB_ID), |
|
7710 apWlan); |
|
7711 |
|
7712 TInt errorCode = iapViews->GotoFirstRecord(); |
|
7713 |
|
7714 // Read iapService from (IAP) |
|
7715 if ( errorCode == KErrNone ) |
|
7716 { |
|
7717 iapViews->ReadTextL(TPtrC(IAP_SERVICE_TYPE), serviceType); |
|
7718 if(serviceType == TPtrC(LAN_SERVICE)) |
|
7719 { |
|
7720 ret = ETrue; |
|
7721 } |
|
7722 } |
|
7723 CleanupStack::PopAndDestroy(); // iapViews |
|
7724 |
|
7725 return ret; |
|
7726 } |
|
7727 |
|
7728 //------------------------------------------------------------------------------ |
|
7729 // TBool CNSmlInternetAdapter::GetLanBearerL() |
|
7730 //------------------------------------------------------------------------------ |
|
7731 TBool CNSmlInternetAdapter::GetLanBearerL(TUint32& aId) |
|
7732 { |
|
7733 TBool ret = EFalse; |
|
7734 |
|
7735 if ( !iWlanSupported ) |
|
7736 { |
|
7737 _DBG_FILE("CNSmlInternetAdapter::GetLanBearerL, WLAN not supported."); |
|
7738 return ret; |
|
7739 } |
|
7740 |
|
7741 CCommsDbTableView* checkView; |
|
7742 |
|
7743 HBufC* bName = HBufC::NewLC(15); |
|
7744 TPtr bNamePtr = bName->Des(); |
|
7745 _LIT(KWlanBearer, "WLANBearer" ); |
|
7746 bNamePtr.Format( KWlanBearer ); |
|
7747 |
|
7748 checkView = iDatabase->OpenViewMatchingTextLC(TPtrC(LAN_BEARER),TPtrC(COMMDB_NAME), bNamePtr); |
|
7749 TInt error = checkView->GotoFirstRecord(); |
|
7750 if (error == KErrNone) |
|
7751 { |
|
7752 checkView->ReadUintL(TPtrC(COMMDB_ID), aId); |
|
7753 ret = ETrue; |
|
7754 } |
|
7755 else |
|
7756 { |
|
7757 aId = 1; // Default modem |
|
7758 } |
|
7759 DBG_ARGS8(_S8("CNSmlInternetAdapter:GetLanBearerL %d"), aId); |
|
7760 |
|
7761 CleanupStack::PopAndDestroy(2); // checkView bName |
|
7762 |
|
7763 return ret; |
|
7764 } |
|
7765 |
|
7766 |
|
7767 //------------------------------------------------------------------------------ |
|
7768 // TBool CNSmlInternetAdapter::GetModemBearerL() |
|
7769 //------------------------------------------------------------------------------ |
|
7770 TBool CNSmlInternetAdapter::GetModemBearerL(TUint32& aId) |
|
7771 { |
|
7772 TBool ret = EFalse; |
|
7773 CCommsDbTableView* checkView; |
|
7774 |
|
7775 HBufC* bName = HBufC::NewLC(15); |
|
7776 TPtr bNamePtr = bName->Des(); |
|
7777 |
|
7778 if(iBearer == TPtrC(OUTGOING_GPRS) || |
|
7779 iBearer == TPtrC(INCOMING_GPRS) ) |
|
7780 { |
|
7781 _LIT(KGprsModem, "GPRS Modem" ); |
|
7782 bNamePtr.Format( KGprsModem ); |
|
7783 } |
|
7784 |
|
7785 checkView = iDatabase->OpenViewMatchingTextLC(TPtrC(MODEM_BEARER),TPtrC(COMMDB_NAME), bNamePtr); |
|
7786 TInt error = checkView->GotoFirstRecord(); |
|
7787 if (error == KErrNone) |
|
7788 { |
|
7789 checkView->ReadUintL(TPtrC(COMMDB_ID), aId); |
|
7790 ret = ETrue; |
|
7791 } |
|
7792 else |
|
7793 { |
|
7794 aId = 5; // Default modem 1->5 ??? |
|
7795 } |
|
7796 DBG_ARGS8(_S8("CNSmlInternetAdapter:GetModemBearerL %d"), aId); |
|
7797 |
|
7798 CleanupStack::PopAndDestroy(2); // checkView bName |
|
7799 |
|
7800 return ret; |
|
7801 } |
|
7802 |
|
7803 |
|
7804 // --------------------------------------------------------- |
|
7805 // NextAPNameL() |
|
7806 // Generates new AP name. |
|
7807 // --------------------------------------------------------- |
|
7808 void CNSmlInternetAdapter::NextAPNameL(const TDesC8& aName) |
|
7809 { |
|
7810 // generate name candidate |
|
7811 HBufC8* nameCandidate = HBufC8::NewLC(aName.Length()+12); |
|
7812 TPtr8 candidatePtr = nameCandidate->Des(); |
|
7813 |
|
7814 // loop while valid name is found |
|
7815 TBool validName; |
|
7816 |
|
7817 // loop while valid name is found |
|
7818 TInt i=0; |
|
7819 do { |
|
7820 validName = ETrue; |
|
7821 candidatePtr.Format(aName); |
|
7822 if(i>0) |
|
7823 { |
|
7824 _LIT( KLeftBrace, "(" ); |
|
7825 _LIT( KRightBrace, ")" ); |
|
7826 HBufC* buf = HBufC::NewLC(10); //10 = max length of 32bit integer |
|
7827 TPtr ptrBuf = buf->Des(); |
|
7828 ptrBuf.Num(i); |
|
7829 candidatePtr.Append( KLeftBrace ); |
|
7830 candidatePtr.Append(ptrBuf); |
|
7831 candidatePtr.Append( KRightBrace ); |
|
7832 CleanupStack::PopAndDestroy(); //buf |
|
7833 } |
|
7834 i++; |
|
7835 if(!IsValidNameL(candidatePtr)) |
|
7836 { |
|
7837 validName = EFalse; |
|
7838 } |
|
7839 } while( !validName ); |
|
7840 |
|
7841 iIAPName = candidatePtr; |
|
7842 |
|
7843 CleanupStack::PopAndDestroy(); //nameCandidate |
|
7844 } |
|
7845 |
|
7846 //------------------------------------------------------------------------------ |
|
7847 // TBool CNSmlInternetAdapter::IsValidNameL() |
|
7848 //------------------------------------------------------------------------------ |
|
7849 TBool CNSmlInternetAdapter::IsValidNameL(const TDesC8& aName) |
|
7850 { |
|
7851 TBool ret = ETrue; |
|
7852 CCommsDbTableView* nameView; |
|
7853 |
|
7854 nameView = iDatabase->OpenViewMatchingTextLC( TPtrC(IAP),TPtrC(COMMDB_NAME), aName); |
|
7855 |
|
7856 TInt errorCode = nameView->GotoFirstRecord(); |
|
7857 |
|
7858 if (errorCode == KErrNone ) |
|
7859 { |
|
7860 ret = EFalse; // If found error returned |
|
7861 } |
|
7862 |
|
7863 CleanupStack::PopAndDestroy(); // nameView |
|
7864 return ret; |
|
7865 } |
|
7866 |
|
7867 //------------------------------------------------------------------------------ |
|
7868 // TBool CNSmlInternetAdapter::InitializeDNSParamsFromBuffL(const TPtrC8 aParentUri, |
|
7869 // TInt& aDnsPri ) |
|
7870 // Finds parameters needed in updating DNSAddrL from buffer |
|
7871 //------------------------------------------------------------------------------ |
|
7872 TBool CNSmlInternetAdapter::InitializeDNSParamsFromBuffL( const TPtrC8 aParentUri, |
|
7873 TInt& aDnsPri ) |
|
7874 { |
|
7875 TInt cmd(0); |
|
7876 TBool found(EFalse); |
|
7877 |
|
7878 TNSmlAPBufferElement& thisElem = iBuffer->At( 0 ); |
|
7879 |
|
7880 // Parse URI to match |
|
7881 CBufBase* buf = CBufFlat::NewL(150); |
|
7882 CleanupStack::PushL( buf ); |
|
7883 buf->InsertL(0, aParentUri); |
|
7884 buf->InsertL(buf->Size(), KNSmlDmApValFSlash); |
|
7885 buf->InsertL(buf->Size(), KNSmlDdfDNSPriority ); |
|
7886 TBuf8<150> tmp; |
|
7887 buf->Read(0, tmp, buf->Size()); |
|
7888 |
|
7889 cmd = thisElem.iNodeBuf->Count() -1; |
|
7890 // check if the DNSPriority is sent for DNSAddr/<x> |
|
7891 while( cmd >= 0 ) |
|
7892 { |
|
7893 TNSmlAPAddElement& dbgElem2 = thisElem.iNodeBuf->At(cmd); |
|
7894 if( thisElem.iNodeBuf->At(cmd).iUri->Match( tmp ) != KErrNotFound ) |
|
7895 { |
|
7896 TLex8 lex(thisElem.iNodeBuf->At(cmd).iData->Des()); |
|
7897 lex.Val(aDnsPri); |
|
7898 thisElem.iNodeBuf->At(cmd).iDone = ETrue; |
|
7899 found = ETrue; |
|
7900 } |
|
7901 cmd--; |
|
7902 } |
|
7903 CleanupStack::PopAndDestroy(buf); |
|
7904 return found; |
|
7905 } |
|
7906 |
|
7907 //------------------------------------------------------------------------------ |
|
7908 // TBool CNSmlInternetAdapter::DnsToLuid(const UriUtils::TUriHostType aType,) |
|
7909 // const TInt aPriority ) const |
|
7910 // Encodes special luid for DNSAddr/<X> |
|
7911 //------------------------------------------------------------------------------ |
|
7912 TInt CNSmlInternetAdapter::DnsToLuid( const UriUtils::TUriHostType aType, |
|
7913 const TInt aPriority ) const |
|
7914 { |
|
7915 return KNSmlApDnsLuidUpperBase + static_cast<TInt>(aType)*10 + aPriority; |
|
7916 } |
|
7917 //------------------------------------------------------------------------------ |
|
7918 // TBool CNSmlInternetAdapter::LuidToDns(UriUtils::TUriHostType& aType,) |
|
7919 // TInt& aPriority, const TInt aLuid ) const |
|
7920 // Decodes DNAddr/<X> type from LUID |
|
7921 //------------------------------------------------------------------------------ |
|
7922 TInt CNSmlInternetAdapter::LuidToDns( UriUtils::TUriHostType& aType, |
|
7923 TInt& aPriority, const TInt aLuid ) const |
|
7924 { |
|
7925 TInt err = KErrNone; |
|
7926 if ( aLuid < KNSmlApDnsLuidUpperBase ) |
|
7927 { |
|
7928 err = KErrGeneral; |
|
7929 } |
|
7930 else |
|
7931 { |
|
7932 aPriority = ( aLuid - KNSmlApDnsLuidUpperBase ) % 10; |
|
7933 if ( (aPriority > 0) && (aPriority < 3) ) |
|
7934 { |
|
7935 TInt type = ( aLuid - KNSmlApDnsLuidUpperBase - aPriority ) / 10; |
|
7936 if ( ( type >= 0 ) && ( type < 2 ) ) |
|
7937 { |
|
7938 aType = static_cast<UriUtils::TUriHostType>(type); |
|
7939 } |
|
7940 else |
|
7941 { |
|
7942 err = KErrGeneral; |
|
7943 } |
|
7944 } |
|
7945 else |
|
7946 { |
|
7947 err = KErrGeneral; |
|
7948 } |
|
7949 } |
|
7950 return err; |
|
7951 } |
|
7952 //------------------------------------------------------------------------------ |
|
7953 // TBool CNSmlInternetAdapter::RemoveLastSeg(const TDesC8& aURI) |
|
7954 // Returns URI without its last segment |
|
7955 //------------------------------------------------------------------------------ |
|
7956 TPtrC8 CNSmlInternetAdapter::RemoveLastSeg(const TDesC8& aURI) const |
|
7957 { |
|
7958 TInt i; |
|
7959 for(i=aURI.Length()-1;i>=0;i--) |
|
7960 { |
|
7961 if(aURI[i]==KNSmlDMUriSeparator) |
|
7962 { |
|
7963 break; |
|
7964 } |
|
7965 } |
|
7966 if(i>0) |
|
7967 { |
|
7968 return aURI.Left(i); |
|
7969 } |
|
7970 else |
|
7971 { |
|
7972 return KNullDesC8(); |
|
7973 } |
|
7974 } |
|
7975 |
|
7976 //------------------------------------------------------------------------------ |
|
7977 // void CNSmlInternetAdapter::ClearBuffer() |
|
7978 // Deletes all dynamically allocated data from given array's each element |
|
7979 // and resets the buffer. |
|
7980 //------------------------------------------------------------------------------ |
|
7981 void CNSmlInternetAdapter::ClearBuffer( CArrayFixFlat<TNSmlAPAddElement>* aBuffer ) |
|
7982 { |
|
7983 for( TInt i = 0; i < aBuffer->Count(); i++ ) |
|
7984 { |
|
7985 delete aBuffer->At(i).iUri; |
|
7986 aBuffer->At(i).iUri = NULL; |
|
7987 |
|
7988 delete aBuffer->At(i).iData; |
|
7989 aBuffer->At(i).iData = NULL; |
|
7990 |
|
7991 delete aBuffer->At(i).iLuid; |
|
7992 aBuffer->At(i).iLuid = NULL; |
|
7993 } |
|
7994 |
|
7995 aBuffer->Reset(); |
|
7996 } |
|
7997 |
|
7998 |
|
7999 |
|
8000 //---------------------------------------------------------------------- |
|
8001 //TBool CNSmlInternetAdapter::IsValidIPv4AddressL(const TDesC8& aNapAddr) |
|
8002 //Checks if the string is of correct IPV4 address format x.x.x.x and |
|
8003 //numbers are within the range 0-255 |
|
8004 //returns true on sucess and false on failure. |
|
8005 //---------------------------------------------------------------------- |
|
8006 TBool CNSmlInternetAdapter::IsValidIPv4AddressL(const TDesC8& aNapAddr) |
|
8007 { |
|
8008 TInt digitLen(0); |
|
8009 TBool ret = EFalse; |
|
8010 _LIT8( KNSmlDMV4Format, "*.*.*.*" ); |
|
8011 |
|
8012 if( aNapAddr.Match(KNSmlDMV4Format)!= KErrNotFound ) |
|
8013 { |
|
8014 TInt pos = 0; |
|
8015 TInt numDots=0; |
|
8016 TInt maxIP=255; |
|
8017 TInt minIP=0; |
|
8018 for( TInt i=0;i<aNapAddr.Length();i++ ) |
|
8019 { |
|
8020 digitLen ++; |
|
8021 //Check if aNapAddr contain any characters other than |
|
8022 // 0 - 9 and ".", If yes return from the function. |
|
8023 if( aNapAddr[i]!=KNSmlDMDot && (aNapAddr[i]<KNSmlDMAsciiIntStart || aNapAddr[i] > KNSmlDMAsciiIntEnd )) |
|
8024 { |
|
8025 ret = EFalse; |
|
8026 break; |
|
8027 } |
|
8028 if(aNapAddr[i]==KNSmlDMDot) |
|
8029 { |
|
8030 ret = ETrue; |
|
8031 if (i > 0 ) |
|
8032 { |
|
8033 TInt digit; |
|
8034 TPtrC8 ptrOneDigit = aNapAddr.Mid(pos,digitLen-1); |
|
8035 TLex8 lexint(ptrOneDigit); |
|
8036 if( lexint.Val(digit)!=KErrNone || digit >= maxIP || digit < minIP ) |
|
8037 { |
|
8038 ret = EFalse; |
|
8039 break; |
|
8040 } |
|
8041 } // end of if i > 0 |
|
8042 pos = i+1; |
|
8043 numDots++; |
|
8044 digitLen=0; |
|
8045 } // end of if |
|
8046 } //End of for |
|
8047 if( numDots==3 && ret ) |
|
8048 { |
|
8049 ret = ETrue; |
|
8050 } |
|
8051 else |
|
8052 { |
|
8053 ret = EFalse; |
|
8054 } |
|
8055 } // end of outer if, format check |
|
8056 return ret; |
|
8057 } |
|
8058 |
|
8059 TBool CNSmlInternetAdapter::IsWAPAccessPointRecordLockedL(TUint32 aRecord) |
|
8060 { |
|
8061 _DBG_FILE("CNSmlInternetAdapter::IsWAPAccessPointRecordLockedL(): BEGIN"); |
|
8062 TBool ret = EFalse; |
|
8063 CCommsDbTableView* wapView; |
|
8064 DBG_ARGS8(_S8("CNSmlInternetAdapter::IsWAPAccessPointRecordLockedL record being checked = %d"),aRecord); |
|
8065 wapView = iDatabase->OpenViewMatchingUintLC(TPtrC(WAP_ACCESS_POINT), |
|
8066 TPtrC(COMMDB_ID), |
|
8067 aRecord); |
|
8068 |
|
8069 TInt aAccess( 0 ); |
|
8070 if(wapView!=NULL) |
|
8071 { |
|
8072 _DBG_FILE("CNSmlInternetAdapter::IsWAPAccessPointRecordLockedL():wap record exists, check for access type"); |
|
8073 TInt err = (((CCommsDbProtectTableView*) wapView )->GetRecordAccess( aAccess ) ); |
|
8074 DBG_ARGS8(_S8("CNSmlInternetAdapter::IsWAPAccessPointRecordLockedL , GetrecordAccess code is =%d and acess type of record = %d"),err, aAccess); |
|
8075 CleanupStack::PopAndDestroy( wapView); |
|
8076 if(aAccess == RDbRowSet::EReadOnly) |
|
8077 ret = ETrue; |
|
8078 } |
|
8079 |
|
8080 _DBG_FILE("CNSmlInternetAdapter::IsWAPAccessPointRecordLockedL(): END"); |
|
8081 return ret; |
|
8082 |
|
8083 } |
|
8084 //---------------------------------------------------------------------- |
|
8085 //TBool CNSmlInternetAdapter::DoProtectWAPAccessRecordL(TUint32 aRecord,TBool aProtect) |
|
8086 // protect or unprotect wapaccesspoint record of access point being altered |
|
8087 //---------------------------------------------------------------------- |
|
8088 |
|
8089 |
|
8090 TInt CNSmlInternetAdapter::DoProtectWAPAccessRecordL(TUint32 aRecord,TBool aProtect) |
|
8091 { |
|
8092 _DBG_FILE("CNSmlInternetAdapter::DoProtectWAPAccessRecordL(): BEGIN"); |
|
8093 DBG_ARGS8(_S8("CNSmlInternetAdapter::DoProtectWAPAccessRecordL , record and protect value =%d = %d"),aRecord, aProtect); |
|
8094 TInt err = KErrNone; |
|
8095 |
|
8096 CCommsDbTableView* wapView; |
|
8097 wapView = iDatabase->OpenViewMatchingUintLC(TPtrC(WAP_ACCESS_POINT), |
|
8098 TPtrC(COMMDB_ID), |
|
8099 aRecord); |
|
8100 if( wapView != NULL ) |
|
8101 { |
|
8102 _DBG_FILE("CNSmlInternetAdapter::DoProtectWAPAccessRecordL(): wap record exists"); |
|
8103 if( !aProtect ) |
|
8104 { |
|
8105 err = ( (CCommsDbProtectTableView*) wapView )->UnprotectRecord(); |
|
8106 DBG_ARGS8(_S8("CNSmlInternetAdapter::DoProtectWAPAccessRecordL ,error code of Unprotectrecord = %d"),err); |
|
8107 } |
|
8108 |
|
8109 else |
|
8110 { |
|
8111 err = ( (CCommsDbProtectTableView*) wapView )->ProtectRecord(); |
|
8112 DBG_ARGS8(_S8("CNSmlInternetAdapter::DoProtectWAPAccessRecordL ,error code of ProtectRecord = %d"),err); |
|
8113 } |
|
8114 |
|
8115 CleanupStack::PopAndDestroy( wapView); |
|
8116 } |
|
8117 |
|
8118 _DBG_FILE("CNSmlInternetAdapter::DoProtectWAPAccessRecordL(): END"); |
|
8119 return err; |
|
8120 } |
|
8121 |
|
8122 //------------------------------------------------------------------------------ |
|
8123 // TUint32 CNSmlInternetAdapter::GetIAPSeamlessnessL(TUint32 aId) |
|
8124 // Gets the seamlessness value from the IAPMetadata table though the cmmanager API |
|
8125 //------------------------------------------------------------------------------ |
|
8126 |
|
8127 TUint32 CNSmlInternetAdapter::GetIAPSeamlessnessL(TUint32 aId) |
|
8128 { |
|
8129 _DBG_FILE("CNSmlInternetAdapter::GetIAPSeamlessnessL(): begin"); |
|
8130 //Deleting iDatabase, Required since CommsDB has one view open for reading and commsdat API would |
|
8131 //return KErrLocked if this is not done |
|
8132 TBool reopenTransaction( EFalse ); |
|
8133 if( iDatabase->InTransaction() ) |
|
8134 { |
|
8135 iDatabase->CommitTransaction(); |
|
8136 iTransactionCommitted = ETrue; |
|
8137 reopenTransaction = ETrue; |
|
8138 } |
|
8139 |
|
8140 |
|
8141 RCmManagerExt cmManagerExt; |
|
8142 cmManagerExt.OpenL(); |
|
8143 RCmConnectionMethodExt cm = cmManagerExt.ConnectionMethodL( aId ); |
|
8144 CleanupClosePushL( cm ); |
|
8145 TUint32 smless= cm.GetIntAttributeL( CMManager::ECmSeamlessnessLevel ); |
|
8146 CleanupStack::PopAndDestroy( ); |
|
8147 cmManagerExt.Close(); |
|
8148 |
|
8149 //Recreate reference to CommsDB since other tables |
|
8150 //are manipulated with Commsdb |
|
8151 if( reopenTransaction ) |
|
8152 { |
|
8153 TInt dberr = iDatabase->BeginTransaction(); |
|
8154 if( dberr == KErrLocked ) |
|
8155 { |
|
8156 _DBG_FILE("GetIAPSeamlessnessL: CommsDat was locked."); |
|
8157 TInt retry = KBeginTransRetryCount; |
|
8158 while ( retry > 0 && dberr == KErrLocked ) |
|
8159 { |
|
8160 User::After(KBeginTransRetryDelay); |
|
8161 _DBG_FILE("GetIAPSeamlessnessL: Slept 1 second. Try again"); |
|
8162 dberr = iDatabase->BeginTransaction(); |
|
8163 retry--; |
|
8164 } |
|
8165 if(dberr != KErrNone) |
|
8166 { |
|
8167 _DBG_FILE("CNSmlInternetAdapter: BeginTransaction failed completely."); |
|
8168 User::Leave( dberr ); |
|
8169 } |
|
8170 } |
|
8171 } |
|
8172 |
|
8173 _DBG_FILE("CNSmlInternetAdapter::GetIAPSeamlessnessL(): End"); |
|
8174 return smless; |
|
8175 |
|
8176 } |
|
8177 |
|
8178 //------------------------------------------------------------------------------ |
|
8179 // TUint32 CNSmlInternetAdapter::GetIAPMetaDataL(TUint32 aId) |
|
8180 // Gets the metadata value from the IAPMetadata table though the cmmanager API |
|
8181 //-------------------------------------------------------------------------- |
|
8182 |
|
8183 TUint32 CNSmlInternetAdapter::GetIAPMetaDataL(TUint32 aId) |
|
8184 { |
|
8185 _DBG_FILE("CNSmlInternetAdapter::GetIAPMetaDataL(): begin"); |
|
8186 //Deleting iDatabase, Required since CommsDB has one view open for reading and commsdat API would |
|
8187 //return KErrLocked if this is not done |
|
8188 TBool reopenTransaction( EFalse ); |
|
8189 if( iDatabase->InTransaction() ) |
|
8190 { |
|
8191 iDatabase->CommitTransaction(); |
|
8192 iTransactionCommitted = ETrue; |
|
8193 reopenTransaction = ETrue; |
|
8194 } |
|
8195 |
|
8196 TUint32 metadata, highlight, hidden; |
|
8197 RCmManagerExt cmManagerExt; |
|
8198 |
|
8199 cmManagerExt.OpenL(); |
|
8200 RCmConnectionMethodExt cm = cmManagerExt.ConnectionMethodL( aId ); |
|
8201 CleanupClosePushL( cm ); |
|
8202 |
|
8203 TBool metaHidden = cm.GetBoolAttributeL( CMManager::ECmMetaHiddenAgent); |
|
8204 TBool metaHL = cm.GetBoolAttributeL( CMManager::ECmMetaHighlight); |
|
8205 highlight = EMetaHighlight & metaHL; |
|
8206 hidden = EMetaHiddenAgent & metaHidden; |
|
8207 metadata = highlight | hidden; |
|
8208 |
|
8209 CleanupStack::PopAndDestroy( ); |
|
8210 cmManagerExt.Close(); |
|
8211 //Recreate reference to CommsDB since other tables |
|
8212 //are manipulated with Commsdb |
|
8213 if( reopenTransaction ) |
|
8214 { |
|
8215 TInt dberr = iDatabase->BeginTransaction(); |
|
8216 if( dberr == KErrLocked ) |
|
8217 { |
|
8218 _DBG_FILE("GetIAPMetaDataL: CommsDat was locked."); |
|
8219 TInt retry = KBeginTransRetryCount; |
|
8220 while ( retry > 0 && dberr == KErrLocked ) |
|
8221 { |
|
8222 User::After(KBeginTransRetryDelay); |
|
8223 _DBG_FILE("GetIAPMetaDataL: Slept 1 second. Try again"); |
|
8224 dberr = iDatabase->BeginTransaction(); |
|
8225 retry--; |
|
8226 } |
|
8227 if(dberr != KErrNone) |
|
8228 { |
|
8229 _DBG_FILE("CNSmlInternetAdapter: BeginTransaction failed completely."); |
|
8230 User::Leave( dberr ); |
|
8231 } |
|
8232 } |
|
8233 } |
|
8234 |
|
8235 _DBG_FILE("CNSmlInternetAdapter::GetIAPMetaDataL(): end"); |
|
8236 return metadata; |
|
8237 |
|
8238 } |
|
8239 //------------------------------------------------------------------------------ |
|
8240 // void CNSmlInternetAdapter::SetIAPSeamlessnessL(TUint32 apMetaID,TUint32 aSeam,TInt aStatusRef) |
|
8241 // Sets the seamlessness value to the IAPMetadata table though the cmmanager API |
|
8242 //------------------------------------------------------------------------------ |
|
8243 void CNSmlInternetAdapter::SetIAPSeamlessnessL(TUint32 apMetaID,TUint32 aSeam,TInt aStatusRef) |
|
8244 { |
|
8245 |
|
8246 _DBG_FILE("CNSmlInternetAdapter::SetIAPSeamlessnessL(): begin"); |
|
8247 TBool reopenTransaction( EFalse ); |
|
8248 if( iDatabase->InTransaction() ) |
|
8249 { |
|
8250 iDatabase->CommitTransaction(); |
|
8251 iTransactionCommitted = ETrue; |
|
8252 reopenTransaction = ETrue; |
|
8253 } |
|
8254 |
|
8255 |
|
8256 RCmManagerExt cmManagerExt; |
|
8257 cmManagerExt.OpenL(); |
|
8258 RCmConnectionMethodExt cm ; |
|
8259 TInt cmerror = KErrNone; |
|
8260 TRAP(cmerror, cm= cmManagerExt.ConnectionMethodL( apMetaID )); |
|
8261 CleanupClosePushL( cm ); |
|
8262 TRAPD(sErr,cm.SetIntAttributeL( CMManager::ECmSeamlessnessLevel,aSeam )) |
|
8263 if(sErr == KErrNone) |
|
8264 { |
|
8265 cm.UpdateL(); |
|
8266 iCallBack->SetStatusL(aStatusRef,CSmlDmAdapter::EOk); |
|
8267 } |
|
8268 else |
|
8269 { |
|
8270 iCallBack->SetStatusL(aStatusRef,CSmlDmAdapter::EError); |
|
8271 } |
|
8272 |
|
8273 CleanupStack::PopAndDestroy( ); |
|
8274 |
|
8275 cmManagerExt.Close(); |
|
8276 // iDatabase = CCommsDatabase::NewL(); |
|
8277 if( reopenTransaction ) |
|
8278 { |
|
8279 TInt dberr = iDatabase->BeginTransaction(); |
|
8280 if( dberr == KErrLocked ) |
|
8281 { |
|
8282 _DBG_FILE("SetIAPSeamlessnessL: CommsDat was locked."); |
|
8283 TInt retry = KBeginTransRetryCount; |
|
8284 while ( retry > 0 && dberr == KErrLocked ) |
|
8285 { |
|
8286 User::After(KBeginTransRetryDelay); |
|
8287 _DBG_FILE("SetIAPSeamlessnessL: Slept 1 second. Try again"); |
|
8288 dberr = iDatabase->BeginTransaction(); |
|
8289 retry--; |
|
8290 } |
|
8291 if(dberr != KErrNone) |
|
8292 { |
|
8293 _DBG_FILE("CNSmlInternetAdapter: BeginTransaction failed completely."); |
|
8294 User::Leave( dberr ); |
|
8295 } |
|
8296 } |
|
8297 } |
|
8298 |
|
8299 _DBG_FILE("CNSmlInternetAdapter::SetIAPSeamlessnessL(): end"); |
|
8300 } |
|
8301 |
|
8302 //------------------------------------------------------------------------------ |
|
8303 // void CNSmlInternetAdapter::SetIAPMetaDataL(TUint32 apMetaID,TUint32 aMeta,TInt aStatusRef) |
|
8304 // Sets the metadata value to the IAPMetadata table though the cmmanager API |
|
8305 //------------------------------------------------------------------------------ |
|
8306 |
|
8307 void CNSmlInternetAdapter::SetIAPMetaDataL(TUint32 apMetaID,TUint32 aMeta,TInt aStatusRef) |
|
8308 { |
|
8309 |
|
8310 _DBG_FILE("CNSmlInternetAdapter::SetIAPMetaDataL(): begin"); |
|
8311 TInt hMHLErr = KErrNone; |
|
8312 TInt hMHAErr = KErrNone; |
|
8313 if(iDatabase) |
|
8314 { |
|
8315 iDatabase->CommitTransaction(); |
|
8316 // delete iDatabase; |
|
8317 } |
|
8318 RCmManagerExt cmManagerExt; |
|
8319 cmManagerExt.OpenL(); |
|
8320 RCmConnectionMethodExt cm = cmManagerExt.ConnectionMethodL( apMetaID ); |
|
8321 CleanupClosePushL( cm ); |
|
8322 |
|
8323 if(aMeta & EMetaHighlight) |
|
8324 { |
|
8325 TRAP(hMHLErr,cm.SetBoolAttributeL( CMManager::ECmMetaHighlight,ETrue)); |
|
8326 } |
|
8327 else |
|
8328 { |
|
8329 TRAP(hMHLErr,cm.SetBoolAttributeL( CMManager::ECmMetaHighlight,EFalse)); |
|
8330 } |
|
8331 |
|
8332 if(aMeta & EMetaHiddenAgent ) |
|
8333 { |
|
8334 TRAP(hMHAErr,cm.SetBoolAttributeL( CMManager::ECmMetaHiddenAgent,ETrue)); |
|
8335 } |
|
8336 else |
|
8337 { |
|
8338 TRAP(hMHAErr,cm.SetBoolAttributeL( CMManager::ECmMetaHiddenAgent,EFalse)); |
|
8339 } |
|
8340 if( (hMHAErr==KErrNone) && (hMHLErr==KErrNone) ) |
|
8341 { |
|
8342 cm.UpdateL(); |
|
8343 iCallBack->SetStatusL(aStatusRef,CSmlDmAdapter::EOk); |
|
8344 |
|
8345 } |
|
8346 else |
|
8347 { |
|
8348 iCallBack->SetStatusL(aStatusRef,CSmlDmAdapter::EError); |
|
8349 } |
|
8350 |
|
8351 |
|
8352 CleanupStack::PopAndDestroy( ); |
|
8353 |
|
8354 cmManagerExt.Close(); |
|
8355 TInt dberr = iDatabase->BeginTransaction(); |
|
8356 if( dberr == KErrLocked ) |
|
8357 { |
|
8358 _DBG_FILE("SetIAPMetaDataL: CommsDat was locked."); |
|
8359 TInt retry = KBeginTransRetryCount; |
|
8360 while ( retry > 0 && dberr == KErrLocked ) |
|
8361 { |
|
8362 User::After(KBeginTransRetryDelay); |
|
8363 _DBG_FILE("SetIAPMetaDataL: Slept 1 second. Try again"); |
|
8364 dberr = iDatabase->BeginTransaction(); |
|
8365 retry--; |
|
8366 } |
|
8367 if(dberr != KErrNone) |
|
8368 { |
|
8369 _DBG_FILE("CNSmlInternetAdapter: BeginTransaction failed completely."); |
|
8370 User::Leave( dberr ); |
|
8371 } |
|
8372 } |
|
8373 |
|
8374 _DBG_FILE("CNSmlInternetAdapter::SetIAPMetaDataL(): end"); |
|
8375 } |
|
8376 |
|
8377 |
|
8378 void CNSmlInternetAdapter::AddLingerL( const TInt aIapId, const TInt aLingerInterval) |
|
8379 { |
|
8380 TInt err( KErrNone ); |
|
8381 |
|
8382 // Open repository |
|
8383 CRepository* repository = CRepository::NewLC( KCRUidPDPContextManager ); |
|
8384 |
|
8385 // Find if an entry for "iapId" already exists in CentRep |
|
8386 RArray< TUint32 > foundKeys; |
|
8387 foundKeys.Reset(); |
|
8388 |
|
8389 err = repository->FindEqL( KIapColumn, // partial key |
|
8390 KColumnMask, // key mask |
|
8391 aIapId, // value |
|
8392 foundKeys ); // found keys |
|
8393 |
|
8394 if ( err == KErrNone || err == KErrNotFound ) |
|
8395 { |
|
8396 if ( foundKeys.Count() == 0 ) |
|
8397 { |
|
8398 // Add a new entry |
|
8399 TInt arrayCount( 0 ); |
|
8400 |
|
8401 // Get number of iapId&linger entries in Centrep |
|
8402 err = repository->Get( KPdpContextManagerLingerArrayCount, |
|
8403 arrayCount ); |
|
8404 |
|
8405 if ( err == KErrNone ) |
|
8406 { |
|
8407 arrayCount++; |
|
8408 |
|
8409 err = repository->Create( ( KIapColumn | arrayCount ), aIapId ); |
|
8410 |
|
8411 if ( err == KErrNone ) |
|
8412 { |
|
8413 err = repository->Create( ( KLingerColumn | arrayCount ), |
|
8414 aLingerInterval ); |
|
8415 } |
|
8416 |
|
8417 if ( err == KErrNone ) |
|
8418 { |
|
8419 // Update number of iapId&linger entries in Centrep |
|
8420 err = repository->Set( KPdpContextManagerLingerArrayCount, |
|
8421 arrayCount ); |
|
8422 } |
|
8423 } |
|
8424 } |
|
8425 else |
|
8426 { |
|
8427 // Update existing entry on current row |
|
8428 TInt32 row = foundKeys[ 0 ] & KRowMask; |
|
8429 |
|
8430 err = repository->Set( ( KLingerColumn | row ), aLingerInterval ); |
|
8431 } |
|
8432 } |
|
8433 |
|
8434 foundKeys.Close(); |
|
8435 CleanupStack::PopAndDestroy( repository ); |
|
8436 |
|
8437 User::LeaveIfError( err ); |
|
8438 } |
|
8439 |
|
8440 void CNSmlInternetAdapter::UpdateLingerL( const TInt aIapId, const TInt aLingerInterval ) |
|
8441 { |
|
8442 TInt err( KErrNone ); |
|
8443 |
|
8444 // Open repository |
|
8445 CRepository* repository = CRepository::NewLC( KCRUidPDPContextManager ); |
|
8446 |
|
8447 // Find if an entry for "iapId" already exists in CentRep |
|
8448 RArray< TUint32 > foundKeys; |
|
8449 foundKeys.Reset(); |
|
8450 |
|
8451 err = repository->FindEqL( KIapColumn, // partial key |
|
8452 KColumnMask, // key mask |
|
8453 aIapId, // value |
|
8454 foundKeys ); // found keys |
|
8455 |
|
8456 if ( err == KErrNone || err == KErrNotFound ) |
|
8457 { |
|
8458 |
|
8459 if ( foundKeys.Count() == 0 ) |
|
8460 { |
|
8461 // Add a new entry |
|
8462 TInt arrayCount( 0 ); |
|
8463 |
|
8464 // Get number of iapId&linger entries in Centrep |
|
8465 err = repository->Get( KPdpContextManagerLingerArrayCount, |
|
8466 arrayCount ); |
|
8467 |
|
8468 if ( err == KErrNone ) |
|
8469 { |
|
8470 arrayCount++; |
|
8471 |
|
8472 err = repository->Create( ( KIapColumn | arrayCount ), aIapId ); |
|
8473 |
|
8474 if ( err == KErrNone ) |
|
8475 { |
|
8476 err = repository->Create( ( KLingerColumn | arrayCount ), |
|
8477 aLingerInterval ); |
|
8478 } |
|
8479 |
|
8480 if ( err == KErrNone ) |
|
8481 { |
|
8482 // Update number of iapId&linger entries in Centrep |
|
8483 err = repository->Set( KPdpContextManagerLingerArrayCount, |
|
8484 arrayCount ); |
|
8485 } |
|
8486 } |
|
8487 } |
|
8488 else |
|
8489 { |
|
8490 // Update existing entry on currebt row |
|
8491 TInt32 row = foundKeys[ 0 ] & KRowMask; |
|
8492 |
|
8493 err = repository->Set( ( KLingerColumn | row ), aLingerInterval ); |
|
8494 } |
|
8495 } |
|
8496 |
|
8497 foundKeys.Close(); |
|
8498 CleanupStack::PopAndDestroy( repository ); |
|
8499 |
|
8500 User::LeaveIfError( err ); |
|
8501 } |
|
8502 void CNSmlInternetAdapter::GetLingerL( const TInt aIapId, TInt& aLingerInterval ) |
|
8503 { |
|
8504 TInt err( KErrNone ); |
|
8505 |
|
8506 // Open repository |
|
8507 CRepository* repository = CRepository::NewLC( KCRUidPDPContextManager ); |
|
8508 |
|
8509 // Find if an entry for "iapId" already exists in CentRep |
|
8510 RArray< TUint32 > foundKeys; |
|
8511 foundKeys.Reset(); |
|
8512 |
|
8513 err = repository->FindEqL( KIapColumn, // partial key |
|
8514 KColumnMask, // key mask |
|
8515 aIapId, // value |
|
8516 foundKeys ); // found keys |
|
8517 |
|
8518 if ( err == KErrNone ) |
|
8519 { |
|
8520 if ( foundKeys.Count() > 0 ) |
|
8521 { |
|
8522 // Find linger interval for the iap id on current row |
|
8523 TInt32 row = foundKeys[ 0 ] & KRowMask; |
|
8524 |
|
8525 err = repository->Get( ( KLingerColumn | row ), aLingerInterval ); |
|
8526 } |
|
8527 } |
|
8528 |
|
8529 foundKeys.Close(); |
|
8530 CleanupStack::PopAndDestroy( repository ); |
|
8531 |
|
8532 User::LeaveIfError( err ); |
|
8533 } |
|
8534 |
|
8535 |
|
8536 |
|
8537 |
|
8538 //---------------------------------------------------------------------- |
|
8539 //TBool CNSmlInternetAdapter::CheckEnforcementL() |
|
8540 // If AP policy is enforced true is returned else false |
|
8541 //---------------------------------------------------------------------- |
|
8542 TBool CNSmlInternetAdapter::CheckEnforcementL() |
|
8543 { |
|
8544 CSettingEnforcementInfo* info = CSettingEnforcementInfo::NewL(); |
|
8545 CleanupStack::PushL(info); |
|
8546 TBool enforceActive ( EFalse ); |
|
8547 User::LeaveIfError(info->EnforcementActive(EAPEnforcement, enforceActive)); |
|
8548 CleanupStack::PopAndDestroy(info); |
|
8549 return enforceActive; |
|
8550 } |
|
8551 |
|
8552 //---------------------------------------------------------------------- |
|
8553 //TBool CNSmlInternetAdapter::CheckWLANEnforcementL() |
|
8554 // If WLAN AP policy is enforced true is returned else false |
|
8555 //---------------------------------------------------------------------- |
|
8556 TBool CNSmlInternetAdapter::CheckWLANEnforcementL() |
|
8557 { |
|
8558 CSettingEnforcementInfo* info = CSettingEnforcementInfo::NewL(); |
|
8559 CleanupStack::PushL(info); |
|
8560 TBool enforceActive ( EFalse ); |
|
8561 User::LeaveIfError(info->EnforcementActive(EWLANEnforcement, enforceActive)); |
|
8562 CleanupStack::PopAndDestroy(info); |
|
8563 return enforceActive; |
|
8564 } |
|
8565 |
|
8566 |
|
8567 //---------------------------------------------------------------------- |
|
8568 //TInt CNSmlInternetAdapter::DoProtectWAPTablesL(TBool aProtect) |
|
8569 // if aProtect is true , tables are locked otherwise tables are unlocked. |
|
8570 //---------------------------------------------------------------------- |
|
8571 |
|
8572 TInt CNSmlInternetAdapter::DoProtectWAPTablesL(TBool aProtect) |
|
8573 { |
|
8574 TInt err = KErrNone; |
|
8575 CCommsDatabaseProtect* dbprotect = CCommsDatabaseProtect::NewL(); |
|
8576 CleanupStack::PushL(dbprotect); |
|
8577 for ( TInt i( 0 ); i < iLockTableList.Count(); i++ ) |
|
8578 { |
|
8579 if(!aProtect) |
|
8580 { |
|
8581 err = dbprotect->UnProtectTable( iLockTableList[ i ] ); |
|
8582 } |
|
8583 else |
|
8584 { |
|
8585 err = dbprotect->ProtectTable( iLockTableList[ i ] ); |
|
8586 } |
|
8587 |
|
8588 } |
|
8589 CleanupStack::PopAndDestroy( dbprotect ); |
|
8590 return err; |
|
8591 } |
|
8592 //---------------------------------------------------------------------- |
|
8593 //void CNSmlInternetAdapter::DoLockIAPTablesL(TBool aProtect) |
|
8594 // if aProtect is true , tables are locked otherwise tables are unlocked. |
|
8595 //---------------------------------------------------------------------- |
|
8596 |
|
8597 void CNSmlInternetAdapter::DoLockIAPTablesL(TBool aLock) |
|
8598 { |
|
8599 TInt protError = KErrNone; |
|
8600 TInt err = KErrNone; |
|
8601 iDatabase->CommitTransaction(); |
|
8602 iLockTableList.AppendL( TPtrC( WAP_ACCESS_POINT ) ); |
|
8603 iLockTableList.AppendL( TPtrC( WAP_IP_BEARER ) ); |
|
8604 iLockTableList.AppendL( TPtrC( IAP ) ); |
|
8605 |
|
8606 TRAP(err, protError = DoProtectWAPTablesL(aLock)); |
|
8607 DBG_ARGS8(_S8("CNSmlInternetAdapter::DoLockIAPTablesL(): Table protect error %d , leave error %d " ),protError,err); |
|
8608 |
|
8609 if ( protError != KErrNone ) // To remove the warnings |
|
8610 { |
|
8611 protError = KErrNone; |
|
8612 } |
|
8613 TInt dberr = iDatabase->BeginTransaction(); |
|
8614 if( dberr == KErrLocked ) |
|
8615 { |
|
8616 _DBG_FILE("DoLockIAPTablesL: CommsDat was locked."); |
|
8617 TInt retry = KBeginTransRetryCount; |
|
8618 while ( retry > 0 && dberr == KErrLocked ) |
|
8619 { |
|
8620 User::After(KBeginTransRetryDelay); |
|
8621 _DBG_FILE("DoLockIAPTablesL: Slept 1 second. Try again"); |
|
8622 dberr = iDatabase->BeginTransaction(); |
|
8623 retry--; |
|
8624 } |
|
8625 if(dberr != KErrNone) |
|
8626 { |
|
8627 _DBG_FILE("CNSmlInternetAdapter: BeginTransaction failed completely."); |
|
8628 User::Leave( dberr ); |
|
8629 } |
|
8630 } |
|
8631 } |
|
8632 //-------------------------------------------------------------------- |
|
8633 //TInt UnprotectWLANAPItemL(TUint32 aId) |
|
8634 //Unprotect the wlan AP if only wlan enforcement is on |
|
8635 //------------------------------------------------------------------- |
|
8636 TInt CNSmlInternetAdapter::UnprotectWLANAPItemL(TUint32 aId) |
|
8637 { |
|
8638 _DBG_FILE("CNSmlInternetAdapter::UnprotectWLANAPItemL(): BEGIN"); |
|
8639 CCommsDbTableView* wapView; |
|
8640 |
|
8641 TInt errorCode = KErrNone; |
|
8642 TBuf<KCommsDbSvrMaxFieldLength> serviceType; |
|
8643 |
|
8644 //check if its WLAN AP being deleted |
|
8645 wapView = iDatabase->OpenViewMatchingUintLC( TPtrC(IAP),TPtrC(COMMDB_ID), aId); |
|
8646 |
|
8647 errorCode = wapView->GotoFirstRecord(); |
|
8648 |
|
8649 if ( errorCode == KErrNone ) |
|
8650 { |
|
8651 wapView->ReadTextL(TPtrC(IAP_SERVICE_TYPE), serviceType); |
|
8652 if(serviceType != TPtrC(LAN_SERVICE)) |
|
8653 { |
|
8654 CleanupStack::PopAndDestroy(); // wapView |
|
8655 return KErrNone; |
|
8656 } |
|
8657 } |
|
8658 |
|
8659 ((CCommsDbProtectTableView*)wapView)->UnprotectRecord(); |
|
8660 |
|
8661 CleanupStack::PopAndDestroy(); // wapView |
|
8662 |
|
8663 _DBG_FILE("CNSmlInternetAdapter::UnprotectWLANAPItemL(): END"); |
|
8664 return errorCode; |
|
8665 } |
|
8666 |
|
8667 |
|
8668 //---------------------------------------------------------------------- |
|
8669 //TBool CNSmlInternetAdapter::IsIAPRecordLockedL(TUint32 aRecord) |
|
8670 //check for wap access point record lock status |
|
8671 //---------------------------------------------------------------------- |
|
8672 |
|
8673 TBool CNSmlInternetAdapter::IsIAPRecordLockedL(TUint32 aRecord) |
|
8674 { |
|
8675 _DBG_FILE("CNSmlInternetAdapter::IsIAPRecordLockedL(): BEGIN"); |
|
8676 TBool ret = EFalse; |
|
8677 CCommsDbTableView* apView; |
|
8678 DBG_ARGS8(_S8("CNSmlInternetAdapter::IsIAPRecordLockedL record being checked = %d"),aRecord); |
|
8679 apView = iDatabase->OpenViewMatchingUintLC(TPtrC(IAP), |
|
8680 TPtrC(COMMDB_ID), |
|
8681 aRecord); |
|
8682 |
|
8683 TInt aAccess( 0 ); |
|
8684 if(apView!=NULL) |
|
8685 { |
|
8686 _DBG_FILE("CNSmlInternetAdapter::IsIAPRecordLockedL():wap record exists, check for access type"); |
|
8687 TInt err = (((CCommsDbProtectTableView*) apView )->GetRecordAccess( aAccess ) ); |
|
8688 DBG_ARGS8(_S8("CNSmlInternetAdapter::IsIAPRecordLockedL , GetrecordAccess code is =%d and acess type of record = %d"),err, aAccess); |
|
8689 CleanupStack::PopAndDestroy( apView); |
|
8690 if(aAccess == RDbRowSet::EReadOnly) |
|
8691 ret = ETrue; |
|
8692 } |
|
8693 |
|
8694 _DBG_FILE("CNSmlInternetAdapter::IsIAPRecordLockedL(): END"); |
|
8695 return ret; |
|
8696 |
|
8697 } |
|
8698 //---------------------------------------------------------------------- |
|
8699 //TBool CNSmlInternetAdapter::DoProtectIAPRecordL(TUint32 aRecord,TBool aProtect) |
|
8700 // protect or unprotect wapaccesspoint record of access point being altered |
|
8701 //---------------------------------------------------------------------- |
|
8702 |
|
8703 |
|
8704 TInt CNSmlInternetAdapter::DoProtectIAPRecordL(TUint32 aRecord,TBool aProtect) |
|
8705 { |
|
8706 _DBG_FILE("CNSmlInternetAdapter::DoProtectIAPRecordL(): BEGIN"); |
|
8707 DBG_ARGS8(_S8("CNSmlInternetAdapter::DoProtectIAPRecordL , record and protect value =%d = %d"),aRecord, aProtect); |
|
8708 TInt err = KErrNone; |
|
8709 |
|
8710 CCommsDbTableView* apView; |
|
8711 apView = iDatabase->OpenViewMatchingUintLC(TPtrC(IAP), |
|
8712 TPtrC(COMMDB_ID), |
|
8713 aRecord); |
|
8714 if( apView != NULL ) |
|
8715 { |
|
8716 _DBG_FILE("CNSmlInternetAdapter::DoProtectIAPRecordL(): wap record exists"); |
|
8717 if( !aProtect ) |
|
8718 { |
|
8719 err = ( (CCommsDbProtectTableView*) apView )->UnprotectRecord(); |
|
8720 DBG_ARGS8(_S8("CNSmlInternetAdapter::DoProtectIAPAccessRecordL ,error code of Unprotectrecord = %d"),err); |
|
8721 } |
|
8722 |
|
8723 else |
|
8724 { |
|
8725 err = ( (CCommsDbProtectTableView*) apView )->ProtectRecord(); |
|
8726 DBG_ARGS8(_S8("CNSmlInternetAdapter::DoProtectIAPRecordL ,error code of ProtectRecord = %d"),err); |
|
8727 } |
|
8728 |
|
8729 CleanupStack::PopAndDestroy( apView); |
|
8730 } |
|
8731 |
|
8732 _DBG_FILE("CNSmlInternetAdapter::DoProtectIAPRecordL(): END"); |
|
8733 return err; |
|
8734 } |
|
8735 //---------------------------------------------------------------------- |
|
8736 //TBool CNSmlInternetAdapter::IsProxyRecordLockedL(TUint32 aRecord) |
|
8737 //check for proxy record lock status |
|
8738 //---------------------------------------------------------------------- |
|
8739 |
|
8740 TBool CNSmlInternetAdapter::IsProxyRecordLockedL(TUint32 aRecord) |
|
8741 { |
|
8742 _DBG_FILE("CNSmlInternetAdapter::IsProxyRecordLockedL(): BEGIN"); |
|
8743 TBool ret = EFalse; |
|
8744 CCommsDbTableView* proxyView; |
|
8745 DBG_ARGS8(_S8("CNSmlInternetAdapter::IsProxyRecordLockedL record being checked = %d"),aRecord); |
|
8746 proxyView = iDatabase->OpenViewMatchingUintLC(TPtrC(PROXIES), |
|
8747 TPtrC(COMMDB_ID), |
|
8748 aRecord); |
|
8749 |
|
8750 TInt aAccess( 0 ); |
|
8751 if(proxyView!=NULL) |
|
8752 { |
|
8753 _DBG_FILE("CNSmlInternetAdapter::IsProxyRecordLockedL():wap record exists, check for access type"); |
|
8754 TInt err = (((CCommsDbProtectTableView*) proxyView )->GetRecordAccess( aAccess ) ); |
|
8755 DBG_ARGS8(_S8("CNSmlInternetAdapter::IsProxyRecordLockedL , GetrecordAccess code is =%d and acess type of record = %d"),err, aAccess); |
|
8756 CleanupStack::PopAndDestroy( proxyView); |
|
8757 if(aAccess == RDbRowSet::EReadOnly) |
|
8758 ret = ETrue; |
|
8759 } |
|
8760 |
|
8761 _DBG_FILE("CNSmlInternetAdapter::IsProxyRecordLockedL(): END"); |
|
8762 return ret; |
|
8763 |
|
8764 } |
|
8765 //---------------------------------------------------------------------- |
|
8766 //TBool CNSmlInternetAdapter::DoProtectProxyRecordL(TUint32 aRecord,TBool aProtect) |
|
8767 // protect or unprotect proxy record of access point being altered |
|
8768 //---------------------------------------------------------------------- |
|
8769 |
|
8770 |
|
8771 TInt CNSmlInternetAdapter::DoProtectProxyRecordL(TUint32 aRecord,TBool aProtect) |
|
8772 { |
|
8773 _DBG_FILE("CNSmlInternetAdapter::DoProtectProxyRecordL(): BEGIN"); |
|
8774 DBG_ARGS8(_S8("CNSmlInternetAdapter::DoProtectProxyRecordL , record and protect value =%d = %d"),aRecord, aProtect); |
|
8775 TInt err = KErrNone; |
|
8776 |
|
8777 CCommsDbTableView* proxyView; |
|
8778 proxyView = iDatabase->OpenViewMatchingUintLC(TPtrC(PROXIES), |
|
8779 TPtrC(COMMDB_ID), |
|
8780 aRecord); |
|
8781 if( proxyView != NULL ) |
|
8782 { |
|
8783 _DBG_FILE("CNSmlInternetAdapter::DoProtectProxyRecordL(): wap record exists"); |
|
8784 if( !aProtect ) |
|
8785 { |
|
8786 err = ( (CCommsDbProtectTableView*) proxyView )->UnprotectRecord(); |
|
8787 DBG_ARGS8(_S8("CNSmlInternetAdapter::DoProtectProxyRecordL ,error code of Unprotectrecord = %d"),err); |
|
8788 } |
|
8789 |
|
8790 else |
|
8791 { |
|
8792 err = ( (CCommsDbProtectTableView*) proxyView )->ProtectRecord(); |
|
8793 DBG_ARGS8(_S8("CNSmlInternetAdapter::DoProtectProxyRecordL ,error code of ProtectRecord = %d"),err); |
|
8794 } |
|
8795 |
|
8796 CleanupStack::PopAndDestroy( proxyView); |
|
8797 } |
|
8798 |
|
8799 _DBG_FILE("CNSmlInternetAdapter::DoProtectProxyRecordL(): END"); |
|
8800 return err; |
|
8801 } |
|
8802 |
|
8803 //---------------------------------------------------------------------- |
|
8804 //TBool CNSmlInternetAdapter::IsServiceRecordLockedL(TUint32 aRecord) |
|
8805 //check for proxy record lock status |
|
8806 //---------------------------------------------------------------------- |
|
8807 |
|
8808 TBool CNSmlInternetAdapter::IsServiceRecordLockedL(TUint32 aRecord) |
|
8809 { |
|
8810 _DBG_FILE("CNSmlInternetAdapter::IsProxyRecordLockedL(): BEGIN"); |
|
8811 TBool ret = EFalse; |
|
8812 CCommsDbTableView* serviceView; |
|
8813 DBG_ARGS8(_S8("CNSmlInternetAdapter::IsProxyRecordLockedL record being checked = %d"),aRecord); |
|
8814 serviceView = iDatabase->OpenViewMatchingUintLC(iProxyServiceType, |
|
8815 TPtrC(COMMDB_ID), |
|
8816 aRecord); |
|
8817 |
|
8818 TInt aAccess( 0 ); |
|
8819 if(serviceView!=NULL) |
|
8820 { |
|
8821 _DBG_FILE("CNSmlInternetAdapter::IsProxyRecordLockedL():wap record exists, check for access type"); |
|
8822 TInt err = (((CCommsDbProtectTableView*) serviceView )->GetRecordAccess( aAccess ) ); |
|
8823 DBG_ARGS8(_S8("CNSmlInternetAdapter::IsProxyRecordLockedL , GetrecordAccess code is =%d and acess type of record = %d"),err, aAccess); |
|
8824 CleanupStack::PopAndDestroy( serviceView); |
|
8825 if(aAccess == RDbRowSet::EReadOnly) |
|
8826 ret = ETrue; |
|
8827 } |
|
8828 |
|
8829 _DBG_FILE("CNSmlInternetAdapter::IsProxyRecordLockedL(): END"); |
|
8830 return ret; |
|
8831 |
|
8832 } |
|
8833 //---------------------------------------------------------------------- |
|
8834 //TBool CNSmlInternetAdapter::DoProtectProxyRecordL(TUint32 aRecord,TBool aProtect) |
|
8835 // protect or unprotect proxy record of access point being altered |
|
8836 //---------------------------------------------------------------------- |
|
8837 |
|
8838 |
|
8839 TInt CNSmlInternetAdapter::DoProtectServiceRecordL(TUint32 aRecord,TBool aProtect) |
|
8840 { |
|
8841 _DBG_FILE("CNSmlInternetAdapter::DoProtectProxyRecordL(): BEGIN"); |
|
8842 DBG_ARGS8(_S8("CNSmlInternetAdapter::DoProtectProxyRecordL , record and protect value =%d = %d"),aRecord, aProtect); |
|
8843 TInt err = KErrNone; |
|
8844 |
|
8845 CCommsDbTableView* serviceView; |
|
8846 serviceView = iDatabase->OpenViewMatchingUintLC(iProxyServiceType, |
|
8847 TPtrC(COMMDB_ID), |
|
8848 aRecord); |
|
8849 if( serviceView != NULL ) |
|
8850 { |
|
8851 _DBG_FILE("CNSmlInternetAdapter::DoProtectProxyRecordL(): wap record exists"); |
|
8852 if( !aProtect ) |
|
8853 { |
|
8854 err = ( (CCommsDbProtectTableView*) serviceView )->UnprotectRecord(); |
|
8855 DBG_ARGS8(_S8("CNSmlInternetAdapter::DoProtectProxyRecordL ,error code of Unprotectrecord = %d"),err); |
|
8856 } |
|
8857 |
|
8858 else |
|
8859 { |
|
8860 err = ( (CCommsDbProtectTableView*) serviceView )->ProtectRecord(); |
|
8861 DBG_ARGS8(_S8("CNSmlInternetAdapter::DoProtectProxyRecordL ,error code of ProtectRecord = %d"),err); |
|
8862 } |
|
8863 |
|
8864 CleanupStack::PopAndDestroy( serviceView); |
|
8865 } |
|
8866 |
|
8867 _DBG_FILE("CNSmlInternetAdapter::DoProtectProxyRecordL(): END"); |
|
8868 return err; |
|
8869 } |
|
8870 //-------------------------------------------------------------------- |
|
8871 //TInt CNSmlInternetAdapter::IsAPUriFormatMatchPredefined(const TDesC8 & aURI) |
|
8872 // |
|
8873 //------------------------------------------------------------------- |
|
8874 |
|
8875 |
|
8876 TBool CNSmlInternetAdapter::IsAPUriFormatMatchPredefined(const TDesC8 & aURI) |
|
8877 { |
|
8878 if(aURI.Match(_L8("AP/APId*")) != KErrNotFound || |
|
8879 aURI.Match(_L8("AP/APId*/NAPDef/NAPId*")) != KErrNotFound) |
|
8880 { |
|
8881 return ETrue; |
|
8882 } |
|
8883 else |
|
8884 { |
|
8885 return EFalse; |
|
8886 } |
|
8887 |
|
8888 |
|
8889 } |
|
8890 //-------------------------------------------------------------------- |
|
8891 //TInt CNSmlInternetAdapter::ConstructTreeL(const TDesC8& aURI) |
|
8892 // |
|
8893 //------------------------------------------------------------------- |
|
8894 |
|
8895 |
|
8896 TUint32 CNSmlInternetAdapter::ConstructTreeL(const TDesC8& aURI) |
|
8897 { |
|
8898 _DBG_FILE("CNSmlInternetAdapter::ConstructTreeL(): AP begin"); |
|
8899 TUint32 returnLuid = 0; // IAP doesn't exist |
|
8900 |
|
8901 CCommsDbTableView* apView = iDatabase->OpenTableLC(TPtrC(IAP)); |
|
8902 |
|
8903 TInt errorCode = apView->GotoFirstRecord(); |
|
8904 |
|
8905 while ( errorCode == KErrNone ) |
|
8906 { |
|
8907 TUint32 lValue; |
|
8908 TBool validService = EFalse; |
|
8909 apView->ReadUintL(TPtrC(COMMDB_ID),lValue); |
|
8910 |
|
8911 TBuf<KCommsDbSvrMaxFieldLength> serviceType; |
|
8912 apView->ReadTextL(TPtrC(IAP_SERVICE_TYPE), serviceType); |
|
8913 TUint32 bearerId = 0; |
|
8914 apView->ReadUintL(TPtrC(IAP_BEARER),bearerId); |
|
8915 // |
|
8916 // Skip other service types than GSM outgoing |
|
8917 // |
|
8918 if (serviceType == TPtrC(OUTGOING_GPRS) || |
|
8919 serviceType == TPtrC(INCOMING_GPRS)) |
|
8920 { |
|
8921 validService = ETrue; |
|
8922 } |
|
8923 |
|
8924 else if(serviceType == TPtrC(LAN_SERVICE) && |
|
8925 bearerId > 0) |
|
8926 { |
|
8927 validService = ETrue; |
|
8928 } |
|
8929 else if(serviceType == TPtrC(VPN_SERVICE)) |
|
8930 { |
|
8931 validService = ETrue; |
|
8932 } |
|
8933 |
|
8934 if(validService) |
|
8935 { |
|
8936 // Skip others |
|
8937 // |
|
8938 // Check if in aPreviousURISegmentList |
|
8939 // |
|
8940 TBool skipToNextIAP = EFalse; |
|
8941 // KNSmlDMStart includes start text for URISeg |
|
8942 TBuf8<20> addAPURI; // AP/APIdnnn , nnn = profileid |
|
8943 addAPURI.Append(_L8("AP/APId")); |
|
8944 addAPURI.AppendNumFixedWidth(lValue,EDecimal,3); |
|
8945 |
|
8946 TBuf8<16> addLUID; |
|
8947 _LIT8(KFormat,"%d"); |
|
8948 addLUID.Format(KFormat,lValue); |
|
8949 |
|
8950 HBufC8* mapInfo = iCallBack->GetLuidAllocL(addAPURI); |
|
8951 CleanupStack::PushL( mapInfo ); |
|
8952 if (mapInfo->Length() == 0) |
|
8953 { |
|
8954 iCallBack->SetMappingL(addAPURI,addLUID); |
|
8955 if( aURI.Find(addAPURI) >= 0 ) |
|
8956 { |
|
8957 returnLuid = lValue; |
|
8958 iPrevLUID = lValue; |
|
8959 } |
|
8960 } |
|
8961 else |
|
8962 { |
|
8963 skipToNextIAP= ETrue; |
|
8964 } |
|
8965 CleanupStack::PopAndDestroy( mapInfo ); |
|
8966 |
|
8967 if( !skipToNextIAP ) |
|
8968 { |
|
8969 // Add the NAPDef also |
|
8970 |
|
8971 TBuf<KCommsDbSvrMaxFieldLength> serviceType; |
|
8972 TUint32 serviceId; |
|
8973 |
|
8974 CCommsDbTableView* napdefView = iDatabase->OpenViewMatchingUintLC(TPtrC(IAP), |
|
8975 TPtrC(COMMDB_ID), |
|
8976 lValue); |
|
8977 |
|
8978 errorCode = napdefView->GotoFirstRecord(); |
|
8979 if (errorCode == KErrNone ) |
|
8980 { |
|
8981 napdefView->ReadTextL(TPtrC(IAP_SERVICE_TYPE), serviceType); |
|
8982 napdefView->ReadUintL(TPtrC(IAP_SERVICE), serviceId); // ID |
|
8983 } |
|
8984 |
|
8985 CCommsDbTableView* tableView = iDatabase->OpenViewMatchingUintLC(serviceType, |
|
8986 TPtrC(COMMDB_ID), |
|
8987 serviceId); |
|
8988 |
|
8989 errorCode = tableView->GotoFirstRecord(); |
|
8990 |
|
8991 while( errorCode == KErrNone ) |
|
8992 { |
|
8993 TUint32 lValue; |
|
8994 tableView->ReadUintL(TPtrC(COMMDB_ID),lValue); |
|
8995 // |
|
8996 // Check if in aPreviousURISegmentList |
|
8997 // |
|
8998 |
|
8999 _LIT8(Kprev,"NAPId"); |
|
9000 TBuf8<15> addNAME(Kprev); // APIdnnn , nnn = profileid |
|
9001 addNAME.AppendNumFixedWidth(lValue,EDecimal,3); |
|
9002 |
|
9003 |
|
9004 _LIT8(Kprev2,"/NAPDef/NAPId"); |
|
9005 TBuf8<80> addURI; // AP/xxx/NAPDef/NAPIdnnn , nnn = id nbr |
|
9006 addURI.Append(addAPURI); |
|
9007 addURI.Append(Kprev2); |
|
9008 addURI.AppendNumFixedWidth(lValue,EDecimal,3); |
|
9009 |
|
9010 TBuf8<16> addLUID; |
|
9011 _LIT8(KFormat,"%d"); |
|
9012 addLUID.Format(KFormat,lValue); |
|
9013 |
|
9014 HBufC8* mapInfo = iCallBack->GetLuidAllocL(addURI); |
|
9015 CleanupStack::PushL( mapInfo ); |
|
9016 if (mapInfo->Length() == 0) |
|
9017 { |
|
9018 // Also added to mapping |
|
9019 iCallBack->SetMappingL(addURI,addLUID); |
|
9020 if( aURI.Find(addURI) >= 0 ) |
|
9021 returnLuid = lValue; |
|
9022 _DBG_FILE("CNSmlInternetAdapter::ConstructTreeL(): Set NAPDef Mapping "); |
|
9023 |
|
9024 TBuf<KCommsDbSvrMaxFieldLength> columnValue; |
|
9025 TBuf8<16> addDNSLUID; |
|
9026 TBuf8<80> addDNSURI; // AP/xxx/NAPDef/DNSAddr/DNSx |
|
9027 _LIT8(KFormat,"%d"); |
|
9028 tableView->ReadTextL( TPtrC(SERVICE_IP_NAME_SERVER1 ), columnValue); |
|
9029 |
|
9030 if ( ( columnValue.Length() > 0 ) ) |
|
9031 { |
|
9032 _LIT8(Kprev2,"/DNSAddr/DNS1"); |
|
9033 addDNSURI.Append(addURI); |
|
9034 addDNSURI.Append(Kprev2); |
|
9035 addLUID.Format(KFormat, DnsToLuid( UriUtils::EIPv4Host, 1)); |
|
9036 iCallBack->SetMappingL(addDNSURI,addLUID); |
|
9037 if( aURI.Find(addDNSURI) >= 0 ) |
|
9038 returnLuid = DnsToLuid( UriUtils::EIPv4Host, 1); |
|
9039 addDNSURI.Zero(); |
|
9040 } |
|
9041 |
|
9042 tableView->ReadTextL( TPtrC(SERVICE_IP_NAME_SERVER2 ), columnValue); |
|
9043 if ( columnValue.Length() > 0 ) |
|
9044 { |
|
9045 _LIT8(Kprev2,"/DNSAddr/DNS2"); |
|
9046 addDNSURI.Append(addURI); |
|
9047 addDNSURI.Append(Kprev2); |
|
9048 addLUID.Format(KFormat, DnsToLuid( UriUtils::EIPv4Host, 2)); |
|
9049 iCallBack->SetMappingL(addDNSURI,addLUID); |
|
9050 if( aURI.Find(addDNSURI) >= 0 ) |
|
9051 returnLuid = DnsToLuid( UriUtils::EIPv4Host, 2); |
|
9052 addDNSURI.Zero(); |
|
9053 } |
|
9054 |
|
9055 tableView->ReadTextL( TPtrC(SERVICE_IP6_NAME_SERVER1 ), columnValue); |
|
9056 if ( columnValue.Length() > 0 ) |
|
9057 { |
|
9058 _LIT8(Kprev2,"/DNSAddr/DNS3"); |
|
9059 addDNSURI.Append(addURI); |
|
9060 addDNSURI.Append(Kprev2); |
|
9061 addLUID.Format(KFormat,DnsToLuid( UriUtils::EIPv6Host, 1) ); |
|
9062 iCallBack->SetMappingL(addDNSURI,addLUID); |
|
9063 if( aURI.Find(addDNSURI) >= 0 ) |
|
9064 returnLuid = DnsToLuid( UriUtils::EIPv6Host, 1); |
|
9065 addDNSURI.Zero(); |
|
9066 } |
|
9067 tableView->ReadTextL( TPtrC(SERVICE_IP6_NAME_SERVER2 ), columnValue); |
|
9068 if ( columnValue.Length() > 0 ) |
|
9069 { |
|
9070 _LIT8(Kprev2,"/DNSAddr/DNS4"); |
|
9071 addDNSURI.Append(addURI); |
|
9072 addDNSURI.Append(Kprev2); |
|
9073 addLUID.Format(KFormat, DnsToLuid( UriUtils::EIPv6Host, 2)); |
|
9074 iCallBack->SetMappingL(addDNSURI,addLUID); |
|
9075 if( aURI.Find(addDNSURI) >= 0 ) |
|
9076 returnLuid = DnsToLuid( UriUtils::EIPv6Host, 2); |
|
9077 addDNSURI.Zero(); |
|
9078 } |
|
9079 _DBG_FILE("CNSmlInternetAdapter::ConstructTreeL(): Set DNS Mapping "); |
|
9080 |
|
9081 TUint32 nwID = 0; |
|
9082 napdefView->ReadUintL(TPtrC(IAP_NETWORK),nwID); // Networks luid |
|
9083 |
|
9084 CCommsDbTableView* nwView = iDatabase->OpenViewMatchingUintLC(TPtrC(NETWORK),TPtrC(COMMDB_ID), nwID); |
|
9085 |
|
9086 errorCode = nwView->GotoFirstRecord(); |
|
9087 |
|
9088 if ( errorCode == KErrNone ) |
|
9089 { |
|
9090 _LIT8(Kprev2,"/Networks/NwId"); |
|
9091 TBuf8<80> addNwURI; // AP/xxx/NAPDef/xxx/Networks/NwIdnnn , nnn = id nbr |
|
9092 addNwURI.Append(addURI); |
|
9093 addNwURI.Append(Kprev2); |
|
9094 addNwURI.AppendNumFixedWidth(nwID,EDecimal,3); |
|
9095 TBuf8<16> addNwLUID; |
|
9096 _LIT8(KFormat,"%d"); |
|
9097 addNwLUID.Format(KFormat,nwID); |
|
9098 HBufC8* mapInfo = iCallBack->GetLuidAllocL(addNwURI); |
|
9099 CleanupStack::PushL( mapInfo ); |
|
9100 |
|
9101 if (mapInfo->Length() == 0) |
|
9102 { |
|
9103 // Also added to mapping |
|
9104 iCallBack->SetMappingL(addNwURI,addNwLUID); |
|
9105 if( aURI.Find(addNwURI) >= 0 ) |
|
9106 returnLuid = nwID; |
|
9107 _DBG_FILE("CNSmlInternetAdapter::ConstructTreeL(): Set Networks Mapping "); |
|
9108 } |
|
9109 CleanupStack::PopAndDestroy( mapInfo ); |
|
9110 } |
|
9111 CleanupStack::PopAndDestroy(); // nwView |
|
9112 |
|
9113 if ( iWlanSupported ) |
|
9114 { |
|
9115 // Check WLAN node |
|
9116 if(serviceType == TPtrC(LAN_SERVICE)) |
|
9117 { |
|
9118 TUint32 wlanID = serviceId; |
|
9119 _LIT8(Kprev2,"/WLAN/WLId"); |
|
9120 TBuf8<80> addWlanURI; // AP/xxx/NAPDef/xxx/WLAN/WLIdnnn , nnn = id nbr |
|
9121 addWlanURI.Append(addURI); |
|
9122 addWlanURI.Append(Kprev2); |
|
9123 addWlanURI.AppendNumFixedWidth(wlanID,EDecimal,3); |
|
9124 TBuf8<16> addWlanLUID; |
|
9125 _LIT8(KFormat,"%d"); |
|
9126 addWlanLUID.Format(KFormat,wlanID); |
|
9127 HBufC8* mapInfo = iCallBack->GetLuidAllocL(addWlanURI); |
|
9128 CleanupStack::PushL( mapInfo ); |
|
9129 |
|
9130 if (mapInfo->Length() == 0) |
|
9131 { |
|
9132 // Also added to mapping |
|
9133 iCallBack->SetMappingL(addWlanURI,addWlanLUID); |
|
9134 if( aURI.Find(addWlanURI) >= 0 ) |
|
9135 returnLuid = wlanID; |
|
9136 _DBG_FILE("CNSmlInternetAdapter::ConstructTreeL(): Set WLAN Mapping "); |
|
9137 |
|
9138 TBuf<KCommsDbSvrMaxFieldLength> value; |
|
9139 TBuf8<16> addWkLUID; |
|
9140 TBuf8<80> addWkURI; // AP/xxx/NAPDef/xxx/WLAN/xxx/WEPKey/WKIdn, n = id nbr |
|
9141 |
|
9142 for( TInt value =1; value <=4 ;value++) |
|
9143 { |
|
9144 _LIT8(Kprev2,"/WEPKey/WKId"); |
|
9145 addWkURI.Append(addWlanURI); |
|
9146 addWkURI.Append(Kprev2); |
|
9147 addWkURI.AppendNumFixedWidth(value,EDecimal,1); |
|
9148 _LIT8(KFormat,"%d"); |
|
9149 addWkLUID.Format(KFormat,(1000*value)+value); |
|
9150 iCallBack->SetMappingL(addWkURI,addWkLUID); |
|
9151 if( aURI.Find(addWkURI) >= 0 ) |
|
9152 returnLuid = (1000*value)+value; |
|
9153 addWkURI.Zero(); |
|
9154 } |
|
9155 } |
|
9156 CleanupStack::PopAndDestroy( mapInfo ); |
|
9157 } |
|
9158 } |
|
9159 |
|
9160 //Check Bearer node |
|
9161 |
|
9162 CCommsDbTableView* bView = iDatabase->OpenViewMatchingUintLC(TPtrC(NETWORK),TPtrC(COMMDB_ID), lValue); |
|
9163 errorCode = bView->GotoFirstRecord(); |
|
9164 |
|
9165 if ( errorCode == KErrNone ) |
|
9166 { |
|
9167 _LIT8(Kprev2,"/Bearer/BId"); |
|
9168 TBuf8<80> addbURI; // AP/xxx/NAPDef/xxx/Bearer/BIdnnn , nnn = id nbr |
|
9169 addbURI.Append(addURI); |
|
9170 addbURI.Append(Kprev2); |
|
9171 addbURI.AppendNumFixedWidth(lValue,EDecimal,3); |
|
9172 TBuf8<16> addbLUID; |
|
9173 _LIT8(KFormat,"%d"); |
|
9174 addbLUID.Format(KFormat,lValue); |
|
9175 HBufC8* mapInfo = iCallBack->GetLuidAllocL(addbURI); |
|
9176 CleanupStack::PushL( mapInfo ); |
|
9177 |
|
9178 if (mapInfo->Length() == 0) |
|
9179 { |
|
9180 // Also added to mapping |
|
9181 iCallBack->SetMappingL(addbURI,addbLUID); |
|
9182 if( aURI.Find(addbURI) >= 0 ) |
|
9183 returnLuid = lValue; |
|
9184 _DBG_FILE("CNSmlInternetAdapter::ConstructTreeL(): Set Bearer Mapping "); |
|
9185 } |
|
9186 CleanupStack::PopAndDestroy( mapInfo ); |
|
9187 } |
|
9188 CleanupStack::PopAndDestroy(); // bView |
|
9189 |
|
9190 //Check NAPAuthInf node NAPAuthInf/AUId |
|
9191 |
|
9192 CCommsDbTableView* authView = iDatabase->OpenViewMatchingUintLC(TPtrC(NETWORK),TPtrC(COMMDB_ID), lValue); |
|
9193 |
|
9194 errorCode = authView->GotoFirstRecord(); |
|
9195 |
|
9196 if ( errorCode == KErrNone ) |
|
9197 { |
|
9198 _LIT8(Kprev2,"/Bearer/BId"); |
|
9199 TBuf8<80> addauthURI; // AP/xxx/NAPDef/xxx/Bearer/BIdnnn , nnn = id nbr |
|
9200 addauthURI.Append(addURI); |
|
9201 addauthURI.Append(Kprev2); |
|
9202 addauthURI.AppendNumFixedWidth(lValue,EDecimal,3); |
|
9203 TBuf8<16> addauthLUID; |
|
9204 _LIT8(KFormat,"%d"); |
|
9205 addauthLUID.Format(KFormat,lValue); |
|
9206 HBufC8* mapInfo = iCallBack->GetLuidAllocL(addauthURI); |
|
9207 CleanupStack::PushL( mapInfo ); |
|
9208 |
|
9209 if (mapInfo->Length() == 0) |
|
9210 { |
|
9211 // Also added to mapping |
|
9212 iCallBack->SetMappingL(addauthURI,addauthLUID); |
|
9213 if( aURI.Find(addauthURI) >= 0 ) |
|
9214 returnLuid = lValue; |
|
9215 _DBG_FILE("CNSmlInternetAdapter::ConstructTreeL(): Set NAPAuthInf Mapping "); |
|
9216 } |
|
9217 CleanupStack::PopAndDestroy( mapInfo ); |
|
9218 } |
|
9219 CleanupStack::PopAndDestroy(); // authView |
|
9220 |
|
9221 //Check Proxy node |
|
9222 |
|
9223 CCommsDbTableView* pxView = iDatabase->OpenViewMatchingTextLC(TPtrC(PROXIES), |
|
9224 TPtrC(PROXY_SERVICE_TYPE), |
|
9225 serviceType); |
|
9226 |
|
9227 errorCode = pxView->GotoFirstRecord(); |
|
9228 if(errorCode == KErrNone) |
|
9229 { |
|
9230 while ( errorCode == KErrNone ) |
|
9231 { |
|
9232 TUint32 lProxyIspId; |
|
9233 TUint32 lProxyId; |
|
9234 pxView->ReadUintL(TPtrC(PROXY_ISP),lProxyIspId); |
|
9235 if (lProxyIspId == serviceId) //ServiceIsp) // Right value ISP |
|
9236 { |
|
9237 pxView->ReadUintL(TPtrC(COMMDB_ID),lProxyId); |
|
9238 |
|
9239 _LIT8(Kprev2,"/Px/PXId"); |
|
9240 TBuf8<80> addURI; // AP/xxx/Px/PXIdnnn , nnn = id nbr |
|
9241 addURI.Append(addAPURI); |
|
9242 addURI.Append(Kprev2); |
|
9243 addURI.AppendNumFixedWidth(lProxyId,EDecimal,3); |
|
9244 |
|
9245 TBuf8<16> addLUID; |
|
9246 _LIT8(KFormat,"%d"); |
|
9247 addLUID.Format(KFormat, KNSmlApProxyLowerBase + lProxyId); // 100000 + lProxyId |
|
9248 HBufC8* mapInfo = iCallBack->GetLuidAllocL(addURI); |
|
9249 CleanupStack::PushL( mapInfo ); |
|
9250 |
|
9251 if (mapInfo->Length() == 0) |
|
9252 { |
|
9253 // Also added to mapping |
|
9254 iCallBack->SetMappingL(addURI,addLUID); |
|
9255 if( aURI.Find(addURI) >= 0 ) |
|
9256 returnLuid = KNSmlApProxyLowerBase + lProxyId; |
|
9257 _DBG_FILE("CNSmlInternetAdapter::ConstructTreeL(): Set Proxy Mapping "); |
|
9258 _LIT8(KProxy,"/Port/PROXY"); |
|
9259 TBuf8<80> addPortURI; // AP/xxx/Px/Port/PROXY |
|
9260 addPortURI.Append(addURI); |
|
9261 addPortURI.Append( KProxy ); |
|
9262 TBuf8<16> addPortLUID; |
|
9263 _LIT8(KFormat,"%d"); |
|
9264 addPortLUID.Format(KFormat, 1); |
|
9265 iCallBack->SetMappingL(addPortURI,addPortLUID); |
|
9266 if( aURI.Find(addPortURI) >= 0 ) |
|
9267 returnLuid = 1; |
|
9268 } |
|
9269 CleanupStack::PopAndDestroy( mapInfo ); |
|
9270 } |
|
9271 errorCode = pxView->GotoNextRecord(); |
|
9272 } |
|
9273 } |
|
9274 CleanupStack::PopAndDestroy() ;//Pxview |
|
9275 } |
|
9276 CleanupStack::PopAndDestroy( mapInfo ); |
|
9277 errorCode = tableView->GotoNextRecord(); |
|
9278 } |
|
9279 CleanupStack::PopAndDestroy() ;//tableview |
|
9280 CleanupStack::PopAndDestroy() ;//napdefview |
|
9281 } |
|
9282 } |
|
9283 errorCode = apView->GotoNextRecord(); |
|
9284 } |
|
9285 CleanupStack::PopAndDestroy(); // apView |
|
9286 _DBG_FILE("CNSmlInternetAdapter::ConstructTreeL(): AP end"); |
|
9287 return returnLuid; |
|
9288 } |
|
9289 // End of File |