1 // Copyright (c) 2004-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 // Compares various packet context related structures |
|
15 // |
|
16 // |
|
17 |
|
18 /** |
|
19 @file |
|
20 @internalComponent |
|
21 */ |
|
22 |
|
23 #include "CompareContextParameters.h" |
|
24 |
|
25 /** |
|
26 @return ETrue if the TContextInfo parameters match, EFalse if they don't |
|
27 */ |
|
28 TBool CompareContextInfo(const TContextInfo& aFirst, const TContextInfo& aSecond) |
|
29 { |
|
30 if (aFirst.iContextId != aSecond.iContextId) |
|
31 { |
|
32 return EFalse; |
|
33 } |
|
34 if (aFirst.iStatus != aSecond.iStatus) |
|
35 { |
|
36 return EFalse; |
|
37 } |
|
38 return ETrue; |
|
39 } |
|
40 |
|
41 /** |
|
42 @return ETrue if the RPacketQoS::TBitRate parameters match, EFalse if they don't |
|
43 */ |
|
44 TBool CompareBitRate(const RPacketQoS::TBitRate &aFirst, const RPacketQoS::TBitRate &aSecond) |
|
45 { |
|
46 if (aFirst.iDownlinkRate != aSecond.iDownlinkRate) |
|
47 { |
|
48 return EFalse; |
|
49 } |
|
50 if (aFirst.iUplinkRate != aSecond.iUplinkRate) |
|
51 { |
|
52 return EFalse; |
|
53 } |
|
54 return ETrue; |
|
55 } |
|
56 |
|
57 /** |
|
58 @return ETrue if the RPacketQoS::TQoSR99_R4Requested parameters match, EFalse if they don't |
|
59 */ |
|
60 TBool CompareUMTSQoSReq(const RPacketQoS::TQoSR99_R4Requested &aFirst, const RPacketQoS::TQoSR99_R4Requested &aSecond) |
|
61 { |
|
62 if (aFirst.iReqTrafficClass != aSecond.iReqTrafficClass) |
|
63 { |
|
64 return EFalse; |
|
65 } |
|
66 if (aFirst.iMinTrafficClass != aSecond.iMinTrafficClass) |
|
67 { |
|
68 return EFalse; |
|
69 } |
|
70 if (aFirst.iReqDeliveryOrderReqd != aSecond.iReqDeliveryOrderReqd) |
|
71 { |
|
72 return EFalse; |
|
73 } |
|
74 if (aFirst.iMinDeliveryOrderReqd != aSecond.iMinDeliveryOrderReqd) |
|
75 { |
|
76 return EFalse; |
|
77 } |
|
78 if (aFirst.iReqDeliverErroneousSDU != aSecond.iReqDeliverErroneousSDU) |
|
79 { |
|
80 return EFalse; |
|
81 } |
|
82 if (aFirst.iMinDeliverErroneousSDU != aSecond.iMinDeliverErroneousSDU) |
|
83 { |
|
84 return EFalse; |
|
85 } |
|
86 if (aFirst.iReqMaxSDUSize != aSecond.iReqMaxSDUSize) |
|
87 { |
|
88 return EFalse; |
|
89 } |
|
90 if (aFirst.iMinAcceptableMaxSDUSize != aSecond.iMinAcceptableMaxSDUSize) |
|
91 { |
|
92 return EFalse; |
|
93 } |
|
94 if (!CompareBitRate(aFirst.iReqMaxRate, aSecond.iReqMaxRate)) |
|
95 { |
|
96 return EFalse; |
|
97 } |
|
98 if (!CompareBitRate(aFirst.iMinAcceptableMaxRate, aSecond.iMinAcceptableMaxRate)) |
|
99 { |
|
100 return EFalse; |
|
101 } |
|
102 if (aFirst.iReqBER != aSecond.iReqBER) |
|
103 { |
|
104 return EFalse; |
|
105 } |
|
106 if (aFirst.iMaxBER != aSecond.iMaxBER) |
|
107 { |
|
108 return EFalse; |
|
109 } |
|
110 if (aFirst.iReqSDUErrorRatio != aSecond.iReqSDUErrorRatio) |
|
111 { |
|
112 return EFalse; |
|
113 } |
|
114 if (aFirst.iMaxSDUErrorRatio != aSecond.iMaxSDUErrorRatio) |
|
115 { |
|
116 return EFalse; |
|
117 } |
|
118 if (aFirst.iReqTrafficHandlingPriority != aSecond.iReqTrafficHandlingPriority) |
|
119 { |
|
120 return EFalse; |
|
121 } |
|
122 if (aFirst.iMinTrafficHandlingPriority != aSecond.iMinTrafficHandlingPriority) |
|
123 { |
|
124 return EFalse; |
|
125 } |
|
126 if (aFirst.iReqTransferDelay != aSecond.iReqTransferDelay) |
|
127 { |
|
128 return EFalse; |
|
129 } |
|
130 if (aFirst.iMaxTransferDelay != aSecond.iMaxTransferDelay) |
|
131 { |
|
132 return EFalse; |
|
133 } |
|
134 if (aFirst.iReqGuaranteedRate.iDownlinkRate != aSecond.iReqGuaranteedRate.iDownlinkRate) |
|
135 { |
|
136 return EFalse; |
|
137 } |
|
138 if (aFirst.iReqGuaranteedRate.iUplinkRate != aSecond.iReqGuaranteedRate.iUplinkRate) |
|
139 { |
|
140 return EFalse; |
|
141 } |
|
142 if (aFirst.iMinGuaranteedRate.iDownlinkRate != aSecond.iMinGuaranteedRate.iDownlinkRate) |
|
143 { |
|
144 return EFalse; |
|
145 } |
|
146 if (aFirst.iMinGuaranteedRate.iUplinkRate != aSecond.iMinGuaranteedRate.iUplinkRate) |
|
147 { |
|
148 return EFalse; |
|
149 } |
|
150 return ETrue; |
|
151 } |
|
152 |
|
153 |
|
154 #ifdef SYMBIAN_NETWORKING_UMTSR5 |
|
155 TBool CompareUMTSQoSReq(const RPacketQoS::TQoSR5Requested &aFirst, const RPacketQoS::TQoSR5Requested &aSecond) |
|
156 { |
|
157 TBool result = CompareUMTSQoSReq(static_cast<const RPacketQoS::TQoSR99_R4Requested&>(aFirst), |
|
158 static_cast<const RPacketQoS::TQoSR99_R4Requested&>(aSecond)); |
|
159 |
|
160 if (!result) |
|
161 { |
|
162 return EFalse; |
|
163 } |
|
164 |
|
165 if (aFirst.iSignallingIndication != aSecond.iSignallingIndication) |
|
166 { |
|
167 return EFalse; |
|
168 } |
|
169 |
|
170 if (aFirst.iSourceStatisticsDescriptor != aSecond.iSourceStatisticsDescriptor) |
|
171 { |
|
172 return EFalse; |
|
173 } |
|
174 |
|
175 return ETrue; |
|
176 } |
|
177 #endif |
|
178 |
|
179 |
|
180 /** |
|
181 @return ETrue if the TContextConfig parameters match, EFalse if they don't |
|
182 */ |
|
183 TBool CompareUMTSQoSReq(const TContextConfig& aFirst, const TContextConfig& aSecond) |
|
184 { |
|
185 #ifdef SYMBIAN_NETWORKING_UMTSR5 |
|
186 RPacketQoS::TQoSR5Requested firstUMTSQoSRequest, secondUMTSQoSRequest; |
|
187 aFirst.GetUMTSQoSReq(firstUMTSQoSRequest); |
|
188 aSecond.GetUMTSQoSReq(secondUMTSQoSRequest); |
|
189 |
|
190 #else |
|
191 RPacketQoS::TQoSR99_R4Requested firstUMTSQoSRequest, secondUMTSQoSRequest; |
|
192 aFirst.GetUMTSQoSReq(firstUMTSQoSRequest); |
|
193 aSecond.GetUMTSQoSReq(secondUMTSQoSRequest); |
|
194 #endif |
|
195 |
|
196 return CompareUMTSQoSReq(firstUMTSQoSRequest, secondUMTSQoSRequest); |
|
197 } |
|
198 |
|
199 |
|
200 |
|
201 |
|
202 /** |
|
203 @return ETrue if the IP address parameters match, EFalse if they don't |
|
204 */ |
|
205 TBool CompareIPAddress(const TUint8* aFirst, const TUint8* aSecond) |
|
206 { |
|
207 for (TUint i = 0; i < RPacketContext::KIPAddressSize; i++) |
|
208 { |
|
209 if (aFirst[i] != aSecond[i]) |
|
210 { |
|
211 return EFalse; |
|
212 } |
|
213 } |
|
214 return ETrue; |
|
215 } |
|
216 |
|
217 /** |
|
218 @return ETrue if the RPacketContext::TPacketFilterV2 parameters match, EFalse if they don't |
|
219 */ |
|
220 TBool ComparePacketFilterV2(const RPacketContext::TPacketFilterV2 &aFirst, const RPacketContext::TPacketFilterV2 &aSecond) |
|
221 { |
|
222 if (aFirst.iId != aSecond.iId) |
|
223 { |
|
224 return EFalse; |
|
225 } |
|
226 if (aFirst.iEvaluationPrecedenceIndex != aSecond.iEvaluationPrecedenceIndex) |
|
227 { |
|
228 return EFalse; |
|
229 } |
|
230 if (!CompareIPAddress((TUint8*)aFirst.iSrcAddr, (TUint8*)aSecond.iSrcAddr)) |
|
231 { |
|
232 return EFalse; |
|
233 } |
|
234 if (!CompareIPAddress((TUint8*)aFirst.iSrcAddrSubnetMask, (TUint8*)aSecond.iSrcAddrSubnetMask)) |
|
235 { |
|
236 return EFalse; |
|
237 } |
|
238 if (aFirst.iProtocolNumberOrNextHeader != aSecond.iProtocolNumberOrNextHeader) |
|
239 { |
|
240 return EFalse; |
|
241 } |
|
242 if (aFirst.iSrcPortMin != aSecond.iSrcPortMin) |
|
243 { |
|
244 return EFalse; |
|
245 } |
|
246 if (aFirst.iSrcPortMax != aSecond.iSrcPortMax) |
|
247 { |
|
248 return EFalse; |
|
249 } |
|
250 if (aFirst.iDestPortMin != aSecond.iDestPortMin) |
|
251 { |
|
252 return EFalse; |
|
253 } |
|
254 if (aFirst.iDestPortMax != aSecond.iDestPortMax) |
|
255 { |
|
256 return EFalse; |
|
257 } |
|
258 if (aFirst.iIPSecSPI != aSecond.iIPSecSPI) |
|
259 { |
|
260 return EFalse; |
|
261 } |
|
262 if (aFirst.iTOSorTrafficClass != aSecond.iTOSorTrafficClass) |
|
263 { |
|
264 return EFalse; |
|
265 } |
|
266 if (aFirst.iFlowLabel != aSecond.iFlowLabel) |
|
267 { |
|
268 return EFalse; |
|
269 } |
|
270 return ETrue; |
|
271 } |
|
272 |
|
273 /** |
|
274 @return ETrue if the TTFTInfo parameters match, EFalse if they don't |
|
275 */ |
|
276 TBool CompareTFTInfo(TTFTInfo &aFirst, TTFTInfo &aSecond) |
|
277 { |
|
278 if (aFirst.FilterCount() != aSecond.FilterCount()) |
|
279 { |
|
280 return EFalse; |
|
281 } |
|
282 |
|
283 for (TUint8 i = 0; i < aFirst.FilterCount(); i++) |
|
284 { |
|
285 RPacketContext::TPacketFilterV2 firstPacketFilter, secondPacketFilter; |
|
286 aFirst.GetPacketFilter(firstPacketFilter); |
|
287 aSecond.GetPacketFilter(secondPacketFilter); |
|
288 if (!ComparePacketFilterV2(firstPacketFilter, secondPacketFilter)) |
|
289 { |
|
290 return EFalse; |
|
291 } |
|
292 } |
|
293 return ETrue; |
|
294 } |
|
295 |
|
296 /** |
|
297 @return ETrue if the TContextConfig parameters match, EFalse if they don't |
|
298 */ |
|
299 TBool CompareTFTInfo(const TContextConfig& aFirst, const TContextConfig& aSecond) |
|
300 { |
|
301 TTFTInfo firstTFTInfo, secondTFTInfo; |
|
302 aFirst.GetTFTInfo(firstTFTInfo); |
|
303 aSecond.GetTFTInfo(secondTFTInfo); |
|
304 return CompareTFTInfo(firstTFTInfo, secondTFTInfo); |
|
305 } |
|
306 |
|
307 |
|
308 /** |
|
309 @return ETrue if the RPacketQoS::TQoSR99_R4Negotiated parameters match, EFalse if they don't |
|
310 */ |
|
311 TBool CompareUMTSQoSNeg(const RPacketQoS::TQoSR99_R4Negotiated &aFirst, const RPacketQoS::TQoSR99_R4Negotiated &aSecond) |
|
312 { |
|
313 if (aFirst.iTrafficClass != aSecond.iTrafficClass) |
|
314 { |
|
315 return EFalse; |
|
316 } |
|
317 if (aFirst.iDeliveryOrderReqd != aSecond.iDeliveryOrderReqd) |
|
318 { |
|
319 return EFalse; |
|
320 } |
|
321 if (aFirst.iDeliverErroneousSDU != aSecond.iDeliverErroneousSDU) |
|
322 { |
|
323 return EFalse; |
|
324 } |
|
325 if (aFirst.iMaxSDUSize != aSecond.iMaxSDUSize) |
|
326 { |
|
327 return EFalse; |
|
328 } |
|
329 if (!CompareBitRate(aFirst.iMaxRate, aSecond.iMaxRate)) |
|
330 { |
|
331 return EFalse; |
|
332 } |
|
333 if (aFirst.iBER != aSecond.iBER) |
|
334 { |
|
335 return EFalse; |
|
336 } |
|
337 if (aFirst.iSDUErrorRatio != aSecond.iSDUErrorRatio) |
|
338 { |
|
339 return EFalse; |
|
340 } |
|
341 if (aFirst.iTrafficHandlingPriority != aSecond.iTrafficHandlingPriority) |
|
342 { |
|
343 return EFalse; |
|
344 } |
|
345 if (aFirst.iTransferDelay != aSecond.iTransferDelay) |
|
346 { |
|
347 return EFalse; |
|
348 } |
|
349 if (!CompareBitRate(aFirst.iGuaranteedRate, aSecond.iGuaranteedRate)) |
|
350 { |
|
351 return EFalse; |
|
352 } |
|
353 return ETrue; |
|
354 } |
|
355 |
|
356 /** |
|
357 @return ETrue if the RPacketQoS::TBitRate parameters match, EFalse if they don't |
|
358 */ |
|
359 TBool CompareUMTSQoSNeg(const TContextConfig& aFirst, const TContextConfig& aSecond) |
|
360 { |
|
361 RPacketQoS::TQoSR99_R4Negotiated firstUMTSQoS, secondUMTSQoS; |
|
362 aFirst.GetUMTSQoSNeg(firstUMTSQoS); |
|
363 aSecond.GetUMTSQoSNeg(secondUMTSQoS); |
|
364 return CompareUMTSQoSNeg(firstUMTSQoS, secondUMTSQoS); |
|
365 } |
|
366 |
|
367 |
|
368 |
|
369 |
|
370 |
|
371 /** |
|
372 @return ETrue if the RPacketContext::TAuthInfo parameters match, EFalse if they don't |
|
373 */ |
|
374 TBool CompareAuthInfo(const RPacketContext::TAuthInfo &aFirst, const RPacketContext::TAuthInfo &aSecond) |
|
375 { |
|
376 if (aFirst.iProtocol != aSecond.iProtocol) |
|
377 { |
|
378 return EFalse; |
|
379 } |
|
380 if (aFirst.iUsername != aSecond.iUsername) |
|
381 { |
|
382 return EFalse; |
|
383 } |
|
384 if (aFirst.iPassword != aSecond.iPassword) |
|
385 { |
|
386 return EFalse; |
|
387 } |
|
388 return ETrue; |
|
389 } |
|
390 |
|
391 /** |
|
392 @return ETrue if the RPacketContext::TDnsInfoV2 parameters match, EFalse if they don't |
|
393 */ |
|
394 TBool CompareDnsInfoV2(const RPacketContext::TDnsInfoV2 &aFirst, const RPacketContext::TDnsInfoV2 &aSecond) |
|
395 { |
|
396 if (aFirst.iPrimaryDns != aSecond.iPrimaryDns) |
|
397 { |
|
398 return EFalse; |
|
399 } |
|
400 if (aFirst.iSecondaryDns != aSecond.iSecondaryDns) |
|
401 { |
|
402 return EFalse; |
|
403 } |
|
404 return ETrue; |
|
405 } |
|
406 |
|
407 /** |
|
408 @return ETrue if the RPacketContext::TProtocolConfigOptionV2 parameters match, EFalse if they don't |
|
409 */ |
|
410 TBool CompareProtocolConfigOptionV2(const RPacketContext::TProtocolConfigOptionV2 &aFirst, const RPacketContext::TProtocolConfigOptionV2 &aSecond) |
|
411 { |
|
412 if (!CompareAuthInfo(aFirst.iAuthInfo, aSecond.iAuthInfo)) |
|
413 { |
|
414 return EFalse; |
|
415 } |
|
416 if (aFirst.iChallenge != aSecond.iChallenge) |
|
417 { |
|
418 return EFalse; |
|
419 } |
|
420 if (aFirst.iResponse != aSecond.iResponse) |
|
421 { |
|
422 return EFalse; |
|
423 } |
|
424 if (aFirst.iId != aSecond.iId) |
|
425 { |
|
426 return EFalse; |
|
427 } |
|
428 if (!CompareDnsInfoV2(aFirst.iDnsAddresses, aSecond.iDnsAddresses)) |
|
429 { |
|
430 return EFalse; |
|
431 } |
|
432 if (aFirst.iMiscBuffer != aSecond.iMiscBuffer) |
|
433 { |
|
434 return EFalse; |
|
435 } |
|
436 return ETrue; |
|
437 } |
|
438 |
|
439 /** |
|
440 @return ETrue if the RPacketContext::TContextConfigGPRS parameters match, EFalse if they don't |
|
441 */ |
|
442 TBool CompareContextConfigGPRS(const RPacketContext::TContextConfigGPRS &aFirst, const RPacketContext::TContextConfigGPRS &aSecond) |
|
443 { |
|
444 if (aFirst.iPdpType != aSecond.iPdpType) |
|
445 { |
|
446 return EFalse; |
|
447 } |
|
448 if (aFirst.iAccessPointName != aSecond.iAccessPointName) |
|
449 { |
|
450 return EFalse; |
|
451 } |
|
452 if (aFirst.iPdpAddress != aSecond.iPdpAddress) |
|
453 { |
|
454 return EFalse; |
|
455 } |
|
456 if (aFirst.iPdpCompression != aSecond.iPdpCompression) |
|
457 { |
|
458 return EFalse; |
|
459 } |
|
460 if (aFirst.iAnonymousAccessReqd != aSecond.iAnonymousAccessReqd) |
|
461 { |
|
462 return EFalse; |
|
463 } |
|
464 if (aFirst.iUseEdge != aSecond.iUseEdge) |
|
465 { |
|
466 return EFalse; |
|
467 } |
|
468 if (!CompareProtocolConfigOptionV2(aFirst.iProtocolConfigOption, aSecond.iProtocolConfigOption)) |
|
469 { |
|
470 return EFalse; |
|
471 } |
|
472 if (aFirst.iNWIContext != aSecond.iNWIContext) |
|
473 { |
|
474 return EFalse; |
|
475 } |
|
476 return ETrue; |
|
477 } |
|
478 |
|
479 /** |
|
480 @return ETrue if the TContextConfig parameters match, EFalse if they don't |
|
481 */ |
|
482 TBool CompareContextConfigGPRS(const TContextConfig& aFirst, const TContextConfig& aSecond) |
|
483 { |
|
484 RPacketContext::TContextConfigGPRS firstUMTSConfig, secondUMTSConfig; |
|
485 aFirst.GetContextConfig(firstUMTSConfig); |
|
486 aSecond.GetContextConfig(secondUMTSConfig); |
|
487 return CompareContextConfigGPRS(firstUMTSConfig, secondUMTSConfig); |
|
488 } |
|
489 |
|
490 /** |
|
491 @return ETrue if the RPacketQoS::TBitRate parameters match, EFalse if they don't |
|
492 */ |
|
493 TBool CompareAccessPointName(const RPacketContext::TGSNAddress &aFirst, const RPacketContext::TGSNAddress &aSecond) |
|
494 { |
|
495 if (aFirst.Compare(aSecond) == 0) |
|
496 { |
|
497 return ETrue; |
|
498 } |
|
499 else |
|
500 { |
|
501 return EFalse; |
|
502 } |
|
503 } |
|
504 |
|
505 /** |
|
506 @return ETrue if the TContextConfig parameters match, EFalse if they don't |
|
507 */ |
|
508 TBool CompareAccessPointName(const TContextConfig& aFirst, const TContextConfig& aSecond) |
|
509 { |
|
510 RPacketContext::TGSNAddress firstAccessPointName, secondAccessPointName; |
|
511 aFirst.GetAccessPointName(firstAccessPointName); |
|
512 aSecond.GetAccessPointName(secondAccessPointName); |
|
513 return CompareAccessPointName(firstAccessPointName, secondAccessPointName); |
|
514 } |
|
515 |
|
516 /** |
|
517 @return ETrue if the RPacketContext::TProtocolAddress parameters match, EFalse if they don't |
|
518 */ |
|
519 TBool ComparePdpAddress(const RPacketContext::TProtocolAddress &aFirst, const RPacketContext::TProtocolAddress &aSecond) |
|
520 { |
|
521 if (aFirst.Compare(aSecond) == 0) |
|
522 { |
|
523 return ETrue; |
|
524 } |
|
525 else |
|
526 { |
|
527 return EFalse; |
|
528 } |
|
529 } |
|
530 |
|
531 /** |
|
532 @return ETrue if the TContextConfig parameters match, EFalse if they don't |
|
533 */ |
|
534 TBool ComparePdpAddress(const TContextConfig& aFirst, const TContextConfig& aSecond) |
|
535 { |
|
536 RPacketContext::TProtocolAddress firstPdpAddress, secondPdpAddress; |
|
537 aFirst.GetPdpAddress(firstPdpAddress); |
|
538 aSecond.GetPdpAddress(secondPdpAddress); |
|
539 return ComparePdpAddress(firstPdpAddress, secondPdpAddress); |
|
540 } |
|
541 |
|
542 /** |
|
543 @return ETrue if the TContextConfig parameters match, EFalse if they don't |
|
544 */ |
|
545 TBool CompareContextConfig(const TContextConfig& aFirst, const TContextConfig& aSecond) |
|
546 { |
|
547 if (!CompareUMTSQoSReq(aFirst, aSecond)) |
|
548 { |
|
549 return EFalse; |
|
550 } |
|
551 |
|
552 if (!CompareTFTInfo(aFirst, aSecond)) |
|
553 { |
|
554 return EFalse; |
|
555 } |
|
556 if (!CompareUMTSQoSNeg(aFirst, aSecond)) |
|
557 { |
|
558 return EFalse; |
|
559 } |
|
560 if (!CompareContextConfigGPRS(aFirst, aSecond)) |
|
561 { |
|
562 return EFalse; |
|
563 } |
|
564 |
|
565 TUint firstPdpCompression, secondPdpCompression; |
|
566 aFirst.GetPdpCompression(firstPdpCompression); |
|
567 aSecond.GetPdpCompression(secondPdpCompression); |
|
568 if (firstPdpCompression != secondPdpCompression) |
|
569 { |
|
570 return EFalse; |
|
571 } |
|
572 |
|
573 RPacketContext::TProtocolType firstPdpType, secondPdpType; |
|
574 aFirst.GetPdpType(firstPdpType); |
|
575 aSecond.GetPdpType(secondPdpType); |
|
576 if (firstPdpType != secondPdpType) |
|
577 { |
|
578 return EFalse; |
|
579 } |
|
580 |
|
581 if (!CompareAccessPointName(aFirst, aSecond)) |
|
582 { |
|
583 return EFalse; |
|
584 } |
|
585 |
|
586 if (!ComparePdpAddress(aFirst, aSecond)) |
|
587 { |
|
588 return EFalse; |
|
589 } |
|
590 |
|
591 return ETrue; |
|
592 } |
|
593 |
|
594 /** |
|
595 @return ETrue if the TContextParameters parameters match, EFalse if they don't |
|
596 */ |
|
597 TBool CompareContextParameters(const TContextParameters& aFirst, const TContextParameters& aSecond) |
|
598 { |
|
599 if (aFirst.iContextType != aSecond.iContextType) |
|
600 { |
|
601 return EFalse; |
|
602 } |
|
603 |
|
604 if (!CompareContextInfo(aFirst.iContextInfo, aSecond.iContextInfo)) |
|
605 { |
|
606 return EFalse; |
|
607 } |
|
608 |
|
609 if (!CompareContextConfig(aFirst.iContextConfig, aSecond.iContextConfig)) |
|
610 { |
|
611 return EFalse; |
|
612 } |
|
613 |
|
614 if (aFirst.iReasonCode != aSecond.iReasonCode) |
|
615 { |
|
616 return EFalse; |
|
617 } |
|
618 |
|
619 if (aFirst.iTFTOperationCode != aSecond.iTFTOperationCode) |
|
620 { |
|
621 return EFalse; |
|
622 } |
|
623 |
|
624 return ETrue; |
|
625 } |
|
626 |
|
627 /** |
|
628 @return ETrue if the RPacketContext::TDataChannelV2 parameters match, EFalse if they don't |
|
629 */ |
|
630 TBool CompareDataChannel(const RPacketContext::TDataChannelV2& aFirst, const RPacketContext::TDataChannelV2& aSecond) |
|
631 { |
|
632 if (aFirst.iCsy.Compare(aSecond.iCsy) != 0) |
|
633 { |
|
634 return EFalse; |
|
635 } |
|
636 if (aFirst.iPort.Compare(aSecond.iPort) != 0) |
|
637 { |
|
638 return EFalse; |
|
639 } |
|
640 if (aFirst.iChannelId.Compare(aSecond.iChannelId) != 0) |
|
641 { |
|
642 return EFalse; |
|
643 } |
|
644 return ETrue; |
|
645 } |
|
646 |
|
647 /** |
|
648 @return ETrue if the TTFTInfo parameter matches the TFTs of the packet context aPacketContext, EFalse if they don't |
|
649 */ |
|
650 TBool CompareTFTInfo(TTFTInfo& aTFTInfo, RPacketContext& aPacketContext) |
|
651 { |
|
652 RPacketContext::TPacketFilterV2 packetFilter; |
|
653 RPacketContext::TPacketFilterV2Pckg packetFilterPckg(packetFilter); |
|
654 RPacketContext::TPacketFilterV2 expectedTftInfo; |
|
655 TRequestStatus status; |
|
656 TInt count; |
|
657 |
|
658 // make sure the count matches up |
|
659 aPacketContext.EnumeratePacketFilters(status, count); |
|
660 User::WaitForRequest(status); |
|
661 if (status != KErrNone) |
|
662 { |
|
663 return EFalse; |
|
664 } |
|
665 if (count != aTFTInfo.FilterCount()) |
|
666 { |
|
667 return EFalse; |
|
668 } |
|
669 |
|
670 // The filters indexed by the second parameter of RPacketContext::GetPacketFilterInfo may not be contiguous, |
|
671 // so we go through each filter assigned to context aPacketContext and try to find a match in aTFTInfo |
|
672 TInt matchingCount = 0; |
|
673 for (TUint packetContextIndex = 0; packetContextIndex < KMaxNumberOfPacketFilters; packetContextIndex++) |
|
674 { |
|
675 TBool foundMatch = EFalse; |
|
676 aPacketContext.GetPacketFilterInfo(status, packetContextIndex, packetFilterPckg); |
|
677 User::WaitForRequest(status); |
|
678 aTFTInfo.SetToFirst(); |
|
679 for (TInt tftInfoIndex = 0; tftInfoIndex < aTFTInfo.FilterCount() && !foundMatch; tftInfoIndex++) |
|
680 { |
|
681 aTFTInfo.NextPacketFilter(expectedTftInfo); |
|
682 if (ComparePacketFilterV2(packetFilter, expectedTftInfo)) |
|
683 { |
|
684 matchingCount++; |
|
685 if (matchingCount == aTFTInfo.FilterCount()) |
|
686 { |
|
687 return ETrue; |
|
688 } |
|
689 else |
|
690 { |
|
691 foundMatch = ETrue; |
|
692 } |
|
693 } |
|
694 } |
|
695 } |
|
696 return EFalse; |
|
697 } |
|
698 |
|
699 /** |
|
700 @return ETrue if the context status of context aContext names matches that of aContextStatus, EFalse if they don't |
|
701 */ |
|
702 TBool CompareContextInfo(const RPacketService& aPacketService, const TDesC& aContextName, RPacketContext::TContextStatus aContextStatus) |
|
703 { |
|
704 TRequestStatus status; |
|
705 RPacketService::TContextInfo contextInfo; |
|
706 TInt numContexts, dummy; |
|
707 aPacketService.EnumerateContexts(status, numContexts, dummy); |
|
708 User::WaitForRequest(status); |
|
709 for (TInt i = 0; i < numContexts; i++) |
|
710 { |
|
711 aPacketService.GetContextInfo(status, i, contextInfo); |
|
712 User::WaitForRequest(status); |
|
713 if (aContextName.Compare(contextInfo.iName) == 0) |
|
714 { |
|
715 if (status != KErrNone) |
|
716 { |
|
717 return EFalse; |
|
718 } |
|
719 if (contextInfo.iStatus != aContextStatus) |
|
720 { |
|
721 return EFalse; |
|
722 } |
|
723 return ETrue; |
|
724 } |
|
725 } |
|
726 return EFalse; |
|
727 } |
|