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