24
|
1 |
// Copyright (c) 2002-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 |
// EtelPacketTest3G_2.cpp
|
|
15 |
// JetStream Packet data tests.
|
|
16 |
// This file tests the 3G (WCDMA) Packet Context functionality - TestCase 3G.2
|
|
17 |
//
|
|
18 |
//
|
|
19 |
|
|
20 |
// Symbian OS includes
|
|
21 |
#include <e32base.h>
|
|
22 |
|
|
23 |
#include <etelpckt.h>
|
|
24 |
#include <pcktcs.h>
|
|
25 |
|
|
26 |
#include "Te_EtelPacketTestStepBase.h"
|
|
27 |
|
|
28 |
#include "testdef.h"
|
|
29 |
|
|
30 |
#include "Te_EtelPacketTest3g_2.h"
|
|
31 |
#include "Te_etelpckt_defs.h"
|
|
32 |
|
|
33 |
CEtelPacketTest3G_2::CEtelPacketTest3G_2()
|
|
34 |
/**
|
|
35 |
* Constructor
|
|
36 |
* Stores the name of this test case.
|
|
37 |
*/
|
|
38 |
{
|
|
39 |
SetTestStepName(_L("3GPacketContext"));
|
|
40 |
}
|
|
41 |
|
|
42 |
|
|
43 |
CEtelPacketTest3G_2::~CEtelPacketTest3G_2()
|
|
44 |
/**
|
|
45 |
* Destructor
|
|
46 |
*/
|
|
47 |
{}
|
|
48 |
|
|
49 |
enum TVerdict CEtelPacketTest3G_2::doTestStepL( void )
|
|
50 |
/**
|
|
51 |
* Test step 3G.2 calls the 3G Packet Context (RPacketContext) methods
|
|
52 |
*/
|
|
53 |
{
|
|
54 |
RPhone pcktPhone;
|
|
55 |
TInt ret=pcktPhone.Open(iTelServer,DPCKTTSY_PHONE_NAME);
|
|
56 |
CHECKPOINT(ret,KErrNone,CHP_OPEN_PHONE);
|
|
57 |
|
|
58 |
RPacketService wcdmaService;
|
|
59 |
ret=wcdmaService.Open(pcktPhone);
|
|
60 |
CHECKPOINT(ret,KErrNone,CHP_SRVS_CASE("A.3G1"));
|
|
61 |
|
|
62 |
// Open a Primary context
|
|
63 |
RPacketContext primaryContext;
|
|
64 |
TName contextName;
|
|
65 |
|
|
66 |
ret=primaryContext.OpenNewContext(wcdmaService, contextName);
|
|
67 |
CHECKPOINT(ret,KErrNone,CHP_CNTXT_CASE("B.3G1"));
|
|
68 |
|
|
69 |
// Open a Secondary context. An arbitrary value of 20 is assigned for the buffer size.
|
|
70 |
// Using a TName object would incur a great load on the stack, which is unnecessary for
|
|
71 |
// this test code.
|
|
72 |
RPacketContext wcdmaContext;
|
|
73 |
TBuf<20> secondaryContextName;
|
|
74 |
|
|
75 |
ret=wcdmaContext.OpenNewSecondaryContext(wcdmaService, contextName, secondaryContextName);
|
|
76 |
CHECKPOINT(ret,KErrNone,CHP_CNTXT_CASE("B.3G2"));
|
|
77 |
|
|
78 |
TRequestStatus reqStatus;
|
|
79 |
|
|
80 |
//Creating Traffic Flow Template (TFT)
|
|
81 |
wcdmaContext.CreateNewTFT(reqStatus, DPCKTTSY_TFT_NO_FILTERS);
|
|
82 |
User::WaitForRequest(reqStatus);
|
|
83 |
CHECKPOINT(reqStatus.Int(),KErrNone,CHP_SRVS_CASE("B.3G9"));
|
|
84 |
|
|
85 |
//Cancel Creating Traffic Flow Template (TFT)
|
|
86 |
wcdmaContext.CreateNewTFT(reqStatus, DPCKTTSY_TFT_NO_FILTERS);
|
|
87 |
wcdmaContext.CancelAsyncRequest(EPacketContextCreateNewTFT);
|
|
88 |
User::WaitForRequest(reqStatus);
|
|
89 |
CHECKPOINT(reqStatus.Int(),KErrCancel,CHP_SRVS_CASE("B.3G9"));
|
|
90 |
|
|
91 |
//Deleting Traffic Flow Template
|
|
92 |
wcdmaContext.DeleteTFT(reqStatus);
|
|
93 |
User::WaitForRequest(reqStatus);
|
|
94 |
CHECKPOINT(reqStatus.Int(),KErrNone,CHP_SRVS_CASE("B.3G10"));
|
|
95 |
|
|
96 |
//Cancel Deleting Traffic Flow Template
|
|
97 |
wcdmaContext.DeleteTFT(reqStatus);
|
|
98 |
wcdmaContext.CancelAsyncRequest(EPacketContextDeleteTFT);
|
|
99 |
User::WaitForRequest(reqStatus);
|
|
100 |
CHECKPOINT(reqStatus.Int(),KErrCancel,CHP_SRVS_CASE("B.3G10"));
|
|
101 |
|
|
102 |
// Enumerate Packet filters
|
|
103 |
TInt filterCount;
|
|
104 |
|
|
105 |
wcdmaContext.EnumeratePacketFilters(reqStatus, filterCount);
|
|
106 |
User::WaitForRequest(reqStatus);
|
|
107 |
|
|
108 |
CHECKPOINT(reqStatus.Int(),KErrNone,CHP_CNTXT_CASE("B.3G3"));
|
|
109 |
CHECKPOINT(filterCount,DPCKTTSY_NUMBER_OF_PACKET_FILTERS,CHP_CNTXT_CASE("B.3G3"));
|
|
110 |
|
|
111 |
// Cancel Request
|
|
112 |
wcdmaContext.EnumeratePacketFilters(reqStatus, filterCount);
|
|
113 |
wcdmaContext.CancelAsyncRequest(EPacketContextEnumeratePacketFilters);
|
|
114 |
User::WaitForRequest(reqStatus);
|
|
115 |
CHECKPOINT(reqStatus.Int(),KErrCancel,CHP_CNTXT_CASE("B.3G3"));
|
|
116 |
|
|
117 |
// Get Packet filter information
|
|
118 |
TInt filterIndex=1;
|
|
119 |
RPacketContext::TPacketFilterV2 packetFilterInfo;
|
|
120 |
RPacketContext::TPacketFilterV2Pckg packetFilterInfoPckg(packetFilterInfo);
|
|
121 |
|
|
122 |
wcdmaContext.GetPacketFilterInfo(reqStatus, filterIndex, packetFilterInfoPckg);
|
|
123 |
User::WaitForRequest(reqStatus);
|
|
124 |
|
|
125 |
CHECKPOINT(reqStatus.Int(),KErrNone,CHP_CNTXT_CASE("B.3G4"));
|
|
126 |
|
|
127 |
CHECKPOINT(packetFilterInfo.iId,DPCKTTSY_FILTER_ID1,CHP_CNTXT_CASE("B.3G4"));
|
|
128 |
CHECKPOINT(packetFilterInfo.iEvaluationPrecedenceIndex,DPCKTTSY_EVALUATION_PRECEDENCE_INDEX1,CHP_CNTXT_CASE("B.3G4"));
|
|
129 |
|
|
130 |
CHECKPOINT(packetFilterInfo.iSrcAddr[0],DPCKTTSY_DOMAIN_SOURCE_ADDRESS1_0,CHP_CNTXT_CASE("B.3G4"));
|
|
131 |
CHECKPOINT(packetFilterInfo.iSrcAddr[1],DPCKTTSY_DOMAIN_SOURCE_ADDRESS1_1,CHP_CNTXT_CASE("B.3G4"));
|
|
132 |
CHECKPOINT(packetFilterInfo.iSrcAddr[2],DPCKTTSY_DOMAIN_SOURCE_ADDRESS1_2,CHP_CNTXT_CASE("B.3G4"));
|
|
133 |
CHECKPOINT(packetFilterInfo.iSrcAddr[3],DPCKTTSY_DOMAIN_SOURCE_ADDRESS1_3,CHP_CNTXT_CASE("B.3G4"));
|
|
134 |
|
|
135 |
CHECKPOINT(packetFilterInfo.iSrcAddrSubnetMask[0],DPCKTTSY_DOMAIN_SUBNET_MASK1_0,CHP_CNTXT_CASE("B.3G4"));
|
|
136 |
CHECKPOINT(packetFilterInfo.iSrcAddrSubnetMask[1],DPCKTTSY_DOMAIN_SUBNET_MASK1_1,CHP_CNTXT_CASE("B.3G4"));
|
|
137 |
CHECKPOINT(packetFilterInfo.iSrcAddrSubnetMask[2],DPCKTTSY_DOMAIN_SUBNET_MASK1_2,CHP_CNTXT_CASE("B.3G4"));
|
|
138 |
CHECKPOINT(packetFilterInfo.iSrcAddrSubnetMask[3],DPCKTTSY_DOMAIN_SUBNET_MASK1_3,CHP_CNTXT_CASE("B.3G4"));
|
|
139 |
|
|
140 |
CHECKPOINT(packetFilterInfo.iProtocolNumberOrNextHeader,DPCKTTSY_PROTOCOLNUMBER_OR_NEXTHEADER1,CHP_CNTXT_CASE("B.3G4"));
|
|
141 |
CHECKPOINT(packetFilterInfo.iSrcPortMin,DPCKTTSY_MINIMUM_SOURCE_PORT_NUMBER1,CHP_CNTXT_CASE("B.3G4"));
|
|
142 |
CHECKPOINT(packetFilterInfo.iSrcPortMax,DPCKTTSY_MAXIMUM_SOURCE_PORT_NUMBER1,CHP_CNTXT_CASE("B.3G4"));
|
|
143 |
CHECKPOINT(packetFilterInfo.iDestPortMin,DPCKTTSY_MINIMUM_DESTINATION_PORT_NUMBER1,CHP_CNTXT_CASE("B.3G4"));
|
|
144 |
CHECKPOINT(packetFilterInfo.iDestPortMax,DPCKTTSY_MAXIMUM_DESTINATION_PORT_NUMBER1,CHP_CNTXT_CASE("B.3G4"));
|
|
145 |
CHECKPOINT(packetFilterInfo.iTOSorTrafficClass,DPCKTTSY_TYPE_OF_SERVICE_OR_TRAFFIC_CLASS1,CHP_CNTXT_CASE("B.3G4"));
|
|
146 |
|
|
147 |
// Cancel Request
|
|
148 |
wcdmaContext.GetPacketFilterInfo(reqStatus, filterIndex, packetFilterInfoPckg);
|
|
149 |
wcdmaContext.CancelAsyncRequest(EPacketContextGetPacketFilterInfo);
|
|
150 |
User::WaitForRequest(reqStatus);
|
|
151 |
CHECKPOINT(reqStatus.Int(),KErrCancel,CHP_CNTXT_CASE("B.3G4"));
|
|
152 |
|
|
153 |
// Add packet filter to a Traffic Flow Template (TFT)
|
|
154 |
packetFilterInfo.iId=DPCKTTSY_FILTER_ID2;
|
|
155 |
packetFilterInfo.iEvaluationPrecedenceIndex=DPCKTTSY_EVALUATION_PRECEDENCE_INDEX2;
|
|
156 |
|
|
157 |
packetFilterInfo.iSrcAddr[0]=DPCKTTSY_DOMAIN_SOURCE_ADDRESS2_0;
|
|
158 |
packetFilterInfo.iSrcAddr[1]=DPCKTTSY_DOMAIN_SOURCE_ADDRESS2_1;
|
|
159 |
packetFilterInfo.iSrcAddr[2]=DPCKTTSY_DOMAIN_SOURCE_ADDRESS2_2;
|
|
160 |
packetFilterInfo.iSrcAddr[3]=DPCKTTSY_DOMAIN_SOURCE_ADDRESS2_3;
|
|
161 |
|
|
162 |
packetFilterInfo.iSrcAddrSubnetMask[0]=DPCKTTSY_DOMAIN_SUBNET_MASK2_0;
|
|
163 |
packetFilterInfo.iSrcAddrSubnetMask[1]=DPCKTTSY_DOMAIN_SUBNET_MASK2_1;
|
|
164 |
packetFilterInfo.iSrcAddrSubnetMask[2]=DPCKTTSY_DOMAIN_SUBNET_MASK2_2;
|
|
165 |
packetFilterInfo.iSrcAddrSubnetMask[3]=DPCKTTSY_DOMAIN_SUBNET_MASK2_3;
|
|
166 |
|
|
167 |
packetFilterInfo.iProtocolNumberOrNextHeader=DPCKTTSY_PROTOCOLNUMBER_OR_NEXTHEADER2;
|
|
168 |
packetFilterInfo.iIPSecSPI=DPCKTTSY_SECURITY_PARAMETER_INDEX2;
|
|
169 |
packetFilterInfo.iTOSorTrafficClass=DPCKTTSY_TYPE_OF_SERVICE_OR_TRAFFIC_CLASS2;
|
|
170 |
|
|
171 |
RPacketContext::TPacketFilterV2Pckg addFilterPckg(packetFilterInfo);
|
|
172 |
|
|
173 |
wcdmaContext.AddPacketFilter(reqStatus, addFilterPckg);
|
|
174 |
User::WaitForRequest(reqStatus);
|
|
175 |
|
|
176 |
CHECKPOINT(reqStatus.Int(),KErrNone,CHP_CNTXT_CASE("B.3G5"));
|
|
177 |
|
|
178 |
// Cancel Request
|
|
179 |
wcdmaContext.AddPacketFilter(reqStatus, addFilterPckg);
|
|
180 |
wcdmaContext.CancelAsyncRequest(EPacketContextAddPacketFilter);
|
|
181 |
User::WaitForRequest(reqStatus);
|
|
182 |
CHECKPOINT(reqStatus.Int(),KErrCancel,CHP_CNTXT_CASE("B.3G5"));
|
|
183 |
|
|
184 |
// Remove packet filter
|
|
185 |
TInt removeIndex=2;
|
|
186 |
|
|
187 |
wcdmaContext.RemovePacketFilter(reqStatus, removeIndex);
|
|
188 |
User::WaitForRequest(reqStatus);
|
|
189 |
|
|
190 |
CHECKPOINT(reqStatus.Int(),KErrNone,CHP_CNTXT_CASE("B.3G6"));
|
|
191 |
|
|
192 |
// Cancel Request
|
|
193 |
wcdmaContext.RemovePacketFilter(reqStatus, removeIndex);
|
|
194 |
wcdmaContext.CancelAsyncRequest(EPacketContextRemovePacketFilter);
|
|
195 |
User::WaitForRequest(reqStatus);
|
|
196 |
CHECKPOINT(reqStatus.Int(),KErrCancel,CHP_CNTXT_CASE("B.3G6"));
|
|
197 |
|
|
198 |
// Modify Active Context
|
|
199 |
wcdmaContext.ModifyActiveContext(reqStatus);
|
|
200 |
User::WaitForRequest(reqStatus);
|
|
201 |
|
|
202 |
CHECKPOINT(reqStatus.Int(),KErrNone,CHP_CNTXT_CASE("B.3G7"));
|
|
203 |
|
|
204 |
// Cancel Request
|
|
205 |
wcdmaContext.ModifyActiveContext(reqStatus);
|
|
206 |
wcdmaContext.CancelAsyncRequest(EPacketContextModifyActiveContext);
|
|
207 |
User::WaitForRequest(reqStatus);
|
|
208 |
|
|
209 |
CHECKPOINT(reqStatus.Int(),KErrCancel,CHP_CNTXT_CASE("B.3G7"));
|
|
210 |
|
|
211 |
// Change Request: NSAE-579FBV. Added a new method, InitialiseContext(), which supersedes
|
|
212 |
// the LoanCommPort() and RecoverCommPort() methods. This new method enables asynchronous
|
|
213 |
// resource reservation for a new primary or secondary context at the creation phase.
|
|
214 |
|
|
215 |
// Asynchronous Resource reservation - InitialiseContext()
|
|
216 |
RPacketContext::TDataChannelV2 dataChannelV2;
|
|
217 |
RPacketContext::TDataChannelV2Pckg dataChannelV2Pckg(dataChannelV2);
|
|
218 |
|
|
219 |
wcdmaContext.InitialiseContext(reqStatus, dataChannelV2Pckg);
|
|
220 |
User::WaitForRequest(reqStatus);
|
|
221 |
CHECKPOINT(reqStatus.Int(),KErrNone,CHP_CNTXT_CASE("B.3G8"));
|
|
222 |
CHECKPOINT_COMP_STR(dataChannelV2.iCsy,DPCKTTSY_CSY_ASYNC,CHP_CNTXT_CASE("B.3G8"));
|
|
223 |
CHECKPOINT_COMP_STR(dataChannelV2.iPort,DPCKTTSY_PORT_ASYNC,CHP_CNTXT_CASE("B.3G8"));
|
|
224 |
CHECKPOINT_COMP_STR(dataChannelV2.iChannelId,DPCKTTSY_CHANNEL_ID,CHP_CNTXT_CASE("B.3G8"));
|
|
225 |
|
|
226 |
// Cancel Request
|
|
227 |
wcdmaContext.InitialiseContext(reqStatus, dataChannelV2Pckg);
|
|
228 |
wcdmaContext.CancelAsyncRequest(EPacketContextInitialiseContext);
|
|
229 |
User::WaitForRequest(reqStatus);
|
|
230 |
CHECKPOINT(reqStatus.Int(),KErrCancel,CHP_CNTXT_CASE("B.3G8"));
|
|
231 |
|
|
232 |
// TPacketFilterV3 Tests
|
|
233 |
RPacketContext::TIPAddress srcAddr;
|
|
234 |
RPacketContext::TIPAddress srcAddrSubnetMask;
|
|
235 |
|
|
236 |
TInt ii;
|
|
237 |
for (ii=0; ii<sizeof(RPacketContext::TIPAddress); ii++)
|
|
238 |
{
|
|
239 |
srcAddr[ii] = 0;
|
|
240 |
}
|
|
241 |
srcAddr[0]=DPCKTTSY_DOMAIN_SOURCE_ADDRESS1_0;
|
|
242 |
srcAddr[1]=DPCKTTSY_DOMAIN_SOURCE_ADDRESS1_1;
|
|
243 |
srcAddr[2]=DPCKTTSY_DOMAIN_SOURCE_ADDRESS1_2;
|
|
244 |
srcAddr[3]=DPCKTTSY_DOMAIN_SOURCE_ADDRESS1_3;
|
|
245 |
|
|
246 |
for (ii=0; ii<sizeof(RPacketContext::TIPAddress); ii++)
|
|
247 |
{
|
|
248 |
srcAddrSubnetMask[ii] = 0;
|
|
249 |
}
|
|
250 |
srcAddrSubnetMask[0]=DPCKTTSY_DOMAIN_SUBNET_MASK1_0;
|
|
251 |
srcAddrSubnetMask[1]=DPCKTTSY_DOMAIN_SUBNET_MASK1_1;
|
|
252 |
srcAddrSubnetMask[2]=DPCKTTSY_DOMAIN_SUBNET_MASK1_2;
|
|
253 |
srcAddrSubnetMask[3]=DPCKTTSY_DOMAIN_SUBNET_MASK1_3;
|
|
254 |
|
|
255 |
filterIndex=3;
|
|
256 |
RPacketContext::TPacketFilterV3 packetFilterV3Info;
|
|
257 |
RPacketContext::TPacketFilterV3Pckg packetFilterV3InfoPckg(packetFilterV3Info);
|
|
258 |
|
|
259 |
wcdmaContext.GetPacketFilterInfo(reqStatus, filterIndex, packetFilterV3InfoPckg);
|
|
260 |
User::WaitForRequest(reqStatus);
|
|
261 |
CHECKPOINT(reqStatus.Int(),KErrNone,CHP_CNTXT_CASE("B.3G11"));
|
|
262 |
|
|
263 |
/* Testing that the correct values were set - TYPE 1*/
|
|
264 |
TEST(packetFilterV3Info.IsPresent(RPacketContext::TPacketFilterV3::EPacketFilterSrcAddr));
|
|
265 |
TEST(!(Mem::Compare(packetFilterV3Info.SrcAddr(),sizeof(RPacketContext::TIPAddress),srcAddr,sizeof(RPacketContext::TIPAddress))));
|
|
266 |
|
|
267 |
TEST(packetFilterV3Info.IsPresent(RPacketContext::TPacketFilterV3::EPacketFilterSrcAddrSubnetMask));
|
|
268 |
TEST(!(Mem::Compare(packetFilterV3Info.SrcAddrSubnetMask(),sizeof(RPacketContext::TIPAddress),srcAddrSubnetMask,sizeof(RPacketContext::TIPAddress))));
|
|
269 |
|
|
270 |
TEST(packetFilterV3Info.IsPresent(RPacketContext::TPacketFilterV3::EPacketFilterDestPortMin));
|
|
271 |
TEST((packetFilterV3Info.DestPortMin() == DPCKTTSY_MINIMUM_DESTINATION_PORT_NUMBER1));
|
|
272 |
|
|
273 |
TEST(packetFilterV3Info.IsPresent(RPacketContext::TPacketFilterV3::EPacketFilterDestPortMax));
|
|
274 |
TEST((packetFilterV3Info.DestPortMax() == DPCKTTSY_MAXIMUM_DESTINATION_PORT_NUMBER1));
|
|
275 |
|
|
276 |
TEST(packetFilterV3Info.IsPresent(RPacketContext::TPacketFilterV3::EPacketFilterProtocolNumberOrNextHeader));
|
|
277 |
TEST((packetFilterV3Info.ProtocolNumberOrNextHeader() == DPCKTTSY_PROTOCOLNUMBER_OR_NEXTHEADER1));
|
|
278 |
|
|
279 |
TEST(packetFilterV3Info.IsPresent(RPacketContext::TPacketFilterV3::EPacketFilterSrcPortMin));
|
|
280 |
TEST((packetFilterV3Info.SrcPortMin() == DPCKTTSY_MINIMUM_SOURCE_PORT_NUMBER1));
|
|
281 |
|
|
282 |
TEST(packetFilterV3Info.IsPresent(RPacketContext::TPacketFilterV3::EPacketFilterSrcPortMax));
|
|
283 |
TEST((packetFilterV3Info.SrcPortMax() == DPCKTTSY_MAXIMUM_SOURCE_PORT_NUMBER1));
|
|
284 |
|
|
285 |
TEST(packetFilterV3Info.IsPresent(RPacketContext::TPacketFilterV3::EPacketFilterTOSorTrafficClass));
|
|
286 |
TEST((packetFilterV3Info.TOSorTrafficClass() == DPCKTTSY_TYPE_OF_SERVICE_OR_TRAFFIC_CLASS1));
|
|
287 |
|
|
288 |
/* Because the Filter Type was One SPI will not be set and should be 0 */
|
|
289 |
TEST(packetFilterV3Info.IsPresent(RPacketContext::TPacketFilterV3::EPacketFilterIPSecSPI) == EFalse);
|
|
290 |
TEST(packetFilterV3Info.IsPresent(RPacketContext::TPacketFilterV3::EPacketFilterFlowLabel) == EFalse);
|
|
291 |
|
|
292 |
|
|
293 |
// Cancel Request
|
|
294 |
wcdmaContext.GetPacketFilterInfo(reqStatus, filterIndex, packetFilterInfoPckg);
|
|
295 |
wcdmaContext.CancelAsyncRequest(EPacketContextGetPacketFilterInfo);
|
|
296 |
User::WaitForRequest(reqStatus);
|
|
297 |
CHECKPOINT(reqStatus.Int(),KErrCancel,CHP_CNTXT_CASE("B.3G11"));
|
|
298 |
|
|
299 |
filterIndex=4;
|
|
300 |
RPacketContext::TPacketFilterV3 packetFilterV3Info2;
|
|
301 |
RPacketContext::TPacketFilterV3Pckg packetFilterV3InfoPckg2(packetFilterV3Info2);
|
|
302 |
|
|
303 |
wcdmaContext.GetPacketFilterInfo(reqStatus, filterIndex, packetFilterV3InfoPckg2);
|
|
304 |
User::WaitForRequest(reqStatus);
|
|
305 |
CHECKPOINT(reqStatus.Int(),KErrNone,CHP_CNTXT_CASE("B.3G11"));
|
|
306 |
|
|
307 |
/* Testing that the correct values were set */
|
|
308 |
TEST(packetFilterV3Info2.IsPresent(RPacketContext::TPacketFilterV3::EPacketFilterProtocolNumberOrNextHeader));
|
|
309 |
TEST((packetFilterV3Info2.ProtocolNumberOrNextHeader() == DPCKTTSY_PROTOCOLNUMBER_OR_NEXTHEADER2));
|
|
310 |
|
|
311 |
TEST(packetFilterV3Info2.IsPresent(RPacketContext::TPacketFilterV3::EPacketFilterIPSecSPI));
|
|
312 |
TEST((packetFilterV3Info2.SPI() == DPCKTTSY_SECURITY_PARAMETER_INDEX2));
|
|
313 |
|
|
314 |
TEST(packetFilterV3Info2.IsPresent(RPacketContext::TPacketFilterV3::EPacketFilterTOSorTrafficClass));
|
|
315 |
TEST((packetFilterV3Info2.TOSorTrafficClass() == DPCKTTSY_TYPE_OF_SERVICE_OR_TRAFFIC_CLASS2));
|
|
316 |
/* Because the Filter Type was Two SrcPortMin will not be set and should be 0 */
|
|
317 |
TEST((packetFilterV3Info2.SrcPortMin() == 0));
|
|
318 |
|
|
319 |
// Cancel Request
|
|
320 |
wcdmaContext.GetPacketFilterInfo(reqStatus, filterIndex, packetFilterInfoPckg);
|
|
321 |
wcdmaContext.CancelAsyncRequest(EPacketContextGetPacketFilterInfo);
|
|
322 |
User::WaitForRequest(reqStatus);
|
|
323 |
CHECKPOINT(reqStatus.Int(),KErrCancel,CHP_CNTXT_CASE("B.3G11"));
|
|
324 |
|
|
325 |
// Add packet filter for Type One
|
|
326 |
|
|
327 |
RPacketContext::TPacketFilterV3 addPacketFilterV3a(RPacketContext::EPacketFilterTypeOne);
|
|
328 |
|
|
329 |
addPacketFilterV3a.iId=DPCKTTSY_FILTER_ID1;
|
|
330 |
addPacketFilterV3a.iEvaluationPrecedenceIndex=DPCKTTSY_EVALUATION_PRECEDENCE_INDEX1;
|
|
331 |
|
|
332 |
addPacketFilterV3a.SetSrcAddr(srcAddr);
|
|
333 |
addPacketFilterV3a.SetSrcAddrSubnetMask(srcAddrSubnetMask);
|
|
334 |
addPacketFilterV3a.SetProtocolNumberOrNextHeader(DPCKTTSY_PROTOCOLNUMBER_OR_NEXTHEADER1);
|
|
335 |
addPacketFilterV3a.SetSrcPortMin(DPCKTTSY_MINIMUM_SOURCE_PORT_NUMBER1);
|
|
336 |
addPacketFilterV3a.SetSrcPortMax(DPCKTTSY_MAXIMUM_SOURCE_PORT_NUMBER1);
|
|
337 |
addPacketFilterV3a.SetDestPortMin(DPCKTTSY_MINIMUM_DESTINATION_PORT_NUMBER1);
|
|
338 |
addPacketFilterV3a.SetDestPortMax(DPCKTTSY_MAXIMUM_DESTINATION_PORT_NUMBER1);
|
|
339 |
addPacketFilterV3a.SetTOSorTrafficClass(DPCKTTSY_TYPE_OF_SERVICE_OR_TRAFFIC_CLASS1);
|
|
340 |
|
|
341 |
RPacketContext::TPacketFilterV3Pckg addFilterV3aPckg(addPacketFilterV3a);
|
|
342 |
|
|
343 |
wcdmaContext.AddPacketFilter(reqStatus, addFilterV3aPckg);
|
|
344 |
User::WaitForRequest(reqStatus);
|
|
345 |
|
|
346 |
CHECKPOINT(reqStatus.Int(),KErrNone,CHP_CNTXT_CASE("B.3G12"));
|
|
347 |
|
|
348 |
// Add packet filter for Type Two
|
|
349 |
|
|
350 |
RPacketContext::TPacketFilterV3 addPacketFilterV3b(RPacketContext::EPacketFilterTypeTwo);
|
|
351 |
|
|
352 |
addPacketFilterV3b.iId=DPCKTTSY_FILTER_ID1;
|
|
353 |
addPacketFilterV3b.iEvaluationPrecedenceIndex=DPCKTTSY_EVALUATION_PRECEDENCE_INDEX1;
|
|
354 |
|
|
355 |
addPacketFilterV3b.SetSrcAddr(srcAddr);
|
|
356 |
addPacketFilterV3b.SetSrcAddrSubnetMask(srcAddrSubnetMask);
|
|
357 |
addPacketFilterV3b.SetProtocolNumberOrNextHeader(DPCKTTSY_PROTOCOLNUMBER_OR_NEXTHEADER1);
|
|
358 |
addPacketFilterV3b.SetSPI(DPCKTTSY_SECURITY_PARAMETER_INDEX2);
|
|
359 |
addPacketFilterV3b.SetTOSorTrafficClass(DPCKTTSY_TYPE_OF_SERVICE_OR_TRAFFIC_CLASS1);
|
|
360 |
|
|
361 |
RPacketContext::TPacketFilterV3Pckg addFilterV3bPckg(addPacketFilterV3b);
|
|
362 |
|
|
363 |
wcdmaContext.AddPacketFilter(reqStatus, addFilterV3bPckg);
|
|
364 |
User::WaitForRequest(reqStatus);
|
|
365 |
|
|
366 |
CHECKPOINT(reqStatus.Int(),KErrNone,CHP_CNTXT_CASE("B.3G12"));
|
|
367 |
|
|
368 |
// Add packet filter for Type Three
|
|
369 |
|
|
370 |
RPacketContext::TPacketFilterV3 addPacketFilterV3c(RPacketContext::EPacketFilterTypeThree);
|
|
371 |
|
|
372 |
addPacketFilterV3c.iId=DPCKTTSY_FILTER_ID1;
|
|
373 |
addPacketFilterV3c.iEvaluationPrecedenceIndex=DPCKTTSY_EVALUATION_PRECEDENCE_INDEX1;
|
|
374 |
|
|
375 |
addPacketFilterV3c.SetSrcAddr(srcAddr);
|
|
376 |
addPacketFilterV3c.SetSrcAddrSubnetMask(srcAddrSubnetMask);
|
|
377 |
addPacketFilterV3c.SetTOSorTrafficClass(DPCKTTSY_TYPE_OF_SERVICE_OR_TRAFFIC_CLASS1);
|
|
378 |
addPacketFilterV3c.SetFlowLabel(DPCKTTSY_FLOW_LABEL);
|
|
379 |
|
|
380 |
RPacketContext::TPacketFilterV3Pckg addFilterV3cPckg(addPacketFilterV3c);
|
|
381 |
|
|
382 |
wcdmaContext.AddPacketFilter(reqStatus, addFilterV3cPckg);
|
|
383 |
User::WaitForRequest(reqStatus);
|
|
384 |
|
|
385 |
CHECKPOINT(reqStatus.Int(),KErrNone,CHP_CNTXT_CASE("B.3G12"));
|
|
386 |
|
|
387 |
// Cancel Request
|
|
388 |
wcdmaContext.AddPacketFilter(reqStatus, addFilterV3cPckg);
|
|
389 |
wcdmaContext.CancelAsyncRequest(EPacketContextAddPacketFilter);
|
|
390 |
User::WaitForRequest(reqStatus);
|
|
391 |
CHECKPOINT(reqStatus.Int(),KErrCancel,CHP_CNTXT_CASE("B.3G12"));
|
|
392 |
|
|
393 |
// Testing FilterTypeOne
|
|
394 |
INFO_PRINTF1(_L("Testing Filter Type One"));
|
|
395 |
TestPacketFilterV3Type(RPacketContext::EPacketFilterTypeOne);
|
|
396 |
|
|
397 |
// Testing FilterTypeTwo
|
|
398 |
INFO_PRINTF1(_L("Testing Filter Type Two"));
|
|
399 |
TestPacketFilterV3Type(RPacketContext::EPacketFilterTypeTwo);
|
|
400 |
|
|
401 |
// Testing FilterTypeThree
|
|
402 |
INFO_PRINTF1(_L("Testing Filter Type Three"));
|
|
403 |
TestPacketFilterV3Type(RPacketContext::EPacketFilterTypeThree);
|
|
404 |
|
|
405 |
|
|
406 |
primaryContext.Close();
|
|
407 |
wcdmaContext.Close();
|
|
408 |
wcdmaService.Close();
|
|
409 |
pcktPhone.Close();
|
|
410 |
|
|
411 |
return TestStepResult();
|
|
412 |
}
|
|
413 |
|
|
414 |
void CEtelPacketTest3G_2::TestPacketFilterV3Type(RPacketContext::TPacketFilterType aType)
|
|
415 |
{
|
|
416 |
RPacketContext::TIPAddress srcAddr;
|
|
417 |
RPacketContext::TIPAddress srcAddrSubnetMask;
|
|
418 |
|
|
419 |
srcAddr[0]=DPCKTTSY_DOMAIN_SOURCE_ADDRESS2_0;
|
|
420 |
srcAddr[1]=DPCKTTSY_DOMAIN_SOURCE_ADDRESS2_1;
|
|
421 |
srcAddr[2]=DPCKTTSY_DOMAIN_SOURCE_ADDRESS2_2;
|
|
422 |
srcAddr[3]=DPCKTTSY_DOMAIN_SOURCE_ADDRESS2_3;
|
|
423 |
|
|
424 |
srcAddrSubnetMask[0]=DPCKTTSY_DOMAIN_SUBNET_MASK2_0;
|
|
425 |
srcAddrSubnetMask[1]=DPCKTTSY_DOMAIN_SUBNET_MASK2_1;
|
|
426 |
srcAddrSubnetMask[2]=DPCKTTSY_DOMAIN_SUBNET_MASK2_2;
|
|
427 |
srcAddrSubnetMask[3]=DPCKTTSY_DOMAIN_SUBNET_MASK2_3;
|
|
428 |
|
|
429 |
|
|
430 |
RPacketContext::TPacketFilterV3 packetFilterV3(aType);
|
|
431 |
packetFilterV3.Reset();
|
|
432 |
TInt err;
|
|
433 |
|
|
434 |
err = packetFilterV3.SetSrcAddr(srcAddr);
|
|
435 |
if(err)
|
|
436 |
{
|
|
437 |
if(!(Mem::Compare(packetFilterV3.SrcAddr(),sizeof(RPacketContext::TIPAddress),srcAddr,sizeof(RPacketContext::TIPAddress))))
|
|
438 |
{
|
|
439 |
INFO_PRINTF1(_L("Correct Source Address Returned"));
|
|
440 |
}
|
|
441 |
TEST(packetFilterV3.IsPresent(RPacketContext::TPacketFilterV3::EPacketFilterSrcAddr));
|
|
442 |
packetFilterV3.Reset(RPacketContext::TPacketFilterV3::EPacketFilterSrcAddr);
|
|
443 |
TEST(!(packetFilterV3.IsPresent(RPacketContext::TPacketFilterV3::EPacketFilterSrcAddr)));
|
|
444 |
}
|
|
445 |
else
|
|
446 |
{
|
|
447 |
TEST(EFalse); // The Source Address should be set for all the types.
|
|
448 |
}
|
|
449 |
|
|
450 |
packetFilterV3.Reset();
|
|
451 |
err = packetFilterV3.SetSrcAddrSubnetMask(srcAddrSubnetMask);
|
|
452 |
if(err)
|
|
453 |
{
|
|
454 |
if(!(Mem::Compare(packetFilterV3.SrcAddrSubnetMask(),sizeof(RPacketContext::TIPAddress),srcAddrSubnetMask,sizeof(RPacketContext::TIPAddress))))
|
|
455 |
{
|
|
456 |
INFO_PRINTF1(_L("Correct Source Address Subnet Mask Returned"));
|
|
457 |
}
|
|
458 |
TEST(packetFilterV3.IsPresent(RPacketContext::TPacketFilterV3::EPacketFilterSrcAddrSubnetMask));
|
|
459 |
}
|
|
460 |
else
|
|
461 |
{
|
|
462 |
TEST(EFalse); // The Source Address Subnet Mask should be set for all the types.
|
|
463 |
}
|
|
464 |
|
|
465 |
packetFilterV3.Reset();
|
|
466 |
err = packetFilterV3.SetProtocolNumberOrNextHeader(DPCKTTSY_PROTOCOLNUMBER_OR_NEXTHEADER2);
|
|
467 |
if(err)
|
|
468 |
{
|
|
469 |
if(packetFilterV3.ProtocolNumberOrNextHeader() == DPCKTTSY_PROTOCOLNUMBER_OR_NEXTHEADER2)
|
|
470 |
{
|
|
471 |
INFO_PRINTF1(_L("Correct Protocol Number Returned"));
|
|
472 |
}
|
|
473 |
TEST(packetFilterV3.IsPresent(RPacketContext::TPacketFilterV3::EPacketFilterProtocolNumberOrNextHeader));
|
|
474 |
}
|
|
475 |
else
|
|
476 |
{
|
|
477 |
if (aType == RPacketContext::EPacketFilterTypeThree)
|
|
478 |
{
|
|
479 |
INFO_PRINTF1(_L("Not Allowed to Set Protocol Numbers"));
|
|
480 |
}
|
|
481 |
else
|
|
482 |
{
|
|
483 |
TEST(EFalse);
|
|
484 |
}
|
|
485 |
}
|
|
486 |
|
|
487 |
packetFilterV3.Reset();
|
|
488 |
err = packetFilterV3.SetSrcPortMin(DPCKTTSY_MINIMUM_SOURCE_PORT_NUMBER1);
|
|
489 |
if(err)
|
|
490 |
{
|
|
491 |
if(packetFilterV3.SrcPortMin() == DPCKTTSY_MINIMUM_SOURCE_PORT_NUMBER1)
|
|
492 |
{
|
|
493 |
INFO_PRINTF1(_L("Correct Minimum Source Port Returned"));
|
|
494 |
}
|
|
495 |
TEST(packetFilterV3.IsPresent(RPacketContext::TPacketFilterV3::EPacketFilterSrcPortMin));
|
|
496 |
}
|
|
497 |
else
|
|
498 |
{
|
|
499 |
if ((aType == RPacketContext::EPacketFilterTypeTwo) || (aType == RPacketContext::EPacketFilterTypeThree))
|
|
500 |
{
|
|
501 |
INFO_PRINTF1(_L("Not Allowed to Set Minimum Source Port"));
|
|
502 |
}
|
|
503 |
else
|
|
504 |
{
|
|
505 |
TEST(EFalse);
|
|
506 |
}
|
|
507 |
}
|
|
508 |
|
|
509 |
packetFilterV3.Reset();
|
|
510 |
err = packetFilterV3.SetSrcPortMax(DPCKTTSY_MAXIMUM_SOURCE_PORT_NUMBER1);
|
|
511 |
if(err)
|
|
512 |
{
|
|
513 |
if(packetFilterV3.SrcPortMax() == DPCKTTSY_MAXIMUM_SOURCE_PORT_NUMBER1)
|
|
514 |
{
|
|
515 |
INFO_PRINTF1(_L("Correct Maximum Source Port Returned"));
|
|
516 |
}
|
|
517 |
TEST(packetFilterV3.IsPresent(RPacketContext::TPacketFilterV3::EPacketFilterSrcPortMax));
|
|
518 |
}
|
|
519 |
else
|
|
520 |
{
|
|
521 |
if ((aType == RPacketContext::EPacketFilterTypeTwo) || (aType == RPacketContext::EPacketFilterTypeThree))
|
|
522 |
{
|
|
523 |
INFO_PRINTF1(_L("Not Allowed to Set Maximum Source Port"));
|
|
524 |
}
|
|
525 |
else
|
|
526 |
{
|
|
527 |
TEST(EFalse);
|
|
528 |
}
|
|
529 |
}
|
|
530 |
|
|
531 |
packetFilterV3.Reset();
|
|
532 |
err = packetFilterV3.SetDestPortMin(DPCKTTSY_MINIMUM_DESTINATION_PORT_NUMBER1);
|
|
533 |
if(err)
|
|
534 |
{
|
|
535 |
if(packetFilterV3.DestPortMin() == DPCKTTSY_MINIMUM_DESTINATION_PORT_NUMBER1)
|
|
536 |
{
|
|
537 |
INFO_PRINTF1(_L("Correct Minimum Destination Port Returned"));
|
|
538 |
}
|
|
539 |
TEST(packetFilterV3.IsPresent(RPacketContext::TPacketFilterV3::EPacketFilterDestPortMin));
|
|
540 |
}
|
|
541 |
else
|
|
542 |
{
|
|
543 |
if ((aType == RPacketContext::EPacketFilterTypeTwo) || (aType == RPacketContext::EPacketFilterTypeThree))
|
|
544 |
{
|
|
545 |
INFO_PRINTF1(_L("Not Allowed to Set Minimum Destination Port"));
|
|
546 |
}
|
|
547 |
else
|
|
548 |
{
|
|
549 |
TEST(EFalse);
|
|
550 |
}
|
|
551 |
}
|
|
552 |
|
|
553 |
packetFilterV3.Reset();
|
|
554 |
err = packetFilterV3.SetDestPortMax(DPCKTTSY_MAXIMUM_DESTINATION_PORT_NUMBER1);
|
|
555 |
if(err)
|
|
556 |
{
|
|
557 |
if(packetFilterV3.DestPortMax() == DPCKTTSY_MAXIMUM_DESTINATION_PORT_NUMBER1)
|
|
558 |
{
|
|
559 |
INFO_PRINTF1(_L("Correct Maximum Destination Port Returned"));
|
|
560 |
}
|
|
561 |
TEST(packetFilterV3.IsPresent(RPacketContext::TPacketFilterV3::EPacketFilterDestPortMax));
|
|
562 |
}
|
|
563 |
else
|
|
564 |
{
|
|
565 |
if ((aType == RPacketContext::EPacketFilterTypeTwo) || (aType == RPacketContext::EPacketFilterTypeThree))
|
|
566 |
{
|
|
567 |
INFO_PRINTF1(_L("Not Allowed to Set Maximum Destination Port"));
|
|
568 |
}
|
|
569 |
else
|
|
570 |
{
|
|
571 |
TEST(EFalse);
|
|
572 |
}
|
|
573 |
}
|
|
574 |
|
|
575 |
packetFilterV3.Reset();
|
|
576 |
err = packetFilterV3.SetSPI(DPCKTTSY_SECURITY_PARAMETER_INDEX2);
|
|
577 |
if(err)
|
|
578 |
{
|
|
579 |
if(packetFilterV3.SPI() == DPCKTTSY_SECURITY_PARAMETER_INDEX2)
|
|
580 |
{
|
|
581 |
INFO_PRINTF1(_L("Correct SPI returend"));
|
|
582 |
}
|
|
583 |
TEST(packetFilterV3.IsPresent(RPacketContext::TPacketFilterV3::EPacketFilterIPSecSPI));
|
|
584 |
}
|
|
585 |
else
|
|
586 |
{
|
|
587 |
if ((aType == RPacketContext::EPacketFilterTypeOne) || (aType == RPacketContext::EPacketFilterTypeThree))
|
|
588 |
{
|
|
589 |
INFO_PRINTF1(_L("Not Allowed to Set SPI"));
|
|
590 |
}
|
|
591 |
else
|
|
592 |
{
|
|
593 |
TEST(EFalse);
|
|
594 |
}
|
|
595 |
}
|
|
596 |
|
|
597 |
packetFilterV3.Reset();
|
|
598 |
err = packetFilterV3.SetTOSorTrafficClass(DPCKTTSY_TYPE_OF_SERVICE_OR_TRAFFIC_CLASS2);
|
|
599 |
if(err)
|
|
600 |
{
|
|
601 |
if(packetFilterV3.TOSorTrafficClass() == DPCKTTSY_TYPE_OF_SERVICE_OR_TRAFFIC_CLASS2)
|
|
602 |
{
|
|
603 |
INFO_PRINTF1(_L("Correct TOS or Traffic Class Returned"));
|
|
604 |
}
|
|
605 |
TEST(packetFilterV3.IsPresent(RPacketContext::TPacketFilterV3::EPacketFilterTOSorTrafficClass));
|
|
606 |
}
|
|
607 |
else
|
|
608 |
{
|
|
609 |
TEST(EFalse); // The TOS or Traffic Class should be set for all the types.
|
|
610 |
}
|
|
611 |
|
|
612 |
packetFilterV3.Reset();
|
|
613 |
err = packetFilterV3.SetFlowLabel(DPCKTTSY_FLOW_LABEL);
|
|
614 |
if(err)
|
|
615 |
{
|
|
616 |
if(packetFilterV3.FlowLabel() == DPCKTTSY_FLOW_LABEL)
|
|
617 |
INFO_PRINTF1(_L("Correct Flow Label Returned"));
|
|
618 |
TEST(packetFilterV3.IsPresent(RPacketContext::TPacketFilterV3::EPacketFilterFlowLabel));
|
|
619 |
}
|
|
620 |
else
|
|
621 |
{
|
|
622 |
if ((aType == RPacketContext::EPacketFilterTypeOne) || (aType == RPacketContext::EPacketFilterTypeTwo))
|
|
623 |
{
|
|
624 |
INFO_PRINTF1(_L("Not Allowed to Set Flow Label"));
|
|
625 |
}
|
|
626 |
else
|
|
627 |
{
|
|
628 |
TEST(EFalse);
|
|
629 |
}
|
|
630 |
}
|
|
631 |
|
|
632 |
}
|