47
|
1 |
/*
|
|
2 |
* Copyright (c) 2002-2006 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: Wlan Adapter
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
|
|
18 |
#ifdef SYMBIAN_ENABLE_SPLIT_HEADERS
|
|
19 |
#include <commsdat_partner.h>
|
|
20 |
#endif
|
|
21 |
#include "NSmlWLanAdapter.h"
|
|
22 |
#include "NSmlWlanSettings.h"
|
|
23 |
#include "nsmldebug.h"
|
|
24 |
#include <commdb.h>
|
|
25 |
#include <utf.h>
|
|
26 |
#include <cdbstore.h>
|
|
27 |
#include <cdbcols.h>
|
|
28 |
#include <EapType.h>
|
|
29 |
#include <nsmldmuri.h>
|
|
30 |
#include <EapExpandedType.h>
|
|
31 |
#include <EapGeneralSettings.h>
|
|
32 |
|
|
33 |
#ifndef __WINS__
|
|
34 |
// This lowers the unnecessary compiler warning (armv5) to remark.
|
|
35 |
// "Warning: #174-D: expression has no effect..." is caused by
|
|
36 |
// DBG_ARGS8 macro in no-debug builds.
|
|
37 |
#pragma diag_remark 174
|
|
38 |
#endif
|
|
39 |
|
|
40 |
const TInt KMaxBuf = 255;
|
|
41 |
//-----------------------------------------------------------------------------
|
|
42 |
// CNSmlWLanAdapter* CNSmlWLanAdapter::NewL( )
|
|
43 |
//-----------------------------------------------------------------------------
|
|
44 |
CNSmlWLanAdapter* CNSmlWLanAdapter::NewL(MSmlDmCallback* aDmCallback,
|
|
45 |
CCommsDatabase& aDatabase)
|
|
46 |
{
|
|
47 |
_DBG_FILE("CNSmlWLanAdapter::NewL(): begin");
|
|
48 |
|
|
49 |
CNSmlWLanAdapter* self = NewLC(aDmCallback, aDatabase);
|
|
50 |
CleanupStack::Pop(self);
|
|
51 |
|
|
52 |
_DBG_FILE("CNSmlWLanAdapter::NewL(): end");
|
|
53 |
return self;
|
|
54 |
}
|
|
55 |
|
|
56 |
//-----------------------------------------------------------------------------
|
|
57 |
// CNSmlWLanAdapter* CNSmlWLanAdapter::NewLC( )
|
|
58 |
//-----------------------------------------------------------------------------
|
|
59 |
CNSmlWLanAdapter* CNSmlWLanAdapter::NewLC(MSmlDmCallback* aDmCallback,
|
|
60 |
CCommsDatabase& aDatabase)
|
|
61 |
{
|
|
62 |
_DBG_FILE("CNSmlWLanAdapter::NewLC(): begin");
|
|
63 |
|
|
64 |
CNSmlWLanAdapter* self = new (ELeave) CNSmlWLanAdapter(aDmCallback,
|
|
65 |
aDatabase);
|
|
66 |
CleanupStack::PushL(self);
|
|
67 |
|
|
68 |
self->iCallBack = aDmCallback;
|
|
69 |
self->ConstructL(aDatabase);
|
|
70 |
|
|
71 |
_DBG_FILE("CNSmlWLanAdapter::NewLC(): end");
|
|
72 |
return self;
|
|
73 |
}
|
|
74 |
|
|
75 |
//-----------------------------------------------------------------------------
|
|
76 |
// void CNSmlWLanAdapter::ConstructL( )
|
|
77 |
// Second phase constructor
|
|
78 |
//-----------------------------------------------------------------------------
|
|
79 |
void CNSmlWLanAdapter::ConstructL(CCommsDatabase& aDatabase)
|
|
80 |
{
|
|
81 |
_DBG_FILE("CNSmlWLanAdapter::ConstructL(): begin");
|
|
82 |
|
|
83 |
iWlanSettings = CWlanSettings::NewL(aDatabase);
|
|
84 |
iBuffer = new (ELeave) CArrayFixFlat<TNSmlWepKeyBufferElement> (
|
|
85 |
KNSmlWepKeyGranularity);
|
|
86 |
iSettings = new (ELeave) TWlanSettings;
|
|
87 |
iEAPSettings = new (ELeave) EAPSettings;
|
|
88 |
|
|
89 |
_DBG_FILE("CNSmlWLanAdapter::ConstructL(): end");
|
|
90 |
}
|
|
91 |
|
|
92 |
//-----------------------------------------------------------------------------
|
|
93 |
// CNSmlWLanAdapter::CNSmlWLanAdapter( )
|
|
94 |
// Constructor
|
|
95 |
//-----------------------------------------------------------------------------
|
|
96 |
CNSmlWLanAdapter::CNSmlWLanAdapter(TAny* aEcomArguments,
|
|
97 |
CCommsDatabase& aDatabase) :
|
|
98 |
CSmlDmAdapter(aEcomArguments), iDatabase(aDatabase)
|
|
99 |
{
|
|
100 |
_DBG_FILE("CNSmlWLanAdapter::CNSmlWLanAdapter(): begin");
|
|
101 |
_DBG_FILE("CNSmlWLanAdapter::CNSmlWLanAdapter(): end");
|
|
102 |
}
|
|
103 |
|
|
104 |
//-----------------------------------------------------------------------------
|
|
105 |
// CNSmlWLanAdapter::~CNSmlWLanAdapter( )
|
|
106 |
// Destructor
|
|
107 |
//-----------------------------------------------------------------------------
|
|
108 |
CNSmlWLanAdapter::~CNSmlWLanAdapter()
|
|
109 |
{
|
|
110 |
_DBG_FILE("CNSmlWLanAdapter::~CNSmlWLanAdapter(): begin");
|
|
111 |
|
|
112 |
if (iBuffer)
|
|
113 |
{
|
|
114 |
|
|
115 |
for (TInt index = 0; index < iBuffer->Count(); index++)
|
|
116 |
{
|
|
117 |
delete iBuffer->At(index).iUri;
|
|
118 |
delete iBuffer->At(index).iData;
|
|
119 |
|
|
120 |
iBuffer->Delete(index);
|
|
121 |
}
|
|
122 |
|
|
123 |
iBuffer->Reset();
|
|
124 |
delete iBuffer;
|
|
125 |
|
|
126 |
}
|
|
127 |
delete iWlanSettings;
|
|
128 |
delete iSettings;
|
|
129 |
|
|
130 |
TRAP_IGNORE(DeleteEAPStructL());
|
|
131 |
|
|
132 |
for (TInt i = 0; i < iEAPBuffer.Count(); i++)
|
|
133 |
{
|
|
134 |
iEAPBuffer[i]->iStatusRefArray.Close();
|
|
135 |
iEAPBuffer[i]->iEAPSettings->iEnabledEncapsulatedEAPExpandedTypes.Close();
|
|
136 |
iEAPBuffer[i]->iEAPSettings->iDisabledEncapsulatedEAPExpandedTypes.Close();
|
|
137 |
iEAPBuffer[i]->iEAPSettings->iCipherSuites.Close();
|
|
138 |
delete iEAPBuffer[i]->iEAPSettings;
|
|
139 |
iEAPBuffer[i]->iEAPSettings = NULL;
|
|
140 |
}
|
|
141 |
iEAPBuffer.ResetAndDestroy();
|
|
142 |
|
|
143 |
TInt count = iSecondaryBuffer.Count();
|
|
144 |
for (TInt index = 0; index < count; index++)
|
|
145 |
{
|
|
146 |
delete iSecondaryBuffer[index];
|
|
147 |
}
|
|
148 |
|
|
149 |
iSecondaryBuffer.Reset();
|
|
150 |
|
|
151 |
_DBG_FILE("CNSmlWLanAdapter::~CNSmlWLanAdapter(): end");
|
|
152 |
}
|
|
153 |
|
|
154 |
//-----------------------------------------------------------------------------
|
|
155 |
// CNSmlWLanAdapter* CNSmlWLanAdapter::DDFVersionL( CBufBase& aDDFVersion )
|
|
156 |
//-----------------------------------------------------------------------------
|
|
157 |
void CNSmlWLanAdapter::DDFVersionL(CBufBase& aDDFVersion)
|
|
158 |
{
|
|
159 |
_DBG_FILE("CNSmlWLanAdapter::DDFVersionL(): begin");
|
|
160 |
|
|
161 |
aDDFVersion.InsertL(0, KNSmlWLanAdapterDDFversion);
|
|
162 |
|
|
163 |
_DBG_FILE("CNSmlWLanAdapter::DDFVersionL(): end");
|
|
164 |
}
|
|
165 |
|
|
166 |
//-----------------------------------------------------------------------------
|
|
167 |
// CNSmlWLanAdapter* CNSmlWLanAdapter::DDFStructureL( MSmlDmDDFObject& aDDF )
|
|
168 |
//-----------------------------------------------------------------------------
|
|
169 |
void CNSmlWLanAdapter::DDFStructureL(MSmlDmDDFObject& aDDF)
|
|
170 |
{
|
|
171 |
_DBG_FILE("CNSmlWLanAdapter::DDFStructureL(): begin");
|
|
172 |
|
|
173 |
TSmlDmAccessTypes *aclTypes = new (ELeave) TSmlDmAccessTypes();
|
|
174 |
CleanupStack::PushL(aclTypes);
|
|
175 |
//
|
|
176 |
// Set Get as acceptable operations
|
|
177 |
//
|
|
178 |
aclTypes->SetGet();
|
|
179 |
aclTypes->SetAdd(); // 041208 Added
|
|
180 |
aclTypes->SetDelete();
|
|
181 |
aclTypes->SetReplace();
|
|
182 |
|
|
183 |
TSmlDmAccessTypes accessTypesAll;
|
|
184 |
accessTypesAll.SetGet();
|
|
185 |
accessTypesAll.SetDelete();
|
|
186 |
accessTypesAll.SetAdd();
|
|
187 |
accessTypesAll.SetReplace();
|
|
188 |
|
|
189 |
TSmlDmAccessTypes accessTypesNoDelete;
|
|
190 |
accessTypesNoDelete.SetGet();
|
|
191 |
accessTypesNoDelete.SetAdd();
|
|
192 |
accessTypesNoDelete.SetReplace();
|
|
193 |
|
|
194 |
TSmlDmAccessTypes accessTypesGetAdd;
|
|
195 |
accessTypesGetAdd.SetGet();
|
|
196 |
accessTypesGetAdd.SetAdd();
|
|
197 |
|
|
198 |
TSmlDmAccessTypes accessTypesGetAddDel;
|
|
199 |
accessTypesGetAddDel.SetGet();
|
|
200 |
accessTypesGetAddDel.SetAdd();
|
|
201 |
accessTypesGetAddDel.SetDelete();
|
|
202 |
//WLAN
|
|
203 |
MSmlDmDDFObject& rootNode = aDDF.AddChildObjectL(KNSmlWLanNodeName);
|
|
204 |
FillNodeInfoL(rootNode, accessTypesGetAdd, MSmlDmDDFObject::EZeroOrOne,
|
|
205 |
MSmlDmDDFObject::EDynamic, MSmlDmDDFObject::ENode, KNSmlEmpty);
|
|
206 |
|
|
207 |
//WLAN/<x>
|
|
208 |
MSmlDmDDFObject& wlanNode = rootNode.AddChildObjectGroupL();
|
|
209 |
FillNodeInfoL(wlanNode, accessTypesGetAddDel, MSmlDmDDFObject::EOne,
|
|
210 |
MSmlDmDDFObject::EDynamic, MSmlDmDDFObject::ENode, KNSmlEmpty);
|
|
211 |
|
|
212 |
//WLAN/<x>/SSID
|
|
213 |
MSmlDmDDFObject& ssid = wlanNode.AddChildObjectL(KNSmlWLanSsid);
|
|
214 |
FillNodeInfoL(ssid, accessTypesNoDelete, MSmlDmDDFObject::EZeroOrOne,
|
|
215 |
MSmlDmDDFObject::EDynamic, MSmlDmDDFObject::EChr, KNSmlEmpty);
|
|
216 |
|
|
217 |
//WLAN/<x>/UsedSSID
|
|
218 |
MSmlDmDDFObject& usedSsid = wlanNode.AddChildObjectL(KNSmlWLanUsedSsid);
|
|
219 |
FillNodeInfoL(usedSsid, accessTypesNoDelete, MSmlDmDDFObject::EZeroOrOne,
|
|
220 |
MSmlDmDDFObject::EDynamic, MSmlDmDDFObject::EChr, KNSmlEmpty);
|
|
221 |
|
|
222 |
//WLAN/<x>/SSIDHidden
|
|
223 |
MSmlDmDDFObject& ssidHidden = wlanNode.AddChildObjectL(
|
|
224 |
KNSmlWLanSsidHidden);
|
|
225 |
FillNodeInfoL(ssidHidden, accessTypesNoDelete,
|
|
226 |
MSmlDmDDFObject::EZeroOrOne, MSmlDmDDFObject::EDynamic,
|
|
227 |
MSmlDmDDFObject::EBool, KNSmlEmpty);
|
|
228 |
|
|
229 |
//WLAN/<x>/NetworkMode
|
|
230 |
MSmlDmDDFObject& networkMode = wlanNode.AddChildObjectL(
|
|
231 |
KNSmlWLanNetworkMode);
|
|
232 |
FillNodeInfoL(networkMode, accessTypesNoDelete,
|
|
233 |
MSmlDmDDFObject::EZeroOrOne, MSmlDmDDFObject::EDynamic,
|
|
234 |
MSmlDmDDFObject::EChr, KNSmlEmpty);
|
|
235 |
|
|
236 |
//WLAN/<x>/SecurityMode
|
|
237 |
MSmlDmDDFObject& securityMode = wlanNode.AddChildObjectL(
|
|
238 |
KNSmlWLanSecurityMode);
|
|
239 |
FillNodeInfoL(securityMode, accessTypesNoDelete,
|
|
240 |
MSmlDmDDFObject::EZeroOrOne, MSmlDmDDFObject::EDynamic,
|
|
241 |
MSmlDmDDFObject::EChr, KNSmlEmpty);
|
|
242 |
|
|
243 |
//WLAN/<x>/UseWPAPSK
|
|
244 |
MSmlDmDDFObject& useWPAPSK = wlanNode.AddChildObjectL(KNSmlWLanUseWPAPSK);
|
|
245 |
FillNodeInfoL(useWPAPSK, accessTypesNoDelete,
|
|
246 |
MSmlDmDDFObject::EZeroOrOne, MSmlDmDDFObject::EDynamic,
|
|
247 |
MSmlDmDDFObject::EBool, KNSmlEmpty);
|
|
248 |
|
|
249 |
//WLAN/<x>/WPAPreSharedKey
|
|
250 |
MSmlDmDDFObject& wpaPreSharedKey = wlanNode.AddChildObjectL(
|
|
251 |
KNSmlWLanWpaPreSharedKey);
|
|
252 |
FillNodeInfoL(wpaPreSharedKey, accessTypesNoDelete,
|
|
253 |
MSmlDmDDFObject::EZeroOrOne, MSmlDmDDFObject::EDynamic,
|
|
254 |
MSmlDmDDFObject::EBin, KNSmlEmpty);
|
|
255 |
|
|
256 |
//WLAN/<x>/WLANEAPList
|
|
257 |
MSmlDmDDFObject& wlanEapList = wlanNode.AddChildObjectL(KNSmlWLanEapList);
|
|
258 |
FillNodeInfoL(wlanEapList, accessTypesNoDelete,
|
|
259 |
MSmlDmDDFObject::EZeroOrOne, MSmlDmDDFObject::EDynamic,
|
|
260 |
MSmlDmDDFObject::EChr, KNSmlEmpty);
|
|
261 |
|
|
262 |
//WLAN/<x>/WEPKeyIndex
|
|
263 |
MSmlDmDDFObject& wepKeyIndex =
|
|
264 |
wlanNode.AddChildObjectL(KNSmlWLanWepIndex);
|
|
265 |
FillNodeInfoL(wepKeyIndex, accessTypesNoDelete,
|
|
266 |
MSmlDmDDFObject::EZeroOrOne, MSmlDmDDFObject::EDynamic,
|
|
267 |
MSmlDmDDFObject::EInt, KNSmlEmpty);
|
|
268 |
|
|
269 |
//WLAN/<x>/WEPAuthMode
|
|
270 |
MSmlDmDDFObject& wlanWepAuthMode = wlanNode.AddChildObjectL(
|
|
271 |
KNSmlWLanAuthMode);
|
|
272 |
FillNodeInfoL(wlanWepAuthMode, accessTypesNoDelete,
|
|
273 |
MSmlDmDDFObject::EZeroOrOne, MSmlDmDDFObject::EDynamic,
|
|
274 |
MSmlDmDDFObject::EInt, KNSmlEmpty);
|
|
275 |
|
|
276 |
//WLAN/<x>/WEPKey/
|
|
277 |
MSmlDmDDFObject& wepKeyRoot = wlanNode.AddChildObjectL(KNSmlWLanWepKey);
|
|
278 |
FillNodeInfoL(wepKeyRoot, accessTypesNoDelete,
|
|
279 |
MSmlDmDDFObject::EZeroOrOne, MSmlDmDDFObject::EDynamic,
|
|
280 |
MSmlDmDDFObject::ENode, KNSmlEmpty);
|
|
281 |
|
|
282 |
//WLAN/<x>/WEPKey/<x>
|
|
283 |
MSmlDmDDFObject& wepKey = wepKeyRoot.AddChildObjectGroupL();
|
|
284 |
FillNodeInfoL(wepKey, accessTypesGetAdd, MSmlDmDDFObject::EOneOrN,
|
|
285 |
MSmlDmDDFObject::EDynamic, MSmlDmDDFObject::ENode, KNSmlEmpty);
|
|
286 |
|
|
287 |
//WLAN/<x>/WEPKey/<x>/WEPKeyID
|
|
288 |
MSmlDmDDFObject& wepKeyId = wepKey.AddChildObjectL(KNSmlWLanWepKeyId);
|
|
289 |
FillNodeInfoL(wepKeyId, accessTypesNoDelete, MSmlDmDDFObject::EOne,
|
|
290 |
MSmlDmDDFObject::EDynamic, MSmlDmDDFObject::EInt, KNSmlEmpty);
|
|
291 |
|
|
292 |
//WLAN/<x>/WEPKey/<x>/Data
|
|
293 |
MSmlDmDDFObject& data = wepKey.AddChildObjectL(KNSmlWLanWepKeyData);
|
|
294 |
FillNodeInfoL(data, accessTypesNoDelete, MSmlDmDDFObject::EOne,
|
|
295 |
MSmlDmDDFObject::EDynamic, MSmlDmDDFObject::EBin, KNSmlEmpty);
|
|
296 |
|
|
297 |
//WLAN/<x>/SecondarySSID/
|
|
298 |
MSmlDmDDFObject& secondarySSidRoot = wlanNode.AddChildObjectL(
|
|
299 |
KNSmlWLanSecSsid);
|
|
300 |
FillNodeInfoL(secondarySSidRoot, accessTypesGetAdd,
|
|
301 |
MSmlDmDDFObject::EZeroOrOne, MSmlDmDDFObject::EDynamic,
|
|
302 |
MSmlDmDDFObject::ENode, KNSmlEmpty);
|
|
303 |
|
|
304 |
//WLAN/<x>/SecondarySSID/<x>
|
|
305 |
MSmlDmDDFObject& secondarySSid = secondarySSidRoot.AddChildObjectGroupL();
|
|
306 |
FillNodeInfoL(secondarySSid, accessTypesGetAddDel,
|
|
307 |
MSmlDmDDFObject::EOneOrN, MSmlDmDDFObject::EDynamic,
|
|
308 |
MSmlDmDDFObject::ENode, KNSmlEmpty);
|
|
309 |
|
|
310 |
//WLAN/<x>/SecondarySSID/<x>/SSID
|
|
311 |
MSmlDmDDFObject& secSsidId = secondarySSid.AddChildObjectL(KNSmlWLanSsid);
|
|
312 |
FillNodeInfoL(secSsidId, accessTypesNoDelete, MSmlDmDDFObject::EOne,
|
|
313 |
MSmlDmDDFObject::EDynamic, MSmlDmDDFObject::EChr, KNSmlEmpty);
|
|
314 |
|
|
315 |
//WLAN/<x>/SecondarySSID/<x>/UsedSSID
|
|
316 |
MSmlDmDDFObject& secUsedSsidId = secondarySSid.AddChildObjectL(
|
|
317 |
KNSmlWLanUsedSsid);
|
|
318 |
FillNodeInfoL(secUsedSsidId, accessTypesNoDelete,
|
|
319 |
MSmlDmDDFObject::EZeroOrOne, MSmlDmDDFObject::EDynamic,
|
|
320 |
MSmlDmDDFObject::EChr, KNSmlEmpty);
|
|
321 |
|
|
322 |
//WLAN/<x>/EAP/
|
|
323 |
MSmlDmDDFObject& eapRoot = wlanNode.AddChildObjectL(KNSmlWLanEap);
|
|
324 |
FillNodeInfoL(eapRoot, accessTypesGetAdd, MSmlDmDDFObject::EZeroOrOne,
|
|
325 |
MSmlDmDDFObject::EDynamic, MSmlDmDDFObject::ENode, KNSmlEmpty);
|
|
326 |
|
|
327 |
//WLAN/<x>/EAP/<x>
|
|
328 |
MSmlDmDDFObject& eap = eapRoot.AddChildObjectGroupL();
|
|
329 |
FillNodeInfoL(eap, accessTypesGetAdd, MSmlDmDDFObject::EOneOrN,
|
|
330 |
MSmlDmDDFObject::EDynamic, MSmlDmDDFObject::ENode, KNSmlEmpty);
|
|
331 |
|
|
332 |
//WLAN/<x>/EAP/<x>/EAPType
|
|
333 |
MSmlDmDDFObject& eapType = eap.AddChildObjectL(KNSmlWLanEapType);
|
|
334 |
FillNodeInfoL(eapType, accessTypesNoDelete, MSmlDmDDFObject::EOne,
|
|
335 |
MSmlDmDDFObject::EDynamic, MSmlDmDDFObject::EChr, KNSmlEmpty);
|
|
336 |
|
|
337 |
//WLAN/<x>/EAP/<x>/Username
|
|
338 |
MSmlDmDDFObject& eapUsername = eap.AddChildObjectL(KNSmlWLanUsername);
|
|
339 |
FillNodeInfoL(eapUsername, accessTypesNoDelete,
|
|
340 |
MSmlDmDDFObject::EZeroOrOne, MSmlDmDDFObject::EDynamic,
|
|
341 |
MSmlDmDDFObject::EChr, KNSmlEmpty);
|
|
342 |
|
|
343 |
//WLAN/<x>/EAP/<x>/Password
|
|
344 |
MSmlDmDDFObject& eapPassword = eap.AddChildObjectL(KNSmlWLanPassword);
|
|
345 |
FillNodeInfoL(eapPassword, accessTypesNoDelete,
|
|
346 |
MSmlDmDDFObject::EZeroOrOne, MSmlDmDDFObject::EDynamic,
|
|
347 |
MSmlDmDDFObject::EChr, KNSmlEmpty);
|
|
348 |
|
|
349 |
//WLAN/<x>/EAP/<x>/Realm
|
|
350 |
MSmlDmDDFObject& eapRealm = eap.AddChildObjectL(KNSmlWLanRealm);
|
|
351 |
FillNodeInfoL(eapRealm, accessTypesNoDelete, MSmlDmDDFObject::EZeroOrOne,
|
|
352 |
MSmlDmDDFObject::EDynamic, MSmlDmDDFObject::EChr, KNSmlEmpty);
|
|
353 |
|
|
354 |
//WLAN/<x>/EAP/<x>/UsePseudonym
|
|
355 |
MSmlDmDDFObject& eapPseudo = eap.AddChildObjectL(KNSmlWLanUsePseudonym);
|
|
356 |
FillNodeInfoL(eapPseudo, accessTypesNoDelete,
|
|
357 |
MSmlDmDDFObject::EZeroOrOne, MSmlDmDDFObject::EDynamic,
|
|
358 |
MSmlDmDDFObject::EBool, KNSmlEmpty);
|
|
359 |
|
|
360 |
//WLAN/<x>/EAP/<x>/Encapsulation
|
|
361 |
// Encapsulation is not supported using this parameter. It is done
|
|
362 |
// with */EAP/EAPIdxxx-yyy/* where xxx is the encapsulated and yyy the encapsulating method.
|
|
363 |
/*MSmlDmDDFObject& eapEncapsulation = eap.AddChildObjectL( KNSmlWLanEncapsulation );
|
|
364 |
FillNodeInfoL( eapEncapsulation,
|
|
365 |
accessTypesNoDelete,
|
|
366 |
MSmlDmDDFObject::EZeroOrOne,
|
|
367 |
MSmlDmDDFObject::EDynamic,
|
|
368 |
MSmlDmDDFObject::EChr,
|
|
369 |
KNSmlEmpty ); */
|
|
370 |
|
|
371 |
//WLAN/<x>/EAP/<x>/VerifyCertRealm
|
|
372 |
MSmlDmDDFObject& eapVerifyCertRealm = eap.AddChildObjectL(
|
|
373 |
KNSmlWLanVerifyCertRealm);
|
|
374 |
FillNodeInfoL(eapVerifyCertRealm, accessTypesNoDelete,
|
|
375 |
MSmlDmDDFObject::EZeroOrOne, MSmlDmDDFObject::EDynamic,
|
|
376 |
MSmlDmDDFObject::EBool, KNSmlEmpty);
|
|
377 |
|
|
378 |
//WLAN/<x>/EAP/<x>/RequireClientAuthentication
|
|
379 |
MSmlDmDDFObject& eapRequireClientAuthentication = eap.AddChildObjectL(
|
|
380 |
KNSmlWLanRequireClientAuthentication);
|
|
381 |
FillNodeInfoL(eapRequireClientAuthentication, accessTypesNoDelete,
|
|
382 |
MSmlDmDDFObject::EZeroOrOne, MSmlDmDDFObject::EDynamic,
|
|
383 |
MSmlDmDDFObject::EBool, KNSmlEmpty);
|
|
384 |
|
|
385 |
//WLAN/<x>/EAP/<x>/SessionValidityTime
|
|
386 |
MSmlDmDDFObject& eapSessionValidityTime = eap.AddChildObjectL(
|
|
387 |
KNSmlWLanSessionValidityTime);
|
|
388 |
FillNodeInfoL(eapSessionValidityTime, accessTypesNoDelete,
|
|
389 |
MSmlDmDDFObject::EZeroOrOne, MSmlDmDDFObject::EDynamic,
|
|
390 |
MSmlDmDDFObject::EChr, KNSmlEmpty);
|
|
391 |
|
|
392 |
//WLAN/<x>/EAP/<x>/CipherSuite
|
|
393 |
MSmlDmDDFObject& eapCipherSuite = eap.AddChildObjectL(
|
|
394 |
KNSmlWLanCipherSuite);
|
|
395 |
FillNodeInfoL(eapCipherSuite, accessTypesNoDelete,
|
|
396 |
MSmlDmDDFObject::EZeroOrOne, MSmlDmDDFObject::EDynamic,
|
|
397 |
MSmlDmDDFObject::EChr, KNSmlEmpty);
|
|
398 |
|
|
399 |
//WLAN/<x>/EAP/<x>/AllowPEAPv0
|
|
400 |
MSmlDmDDFObject& eapAllowPEAPv0 = eap.AddChildObjectL(
|
|
401 |
KNSmlWLanAllowPEAPv0);
|
|
402 |
FillNodeInfoL(eapAllowPEAPv0, accessTypesNoDelete,
|
|
403 |
MSmlDmDDFObject::EZeroOrOne, MSmlDmDDFObject::EDynamic,
|
|
404 |
MSmlDmDDFObject::EBool, KNSmlEmpty);
|
|
405 |
|
|
406 |
//WLAN/<x>/EAP/<x>/AllowPEAPv1
|
|
407 |
MSmlDmDDFObject& eapAllowPEAPv1 = eap.AddChildObjectL(
|
|
408 |
KNSmlWLanAllowPEAPv1);
|
|
409 |
FillNodeInfoL(eapAllowPEAPv1, accessTypesNoDelete,
|
|
410 |
MSmlDmDDFObject::EZeroOrOne, MSmlDmDDFObject::EDynamic,
|
|
411 |
MSmlDmDDFObject::EBool, KNSmlEmpty);
|
|
412 |
|
|
413 |
//WLAN/<x>/EAP/<x>/AllowPEAPv2
|
|
414 |
MSmlDmDDFObject& eapAllowPEAPv2 = eap.AddChildObjectL(
|
|
415 |
KNSmlWLanAllowPEAPv2);
|
|
416 |
FillNodeInfoL(eapAllowPEAPv2, accessTypesNoDelete,
|
|
417 |
MSmlDmDDFObject::EZeroOrOne, MSmlDmDDFObject::EDynamic,
|
|
418 |
MSmlDmDDFObject::EBool, KNSmlEmpty);
|
|
419 |
|
|
420 |
#ifdef FF_WLAN_EXTENSIONS
|
|
421 |
|
|
422 |
//WLAN/<x>/EAP/<x>/AuthProvModeAllowed
|
|
423 |
MSmlDmDDFObject& authProvMode = eap.AddChildObjectL( KNSmlWLanAuthProvMode );
|
|
424 |
FillNodeInfoL( authProvMode,
|
|
425 |
accessTypesNoDelete,
|
|
426 |
MSmlDmDDFObject::EZeroOrOne,
|
|
427 |
MSmlDmDDFObject::EDynamic,
|
|
428 |
MSmlDmDDFObject::EBool,
|
|
429 |
KNSmlEmpty );
|
|
430 |
|
|
431 |
//WLAN/<x>/EAP/<x>/UnauthProvModeAllowed
|
|
432 |
MSmlDmDDFObject& unauthProvMode = eap.AddChildObjectL( KNSmlWLanUnauthProvMode );
|
|
433 |
FillNodeInfoL( unauthProvMode,
|
|
434 |
accessTypesNoDelete,
|
|
435 |
MSmlDmDDFObject::EZeroOrOne,
|
|
436 |
MSmlDmDDFObject::EDynamic,
|
|
437 |
MSmlDmDDFObject::EBool,
|
|
438 |
KNSmlEmpty );
|
|
439 |
|
|
440 |
//WLAN/<x>/EAP/<x>/PACGroupReference
|
|
441 |
MSmlDmDDFObject& pacGroupRef = eap.AddChildObjectL( KNSmlWLanPACGroupRef );
|
|
442 |
FillNodeInfoL( pacGroupRef,
|
|
443 |
accessTypesNoDelete,
|
|
444 |
MSmlDmDDFObject::EZeroOrOne,
|
|
445 |
MSmlDmDDFObject::EDynamic,
|
|
446 |
MSmlDmDDFObject::EChr,
|
|
447 |
KNSmlEmpty );
|
|
448 |
|
|
449 |
//WLAN/<x>/EAP/<x>/WarnADHPNoPAC
|
|
450 |
MSmlDmDDFObject& warnADHPNoPAC = eap.AddChildObjectL( KNSmlWLanWarnADHPNoPAC );
|
|
451 |
FillNodeInfoL( warnADHPNoPAC,
|
|
452 |
accessTypesNoDelete,
|
|
453 |
MSmlDmDDFObject::EZeroOrOne,
|
|
454 |
MSmlDmDDFObject::EDynamic,
|
|
455 |
MSmlDmDDFObject::EBool,
|
|
456 |
KNSmlEmpty );
|
|
457 |
|
|
458 |
//WLAN/<x>/EAP/<x>/WarnADHPNoMatchingPAC
|
|
459 |
MSmlDmDDFObject& warnADHPNoMatchingPAC = eap.AddChildObjectL( KNSmlWLanWarnADHPNoMatchPAC );
|
|
460 |
FillNodeInfoL( warnADHPNoMatchingPAC,
|
|
461 |
accessTypesNoDelete,
|
|
462 |
MSmlDmDDFObject::EZeroOrOne,
|
|
463 |
MSmlDmDDFObject::EDynamic,
|
|
464 |
MSmlDmDDFObject::EBool,
|
|
465 |
KNSmlEmpty );
|
|
466 |
|
|
467 |
//WLAN/<x>/EAP/<x>/WarnNotDefaultServer
|
|
468 |
MSmlDmDDFObject& warnNoDefServ = eap.AddChildObjectL( KNSmlWLanWarnNotDefaultSrv );
|
|
469 |
FillNodeInfoL( warnNoDefServ,
|
|
470 |
accessTypesNoDelete,
|
|
471 |
MSmlDmDDFObject::EZeroOrOne,
|
|
472 |
MSmlDmDDFObject::EDynamic,
|
|
473 |
MSmlDmDDFObject::EBool,
|
|
474 |
KNSmlEmpty );
|
|
475 |
|
|
476 |
#endif
|
|
477 |
|
|
478 |
//WLAN/<x>/EAP/<x>/Certificate
|
|
479 |
MSmlDmDDFObject& eapCertificateRoot = eap.AddChildObjectL(
|
|
480 |
KNSmlWLanCertificate);
|
|
481 |
FillNodeInfoL(eapCertificateRoot, accessTypesGetAdd,
|
|
482 |
MSmlDmDDFObject::EZeroOrOne, MSmlDmDDFObject::EDynamic,
|
|
483 |
MSmlDmDDFObject::ENode, KNSmlEmpty);
|
|
484 |
|
|
485 |
//WLAN/<x>/EAP/<x>/Certificate/<x>
|
|
486 |
MSmlDmDDFObject& eapCertificate =
|
|
487 |
eapCertificateRoot.AddChildObjectGroupL();
|
|
488 |
FillNodeInfoL(eapCertificate, accessTypesGetAdd,
|
|
489 |
MSmlDmDDFObject::EOneOrMore, MSmlDmDDFObject::EDynamic,
|
|
490 |
MSmlDmDDFObject::ENode, KNSmlEmpty);
|
|
491 |
|
|
492 |
//WLAN/<x>/EAP/<x>/Certificate/<x>/IssuerName
|
|
493 |
MSmlDmDDFObject& eapIssuerName = eapCertificate.AddChildObjectL(
|
|
494 |
KNSmlWLanIssuerName);
|
|
495 |
FillNodeInfoL(eapIssuerName, accessTypesNoDelete,
|
|
496 |
MSmlDmDDFObject::EZeroOrOne, MSmlDmDDFObject::EDynamic,
|
|
497 |
MSmlDmDDFObject::EChr, KNSmlEmpty);
|
|
498 |
|
|
499 |
//WLAN/<x>/EAP/<x>/Certificate/<x>/SubjectName
|
|
500 |
MSmlDmDDFObject& eapSubjectName = eapCertificate.AddChildObjectL(
|
|
501 |
KNSmlWLanSubjectName);
|
|
502 |
FillNodeInfoL(eapSubjectName, accessTypesNoDelete,
|
|
503 |
MSmlDmDDFObject::EZeroOrOne, MSmlDmDDFObject::EDynamic,
|
|
504 |
MSmlDmDDFObject::EChr, KNSmlEmpty);
|
|
505 |
|
|
506 |
//WLAN/<x>/EAP/<x>/Certificate/<x>/CertType
|
|
507 |
MSmlDmDDFObject& eapCertType = eapCertificate.AddChildObjectL(
|
|
508 |
KNSmlWLanCertType);
|
|
509 |
FillNodeInfoL(eapCertType, accessTypesNoDelete, MSmlDmDDFObject::EOne,
|
|
510 |
MSmlDmDDFObject::EDynamic, MSmlDmDDFObject::EChr, KNSmlEmpty);
|
|
511 |
|
|
512 |
//WLAN/<x>/EAP/<x>/Certificate/<x>/SerialNumber
|
|
513 |
MSmlDmDDFObject& eapSerialNumber = eapCertificate.AddChildObjectL(
|
|
514 |
KNSmlWLanSerialNumber);
|
|
515 |
FillNodeInfoL(eapSerialNumber, accessTypesNoDelete,
|
|
516 |
MSmlDmDDFObject::EZeroOrOne, MSmlDmDDFObject::EDynamic,
|
|
517 |
MSmlDmDDFObject::EChr, KNSmlEmpty);
|
|
518 |
|
|
519 |
//WLAN/<x>/EAP/<x>/Certificate/<x>/SubjectKeyId
|
|
520 |
MSmlDmDDFObject& eapSubjectKeyId = eapCertificate.AddChildObjectL(
|
|
521 |
KNSmlWLanSubjectKeyId);
|
|
522 |
FillNodeInfoL(eapSubjectKeyId, accessTypesNoDelete,
|
|
523 |
MSmlDmDDFObject::EOne, MSmlDmDDFObject::EDynamic,
|
|
524 |
MSmlDmDDFObject::EChr, KNSmlEmpty);
|
|
525 |
|
|
526 |
//WLAN/<x>/EAP/<x>/Certificate/<x>/Fingerprint
|
|
527 |
MSmlDmDDFObject& eapFingerprint = eapCertificate.AddChildObjectL(
|
|
528 |
KNSmlWLanFingerprint);
|
|
529 |
FillNodeInfoL(eapFingerprint, accessTypesNoDelete,
|
|
530 |
MSmlDmDDFObject::EZeroOrOne, MSmlDmDDFObject::EDynamic,
|
|
531 |
MSmlDmDDFObject::EChr, KNSmlEmpty);
|
|
532 |
|
|
533 |
CleanupStack::PopAndDestroy(); //aclTypes
|
|
534 |
|
|
535 |
_DBG_FILE("CNSmlWLanAdapter::DDFStructureL(): end");
|
|
536 |
}
|
|
537 |
|
|
538 |
//-----------------------------------------------------------------------------
|
|
539 |
// CNSmlWLanAdapter* CNSmlWLanAdapter::AddLeafObjectL( const TDesC& aURI,const
|
|
540 |
// TDesC& aParentLUID, const TDesC8& aObject, const TDesC& aType,
|
|
541 |
// const TInt aStatusRef )
|
|
542 |
//-----------------------------------------------------------------------------
|
|
543 |
void CNSmlWLanAdapter::AddLeafObjectL(const TDesC8& aURI,
|
|
544 |
const TDesC8& aParentLUID, const TDesC8& aObject,
|
|
545 |
const TDesC8& /*aType*/, const TInt aStatusRef)
|
|
546 |
{
|
|
547 |
DBG_ARGS8(_S8("CNSmlWLanAdapter::AddLeafObjectL - <%S> <%S> <%S>"),
|
|
548 |
&aURI, &aParentLUID, &aObject);
|
|
549 |
|
|
550 |
TInt uriSegs = NumOfUriSegs(aURI);
|
|
551 |
TInt luid = GetIdFromLuid(aParentLUID);
|
|
552 |
TInt err(KErrNone);
|
|
553 |
TPtrC8 lastUriSeg = GetLastUriSeg(aURI);
|
|
554 |
|
|
555 |
TInt eapIndex(0);
|
|
556 |
|
|
557 |
TInt eapId = GetEAPIdFromUri(aURI);
|
|
558 |
if (eapId == KErrNotFound)
|
|
559 |
{
|
|
560 |
_DBG_FILE("CNSmlWLanAdapter::AddLeafObjectL(): Non-EAP setting.");
|
|
561 |
if (luid == KErrNotFound)
|
|
562 |
{
|
|
563 |
return;
|
|
564 |
}
|
|
565 |
err = iWlanSettings->GetWlanSettings(luid, *iSettings);
|
|
566 |
}
|
|
567 |
else
|
|
568 |
{
|
|
569 |
_DBG_FILE("CNSmlWLanAdapter::AddLeafObjectL(): EAP setting.");
|
|
570 |
TInt encapsEapId = GetEncapsEAPIdFromUri(aURI);
|
|
571 |
if (encapsEapId == KErrNotFound)
|
|
572 |
{
|
|
573 |
_DBG_FILE(
|
|
574 |
"CNSmlWLanAdapter::AddLeafObjectL(): Does not have encapsulation id xx-xx.");
|
|
575 |
encapsEapId = EEapNone;
|
|
576 |
}
|
|
577 |
// append it to the appropriate list ('+' enabled, '-' disabled)
|
|
578 |
_LIT8(KPadding, "\xFE\0\0\0\0\0\0");
|
|
579 |
_LIT8(KMsChapV2Padding, "\xFE\xFF\xFF\xFF\0\0\0");
|
|
580 |
const TInt KPlainMsChapV2ImplUid = 99;
|
|
581 |
|
|
582 |
TBuf8<KExpandedEapIdLength> cmpbuf;
|
|
583 |
if (eapId == KPlainMsChapV2ImplUid)
|
|
584 |
{
|
|
585 |
cmpbuf.Append(KMsChapV2Padding);
|
|
586 |
}
|
|
587 |
else
|
|
588 |
{
|
|
589 |
cmpbuf.Append(KPadding);
|
|
590 |
}
|
|
591 |
cmpbuf.Append(eapId);
|
|
592 |
TEapExpandedType expandedTypecmbuf(cmpbuf);
|
|
593 |
|
|
594 |
TBuf8<KExpandedEapIdLength> encapscmpbuf;
|
|
595 |
if (encapsEapId == KPlainMsChapV2ImplUid)
|
|
596 |
{
|
|
597 |
encapscmpbuf.Append(KMsChapV2Padding);
|
|
598 |
}
|
|
599 |
else
|
|
600 |
{
|
|
601 |
encapscmpbuf.Append(KPadding);
|
|
602 |
}
|
|
603 |
encapscmpbuf.Append(encapsEapId);
|
|
604 |
TEapExpandedType expandedTypeencapscmbuf(encapscmpbuf);
|
|
605 |
|
|
606 |
TInt i(0);
|
|
607 |
// This is EAP addition. Check if the buffer for this EAP already exists
|
|
608 |
for (i = 0; i < iEAPBuffer.Count(); i++)
|
|
609 |
{
|
|
610 |
if ((expandedTypecmbuf.Compare(
|
|
611 |
iEAPBuffer[i]->iEAPSettings->iEAPExpandedType) == 0)
|
|
612 |
&& (expandedTypeencapscmbuf.Compare(
|
|
613 |
iEAPBuffer[i]->iEncapsulatingExpandedEapId) == 0))
|
|
614 |
{
|
|
615 |
// The correct buffer was found.
|
|
616 |
_DBG_FILE(
|
|
617 |
"CNSmlWLanAdapter::AddLeafObjectL(): Found existing buffer.");
|
|
618 |
eapIndex = i;
|
|
619 |
break;
|
|
620 |
}
|
|
621 |
}
|
|
622 |
if (i == iEAPBuffer.Count())
|
|
623 |
{
|
|
624 |
DBG_ARGS8(
|
|
625 |
_S8(
|
|
626 |
"CNSmlWLanAdapter::AddLeafObjectL(): No buffer found. Create new: <%d>-<%d>"),
|
|
627 |
eapId, encapsEapId);
|
|
628 |
// Buffer was not found. Create new.
|
|
629 |
TInt WLANServiceId = GetServiceIdFromUriL(aURI);
|
|
630 |
|
|
631 |
if (WLANServiceId == KErrNotFound)
|
|
632 |
{
|
|
633 |
_DBG_FILE(
|
|
634 |
"CNSmlWLanAdapter::AddLeafObjectL(): Could not find WLAN service ID from URI.");
|
|
635 |
iCallBack->SetStatusL(aStatusRef, CSmlDmAdapter::ENotFound);
|
|
636 |
return;
|
|
637 |
}
|
|
638 |
|
|
639 |
TNSmlEAPBufferElement* buffer =
|
|
640 |
new (ELeave) TNSmlEAPBufferElement;
|
|
641 |
CleanupStack::PushL(buffer);
|
|
642 |
|
|
643 |
buffer->iEAPSettings = new (ELeave) EAPSettings;
|
|
644 |
CleanupStack::PushL(buffer->iEAPSettings);
|
|
645 |
|
|
646 |
// append it to the appropriate list ('+' enabled, '-' disabled)
|
|
647 |
_LIT8(KPadding, "\xFE\0\0\0\0\0\0");
|
|
648 |
_LIT8(KMsChapV2Padding, "\xFE\xFF\xFF\xFF\0\0\0");
|
|
649 |
const TInt KPlainMsChapV2ImplUid = 99;
|
|
650 |
|
|
651 |
TBuf8<KExpandedEapIdLength> tempbuf;
|
|
652 |
if (eapId == KPlainMsChapV2ImplUid)
|
|
653 |
{
|
|
654 |
tempbuf.Append(KMsChapV2Padding);
|
|
655 |
}
|
|
656 |
else
|
|
657 |
{
|
|
658 |
tempbuf.Append(KPadding);
|
|
659 |
}
|
|
660 |
tempbuf.Append(eapId);
|
|
661 |
|
|
662 |
buffer->iEAPSettings->iEAPExpandedType = tempbuf;
|
|
663 |
buffer->iWLANServiceId = WLANServiceId;
|
|
664 |
TBuf8<KExpandedEapIdLength> encapsTempbuf;
|
|
665 |
if (encapsEapId == KPlainMsChapV2ImplUid)
|
|
666 |
{
|
|
667 |
encapsTempbuf.Append(KMsChapV2Padding);
|
|
668 |
}
|
|
669 |
else
|
|
670 |
{
|
|
671 |
encapsTempbuf.Append(KPadding);
|
|
672 |
}
|
|
673 |
encapsTempbuf.Append(encapsEapId);
|
|
674 |
|
|
675 |
buffer->iEncapsulatingExpandedEapId = encapsTempbuf;
|
|
676 |
iEAPBuffer.AppendL(buffer);
|
|
677 |
|
|
678 |
CleanupStack::Pop(buffer->iEAPSettings);
|
|
679 |
CleanupStack::Pop(buffer);
|
|
680 |
|
|
681 |
eapIndex = iEAPBuffer.Count() - 1;
|
|
682 |
}
|
|
683 |
}
|
|
684 |
if (err != KErrNone)
|
|
685 |
{
|
|
686 |
DBG_ARGS(_S16("CNSmlWLanAdapter::AddLeafObjectL - ErrorCode <%D>"),
|
|
687 |
err);
|
|
688 |
iCallBack->SetStatusL(aStatusRef, CSmlDmAdapter::ENotFound);
|
|
689 |
return;
|
|
690 |
}
|
|
691 |
|
|
692 |
else if (aURI.Match(_L8("AP/*/NAPDef/*/WLAN/*/WEPKey/*/*"))
|
|
693 |
!= KErrNotFound && uriSegs == 9)
|
|
694 |
{
|
|
695 |
TInt wepKeyId = GetWepKeyIdFromLuid(aParentLUID);
|
|
696 |
|
|
697 |
if (wepKeyId != KErrNotFound)
|
|
698 |
{
|
|
699 |
if (lastUriSeg.Match(KNSmlWLanWepKeyData) != KErrNotFound)
|
|
700 |
{
|
|
701 |
switch (wepKeyId)
|
|
702 |
{
|
|
703 |
case 1:
|
|
704 |
iSettings->WepKey1 = aObject;
|
|
705 |
break;
|
|
706 |
case 2:
|
|
707 |
iSettings->WepKey2 = aObject;
|
|
708 |
break;
|
|
709 |
case 3:
|
|
710 |
iSettings->WepKey3 = aObject;
|
|
711 |
break;
|
|
712 |
case 4:
|
|
713 |
iSettings->WepKey4 = aObject;
|
|
714 |
break;
|
|
715 |
default:
|
|
716 |
iCallBack->SetStatusL(aStatusRef,
|
|
717 |
CSmlDmAdapter::ENotFound);
|
|
718 |
return;
|
|
719 |
}
|
|
720 |
}
|
|
721 |
else if (lastUriSeg.Match(KNSmlWLanWepKeyId) != KErrNotFound)
|
|
722 |
{
|
|
723 |
iCallBack->SetStatusL(aStatusRef, CSmlDmAdapter::EOk);
|
|
724 |
return;
|
|
725 |
}
|
|
726 |
else
|
|
727 |
{
|
|
728 |
iCallBack->SetStatusL(aStatusRef, CSmlDmAdapter::ENotFound);
|
|
729 |
return;
|
|
730 |
}
|
|
731 |
}
|
|
732 |
|
|
733 |
else
|
|
734 |
{
|
|
735 |
TInt index = -1;
|
|
736 |
|
|
737 |
for (TInt i = 0; i < iBuffer->Count(); i++)
|
|
738 |
{
|
|
739 |
if (aURI.Find(iBuffer->At(i).iUri->Des()) != KErrNotFound)
|
|
740 |
{
|
|
741 |
index = i;
|
|
742 |
break;
|
|
743 |
}
|
|
744 |
}
|
|
745 |
if (index < 0)
|
|
746 |
{
|
|
747 |
wepKeyId = GetWepKeyIdFromUri(aURI);
|
|
748 |
|
|
749 |
TBuf8<80> addLUID; // AP/<x>/NapDef/<x>/WLAN/<x>/WEPKey/WKIdnnn
|
|
750 |
addLUID.AppendNum(wepKeyId);
|
|
751 |
addLUID.AppendNumFixedWidth(luid, EDecimal, 3);
|
|
752 |
|
|
753 |
DBG_ARGS8(
|
|
754 |
_S8(
|
|
755 |
"WLanAdapter::AddleafObject - mapping uri: <%S> to luid: <%S>"),
|
|
756 |
&aURI, &addLUID);
|
|
757 |
DBG_ARGS8(_S8("Parametrit - <%S> <%S>"), &aURI, &addLUID);
|
|
758 |
iCallBack->SetMappingL(aURI, addLUID);
|
|
759 |
if (lastUriSeg.Match(KNSmlWLanWepKeyData) != KErrNotFound)
|
|
760 |
{
|
|
761 |
switch (wepKeyId)
|
|
762 |
{
|
|
763 |
case 1:
|
|
764 |
iSettings->WepKey1 = aObject;
|
|
765 |
break;
|
|
766 |
case 2:
|
|
767 |
iSettings->WepKey2 = aObject;
|
|
768 |
break;
|
|
769 |
case 3:
|
|
770 |
iSettings->WepKey3 = aObject;
|
|
771 |
break;
|
|
772 |
case 4:
|
|
773 |
iSettings->WepKey4 = aObject;
|
|
774 |
break;
|
|
775 |
default:
|
|
776 |
iCallBack->SetStatusL(aStatusRef,
|
|
777 |
CSmlDmAdapter::ENotFound);
|
|
778 |
return;
|
|
779 |
}
|
|
780 |
}
|
|
781 |
else if (lastUriSeg.Match(KNSmlWLanWepKeyId) != KErrNotFound)
|
|
782 |
{
|
|
783 |
iCallBack->SetStatusL(aStatusRef, CSmlDmAdapter::EOk);
|
|
784 |
return;
|
|
785 |
}
|
|
786 |
else
|
|
787 |
{
|
|
788 |
iCallBack->SetStatusL(aStatusRef,
|
|
789 |
CSmlDmAdapter::ENotFound);
|
|
790 |
return;
|
|
791 |
}
|
|
792 |
}
|
|
793 |
else
|
|
794 |
{
|
|
795 |
//Add WepKeyId and execute buffer
|
|
796 |
if (lastUriSeg.Match(KNSmlWLanWepKeyId) != KErrNotFound)
|
|
797 |
{
|
|
798 |
iBuffer->At(index).iWepKeyId = DesToInt(aObject);
|
|
799 |
iBuffer->At(index).iIdStatusRef = aStatusRef;
|
|
800 |
|
|
801 |
// ExecuteBufferL( ); (JPLA-6M29NR caused error in WEPkey Data if buffer is executed here)
|
|
802 |
return;
|
|
803 |
}
|
|
804 |
|
|
805 |
else if (lastUriSeg.Match(KNSmlWLanWepKeyData)
|
|
806 |
!= KErrNotFound)
|
|
807 |
{
|
|
808 |
iBuffer->At(index).iData = aObject.AllocLC();
|
|
809 |
iBuffer->At(index).iDataSet = ETrue;
|
|
810 |
CleanupStack::Pop(); //iBuffer->At(index).iData
|
|
811 |
iBuffer->At(index).iDataStatusRef = aStatusRef;
|
|
812 |
return;
|
|
813 |
}
|
|
814 |
else
|
|
815 |
{
|
|
816 |
iCallBack->SetStatusL(aStatusRef,
|
|
817 |
CSmlDmAdapter::ENotFound);
|
|
818 |
return;
|
|
819 |
}
|
|
820 |
}
|
|
821 |
}
|
|
822 |
}
|
|
823 |
|
|
824 |
else if (aURI.Match(_L8("AP/*/NAPDef/*/WLAN/*/*")) != KErrNotFound
|
|
825 |
&& uriSegs == 7)
|
|
826 |
{
|
|
827 |
if (lastUriSeg.Compare(KNSmlWLanSsid) == 0)
|
|
828 |
{
|
|
829 |
TInt returnValue = CnvUtfConverter::ConvertToUnicodeFromUtf8(
|
|
830 |
iSettings->SSID, aObject);
|
|
831 |
DBG_ARGS(_S16("WLanAdapter::ssid convert: <%D>"), returnValue);
|
|
832 |
if (returnValue != KErrNone)
|
|
833 |
{
|
|
834 |
// setting the default value to the network name
|
|
835 |
iSettings->SSID = TPtrC(KNSmlWLanDefaultSSID);
|
|
836 |
DBG_ARGS(
|
|
837 |
_S16(
|
|
838 |
"CNSmlWLanAdapter::AddLeafObjectL SSID - ErrorCode <%D>"),
|
|
839 |
returnValue);
|
|
840 |
iCallBack->SetStatusL(aStatusRef, CSmlDmAdapter::EError);
|
|
841 |
return;
|
|
842 |
}
|
|
843 |
}
|
|
844 |
|
|
845 |
else if (lastUriSeg.Compare(KNSmlWLanUsedSsid) == 0)
|
|
846 |
{
|
|
847 |
TInt returnValue = CnvUtfConverter::ConvertToUnicodeFromUtf8(
|
|
848 |
iSettings->UsedSSID, aObject);
|
|
849 |
DBG_ARGS(_S16("WLanAdapter::usedSsid convert: <%D>"), returnValue);
|
|
850 |
}
|
|
851 |
|
|
852 |
else if (lastUriSeg.Compare(KNSmlWLanSsidHidden) == 0)
|
|
853 |
{
|
|
854 |
if (aObject.MatchF(_L8("True")) != KErrNotFound)
|
|
855 |
{
|
|
856 |
iSettings->ScanSSID = 1;
|
|
857 |
}
|
|
858 |
else
|
|
859 |
{
|
|
860 |
iSettings->ScanSSID = 0;
|
|
861 |
}
|
|
862 |
}
|
|
863 |
|
|
864 |
else if (lastUriSeg.Compare(KNSmlWLanNetworkMode) == 0)
|
|
865 |
{
|
|
866 |
if (aObject.MatchF(_L8("ADHOC")) != KErrNotFound)
|
|
867 |
{
|
|
868 |
iSettings->ConnectionMode = EAdhoc;
|
|
869 |
}
|
|
870 |
|
|
871 |
else if (aObject.MatchF(_L8("Infrastructure")) != KErrNotFound)
|
|
872 |
{
|
|
873 |
iSettings->ConnectionMode = EInfrastructure;
|
|
874 |
}
|
|
875 |
else
|
|
876 |
{
|
|
877 |
iCallBack->SetStatusL(aStatusRef,
|
|
878 |
CSmlDmAdapter::EInvalidObject);
|
|
879 |
return;
|
|
880 |
}
|
|
881 |
}
|
|
882 |
|
|
883 |
else if (lastUriSeg.Compare(KNSmlWLanSecurityMode) == 0)
|
|
884 |
{
|
|
885 |
if (aObject.MatchF(_L8("NONE")) != KErrNotFound)
|
|
886 |
{
|
|
887 |
iSettings->SecurityMode = EAllowUnsecure;
|
|
888 |
}
|
|
889 |
else if (aObject.MatchF(_L8("WEP")) != KErrNotFound)
|
|
890 |
{
|
|
891 |
iSettings->SecurityMode = EWep;
|
|
892 |
}
|
|
893 |
else if (aObject.MatchF(_L8("8021X")) != KErrNotFound)
|
|
894 |
{
|
|
895 |
iSettings->SecurityMode = EWlan8021x;
|
|
896 |
}
|
|
897 |
else if (aObject.MatchF(_L8("WPA")) != KErrNotFound)
|
|
898 |
{
|
|
899 |
iSettings->SecurityMode = EWpa;
|
|
900 |
}
|
|
901 |
else if (aObject.MatchF(_L8("WPA2")) != KErrNotFound)
|
|
902 |
{
|
|
903 |
iSettings->SecurityMode = EWpa2;
|
|
904 |
}
|
|
905 |
else
|
|
906 |
{
|
|
907 |
iCallBack->SetStatusL(aStatusRef,
|
|
908 |
CSmlDmAdapter::EInvalidObject);
|
|
909 |
return;
|
|
910 |
}
|
|
911 |
}
|
|
912 |
|
|
913 |
else if (lastUriSeg.Compare(KNSmlWLanUseWPAPSK) == 0)
|
|
914 |
{
|
|
915 |
if (aObject.MatchF(_L8("True")) != KErrNotFound)
|
|
916 |
{
|
|
917 |
iSettings->UseWPAPSK = 1;
|
|
918 |
}
|
|
919 |
else
|
|
920 |
{
|
|
921 |
iSettings->UseWPAPSK = 0;
|
|
922 |
}
|
|
923 |
}
|
|
924 |
|
|
925 |
else if (lastUriSeg.Compare(KNSmlWLanWpaPreSharedKey) == 0)
|
|
926 |
{
|
|
927 |
if (aObject.Length() > KMaxPSKLength)
|
|
928 |
{
|
|
929 |
iCallBack->SetStatusL(aStatusRef,
|
|
930 |
CSmlDmAdapter::ETooLargeObject);
|
|
931 |
return;
|
|
932 |
}
|
|
933 |
/*else if(aObject.Length() < KMinPSKLength)
|
|
934 |
{
|
|
935 |
iCallBack->SetStatusL( aStatusRef, CSmlDmAdapter::EInvalidObject );
|
|
936 |
return;
|
|
937 |
}*/
|
|
938 |
else
|
|
939 |
{
|
|
940 |
iSettings->WPAPreSharedKey = aObject;
|
|
941 |
}
|
|
942 |
}
|
|
943 |
|
|
944 |
else if (lastUriSeg.Compare(KNSmlWLanEapList) == 0)
|
|
945 |
{
|
|
946 |
TInt returnValue = CnvUtfConverter::ConvertToUnicodeFromUtf8(
|
|
947 |
iSettings->EapList, aObject);
|
|
948 |
DBG_ARGS(_S16("WLanAdapter::EapList convert: <%D>"), returnValue);
|
|
949 |
}
|
|
950 |
|
|
951 |
else if (lastUriSeg.Compare(KNSmlWLanAuthMode) == 0)
|
|
952 |
{
|
|
953 |
if (aObject.MatchF(_L8("1")) != KErrNotFound)
|
|
954 |
{
|
|
955 |
iSettings->AuthMode = EShared;
|
|
956 |
}
|
|
957 |
else
|
|
958 |
{
|
|
959 |
iSettings->AuthMode = EOpen;
|
|
960 |
}
|
|
961 |
}
|
|
962 |
|
|
963 |
else if (lastUriSeg.Compare(KNSmlWLanWepIndex) == 0)
|
|
964 |
{
|
|
965 |
TInt32 actualIndex = DesToInt(aObject);
|
|
966 |
if (actualIndex < 4 && actualIndex >= 0)
|
|
967 |
{
|
|
968 |
iSettings->WepIndex = actualIndex;
|
|
969 |
}
|
|
970 |
else
|
|
971 |
{
|
|
972 |
if (actualIndex > 3)
|
|
973 |
{
|
|
974 |
iCallBack->SetStatusL(aStatusRef,
|
|
975 |
CSmlDmAdapter::ETooLargeObject);
|
|
976 |
}
|
|
977 |
else
|
|
978 |
{
|
|
979 |
iCallBack->SetStatusL(aStatusRef, CSmlDmAdapter::EError);
|
|
980 |
}
|
|
981 |
return;
|
|
982 |
}
|
|
983 |
}
|
|
984 |
|
|
985 |
else
|
|
986 |
{
|
|
987 |
iCallBack->SetStatusL(aStatusRef, CSmlDmAdapter::ENotFound);
|
|
988 |
return;
|
|
989 |
}
|
|
990 |
}
|
|
991 |
|
|
992 |
else if (aURI.Match(_L8("AP/*/NAPDef/*/WLAN/*/SecondarySSID/*/*"))
|
|
993 |
!= KErrNotFound && uriSegs == 9)
|
|
994 |
{
|
|
995 |
TSecondarySSID ssid;
|
|
996 |
ssid.Id = 0;
|
|
997 |
TUint32 id = GetSecSSIDFromUriL(aURI);
|
|
998 |
RArray<TSecondarySSID> secondaryList;
|
|
999 |
CleanupClosePushL(secondaryList);
|
|
1000 |
iWlanSettings->GetSecondarySSIDListL(luid, secondaryList);
|
|
1001 |
TInt count = secondaryList.Count();
|
|
1002 |
for (TInt i = 0; i < count; i++)
|
|
1003 |
{
|
|
1004 |
if (id == secondaryList[i].Id)
|
|
1005 |
{
|
|
1006 |
ssid = secondaryList[i];
|
|
1007 |
break;
|
|
1008 |
}
|
|
1009 |
}
|
|
1010 |
CleanupStack::PopAndDestroy(&secondaryList);
|
|
1011 |
if (ssid.Id == 0)
|
|
1012 |
{
|
|
1013 |
|
|
1014 |
_DBG_FILE("CNSmlWLanAdapter::Coming to check buffer ");
|
|
1015 |
|
|
1016 |
//Check if its buffered here - Divya
|
|
1017 |
TInt index = -1;
|
|
1018 |
|
|
1019 |
for (TInt i = 0; i < iSecondaryBuffer.Count(); i++)
|
|
1020 |
{
|
|
1021 |
if (aURI.Find(iSecondaryBuffer[i]->iUri->Des())
|
|
1022 |
!= KErrNotFound)
|
|
1023 |
{
|
|
1024 |
index = i;
|
|
1025 |
_DBG_FILE("CNSmlWLanAdapter::one indexis matched :-)");
|
|
1026 |
break;
|
|
1027 |
}
|
|
1028 |
}
|
|
1029 |
if (index < 0)
|
|
1030 |
{
|
|
1031 |
_DBG_FILE("CNSmlWLanAdapter::one indexis matched :-)");
|
|
1032 |
iCallBack->SetStatusL(aStatusRef, CSmlDmAdapter::ENotFound);
|
|
1033 |
return;
|
|
1034 |
}
|
|
1035 |
else
|
|
1036 |
{
|
|
1037 |
DBG_ARGS8(
|
|
1038 |
_S8(
|
|
1039 |
"CWlanadaptes::Execute Buffer - copying in buffer instead of giving 404 uri: object id : <%S>"),
|
|
1040 |
&aObject);
|
|
1041 |
|
|
1042 |
if (lastUriSeg.Compare(KNSmlWLanSsid) == 0)
|
|
1043 |
{
|
|
1044 |
if (aObject.Length() <= KMaxTextLength)
|
|
1045 |
{
|
|
1046 |
iSecondaryBuffer[index]->ScannedId.Copy(aObject);
|
|
1047 |
}
|
|
1048 |
else
|
|
1049 |
{
|
|
1050 |
_DBG_FILE(
|
|
1051 |
"CNSmlWLanAdapter::AddLeafObject - SecondarySSID too long");
|
|
1052 |
iCallBack->SetStatusL(aStatusRef,
|
|
1053 |
CSmlDmAdapter::EError);
|
|
1054 |
return;
|
|
1055 |
}
|
|
1056 |
|
|
1057 |
}
|
|
1058 |
else if (lastUriSeg.Compare(KNSmlWLanUsedSsid) == 0)
|
|
1059 |
{
|
|
1060 |
iSecondaryBuffer[index]->UsedId.Copy(aObject);
|
|
1061 |
}
|
|
1062 |
|
|
1063 |
}
|
|
1064 |
|
|
1065 |
}
|
|
1066 |
|
|
1067 |
else
|
|
1068 |
{
|
|
1069 |
|
|
1070 |
if (lastUriSeg.Compare(KNSmlWLanSsid) == 0)
|
|
1071 |
{
|
|
1072 |
ssid.ScannedId.Copy(aObject);
|
|
1073 |
}
|
|
1074 |
else if (lastUriSeg.Compare(KNSmlWLanUsedSsid) == 0)
|
|
1075 |
{
|
|
1076 |
ssid.UsedId.Copy(aObject);
|
|
1077 |
}
|
|
1078 |
TInt retval = iWlanSettings->WriteSecondarySSIDL(luid, ssid,
|
|
1079 |
EFalse);
|
|
1080 |
if (retval == KErrNone)
|
|
1081 |
{
|
|
1082 |
iCallBack->SetStatusL(aStatusRef, CSmlDmAdapter::EOk);
|
|
1083 |
}
|
|
1084 |
else
|
|
1085 |
{
|
|
1086 |
iCallBack->SetStatusL(aStatusRef, CSmlDmAdapter::EError);
|
|
1087 |
}
|
|
1088 |
}
|
|
1089 |
}
|
|
1090 |
else if (aURI.Match(_L8("AP/*/NAPDef/*/WLAN/*/EAP/*/*")) != KErrNotFound
|
|
1091 |
&& uriSegs == 9)
|
|
1092 |
{
|
|
1093 |
DBG_ARGS8(_S8("CNSmlWLanAdapter::AddLeafObjectL - EAP index: <%d>"),
|
|
1094 |
eapIndex);
|
|
1095 |
|
|
1096 |
if (lastUriSeg.Compare(KNSmlWLanEapType) == 0)
|
|
1097 |
{
|
|
1098 |
TInt eapid = GetEAPIdFromUri(aURI);
|
|
1099 |
// append it to the appropriate list ('+' enabled, '-' disabled)
|
|
1100 |
_LIT8(KPadding, "\xFE\0\0\0\0\0\0");
|
|
1101 |
_LIT8(KMsChapV2Padding, "\xFE\xFF\xFF\xFF\0\0\0");
|
|
1102 |
const TInt KPlainMsChapV2ImplUid = 99;
|
|
1103 |
TBuf8<KExpandedEapIdLength> tempbuf;
|
|
1104 |
if (eapid == KPlainMsChapV2ImplUid)
|
|
1105 |
{
|
|
1106 |
tempbuf.Append(KMsChapV2Padding);
|
|
1107 |
}
|
|
1108 |
else
|
|
1109 |
{
|
|
1110 |
tempbuf.Append(KPadding);
|
|
1111 |
}
|
|
1112 |
tempbuf.Append(eapid);
|
|
1113 |
// Get EAP ID from URI instead of the value because the server gives the value
|
|
1114 |
// incorrectly as the textual representation of the EAP method instead of the IANA number.
|
|
1115 |
iEAPBuffer[eapIndex]->iEAPSettings->iEAPExpandedType = tempbuf;
|
|
1116 |
}
|
|
1117 |
else if (lastUriSeg.Compare(KNSmlWLanUsername) == 0)
|
|
1118 |
{
|
|
1119 |
TInt retval = CnvUtfConverter::ConvertToUnicodeFromUtf8(
|
|
1120 |
iEAPBuffer[eapIndex]->iEAPSettings->iUsername, aObject);
|
|
1121 |
if (retval == KErrNone)
|
|
1122 |
{
|
|
1123 |
iEAPBuffer[eapIndex]->iEAPSettings->iUsernamePresent = ETrue;
|
|
1124 |
}
|
|
1125 |
else
|
|
1126 |
{
|
|
1127 |
iEAPBuffer[eapIndex]->iEAPSettings->iUsername.Zero();
|
|
1128 |
DBG_ARGS(
|
|
1129 |
_S16(
|
|
1130 |
"CNSmlWLanAdapter::AddLeafObjectL EAP username - ErrorCode <%D>"),
|
|
1131 |
retval);
|
|
1132 |
iCallBack->SetStatusL(aStatusRef, CSmlDmAdapter::EError);
|
|
1133 |
return;
|
|
1134 |
}
|
|
1135 |
|
|
1136 |
}
|
|
1137 |
else if (lastUriSeg.Compare(KNSmlWLanPassword) == 0)
|
|
1138 |
{
|
|
1139 |
TInt retval = CnvUtfConverter::ConvertToUnicodeFromUtf8(
|
|
1140 |
iEAPBuffer[eapIndex]->iEAPSettings->iPassword, aObject);
|
|
1141 |
if (retval == KErrNone)
|
|
1142 |
{
|
|
1143 |
iEAPBuffer[eapIndex]->iEAPSettings->iPasswordPresent = ETrue;
|
|
1144 |
}
|
|
1145 |
else
|
|
1146 |
{
|
|
1147 |
iEAPBuffer[eapIndex]->iEAPSettings->iPassword.Zero();
|
|
1148 |
DBG_ARGS(
|
|
1149 |
_S16(
|
|
1150 |
"CNSmlWLanAdapter::AddLeafObjectL EAP password - ErrorCode <%D>"),
|
|
1151 |
retval);
|
|
1152 |
iCallBack->SetStatusL(aStatusRef, CSmlDmAdapter::EError);
|
|
1153 |
return;
|
|
1154 |
}
|
|
1155 |
}
|
|
1156 |
else if (lastUriSeg.Compare(KNSmlWLanRealm) == 0)
|
|
1157 |
{
|
|
1158 |
TInt retval = CnvUtfConverter::ConvertToUnicodeFromUtf8(
|
|
1159 |
iEAPBuffer[eapIndex]->iEAPSettings->iRealm, aObject);
|
|
1160 |
if (retval == KErrNone)
|
|
1161 |
iEAPBuffer[eapIndex]->iEAPSettings->iRealmPresent = ETrue;
|
|
1162 |
|
|
1163 |
}
|
|
1164 |
else if (lastUriSeg.Compare(KNSmlWLanUsePseudonym) == 0)
|
|
1165 |
{
|
|
1166 |
if ((aObject == KTrue) || (aObject == KTtrue))
|
|
1167 |
iEAPBuffer[eapIndex]->iEAPSettings->iUsePseudonyms = ETrue;
|
|
1168 |
else
|
|
1169 |
iEAPBuffer[eapIndex]->iEAPSettings->iUsePseudonyms = EFalse;
|
|
1170 |
|
|
1171 |
iEAPBuffer[eapIndex]->iEAPSettings->iUsePseudonymsPresent = ETrue;
|
|
1172 |
}
|
|
1173 |
else if (lastUriSeg.Compare(KNSmlWLanEncapsulation) == 0)
|
|
1174 |
{
|
|
1175 |
TBuf8<KExpandedEAPIdLength> dummy;
|
|
1176 |
//ConvertEAPStringToIds( aObject, dummy, iEAPBuffer[eapIndex]->iEncapsulatingExpandedEapId );
|
|
1177 |
}
|
|
1178 |
else if (lastUriSeg.Compare(KNSmlWLanVerifyCertRealm) == 0)
|
|
1179 |
{
|
|
1180 |
if ((aObject == KTrue) || (aObject == KTtrue))
|
|
1181 |
iEAPBuffer[eapIndex]->iEAPSettings->iVerifyServerRealm
|
|
1182 |
= ETrue;
|
|
1183 |
else
|
|
1184 |
iEAPBuffer[eapIndex]->iEAPSettings->iVerifyServerRealm
|
|
1185 |
= EFalse;
|
|
1186 |
|
|
1187 |
iEAPBuffer[eapIndex]->iEAPSettings->iVerifyServerRealmPresent
|
|
1188 |
= ETrue;
|
|
1189 |
|
|
1190 |
}
|
|
1191 |
else if (lastUriSeg.Compare(KNSmlWLanRequireClientAuthentication)
|
|
1192 |
== 0)
|
|
1193 |
{
|
|
1194 |
if ((aObject == KTrue) || (aObject == KTtrue))
|
|
1195 |
iEAPBuffer[eapIndex]->iEAPSettings->iRequireClientAuthentication
|
|
1196 |
= ETrue;
|
|
1197 |
else
|
|
1198 |
iEAPBuffer[eapIndex]->iEAPSettings->iRequireClientAuthentication
|
|
1199 |
= EFalse;
|
|
1200 |
|
|
1201 |
iEAPBuffer[eapIndex]->iEAPSettings->iRequireClientAuthenticationPresent
|
|
1202 |
= ETrue;
|
|
1203 |
|
|
1204 |
}
|
|
1205 |
else if (lastUriSeg.Compare(KNSmlWLanSessionValidityTime) == 0)
|
|
1206 |
{
|
|
1207 |
TLex8 lex(aObject);
|
|
1208 |
TUint newVal;
|
|
1209 |
TInt sesValErr = lex.Val(newVal);
|
|
1210 |
// Check whether the conversion went ok
|
|
1211 |
if (sesValErr == KErrNone)
|
|
1212 |
{
|
|
1213 |
iEAPBuffer[eapIndex]->iEAPSettings->iSessionValidityTime
|
|
1214 |
= newVal;
|
|
1215 |
iEAPBuffer[eapIndex]->iEAPSettings->iSessionValidityTimePresent
|
|
1216 |
= ETrue;
|
|
1217 |
}
|
|
1218 |
else
|
|
1219 |
{
|
|
1220 |
// there were errors, let's leave the function and update status
|
|
1221 |
DBG_ARGS(
|
|
1222 |
_S16(
|
|
1223 |
"CNSmlWLanAdapter::AddLeafObjectL SessionValidityTime - ErrorCode <%D>"),
|
|
1224 |
sesValErr);
|
|
1225 |
iCallBack->SetStatusL(aStatusRef,
|
|
1226 |
CSmlDmAdapter::EInvalidObject);
|
|
1227 |
return;
|
|
1228 |
}
|
|
1229 |
}
|
|
1230 |
else if (lastUriSeg.Compare(KNSmlWLanCipherSuite) == 0)
|
|
1231 |
{
|
|
1232 |
FillCipherSuitesL(aObject, eapIndex);
|
|
1233 |
}
|
|
1234 |
else if (lastUriSeg.Compare(KNSmlWLanAllowPEAPv0) == 0)
|
|
1235 |
{
|
|
1236 |
if ((aObject == KTrue) || (aObject == KTtrue))
|
|
1237 |
iEAPBuffer[eapIndex]->iEAPSettings->iPEAPv0Allowed = ETrue;
|
|
1238 |
else
|
|
1239 |
iEAPBuffer[eapIndex]->iEAPSettings->iPEAPv0Allowed = EFalse;
|
|
1240 |
|
|
1241 |
iEAPBuffer[eapIndex]->iEAPSettings->iPEAPVersionsPresent = ETrue;
|
|
1242 |
}
|
|
1243 |
else if (lastUriSeg.Compare(KNSmlWLanAllowPEAPv1) == 0)
|
|
1244 |
{
|
|
1245 |
if ((aObject == KTrue) || (aObject == KTtrue))
|
|
1246 |
iEAPBuffer[eapIndex]->iEAPSettings->iPEAPv1Allowed = ETrue;
|
|
1247 |
else
|
|
1248 |
iEAPBuffer[eapIndex]->iEAPSettings->iPEAPv1Allowed = EFalse;
|
|
1249 |
|
|
1250 |
iEAPBuffer[eapIndex]->iEAPSettings->iPEAPVersionsPresent = ETrue;
|
|
1251 |
|
|
1252 |
}
|
|
1253 |
else if (lastUriSeg.Compare(KNSmlWLanAllowPEAPv2) == 0)
|
|
1254 |
{
|
|
1255 |
if ((aObject == KTrue) || (aObject == KTtrue))
|
|
1256 |
iEAPBuffer[eapIndex]->iEAPSettings->iPEAPv2Allowed = ETrue;
|
|
1257 |
else
|
|
1258 |
iEAPBuffer[eapIndex]->iEAPSettings->iPEAPv2Allowed = EFalse;
|
|
1259 |
|
|
1260 |
iEAPBuffer[eapIndex]->iEAPSettings->iPEAPVersionsPresent = ETrue;
|
|
1261 |
}
|
|
1262 |
|
|
1263 |
#ifdef FF_WLAN_EXTENSIONS
|
|
1264 |
else if (lastUriSeg.Compare(KNSmlWLanAuthProvMode) == 0)
|
|
1265 |
{
|
|
1266 |
if ( (aObject == KTrue) || (aObject == KTtrue) )
|
|
1267 |
iEAPBuffer[eapIndex]->iEAPSettings->iAuthProvModeAllowed = ETrue;
|
|
1268 |
else
|
|
1269 |
iEAPBuffer[eapIndex]->iEAPSettings->iAuthProvModeAllowed = EFalse;
|
|
1270 |
|
|
1271 |
iEAPBuffer[eapIndex]->iEAPSettings->iAuthProvModeAllowedPresent = ETrue;
|
|
1272 |
}
|
|
1273 |
|
|
1274 |
else if (lastUriSeg.Compare(KNSmlWLanUnauthProvMode) == 0)
|
|
1275 |
{
|
|
1276 |
if ( (aObject == KTrue) || (aObject == KTtrue) )
|
|
1277 |
iEAPBuffer[eapIndex]->iEAPSettings->iUnauthProvModeAllowed = ETrue;
|
|
1278 |
else
|
|
1279 |
iEAPBuffer[eapIndex]->iEAPSettings->iUnauthProvModeAllowed = EFalse;
|
|
1280 |
|
|
1281 |
iEAPBuffer[eapIndex]->iEAPSettings->iUnauthProvModeAllowedPresent = ETrue;
|
|
1282 |
}
|
|
1283 |
|
|
1284 |
else if (lastUriSeg.Compare(KNSmlWLanPACGroupRef) == 0)
|
|
1285 |
{
|
|
1286 |
TInt retval = CnvUtfConverter::ConvertToUnicodeFromUtf8( iEAPBuffer[eapIndex]->iEAPSettings->iPACGroupReference, aObject );
|
|
1287 |
if (retval == KErrNone)
|
|
1288 |
iEAPBuffer[eapIndex]->iEAPSettings->iPACGroupReferencePresent = ETrue;
|
|
1289 |
|
|
1290 |
}
|
|
1291 |
|
|
1292 |
else if (lastUriSeg.Compare(KNSmlWLanWarnADHPNoPAC) == 0)
|
|
1293 |
{
|
|
1294 |
if ( (aObject == KTrue) || (aObject == KTtrue) )
|
|
1295 |
iEAPBuffer[eapIndex]->iEAPSettings->iWarnADHPNoPAC = ETrue;
|
|
1296 |
else
|
|
1297 |
iEAPBuffer[eapIndex]->iEAPSettings->iWarnADHPNoPAC = EFalse;
|
|
1298 |
|
|
1299 |
iEAPBuffer[eapIndex]->iEAPSettings->iWarnADHPNoPACPresent = ETrue;
|
|
1300 |
}
|
|
1301 |
|
|
1302 |
else if (lastUriSeg.Compare(KNSmlWLanWarnADHPNoMatchPAC) == 0)
|
|
1303 |
{
|
|
1304 |
if ( (aObject == KTrue) || (aObject == KTtrue) )
|
|
1305 |
iEAPBuffer[eapIndex]->iEAPSettings->iWarnADHPNoMatchingPAC = ETrue;
|
|
1306 |
else
|
|
1307 |
iEAPBuffer[eapIndex]->iEAPSettings->iWarnADHPNoMatchingPAC = EFalse;
|
|
1308 |
|
|
1309 |
iEAPBuffer[eapIndex]->iEAPSettings->iWarnADHPNoMatchingPACPresent = ETrue;
|
|
1310 |
}
|
|
1311 |
|
|
1312 |
else if (lastUriSeg.Compare(KNSmlWLanWarnNotDefaultSrv) == 0)
|
|
1313 |
{
|
|
1314 |
if ( (aObject == KTrue) || (aObject == KTtrue) )
|
|
1315 |
iEAPBuffer[eapIndex]->iEAPSettings->iWarnNotDefaultServer = ETrue;
|
|
1316 |
else
|
|
1317 |
iEAPBuffer[eapIndex]->iEAPSettings->iWarnNotDefaultServer = EFalse;
|
|
1318 |
|
|
1319 |
iEAPBuffer[eapIndex]->iEAPSettings->iWarnNotDefaultServerPresent = ETrue;
|
|
1320 |
}
|
|
1321 |
|
|
1322 |
#endif
|
|
1323 |
|
|
1324 |
// Save the status reference
|
|
1325 |
iEAPBuffer[eapIndex]->iStatusRefArray.AppendL(aStatusRef);
|
|
1326 |
return;
|
|
1327 |
}
|
|
1328 |
else if (aURI.Match(_L8("AP/*/NAPDef/*/WLAN/*/EAP/*/Certificate/*/*"))
|
|
1329 |
!= KErrNotFound && uriSegs == 11)
|
|
1330 |
{
|
|
1331 |
TPtrC8 ptr = NSmlDmURI::ParentURI(aURI);
|
|
1332 |
|
|
1333 |
TBuf<KGeneralStringMaxLength> certBuffer;
|
|
1334 |
|
|
1335 |
// Get the LUID from ptr2
|
|
1336 |
HBufC8* certLuid = iCallBack->GetLuidAllocL(ptr);
|
|
1337 |
|
|
1338 |
TInt certIndex = GetIdFromLuid(*certLuid);
|
|
1339 |
|
|
1340 |
delete certLuid;
|
|
1341 |
|
|
1342 |
DBG_ARGS8(
|
|
1343 |
_S8(
|
|
1344 |
"CNSmlWLanAdapter::AddLeafObjectL - cert index: <%d>, cert count: <%d>"),
|
|
1345 |
certIndex,
|
|
1346 |
iEAPBuffer[eapIndex]->iEAPSettings->iCertificates.Count());
|
|
1347 |
|
|
1348 |
if (iEAPBuffer[eapIndex]->iEAPSettings->iCertificates.Count() - 1
|
|
1349 |
< certIndex)
|
|
1350 |
{
|
|
1351 |
_DBG_FILE(
|
|
1352 |
"CNSmlWLanAdapter::AddLeafObject - Certificate buffer does not exist. Create it.");
|
|
1353 |
// The certificate buffer does not exist. Create a new one
|
|
1354 |
EapCertificateEntry *entry = new (ELeave) EapCertificateEntry;
|
62
|
1355 |
TRAPD(err, iEAPBuffer[eapIndex]->iEAPSettings->iCertificates.AppendL(entry));
|
|
1356 |
if(err != KErrNone)
|
|
1357 |
{
|
|
1358 |
delete entry;
|
|
1359 |
DBG_ARGS(_S16(
|
|
1360 |
"CNSmlWLanAdapter::AddLeafObjectL - ErrorCode <%D>"),
|
|
1361 |
err);
|
|
1362 |
iCallBack->SetStatusL(aStatusRef, CSmlDmAdapter::EError);
|
|
1363 |
return;
|
|
1364 |
}
|
47
|
1365 |
iEAPBuffer[eapIndex]->iEAPSettings->iCertificatesPresent = ETrue;
|
|
1366 |
|
|
1367 |
certIndex
|
|
1368 |
= iEAPBuffer[eapIndex]->iEAPSettings->iCertificates.Count()
|
|
1369 |
- 1;
|
|
1370 |
|
|
1371 |
TBuf8<2> newLuid;
|
|
1372 |
newLuid.Num(certIndex);
|
|
1373 |
|
|
1374 |
DBG_ARGS8(
|
|
1375 |
_S8(
|
|
1376 |
"WLanAdapter::AddLeafObjectL - mapping uri: <%S> to luid: <%S>"),
|
|
1377 |
&aURI, &newLuid);
|
|
1378 |
iCallBack->SetMappingL(aURI, newLuid);
|
|
1379 |
}
|
|
1380 |
|
|
1381 |
if (lastUriSeg.Compare(KNSmlWLanIssuerName) == 0)
|
|
1382 |
{
|
|
1383 |
TInt retval = CnvUtfConverter::ConvertToUnicodeFromUtf8(
|
|
1384 |
certBuffer, aObject);
|
|
1385 |
iEAPBuffer[eapIndex]->iEAPSettings->iCertificates[certIndex]->SetIssuerName(
|
|
1386 |
certBuffer);
|
|
1387 |
if (retval == KErrNone)
|
|
1388 |
iEAPBuffer[eapIndex]->iEAPSettings->iCertificates[certIndex]->SetIssuerNamePresent();
|
|
1389 |
}
|
|
1390 |
else if (lastUriSeg.Compare(KNSmlWLanSubjectName) == 0)
|
|
1391 |
{
|
|
1392 |
certBuffer.FillZ();
|
|
1393 |
TInt retval = CnvUtfConverter::ConvertToUnicodeFromUtf8(
|
|
1394 |
certBuffer, aObject);
|
|
1395 |
iEAPBuffer[eapIndex]->iEAPSettings->iCertificates[certIndex]->SetSubjectName(
|
|
1396 |
certBuffer);
|
|
1397 |
|
|
1398 |
if (retval == KErrNone)
|
|
1399 |
iEAPBuffer[eapIndex]->iEAPSettings->iCertificates[certIndex]->SetSubjectNamePresent();
|
|
1400 |
}
|
|
1401 |
else if (lastUriSeg.Compare(KNSmlWLanCertType) == 0)
|
|
1402 |
{
|
|
1403 |
iEAPBuffer[eapIndex]->iEAPSettings->iCertificates[certIndex]->SetCertType(
|
|
1404 |
(EapCertificateEntry::TCertType) DesToInt(aObject));
|
|
1405 |
}
|
|
1406 |
else if (lastUriSeg.Compare(KNSmlWLanSerialNumber) == 0)
|
|
1407 |
{
|
|
1408 |
certBuffer.FillZ();
|
|
1409 |
TInt retval = CnvUtfConverter::ConvertToUnicodeFromUtf8(
|
|
1410 |
certBuffer, aObject);
|
|
1411 |
iEAPBuffer[eapIndex]->iEAPSettings->iCertificates[certIndex]->SetSerialNumber(
|
|
1412 |
certBuffer);
|
|
1413 |
if (retval == KErrNone)
|
|
1414 |
iEAPBuffer[eapIndex]->iEAPSettings->iCertificates[certIndex]->SetSerialNumberPresent();
|
|
1415 |
|
|
1416 |
}
|
|
1417 |
else if (lastUriSeg.Compare(KNSmlWLanSubjectKeyId) == 0)
|
|
1418 |
{
|
|
1419 |
|
|
1420 |
// Define literals to search the subject key for possible 0X/0x beginning
|
|
1421 |
_LIT(KHexIdLC, "0x");
|
|
1422 |
_LIT(KHexIdUC, "0X");
|
|
1423 |
TBuf<2> hexIdBuf;
|
|
1424 |
// The lenght of the key given as input
|
|
1425 |
TInt keyLen = aObject.Length();
|
|
1426 |
|
|
1427 |
// setting the given key to the key buffer
|
|
1428 |
TBuf8<KNsmlSubjectKeyIdLength> origKey = aObject;
|
|
1429 |
origKey.SetLength(keyLen);
|
|
1430 |
TBuf8<KIdentifierLength> key;
|
|
1431 |
TLex8 tmpByte;
|
|
1432 |
TUint16 byte;
|
|
1433 |
|
|
1434 |
// Remove possible spaces from the beginning
|
|
1435 |
origKey.TrimLeft();
|
|
1436 |
|
|
1437 |
// the key should be atleast two chars long
|
|
1438 |
if (origKey.Length() >= 2)
|
|
1439 |
{
|
|
1440 |
// Copy the two left most characters in to the buffer
|
|
1441 |
hexIdBuf.Copy(origKey.Left(2));
|
|
1442 |
|
|
1443 |
// If the first characters are 0x or 0X, then thet should be ignored
|
|
1444 |
if (hexIdBuf.Compare(KHexIdLC) == 0 || hexIdBuf.Compare(
|
|
1445 |
KHexIdUC) == 0)
|
|
1446 |
{
|
|
1447 |
// delete two characters
|
|
1448 |
origKey.Delete(0, 2);
|
|
1449 |
}
|
|
1450 |
}
|
|
1451 |
|
|
1452 |
// looping the subject key through, removing whitespaces
|
|
1453 |
for (TInt i = 0; i < keyLen; i++)
|
|
1454 |
{
|
|
1455 |
// removing white spaces from the left side of the key
|
|
1456 |
origKey.TrimLeft();
|
|
1457 |
// check that there are characters left
|
|
1458 |
if (origKey.Length() >= 2)
|
|
1459 |
{
|
|
1460 |
// pick the two left most bytes from the key
|
|
1461 |
tmpByte = origKey.Left(2);
|
|
1462 |
// convert byte into binary format
|
|
1463 |
err = tmpByte.Val(byte, EHex);
|
|
1464 |
|
|
1465 |
// check whether conversion to decimal went ok
|
|
1466 |
if (err != KErrNone)
|
|
1467 |
{
|
|
1468 |
// if there are problems, then leave the loop
|
|
1469 |
break;
|
|
1470 |
}
|
|
1471 |
|
|
1472 |
// store the appended byte into the key variable
|
|
1473 |
key.Append(byte);
|
|
1474 |
// delete two characters from the left side of the character array in the buffer
|
|
1475 |
origKey.Delete(0, 2);
|
|
1476 |
}
|
|
1477 |
else if (origKey.Length() == 1)
|
|
1478 |
{
|
|
1479 |
// pick the left most byte from the key
|
|
1480 |
tmpByte = origKey.Left(1);
|
|
1481 |
// convert byte into binary format
|
|
1482 |
err = tmpByte.Val(byte, EHex);
|
|
1483 |
|
|
1484 |
// check whether conversion to decimal went ok
|
|
1485 |
if (err != KErrNone)
|
|
1486 |
{
|
|
1487 |
// if there are problems, then leave the loop
|
|
1488 |
break;
|
|
1489 |
}
|
|
1490 |
|
|
1491 |
// store the appended byte into the key variable
|
|
1492 |
key.Append(byte);
|
|
1493 |
// delete two characters from the left side of the character array in the buffer
|
|
1494 |
origKey.Delete(0, 1);
|
|
1495 |
}
|
|
1496 |
else
|
|
1497 |
{
|
|
1498 |
// leave the loop, no characters are left
|
|
1499 |
break;
|
|
1500 |
}
|
|
1501 |
}
|
|
1502 |
// store key value only if no errors occurred
|
|
1503 |
if (err == KErrNone)
|
|
1504 |
{
|
|
1505 |
iEAPBuffer[eapIndex]->iEAPSettings->iCertificates[certIndex]->SetSubjectKeyId(
|
|
1506 |
key);
|
|
1507 |
iEAPBuffer[eapIndex]->iEAPSettings->iCertificates[certIndex]->SetSubjectKeyIdPresent();
|
|
1508 |
}
|
|
1509 |
else
|
|
1510 |
{
|
|
1511 |
// there were errors, let's leave the function and update status
|
|
1512 |
DBG_ARGS(_S16(
|
|
1513 |
"CNSmlWLanAdapter::AddLeafObjectL - ErrorCode <%D>"),
|
|
1514 |
err);
|
|
1515 |
iCallBack->SetStatusL(aStatusRef, CSmlDmAdapter::EError);
|
|
1516 |
return;
|
|
1517 |
}
|
|
1518 |
}
|
|
1519 |
else if (lastUriSeg.Compare(KNSmlWLanFingerprint) == 0)
|
|
1520 |
{
|
|
1521 |
certBuffer.FillZ();
|
|
1522 |
TInt retval = CnvUtfConverter::ConvertToUnicodeFromUtf8(
|
|
1523 |
certBuffer, aObject);
|
|
1524 |
iEAPBuffer[eapIndex]->iEAPSettings->iCertificates[certIndex]->SetThumbprint(
|
|
1525 |
certBuffer);
|
|
1526 |
if (retval == KErrNone)
|
|
1527 |
iEAPBuffer[eapIndex]->iEAPSettings->iCertificates[certIndex]->SetThumbprintPresent();
|
|
1528 |
}
|
|
1529 |
// Save the status reference
|
|
1530 |
iEAPBuffer[eapIndex]->iStatusRefArray.AppendL(aStatusRef);
|
|
1531 |
|
|
1532 |
return;
|
|
1533 |
}
|
|
1534 |
|
|
1535 |
if (eapId == KErrNotFound)
|
|
1536 |
{
|
|
1537 |
err = iWlanSettings->WriteWlanSettings(*iSettings);
|
|
1538 |
}
|
|
1539 |
|
|
1540 |
if (err != KErrNone)
|
|
1541 |
{
|
|
1542 |
DBG_ARGS(_S16("CNSmlWLanAdapter::AddLeafObjectL - ErrorCode <%D>"),
|
|
1543 |
err);
|
|
1544 |
iCallBack->SetStatusL(aStatusRef, CSmlDmAdapter::EError);
|
|
1545 |
return;
|
|
1546 |
}
|
|
1547 |
|
|
1548 |
iCallBack->SetStatusL(aStatusRef, CSmlDmAdapter::EOk);
|
|
1549 |
|
|
1550 |
_DBG_FILE("CNSmlWLanAdapter::AddLeafObjectL(): end");
|
|
1551 |
}
|
|
1552 |
|
|
1553 |
//-----------------------------------------------------------------------------
|
|
1554 |
// CNSmlWLanAdapter* CNSmlWLanAdapter::UpdateLeafObjectL( const TDesC& aURI,
|
|
1555 |
// const TDesC& aLUID, const TDesC8& aObject, const TDesC& aType,
|
|
1556 |
// const TInt aStatusRef )
|
|
1557 |
//-----------------------------------------------------------------------------
|
|
1558 |
void CNSmlWLanAdapter::UpdateLeafObjectL(const TDesC8& aURI,
|
|
1559 |
const TDesC8& aLUID, const TDesC8& aObject, const TDesC8& aType,
|
|
1560 |
const TInt aStatusRef)
|
|
1561 |
{
|
|
1562 |
_DBG_FILE("CNSmlWLanAdapter::UpdateLeafObjectL(): begin");
|
|
1563 |
DBG_ARGS8(_S8("WLanAdapter::UpdateLeafObjectL - <%S> <%S> <%S>"), &aURI,
|
|
1564 |
&aLUID, &aObject);
|
|
1565 |
|
|
1566 |
AddLeafObjectL(aURI, aLUID, aObject, aType, aStatusRef);
|
|
1567 |
|
|
1568 |
_DBG_FILE("CNSmlWLanAdapter::UpdateLeafObjectL(): end");
|
|
1569 |
}
|
|
1570 |
|
|
1571 |
//------------------------------------------------------------------------------
|
|
1572 |
// CNSmlWLanAdapter::UpdateLeafObjectL( const TDesC8& aURI,
|
|
1573 |
// const TDesC8& aLUID, const TDesC8& aObject, const TDesC8& aType )
|
|
1574 |
//------------------------------------------------------------------------------
|
|
1575 |
|
|
1576 |
void CNSmlWLanAdapter::UpdateLeafObjectL(const TDesC8& /*aURI*/,
|
|
1577 |
const TDesC8& /*aLUID*/, RWriteStream*& /*aStream*/,
|
|
1578 |
const TDesC8& /*aType*/, TInt aStatusRef)
|
|
1579 |
{
|
|
1580 |
_DBG_FILE("CNSmlWLanAdapter::UpdateLeafObjectL(): begin");
|
|
1581 |
iCallBack->SetStatusL(aStatusRef, CSmlDmAdapter::EError);
|
|
1582 |
_DBG_FILE("CNSmlWLanAdapter::UpdateLeafObjectL(): end");
|
|
1583 |
}
|
|
1584 |
|
|
1585 |
//-----------------------------------------------------------------------------
|
|
1586 |
// CNSmlWLanAdapter* CNSmlWLanAdapter::DeleteObjectL( const TDesC8& aURI,
|
|
1587 |
// const TDesC8& aLUID, const TInt aStatusRef )
|
|
1588 |
//-----------------------------------------------------------------------------
|
|
1589 |
void CNSmlWLanAdapter::DeleteObjectL(const TDesC8& aURI, const TDesC8& aLUID,
|
|
1590 |
const TInt aStatusRef)
|
|
1591 |
{
|
|
1592 |
_DBG_FILE("CNSmlWLanAdapter::DeleteObjectL(): begin");
|
|
1593 |
CSmlDmAdapter::TError status = CSmlDmAdapter::ENotFound;
|
|
1594 |
|
|
1595 |
if (aLUID.Length() == 0)
|
|
1596 |
{
|
|
1597 |
iCallBack->SetStatusL(aStatusRef, CSmlDmAdapter::ENotFound);
|
|
1598 |
|
|
1599 |
_DBG_FILE("CNSmlWLanAdapter::DeleteObjectL(): end");
|
|
1600 |
return;
|
|
1601 |
}
|
|
1602 |
|
|
1603 |
TInt luid = GetIdFromLuid(aLUID);
|
|
1604 |
|
|
1605 |
if ((NumOfUriSegs(aURI) < 6) || (aURI.Match(_L8("AP/*/NAPDef/*/WLAN/*"))
|
|
1606 |
!= KErrNotFound && NumOfUriSegs(aURI) == 6))
|
|
1607 |
{
|
|
1608 |
if (luid == KErrNotFound)
|
|
1609 |
{
|
|
1610 |
return;
|
|
1611 |
}
|
|
1612 |
TInt ret = iWlanSettings->DeleteWlanSettings(luid);
|
|
1613 |
|
|
1614 |
if (ret == KErrNone)
|
|
1615 |
{
|
|
1616 |
status = CSmlDmAdapter::EOk;
|
|
1617 |
}
|
|
1618 |
else
|
|
1619 |
{
|
|
1620 |
status = CSmlDmAdapter::EError;
|
|
1621 |
}
|
|
1622 |
|
|
1623 |
}
|
|
1624 |
else if (aURI.Match(_L8("AP/*/NAPDef/*/WLAN/*/WEPKey")) != KErrNotFound
|
|
1625 |
&& NumOfUriSegs(aURI) == 7)
|
|
1626 |
{
|
|
1627 |
// Individual WLAN settings cannot be deleted and this case should never happen.
|
|
1628 |
// These are deleted through WLAN parent nodes.
|
|
1629 |
status = CSmlDmAdapter::EError;
|
|
1630 |
}
|
|
1631 |
|
|
1632 |
else if (aURI.Match(_L8("AP/*/NAPDef/*/WLAN/*/SecondarySSID/*"))
|
|
1633 |
!= KErrNotFound && NumOfUriSegs(aURI) == 8)
|
|
1634 |
{
|
|
1635 |
_DBG_FILE(
|
|
1636 |
"CNSmlWLanAdapter::DeleteObjectL(): matching SecondarySSID/*");
|
|
1637 |
//Check if the secondary SSID is present , if so delete that
|
|
1638 |
TUint32 secid = GetSecSSIDFromUriL(aURI);
|
|
1639 |
TInt retvalue(KErrNone);
|
|
1640 |
_DBG_FILE(
|
|
1641 |
"CNSmlWLanAdapter::DeleteObjectL() before call to DeleteOneSecondarySSIDL ");
|
|
1642 |
TRAPD(ssidError, retvalue = iWlanSettings->DeleteOneSecondarySSIDL(
|
|
1643 |
luid, secid));
|
|
1644 |
_DBG_FILE(
|
|
1645 |
"CNSmlWLanAdapter::DeleteObjectL() After call to DeleteOneSecondarySSIDL ");
|
|
1646 |
DBG_ARGS8(_S8(
|
|
1647 |
"TRAP ERROR ssidError : Id = %d and retvalue eror = %d"),
|
|
1648 |
ssidError, retvalue);
|
|
1649 |
|
|
1650 |
if (ssidError == KErrNone)
|
|
1651 |
{
|
|
1652 |
_DBG_FILE("CNSmlWLanAdapter::DeleteObjectL() SSID trap KERRONONE");
|
|
1653 |
if (retvalue == KErrNone)
|
|
1654 |
{
|
|
1655 |
_DBG_FILE(
|
|
1656 |
"CNSmlWLanAdapter::DeleteObjectL() retvalue also KERRONONE, so its deleted");
|
|
1657 |
status = CSmlDmAdapter::EOk;
|
|
1658 |
}
|
|
1659 |
|
|
1660 |
else if (retvalue == KErrNotFound)
|
|
1661 |
{
|
|
1662 |
status = CSmlDmAdapter::ENotFound;
|
|
1663 |
_DBG_FILE(
|
|
1664 |
"CNSmlWLanAdapter::DeleteObjectL() retvalue KErrNotFound :-(");
|
|
1665 |
}
|
|
1666 |
|
|
1667 |
else
|
|
1668 |
{
|
|
1669 |
_DBG_FILE(
|
|
1670 |
"CNSmlWLanAdapter::DeleteObjectL() retvalue some error :-(");
|
|
1671 |
status = CSmlDmAdapter::EError;
|
|
1672 |
}
|
|
1673 |
|
|
1674 |
}
|
|
1675 |
else
|
|
1676 |
{
|
|
1677 |
_DBG_FILE("CNSmlWLanAdapter::DeleteObjectL() trap error :-( ");
|
|
1678 |
status = CSmlDmAdapter::EError;
|
|
1679 |
}
|
|
1680 |
|
|
1681 |
}
|
|
1682 |
|
|
1683 |
else if (aURI.Match(_L8("AP/*/NAPDef/*/WLAN/*/*")) != KErrNotFound
|
|
1684 |
&& NumOfUriSegs(aURI) == 7)
|
|
1685 |
{
|
|
1686 |
// Individual WLAN settings cannot be deleted and this case should never happen.
|
|
1687 |
// These are deleted through WLAN parent nodes.
|
|
1688 |
status = CSmlDmAdapter::EError;
|
|
1689 |
}
|
|
1690 |
|
|
1691 |
else if (aURI.Match(_L8("AP/*/NAPDef/*/WLAN/*/WEPKey/*")) != KErrNotFound
|
|
1692 |
&& NumOfUriSegs(aURI) == 8)
|
|
1693 |
{
|
|
1694 |
// Individual WEP keys cannot be deleted and this case should never happen.
|
|
1695 |
// These are deleted through WLAN parent nodes.
|
|
1696 |
status = CSmlDmAdapter::EError;
|
|
1697 |
}
|
|
1698 |
|
|
1699 |
else if (aURI.Match(_L8("AP/*/NAPDef/*/WLAN/*/WEPKey/*/Data"))
|
|
1700 |
!= KErrNotFound && NumOfUriSegs(aURI) == 9)
|
|
1701 |
{
|
|
1702 |
// Individual WEP keys cannot be deleted and this case should never happen.
|
|
1703 |
// These are deleted through WLAN parent nodes.
|
|
1704 |
status = CSmlDmAdapter::EError;
|
|
1705 |
}
|
|
1706 |
|
|
1707 |
else if (aURI.Match(_L8("AP/*/NAPDef/*/WLAN/*/EAP/*")) != KErrNotFound
|
|
1708 |
&& NumOfUriSegs(aURI) == 8)
|
|
1709 |
{
|
|
1710 |
// Individual EAP settings cannot be deleted and this case should never happen.
|
|
1711 |
// These are deleted through WLAN parent nodes.
|
|
1712 |
status = CSmlDmAdapter::EError;
|
|
1713 |
}
|
|
1714 |
else if (aURI.Match(_L8("AP/*/NAPDef/*/WLAN/*/EAP/*/*")) != KErrNotFound
|
|
1715 |
&& NumOfUriSegs(aURI) == 9)
|
|
1716 |
{
|
|
1717 |
// Individual EAP settings cannot be deleted and this case should never happen.
|
|
1718 |
// These are deleted through WLAN parent nodes.
|
|
1719 |
status = CSmlDmAdapter::EError;
|
|
1720 |
}
|
|
1721 |
else if (aURI.Match(_L8("AP/*/NAPDef/*/WLAN/*/EAP/*/Certificate/*"))
|
|
1722 |
!= KErrNotFound && NumOfUriSegs(aURI) == 10)
|
|
1723 |
{
|
|
1724 |
// Individual certificates are not allowed to be deleted and this case should never happen
|
|
1725 |
// These are deleted through WLAN parent nodes.
|
|
1726 |
status = CSmlDmAdapter::EError;
|
|
1727 |
|
|
1728 |
}
|
|
1729 |
else if (aURI.Match(_L8("AP/*/NAPDef/*/WLAN/*/EAP/*/Certificate/*/*"))
|
|
1730 |
!= KErrNotFound && NumOfUriSegs(aURI) == 11)
|
|
1731 |
{
|
|
1732 |
// Individual certificate fields are not allowed to be deleted and this case should never happen.
|
|
1733 |
// These are deleted through WLAN parent nodes.
|
|
1734 |
status = CSmlDmAdapter::EError;
|
|
1735 |
}
|
|
1736 |
|
|
1737 |
iCallBack->SetStatusL(aStatusRef, status);
|
|
1738 |
|
|
1739 |
_DBG_FILE("CNSmlWLanAdapter::DeleteObjectL(): end");
|
|
1740 |
}
|
|
1741 |
|
|
1742 |
//-----------------------------------------------------------------------------
|
|
1743 |
// CNSmlWLanAdapter* CNSmlWLanAdapter::FetchLeafObjectL( const TDesC8& aURI,
|
|
1744 |
// const TDesC8& aLUID, const TDesC8& aType,
|
|
1745 |
// const TInt aResultsRef, const TInt aStatusRef )
|
|
1746 |
// not used.
|
|
1747 |
//-----------------------------------------------------------------------------
|
|
1748 |
|
|
1749 |
void CNSmlWLanAdapter::FetchLeafObjectSizeL(const TDesC8& /*aURI*/,
|
|
1750 |
const TDesC8& /*aLUID*/, const TDesC8& /*aType*/,
|
|
1751 |
TInt /*aResultsRef*/, TInt /*aStatusRef*/)
|
|
1752 |
{
|
|
1753 |
_DBG_FILE("CNSmlWLanAdapter::FetchLeafObjectSizeL(): begin");
|
|
1754 |
_DBG_FILE("CNSmlWLanAdapter::FetchLeafObjectSizeL(): end");
|
|
1755 |
return;
|
|
1756 |
}
|
|
1757 |
|
|
1758 |
//-----------------------------------------------------------------------------
|
|
1759 |
// CNSmlWLanAdapter* CNSmlWLanAdapter::FetchLeafObjectL( const TDesC8& aURI,
|
|
1760 |
// const TDesC8& aLUID, const TDesC8& aType,
|
|
1761 |
// const TInt aResultsRef, const TInt aStatusRef )
|
|
1762 |
//-----------------------------------------------------------------------------
|
|
1763 |
void CNSmlWLanAdapter::FetchLeafObjectL(const TDesC8& /*aURI*/,
|
|
1764 |
const TDesC8& /*aLUID*/, const TDesC8& /*aType*/,
|
|
1765 |
const TInt /*aResultsRef*/, const TInt /*aStatusRef*/)
|
|
1766 |
{
|
|
1767 |
_DBG_FILE("CNSmlWLanAdapter::FetchLeafObjectL(): begin");
|
|
1768 |
_DBG_FILE("CNSmlWLanAdapter::FetchLeafObjectL(): end");
|
|
1769 |
|
|
1770 |
}
|
|
1771 |
|
|
1772 |
//-----------------------------------------------------------------------------
|
|
1773 |
// CNSmlWLanAdapter* CNSmlWLanAdapter::FetchLeafObjectL( const TDesC& aURI,
|
|
1774 |
// const TDesC& aLUID, const TDesC& aType,
|
|
1775 |
// const TInt aResultsRef, const TInt aStatusRef )
|
|
1776 |
//-----------------------------------------------------------------------------
|
|
1777 |
CSmlDmAdapter::TError CNSmlWLanAdapter::FetchLeafObjectL(const TDesC8& aURI,
|
|
1778 |
const TDesC8& aLUID, const TDesC8& aType, CBufBase& aObject)
|
|
1779 |
{
|
|
1780 |
|
|
1781 |
_DBG_FILE("CNSmlWLanAdapter::FetchLeafObjectL(): begin");
|
|
1782 |
DBG_ARGS8(_S8("WLanAdapter::FetchLeafObjectL - <%S> <%S> <%S>"), &aURI,
|
|
1783 |
&aLUID, &aType);
|
|
1784 |
|
|
1785 |
if (aLUID.Length() == 0)
|
|
1786 |
{
|
|
1787 |
|
|
1788 |
_DBG_FILE("CNSmlWLanAdapter::FetchLeafObjectL(): ENotFound");
|
|
1789 |
return CSmlDmAdapter::ENotFound;
|
|
1790 |
}
|
|
1791 |
|
|
1792 |
CSmlDmAdapter::TError status = CSmlDmAdapter::ENotFound;
|
|
1793 |
|
|
1794 |
// This luid is the service table id (Found from EAP node and parents)
|
|
1795 |
TInt luid;
|
|
1796 |
if (aURI.Match(_L8("AP/*/NAPDef/*/WLAN/*/EAP/*")) != KErrNotFound)
|
|
1797 |
{
|
|
1798 |
luid = GetServiceIdFromUriL(aURI);
|
|
1799 |
}
|
|
1800 |
else
|
|
1801 |
{
|
|
1802 |
// The luid supplied is ok
|
|
1803 |
luid = GetIdFromLuid(aLUID);
|
|
1804 |
}
|
|
1805 |
|
|
1806 |
TPtrC8 lastUriSeg = GetLastUriSeg(aURI);
|
|
1807 |
|
|
1808 |
if (luid == KErrNotFound)
|
|
1809 |
{
|
56
|
1810 |
return CSmlDmAdapter::ENotFound;;
|
47
|
1811 |
}
|
|
1812 |
|
|
1813 |
TInt err = iWlanSettings->GetWlanSettings(luid, *iSettings);
|
|
1814 |
|
|
1815 |
if (err == KErrNotFound)
|
|
1816 |
{
|
|
1817 |
|
|
1818 |
_DBG_FILE("CNSmlWLanAdapter::FetchLeafObjectL(): ENotFound");
|
|
1819 |
return CSmlDmAdapter::ENotFound;
|
|
1820 |
}
|
|
1821 |
|
|
1822 |
if (lastUriSeg.Compare(KNSmlWLanSsid) == 0)
|
|
1823 |
{
|
|
1824 |
|
|
1825 |
if (aURI.Match(_L8("AP/*/NAPDef/*/WLAN/*/SecondarySSID/*"))
|
|
1826 |
!= KErrNotFound)
|
|
1827 |
{
|
|
1828 |
RArray<TSecondarySSID> secondarySSIDs;
|
|
1829 |
CleanupClosePushL(secondarySSIDs);
|
|
1830 |
iWlanSettings->GetSecondarySSIDListL(luid, secondarySSIDs);
|
|
1831 |
TSecondarySSID ssid;
|
|
1832 |
ssid.Id = 0;
|
|
1833 |
TUint32 id = GetSecSSIDFromUriL(aURI);
|
|
1834 |
TInt count = secondarySSIDs.Count();
|
|
1835 |
for (TInt i = 0; i < count; i++)
|
|
1836 |
{
|
|
1837 |
if (id == secondarySSIDs[i].Id)
|
|
1838 |
{
|
|
1839 |
ssid = secondarySSIDs[i];
|
|
1840 |
break;
|
|
1841 |
}
|
|
1842 |
}
|
|
1843 |
CleanupStack::PopAndDestroy(&secondarySSIDs);
|
|
1844 |
if (ssid.Id == 0)
|
|
1845 |
{
|
|
1846 |
status = CSmlDmAdapter::ENotFound;
|
|
1847 |
}
|
|
1848 |
else
|
|
1849 |
{
|
|
1850 |
HBufC* data = ssid.ScannedId.AllocLC();
|
|
1851 |
HBufC8* data8 = HBufC8::NewLC(data->Size());
|
|
1852 |
TPtr8 dataPtr8 = data8->Des();
|
|
1853 |
//FFS
|
|
1854 |
CnvUtfConverter::ConvertFromUnicodeToUtf8(dataPtr8,
|
|
1855 |
data->Des());
|
|
1856 |
|
|
1857 |
aObject.InsertL(0, dataPtr8);
|
|
1858 |
status = CSmlDmAdapter::EOk;
|
|
1859 |
|
|
1860 |
CleanupStack::PopAndDestroy(2); //data, data8
|
|
1861 |
}
|
|
1862 |
}
|
|
1863 |
else
|
|
1864 |
{
|
|
1865 |
|
|
1866 |
HBufC* data = iSettings->SSID.AllocLC();
|
|
1867 |
HBufC8* data8 = HBufC8::NewLC(data->Size());
|
|
1868 |
TPtr8 dataPtr8 = data8->Des();
|
|
1869 |
//FFS
|
|
1870 |
CnvUtfConverter::ConvertFromUnicodeToUtf8(dataPtr8, data->Des());
|
|
1871 |
|
|
1872 |
aObject.InsertL(0, dataPtr8);
|
|
1873 |
status = CSmlDmAdapter::EOk;
|
|
1874 |
|
|
1875 |
CleanupStack::PopAndDestroy(2); //data, data8
|
|
1876 |
|
|
1877 |
}
|
|
1878 |
|
|
1879 |
}
|
|
1880 |
|
|
1881 |
else if (lastUriSeg.Compare(KNSmlWLanUsedSsid) == 0)
|
|
1882 |
{
|
|
1883 |
|
|
1884 |
if (aURI.Match(_L8("AP/*/NAPDef/*/WLAN/*/SecondarySSID/*"))
|
|
1885 |
!= KErrNotFound)
|
|
1886 |
{
|
|
1887 |
RArray<TSecondarySSID> secondarySSIDs;
|
|
1888 |
CleanupClosePushL(secondarySSIDs);
|
|
1889 |
iWlanSettings->GetSecondarySSIDListL(luid, secondarySSIDs);
|
|
1890 |
TSecondarySSID ssid;
|
|
1891 |
ssid.Id = 0;
|
|
1892 |
TUint32 id = GetSecSSIDFromUriL(aURI);
|
|
1893 |
TInt count = secondarySSIDs.Count();
|
|
1894 |
for (TInt i = 0; i < count; i++)
|
|
1895 |
{
|
|
1896 |
if (id == secondarySSIDs[i].Id)
|
|
1897 |
{
|
|
1898 |
ssid = secondarySSIDs[i];
|
|
1899 |
break;
|
|
1900 |
}
|
|
1901 |
}
|
|
1902 |
CleanupStack::PopAndDestroy(&secondarySSIDs);
|
|
1903 |
if (ssid.Id == 0)
|
|
1904 |
{
|
|
1905 |
status = CSmlDmAdapter::ENotFound;
|
|
1906 |
}
|
|
1907 |
else
|
|
1908 |
{
|
|
1909 |
HBufC* data = ssid.UsedId.AllocLC();
|
|
1910 |
HBufC8* data8 = HBufC8::NewLC(data->Size());
|
|
1911 |
TPtr8 dataPtr8 = data8->Des();
|
|
1912 |
//FFS
|
|
1913 |
CnvUtfConverter::ConvertFromUnicodeToUtf8(dataPtr8,
|
|
1914 |
data->Des());
|
|
1915 |
|
|
1916 |
aObject.InsertL(0, dataPtr8);
|
|
1917 |
status = CSmlDmAdapter::EOk;
|
|
1918 |
|
|
1919 |
CleanupStack::PopAndDestroy(2); //data, data8
|
|
1920 |
}
|
|
1921 |
}
|
|
1922 |
else
|
|
1923 |
{
|
|
1924 |
|
|
1925 |
HBufC* data = iSettings->UsedSSID.AllocLC();
|
|
1926 |
HBufC8* data8 = HBufC8::NewLC(data->Size());
|
|
1927 |
TPtr8 dataPtr8 = data8->Des();
|
|
1928 |
//FFS
|
|
1929 |
CnvUtfConverter::ConvertFromUnicodeToUtf8(dataPtr8, data->Des());
|
|
1930 |
|
|
1931 |
aObject.InsertL(0, dataPtr8);
|
|
1932 |
status = CSmlDmAdapter::EOk;
|
|
1933 |
|
|
1934 |
CleanupStack::PopAndDestroy(2); //data, data8
|
|
1935 |
|
|
1936 |
}
|
|
1937 |
|
|
1938 |
}
|
|
1939 |
|
|
1940 |
else if (lastUriSeg.Compare(KNSmlWLanSsidHidden) == 0)
|
|
1941 |
{
|
|
1942 |
if (iSettings->ScanSSID == 1)
|
|
1943 |
{
|
|
1944 |
aObject.InsertL(0, _L8("True"));
|
|
1945 |
}
|
|
1946 |
else
|
|
1947 |
{
|
|
1948 |
aObject.InsertL(0, _L8("False"));
|
|
1949 |
}
|
|
1950 |
status = CSmlDmAdapter::EOk;
|
|
1951 |
}
|
|
1952 |
|
|
1953 |
else if (lastUriSeg.Compare(KNSmlWLanNetworkMode) == 0)
|
|
1954 |
{
|
|
1955 |
status = CSmlDmAdapter::EOk;
|
|
1956 |
|
|
1957 |
switch (iSettings->ConnectionMode)
|
|
1958 |
{
|
|
1959 |
case 0:
|
|
1960 |
aObject.InsertL(0, KNSmlWLanAdHoc8);
|
|
1961 |
break;
|
|
1962 |
case 1:
|
|
1963 |
aObject.InsertL(0, KNSmlWLanInfrastructure8);
|
|
1964 |
break;
|
|
1965 |
default:
|
|
1966 |
status = CSmlDmAdapter::ENotFound;
|
|
1967 |
break;
|
|
1968 |
}
|
|
1969 |
}
|
|
1970 |
else if (lastUriSeg.Compare(KNSmlWLanSecurityMode) == 0)
|
|
1971 |
{
|
|
1972 |
status = CSmlDmAdapter::EOk;
|
|
1973 |
|
|
1974 |
switch (iSettings->SecurityMode)
|
|
1975 |
{
|
|
1976 |
case EAllowUnsecure:
|
|
1977 |
aObject.InsertL(0, KNSmlWLanAllowUnsecure8);
|
|
1978 |
break;
|
|
1979 |
case EWep:
|
|
1980 |
aObject.InsertL(0, KNSmlWLanWep8);
|
|
1981 |
break;
|
|
1982 |
case EWlan8021x:
|
|
1983 |
aObject.InsertL(0, KNSmlWLan8021x8);
|
|
1984 |
break;
|
|
1985 |
case EWpa:
|
|
1986 |
aObject.InsertL(0, KNSmlWLanWpa8);
|
|
1987 |
break;
|
|
1988 |
case EWpa2:
|
|
1989 |
aObject.InsertL(0, KNSmlWLanWpa28);
|
|
1990 |
break;
|
|
1991 |
default:
|
|
1992 |
status = CSmlDmAdapter::ENotFound;
|
|
1993 |
break;
|
|
1994 |
}
|
|
1995 |
}
|
|
1996 |
|
|
1997 |
else if (lastUriSeg.Compare(KNSmlWLanWpaPreSharedKey) == 0)
|
|
1998 |
{
|
|
1999 |
aObject.InsertL(0, iSettings->WPAPreSharedKey);
|
|
2000 |
status = CSmlDmAdapter::EOk;
|
|
2001 |
}
|
|
2002 |
|
|
2003 |
else if (lastUriSeg.Compare(KNSmlWLanUseWPAPSK) == 0)
|
|
2004 |
{
|
|
2005 |
if (iSettings->UseWPAPSK == 1)
|
|
2006 |
{
|
|
2007 |
aObject.InsertL(0, _L8("True"));
|
|
2008 |
}
|
|
2009 |
else
|
|
2010 |
{
|
|
2011 |
aObject.InsertL(0, _L8("False"));
|
|
2012 |
}
|
|
2013 |
status = CSmlDmAdapter::EOk;
|
|
2014 |
}
|
|
2015 |
|
|
2016 |
else if (lastUriSeg.Compare(KNSmlWLanWepIndex) == 0)
|
|
2017 |
{
|
|
2018 |
HBufC8* data = IntToDes8LC(iSettings->WepIndex);
|
|
2019 |
aObject.InsertL(0, data->Des());
|
|
2020 |
|
|
2021 |
CleanupStack::PopAndDestroy(data); //data
|
|
2022 |
status = CSmlDmAdapter::EOk;
|
|
2023 |
}
|
|
2024 |
|
|
2025 |
else if (lastUriSeg.Compare(KNSmlWLanEapList) == 0)
|
|
2026 |
{
|
|
2027 |
HBufC* data = iSettings->EapList.AllocLC();
|
|
2028 |
HBufC8* data8 = HBufC8::NewLC(data->Size());
|
|
2029 |
TPtr8 dataPtr8 = data8->Des();
|
|
2030 |
//FFS
|
|
2031 |
CnvUtfConverter::ConvertFromUnicodeToUtf8(dataPtr8, data->Des());
|
|
2032 |
|
|
2033 |
aObject.InsertL(0, dataPtr8);
|
|
2034 |
status = CSmlDmAdapter::EOk;
|
|
2035 |
|
|
2036 |
CleanupStack::PopAndDestroy(2); //data, data8
|
|
2037 |
|
|
2038 |
}
|
|
2039 |
|
|
2040 |
else if (lastUriSeg.Compare(KNSmlWLanAuthMode) == 0)
|
|
2041 |
{
|
|
2042 |
HBufC8* data = IntToDes8LC(iSettings->AuthMode);
|
|
2043 |
aObject.InsertL(0, data->Des());
|
|
2044 |
|
|
2045 |
CleanupStack::PopAndDestroy(data); //data
|
|
2046 |
status = CSmlDmAdapter::EOk;
|
|
2047 |
}
|
|
2048 |
|
|
2049 |
else if (lastUriSeg.Compare(KNSmlWLanWepKeyData) == 0)
|
|
2050 |
{
|
|
2051 |
TInt wepKeyIndex = GetWepKeyIdFromLuid(aLUID);
|
|
2052 |
if (wepKeyIndex == KErrNotFound)
|
|
2053 |
{
|
|
2054 |
wepKeyIndex = GetWepKeyIdFromUri(aURI);
|
|
2055 |
TBuf8<80> addLUID; // AP/<x>/NapDef/<x>/WLAN/<x>/WEPKey/WKIdnnn
|
|
2056 |
addLUID.AppendNum(wepKeyIndex);
|
|
2057 |
addLUID.AppendNumFixedWidth(luid, EDecimal, 3);
|
|
2058 |
DBG_ARGS8(
|
|
2059 |
_S8(
|
|
2060 |
"WLanAdapter::Fetchleaf object, set mapping uri: <%S> to luid: <%S>"),
|
|
2061 |
&aURI, &addLUID);
|
|
2062 |
DBG_ARGS8(_S8("Parametrit - <%S> <%S>"), &aURI, &addLUID);
|
|
2063 |
iCallBack->SetMappingL(aURI, addLUID);
|
|
2064 |
|
|
2065 |
}
|
|
2066 |
status = CSmlDmAdapter::EOk;
|
|
2067 |
switch (wepKeyIndex)
|
|
2068 |
{
|
|
2069 |
case 1:
|
|
2070 |
aObject.InsertL(0, iSettings->WepKey1);
|
|
2071 |
break;
|
|
2072 |
case 2:
|
|
2073 |
aObject.InsertL(0, iSettings->WepKey2);
|
|
2074 |
break;
|
|
2075 |
case 3:
|
|
2076 |
aObject.InsertL(0, iSettings->WepKey3);
|
|
2077 |
break;
|
|
2078 |
case 4:
|
|
2079 |
aObject.InsertL(0, iSettings->WepKey4);
|
|
2080 |
break;
|
|
2081 |
default:
|
|
2082 |
status = CSmlDmAdapter::EError;
|
|
2083 |
}
|
|
2084 |
}
|
|
2085 |
else if (lastUriSeg.Compare(KNSmlWLanWepKeyId) == 0)
|
|
2086 |
{
|
|
2087 |
TInt wepKeyIndex = GetWepKeyIdFromLuid(aLUID);
|
|
2088 |
if (wepKeyIndex == KErrNotFound)
|
|
2089 |
{
|
|
2090 |
wepKeyIndex = GetWepKeyIdFromUri(aURI);
|
|
2091 |
TBuf8<80> addLUID; // AP/<x>/NapDef/<x>/WLAN/<x>/WEPKey/WKIdnnn
|
|
2092 |
addLUID.AppendNum(wepKeyIndex);
|
|
2093 |
addLUID.AppendNumFixedWidth(luid, EDecimal, 3);
|
|
2094 |
DBG_ARGS8(
|
|
2095 |
_S8(
|
|
2096 |
"WLanAdapter::Fetchleaf object, set mapping uri: <%S> to luid: <%S>"),
|
|
2097 |
&aURI, &addLUID);
|
|
2098 |
DBG_ARGS8(_S8("Parametrit - <%S> <%S>"), &aURI, &addLUID);
|
|
2099 |
iCallBack->SetMappingL(aURI, addLUID);
|
|
2100 |
}
|
|
2101 |
if (wepKeyIndex > 0)
|
|
2102 |
{
|
|
2103 |
HBufC8* data = IntToDes8LC(wepKeyIndex);
|
|
2104 |
aObject.InsertL(0, data->Des());
|
|
2105 |
CleanupStack::PopAndDestroy(data); //data
|
|
2106 |
status = CSmlDmAdapter::EOk;
|
|
2107 |
}
|
|
2108 |
else
|
|
2109 |
{
|
|
2110 |
status = CSmlDmAdapter::EError;
|
|
2111 |
}
|
|
2112 |
}
|
|
2113 |
|
|
2114 |
else if (aURI.Match(_L8("AP/*/NAPDef/*/WLAN/*/EAP/*")) != KErrNotFound)
|
|
2115 |
{
|
|
2116 |
TInt eapId = GetEAPIdFromUri(aURI);
|
|
2117 |
|
|
2118 |
// Check if the id contains encapsulating type as well
|
|
2119 |
TInt encapsEapId = GetEncapsEAPIdFromUri(aURI);
|
|
2120 |
if (encapsEapId == KErrNotFound)
|
|
2121 |
{
|
|
2122 |
encapsEapId = EEapNone;
|
|
2123 |
}
|
|
2124 |
|
|
2125 |
ResetEAPStructL();
|
|
2126 |
TEapExpandedType expandedTypecmbuf;
|
|
2127 |
TEapExpandedType expandedTypeencapscmbuf;
|
|
2128 |
|
|
2129 |
GetExpandedType(eapId, encapsEapId, expandedTypecmbuf,
|
|
2130 |
expandedTypeencapscmbuf);
|
|
2131 |
TInt err = iWlanSettings->GetEAPSettings(luid, expandedTypecmbuf,
|
|
2132 |
expandedTypeencapscmbuf, *iEAPSettings);
|
|
2133 |
|
|
2134 |
if (err != KErrNone || iEAPSettings == NULL)
|
|
2135 |
{
|
|
2136 |
status = CSmlDmAdapter::EError;
|
|
2137 |
}
|
|
2138 |
else if (lastUriSeg.Compare(KNSmlWLanEapType) == 0)
|
|
2139 |
{
|
|
2140 |
aObject.InsertL(0, *IntToDes8LC(eapId));
|
|
2141 |
CleanupStack::PopAndDestroy(); // IntToDes8LC
|
|
2142 |
status = CSmlDmAdapter::EOk;
|
|
2143 |
}
|
|
2144 |
else if (lastUriSeg.Compare(KNSmlWLanUsername) == 0)
|
|
2145 |
{
|
|
2146 |
if (iEAPSettings->iUsernamePresent)
|
|
2147 |
{
|
|
2148 |
DesToBufferL(aObject, iEAPSettings->iUsername);
|
|
2149 |
}
|
|
2150 |
status = CSmlDmAdapter::EOk;
|
|
2151 |
}
|
|
2152 |
else if (lastUriSeg.Compare(KNSmlWLanPassword) == 0)
|
|
2153 |
{
|
|
2154 |
if (iEAPSettings->iPasswordPresent)
|
|
2155 |
{
|
|
2156 |
DesToBufferL(aObject, iEAPSettings->iPassword);
|
|
2157 |
}
|
|
2158 |
status = CSmlDmAdapter::EOk;
|
|
2159 |
}
|
|
2160 |
else if (lastUriSeg.Compare(KNSmlWLanRealm) == 0)
|
|
2161 |
{
|
|
2162 |
if (iEAPSettings->iRealmPresent)
|
|
2163 |
{
|
|
2164 |
DesToBufferL(aObject, iEAPSettings->iRealm);
|
|
2165 |
}
|
|
2166 |
status = CSmlDmAdapter::EOk;
|
|
2167 |
}
|
|
2168 |
else if (lastUriSeg.Compare(KNSmlWLanUsePseudonym) == 0)
|
|
2169 |
{
|
|
2170 |
if (iEAPSettings->iUsePseudonymsPresent
|
|
2171 |
&& iEAPSettings->iUsePseudonyms)
|
|
2172 |
{
|
|
2173 |
aObject.InsertL(0, KTrue);
|
|
2174 |
}
|
|
2175 |
else
|
|
2176 |
{
|
|
2177 |
aObject.InsertL(0, KFalse);
|
|
2178 |
}
|
|
2179 |
status = CSmlDmAdapter::EOk;
|
|
2180 |
}
|
|
2181 |
else if (lastUriSeg.Compare(KNSmlWLanEncapsulation) == 0)
|
|
2182 |
{
|
|
2183 |
if (encapsEapId == EEapPeap)
|
|
2184 |
{
|
|
2185 |
aObject.InsertL(0, KEAPPEAP);
|
|
2186 |
}
|
|
2187 |
else if (encapsEapId == EEapTtls)
|
|
2188 |
{
|
|
2189 |
aObject.InsertL(0, KEAPTTLS);
|
|
2190 |
}
|
|
2191 |
status = CSmlDmAdapter::EOk;
|
|
2192 |
}
|
|
2193 |
else if (lastUriSeg.Compare(KNSmlWLanVerifyCertRealm) == 0)
|
|
2194 |
{
|
|
2195 |
if (iEAPSettings->iVerifyServerRealmPresent
|
|
2196 |
&& iEAPSettings->iVerifyServerRealm)
|
|
2197 |
{
|
|
2198 |
aObject.InsertL(0, KTrue);
|
|
2199 |
}
|
|
2200 |
else
|
|
2201 |
{
|
|
2202 |
aObject.InsertL(0, KFalse);
|
|
2203 |
}
|
|
2204 |
status = CSmlDmAdapter::EOk;
|
|
2205 |
}
|
|
2206 |
else if (lastUriSeg.Compare(KNSmlWLanRequireClientAuthentication)
|
|
2207 |
== 0)
|
|
2208 |
{
|
|
2209 |
if (iEAPSettings->iRequireClientAuthenticationPresent
|
|
2210 |
&& iEAPSettings->iRequireClientAuthentication)
|
|
2211 |
{
|
|
2212 |
aObject.InsertL(0, KTrue);
|
|
2213 |
}
|
|
2214 |
else
|
|
2215 |
{
|
|
2216 |
aObject.InsertL(0, KFalse);
|
|
2217 |
}
|
|
2218 |
status = CSmlDmAdapter::EOk;
|
|
2219 |
}
|
|
2220 |
else if (lastUriSeg.Compare(KNSmlWLanSessionValidityTime) == 0)
|
|
2221 |
{
|
|
2222 |
if (iEAPSettings->iSessionValidityTimePresent)
|
|
2223 |
{
|
|
2224 |
aObject.InsertL(0, *IntToDes8LC(
|
|
2225 |
(TInt) iEAPSettings->iSessionValidityTime));
|
|
2226 |
CleanupStack::PopAndDestroy(); // IntToDes8LC
|
|
2227 |
}
|
|
2228 |
status = CSmlDmAdapter::EOk;
|
|
2229 |
}
|
|
2230 |
else if (lastUriSeg.Compare(KNSmlWLanCipherSuite) == 0)
|
|
2231 |
{
|
|
2232 |
FillCipherSuiteBufferL(aObject);
|
|
2233 |
status = CSmlDmAdapter::EOk;
|
|
2234 |
}
|
|
2235 |
else if (lastUriSeg.Compare(KNSmlWLanAllowPEAPv0) == 0)
|
|
2236 |
{
|
|
2237 |
if (iEAPSettings->iPEAPVersionsPresent
|
|
2238 |
&& iEAPSettings->iPEAPv0Allowed)
|
|
2239 |
{
|
|
2240 |
aObject.InsertL(0, KTrue);
|
|
2241 |
}
|
|
2242 |
else
|
|
2243 |
{
|
|
2244 |
aObject.InsertL(0, KFalse);
|
|
2245 |
}
|
|
2246 |
status = CSmlDmAdapter::EOk;
|
|
2247 |
}
|
|
2248 |
else if (lastUriSeg.Compare(KNSmlWLanAllowPEAPv1) == 0)
|
|
2249 |
{
|
|
2250 |
if (iEAPSettings->iPEAPVersionsPresent
|
|
2251 |
&& iEAPSettings->iPEAPv1Allowed)
|
|
2252 |
{
|
|
2253 |
aObject.InsertL(0, KTrue);
|
|
2254 |
}
|
|
2255 |
else
|
|
2256 |
{
|
|
2257 |
aObject.InsertL(0, KFalse);
|
|
2258 |
}
|
|
2259 |
status = CSmlDmAdapter::EOk;
|
|
2260 |
}
|
|
2261 |
else if (lastUriSeg.Compare(KNSmlWLanAllowPEAPv2) == 0)
|
|
2262 |
{
|
|
2263 |
if (iEAPSettings->iPEAPVersionsPresent
|
|
2264 |
&& iEAPSettings->iPEAPv2Allowed)
|
|
2265 |
{
|
|
2266 |
aObject.InsertL(0, KTrue);
|
|
2267 |
}
|
|
2268 |
else
|
|
2269 |
{
|
|
2270 |
aObject.InsertL(0, KFalse);
|
|
2271 |
}
|
|
2272 |
status = CSmlDmAdapter::EOk;
|
|
2273 |
}
|
|
2274 |
|
|
2275 |
#ifdef FF_WLAN_EXTENSIONS
|
|
2276 |
else if (lastUriSeg.Compare(KNSmlWLanAuthProvMode) == 0)
|
|
2277 |
{
|
|
2278 |
if (iEAPSettings->iAuthProvModeAllowedPresent && iEAPSettings->iAuthProvModeAllowed)
|
|
2279 |
{
|
|
2280 |
aObject.InsertL(0, KTrue);
|
|
2281 |
}
|
|
2282 |
else
|
|
2283 |
{
|
|
2284 |
aObject.InsertL(0, KFalse);
|
|
2285 |
}
|
|
2286 |
status = CSmlDmAdapter::EOk;
|
|
2287 |
}
|
|
2288 |
|
|
2289 |
else if (lastUriSeg.Compare(KNSmlWLanUnauthProvMode) == 0)
|
|
2290 |
{
|
|
2291 |
if (iEAPSettings->iUnauthProvModeAllowedPresent && iEAPSettings->iUnauthProvModeAllowed)
|
|
2292 |
{
|
|
2293 |
aObject.InsertL(0, KTrue);
|
|
2294 |
}
|
|
2295 |
else
|
|
2296 |
{
|
|
2297 |
aObject.InsertL(0, KFalse);
|
|
2298 |
}
|
|
2299 |
status = CSmlDmAdapter::EOk;
|
|
2300 |
}
|
|
2301 |
|
|
2302 |
else if (lastUriSeg.Compare(KNSmlWLanPACGroupRef) == 0)
|
|
2303 |
{
|
|
2304 |
if (iEAPSettings->iPACGroupReferencePresent)
|
|
2305 |
{
|
|
2306 |
DesToBufferL(aObject, iEAPSettings->iPACGroupReference);
|
|
2307 |
}
|
|
2308 |
status = CSmlDmAdapter::EOk;
|
|
2309 |
}
|
|
2310 |
|
|
2311 |
else if (lastUriSeg.Compare(KNSmlWLanWarnADHPNoPAC) == 0)
|
|
2312 |
{
|
|
2313 |
if (iEAPSettings->iWarnADHPNoPACPresent && iEAPSettings->iWarnADHPNoPAC)
|
|
2314 |
{
|
|
2315 |
aObject.InsertL(0, KTrue);
|
|
2316 |
}
|
|
2317 |
else
|
|
2318 |
{
|
|
2319 |
aObject.InsertL(0, KFalse);
|
|
2320 |
}
|
|
2321 |
status = CSmlDmAdapter::EOk;
|
|
2322 |
}
|
|
2323 |
|
|
2324 |
else if (lastUriSeg.Compare(KNSmlWLanWarnADHPNoMatchPAC) == 0)
|
|
2325 |
{
|
|
2326 |
if (iEAPSettings->iWarnADHPNoMatchingPACPresent && iEAPSettings->iWarnADHPNoMatchingPAC)
|
|
2327 |
{
|
|
2328 |
aObject.InsertL(0, KTrue);
|
|
2329 |
}
|
|
2330 |
else
|
|
2331 |
{
|
|
2332 |
aObject.InsertL(0, KFalse);
|
|
2333 |
}
|
|
2334 |
status = CSmlDmAdapter::EOk;
|
|
2335 |
}
|
|
2336 |
|
|
2337 |
else if (lastUriSeg.Compare(KNSmlWLanWarnNotDefaultSrv) == 0)
|
|
2338 |
{
|
|
2339 |
if (iEAPSettings->iWarnNotDefaultServerPresent && iEAPSettings->iWarnNotDefaultServer)
|
|
2340 |
{
|
|
2341 |
aObject.InsertL(0, KTrue);
|
|
2342 |
}
|
|
2343 |
else
|
|
2344 |
{
|
|
2345 |
aObject.InsertL(0, KFalse);
|
|
2346 |
}
|
|
2347 |
status = CSmlDmAdapter::EOk;
|
|
2348 |
}
|
|
2349 |
|
|
2350 |
#endif
|
|
2351 |
|
|
2352 |
else if (lastUriSeg.Compare(KNSmlWLanIssuerName) == 0)
|
|
2353 |
{
|
|
2354 |
status = CSmlDmAdapter::ENotFound;
|
|
2355 |
|
|
2356 |
TInt certId = GetCertificateIdFromUri(aURI);
|
|
2357 |
|
|
2358 |
if (iEAPSettings->iCertificatesPresent
|
|
2359 |
&& iEAPSettings->iCertificates.Count() >= certId
|
|
2360 |
&& certId != KErrNotFound)
|
|
2361 |
{
|
|
2362 |
if (iEAPSettings->iCertificates[certId - 1]->GetIssuerNamePresent())
|
|
2363 |
{
|
|
2364 |
aObject.InsertL(0,
|
|
2365 |
ConvertTo8LC(*(iEAPSettings->iCertificates[certId
|
|
2366 |
- 1]->GetIssuerName())));
|
|
2367 |
CleanupStack::PopAndDestroy(); // ConvertTo8LC
|
|
2368 |
status = CSmlDmAdapter::EOk;
|
|
2369 |
}
|
|
2370 |
}
|
|
2371 |
}
|
|
2372 |
else if (lastUriSeg.Compare(KNSmlWLanSubjectName) == 0)
|
|
2373 |
{
|
|
2374 |
status = CSmlDmAdapter::ENotFound;
|
|
2375 |
|
|
2376 |
TInt certId = GetCertificateIdFromUri(aURI);
|
|
2377 |
|
|
2378 |
if (iEAPSettings->iCertificatesPresent
|
|
2379 |
&& iEAPSettings->iCertificates.Count() >= certId
|
|
2380 |
&& certId != KErrNotFound)
|
|
2381 |
{
|
|
2382 |
if (iEAPSettings->iCertificates[certId - 1]->GetSubjectNamePresent())
|
|
2383 |
{
|
|
2384 |
aObject.InsertL(0,
|
|
2385 |
ConvertTo8LC(*(iEAPSettings->iCertificates[certId
|
|
2386 |
- 1]->GetSubjectName())));
|
|
2387 |
CleanupStack::PopAndDestroy(); // ConvertTo8LC
|
|
2388 |
status = CSmlDmAdapter::EOk;
|
|
2389 |
}
|
|
2390 |
}
|
|
2391 |
}
|
|
2392 |
else if (lastUriSeg.Compare(KNSmlWLanCertType) == 0)
|
|
2393 |
{
|
|
2394 |
status = CSmlDmAdapter::ENotFound;
|
|
2395 |
|
|
2396 |
TInt certId = GetCertificateIdFromUri(aURI);
|
|
2397 |
|
|
2398 |
if (iEAPSettings->iCertificatesPresent
|
|
2399 |
&& iEAPSettings->iCertificates.Count() >= certId
|
|
2400 |
&& certId != KErrNotFound)
|
|
2401 |
{
|
|
2402 |
aObject.InsertL(
|
|
2403 |
0,
|
|
2404 |
*IntToDes8LC(
|
|
2405 |
iEAPSettings->iCertificates[certId - 1]->GetCertType()));
|
|
2406 |
CleanupStack::PopAndDestroy(); // IntToDes8LC
|
|
2407 |
status = CSmlDmAdapter::EOk;
|
|
2408 |
}
|
|
2409 |
}
|
|
2410 |
else if (lastUriSeg.Compare(KNSmlWLanSerialNumber) == 0)
|
|
2411 |
{
|
|
2412 |
status = CSmlDmAdapter::ENotFound;
|
|
2413 |
|
|
2414 |
TInt certId = GetCertificateIdFromUri(aURI);
|
|
2415 |
|
|
2416 |
if (iEAPSettings->iCertificatesPresent
|
|
2417 |
&& iEAPSettings->iCertificates.Count() >= certId
|
|
2418 |
&& certId != KErrNotFound)
|
|
2419 |
{
|
|
2420 |
if (iEAPSettings->iCertificates[certId - 1]->GetSerialNumberPresent())
|
|
2421 |
{
|
|
2422 |
aObject.InsertL(0,
|
|
2423 |
ConvertTo8LC(*(iEAPSettings->iCertificates[certId
|
|
2424 |
- 1]->GetSerialNumber())));
|
|
2425 |
CleanupStack::PopAndDestroy(); // ConvertTo8LC
|
|
2426 |
status = CSmlDmAdapter::EOk;
|
|
2427 |
}
|
|
2428 |
}
|
|
2429 |
}
|
|
2430 |
else if (lastUriSeg.Compare(KNSmlWLanSubjectKeyId) == 0)
|
|
2431 |
{
|
|
2432 |
status = CSmlDmAdapter::ENotFound;
|
|
2433 |
|
|
2434 |
TInt certId = GetCertificateIdFromUri(aURI);
|
|
2435 |
|
|
2436 |
if (iEAPSettings->iCertificatesPresent
|
|
2437 |
&& iEAPSettings->iCertificates.Count() >= certId
|
|
2438 |
&& certId != KErrNotFound)
|
|
2439 |
{
|
|
2440 |
if (iEAPSettings->iCertificates[certId - 1]->GetSubjectKeyIdPresent())
|
|
2441 |
{
|
|
2442 |
_DBG_FILE(
|
|
2443 |
"CNSmlWLanAdapter::FetchLeafObject - Fetch subject key.");
|
|
2444 |
// check the lenght of the given subjectKeyId, if it is longer that 20, then we
|
|
2445 |
// update the status with error and will not go through the key
|
|
2446 |
if ((iEAPSettings->iCertificates[certId - 1]->GetSubjectKeyId().Length())
|
|
2447 |
> KKeyIdentifierLength)
|
|
2448 |
{
|
|
2449 |
status = CSmlDmAdapter::EError;
|
|
2450 |
}
|
|
2451 |
else
|
|
2452 |
{
|
|
2453 |
_DBG_FILE(
|
|
2454 |
"CNSmlWLanAdapter::FetchLeafObject - key is under max lenght");
|
|
2455 |
TBuf8<KKeyIdentifierLength>
|
|
2456 |
binKey = iEAPSettings->iCertificates[certId
|
|
2457 |
- 1]->GetSubjectKeyId();
|
|
2458 |
TBuf8<2> idBuf;
|
|
2459 |
TBuf8<KKeyIdentifierLength * 2> key;
|
|
2460 |
TUint8 byte;
|
|
2461 |
|
|
2462 |
// hexadecimal representation
|
|
2463 |
_LIT8(KFormat, "%02x");
|
|
2464 |
|
|
2465 |
// looping the subject key through
|
|
2466 |
for (TInt i = 0; i < binKey.Length(); i++)
|
|
2467 |
{
|
|
2468 |
_DBG_FILE(
|
|
2469 |
"CNSmlWLanAdapter::FetchLeafObject - Loop the key through.");
|
|
2470 |
// pick the next value from the buffer
|
|
2471 |
byte = binKey[i];
|
|
2472 |
// convert the value into hexadecimal format
|
|
2473 |
idBuf.Format(KFormat, byte);
|
|
2474 |
// store the hexa value into the key variable
|
|
2475 |
key.Append(idBuf);
|
|
2476 |
}
|
|
2477 |
// Copy the key to the aObject variable
|
|
2478 |
aObject.InsertL(0, key);
|
|
2479 |
status = CSmlDmAdapter::EOk;
|
|
2480 |
}
|
|
2481 |
}
|
|
2482 |
}
|
|
2483 |
}
|
|
2484 |
else if (lastUriSeg.Compare(KNSmlWLanFingerprint) == 0)
|
|
2485 |
{
|
|
2486 |
status = CSmlDmAdapter::ENotFound;
|
|
2487 |
|
|
2488 |
TInt certId = GetCertificateIdFromUri(aURI);
|
|
2489 |
|
|
2490 |
if (iEAPSettings->iCertificatesPresent
|
|
2491 |
&& iEAPSettings->iCertificates.Count() >= certId
|
|
2492 |
&& certId != KErrNotFound)
|
|
2493 |
{
|
|
2494 |
if (iEAPSettings->iCertificates[certId - 1]->GetThumbprintPresent())
|
|
2495 |
{
|
|
2496 |
aObject.InsertL(0,
|
|
2497 |
ConvertTo8LC(*(iEAPSettings->iCertificates[certId
|
|
2498 |
- 1]->GetThumbprint())));
|
|
2499 |
CleanupStack::PopAndDestroy(); // ConvertTo8LC
|
|
2500 |
status = CSmlDmAdapter::EOk;
|
|
2501 |
}
|
|
2502 |
}
|
|
2503 |
}
|
|
2504 |
else if (lastUriSeg.Compare(KNSmlWLanSerialNumber) == 0)
|
|
2505 |
{
|
|
2506 |
status = CSmlDmAdapter::ENotFound;
|
|
2507 |
|
|
2508 |
TInt certId = GetCertificateIdFromUri(aURI);
|
|
2509 |
|
|
2510 |
if (iEAPSettings->iCertificatesPresent
|
|
2511 |
&& iEAPSettings->iCertificates.Count() >= certId
|
|
2512 |
&& certId != KErrNotFound)
|
|
2513 |
{
|
|
2514 |
if (iEAPSettings->iCertificates[certId - 1]->GetSerialNumberPresent())
|
|
2515 |
{
|
|
2516 |
aObject.InsertL(0,
|
|
2517 |
ConvertTo8LC(*(iEAPSettings->iCertificates[certId
|
|
2518 |
- 1]->GetSerialNumber())));
|
|
2519 |
CleanupStack::PopAndDestroy(); // ConvertTo8LC
|
|
2520 |
status = CSmlDmAdapter::EOk;
|
|
2521 |
}
|
|
2522 |
}
|
|
2523 |
}
|
|
2524 |
}
|
|
2525 |
|
|
2526 |
DBG_ARGS(_S16("CNSmlWLanAdapter::FetchLeafObjectL - Status <%D>"), status);
|
|
2527 |
_DBG_FILE("CNSmlWLanAdapter::FetchLeafObjectL(): end");
|
|
2528 |
return status;
|
|
2529 |
}
|
|
2530 |
|
|
2531 |
//-----------------------------------------------------------------------------
|
|
2532 |
// CNSmlWLanAdapter* CNSmlWLanAdapter::ChildURIListL( const TDesC& aURI,
|
|
2533 |
// const TDesC& aLUID, const CArrayFix<TNSmlDmMappingInfo>& aPreviousURISegmentList,
|
|
2534 |
// const TInt aResultsRef, const TInt aStatusRef )
|
|
2535 |
//-----------------------------------------------------------------------------
|
|
2536 |
void CNSmlWLanAdapter::ChildURIListL(const TDesC8& aURI, const TDesC8& aLUID,
|
|
2537 |
const CArrayFix<TSmlDmMappingInfo>& aPreviousURISegmentList,
|
|
2538 |
const TInt aResultsRef, const TInt aStatusRef)
|
|
2539 |
{
|
|
2540 |
_DBG_FILE("CNSmlWLanAdapter::ChildURIListL(): begin");
|
|
2541 |
DBG_ARGS8(_S8("WLanAdapter::ChildURIListL - <%S> <%S>"), &aURI, &aLUID);
|
|
2542 |
CBufBase* currentUriSegmentList = CBufFlat::NewL(128);
|
|
2543 |
CleanupStack::PushL(currentUriSegmentList);
|
|
2544 |
|
|
2545 |
TInt uriSegs = NumOfUriSegs(aURI);
|
|
2546 |
TInt luid = GetIdFromLuid(aLUID);
|
|
2547 |
|
|
2548 |
//AP/<x>/NAPDef/<x>/
|
|
2549 |
if (aURI.Match(_L8("AP/*/NAPDef/*")) != KErrNotFound && uriSegs == 4)
|
|
2550 |
{
|
|
2551 |
DBG_ARGS8(_S8("WLanAdapter::ChildURIListL->NAPDef - <%S> <%S>"),
|
|
2552 |
&aURI, &aLUID);
|
|
2553 |
if (luid == KErrNotFound)
|
|
2554 |
{
|
|
2555 |
return;
|
|
2556 |
}
|
|
2557 |
if (iWlanSettings->RecordExists(luid) < 0)
|
|
2558 |
{
|
|
2559 |
currentUriSegmentList->InsertL(0, KNSmlNAPDefWlanNode);
|
|
2560 |
iCallBack->SetStatusL(aStatusRef, CSmlDmAdapter::EOk);
|
|
2561 |
iCallBack->SetResultsL(aResultsRef, *currentUriSegmentList,
|
|
2562 |
KNullDesC8);
|
|
2563 |
_DBG_FILE("CNSmlWLanAdapter::ChildURIListL(): status ok");
|
|
2564 |
}
|
|
2565 |
else
|
|
2566 |
{
|
|
2567 |
currentUriSegmentList->InsertL(0, KNSmlNAPDefWlanNode);
|
|
2568 |
currentUriSegmentList->InsertL(currentUriSegmentList->Size(),
|
|
2569 |
KNSmlWLan);
|
|
2570 |
iCallBack->SetStatusL(aStatusRef, CSmlDmAdapter::EOk);
|
|
2571 |
iCallBack->SetResultsL(aResultsRef, *currentUriSegmentList,
|
|
2572 |
KNullDesC8);
|
|
2573 |
_DBG_FILE("CNSmlWLanAdapter::ChildURIListL(): status ok");
|
|
2574 |
}
|
|
2575 |
}
|
|
2576 |
|
|
2577 |
//AP/<x>/NAPDef/<x>/WLAN
|
|
2578 |
else if (aURI.Match(_L8("AP/*/NAPDef/*/WLAN")) != KErrNotFound && uriSegs
|
|
2579 |
== 5)
|
|
2580 |
{
|
|
2581 |
if (aPreviousURISegmentList.Count() > 0)
|
|
2582 |
{
|
|
2583 |
HBufC8 *uriSeg = HBufC8::NewLC(KNSmlMaxURISegLen);
|
|
2584 |
TPtr8 uriSegPtr = uriSeg->Des();
|
|
2585 |
uriSegPtr = aPreviousURISegmentList.At(0).iURISeg;
|
|
2586 |
currentUriSegmentList->InsertL(currentUriSegmentList->Size(),
|
|
2587 |
uriSegPtr);
|
|
2588 |
CleanupStack::PopAndDestroy(uriSeg); //uriSeg
|
|
2589 |
iCallBack->SetStatusL(aStatusRef, CSmlDmAdapter::EOk);
|
|
2590 |
iCallBack->SetResultsL(aResultsRef, *currentUriSegmentList,
|
|
2591 |
KNullDesC8);
|
|
2592 |
_DBG_FILE("CNSmlWLanAdapter::ChildURIListL(): status ok");
|
|
2593 |
}
|
|
2594 |
else
|
|
2595 |
{
|
|
2596 |
if (luid == KErrNotFound)
|
|
2597 |
{
|
|
2598 |
return;
|
|
2599 |
}
|
|
2600 |
if (iWlanSettings->RecordExists(luid) < 0)
|
|
2601 |
{
|
|
2602 |
iCallBack->SetStatusL(aStatusRef, CSmlDmAdapter::ENotFound);
|
|
2603 |
_DBG_FILE(
|
|
2604 |
"CNSmlWLanAdapter::ChildURIListL(): status: Not found");
|
|
2605 |
}
|
|
2606 |
else
|
|
2607 |
{
|
|
2608 |
_LIT8(Kprev, "WLId");
|
|
2609 |
TBuf8<9> addNAME(Kprev); // WLId
|
|
2610 |
addNAME.AppendNumFixedWidth(luid, EDecimal, 3);
|
|
2611 |
|
|
2612 |
currentUriSegmentList->InsertL(currentUriSegmentList->Size(),
|
|
2613 |
addNAME);
|
|
2614 |
currentUriSegmentList->InsertL(currentUriSegmentList->Size(),
|
|
2615 |
_L8("/"));
|
|
2616 |
|
|
2617 |
TBuf8<80> addURI; // AP/<x>/NapDef/<x>/WLAN/WLIdnnn , n=aLUID
|
|
2618 |
addURI.Append(aURI);
|
|
2619 |
addURI.Append(_L8("/WLId"));
|
|
2620 |
addURI.AppendNumFixedWidth(luid, EDecimal, 3);
|
|
2621 |
|
|
2622 |
TBuf8<16> addLUID;
|
|
2623 |
_LIT8(KFormat, "%d");
|
|
2624 |
addLUID.Format(KFormat, luid);
|
|
2625 |
|
|
2626 |
// Also added to mapping
|
|
2627 |
DBG_ARGS8(
|
|
2628 |
_S8(
|
|
2629 |
"WLanAdapter::ChildURIListL - mapping uri: <%S> to luid: <%S>"),
|
|
2630 |
&addURI, &addLUID);
|
|
2631 |
DBG_ARGS8(_S8("Parameters - <%S> <%S>"), &aURI, &aLUID);
|
|
2632 |
iCallBack->SetMappingL(addURI, addLUID);
|
|
2633 |
iCallBack->SetStatusL(aStatusRef, CSmlDmAdapter::EOk);
|
|
2634 |
iCallBack->SetResultsL(aResultsRef, *currentUriSegmentList,
|
|
2635 |
KNullDesC8);
|
|
2636 |
_DBG_FILE("CNSmlWLanAdapter::ChildURIListL(): status ok");
|
|
2637 |
}
|
|
2638 |
}
|
|
2639 |
}
|
|
2640 |
|
|
2641 |
//AP/<x>/NAPDef/<x>/WLAN/<x>
|
|
2642 |
else if (aURI.Match(_L8("AP/*/NAPDef/*/WLAN/*")) != KErrNotFound
|
|
2643 |
&& uriSegs == 6)
|
|
2644 |
{
|
|
2645 |
DBG_ARGS8(_S8("WLanAdapter::ChildURIListL->NAPDef - <%S> <%S>"),
|
|
2646 |
&aURI, &aLUID);
|
|
2647 |
if (luid == KErrNotFound)
|
|
2648 |
{
|
|
2649 |
return;
|
|
2650 |
}
|
|
2651 |
if (iWlanSettings->RecordExists(luid) < 0)
|
|
2652 |
{
|
|
2653 |
iCallBack->SetStatusL(aStatusRef, CSmlDmAdapter::ENotFound);
|
|
2654 |
_DBG_FILE("CNSmlWLanAdapter::ChildURIListL(): ENotFound end");
|
|
2655 |
}
|
|
2656 |
else
|
|
2657 |
{
|
|
2658 |
currentUriSegmentList->InsertL(currentUriSegmentList->Size(),
|
|
2659 |
KNSmlWLanListOfLeafs);
|
|
2660 |
iCallBack->SetStatusL(aStatusRef, CSmlDmAdapter::EOk);
|
|
2661 |
iCallBack->SetResultsL(aResultsRef, *currentUriSegmentList,
|
|
2662 |
KNullDesC8);
|
|
2663 |
_DBG_FILE("CNSmlWLanAdapter::ChildURIListL(): status ok");
|
|
2664 |
}
|
|
2665 |
}
|
|
2666 |
|
|
2667 |
//AP/<x>/NAPDef/<x>/WLAN/<x>/WEPKey
|
|
2668 |
else if (aURI.Match(_L8("AP/*/NAPDef/*/WLAN/*/WEPKey")) != KErrNotFound
|
|
2669 |
&& uriSegs == 7)
|
|
2670 |
{
|
|
2671 |
DBG_ARGS8(_S8(
|
|
2672 |
"WLanAdapter::ChildURIListL->WEPKey - <%S> <%S> <%D> <%D>"),
|
|
2673 |
&aURI, &aLUID, aResultsRef, aStatusRef);
|
|
2674 |
|
|
2675 |
for (TInt i = 0; i < 4; i++)
|
|
2676 |
{
|
|
2677 |
if (aPreviousURISegmentList.Count() > i)
|
|
2678 |
{
|
|
2679 |
HBufC8 *uriSeg = HBufC8::NewLC(KNSmlMaxURISegLen);
|
|
2680 |
TPtr8 uriSegPtr = uriSeg->Des();
|
|
2681 |
uriSegPtr = aPreviousURISegmentList.At(i).iURISeg;
|
|
2682 |
|
|
2683 |
currentUriSegmentList->InsertL(currentUriSegmentList->Size(),
|
|
2684 |
uriSegPtr);
|
|
2685 |
currentUriSegmentList->InsertL(currentUriSegmentList->Size(),
|
|
2686 |
_L8("/"));
|
|
2687 |
CleanupStack::PopAndDestroy(); //uriSeg
|
|
2688 |
}
|
|
2689 |
else
|
|
2690 |
{
|
|
2691 |
TBuf8<25> addNAME;
|
|
2692 |
addNAME.Append(_L8("WKId"));
|
|
2693 |
addNAME.AppendNum(i + 1);
|
|
2694 |
addNAME.Append(_L8("/"));
|
|
2695 |
|
|
2696 |
currentUriSegmentList->InsertL(currentUriSegmentList->Size(),
|
|
2697 |
addNAME);
|
|
2698 |
}
|
|
2699 |
}
|
|
2700 |
|
|
2701 |
iCallBack->SetStatusL(aStatusRef, CSmlDmAdapter::EOk);
|
|
2702 |
iCallBack->SetResultsL(aResultsRef, *currentUriSegmentList,
|
|
2703 |
KNullDesC8);
|
|
2704 |
_DBG_FILE("CNSmlWLanAdapter::ChildURIListL(): status ok");
|
|
2705 |
}
|
|
2706 |
|
|
2707 |
//AP/<x>/NAPDef/<x>/WEPKey/<x>
|
|
2708 |
else if (aURI.Match(_L8("AP/*/NAPDef/*/WLAN/*/WEPKey/*")) != KErrNotFound
|
|
2709 |
&& uriSegs == 8)
|
|
2710 |
{
|
|
2711 |
DBG_ARGS8(_S8("WLanAdapter::ChildURIListL->WEPKey/* - <%S> <%D>"),
|
|
2712 |
&aURI, luid);
|
|
2713 |
if (luid == KErrNotFound)
|
|
2714 |
{
|
|
2715 |
return;
|
|
2716 |
}
|
|
2717 |
if (iWlanSettings->RecordExists(luid) < 0)
|
|
2718 |
{
|
|
2719 |
//wlan settings not found for aLUID
|
|
2720 |
iCallBack->SetStatusL(aStatusRef, CSmlDmAdapter::ENotFound);
|
|
2721 |
_DBG_FILE("CNSmlWLanAdapter::ChildURIListL(): ENotFound end");
|
|
2722 |
}
|
|
2723 |
else
|
|
2724 |
{
|
|
2725 |
TInt wepKeyId = GetWepKeyIdFromLuid(aLUID);
|
|
2726 |
if (wepKeyId == KErrNotFound)
|
|
2727 |
{
|
|
2728 |
wepKeyId = GetWepKeyIdFromUri(aURI);
|
|
2729 |
|
|
2730 |
TBuf8<80> addLUID; // AP/<x>/NapDef/<x>/WLAN/<x>/WEPKey/WKIdnnn
|
|
2731 |
addLUID.AppendNum(wepKeyId);
|
|
2732 |
addLUID.AppendNumFixedWidth(luid, EDecimal, 3);
|
|
2733 |
|
|
2734 |
DBG_ARGS8(
|
|
2735 |
_S8(
|
|
2736 |
"WLanAdapter::ChildURIListL - mapping uri: <%S> to luid: <%S>"),
|
|
2737 |
&aURI, &addLUID);
|
|
2738 |
DBG_ARGS8(_S8("Parametrit - <%S> <%S>"), &aURI, &addLUID);
|
|
2739 |
iCallBack->SetMappingL(aURI, addLUID);
|
|
2740 |
}
|
|
2741 |
|
|
2742 |
currentUriSegmentList->InsertL(currentUriSegmentList->Size(),
|
|
2743 |
KNSmlWLanListOfWepKeyLeafs);
|
|
2744 |
iCallBack->SetStatusL(aStatusRef, CSmlDmAdapter::EOk);
|
|
2745 |
iCallBack->SetResultsL(aResultsRef, *currentUriSegmentList,
|
|
2746 |
KNullDesC8);
|
|
2747 |
_DBG_FILE("CNSmlWLanAdapter::ChildURIListL(): status ok");
|
|
2748 |
}
|
|
2749 |
}
|
|
2750 |
|
|
2751 |
//AP/<x>/NAPDef/<x>/WLAN/<x>/SecondarySSID/
|
|
2752 |
else if (aURI.Match(_L8("AP/*/NAPDef/*/WLAN/*/SecondarySSID"))
|
|
2753 |
!= KErrNotFound && uriSegs == 7)
|
|
2754 |
{
|
|
2755 |
DBG_ARGS8(
|
|
2756 |
_S8("WLanAdapter::ChildURIListL->EAP - <%S> <%S> <%D> <%D>"),
|
|
2757 |
&aURI, &aLUID, aResultsRef, aStatusRef);
|
|
2758 |
if (aPreviousURISegmentList.Count() > 0)
|
|
2759 |
{
|
|
2760 |
HBufC8 *uriSeg = HBufC8::NewLC(KNSmlMaxURISegLen);
|
|
2761 |
TPtr8 uriSegPtr = uriSeg->Des();
|
|
2762 |
uriSegPtr = aPreviousURISegmentList.At(0).iURISeg;
|
|
2763 |
currentUriSegmentList->InsertL(currentUriSegmentList->Size(),
|
|
2764 |
uriSegPtr);
|
|
2765 |
CleanupStack::PopAndDestroy(uriSeg); //uriSeg
|
|
2766 |
iCallBack->SetStatusL(aStatusRef, CSmlDmAdapter::EOk);
|
|
2767 |
iCallBack->SetResultsL(aResultsRef, *currentUriSegmentList,
|
|
2768 |
KNullDesC8);
|
|
2769 |
_DBG_FILE("CNSmlWLanAdapter::ChildURIListL(): status ok");
|
|
2770 |
}
|
|
2771 |
else
|
|
2772 |
{
|
|
2773 |
if (luid == KErrNotFound)
|
|
2774 |
{
|
|
2775 |
return;
|
|
2776 |
}
|
|
2777 |
if (iWlanSettings->RecordExists(luid) < 0)
|
|
2778 |
{
|
|
2779 |
iCallBack->SetStatusL(aStatusRef, CSmlDmAdapter::ENotFound);
|
|
2780 |
_DBG_FILE(
|
|
2781 |
"CNSmlWLanAdapter::ChildURIListL(): status: Not found");
|
|
2782 |
}
|
|
2783 |
else
|
|
2784 |
{
|
|
2785 |
RArray<TSecondarySSID> secondarySSIDs;
|
|
2786 |
CleanupClosePushL(secondarySSIDs);
|
|
2787 |
iWlanSettings->GetSecondarySSIDListL(luid, secondarySSIDs);
|
|
2788 |
TInt count = secondarySSIDs.Count();
|
|
2789 |
_LIT8(KPrefixSSID, "SecSSID");
|
|
2790 |
TBuf8<5> addNAME; // number
|
|
2791 |
for (TInt i = 0; i < count; i++)
|
|
2792 |
{
|
|
2793 |
if (i != 0) // Don't do it in first iteration, but with all the following
|
|
2794 |
{
|
|
2795 |
currentUriSegmentList->InsertL(
|
|
2796 |
currentUriSegmentList->Size(), _L8("/"));
|
|
2797 |
}
|
|
2798 |
currentUriSegmentList->InsertL(
|
|
2799 |
currentUriSegmentList->Size(), KPrefixSSID);
|
|
2800 |
addNAME.Zero();
|
|
2801 |
addNAME.AppendNumFixedWidth(secondarySSIDs[i].Id,
|
|
2802 |
EDecimal, 3);
|
|
2803 |
currentUriSegmentList->InsertL(
|
|
2804 |
currentUriSegmentList->Size(), addNAME);
|
|
2805 |
}
|
|
2806 |
CleanupStack::PopAndDestroy(&secondarySSIDs);
|
|
2807 |
iCallBack->SetStatusL(aStatusRef, CSmlDmAdapter::EOk);
|
|
2808 |
iCallBack->SetResultsL(aResultsRef, *currentUriSegmentList,
|
|
2809 |
KNullDesC8);
|
|
2810 |
_DBG_FILE("CNSmlWLanAdapter::ChildURIListL(): status ok");
|
|
2811 |
}
|
|
2812 |
}
|
|
2813 |
}
|
|
2814 |
//AP/<x>/NAPDef/<x>/WLAN/<x>/SecondarySSID/*
|
|
2815 |
else if (aURI.Match(_L8("AP/*/NAPDef/*/WLAN/*/SecondarySSID/*"))
|
|
2816 |
!= KErrNotFound && uriSegs == 8)
|
|
2817 |
{
|
|
2818 |
DBG_ARGS8(_S8(
|
|
2819 |
"WLanAdapter::ChildURIListL->SecondarySSID/* - <%S> <%D>"),
|
|
2820 |
&aURI, luid);
|
|
2821 |
if (luid == KErrNotFound)
|
|
2822 |
{
|
|
2823 |
return;
|
|
2824 |
}
|
|
2825 |
if (iWlanSettings->RecordExists(luid) < 0)
|
|
2826 |
{
|
|
2827 |
//wlan settings not found for aLUID
|
|
2828 |
iCallBack->SetStatusL(aStatusRef, CSmlDmAdapter::ENotFound);
|
|
2829 |
_DBG_FILE("CNSmlWLanAdapter::ChildURIListL(): ENotFound end");
|
|
2830 |
}
|
|
2831 |
else
|
|
2832 |
{
|
|
2833 |
currentUriSegmentList->InsertL(currentUriSegmentList->Size(),
|
|
2834 |
KNSmlWLanListOfSecondaryLeafs);
|
|
2835 |
iCallBack->SetStatusL(aStatusRef, CSmlDmAdapter::EOk);
|
|
2836 |
iCallBack->SetResultsL(aResultsRef, *currentUriSegmentList,
|
|
2837 |
KNullDesC8);
|
|
2838 |
_DBG_FILE("CNSmlWLanAdapter::ChildURIListL(): status ok");
|
|
2839 |
}
|
|
2840 |
}
|
|
2841 |
//AP/<x>/NAPDef/<x>/WLAN/<x>/EAP
|
|
2842 |
else if (aURI.Match(_L8("AP/*/NAPDef/*/WLAN/*/EAP")) != KErrNotFound
|
|
2843 |
&& uriSegs == 7)
|
|
2844 |
{
|
|
2845 |
DBG_ARGS8(
|
|
2846 |
_S8("WLanAdapter::ChildURIListL->EAP - <%S> <%S> <%D> <%D>"),
|
|
2847 |
&aURI, &aLUID, aResultsRef, aStatusRef);
|
|
2848 |
|
|
2849 |
// Need to get the service id from parent node
|
|
2850 |
luid = GetServiceIdFromUriL(aURI);
|
|
2851 |
|
|
2852 |
if (luid == KErrNotFound)
|
|
2853 |
{
|
|
2854 |
return;
|
|
2855 |
}
|
|
2856 |
if (iWlanSettings->RecordExists(luid) < 0)
|
|
2857 |
{
|
|
2858 |
//wlan settings not found for aLUID
|
|
2859 |
iCallBack->SetStatusL(aStatusRef, CSmlDmAdapter::ENotFound);
|
|
2860 |
_DBG_FILE("CNSmlWLanAdapter::ChildURIListL(): ENotFound end");
|
|
2861 |
}
|
|
2862 |
else
|
|
2863 |
{
|
|
2864 |
iWlanSettings->InstalledEAPsL(*currentUriSegmentList);
|
|
2865 |
|
|
2866 |
iCallBack->SetStatusL(aStatusRef, CSmlDmAdapter::EOk);
|
|
2867 |
iCallBack->SetResultsL(aResultsRef, *currentUriSegmentList,
|
|
2868 |
KNullDesC8);
|
|
2869 |
_DBG_FILE("CNSmlWLanAdapter::ChildURIListL(): status ok");
|
|
2870 |
}
|
|
2871 |
}
|
|
2872 |
//AP/<x>/NAPDef/<x>/WLAN/<x>/EAP/<x>
|
|
2873 |
else if (aURI.Match(_L8("AP/*/NAPDef/*/WLAN/*/EAP/*")) != KErrNotFound
|
|
2874 |
&& uriSegs == 8)
|
|
2875 |
{
|
|
2876 |
// Need to get the service id from parent node
|
|
2877 |
luid = GetServiceIdFromUriL(aURI);
|
|
2878 |
|
|
2879 |
DBG_ARGS8(_S8("WLanAdapter::ChildURIListL->EAP/* - <%S> <%D>"),
|
|
2880 |
&aURI, luid);
|
|
2881 |
if (iWlanSettings->RecordExists(luid) < 0)
|
|
2882 |
{
|
|
2883 |
//wlan settings not found for aLUID
|
|
2884 |
iCallBack->SetStatusL(aStatusRef, CSmlDmAdapter::ENotFound);
|
|
2885 |
_DBG_FILE("CNSmlWLanAdapter::ChildURIListL(): ENotFound end");
|
|
2886 |
}
|
|
2887 |
else
|
|
2888 |
{
|
|
2889 |
currentUriSegmentList->InsertL(currentUriSegmentList->Size(),
|
|
2890 |
KNSmlWLanListOfEAPLeafs);
|
|
2891 |
iCallBack->SetStatusL(aStatusRef, CSmlDmAdapter::EOk);
|
|
2892 |
iCallBack->SetResultsL(aResultsRef, *currentUriSegmentList,
|
|
2893 |
KNullDesC8);
|
|
2894 |
_DBG_FILE("CNSmlWLanAdapter::ChildURIListL(): status ok");
|
|
2895 |
}
|
|
2896 |
}
|
|
2897 |
//AP/<x>/NAPDef/<x>/WLAN/<x>/EAP/<x>/Certificate
|
|
2898 |
else if (aURI.Match(_L8("AP/*/NAPDef/*/WLAN/*/EAP/*/Certificate"))
|
|
2899 |
!= KErrNotFound && uriSegs == 9)
|
|
2900 |
{
|
|
2901 |
luid = GetServiceIdFromUriL(aURI);
|
|
2902 |
|
|
2903 |
DBG_ARGS8(_S8("WLanAdapter::ChildURIListL->Certificate - <%S> <%D>"),
|
|
2904 |
&aURI, luid);
|
|
2905 |
if (iWlanSettings->RecordExists(luid) < 0)
|
|
2906 |
{
|
|
2907 |
//wlan settings not found for aLUID
|
|
2908 |
iCallBack->SetStatusL(aStatusRef, CSmlDmAdapter::ENotFound);
|
|
2909 |
_DBG_FILE("CNSmlWLanAdapter::ChildURIListL(): ENotFound end");
|
|
2910 |
}
|
|
2911 |
else
|
|
2912 |
{
|
|
2913 |
TInt eapId = GetEAPIdFromUri(aURI);
|
|
2914 |
|
|
2915 |
// Check if the id contains encapsulating type as well
|
|
2916 |
TInt encapsEapId = GetEncapsEAPIdFromUri(aURI);
|
|
2917 |
if (encapsEapId == KErrNotFound)
|
|
2918 |
{
|
|
2919 |
encapsEapId = EEapNone;
|
|
2920 |
}
|
|
2921 |
|
|
2922 |
ResetEAPStructL();
|
|
2923 |
TEapExpandedType expandedTypecmbuf;
|
|
2924 |
TEapExpandedType expandedTypeencapscmbuf;
|
|
2925 |
|
|
2926 |
GetExpandedType(eapId, encapsEapId, expandedTypecmbuf,
|
|
2927 |
expandedTypeencapscmbuf);
|
|
2928 |
|
|
2929 |
TInt err = iWlanSettings->GetEAPSettings(luid, expandedTypecmbuf,
|
|
2930 |
expandedTypeencapscmbuf, *iEAPSettings);
|
|
2931 |
if (err != KErrNone || !iEAPSettings->iCertificatesPresent)
|
|
2932 |
{
|
|
2933 |
iCallBack->SetStatusL(aStatusRef, CSmlDmAdapter::ENotFound);
|
|
2934 |
_DBG_FILE("CNSmlWLanAdapter::ChildURIListL(): ENotFound end");
|
|
2935 |
}
|
|
2936 |
else
|
|
2937 |
{
|
|
2938 |
TInt certCount = iEAPSettings->iCertificates.Count();
|
|
2939 |
HBufC8* pBuf = HBufC8::NewLC(KNSmlMaxURISegLen);
|
|
2940 |
TPtr8 ptrCerts = pBuf->Des();
|
|
2941 |
for (TInt i = 0; i < certCount; i++)
|
|
2942 |
{
|
|
2943 |
ptrCerts.Append(_L8("CertId"));
|
|
2944 |
ptrCerts.AppendNumFixedWidth(i + 1, EDecimal, 3);
|
|
2945 |
ptrCerts.Append(_L8("/"));
|
|
2946 |
}
|
|
2947 |
|
|
2948 |
currentUriSegmentList->InsertL(currentUriSegmentList->Size(),
|
|
2949 |
ptrCerts);
|
|
2950 |
CleanupStack::PopAndDestroy(pBuf); // pBuf
|
|
2951 |
iCallBack->SetStatusL(aStatusRef, CSmlDmAdapter::EOk);
|
|
2952 |
iCallBack->SetResultsL(aResultsRef, *currentUriSegmentList,
|
|
2953 |
KNullDesC8);
|
|
2954 |
_DBG_FILE("CNSmlWLanAdapter::ChildURIListL(): status ok");
|
|
2955 |
}
|
|
2956 |
}
|
|
2957 |
}
|
|
2958 |
//AP/<x>/NAPDef/<x>/WLAN/<x>/EAP/<x>/Certificate/<x>
|
|
2959 |
else if (aURI.Match(_L8("AP/*/NAPDef/*/WLAN/*/EAP/*/Certificate/*"))
|
|
2960 |
!= KErrNotFound && uriSegs == 10)
|
|
2961 |
{
|
|
2962 |
DBG_ARGS8(_S8("WLanAdapter::ChildURIListL->EAP/* - <%S> <%D>"),
|
|
2963 |
&aURI, luid);
|
|
2964 |
TInt eapId = GetEAPIdFromUri(aURI);
|
|
2965 |
// Check if the id contains encapsulating type as well
|
|
2966 |
TInt encapsEapId = GetEncapsEAPIdFromUri(aURI);
|
|
2967 |
if (encapsEapId == KErrNotFound)
|
|
2968 |
{
|
|
2969 |
encapsEapId = EEapNone;
|
|
2970 |
}
|
|
2971 |
|
|
2972 |
ResetEAPStructL();
|
|
2973 |
TEapExpandedType expandedTypecmbuf;
|
|
2974 |
TEapExpandedType expandedTypeencapscmbuf;
|
|
2975 |
|
|
2976 |
GetExpandedType(eapId, encapsEapId, expandedTypecmbuf,
|
|
2977 |
expandedTypeencapscmbuf);
|
|
2978 |
|
|
2979 |
TInt err = iWlanSettings->GetEAPSettings(luid, expandedTypecmbuf,
|
|
2980 |
expandedTypeencapscmbuf, *iEAPSettings);
|
|
2981 |
if (err != KErrNone || !iEAPSettings->iCertificatesPresent)
|
|
2982 |
{
|
|
2983 |
iCallBack->SetStatusL(aStatusRef, CSmlDmAdapter::ENotFound);
|
|
2984 |
_DBG_FILE("CNSmlWLanAdapter::ChildURIListL(): ENotFound end");
|
|
2985 |
}
|
|
2986 |
else
|
|
2987 |
{
|
|
2988 |
currentUriSegmentList->InsertL(currentUriSegmentList->Size(),
|
|
2989 |
KNSmlWLanListOfCertificateLeafs);
|
|
2990 |
iCallBack->SetStatusL(aStatusRef, CSmlDmAdapter::EOk);
|
|
2991 |
iCallBack->SetResultsL(aResultsRef, *currentUriSegmentList,
|
|
2992 |
KNullDesC8);
|
|
2993 |
_DBG_FILE("CNSmlWLanAdapter::ChildURIListL(): status ok");
|
|
2994 |
}
|
|
2995 |
}
|
|
2996 |
|
|
2997 |
CleanupStack::PopAndDestroy(currentUriSegmentList);
|
|
2998 |
|
|
2999 |
_DBG_FILE("CNSmlWLanAdapter::ChildURIListL(): end");
|
|
3000 |
}
|
|
3001 |
|
|
3002 |
//-----------------------------------------------------------------------------
|
|
3003 |
// void CNSmlWLanAdapter::AddNodeObjectL( const TDesC& aURI, const TDesC& aParentLUID,
|
|
3004 |
// const TInt aStatusRef )
|
|
3005 |
//-----------------------------------------------------------------------------
|
|
3006 |
void CNSmlWLanAdapter::AddNodeObjectL(const TDesC8& aURI,
|
|
3007 |
const TDesC8& aParentLUID, const TInt aStatusRef)
|
|
3008 |
{
|
|
3009 |
_DBG_FILE("CNSmlWLanAdapter::AddNodeObjectL(): begin");
|
|
3010 |
DBG_ARGS8(_S8(
|
|
3011 |
"WLanAdapter::AddNodeObjectL - uri: <%S> to aParentLuid: <%S>"),
|
|
3012 |
&aURI, &aParentLUID);
|
|
3013 |
|
|
3014 |
TInt uriSegs = NumOfUriSegs(aURI);
|
|
3015 |
if ((aURI.Match(_L8("AP/*/NAPDef/*/WLAN")) != KErrNotFound && uriSegs
|
|
3016 |
== 5) || (aURI.Match(_L8("AP/*/NAPDef/*/WLAN/*/EAP"))
|
|
3017 |
!= KErrNotFound && uriSegs == 7) || (aURI.Match(_L8(
|
|
3018 |
"AP/*/NAPDef/*/WLAN/*/EAP/*/Certificate")) != KErrNotFound
|
|
3019 |
&& uriSegs == 9))
|
|
3020 |
{
|
|
3021 |
iCallBack->SetMappingL(aURI, aParentLUID);
|
|
3022 |
iCallBack->SetStatusL(aStatusRef, CSmlDmAdapter::EOk);
|
|
3023 |
return;
|
|
3024 |
}
|
|
3025 |
|
|
3026 |
//Add new wlan settings
|
|
3027 |
else if (aURI.Match(_L8("AP/*/NAPDef/*/WLAN/*")) != KErrNotFound
|
|
3028 |
&& NumOfUriSegs(aURI) == 6)
|
|
3029 |
{
|
|
3030 |
TBuf<KCommsDbSvrMaxFieldLength> serviceType;
|
|
3031 |
TUint32 serviceId(NULL);
|
67
|
3032 |
TUint32 lValue = 0;
|
47
|
3033 |
CCommsDbTableView* napdefView = iDatabase.OpenViewMatchingUintLC(
|
|
3034 |
TPtrC(IAP), TPtrC(COMMDB_ID), DesToInt(aParentLUID));
|
|
3035 |
TInt errorCode = napdefView->GotoFirstRecord();
|
|
3036 |
if (errorCode == KErrNone)
|
|
3037 |
{
|
|
3038 |
napdefView->ReadTextL(TPtrC(IAP_SERVICE_TYPE), serviceType);
|
|
3039 |
napdefView->ReadUintL(TPtrC(IAP_SERVICE), serviceId); // ID
|
|
3040 |
}
|
|
3041 |
CCommsDbTableView* tableView = iDatabase.OpenViewMatchingUintLC(
|
|
3042 |
serviceType, TPtrC(COMMDB_ID), serviceId);
|
|
3043 |
errorCode = tableView->GotoFirstRecord();
|
|
3044 |
if (errorCode == KErrNone)
|
|
3045 |
{
|
|
3046 |
tableView->ReadUintL(TPtrC(COMMDB_ID), lValue);
|
|
3047 |
}
|
|
3048 |
CleanupStack::PopAndDestroy();//tableview
|
|
3049 |
CleanupStack::PopAndDestroy();//napdefview
|
|
3050 |
|
|
3051 |
iSettings->Id = 0;
|
|
3052 |
iSettings->ServiceID = lValue;
|
|
3053 |
iSettings->ConnectionMode = 0;
|
|
3054 |
iSettings->SSID = TPtrC(KNSmlWLanDefaultSSID);
|
|
3055 |
iSettings->UsedSSID = _L("");
|
|
3056 |
iSettings->ScanSSID = 0;
|
|
3057 |
iSettings->WepKey1 = _L8("");
|
|
3058 |
iSettings->WepKey2 = _L8("");
|
|
3059 |
iSettings->WepKey3 = _L8("");
|
|
3060 |
iSettings->WepKey4 = _L8("");
|
|
3061 |
iSettings->WepIndex = 0;
|
|
3062 |
iSettings->SecurityMode = EAllowUnsecure;
|
|
3063 |
iSettings->WPAPreSharedKey = _L8("");
|
|
3064 |
iSettings->UseWPAPSK = 0;
|
|
3065 |
iSettings->EapList = _L("");
|
|
3066 |
iSettings->AuthMode = 0;
|
|
3067 |
|
|
3068 |
TInt err = iWlanSettings->WriteWlanSettings(*iSettings);
|
|
3069 |
if (err != KErrNone)
|
|
3070 |
{
|
|
3071 |
iCallBack->SetStatusL(aStatusRef, CSmlDmAdapter::EError);
|
|
3072 |
return;
|
|
3073 |
}
|
|
3074 |
|
|
3075 |
DBG_ARGS8(
|
|
3076 |
_S8(
|
|
3077 |
"WLanAdapter::AddNodeObjectL - mapping uri: <%S> to luid: <%S>"),
|
|
3078 |
&aURI, &aParentLUID);
|
|
3079 |
iCallBack->SetMappingL(aURI, aParentLUID);
|
|
3080 |
iCallBack->SetStatusL(aStatusRef, CSmlDmAdapter::EOk);
|
|
3081 |
}
|
|
3082 |
|
|
3083 |
else if (aURI.Match(_L8("AP/*/NAPDef/*/WLAN/*/WEPKey")) != KErrNotFound
|
|
3084 |
&& uriSegs == 7)
|
|
3085 |
{
|
|
3086 |
if (iWlanSettings->RecordExists(DesToInt(aParentLUID)))
|
|
3087 |
iCallBack->SetStatusL(aStatusRef, CSmlDmAdapter::EOk);
|
|
3088 |
else
|
|
3089 |
iCallBack->SetStatusL(aStatusRef, CSmlDmAdapter::ENotFound);
|
|
3090 |
return;
|
|
3091 |
}
|
|
3092 |
|
|
3093 |
//Add wep key for existing record
|
|
3094 |
else if (aURI.Match(_L8("AP/*/NAPDef/*/WLAN/*/WEPKey/*")) != KErrNotFound
|
|
3095 |
&& uriSegs == 8)
|
|
3096 |
{
|
|
3097 |
for (TInt i = 0; i < iBuffer->Count(); i++)
|
|
3098 |
{
|
|
3099 |
if (iBuffer->At(i).iUri->Match(aURI) != KErrNotFound)
|
|
3100 |
{
|
|
3101 |
iCallBack->SetStatusL(aStatusRef,
|
|
3102 |
CSmlDmAdapter::EAlreadyExists);
|
|
3103 |
|
|
3104 |
_DBG_FILE(
|
|
3105 |
"CNSmlWLanAdapter::AddNodeObjectL(): EAlreadyExists");
|
|
3106 |
return;
|
|
3107 |
}
|
|
3108 |
}
|
|
3109 |
DBG_ARGS8(_S8(
|
|
3110 |
"WLanAdapter::Bufferiin - uri: <%S> to aParentLuid: <%S>"),
|
|
3111 |
&aURI, &aParentLUID);
|
|
3112 |
|
|
3113 |
TNSmlWepKeyBufferElement newNode;
|
|
3114 |
newNode.iUri = aURI.AllocLC();
|
|
3115 |
newNode.iData = 0;
|
|
3116 |
newNode.iWepKeyId = 0;
|
|
3117 |
//newNode.iUseWPAPSK = 0;
|
|
3118 |
newNode.iIdStatusRef = 0;
|
|
3119 |
newNode.iDataStatusRef = 0;
|
|
3120 |
newNode.iLengthStatusRef = 0;
|
|
3121 |
newNode.iNodeStatusRef = aStatusRef;
|
|
3122 |
newNode.iExecuted = EFalse;
|
|
3123 |
newNode.iDataSet = EFalse;
|
|
3124 |
newNode.iLuid = DesToInt(aParentLUID);
|
|
3125 |
iBuffer->AppendL(newNode);
|
|
3126 |
|
|
3127 |
CleanupStack::Pop(); //newNode.iUri
|
|
3128 |
|
|
3129 |
_DBG_FILE("CNSmlWLanAdapter::AddNodeObjectL(): end");
|
|
3130 |
return;
|
|
3131 |
}
|
|
3132 |
|
|
3133 |
else if (aURI.Match(_L8("AP/*/NAPDef/*/WLAN/*/SecondarySSID/*"))
|
|
3134 |
!= KErrNotFound && NumOfUriSegs(aURI) == 8)
|
|
3135 |
{
|
|
3136 |
/*
|
|
3137 |
TSecondarySSID ssid;
|
|
3138 |
ssid.ScannedId = KNullDesC;
|
|
3139 |
ssid.UsedId = KNullDesC;
|
|
3140 |
TInt luid = GetIdFromLuid( aParentLUID );
|
|
3141 |
TInt retval = iWlanSettings->WriteSecondarySSIDL(luid, ssid, ETrue);*/
|
|
3142 |
|
|
3143 |
TNSmlSecondarySSIDBufferElement *newSecNode =
|
|
3144 |
new (ELeave) TNSmlSecondarySSIDBufferElement;
|
|
3145 |
;
|
|
3146 |
newSecNode->iUri = aURI.AllocLC();
|
|
3147 |
newSecNode->ScannedId = KNullDesC;
|
|
3148 |
newSecNode->UsedId = KNullDesC;
|
|
3149 |
newSecNode->iExecuted = EFalse;
|
|
3150 |
newSecNode->wlanLuid = GetIdFromLuid(aParentLUID);
|
|
3151 |
iSecondaryBuffer.AppendL(newSecNode);
|
|
3152 |
CleanupStack::Pop(); //newNode.iUri
|
|
3153 |
return;
|
|
3154 |
}
|
|
3155 |
|
|
3156 |
else if (aURI.Match(_L8("AP/*/NAPDef/*/WLAN/*/EAP/*")) != KErrNotFound
|
|
3157 |
&& NumOfUriSegs(aURI) == 8)
|
|
3158 |
{
|
|
3159 |
TInt eapTypeId = GetEAPIdFromUri(aURI);
|
|
3160 |
TInt encapsEapId = GetEncapsEAPIdFromUri(aURI);
|
|
3161 |
if (encapsEapId == KErrNotFound)
|
|
3162 |
{
|
|
3163 |
encapsEapId = EEapNone;
|
|
3164 |
}
|
|
3165 |
|
|
3166 |
TInt WLANServiceId = GetServiceIdFromUriL(aURI);
|
|
3167 |
|
|
3168 |
if (WLANServiceId == KErrNotFound)
|
|
3169 |
{
|
|
3170 |
_DBG_FILE(
|
|
3171 |
"CNSmlWLanAdapter::AddNodeObjectL(): Could not find WLAN service ID from URI.");
|
|
3172 |
User::Leave(KErrNotFound);
|
|
3173 |
}
|
|
3174 |
// append it to the appropriate list ('+' enabled, '-' disabled)
|
|
3175 |
_LIT8(KPadding, "\xFE\0\0\0\0\0\0");
|
|
3176 |
_LIT8(KMsChapV2Padding, "\xFE\xFF\xFF\xFF\0\0\0");
|
|
3177 |
const TInt KPlainMsChapV2ImplUid = 99;
|
|
3178 |
|
|
3179 |
TBuf8<KExpandedEapIdLength> cmpbuf;
|
|
3180 |
if (eapTypeId == KPlainMsChapV2ImplUid)
|
|
3181 |
{
|
|
3182 |
cmpbuf.Append(KMsChapV2Padding);
|
|
3183 |
}
|
|
3184 |
else
|
|
3185 |
{
|
|
3186 |
cmpbuf.Append(KPadding);
|
|
3187 |
}
|
|
3188 |
cmpbuf.Append(eapTypeId);
|
|
3189 |
TEapExpandedType expandedTypecmbuf(cmpbuf);
|
|
3190 |
|
|
3191 |
TBuf8<KExpandedEapIdLength> encapscmpbuf;
|
|
3192 |
if (encapsEapId == KPlainMsChapV2ImplUid)
|
|
3193 |
{
|
|
3194 |
encapscmpbuf.Append(KMsChapV2Padding);
|
|
3195 |
}
|
|
3196 |
else
|
|
3197 |
{
|
|
3198 |
encapscmpbuf.Append(KPadding);
|
|
3199 |
}
|
|
3200 |
encapscmpbuf.Append(encapsEapId);
|
|
3201 |
TEapExpandedType expandedTypeencapscmbuf(encapscmpbuf);
|
|
3202 |
|
|
3203 |
TInt i(0);
|
|
3204 |
// Check if the buffer for this EAP already exists
|
|
3205 |
for (i = 0; i < iEAPBuffer.Count(); i++)
|
|
3206 |
{
|
|
3207 |
if ((expandedTypecmbuf.Compare(
|
|
3208 |
iEAPBuffer[i]->iEAPSettings->iEAPExpandedType) == 0)
|
|
3209 |
&& (expandedTypeencapscmbuf.Compare(
|
|
3210 |
iEAPBuffer[i]->iEncapsulatingExpandedEapId) == 0))
|
|
3211 |
{
|
|
3212 |
// The correct buffer was found.
|
|
3213 |
_DBG_FILE(
|
|
3214 |
"CNSmlWLanAdapter::AddNodeObjectL(): Found existing buffer.");
|
|
3215 |
break;
|
|
3216 |
}
|
|
3217 |
}
|
|
3218 |
// buffer did not exist. Update the existing buffer
|
|
3219 |
if (i == iEAPBuffer.Count())
|
|
3220 |
{
|
|
3221 |
TNSmlEAPBufferElement* buffer =
|
|
3222 |
new (ELeave) TNSmlEAPBufferElement;
|
|
3223 |
CleanupStack::PushL(buffer);
|
|
3224 |
|
|
3225 |
buffer->iEAPSettings = new (ELeave) EAPSettings;
|
|
3226 |
CleanupStack::PushL(buffer->iEAPSettings);
|
|
3227 |
|
|
3228 |
TBuf8<KExpandedEapIdLength> tempbuf;
|
|
3229 |
if (eapTypeId == KPlainMsChapV2ImplUid)
|
|
3230 |
{
|
|
3231 |
tempbuf.Append(KMsChapV2Padding);
|
|
3232 |
}
|
|
3233 |
else
|
|
3234 |
{
|
|
3235 |
tempbuf.Append(KPadding);
|
|
3236 |
}
|
|
3237 |
tempbuf.Append(eapTypeId);
|
|
3238 |
|
|
3239 |
buffer->iEAPSettings->iEAPExpandedType = tempbuf;
|
|
3240 |
buffer->iStatusRefArray.AppendL(aStatusRef);
|
|
3241 |
buffer->iWLANServiceId = WLANServiceId;
|
|
3242 |
ConvertEAPStringToIds(buffer->iEapTypeString,
|
|
3243 |
buffer->iEAPSettings->iEAPExpandedType);
|
|
3244 |
TBuf8<KExpandedEapIdLength> encapsTempbuf;
|
|
3245 |
if (encapsEapId == KPlainMsChapV2ImplUid)
|
|
3246 |
{
|
|
3247 |
encapsTempbuf.Append(KMsChapV2Padding);
|
|
3248 |
}
|
|
3249 |
else
|
|
3250 |
{
|
|
3251 |
encapsTempbuf.Append(KPadding);
|
|
3252 |
}
|
|
3253 |
encapsTempbuf.Append(encapsEapId);
|
|
3254 |
buffer->iEncapsulatingExpandedEapId = encapsTempbuf;
|
|
3255 |
if (buffer->iEncapsulatingExpandedEapId
|
|
3256 |
!= (*EapExpandedTypeNone.GetType()))
|
|
3257 |
{
|
|
3258 |
ConvertEAPStringToIds(buffer->iEncapsulatingString,
|
|
3259 |
buffer->iEncapsulatingExpandedEapId);
|
|
3260 |
}
|
|
3261 |
iEAPBuffer.AppendL(buffer);
|
|
3262 |
|
|
3263 |
CleanupStack::Pop(buffer->iEAPSettings);
|
|
3264 |
CleanupStack::Pop(buffer);
|
|
3265 |
}
|
|
3266 |
|
|
3267 |
// Set the mapping luid to be the index to the iEAPBuffer
|
|
3268 |
TBuf8<2> luid;
|
|
3269 |
luid.Num(iEAPBuffer.Count() - 1);
|
|
3270 |
DBG_ARGS8(
|
|
3271 |
_S8(
|
|
3272 |
"WLanAdapter::AddNodeObjectL - mapping uri: <%S> to luid: <%S>"),
|
|
3273 |
&aURI, &luid);
|
|
3274 |
iCallBack->SetMappingL(aURI, luid);
|
|
3275 |
|
|
3276 |
}
|
|
3277 |
else if (aURI.Match(_L8("AP/*/NAPDef/*/WLAN/*/EAP/*/Certificate/*"))
|
|
3278 |
!= KErrNotFound && NumOfUriSegs(aURI) == 10)
|
|
3279 |
{
|
|
3280 |
TPtrC8 ptr = NSmlDmURI::ParentURI(aURI);
|
|
3281 |
TPtrC8 ptr2 = NSmlDmURI::ParentURI(ptr);
|
|
3282 |
|
|
3283 |
HBufC8* eapLuidBuf = iCallBack->GetLuidAllocL(ptr2);
|
|
3284 |
|
|
3285 |
TInt index = GetIdFromLuid(*eapLuidBuf);
|
|
3286 |
|
|
3287 |
delete eapLuidBuf;
|
|
3288 |
|
|
3289 |
EapCertificateEntry *entry = new (ELeave) EapCertificateEntry;
|
62
|
3290 |
TRAPD(err, iEAPBuffer[index]->iEAPSettings->iCertificates.AppendL(entry));
|
|
3291 |
if(err != KErrNone)
|
|
3292 |
{
|
|
3293 |
delete entry;
|
|
3294 |
DBG_ARGS(_S16(
|
|
3295 |
"CNSmlWLanAdapter::AddLeafObjectL - ErrorCode <%D>"),
|
|
3296 |
err);
|
|
3297 |
iCallBack->SetStatusL(aStatusRef, CSmlDmAdapter::EError);
|
|
3298 |
return;
|
|
3299 |
}
|
|
3300 |
|
47
|
3301 |
iEAPBuffer[index]->iEAPSettings->iCertificatesPresent = ETrue;
|
|
3302 |
iEAPBuffer[index]->iStatusRefArray.AppendL(aStatusRef);
|
|
3303 |
|
|
3304 |
TBuf8<2> luid;
|
|
3305 |
luid.Num(iEAPBuffer[index]->iEAPSettings->iCertificates.Count() - 1);
|
|
3306 |
|
|
3307 |
DBG_ARGS8(
|
|
3308 |
_S8(
|
|
3309 |
"WLanAdapter::AddNodeObjectL - mapping uri: <%S> to luid: <%S>"),
|
|
3310 |
&aURI, &luid);
|
|
3311 |
iCallBack->SetMappingL(aURI, luid);
|
|
3312 |
}
|
|
3313 |
_DBG_FILE("CNSmlWLanAdapter::AddNodeObjectL(): end");
|
|
3314 |
}
|
|
3315 |
|
|
3316 |
//------------------------------------------------------------------------------
|
|
3317 |
// CNSmlWLanAdapter::ExecuteCommandL
|
|
3318 |
// not supported
|
|
3319 |
//------------------------------------------------------------------------------
|
|
3320 |
void CNSmlWLanAdapter::ExecuteCommandL(const TDesC8& /*aURI*/,
|
|
3321 |
const TDesC8& /*aLUID*/, const TDesC8& /*aArgument*/,
|
|
3322 |
const TDesC8& /*aType*/, TInt aStatusRef)
|
|
3323 |
{
|
|
3324 |
_DBG_FILE("CNSmlWLanAdapter::ExecuteCommandL(): begin");
|
|
3325 |
iCallBack->SetStatusL(aStatusRef, CSmlDmAdapter::EError);
|
|
3326 |
_DBG_FILE("CNSmlWLanAdapter::ExecuteCommandL(): end");
|
|
3327 |
}
|
|
3328 |
|
|
3329 |
//------------------------------------------------------------------------------
|
|
3330 |
// CNSmlWLanAdapter::ExecuteCommandL ( .. RWriteStream ..)
|
|
3331 |
// not supported
|
|
3332 |
//------------------------------------------------------------------------------
|
|
3333 |
void CNSmlWLanAdapter::ExecuteCommandL(const TDesC8& /*aURI*/,
|
|
3334 |
const TDesC8& /*aLUID*/, RWriteStream*& /*aStream*/,
|
|
3335 |
const TDesC8& /*aType*/, TInt aStatusref)
|
|
3336 |
{
|
|
3337 |
_DBG_FILE("CNSmlWLanAdapter::ExecuteCommandL(): begin");
|
|
3338 |
iCallBack->SetStatusL(aStatusref, CSmlDmAdapter::EError);
|
|
3339 |
_DBG_FILE("CNSmlWLanAdapter::ExecuteCommandL(): end");
|
|
3340 |
}
|
|
3341 |
|
|
3342 |
//------------------------------------------------------------------------------
|
|
3343 |
// CNSmlWLanAdapter::CopyCommandL
|
|
3344 |
// not supported
|
|
3345 |
//------------------------------------------------------------------------------
|
|
3346 |
void CNSmlWLanAdapter::CopyCommandL(const TDesC8& /*aTargetURI*/,
|
|
3347 |
const TDesC8& /*aTargetLUID*/, const TDesC8& /* aSourceURI*/,
|
|
3348 |
const TDesC8& /*aSourceLUID*/, const TDesC8& /*aType*/,
|
|
3349 |
TInt aStatusRef)
|
|
3350 |
{
|
|
3351 |
_DBG_FILE("CNSmlWLanAdapter::CopyCommandL(): begin");
|
|
3352 |
iCallBack->SetStatusL(aStatusRef, CSmlDmAdapter::EError);
|
|
3353 |
_DBG_FILE("CNSmlWLanAdapter::CopyCommandL(): end");
|
|
3354 |
}
|
|
3355 |
//------------------------------------------------------------------------------
|
|
3356 |
// CNSmlWLanAdapter::StartAtomicL
|
|
3357 |
// not supported
|
|
3358 |
//------------------------------------------------------------------------------
|
|
3359 |
void CNSmlWLanAdapter::StartAtomicL()
|
|
3360 |
{
|
|
3361 |
_DBG_FILE("CNSmlWLanAdapter::StartAtomicL(): begin");
|
|
3362 |
_DBG_FILE("CNSmlWLanAdapter::StartAtomicL(): end");
|
|
3363 |
}
|
|
3364 |
|
|
3365 |
//------------------------------------------------------------------------------
|
|
3366 |
// CNSmlWLanAdapter::CommitAtomicL
|
|
3367 |
// not supported
|
|
3368 |
//------------------------------------------------------------------------------
|
|
3369 |
void CNSmlWLanAdapter::CommitAtomicL()
|
|
3370 |
{
|
|
3371 |
_DBG_FILE("CNSmlWLanAdapter::CommitAtomicL(): begin");
|
|
3372 |
_DBG_FILE("CNSmlWLanAdapter::CommitAtomicL(): end");
|
|
3373 |
}
|
|
3374 |
|
|
3375 |
//------------------------------------------------------------------------------
|
|
3376 |
// CNSmlWLanAdapter::RollbackAtomicL
|
|
3377 |
// returns EError
|
|
3378 |
//------------------------------------------------------------------------------
|
|
3379 |
void CNSmlWLanAdapter::RollbackAtomicL()
|
|
3380 |
{
|
|
3381 |
_DBG_FILE("CNSmlWLanAdapter::RollbackAtomicL(): begin");
|
|
3382 |
_DBG_FILE("CNSmlWLanAdapter::RollbackAtomicL(): end");
|
|
3383 |
}
|
|
3384 |
|
|
3385 |
//------------------------------------------------------------------------------
|
|
3386 |
// CNSmlWLanAdapter::StreamingSupport
|
|
3387 |
// returns EFalse
|
|
3388 |
//------------------------------------------------------------------------------
|
|
3389 |
|
|
3390 |
TBool CNSmlWLanAdapter::StreamingSupport(TInt& /*aItemSize*/)
|
|
3391 |
{
|
|
3392 |
_DBG_FILE("CNSmlWLanAdapter::StreamingSupport(): begin");
|
|
3393 |
_DBG_FILE("CNSmlWLanAdapter::StreamingSupport(): end");
|
|
3394 |
return EFalse;
|
|
3395 |
}
|
|
3396 |
|
|
3397 |
//------------------------------------------------------------------------------
|
|
3398 |
// CNSmlWLanAdapter::StreamCommittedL
|
|
3399 |
// not used in this adapter
|
|
3400 |
//------------------------------------------------------------------------------
|
|
3401 |
|
|
3402 |
void CNSmlWLanAdapter::StreamCommittedL()
|
|
3403 |
{
|
|
3404 |
_DBG_FILE("CNSmlWLanAdapter::StreamCommittedL(): begin");
|
|
3405 |
_DBG_FILE("CNSmlWLanAdapter::StreamCommittedL(): end");
|
|
3406 |
}
|
|
3407 |
|
|
3408 |
//-----------------------------------------------------------------------------
|
|
3409 |
// CNSmlWLanAdapter* CNSmlWLanAdapter::CompleteOutstandingCmdsL( )
|
|
3410 |
//-----------------------------------------------------------------------------
|
|
3411 |
void CNSmlWLanAdapter::CompleteOutstandingCmdsL()
|
|
3412 |
{
|
|
3413 |
_DBG_FILE("CNSmlWLanAdapter::CompleteOutStandingCmdsL(): begin");
|
|
3414 |
|
|
3415 |
ExecuteBufferL(ETrue);
|
|
3416 |
|
|
3417 |
_DBG_FILE("CNSmlWLanAdapter::CompleteOutStandingCmdsL(): end");
|
|
3418 |
}
|
|
3419 |
|
|
3420 |
// ------------------------------------------------------------------------------------------------
|
|
3421 |
// TPtrC8 CNSmlWLanAdapter::GetLastUriSeg(const TDesC8& aURI)
|
|
3422 |
// Returns only the last uri segemnt
|
|
3423 |
// ------------------------------------------------------------------------------------------------
|
|
3424 |
TPtrC8 CNSmlWLanAdapter::GetLastUriSeg(const TDesC8& aURI)
|
|
3425 |
{
|
|
3426 |
_DBG_FILE("CNSmlWLanAdapter::GetLastUriSeg(): begin");
|
|
3427 |
|
|
3428 |
TInt i;
|
|
3429 |
for (i = aURI.Length() - 1; i >= 0; i--)
|
|
3430 |
{
|
|
3431 |
if (aURI[i] == '/')
|
|
3432 |
{
|
|
3433 |
break;
|
|
3434 |
}
|
|
3435 |
}
|
|
3436 |
|
|
3437 |
if (i == 0)
|
|
3438 |
{
|
|
3439 |
_DBG_FILE("CNSmlWLanAdapter::GetLastUriSeg(): end");
|
|
3440 |
return aURI;
|
|
3441 |
}
|
|
3442 |
else
|
|
3443 |
{
|
|
3444 |
_DBG_FILE("CNSmlWLanAdapter::GetLastUriSeg(): end");
|
|
3445 |
return aURI.Mid(i + 1);
|
|
3446 |
}
|
|
3447 |
}
|
|
3448 |
|
|
3449 |
// ------------------------------------------------------------------------------------------------
|
|
3450 |
// TPtrC16 CNSmlWLanAdapter::RemoveLastURISeg(const TDesC8& aURI)
|
|
3451 |
// returns parent uri, i.e. removes last uri segment
|
|
3452 |
// ------------------------------------------------------------------------------------------------
|
|
3453 |
TPtrC8 CNSmlWLanAdapter::RemoveLastUriSeg(const TDesC8& aURI)
|
|
3454 |
{
|
|
3455 |
_DBG_FILE("CNSmlWLanAdapter::RemoveLastUriSeg(): begin");
|
|
3456 |
|
|
3457 |
TInt i;
|
|
3458 |
for (i = aURI.Length() - 1; i >= 0; i--)
|
|
3459 |
{
|
|
3460 |
if (aURI[i] == '/')
|
|
3461 |
{
|
|
3462 |
break;
|
|
3463 |
}
|
|
3464 |
}
|
|
3465 |
|
|
3466 |
_DBG_FILE("CNSmlWLanAdapter::RemoveLastUriSeg(): end");
|
|
3467 |
return aURI.Left(i);
|
|
3468 |
}
|
|
3469 |
|
|
3470 |
// ------------------------------------------------------------------------------------------------
|
|
3471 |
// TInt CNSmlWLanAdapter::DesToInt( const TDesC8& aLuid )
|
|
3472 |
// Returns aLuid as integer value
|
|
3473 |
// ------------------------------------------------------------------------------------------------
|
|
3474 |
TInt CNSmlWLanAdapter::DesToInt(const TDesC8& aLuid)
|
|
3475 |
{
|
|
3476 |
_DBG_FILE("CNSmlWLanAdapter::DesToInt(): begin");
|
|
3477 |
|
|
3478 |
TLex8 lex(aLuid);
|
|
3479 |
TInt value = 0;
|
|
3480 |
lex.Val(value);
|
|
3481 |
|
|
3482 |
DBG_ARGS8(_S8("WLanAdapter::DesToInt() - Des: <%S> Int: <%D>"), &aLuid,
|
|
3483 |
value);
|
|
3484 |
_DBG_FILE("CNSmlWLanAdapter::DesToInt(): end");
|
|
3485 |
return value;
|
|
3486 |
}
|
|
3487 |
|
|
3488 |
// ------------------------------------------------------------------------------------------------
|
|
3489 |
// HBufC* CNSmlWLanAdapter::IntToDesLC(const TInt aLuid)
|
|
3490 |
// ------------------------------------------------------------------------------------------------
|
|
3491 |
HBufC* CNSmlWLanAdapter::IntToDesLC(const TInt aLuid)
|
|
3492 |
{
|
|
3493 |
_DBG_FILE("CNSmlWLanAdapter::IntToDesLC(): begin");
|
|
3494 |
|
|
3495 |
HBufC* buf = HBufC::NewLC(10);
|
|
3496 |
TPtr ptrBuf = buf->Des();
|
|
3497 |
ptrBuf.Num(aLuid);
|
|
3498 |
|
|
3499 |
_DBG_FILE("CNSmlWLanAdapter::IntToDesLC(): end");
|
|
3500 |
return buf;
|
|
3501 |
}
|
|
3502 |
|
|
3503 |
// ------------------------------------------------------------------------------------------------
|
|
3504 |
// HBufC8* CNSmlWLanAdapter::IntToDes8LC(const TInt aLuid)
|
|
3505 |
// ------------------------------------------------------------------------------------------------
|
|
3506 |
HBufC8* CNSmlWLanAdapter::IntToDes8LC(const TInt aLuid)
|
|
3507 |
{
|
|
3508 |
_DBG_FILE("CNSmlWLanAdapter::IntToDes8LC(): begin");
|
|
3509 |
|
|
3510 |
HBufC8* buf = HBufC8::NewLC(10);
|
|
3511 |
TPtr8 ptrBuf = buf->Des();
|
|
3512 |
ptrBuf.Num(aLuid);
|
|
3513 |
|
|
3514 |
_DBG_FILE("CNSmlWLanAdapter::IntToDes8LC(): end");
|
|
3515 |
return buf;
|
|
3516 |
}
|
|
3517 |
|
|
3518 |
// ------------------------------------------------------------------------------------------------
|
|
3519 |
// TInt CNSmlWLanAdapter::NumOfUriSegs( const TDesC8& aUri )
|
|
3520 |
// Return count of URI segments of aUri
|
|
3521 |
// ------------------------------------------------------------------------------------------------
|
|
3522 |
TInt CNSmlWLanAdapter::NumOfUriSegs(const TDesC8& aUri)
|
|
3523 |
{
|
|
3524 |
_DBG_FILE("CNSmlWLanAdapter::NumOfUriSegs(): begin");
|
|
3525 |
|
|
3526 |
TInt count = 1;
|
|
3527 |
for (TInt i = 0; i < aUri.Length(); i++)
|
|
3528 |
{
|
|
3529 |
if (aUri[i] == '/')
|
|
3530 |
count++;
|
|
3531 |
}
|
|
3532 |
|
|
3533 |
_DBG_FILE("CNSmlWLanAdapter::NumOfUriSegs(): end");
|
|
3534 |
return count;
|
|
3535 |
}
|
|
3536 |
|
|
3537 |
// -------------------------------------------------------------------------------------
|
|
3538 |
// CNSmlWLanAdapter::FillNodeInfoL()
|
|
3539 |
// Fills the node info in ddf structure
|
|
3540 |
// -------------------------------------------------------------------------------------
|
|
3541 |
void CNSmlWLanAdapter::FillNodeInfoL(MSmlDmDDFObject& aNode,
|
|
3542 |
TSmlDmAccessTypes aAccTypes, MSmlDmDDFObject::TOccurence aOccurrence,
|
|
3543 |
MSmlDmDDFObject::TScope aScope, MSmlDmDDFObject::TDFFormat aFormat,
|
|
3544 |
const TDesC8& aDescription)
|
|
3545 |
|
|
3546 |
{
|
|
3547 |
aNode.SetAccessTypesL(aAccTypes);
|
|
3548 |
aNode.SetOccurenceL(aOccurrence);
|
|
3549 |
aNode.SetScopeL(aScope);
|
|
3550 |
aNode.SetDFFormatL(aFormat);
|
|
3551 |
if (aFormat != MSmlDmDDFObject::ENode)
|
|
3552 |
{
|
|
3553 |
aNode.AddDFTypeMimeTypeL(KNSmlMimeType);
|
|
3554 |
}
|
|
3555 |
aNode.SetDescriptionL(aDescription);
|
|
3556 |
}
|
|
3557 |
|
|
3558 |
// ------------------------------------------------------------------------------------------------
|
|
3559 |
// TInt CNSmlWLanAdapter::GetEAPIdFromUri( const TDesC8& aUri )
|
|
3560 |
// Return WLan ID number from URI
|
|
3561 |
// ------------------------------------------------------------------------------------------------
|
|
3562 |
TInt CNSmlWLanAdapter::GetEAPIdFromUri(const TDesC8& aUri)
|
|
3563 |
{
|
|
3564 |
DBG_ARGS8(_S8("WLanAdapter::GetEAPIdFromUri - <%S>"), &aUri);
|
|
3565 |
|
|
3566 |
if (aUri.Match(_L8("AP/*/NAPDef/*/WLAN/*/EAP/*")) == KErrNotFound)
|
|
3567 |
{
|
|
3568 |
return KErrNotFound;
|
|
3569 |
}
|
|
3570 |
|
|
3571 |
TInt begin = aUri.Find(_L8("/EAPId")) + 6;
|
|
3572 |
if (begin == KErrNotFound)
|
|
3573 |
{
|
|
3574 |
return KErrNotFound;
|
|
3575 |
}
|
|
3576 |
|
|
3577 |
TInt eapId = DesToInt(aUri.Mid(begin, 3));
|
|
3578 |
|
|
3579 |
return eapId;
|
|
3580 |
}
|
|
3581 |
|
|
3582 |
// ------------------------------------------------------------------------------------------------
|
|
3583 |
// TInt CNSmlWLanAdapter::GetEncapsEAPIdFromUri( const TDesC8& aUri )
|
|
3584 |
// Return WLan ID number from URI
|
|
3585 |
// ------------------------------------------------------------------------------------------------
|
|
3586 |
TInt CNSmlWLanAdapter::GetEncapsEAPIdFromUri(const TDesC8& aUri)
|
|
3587 |
{
|
|
3588 |
DBG_ARGS8(_S8("WLanAdapter::GetEncapsEAPIdFromUri - <%S>"), &aUri);
|
|
3589 |
|
|
3590 |
if (aUri.Match(_L8("AP/*/NAPDef/*/WLAN/*/EAP/EAPId*-*")) == KErrNotFound)
|
|
3591 |
{
|
|
3592 |
return KErrNotFound;
|
|
3593 |
}
|
|
3594 |
|
|
3595 |
TInt begin = aUri.Find(_L8("/EAPId")) + 9;
|
|
3596 |
if (aUri[begin] != '-')
|
|
3597 |
{
|
|
3598 |
return KErrNotFound;
|
|
3599 |
}
|
|
3600 |
begin++;
|
|
3601 |
TInt end = -1;
|
|
3602 |
TInt count;
|
|
3603 |
|
|
3604 |
for (count = 0; count + begin < aUri.Length(); count++)
|
|
3605 |
{
|
|
3606 |
if (aUri[begin + count] == '/')
|
|
3607 |
{
|
|
3608 |
end = begin + count;
|
|
3609 |
break;
|
|
3610 |
}
|
|
3611 |
else if (aUri.Length() == begin + count + 1)
|
|
3612 |
{
|
|
3613 |
count++;
|
|
3614 |
end = begin + count;
|
|
3615 |
break;
|
|
3616 |
}
|
|
3617 |
}
|
|
3618 |
|
|
3619 |
if (end > 0)
|
|
3620 |
{
|
|
3621 |
TInt eapId = DesToInt(aUri.Mid(begin, count));
|
|
3622 |
return eapId;
|
|
3623 |
}
|
|
3624 |
return KErrNotFound;
|
|
3625 |
}
|
|
3626 |
|
|
3627 |
// ------------------------------------------------------------------------------------------------
|
|
3628 |
// TInt CNSmlWLanAdapter::GetEAPIdFromUriL( const TDesC8& aUri )
|
|
3629 |
// Return WLan ID number from URI
|
|
3630 |
// ------------------------------------------------------------------------------------------------
|
|
3631 |
TInt CNSmlWLanAdapter::GetServiceIdFromUriL(const TDesC8& aURI)
|
|
3632 |
{
|
|
3633 |
DBG_ARGS8(_S8("WLanAdapter::GetServiceIdFromUriL - <%S>"), &aURI);
|
|
3634 |
|
|
3635 |
if (aURI.Match(_L8("AP/*/NAPDef/*/WLAN/*/EAP*")) == KErrNotFound)
|
|
3636 |
{
|
|
3637 |
return KErrNotFound;
|
|
3638 |
}
|
|
3639 |
|
|
3640 |
TInt end = aURI.Find(_L8("/EAP")) + 4;
|
|
3641 |
|
|
3642 |
if (end > 0)
|
|
3643 |
{
|
|
3644 |
|
|
3645 |
HBufC8* luidBuf = iCallBack->GetLuidAllocL(aURI.Left(end));
|
|
3646 |
|
|
3647 |
TInt serviceId = GetIdFromLuid(*luidBuf);
|
|
3648 |
|
|
3649 |
delete luidBuf;
|
|
3650 |
|
|
3651 |
return serviceId;
|
|
3652 |
}
|
|
3653 |
return KErrNotFound;
|
|
3654 |
}
|
|
3655 |
|
|
3656 |
// ------------------------------------------------------------------------------------------------
|
|
3657 |
// TInt CNSmlWLanAdapter::GetSecSSIDFromUriL( const TDesC8& aUri )
|
|
3658 |
// Return WLan ID number from URI
|
|
3659 |
// ------------------------------------------------------------------------------------------------
|
|
3660 |
TUint32 CNSmlWLanAdapter::GetSecSSIDFromUriL(const TDesC8& aUri)
|
|
3661 |
{
|
|
3662 |
DBG_ARGS8(_S8("WLanAdapter::GetSecSSIDFromUriL - <%S>"), &aUri);
|
|
3663 |
|
|
3664 |
if (aUri.Match(_L8("AP/*/NAPDef/*/WLAN/*/SecondarySSID/*"))
|
|
3665 |
== KErrNotFound)
|
|
3666 |
{
|
|
3667 |
User::Leave(KErrNotFound);
|
|
3668 |
}
|
|
3669 |
_LIT8(KSSIDString, "/SecondarySSID/SecSSID");
|
|
3670 |
TInt begin = aUri.Find(KSSIDString) + KSSIDString().Length();
|
|
3671 |
TInt end = -1;
|
|
3672 |
TInt count;
|
|
3673 |
|
|
3674 |
for (count = 0; count + begin < aUri.Length(); count++)
|
|
3675 |
{
|
|
3676 |
if (aUri[begin + count] == '/')
|
|
3677 |
{
|
|
3678 |
end = begin + count;
|
|
3679 |
break;
|
|
3680 |
}
|
|
3681 |
else if (aUri.Length() == begin + count + 1)
|
|
3682 |
{
|
|
3683 |
count++;
|
|
3684 |
end = begin + count;
|
|
3685 |
break;
|
|
3686 |
}
|
|
3687 |
}
|
|
3688 |
|
|
3689 |
if (end > 0)
|
|
3690 |
{
|
|
3691 |
TLex8 lex(aUri.Mid(begin, count));
|
|
3692 |
TUint32 value = 0;
|
|
3693 |
lex.Val(value, EDecimal);
|
|
3694 |
return value;
|
|
3695 |
}
|
|
3696 |
else
|
|
3697 |
{
|
|
3698 |
User::Leave(KErrNotFound);
|
|
3699 |
}
|
|
3700 |
return 0;
|
|
3701 |
}
|
|
3702 |
|
|
3703 |
// ------------------------------------------------------------------------------------------------
|
|
3704 |
// TInt CNSmlWLanAdapter::GetEAPIdFromUri( const TDesC8& aUri )
|
|
3705 |
// Return WLan ID number from URI
|
|
3706 |
// ------------------------------------------------------------------------------------------------
|
|
3707 |
TInt CNSmlWLanAdapter::GetCertificateIdFromUri(const TDesC8& aUri)
|
|
3708 |
{
|
|
3709 |
DBG_ARGS8(_S8("WLanAdapter::GetCertificateIdFromUri - <%S>"), &aUri);
|
|
3710 |
|
|
3711 |
if (aUri.Match(_L8("AP/*/NAPDef/*/WLAN/*/EAP/*/Certificate/*"))
|
|
3712 |
== KErrNotFound)
|
|
3713 |
{
|
|
3714 |
return KErrNotFound;
|
|
3715 |
}
|
|
3716 |
_LIT8(KCertString, "/Certificate/CertId");
|
|
3717 |
|
|
3718 |
TInt begin = aUri.Find(KCertString);
|
|
3719 |
if (begin == KErrNotFound)
|
|
3720 |
{
|
|
3721 |
return KErrNotFound;
|
|
3722 |
}
|
|
3723 |
|
|
3724 |
begin += KCertString().Length();
|
|
3725 |
|
|
3726 |
TInt end = -1;
|
|
3727 |
TInt count;
|
|
3728 |
|
|
3729 |
for (count = 0; count + begin < aUri.Length(); count++)
|
|
3730 |
{
|
|
3731 |
if (aUri[begin + count] == '/')
|
|
3732 |
{
|
|
3733 |
end = begin + count;
|
|
3734 |
break;
|
|
3735 |
}
|
|
3736 |
else if (aUri.Length() == begin + count + 1)
|
|
3737 |
{
|
|
3738 |
count++;
|
|
3739 |
end = begin + count;
|
|
3740 |
break;
|
|
3741 |
}
|
|
3742 |
}
|
|
3743 |
|
|
3744 |
if (end > 0)
|
|
3745 |
{
|
|
3746 |
TInt certId = DesToInt(aUri.Mid(begin, count));
|
|
3747 |
return certId;
|
|
3748 |
}
|
|
3749 |
return KErrNotFound;
|
|
3750 |
}
|
|
3751 |
|
|
3752 |
// ------------------------------------------------------------------------------------------------
|
|
3753 |
// TInt CNSmlWLanAdapter::GetWepKeyIdFromUri( const TDesC8& aUri )
|
|
3754 |
// Returns WepKey ID number from URI
|
|
3755 |
// ------------------------------------------------------------------------------------------------
|
|
3756 |
TInt CNSmlWLanAdapter::GetWepKeyIdFromUri(const TDesC8& aUri)
|
|
3757 |
{
|
|
3758 |
if (aUri.Match(_L8("AP/*/NAPDef/*/WLAN/*/WEPKey/*")) == KErrNotFound)
|
|
3759 |
{
|
|
3760 |
return KErrNotFound;
|
|
3761 |
}
|
|
3762 |
|
|
3763 |
TInt begin = aUri.Find(_L8("WEPKey/WKId")) + 11;
|
|
3764 |
TInt end = -1;
|
|
3765 |
TInt count;
|
|
3766 |
|
|
3767 |
for (count = 0; count < aUri.Length() - 11; count++)
|
|
3768 |
{
|
|
3769 |
if (aUri[begin + count] == '/')
|
|
3770 |
{
|
|
3771 |
end = begin + count;
|
|
3772 |
break;
|
|
3773 |
}
|
|
3774 |
|
|
3775 |
else if (aUri.Length() == begin + count + 1)
|
|
3776 |
{
|
|
3777 |
count++;
|
|
3778 |
end = begin + count;
|
|
3779 |
break;
|
|
3780 |
}
|
|
3781 |
}
|
|
3782 |
|
|
3783 |
if (end > 0)
|
|
3784 |
{
|
|
3785 |
TInt wlanId = DesToInt(aUri.Mid(begin, count));
|
|
3786 |
return wlanId;
|
|
3787 |
}
|
|
3788 |
return KErrNotFound;
|
|
3789 |
}
|
|
3790 |
|
|
3791 |
// ------------------------------------------------------------------------------------------------
|
|
3792 |
// TInt CNSmlWLanAdapter::GetWepKeyIdFromLuid( const TDesC8& aLuid )
|
|
3793 |
// Return id number of wepkey
|
|
3794 |
// ------------------------------------------------------------------------------------------------
|
|
3795 |
TInt CNSmlWLanAdapter::GetWepKeyIdFromLuid(const TDesC8& aLuid)
|
|
3796 |
{
|
|
3797 |
TLex8 iLex(aLuid);
|
|
3798 |
|
|
3799 |
TInt luid;
|
|
3800 |
if (iLex.Val(luid) == KErrNone)
|
|
3801 |
{
|
|
3802 |
if (luid > 1000)
|
|
3803 |
{
|
|
3804 |
return luid / 1000;
|
|
3805 |
}
|
|
3806 |
else
|
|
3807 |
{
|
|
3808 |
return KErrNotFound;
|
|
3809 |
}
|
|
3810 |
}
|
|
3811 |
else
|
|
3812 |
{
|
|
3813 |
return KErrNotFound;
|
|
3814 |
}
|
|
3815 |
}
|
|
3816 |
|
|
3817 |
// ------------------------------------------------------------------------------------------------
|
|
3818 |
// TInt CNSmlWLanAdapter::GetIdFromLuid( const TDesC& aLuid )
|
|
3819 |
// Return luid of wlan node
|
|
3820 |
// ------------------------------------------------------------------------------------------------
|
|
3821 |
TInt CNSmlWLanAdapter::GetIdFromLuid(const TDesC8& aLuid)
|
|
3822 |
{
|
|
3823 |
TLex8 iLex(aLuid);
|
|
3824 |
|
|
3825 |
TInt luid;
|
|
3826 |
if (iLex.Val(luid) == KErrNone)
|
|
3827 |
{
|
|
3828 |
if (luid < 1000)
|
|
3829 |
{
|
|
3830 |
return luid;
|
|
3831 |
}
|
|
3832 |
else
|
|
3833 |
{
|
|
3834 |
TInt tmp = luid / 1000 * 1000; //First number of luid > 1000
|
|
3835 |
return luid - tmp;
|
|
3836 |
}
|
|
3837 |
}
|
|
3838 |
else
|
|
3839 |
{
|
|
3840 |
return KErrNotFound;
|
|
3841 |
}
|
|
3842 |
}
|
|
3843 |
|
|
3844 |
// ------------------------------------------------------------------------------------------------
|
|
3845 |
// void CNSmlWLanAdapter::ExecuteBufferL( TBool aFinal )
|
|
3846 |
// Executes buffered commands from iBuffer
|
|
3847 |
// ------------------------------------------------------------------------------------------------
|
|
3848 |
void CNSmlWLanAdapter::ExecuteBufferL(TBool aFinal)
|
|
3849 |
{
|
|
3850 |
for (TInt index = 0; index < iBuffer->Count(); index++)
|
|
3851 |
{
|
|
3852 |
DBG_ARGS8(_S8(
|
|
3853 |
"WLanAdapter::ExecuteBuffer(): Buf count: <%D> index: <%D>"),
|
|
3854 |
iBuffer->Count(), index);
|
|
3855 |
|
|
3856 |
if (iBuffer->At(index).iExecuted)
|
|
3857 |
{
|
|
3858 |
continue;
|
|
3859 |
}
|
|
3860 |
TInt err = 0;
|
|
3861 |
|
|
3862 |
TInt luid = iBuffer->At(index).iLuid;
|
|
3863 |
TInt wepKeyId = iBuffer->At(index).iWepKeyId;
|
|
3864 |
if (!wepKeyId && !aFinal)
|
|
3865 |
{
|
|
3866 |
continue;
|
|
3867 |
}
|
|
3868 |
|
|
3869 |
if (wepKeyId > 4 || !wepKeyId && aFinal)
|
|
3870 |
{
|
|
3871 |
if (iBuffer->At(index).iDataStatusRef)
|
|
3872 |
iCallBack->SetStatusL(iBuffer->At(index).iDataStatusRef,
|
|
3873 |
CSmlDmAdapter::EError);
|
|
3874 |
if (iBuffer->At(index).iNodeStatusRef)
|
|
3875 |
iCallBack->SetStatusL(iBuffer->At(index).iNodeStatusRef,
|
|
3876 |
CSmlDmAdapter::EError);
|
|
3877 |
if (iBuffer->At(index).iLengthStatusRef)
|
|
3878 |
iCallBack->SetStatusL(iBuffer->At(index).iLengthStatusRef,
|
|
3879 |
CSmlDmAdapter::EError);
|
|
3880 |
|
|
3881 |
iBuffer->At(index).iIdStatusRef = 0;
|
|
3882 |
iBuffer->At(index).iNodeStatusRef = 0;
|
|
3883 |
iBuffer->At(index).iDataStatusRef = 0;
|
|
3884 |
iBuffer->At(index).iLengthStatusRef = 0;
|
|
3885 |
iBuffer->At(index).iExecuted = ETrue;
|
|
3886 |
|
|
3887 |
continue;
|
|
3888 |
}
|
|
3889 |
|
|
3890 |
if (iBuffer->At(index).iDataSet && iBuffer->At(index).iWepKeyId > 0)
|
|
3891 |
{
|
|
3892 |
iWlanSettings->GetWlanSettings(luid, *iSettings);
|
|
3893 |
|
|
3894 |
switch (wepKeyId)
|
|
3895 |
{
|
|
3896 |
case 1:
|
|
3897 |
iSettings->WepKey1 = iBuffer->At(index).iData->Des();
|
|
3898 |
break;
|
|
3899 |
case 2:
|
|
3900 |
iSettings->WepKey2 = iBuffer->At(index).iData->Des();
|
|
3901 |
break;
|
|
3902 |
case 3:
|
|
3903 |
iSettings->WepKey3 = iBuffer->At(index).iData->Des();
|
|
3904 |
break;
|
|
3905 |
case 4:
|
|
3906 |
iSettings->WepKey4 = iBuffer->At(index).iData->Des();
|
|
3907 |
break;
|
|
3908 |
default:
|
|
3909 |
continue;
|
|
3910 |
}
|
|
3911 |
|
|
3912 |
err = iWlanSettings->WriteWlanSettings(*iSettings);
|
|
3913 |
if (err == KErrNone)
|
|
3914 |
{
|
|
3915 |
iCallBack->SetStatusL(iBuffer->At(index).iDataStatusRef,
|
|
3916 |
CSmlDmAdapter::EOk);
|
|
3917 |
}
|
|
3918 |
else
|
|
3919 |
{
|
|
3920 |
iCallBack->SetStatusL(iBuffer->At(index).iDataStatusRef,
|
|
3921 |
CSmlDmAdapter::EError);
|
|
3922 |
}
|
|
3923 |
|
|
3924 |
iBuffer->At(index).iDataStatusRef = 0;
|
|
3925 |
}
|
|
3926 |
|
|
3927 |
TBuf8<5> addLUID;
|
|
3928 |
addLUID.AppendNum(wepKeyId);
|
|
3929 |
addLUID.AppendNumFixedWidth(luid, EDecimal, 3);
|
|
3930 |
|
|
3931 |
iCallBack->SetMappingL(iBuffer->At(index).iUri->Des(), addLUID);
|
|
3932 |
if (iBuffer->At(index).iIdStatusRef)
|
|
3933 |
iCallBack->SetStatusL(iBuffer->At(index).iIdStatusRef,
|
|
3934 |
CSmlDmAdapter::EOk);
|
|
3935 |
if (iBuffer->At(index).iNodeStatusRef)
|
|
3936 |
iCallBack->SetStatusL(iBuffer->At(index).iNodeStatusRef,
|
|
3937 |
CSmlDmAdapter::EOk);
|
|
3938 |
if (iBuffer->At(index).iLengthStatusRef)
|
|
3939 |
iCallBack->SetStatusL(iBuffer->At(index).iLengthStatusRef,
|
|
3940 |
CSmlDmAdapter::EOk);
|
|
3941 |
|
|
3942 |
iBuffer->At(index).iIdStatusRef = 0;
|
|
3943 |
iBuffer->At(index).iNodeStatusRef = 0;
|
|
3944 |
iBuffer->At(index).iLengthStatusRef = 0;
|
|
3945 |
iBuffer->At(index).iExecuted = ETrue;
|
|
3946 |
}
|
|
3947 |
|
|
3948 |
//Clean executed command from buffer
|
|
3949 |
for (TInt i = 0; i < iBuffer->Count(); i++)
|
|
3950 |
{
|
|
3951 |
if (iBuffer->At(i).iExecuted)
|
|
3952 |
{
|
|
3953 |
if (iBuffer->At(i).iUri)
|
|
3954 |
{
|
|
3955 |
delete iBuffer->At(i).iUri;
|
|
3956 |
iBuffer->At(i).iUri = 0;
|
|
3957 |
}
|
|
3958 |
if (iBuffer->At(i).iData)
|
|
3959 |
{
|
|
3960 |
delete iBuffer->At(i).iData;
|
|
3961 |
iBuffer->At(i).iData = 0;
|
|
3962 |
}
|
|
3963 |
iBuffer->Delete(i);
|
|
3964 |
iBuffer->Compress();
|
|
3965 |
}
|
|
3966 |
}
|
|
3967 |
// Secondary SSID Buffer
|
|
3968 |
for (TInt index = 0; index < iSecondaryBuffer.Count(); index++)
|
|
3969 |
{
|
|
3970 |
DBG_ARGS8(_S8(
|
|
3971 |
"WLanAdapter::ExecuteBuffer(): Buf count: <%D> index: <%D>"),
|
|
3972 |
iBuffer->Count(), index);
|
|
3973 |
|
|
3974 |
if (iSecondaryBuffer[index]->iExecuted)
|
|
3975 |
{
|
|
3976 |
continue;
|
|
3977 |
}
|
|
3978 |
|
|
3979 |
TSecondarySSID ssid;
|
|
3980 |
ssid.ScannedId = iSecondaryBuffer[index]->ScannedId;
|
|
3981 |
ssid.UsedId = iSecondaryBuffer[index]->UsedId;
|
|
3982 |
|
|
3983 |
DBG_ARGS8(
|
|
3984 |
_S8(
|
|
3985 |
"CWlanadaptes::Execute Buffer - WLAN_SEC_SSID_SCANNED_SSID uri: <%S> ad WLAN_SEC_SSID_USED_SSID : <%S>"),
|
|
3986 |
&iSecondaryBuffer[index]->ScannedId,
|
|
3987 |
&iSecondaryBuffer[index]->UsedId);
|
|
3988 |
|
|
3989 |
TInt retval = iWlanSettings->WriteSecondarySSIDL(
|
|
3990 |
iSecondaryBuffer[index]->wlanLuid, ssid, ETrue);
|
|
3991 |
iSecondaryBuffer[index]->iExecuted = ETrue;
|
|
3992 |
|
|
3993 |
}
|
|
3994 |
TBuf<KMaxLengthOfEapList> eapList;
|
|
3995 |
eapList.Copy(KEapAll);
|
|
3996 |
// EAP settings
|
|
3997 |
for (TInt i = 0; i < iEAPBuffer.Count(); i++)
|
|
3998 |
{
|
|
3999 |
|
|
4000 |
// Save EAP list
|
|
4001 |
if (iEAPBuffer[i]->iEapTypeString.Length() > 0
|
|
4002 |
&& iEAPBuffer[i]->iEncapsulatingString.Length() == 0) // AND method is not encapsulated
|
|
4003 |
{
|
|
4004 |
|
|
4005 |
TBuf8<3> buf;
|
|
4006 |
_LIT8(KFormat, "%d");
|
|
4007 |
// pick the last byte from the array
|
|
4008 |
buf.Format(KFormat,
|
|
4009 |
iEAPBuffer[i]->iEapTypeString[KExpandedEapIdLength - 1]);
|
|
4010 |
// search for the correct offset for the eap type from the KEapAll literal
|
|
4011 |
TInt index = KEapAll().Find(buf);
|
|
4012 |
|
|
4013 |
const TUint8 offset = 2; //length = f "-0" string
|
|
4014 |
// Add '+' to the correct offset, so that the eap is repsesented activated in the list
|
|
4015 |
if (index >= offset)
|
|
4016 |
{
|
|
4017 |
eapList[index - offset] = KEapPlus;
|
|
4018 |
}
|
|
4019 |
|
|
4020 |
}
|
|
4021 |
|
|
4022 |
// Check if this method has encapsulated methods
|
|
4023 |
for (TInt j = 0; j < iEAPBuffer.Count(); j++)
|
|
4024 |
{
|
|
4025 |
if (iEAPBuffer[i]->iEAPSettings->iEAPExpandedType
|
|
4026 |
== iEAPBuffer[j]->iEncapsulatingExpandedEapId)
|
|
4027 |
{
|
|
4028 |
// j is encapsulated inside i
|
|
4029 |
iEAPBuffer[i]->iEAPSettings->iEnabledEncapsulatedEAPExpandedTypes.Append(
|
|
4030 |
iEAPBuffer[j]->iEAPSettings->iEAPExpandedType);
|
|
4031 |
iEAPBuffer[i]->iEAPSettings->iEnabledEncapsulatedEAPExpandedTypesPresent
|
|
4032 |
= ETrue;
|
|
4033 |
}
|
|
4034 |
}
|
|
4035 |
|
|
4036 |
TRAPD(err, iWlanSettings->GetEAPInterfaceL(
|
|
4037 |
iEAPBuffer[i]->iWLANServiceId,
|
|
4038 |
iEAPBuffer[i]->iEncapsulatingExpandedEapId,
|
|
4039 |
iEAPBuffer[i]->iEAPSettings->iEAPExpandedType));
|
|
4040 |
if (err == KErrNone)
|
|
4041 |
{
|
|
4042 |
err = iWlanSettings->WriteEAPSettings(
|
|
4043 |
*iEAPBuffer[i]->iEAPSettings);
|
|
4044 |
}
|
|
4045 |
|
|
4046 |
MSmlDmAdapter::TError status;
|
|
4047 |
switch (err)
|
|
4048 |
{
|
|
4049 |
case KErrNotFound:
|
|
4050 |
{
|
|
4051 |
status = CSmlDmAdapter::ENotFound;
|
|
4052 |
break;
|
|
4053 |
}
|
|
4054 |
case KErrNone:
|
|
4055 |
{
|
|
4056 |
status = CSmlDmAdapter::EOk;
|
|
4057 |
break;
|
|
4058 |
}
|
|
4059 |
default:
|
|
4060 |
{
|
|
4061 |
status = CSmlDmAdapter::EError;
|
|
4062 |
}
|
|
4063 |
}
|
|
4064 |
|
|
4065 |
for (TInt j = 0; j < iEAPBuffer[i]->iStatusRefArray.Count(); j++)
|
|
4066 |
{
|
|
4067 |
iCallBack->SetStatusL(iEAPBuffer[i]->iStatusRefArray[j], status);
|
|
4068 |
}
|
|
4069 |
}
|
|
4070 |
|
|
4071 |
// Expanded EAP types in use. Write the eap list to the new columns.
|
|
4072 |
|
|
4073 |
// generate appropriate entries in the new enabled and disabled list,
|
|
4074 |
// overwriting those values
|
|
4075 |
|
|
4076 |
// count the + and - signs to determine the size of enabled and
|
|
4077 |
// disabled descriptors
|
|
4078 |
|
|
4079 |
TLex lex(eapList);
|
|
4080 |
TInt numPlus = 0;
|
|
4081 |
TInt numMinus = 0;
|
|
4082 |
TChar ch;
|
|
4083 |
while (!lex.Eos())
|
|
4084 |
{
|
|
4085 |
ch = lex.Get();
|
|
4086 |
if (ch == '+')
|
|
4087 |
++numPlus;
|
|
4088 |
else if (ch == '-')
|
|
4089 |
++numMinus;
|
|
4090 |
}
|
|
4091 |
// load general EAP settings If
|
|
4092 |
CEapGeneralSettings* genSettings;
|
|
4093 |
genSettings = CEapGeneralSettings::NewL(ELan, iSettings->ServiceID);
|
|
4094 |
CleanupStack::PushL(genSettings);
|
|
4095 |
|
|
4096 |
// get lists of enabled/disabled EAPs for the IAP
|
|
4097 |
|
|
4098 |
RArray<TEapExpandedType> enabledEapMethods;
|
|
4099 |
RArray<TEapExpandedType> disabledEapMethods;
|
|
4100 |
|
|
4101 |
enabledEapMethods.Reset();
|
|
4102 |
disabledEapMethods.Reset();
|
|
4103 |
|
|
4104 |
lex.Assign(eapList);
|
|
4105 |
|
|
4106 |
while (!lex.Eos())
|
|
4107 |
{
|
|
4108 |
// beginning of implementation UID
|
|
4109 |
TInt16 implUid = 0;
|
|
4110 |
|
|
4111 |
if (lex.Val(implUid) != KErrNone || !implUid)
|
|
4112 |
{
|
|
4113 |
break;
|
|
4114 |
}
|
|
4115 |
|
|
4116 |
// append it to the appropriate list ('+' enabled, '-' disabled)
|
|
4117 |
_LIT8(KPadding, "\xFE\0\0\0\0\0\0");
|
|
4118 |
_LIT8(KMsChapV2Padding, "\xFE\xFF\xFF\xFF\0\0\0");
|
|
4119 |
const TInt KPlainMsChapV2ImplUid = 99;
|
|
4120 |
|
|
4121 |
if (implUid > 0)
|
|
4122 |
{
|
|
4123 |
TBuf8<KExpandedEapIdLength> tempbuf;
|
|
4124 |
if (Abs(implUid) == KPlainMsChapV2ImplUid)
|
|
4125 |
{
|
|
4126 |
tempbuf.Append(KMsChapV2Padding);
|
|
4127 |
}
|
|
4128 |
else
|
|
4129 |
{
|
|
4130 |
tempbuf.Append(KPadding);
|
|
4131 |
}
|
|
4132 |
tempbuf.Append(Abs(implUid));
|
|
4133 |
TEapExpandedType expandedTypebuf(tempbuf);
|
|
4134 |
enabledEapMethods.Append(expandedTypebuf);
|
|
4135 |
}
|
|
4136 |
|
|
4137 |
// swallow the delimiter (',')
|
|
4138 |
lex.Get();
|
|
4139 |
}
|
|
4140 |
|
|
4141 |
if (numPlus != NULL)
|
|
4142 |
{
|
|
4143 |
genSettings->SetEapMethods(enabledEapMethods, disabledEapMethods);
|
|
4144 |
}
|
|
4145 |
|
|
4146 |
CleanupStack::PopAndDestroy(genSettings);
|
|
4147 |
|
|
4148 |
for (TInt i = 0; i < iEAPBuffer.Count(); i++)
|
|
4149 |
{
|
|
4150 |
iEAPBuffer[i]->iStatusRefArray.Close();
|
|
4151 |
iEAPBuffer[i]->iEAPSettings->iEnabledEncapsulatedEAPExpandedTypes.Close();
|
|
4152 |
iEAPBuffer[i]->iEAPSettings->iDisabledEncapsulatedEAPExpandedTypes.Close();
|
|
4153 |
iEAPBuffer[i]->iEAPSettings->iCipherSuites.Close();
|
|
4154 |
delete iEAPBuffer[i]->iEAPSettings;
|
|
4155 |
iEAPBuffer[i]->iEAPSettings = NULL;
|
|
4156 |
}
|
|
4157 |
iEAPBuffer.ResetAndDestroy();
|
|
4158 |
}
|
|
4159 |
|
|
4160 |
//=============================================
|
|
4161 |
// CNSmlWLanAdapter::ConvertTo8LC()
|
|
4162 |
// Converts string value to 8-bit
|
|
4163 |
//
|
|
4164 |
//=============================================
|
|
4165 |
TDesC8& CNSmlWLanAdapter::ConvertTo8LC(const TDesC& aSource)
|
|
4166 |
{
|
|
4167 |
HBufC8* buf = HBufC8::NewLC(aSource.Length() * 2);
|
|
4168 |
TPtr8 bufPtr = buf->Des();
|
|
4169 |
CnvUtfConverter::ConvertFromUnicodeToUtf8(bufPtr, aSource);
|
|
4170 |
|
|
4171 |
return *buf;
|
|
4172 |
}
|
|
4173 |
|
|
4174 |
//=============================================
|
|
4175 |
// CNSmlWLanAdapter::ConvertTo16LC()
|
|
4176 |
// Converts string value to 16-bit
|
|
4177 |
//
|
|
4178 |
//=============================================
|
|
4179 |
TDesC16& CNSmlWLanAdapter::ConvertTo16LC(const TDesC8& aSource)
|
|
4180 |
{
|
|
4181 |
HBufC16* buf16 = HBufC16::NewLC(aSource.Length());
|
|
4182 |
TPtr bufPtr16 = buf16->Des();
|
|
4183 |
|
|
4184 |
CnvUtfConverter::ConvertToUnicodeFromUtf8(bufPtr16, aSource);
|
|
4185 |
|
|
4186 |
return *buf16;
|
|
4187 |
}
|
|
4188 |
|
|
4189 |
void CNSmlWLanAdapter::ResetEAPStructL()
|
|
4190 |
{
|
|
4191 |
DeleteEAPStructL();
|
|
4192 |
iEAPSettings = new (ELeave) EAPSettings;
|
|
4193 |
}
|
|
4194 |
|
|
4195 |
void CNSmlWLanAdapter::DeleteEAPStructL()
|
|
4196 |
{
|
|
4197 |
if (iEAPSettings != NULL)
|
|
4198 |
{
|
|
4199 |
if (iEAPSettings->iCertificatesPresent)
|
|
4200 |
{
|
|
4201 |
iEAPSettings->iCertificates.Reset();
|
|
4202 |
}
|
|
4203 |
iEAPSettings->iEnabledEncapsulatedEAPExpandedTypes.Close();
|
|
4204 |
iEAPSettings->iDisabledEncapsulatedEAPExpandedTypes.Close();
|
|
4205 |
iEAPSettings->iCipherSuites.Close();
|
|
4206 |
|
|
4207 |
delete iEAPSettings;
|
|
4208 |
iEAPSettings = NULL;
|
|
4209 |
}
|
|
4210 |
}
|
|
4211 |
|
|
4212 |
void CNSmlWLanAdapter::DesToBufferL(CBufBase& aTo, const TDesC& aFrom)
|
|
4213 |
{
|
|
4214 |
aTo.InsertL(0, ConvertTo8LC(aFrom));
|
|
4215 |
CleanupStack::PopAndDestroy(); // ConvertTo8LC
|
|
4216 |
}
|
|
4217 |
|
|
4218 |
void CNSmlWLanAdapter::FillCipherSuiteBufferL(CBufBase& aBuffer)
|
|
4219 |
{
|
|
4220 |
if (iEAPSettings == NULL || !iEAPSettings->iCipherSuitesPresent)
|
|
4221 |
{
|
|
4222 |
return;
|
|
4223 |
}
|
|
4224 |
// 0 5 10 15 20 25 30 35
|
|
4225 |
_LIT8(KPlus, "+");
|
|
4226 |
aBuffer.InsertL(0, KSuitesDefault);
|
|
4227 |
TInt count = iEAPSettings->iCipherSuites.Count();
|
|
4228 |
for (TInt i = count - 1; i >= 0; --i)
|
|
4229 |
{
|
|
4230 |
switch (iEAPSettings->iCipherSuites[i])
|
|
4231 |
{
|
|
4232 |
case RSA_3DES_SHA:
|
|
4233 |
{
|
|
4234 |
aBuffer.Write(0, KPlus);
|
|
4235 |
break;
|
|
4236 |
}
|
|
4237 |
case DHE_RSA_3DES_SHA:
|
|
4238 |
{
|
|
4239 |
aBuffer.Write(5, KPlus);
|
|
4240 |
break;
|
|
4241 |
}
|
|
4242 |
case DHE_DSS_3DES_SHA:
|
|
4243 |
{
|
|
4244 |
aBuffer.Write(10, KPlus);
|
|
4245 |
break;
|
|
4246 |
}
|
|
4247 |
case RSA_AES_SHA:
|
|
4248 |
{
|
|
4249 |
aBuffer.Write(15, KPlus);
|
|
4250 |
break;
|
|
4251 |
}
|
|
4252 |
case DHE_RSA_AES_SHA:
|
|
4253 |
{
|
|
4254 |
aBuffer.Write(20, KPlus);
|
|
4255 |
break;
|
|
4256 |
}
|
|
4257 |
case DHE_DSS_AES_SHA:
|
|
4258 |
{
|
|
4259 |
aBuffer.Write(25, KPlus);
|
|
4260 |
break;
|
|
4261 |
}
|
|
4262 |
case RSA_RC4_MD5:
|
|
4263 |
{
|
|
4264 |
aBuffer.Write(30, KPlus);
|
|
4265 |
break;
|
|
4266 |
}
|
|
4267 |
case RSA_RC4_SHA:
|
|
4268 |
{
|
|
4269 |
aBuffer.Write(35, KPlus);
|
|
4270 |
break;
|
|
4271 |
}
|
|
4272 |
default:
|
|
4273 |
{
|
|
4274 |
break;
|
|
4275 |
}
|
|
4276 |
|
|
4277 |
}
|
|
4278 |
}
|
|
4279 |
|
|
4280 |
}
|
|
4281 |
|
|
4282 |
void CNSmlWLanAdapter::FillCipherSuitesL(const TDesC8& aObject,
|
|
4283 |
const TInt aLuid)
|
|
4284 |
{
|
|
4285 |
if (iEAPBuffer[aLuid] == NULL)
|
|
4286 |
{
|
|
4287 |
return;
|
|
4288 |
}
|
|
4289 |
iEAPBuffer[aLuid]->iEAPSettings->iCipherSuites.Reset();
|
|
4290 |
iEAPBuffer[aLuid]->iEAPSettings->iCipherSuitesPresent = EFalse; // init to EFalse
|
|
4291 |
|
|
4292 |
TChar plus('+');
|
|
4293 |
|
|
4294 |
TInt length = aObject.Length();
|
|
4295 |
for (TInt i = 0; i + 3 < length; i += 5)
|
|
4296 |
{
|
|
4297 |
if (aObject[i] == plus)
|
|
4298 |
{
|
|
4299 |
TLex8 lex(aObject.Mid(i + 1, 3));
|
|
4300 |
TUint suite;
|
|
4301 |
lex.Val(suite);
|
|
4302 |
iEAPBuffer[aLuid]->iEAPSettings->iCipherSuites.Append(suite);
|
|
4303 |
iEAPBuffer[aLuid]->iEAPSettings->iCipherSuitesPresent = ETrue;
|
|
4304 |
}
|
|
4305 |
}
|
|
4306 |
}
|
|
4307 |
|
|
4308 |
void CNSmlWLanAdapter::ConvertEAPStringToIds(TDes8& aEAPString,
|
|
4309 |
TEapExpandedType& aId)
|
|
4310 |
{
|
|
4311 |
if (aId.Compare(*EapExpandedTypeSim.GetType()) == 0)
|
|
4312 |
{
|
|
4313 |
aEAPString.Copy(KEapSimTypeId, KExpandedEAPIdLength);
|
|
4314 |
}
|
|
4315 |
else if (aId.Compare(*EapExpandedTypeAka.GetType()) == 0)
|
|
4316 |
{
|
|
4317 |
aEAPString.Copy(KEapAkaTypeId, KExpandedEAPIdLength);
|
|
4318 |
}
|
|
4319 |
else if (aId.Compare(*EapExpandedTypeTtls.GetType()) == 0)
|
|
4320 |
{
|
|
4321 |
aEAPString.Copy(KEapTlsTypeId, KExpandedEAPIdLength);
|
|
4322 |
}
|
|
4323 |
else if (aId.Compare(*EapExpandedTypePeap.GetType()) == 0)
|
|
4324 |
{
|
|
4325 |
aEAPString.Copy(KEapPeapTypeId, KExpandedEAPIdLength);
|
|
4326 |
}
|
|
4327 |
else if (aId.Compare(*EapExpandedTypeTtls.GetType()) == 0)
|
|
4328 |
{
|
|
4329 |
aEAPString.Copy(KEapTtlsTypeId, KExpandedEAPIdLength);
|
|
4330 |
}
|
|
4331 |
else if (aId.Compare(*EapExpandedTypeLeap.GetType()) == 0)
|
|
4332 |
{
|
|
4333 |
aEAPString.Copy(KEapLeapTypeId, KExpandedEAPIdLength);
|
|
4334 |
}
|
|
4335 |
else if (aId.Compare(*EapExpandedTypeMsChapv2.GetType()) == 0)
|
|
4336 |
{
|
|
4337 |
aEAPString.Copy(KEapMschapv2TypeId, KExpandedEAPIdLength);
|
|
4338 |
}
|
|
4339 |
else if (aId.Compare(*EapExpandedPlainMsChapv2.GetType()) == 0)
|
|
4340 |
{
|
|
4341 |
aEAPString.Copy(KMschapv2TypeId, KExpandedEAPIdLength);
|
|
4342 |
}
|
|
4343 |
else if (aId.Compare(*EapExpandedTypeGtc.GetType()) == 0)
|
|
4344 |
{
|
|
4345 |
aEAPString.Copy(KEapGtcTypeId, KExpandedEAPIdLength);
|
|
4346 |
}
|
|
4347 |
else if (aId.Compare(*EapExpandedTypeFast.GetType()) == 0)
|
|
4348 |
{
|
|
4349 |
aEAPString.Copy(KEapFastTypeId, KExpandedEAPIdLength);
|
|
4350 |
}
|
|
4351 |
else if (aId.Compare(*EapExpandedTypeTtlsPap.GetType()) == 0)
|
|
4352 |
{
|
|
4353 |
aEAPString.Copy(KTtlspapTypeId, KExpandedEAPIdLength);
|
|
4354 |
}
|
|
4355 |
else
|
|
4356 |
{
|
|
4357 |
aEAPString.Copy(KEapNoneId, KExpandedEAPIdLength);
|
|
4358 |
}
|
|
4359 |
|
|
4360 |
}
|
|
4361 |
|
|
4362 |
void CNSmlWLanAdapter::GetExpandedType(const TInt aEapType,
|
|
4363 |
const TInt aTunnelingType, TEapExpandedType& aExpanedId,
|
|
4364 |
TEapExpandedType& aExpanedEncapsId)
|
|
4365 |
{
|
|
4366 |
|
|
4367 |
// append it to the appropriate list ('+' enabled, '-' disabled)
|
|
4368 |
_LIT8(KPadding, "\xFE\0\0\0\0\0\0");
|
|
4369 |
_LIT8(KMsChapV2Padding, "\xFE\xFF\xFF\xFF\0\0\0");
|
|
4370 |
const TInt KPlainMsChapV2ImplUid = 99;
|
|
4371 |
|
|
4372 |
TBuf8<KExpandedEapIdLength> cmpbuf;
|
|
4373 |
if (aEapType == KPlainMsChapV2ImplUid)
|
|
4374 |
{
|
|
4375 |
cmpbuf.Append(KMsChapV2Padding);
|
|
4376 |
}
|
|
4377 |
else
|
|
4378 |
{
|
|
4379 |
cmpbuf.Append(KPadding);
|
|
4380 |
}
|
|
4381 |
cmpbuf.Append(aEapType);
|
|
4382 |
aExpanedId = cmpbuf;
|
|
4383 |
|
|
4384 |
TBuf8<KExpandedEapIdLength> encapscmpbuf;
|
|
4385 |
if (aTunnelingType == KPlainMsChapV2ImplUid)
|
|
4386 |
{
|
|
4387 |
encapscmpbuf.Append(KMsChapV2Padding);
|
|
4388 |
}
|
|
4389 |
else
|
|
4390 |
{
|
|
4391 |
encapscmpbuf.Append(KPadding);
|
|
4392 |
}
|
|
4393 |
encapscmpbuf.Append(aTunnelingType);
|
|
4394 |
aExpanedEncapsId = encapscmpbuf;
|
|
4395 |
|
|
4396 |
}
|
|
4397 |
|
|
4398 |
// end of file
|