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