|
1 // Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies). |
|
2 // All rights reserved. |
|
3 // This component and the accompanying materials are made available |
|
4 // under the terms of "Eclipse Public License v1.0" |
|
5 // which accompanies this distribution, and is available |
|
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
7 // |
|
8 // Initial Contributors: |
|
9 // Nokia Corporation - initial contribution. |
|
10 // |
|
11 // Contributors: |
|
12 // |
|
13 // Description: |
|
14 // |
|
15 |
|
16 |
|
17 #include "CSimContextHelper.h" |
|
18 |
|
19 #include "CSimPacketContext.h" |
|
20 #include "Simlog.h" |
|
21 |
|
22 //const RPacketContext::TContextConfigGPRS& aContextConfigV1 |
|
23 void CSimContextHelper::SetTContextConfigParamFromTContextConfigGPRS( TContextConfigParam& aContextConfigToSet, const RPacketContext::TContextConfigGPRS& aContextConfigV1 ) |
|
24 { |
|
25 aContextConfigToSet.iProtocolType = aContextConfigV1.iPdpType; |
|
26 aContextConfigToSet.iGsnAddress.Set(aContextConfigV1.iAccessPointName); |
|
27 aContextConfigToSet.iProtocolAddress.Set(aContextConfigV1.iPdpAddress); |
|
28 aContextConfigToSet.iAnonymousAccess = aContextConfigV1.iAnonymousAccessReqd; |
|
29 aContextConfigToSet.iUseEdge = aContextConfigV1.iUseEdge; |
|
30 aContextConfigToSet.iProtocolConfigOption.iAuthProtocol = aContextConfigV1.iProtocolConfigOption.iAuthInfo.iProtocol; |
|
31 aContextConfigToSet.iProtocolConfigOption.iUsername.Set(aContextConfigV1.iProtocolConfigOption.iAuthInfo.iUsername); |
|
32 aContextConfigToSet.iProtocolConfigOption.iPassword.Set(aContextConfigV1.iProtocolConfigOption.iAuthInfo.iPassword); |
|
33 aContextConfigToSet.iProtocolConfigOption.iChallenge.Set(aContextConfigV1.iProtocolConfigOption.iChallenge); |
|
34 aContextConfigToSet.iProtocolConfigOption.iResponse.Set(aContextConfigV1.iProtocolConfigOption.iResponse); |
|
35 aContextConfigToSet.iProtocolConfigOption.iPrimaryDNS.Set(aContextConfigV1.iProtocolConfigOption.iDnsAddresses.iPrimaryDns); |
|
36 aContextConfigToSet.iProtocolConfigOption.iSecondaryDNS.Set(aContextConfigV1.iProtocolConfigOption.iDnsAddresses.iSecondaryDns); |
|
37 aContextConfigToSet.iProtocolConfigOption.iId = aContextConfigV1.iProtocolConfigOption.iId; |
|
38 aContextConfigToSet.iProtocolConfigOption.iMiscBuffer = aContextConfigV1.iProtocolConfigOption.iMiscBuffer; |
|
39 |
|
40 if((aContextConfigV1.iPdpCompression & RPacketContext::KPdpHeaderCompression) != 0) |
|
41 { |
|
42 aContextConfigToSet.iPdpHeaderCompression = RPacketContext::EManufacturerDefaultHeaderCompression; |
|
43 } |
|
44 else |
|
45 { |
|
46 aContextConfigToSet.iPdpHeaderCompression = RPacketContext::ENoHeaderCompression; |
|
47 } |
|
48 |
|
49 if((aContextConfigV1.iPdpCompression & RPacketContext::KPdpDataCompression) != 0) |
|
50 { |
|
51 aContextConfigToSet.iPdpDataCompression = RPacketContext::EManufacturerDefaultDataCompression; |
|
52 } |
|
53 else |
|
54 { |
|
55 aContextConfigToSet.iPdpDataCompression = RPacketContext::ENoDataCompression; |
|
56 } |
|
57 } |
|
58 |
|
59 void CSimContextHelper::SetTContextConfigParamFromTContextConfigR99_R4( TContextConfigParam& aContextConfigToSet, const RPacketContext::TContextConfigR99_R4& aContextConfigV1 ) |
|
60 { |
|
61 aContextConfigToSet.iProtocolType = aContextConfigV1.iPdpType; |
|
62 aContextConfigToSet.iGsnAddress.Set(aContextConfigV1.iAccessPointName); |
|
63 aContextConfigToSet.iProtocolAddress.Set(aContextConfigV1.iPdpAddress); |
|
64 aContextConfigToSet.iAnonymousAccess = 0; /*RPacketContext::TAnonymousAccess::ENotApplicable;*/ |
|
65 aContextConfigToSet.iUseEdge = aContextConfigV1.iUseEdge; |
|
66 aContextConfigToSet.iProtocolConfigOption.iAuthProtocol = aContextConfigV1.iProtocolConfigOption.iAuthInfo.iProtocol; |
|
67 aContextConfigToSet.iProtocolConfigOption.iUsername.Set(aContextConfigV1.iProtocolConfigOption.iAuthInfo.iUsername); |
|
68 aContextConfigToSet.iProtocolConfigOption.iPassword.Set(aContextConfigV1.iProtocolConfigOption.iAuthInfo.iPassword); |
|
69 aContextConfigToSet.iProtocolConfigOption.iChallenge.Set(aContextConfigV1.iProtocolConfigOption.iChallenge); |
|
70 aContextConfigToSet.iProtocolConfigOption.iResponse.Set(aContextConfigV1.iProtocolConfigOption.iResponse); |
|
71 aContextConfigToSet.iProtocolConfigOption.iPrimaryDNS.Set(aContextConfigV1.iProtocolConfigOption.iDnsAddresses.iPrimaryDns); |
|
72 aContextConfigToSet.iProtocolConfigOption.iSecondaryDNS.Set(aContextConfigV1.iProtocolConfigOption.iDnsAddresses.iSecondaryDns); |
|
73 aContextConfigToSet.iProtocolConfigOption.iId = aContextConfigV1.iProtocolConfigOption.iId; |
|
74 aContextConfigToSet.iPdpHeaderCompression = RPacketContext::ENoHeaderCompression; |
|
75 aContextConfigToSet.iPdpDataCompression = RPacketContext::ENoDataCompression; |
|
76 aContextConfigToSet.iProtocolConfigOption.iMiscBuffer = aContextConfigV1.iProtocolConfigOption.iMiscBuffer; |
|
77 } |
|
78 |
|
79 void CSimContextHelper::SetTContextConfigParamFromTContextConfig_R5(TContextConfigParam& aContextConfigToSet,const RPacketContext::TContextConfig_R5& aContextConfigV1 ) |
|
80 { |
|
81 aContextConfigToSet.iProtocolType = aContextConfigV1.iPdpType; |
|
82 aContextConfigToSet.iGsnAddress.Set(aContextConfigV1.iAccessPointName); |
|
83 aContextConfigToSet.iProtocolAddress.Set(aContextConfigV1.iPdpAddress); |
|
84 aContextConfigToSet.iAnonymousAccess = 0; /*RPacketContext::TAnonymousAccess::ENotApplicable;*/ |
|
85 aContextConfigToSet.iUseEdge = aContextConfigV1.iUseEdge; |
|
86 aContextConfigToSet.iProtocolConfigOption.iAuthProtocol = aContextConfigV1.iProtocolConfigOption.iAuthInfo.iProtocol; |
|
87 aContextConfigToSet.iProtocolConfigOption.iUsername.Set(aContextConfigV1.iProtocolConfigOption.iAuthInfo.iUsername); |
|
88 aContextConfigToSet.iProtocolConfigOption.iPassword.Set(aContextConfigV1.iProtocolConfigOption.iAuthInfo.iPassword); |
|
89 aContextConfigToSet.iProtocolConfigOption.iChallenge.Set(aContextConfigV1.iProtocolConfigOption.iChallenge); |
|
90 aContextConfigToSet.iProtocolConfigOption.iResponse.Set(aContextConfigV1.iProtocolConfigOption.iResponse); |
|
91 aContextConfigToSet.iProtocolConfigOption.iPrimaryDNS.Set(aContextConfigV1.iProtocolConfigOption.iDnsAddresses.iPrimaryDns); |
|
92 aContextConfigToSet.iProtocolConfigOption.iSecondaryDNS.Set(aContextConfigV1.iProtocolConfigOption.iDnsAddresses.iSecondaryDns); |
|
93 aContextConfigToSet.iProtocolConfigOption.iId = aContextConfigV1.iProtocolConfigOption.iId; |
|
94 aContextConfigToSet.iPdpHeaderCompression = aContextConfigV1.iPdpHeaderCompression; |
|
95 aContextConfigToSet.iPdpDataCompression = aContextConfigV1.iPdpDataCompression; |
|
96 aContextConfigToSet.iProtocolConfigOption.iMiscBuffer = aContextConfigV1.iProtocolConfigOption.iMiscBuffer; |
|
97 } |
|
98 |
|
99 TBool CSimContextHelper::EqualTContextConfigParam(const TContextConfigParam& aContextConfigLHS, const TContextConfigParam& aContextConfigRHS ) |
|
100 { |
|
101 if((aContextConfigLHS.iProtocolType != aContextConfigRHS.iProtocolType) || |
|
102 (aContextConfigLHS.iGsnAddress.Compare(aContextConfigRHS.iGsnAddress) != 0 ) || |
|
103 (aContextConfigLHS.iAnonymousAccess != aContextConfigRHS.iAnonymousAccess) || |
|
104 (aContextConfigLHS.iUseEdge != aContextConfigRHS.iUseEdge) || |
|
105 (aContextConfigLHS.iProtocolConfigOption.iAuthProtocol != aContextConfigRHS.iProtocolConfigOption.iAuthProtocol) || |
|
106 (aContextConfigLHS.iProtocolConfigOption.iUsername.Compare(aContextConfigRHS.iProtocolConfigOption.iUsername) != 0) || |
|
107 (aContextConfigLHS.iProtocolConfigOption.iPassword.Compare(aContextConfigRHS.iProtocolConfigOption.iPassword) != 0) || |
|
108 (aContextConfigLHS.iProtocolConfigOption.iChallenge.Compare(aContextConfigRHS.iProtocolConfigOption.iChallenge) != 0) || |
|
109 (aContextConfigLHS.iProtocolConfigOption.iResponse.Compare(aContextConfigRHS.iProtocolConfigOption.iResponse) != 0) || |
|
110 // These line are commented as these parameters currently are usually returned by the network and not required for |
|
111 // setting the context configuration |
|
112 // (aContextConfigLHS.iProtocolConfigOption.iPrimaryDNS.Compare(aContextConfigRHS.iProtocolConfigOption.iPrimaryDNS) != 0) || |
|
113 // (aContextConfigLHS.iProtocolConfigOption.iSecondaryDNS.Compare(aContextConfigRHS.iProtocolConfigOption.iSecondaryDNS) != 0) || |
|
114 (aContextConfigLHS.iProtocolConfigOption.iId != aContextConfigRHS.iProtocolConfigOption.iId) || |
|
115 (aContextConfigLHS.iPdpHeaderCompression != aContextConfigRHS.iPdpHeaderCompression) || |
|
116 (aContextConfigLHS.iPdpDataCompression != aContextConfigRHS.iPdpDataCompression)) |
|
117 { |
|
118 return EFalse; |
|
119 } |
|
120 // else considered equal. |
|
121 |
|
122 return ETrue; |
|
123 } |
|
124 |
|
125 void CSimContextHelper::ConvertConfigParams(const TContextConfigParam& aInputConfig, RPacketContext::TContextConfigGPRS& aOutputConfig) |
|
126 { |
|
127 aOutputConfig.iPdpType = static_cast<RPacketContext::TProtocolType>(aInputConfig.iProtocolType); |
|
128 aOutputConfig.iAccessPointName.Copy(aInputConfig.iGsnAddress); |
|
129 aOutputConfig.iPdpAddress.Copy(aInputConfig.iProtocolAddress); |
|
130 |
|
131 //Translate the R5 SIMTSY internal representation of PDP Data/Header into the GPRS representation |
|
132 TUint pdpCompressionParam = 0; |
|
133 if(aInputConfig.iPdpDataCompression != static_cast<TUint>(RPacketContext::ENoDataCompression)) |
|
134 { |
|
135 pdpCompressionParam = (pdpCompressionParam | RPacketContext::KPdpDataCompression); |
|
136 } |
|
137 if(aInputConfig.iPdpHeaderCompression != RPacketContext::ENoHeaderCompression) |
|
138 { |
|
139 pdpCompressionParam = (pdpCompressionParam | RPacketContext::KPdpHeaderCompression); |
|
140 } |
|
141 |
|
142 aOutputConfig.iPdpCompression = pdpCompressionParam; |
|
143 aOutputConfig.iAnonymousAccessReqd = static_cast<RPacketContext::TAnonymousAccess>(aInputConfig.iAnonymousAccess); |
|
144 aOutputConfig.iUseEdge = static_cast<TBool>(aInputConfig.iUseEdge); |
|
145 aOutputConfig.iProtocolConfigOption.iAuthInfo.iProtocol = static_cast<RPacketContext::TAuthProtocol>(aInputConfig.iProtocolConfigOption.iAuthProtocol); |
|
146 aOutputConfig.iProtocolConfigOption.iAuthInfo.iUsername.Copy(aInputConfig.iProtocolConfigOption.iUsername); |
|
147 aOutputConfig.iProtocolConfigOption.iAuthInfo.iPassword.Copy(aInputConfig.iProtocolConfigOption.iPassword); |
|
148 aOutputConfig.iProtocolConfigOption.iChallenge.Copy(aInputConfig.iProtocolConfigOption.iChallenge); |
|
149 aOutputConfig.iProtocolConfigOption.iResponse.Copy(aInputConfig.iProtocolConfigOption.iResponse); |
|
150 aOutputConfig.iProtocolConfigOption.iDnsAddresses.iPrimaryDns.Copy(aInputConfig.iProtocolConfigOption.iPrimaryDNS); |
|
151 aOutputConfig.iProtocolConfigOption.iDnsAddresses.iSecondaryDns.Copy(aInputConfig.iProtocolConfigOption.iSecondaryDNS); |
|
152 aOutputConfig.iProtocolConfigOption.iId = static_cast<TUint8>(aInputConfig.iProtocolConfigOption.iId); |
|
153 aOutputConfig.iProtocolConfigOption.iMiscBuffer.Copy(aInputConfig.iProtocolConfigOption.iMiscBuffer); |
|
154 } |
|
155 |
|
156 void CSimContextHelper::ConvertConfigParams(const TContextConfigParam& aInputConfig, RPacketContext::TContextConfigR99_R4& aOutputConfig) |
|
157 { |
|
158 aOutputConfig.iPdpType = static_cast<RPacketContext::TProtocolType>(aInputConfig.iProtocolType); |
|
159 aOutputConfig.iAccessPointName.Copy(aInputConfig.iGsnAddress); |
|
160 aOutputConfig.iPdpAddress.Copy(aInputConfig.iProtocolAddress); |
|
161 aOutputConfig.iUseEdge = aInputConfig.iUseEdge; |
|
162 aOutputConfig.iProtocolConfigOption.iAuthInfo.iProtocol = static_cast<RPacketContext::TAuthProtocol>(aInputConfig.iProtocolConfigOption.iAuthProtocol); |
|
163 aOutputConfig.iProtocolConfigOption.iAuthInfo.iUsername.Copy(aInputConfig.iProtocolConfigOption.iUsername); |
|
164 aOutputConfig.iProtocolConfigOption.iAuthInfo.iPassword.Copy(aInputConfig.iProtocolConfigOption.iPassword); |
|
165 aOutputConfig.iProtocolConfigOption.iChallenge.Copy(aInputConfig.iProtocolConfigOption.iChallenge); |
|
166 aOutputConfig.iProtocolConfigOption.iResponse.Copy(aInputConfig.iProtocolConfigOption.iResponse); |
|
167 aOutputConfig.iProtocolConfigOption.iDnsAddresses.iPrimaryDns.Copy(aInputConfig.iProtocolConfigOption.iPrimaryDNS); |
|
168 aOutputConfig.iProtocolConfigOption.iDnsAddresses.iSecondaryDns.Copy(aInputConfig.iProtocolConfigOption.iSecondaryDNS); |
|
169 aOutputConfig.iProtocolConfigOption.iId = static_cast<TUint8>(aInputConfig.iProtocolConfigOption.iId); |
|
170 aOutputConfig.iProtocolConfigOption.iMiscBuffer.Copy(aInputConfig.iProtocolConfigOption.iMiscBuffer); |
|
171 } |
|
172 |
|
173 void CSimContextHelper::ConvertConfigParams(const TContextConfigParam& aInputConfig, RPacketContext::TContextConfig_R5& aOutputConfig) |
|
174 { |
|
175 aOutputConfig.iPdpType = static_cast<RPacketContext::TProtocolType>(aInputConfig.iProtocolType); |
|
176 aOutputConfig.iAccessPointName.Copy(aInputConfig.iGsnAddress); |
|
177 aOutputConfig.iPdpAddress.Copy(aInputConfig.iProtocolAddress); |
|
178 aOutputConfig.iUseEdge = aInputConfig.iUseEdge; |
|
179 aOutputConfig.iProtocolConfigOption.iAuthInfo.iProtocol = static_cast<RPacketContext::TAuthProtocol>(aInputConfig.iProtocolConfigOption.iAuthProtocol); |
|
180 aOutputConfig.iProtocolConfigOption.iAuthInfo.iUsername.Copy(aInputConfig.iProtocolConfigOption.iUsername); |
|
181 aOutputConfig.iProtocolConfigOption.iAuthInfo.iPassword.Copy(aInputConfig.iProtocolConfigOption.iPassword); |
|
182 aOutputConfig.iProtocolConfigOption.iChallenge.Copy(aInputConfig.iProtocolConfigOption.iChallenge); |
|
183 aOutputConfig.iProtocolConfigOption.iResponse.Copy(aInputConfig.iProtocolConfigOption.iResponse); |
|
184 aOutputConfig.iProtocolConfigOption.iDnsAddresses.iPrimaryDns.Copy(aInputConfig.iProtocolConfigOption.iPrimaryDNS); |
|
185 aOutputConfig.iProtocolConfigOption.iDnsAddresses.iSecondaryDns.Copy(aInputConfig.iProtocolConfigOption.iSecondaryDNS); |
|
186 aOutputConfig.iProtocolConfigOption.iId = static_cast<TUint8>(aInputConfig.iProtocolConfigOption.iId); |
|
187 aOutputConfig.iPdpDataCompression = static_cast<RPacketContext::TDataCompression>(aInputConfig.iPdpDataCompression); |
|
188 aOutputConfig.iPdpHeaderCompression = static_cast<RPacketContext::THeaderCompression>(aInputConfig.iPdpHeaderCompression); |
|
189 aOutputConfig.iProtocolConfigOption.iMiscBuffer.Copy(aInputConfig.iProtocolConfigOption.iMiscBuffer); |
|
190 } |
|
191 |
|
192 void CSimContextHelper::GetContextConfigParamSettingsL( const CTestConfigSection* const aCfgFile, const TPtrC8 aTag, |
|
193 CArrayFixFlat<TContextConfigParam>* aContextConfigParams ) |
|
194 { |
|
195 TContextConfigParam configParam; |
|
196 |
|
197 TInt protocolType, pdpCompression, anonymousAccess, useEdge, protocol, id; |
|
198 TInt pdpDataCompression, pdpHeaderCompression, numAdditionalParams; |
|
199 TPtrC8 gsnAddress, protocolAddress, username, password, challenge; |
|
200 TPtrC8 response, primaryDNS, secondaryDNS; |
|
201 |
|
202 configParam.iProtocolConfigOption.iMiscBuffer.Zero(); |
|
203 |
|
204 RPacketContext::TPcoId pcoId; |
|
205 |
|
206 TUint itemOffSet = 0; //Used for nested Addional Param items |
|
207 TInt delimiterField; |
|
208 |
|
209 TInt count = aCfgFile->ItemCount(aTag); |
|
210 |
|
211 for(TInt i=0;i<count;i++) |
|
212 { |
|
213 const CTestConfigItem* item = aCfgFile->Item(aTag,i); |
|
214 if(!item) |
|
215 break; |
|
216 |
|
217 //Get the Protocol Type from the config file |
|
218 TInt ret=CTestConfig::GetElement(item->Value(),KStdDelimiter,0,protocolType); |
|
219 if(ret!=KErrNone) |
|
220 { |
|
221 LOGPARSERR("ContextConfigParams::protocolType",ret,0,&aTag); |
|
222 continue; |
|
223 } |
|
224 else |
|
225 { |
|
226 configParam.iProtocolType = protocolType; |
|
227 } |
|
228 |
|
229 |
|
230 //Get the GGSN Address from the config file |
|
231 ret=CTestConfig::GetElement(item->Value(),KStdDelimiter,1,gsnAddress); |
|
232 if(ret!=KErrNone) |
|
233 { |
|
234 LOGPARSERR("ContextConfigParams::gsnAddress",ret,1,&aTag); |
|
235 continue; |
|
236 } |
|
237 else |
|
238 { |
|
239 configParam.iGsnAddress.Set(gsnAddress); |
|
240 } |
|
241 |
|
242 |
|
243 //Get the ProtocolAddress from the config file |
|
244 ret=CTestConfig::GetElement(item->Value(),KStdDelimiter,2,protocolAddress); |
|
245 if(ret!=KErrNone) |
|
246 { |
|
247 LOGPARSERR("ContextConfigParams::protocolAddress",ret,2,&aTag); |
|
248 continue; |
|
249 } |
|
250 else |
|
251 { |
|
252 configParam.iProtocolAddress.Set(protocolAddress); |
|
253 } |
|
254 |
|
255 |
|
256 //Get the pdpCompression from the config file |
|
257 //If the tag is a GPRS config tag, map the GPRS configuration to the R5 format used internally in SIMTSY |
|
258 if(aTag == KSetContextConfigGPRS) |
|
259 { |
|
260 ret=CTestConfig::GetElement(item->Value(),KStdDelimiter,3,pdpCompression); |
|
261 if(ret!=KErrNone) |
|
262 { |
|
263 LOGPARSERR("ContextConfigParams::pdpCompression",ret,3,&aTag); |
|
264 continue; |
|
265 } |
|
266 else |
|
267 { |
|
268 //Set the GPRS PDP compression Config params |
|
269 //configParam.iPdpCompression = pdpCompression; |
|
270 |
|
271 //Set the R5 PDP header compression config params based on GPRS params |
|
272 if((pdpCompression & RPacketContext::KPdpHeaderCompression) != 0) |
|
273 { |
|
274 configParam.iPdpHeaderCompression = RPacketContext::EManufacturerDefaultHeaderCompression; |
|
275 } |
|
276 else |
|
277 { |
|
278 configParam.iPdpHeaderCompression = RPacketContext::ENoHeaderCompression; |
|
279 } |
|
280 |
|
281 if((pdpCompression & RPacketContext::KPdpDataCompression) != 0) |
|
282 { |
|
283 configParam.iPdpDataCompression = RPacketContext::EManufacturerDefaultDataCompression; |
|
284 } |
|
285 else |
|
286 { |
|
287 configParam.iPdpDataCompression = RPacketContext::ENoDataCompression; |
|
288 } |
|
289 } |
|
290 |
|
291 } |
|
292 else if(aTag == KSetContextConfigRel5) |
|
293 { |
|
294 //Get the PDP Header Compression params |
|
295 ret=CTestConfig::GetElement(item->Value(),KStdDelimiter,12,pdpHeaderCompression); |
|
296 if(ret!=KErrNone) |
|
297 { |
|
298 LOGPARSERR("ContextConfigParams::pdpHeaderCompression",ret,12,&aTag); |
|
299 continue; |
|
300 } |
|
301 else |
|
302 { |
|
303 configParam.iPdpHeaderCompression = pdpHeaderCompression; |
|
304 } |
|
305 |
|
306 //Get the PDP Data compression params |
|
307 ret=CTestConfig::GetElement(item->Value(),KStdDelimiter,13,pdpDataCompression); |
|
308 if(ret!=KErrNone) |
|
309 { |
|
310 LOGPARSERR("ContextConfigParams::pdpDataCompression",ret,13,&aTag); |
|
311 continue; |
|
312 } |
|
313 else |
|
314 { |
|
315 configParam.iPdpDataCompression = pdpDataCompression; |
|
316 } |
|
317 } |
|
318 else |
|
319 { |
|
320 configParam.iPdpHeaderCompression = RPacketContext::ENoHeaderCompression; |
|
321 configParam.iPdpDataCompression = RPacketContext::ENoDataCompression; |
|
322 } |
|
323 |
|
324 |
|
325 //Get the Anonymous Access param if this is a GPRS PDP context config param tag |
|
326 if(aTag == KSetContextConfigGPRS) |
|
327 { |
|
328 ret=CTestConfig::GetElement(item->Value(),KStdDelimiter,4,anonymousAccess); |
|
329 if(ret!=KErrNone) |
|
330 { |
|
331 LOGPARSERR("ContextConfigParams::anonymousAccess",ret,4,&aTag); |
|
332 continue; |
|
333 } |
|
334 else |
|
335 { |
|
336 configParam.iAnonymousAccess = anonymousAccess; |
|
337 } |
|
338 } |
|
339 else |
|
340 { |
|
341 configParam.iAnonymousAccess = 0; /*RPacketContext::TAnonymousAccess::ENotApplicable;*/ |
|
342 } |
|
343 |
|
344 |
|
345 //Get the UseEdge config param from the config file |
|
346 if(aTag == KSetContextConfigGPRS) |
|
347 { |
|
348 delimiterField = 5; |
|
349 } |
|
350 else |
|
351 { |
|
352 delimiterField = 3; |
|
353 } |
|
354 |
|
355 ret=CTestConfig::GetElement(item->Value(),KStdDelimiter,delimiterField,useEdge); |
|
356 if(ret!=KErrNone) |
|
357 { |
|
358 LOGPARSERR("ContextConfigParams::useEdge",ret,delimiterField,&aTag); |
|
359 continue; |
|
360 } |
|
361 else |
|
362 { |
|
363 configParam.iUseEdge = useEdge; |
|
364 } |
|
365 |
|
366 |
|
367 //Get the Autorisation Protocol config param from the config file |
|
368 if(aTag == KSetContextConfigGPRS) |
|
369 { |
|
370 delimiterField = 6; |
|
371 } |
|
372 else |
|
373 { |
|
374 delimiterField = 4; |
|
375 } |
|
376 |
|
377 ret=CTestConfig::GetElement(item->Value(),KStdDelimiter,delimiterField,protocol); |
|
378 if(ret!=KErrNone) |
|
379 { |
|
380 LOGPARSERR("ProtocolConfigOption::protocol",ret,delimiterField,&aTag); |
|
381 } |
|
382 else |
|
383 { |
|
384 configParam.iProtocolConfigOption.iAuthProtocol = protocol; |
|
385 } |
|
386 |
|
387 |
|
388 //Get the Username config param from the config file |
|
389 if(aTag == KSetContextConfigGPRS) |
|
390 { |
|
391 delimiterField = 7; |
|
392 } |
|
393 else |
|
394 { |
|
395 delimiterField = 5; |
|
396 } |
|
397 |
|
398 ret=CTestConfig::GetElement(item->Value(),KStdDelimiter,delimiterField,username); |
|
399 if(ret!=KErrNone) |
|
400 { |
|
401 LOGPARSERR("ProtocolConfigOption::username",ret,delimiterField,&aTag); |
|
402 } |
|
403 else |
|
404 { |
|
405 configParam.iProtocolConfigOption.iUsername.Set(username); |
|
406 } |
|
407 |
|
408 |
|
409 //Get the password config param from the config file |
|
410 if(aTag == KSetContextConfigGPRS) |
|
411 { |
|
412 delimiterField = 8; |
|
413 } |
|
414 else |
|
415 { |
|
416 delimiterField = 6; |
|
417 } |
|
418 |
|
419 ret=CTestConfig::GetElement(item->Value(),KStdDelimiter,delimiterField,password); |
|
420 if(ret!=KErrNone) |
|
421 { |
|
422 LOGPARSERR("ProtocolConfigOption::password",ret,delimiterField,&aTag); |
|
423 } |
|
424 else |
|
425 { |
|
426 configParam.iProtocolConfigOption.iPassword.Set(password); |
|
427 } |
|
428 |
|
429 |
|
430 //Get the Challenge config param from the config file |
|
431 if(aTag == KSetContextConfigGPRS) |
|
432 { |
|
433 delimiterField = 9; |
|
434 } |
|
435 else |
|
436 { |
|
437 delimiterField = 7; |
|
438 } |
|
439 |
|
440 ret=CTestConfig::GetElement(item->Value(),KStdDelimiter,delimiterField,challenge); |
|
441 if(ret!=KErrNone) |
|
442 { |
|
443 LOGPARSERR("ProtocolConfigOption::challenge",ret,delimiterField,&aTag); |
|
444 } |
|
445 else |
|
446 { |
|
447 configParam.iProtocolConfigOption.iChallenge.Set(challenge); |
|
448 } |
|
449 |
|
450 |
|
451 //Get the Response config param from the config file |
|
452 if(aTag == KSetContextConfigGPRS) |
|
453 { |
|
454 delimiterField = 10; |
|
455 } |
|
456 else |
|
457 { |
|
458 delimiterField = 8; |
|
459 } |
|
460 |
|
461 ret=CTestConfig::GetElement(item->Value(),KStdDelimiter,delimiterField,response); |
|
462 if(ret!=KErrNone) |
|
463 { |
|
464 LOGPARSERR("ProtocolConfigOption::response",ret,delimiterField,&aTag); |
|
465 } |
|
466 else |
|
467 { |
|
468 configParam.iProtocolConfigOption.iResponse.Set(response); |
|
469 } |
|
470 |
|
471 |
|
472 //Get the Primary DNS config param from the config file |
|
473 if(aTag == KSetContextConfigGPRS) |
|
474 { |
|
475 delimiterField = 11; |
|
476 } |
|
477 else |
|
478 { |
|
479 delimiterField = 9; |
|
480 } |
|
481 |
|
482 ret=CTestConfig::GetElement(item->Value(),KStdDelimiter,delimiterField,primaryDNS); |
|
483 if(ret!=KErrNone) |
|
484 { |
|
485 LOGPARSERR("ProtocolConfigOption::primaryDNS",ret,delimiterField,&aTag); |
|
486 } |
|
487 else |
|
488 { |
|
489 configParam.iProtocolConfigOption.iPrimaryDNS.Set(primaryDNS); |
|
490 } |
|
491 |
|
492 |
|
493 //Get the Secondary DNS config param from the config file |
|
494 if(aTag == KSetContextConfigGPRS) |
|
495 { |
|
496 delimiterField = 12; |
|
497 } |
|
498 else |
|
499 { |
|
500 delimiterField = 10; |
|
501 } |
|
502 |
|
503 ret=CTestConfig::GetElement(item->Value(),KStdDelimiter,delimiterField,secondaryDNS); |
|
504 if(ret!=KErrNone) |
|
505 { |
|
506 LOGPARSERR("ProtocolConfigOption::secondaryDNS",ret,delimiterField,&aTag); |
|
507 } |
|
508 else |
|
509 { |
|
510 configParam.iProtocolConfigOption.iSecondaryDNS.Set(secondaryDNS); |
|
511 } |
|
512 |
|
513 |
|
514 //Get the ID config param from the config file. |
|
515 if(aTag == KSetContextConfigGPRS) |
|
516 { |
|
517 delimiterField = 13; |
|
518 } |
|
519 else |
|
520 { |
|
521 delimiterField = 11; |
|
522 } |
|
523 |
|
524 ret=CTestConfig::GetElement(item->Value(),KStdDelimiter,delimiterField,id); |
|
525 if(ret!=KErrNone) |
|
526 { |
|
527 LOGPARSERR("ProtocolConfigOption::id",ret,delimiterField,&aTag); |
|
528 } |
|
529 else |
|
530 { |
|
531 configParam.iProtocolConfigOption.iId = id; |
|
532 } |
|
533 |
|
534 |
|
535 //Get the Additional Params List |
|
536 |
|
537 //Create buffer to hold the TLV structure |
|
538 RPacketContext::TMiscProtocolBuffer miscBuffer; |
|
539 miscBuffer.Zero(); |
|
540 |
|
541 |
|
542 //Get the number of items in the Additional Params List |
|
543 if (aTag == KSetContextConfigRel99) |
|
544 { |
|
545 delimiterField = 12; |
|
546 } |
|
547 else |
|
548 { |
|
549 delimiterField = 14; |
|
550 } |
|
551 |
|
552 ret=CTestConfig::GetElement(item->Value(),KStdDelimiter,delimiterField,numAdditionalParams); |
|
553 |
|
554 if(ret!=KErrNone) |
|
555 { |
|
556 LOGPARSERR("ProtocolConfigOption::numAdditionalParams",ret,delimiterField,&aTag); |
|
557 } |
|
558 else |
|
559 { |
|
560 TInt nestedItemNumber; |
|
561 TUint16 digit, format; |
|
562 const CTestConfigItem* item2; |
|
563 |
|
564 TPtr8 pcoPtr(const_cast<TUint8*>(miscBuffer.Ptr()), |
|
565 RPacketContext::KMiscProtocolBufferLength); |
|
566 |
|
567 // Attach TTlv to the buffer |
|
568 TTlvStruct<RPacketContext::TPcoId,RPacketContext::TPcoItemDataLength> theTLV(pcoPtr,0); |
|
569 |
|
570 for(nestedItemNumber=itemOffSet; nestedItemNumber<itemOffSet+numAdditionalParams; nestedItemNumber++) |
|
571 { |
|
572 |
|
573 // Get the relevant Additional Param Item |
|
574 |
|
575 // Find the correct tag |
|
576 if (aTag == KSetContextConfigRel5) |
|
577 { |
|
578 item2 = aCfgFile->Item(KAdditionalParamItem, nestedItemNumber); |
|
579 } |
|
580 else if (aTag == KSetContextConfigGPRS) |
|
581 { |
|
582 item2 = aCfgFile->Item(KAdditionalParamItemGPRS, nestedItemNumber); |
|
583 } |
|
584 else |
|
585 { |
|
586 // Otherwise it is KSetContextConfigRel99 |
|
587 item2 = aCfgFile->Item(KAdditionalParamItemRel99, nestedItemNumber); |
|
588 } |
|
589 |
|
590 if(!item2) |
|
591 { |
|
592 break; |
|
593 } |
|
594 |
|
595 TPtrC8 additionalParamId, additionalParamData, additionalParamDataFormat; |
|
596 |
|
597 // Get TPcoProtocolId |
|
598 ret=CTestConfig::GetElement(item2->Value(),KStdDelimiter,0,additionalParamId); |
|
599 if(ret!=KErrNone) |
|
600 { |
|
601 LOGPARSERR("AdditionalParamItem::additionalParamId",ret,0,&aTag); |
|
602 continue; |
|
603 } |
|
604 else |
|
605 { |
|
606 if(AsciiToNum(additionalParamId, digit) == KErrNone) |
|
607 { |
|
608 pcoId.SetId(digit); |
|
609 } |
|
610 else |
|
611 { |
|
612 LOGPARSERR("AdditionalParamItem::additionalParamId",KErrArgument,0,&aTag); |
|
613 continue; |
|
614 } |
|
615 } |
|
616 |
|
617 // Read AdditionalParamDataFormat field to find out how |
|
618 // to interpret data in the AdditionalParamData field |
|
619 ret=CTestConfig::GetElement(item2->Value(),KStdDelimiter,2,additionalParamDataFormat); |
|
620 if (ret != KErrNone) |
|
621 { |
|
622 // AdditionalParamDataFormat not been specified, |
|
623 // default to plain ASCII |
|
624 LOGPARSERR("AdditionalParamItem::additionalParamDataFormat",ret,2,&aTag); |
|
625 format = EConfigDataFormatAscii; |
|
626 } |
|
627 else |
|
628 { |
|
629 if (AsciiToNum(additionalParamDataFormat, format) != KErrNone) |
|
630 { |
|
631 LOGPARSERR("AdditionalParamItem::additionalParamDataFormat",KErrArgument,2,&aTag); |
|
632 format = EConfigDataFormatAscii; |
|
633 } |
|
634 |
|
635 // Check that the AdditionalParamDataFormat value |
|
636 // specified in the config file is a valid one, |
|
637 // default to ASCII if not. |
|
638 if (format >= EMaxConfigDataFormat) |
|
639 { |
|
640 LOGPARSERR("AdditionalParamItem::additionalParamDataFormat",KErrArgument,2,&aTag); |
|
641 format = EConfigDataFormatAscii; |
|
642 } |
|
643 } |
|
644 |
|
645 // Read AdditionalParamData |
|
646 ret=CTestConfig::GetElement(item2->Value(),KStdDelimiter,1,additionalParamData); |
|
647 if(ret!=KErrNone) |
|
648 { |
|
649 LOGPARSERR("AdditionalParamItem::additionalParamContent",ret,1,&aTag); |
|
650 continue; |
|
651 } |
|
652 else |
|
653 { |
|
654 // Add AdditionalParamData to PCO buffer depending on format |
|
655 switch (format) |
|
656 { |
|
657 case EConfigDataFormatMixedBinaryAndAscii: |
|
658 { |
|
659 // Parse the string here |
|
660 // Will store the parsed data when algorithm has completed |
|
661 TBuf8<RPacketContext::KMiscProtocolBufferLength> additionalParamDataBuffer; |
|
662 additionalParamDataBuffer.Copy (additionalParamData); |
|
663 |
|
664 if (ParseMixedBinaryAsciiDataL(additionalParamDataBuffer) != KErrNone) |
|
665 { |
|
666 LOGPARSERR("AdditionalParamItem::additionalParamContent",KErrArgument,1,&aTag); |
|
667 SimPanic(EInvalidParameterFormatInConfigFile); |
|
668 } |
|
669 TPtr8 additionalParamDataPtr(const_cast<TUint8*>(additionalParamDataBuffer.Ptr()), |
|
670 additionalParamDataBuffer.Length(), additionalParamDataBuffer.Length()); |
|
671 theTLV.AppendItemL(pcoId,additionalParamDataPtr); |
|
672 miscBuffer.SetLength(pcoPtr.Length()); |
|
673 } // case EAdditionalParamDataFormatMixedBinaryAndAscii |
|
674 break; |
|
675 case EConfigDataFormatAscii: |
|
676 default: |
|
677 // No string handling required for plain ASCII. |
|
678 TPtr8 additionalParamDataPtr(const_cast<TUint8*>(additionalParamData.Ptr()), |
|
679 additionalParamData.Length(), additionalParamData.Length()); |
|
680 theTLV.AppendItemL(pcoId,additionalParamDataPtr); |
|
681 miscBuffer.SetLength(pcoPtr.Length()); |
|
682 break; |
|
683 } // switch (format) |
|
684 } // End else |
|
685 } // End for loop |
|
686 |
|
687 configParam.iProtocolConfigOption.iMiscBuffer = miscBuffer; |
|
688 itemOffSet= itemOffSet + numAdditionalParams; |
|
689 } |
|
690 |
|
691 |
|
692 //Get if the context is valid from the config file. |
|
693 if(aTag == KSetContextConfigRel99) |
|
694 { |
|
695 delimiterField = 13; |
|
696 } |
|
697 else |
|
698 { |
|
699 delimiterField = 15; |
|
700 } |
|
701 |
|
702 aContextConfigParams->AppendL(configParam); |
|
703 } |
|
704 } |