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