|
1 // Copyright (c) 2005-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 // protocol manual from protocol main |
|
15 // a test harness for SDP protocol to send manual PDUs into the server |
|
16 // and onto the wire. |
|
17 // |
|
18 // |
|
19 |
|
20 |
|
21 |
|
22 #include <e32test.h> |
|
23 #include <f32file.h> |
|
24 #include <c32comm.h> |
|
25 #include "listener.h" |
|
26 #include "protocolmanl.h" |
|
27 #include "reqhandler.h" |
|
28 // #include "builddb.h" we need one of these |
|
29 #include "debug.h" |
|
30 |
|
31 #if defined (__WINS__) |
|
32 #define PDD_NAME _L("ECDRV") |
|
33 #define LDD_NAME _L("ECOMM") |
|
34 #else // __GCC32__ |
|
35 #define PDD_NAME _L("EUART1") |
|
36 #define LDD_NAME _L("ECOMM") |
|
37 // #define ETNA_PDD_NAME _L("EUART2") // for debugging over com2 |
|
38 #endif |
|
39 |
|
40 CSdpDatabase* BuildDbL(); |
|
41 CSdpDatabase* BuildUpf4DbL(); |
|
42 // in Builddb.cpp |
|
43 |
|
44 // tsdpdb.cpp |
|
45 void HexDes(const TDesC8& aDes); |
|
46 |
|
47 |
|
48 // being called by tsdpdb |
|
49 // GLDEF_D RTest test(_L("SDP Server injection tests")); |
|
50 |
|
51 GLDEF_D CSdpDatabase* gSdpTestDatabase; |
|
52 GLDEF_D TInt sdp_debug_level = 4; |
|
53 |
|
54 /* |
|
55 ** Injector test |
|
56 * |
|
57 * load up manual packets to |
|
58 respond synthetically to requests |
|
59 send into the server |
|
60 */ |
|
61 static TUint8 transId = 42; |
|
62 |
|
63 // Inject dummy SDP requests |
|
64 // inject buffers and return the response |
|
65 // first parameter is the request ID, and returns the response ID |
|
66 // so if an error occurs this can be checked... |
|
67 HBufC8* InjectLC(TUint8& aReqResID, const TPtr8& aReqBuf, TUint aMTU) |
|
68 { |
|
69 TSdpPdu iRequest; |
|
70 TSdpPdu iOutput; |
|
71 |
|
72 iRequest.iTransId = transId++; |
|
73 iRequest.iPduId = aReqResID; |
|
74 iRequest.iParams.Set(aReqBuf); |
|
75 SDP_DEBUG(2, FPrint(_L("InjectLC"))); |
|
76 SDP_DEBUG(3, FPrint(_L("SDP PDU ID %d, transaction ID %d, parameter length %d, [params]"), iRequest.iPduId, iRequest.iTransId, iRequest.iParams.Length())); |
|
77 SDP_DEBUG(4, FHex(iRequest.iParams)); |
|
78 |
|
79 HBufC8* iWriteHBuf = HBufC8::NewL(aMTU); |
|
80 CleanupStack::PushL(iWriteHBuf); |
|
81 |
|
82 iOutput.iParams.Set(iWriteHBuf->Des()); |
|
83 iOutput.iParams.Zero(); |
|
84 __UHEAP_MARK; |
|
85 TRAPD(errorCode, SdpReqHandler::HandleL(*gSdpTestDatabase, iRequest, iOutput)); |
|
86 __UHEAP_MARKEND; |
|
87 if (errorCode != KErrNone) |
|
88 { |
|
89 errorCode = SdpReqHandler::RunError(errorCode, iRequest, iOutput); |
|
90 } |
|
91 aReqResID = iOutput.iPduId; |
|
92 SDP_DEBUG(3, FPrint(_L("Writing %d bytes of response data [contents]"), iWriteHBuf->Des().Length())); |
|
93 SDP_DEBUG(4, FHex(iWriteHBuf->Des())); |
|
94 return iWriteHBuf; |
|
95 } |
|
96 |
|
97 #define KErrorResponse 0x01 |
|
98 #define KServiceSearchRequest 0x02 |
|
99 #define KServiceSearchResponse 0x03 |
|
100 #define KAttributeRequest 0x04 |
|
101 #define KAttributeResponse 0x05 |
|
102 #define KServiceAttSearchRequest 0x06 |
|
103 #define KServiceAttSearchResponse 0x07 |
|
104 |
|
105 #define DUMMTU 156 |
|
106 |
|
107 |
|
108 // send a request and match a known response, show data only if a mismatch |
|
109 TBool testSdpReqL(RTest& test, TUint8* aReqData, TUint aReqLen, TUint8 aReqId, TUint8* aRespData, TUint aRespLen, TUint8 aRespId, TUint aRespSize) |
|
110 { |
|
111 TUint8 pduId = aReqId; |
|
112 TBool testMatch; |
|
113 HBufC8* requestHBuf = HBufC8::New(aReqLen); |
|
114 HBufC8* responseHBuf; |
|
115 TPtr8 request = requestHBuf->Des(); |
|
116 |
|
117 request.SetLength(0); |
|
118 request.Append(aReqData, aReqLen); |
|
119 responseHBuf = InjectLC(pduId, request, aRespSize); |
|
120 if (pduId == aRespId) |
|
121 { |
|
122 TInt respCmp = Mem::Compare(aRespData, aRespLen, &responseHBuf->Des()[0], responseHBuf->Length()); |
|
123 if (respCmp) |
|
124 { |
|
125 test.Printf(_L("no match at offset %d:\n"), respCmp); |
|
126 HexDes(responseHBuf->Des()); |
|
127 test.Printf(_L("\n")); |
|
128 testMatch = EFalse; |
|
129 } |
|
130 else |
|
131 { |
|
132 test.Printf(_L("Response OK\n")); |
|
133 testMatch = ETrue; |
|
134 } |
|
135 } |
|
136 else |
|
137 { |
|
138 test.Printf(_L("Error:")); |
|
139 HexDes(responseHBuf->Des()); |
|
140 test.Printf(_L("\n")); |
|
141 testMatch = EFalse; |
|
142 } |
|
143 CleanupStack::PopAndDestroy(/*responseHBuf*/); |
|
144 delete requestHBuf; |
|
145 return testMatch; |
|
146 } |
|
147 |
|
148 // send a request and resend any continuations - use SDP_DEBUG to dump |
|
149 TUint testSdpContL(RTest& test, TUint8* aReqData, TUint aReqLen, TUint8 aReqId, /*TUint8* aRespData,*/ TUint aMtu) |
|
150 { |
|
151 TUint8 pduId = aReqId; |
|
152 HBufC8* requestHBuf = HBufC8::New(aReqLen + 10 /*KSdpContinuationStateLength*/); |
|
153 HBufC8* responseHBuf; |
|
154 TPtr8 request = requestHBuf->Des(); |
|
155 TPtr8 buf(0,0); |
|
156 TInt continuationLen = 0; |
|
157 TInt partial = 0; |
|
158 TInt continutations = 0; |
|
159 |
|
160 request.SetLength(0); |
|
161 request.Append(aReqData, aReqLen); |
|
162 do |
|
163 { |
|
164 pduId = aReqId; |
|
165 responseHBuf = InjectLC(pduId, request, aMtu); |
|
166 buf.Set(responseHBuf->Des()); |
|
167 |
|
168 switch(pduId) |
|
169 { |
|
170 case 0x03: |
|
171 test.Printf(_L("Got SDP_ServiceSearchResponse\n")); |
|
172 partial = BigEndian::Get16(&buf[2]); |
|
173 partial *= 4; |
|
174 partial += 4; |
|
175 continuationLen = buf[partial]; |
|
176 break; |
|
177 |
|
178 case 0x05: |
|
179 test.Printf(_L("Got SDP_ServiceAttributeResponse\n")); |
|
180 partial = BigEndian::Get16(&buf[0]); |
|
181 partial += 2; |
|
182 continuationLen = buf[partial]; |
|
183 break; |
|
184 |
|
185 case 0x07: |
|
186 test.Printf(_L("Got SDP_ServiceSearchAttributeResponse\n")); |
|
187 partial = BigEndian::Get16(&buf[0]); |
|
188 partial += 2; |
|
189 continuationLen = buf[partial]; |
|
190 break; |
|
191 default: |
|
192 |
|
193 test.Printf(_L("Got UnknownResponse (0x%x)\n"), buf[0]); |
|
194 continuationLen = 0; // create a dummy non-continuation |
|
195 break; |
|
196 } |
|
197 continutations++; |
|
198 |
|
199 request.Zero(); |
|
200 request.Append(aReqData, aReqLen-1); |
|
201 request.Append(&buf[partial], continuationLen+1); //1 for continuation len |
|
202 CleanupStack::PopAndDestroy(/*responseHBuf*/); |
|
203 } while (continuationLen != 0); |
|
204 |
|
205 |
|
206 delete requestHBuf; |
|
207 return continutations; |
|
208 } |
|
209 |
|
210 |
|
211 void TestBL(RTest& test) |
|
212 { |
|
213 __UHEAP_MARK; |
|
214 test.Start(_L("Test B -- UPF back to back tests")); |
|
215 |
|
216 gSdpTestDatabase = BuildUpf4DbL(); |
|
217 gSdpTestDatabase->EncodeDbL(); |
|
218 |
|
219 test.Printf(_L("SS for RFCOMM ")); |
|
220 TUint8 requestdata00[] = { |
|
221 0x35, 0x03, 0x19, 0x00, 0x03, // UUID list |
|
222 0x00, 0x03, // max handles |
|
223 0x00 // continuation |
|
224 }; |
|
225 TUint8 responsedata00[] = { |
|
226 0x00, 0x03, // total handle count |
|
227 0x00, 0x03, // this handle count |
|
228 0x00, 0x01, 0x00, 0x00, // handle |
|
229 0x00, 0x01, 0x00, 0x01, // handle |
|
230 0x00, 0x01, 0x00, 0x02, // handle |
|
231 0x00 // continuation |
|
232 }; |
|
233 testSdpReqL(test, &requestdata00[0], sizeof(requestdata00), KServiceSearchRequest, &responsedata00[0], sizeof(responsedata00), KServiceSearchResponse, DUMMTU); |
|
234 |
|
235 |
|
236 test.Printf(_L("AR for Server Description ")); |
|
237 TUint8 requestdata01[] = { |
|
238 0x00, 0x00, 0x00, 0x00, // handle |
|
239 0x01, 0x00, // max bytes |
|
240 0x35, 0x03, // DES header attrib list |
|
241 0x09, 0x01, 0x01, // attribute ID 0101 |
|
242 0x00 // continuation |
|
243 }; |
|
244 TUint8 responsedata01[] = { |
|
245 0x00, 0x1c, // this byte count |
|
246 0x35, 0x1a, // DES of attribute list |
|
247 0x09, 0x01, 0x01, // attribute ID 0101 |
|
248 0x25, 0x15, // string of 15h (21) bytes |
|
249 0x45, 0x50, 0x4f, 0x43, 0x20, 0x53, 0x44, 0x50, 0x20, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x20, 0x55, 0x50, 0x46, 0x2d, 0x34, |
|
250 0x00 // continuation |
|
251 }; |
|
252 testSdpReqL(test, &requestdata01[0], sizeof(requestdata01), KAttributeRequest, &responsedata01[0], sizeof(responsedata01), KAttributeResponse, 0x100); |
|
253 |
|
254 test.Printf(_L("UPF test 01 SS ")); |
|
255 TUint8 requestdataU01a[] = { |
|
256 0x35, 0x03, 0x19, 0x11, 0x03, // UUID list |
|
257 0x00, 0x03, // max handles |
|
258 0x00 // continuation |
|
259 }; |
|
260 TUint8 responsedataU01a[] = { |
|
261 0x00, 0x01, // total handle count |
|
262 0x00, 0x01, // this handle count |
|
263 0x00, 0x01, 0x00, 0x00, // handle |
|
264 0x00 // continuation |
|
265 }; |
|
266 testSdpReqL(test, &requestdataU01a[0], sizeof(requestdataU01a), KServiceSearchRequest, &responsedataU01a[0], sizeof(responsedataU01a), KServiceSearchResponse, DUMMTU); |
|
267 |
|
268 test.Printf(_L("UPF test 01 AR ")); |
|
269 TUint8 requestdataU01b[] = { |
|
270 0x00, 0x01, 0x00, 0x00, // handle |
|
271 0x01, 0x00, // max bytes |
|
272 0x35, 0x03, // DES header attrib list |
|
273 0x09, 0x00, 0x04, // attribute ID 0004 |
|
274 0x00 // continuation |
|
275 }; |
|
276 TUint8 responsedataU01b[] = { |
|
277 0x00, 0x13, // this byte count |
|
278 0x35, 0x11, // DES of attribute list |
|
279 0x09, 0x00, 0x04, // attribute ID 0101 |
|
280 0x35, 0x0c, // protocol DES |
|
281 0x35, 0x03, // DES for L2Cap |
|
282 0x19, 0x01, 0x00, // UUID L2CAP |
|
283 0x35, 0x05, // DES for RFCOMM |
|
284 0x19, 0x00, 0x03, // UUID for RFCOMM |
|
285 0x08, 0x01, // RFCOMM port number |
|
286 // 0x0a, 0x00, 0x00, 0x00, 0x01, // RFCOMM port number |
|
287 0x00 // continuation |
|
288 }; |
|
289 testSdpReqL(test, &requestdataU01b[0], sizeof(requestdataU01b), KAttributeRequest, &responsedataU01b[0], sizeof(responsedataU01b), KAttributeResponse, 0x100); |
|
290 |
|
291 test.Printf(_L("UPF test 02 ")); |
|
292 TUint8 requestdataU02a[] = { |
|
293 0x35, 0x03, 0x19, 0x10, 0x02, // UUID list |
|
294 0x01, 0x00, // max byte count |
|
295 0x35, 0x03, // DES header attrib list |
|
296 0x09, 0x01, 0x00, // attribute ID 0100 |
|
297 0x00 // continuation |
|
298 }; |
|
299 TUint8 responsedataU02a[] = { |
|
300 0x00, 0x4d, // this byte count |
|
301 0x35, 0x4b, // DES of lists of attribute lists |
|
302 0x35, 0x0f, // DES of first attribute list |
|
303 0x09, 0x01, 0x00, // attribute ID 0100 |
|
304 0x25, 0x0a, // string of 0ah (10) bytes |
|
305 0x53, 0x44, 0x50, 0x20, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, |
|
306 0x35, 0x17, // DES of second attribute list |
|
307 0x09, 0x01, 0x00, // attribute ID 0100 |
|
308 0x25, 0x12, // string of 12h (18) bytes |
|
309 0x44, 0x69, 0x61, 0x6c, 0x2d, 0x75, 0x70, 0x20, 0x6e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x69, 0x6e, 0x67, |
|
310 0x35, 0x08, // DES of third attribute list |
|
311 0x09, 0x01, 0x00, // attribute ID 0100 |
|
312 0x25, 0x03, // string of 03h bytes |
|
313 0x46, 0x61, 0x78, |
|
314 0x35, 0x15, // DES of fourth attribute list |
|
315 0x09, 0x01, 0x00, // attribute ID 0100 |
|
316 0x25, 0x10, // string of 10h (16) bytes |
|
317 0x4f, 0x42, 0x45, 0x58, 0x20, 0x4f, 0x62, 0x6a, 0x65, 0x78, 0x74, 0x20, 0x50, 0x75, 0x73, 0x68, |
|
318 0x00 // continuation |
|
319 }; |
|
320 testSdpReqL(test, requestdataU02a, sizeof(requestdataU02a), KServiceAttSearchRequest, responsedataU02a, sizeof(responsedataU02a), KServiceAttSearchResponse, DUMMTU); |
|
321 |
|
322 test.Printf(_L("UPF test 03 part 1")); |
|
323 TUint8 requestdataU03a[] = { |
|
324 0x35, 0x03, 0x19, 0x11, 0x05, // UUID list |
|
325 0x00, 0x45, // max byte count |
|
326 0x35, 0x05, 0x0a, 0x00, 0x00, 0xff, 0xff, // atttribute range |
|
327 0x00 // continuation |
|
328 }; |
|
329 TUint8 responsedataU03a[] = { |
|
330 0x00, 0x45, // this byte count |
|
331 0x35, 0x6b, // outer DES header |
|
332 0x35, 0x69, // first record DES |
|
333 0x09, 0x00, 0x00, // attribute 0 |
|
334 0x0a, 0x00, 0x01, 0x00, 0x02, // record 10002 |
|
335 0x09, 0x00, 0x01, // attribute 1 |
|
336 0x35, 0x03, 0x19, 0x11, 0x05, // service class ID |
|
337 0x09, 0x00, 0x04, // attribute 4 |
|
338 0x35, 0x14, // protocol list |
|
339 0x35, 0x03, 0x19, 0x01, 0x00, |
|
340 0x35, 0x08, 0x19, 0x00, 0x03, 0x0a, 0x00, 0x00, 0x00, 0x03, |
|
341 0x35, 0x03, 0x19, 0x00, 0x08, |
|
342 0x09, 0x00, 0x05, |
|
343 0x35, 0x03, 0x19, 0x10, 0x02, |
|
344 0x09, 0x00, 0x06, // attribute 6 |
|
345 0x35, 0x0f, |
|
346 0x0a, 0x00, 0x00, 0x65, 0x6e, |
|
347 0x0a, 0x00, 0x00, 0x00, 0x6a, |
|
348 0x0a, // start of next part |
|
349 0x0a, 0x00, 0x00, 0x00, 0x45, 0x00, 0x00, 0x00, 0x6d, 0x00, 0x00 // continuation |
|
350 }; |
|
351 testSdpReqL(test, requestdataU03a, sizeof(requestdataU03a), KServiceAttSearchRequest, responsedataU03a, sizeof(responsedataU03a), KServiceAttSearchResponse, DUMMTU); |
|
352 |
|
353 test.Printf(_L("UPF test 03 cont. ")); |
|
354 TUint8 requestdataU03b[] = { |
|
355 0x35, 0x03, 0x19, 0x11, 0x05, // UUID list |
|
356 0x00, 0x45, // max byte count |
|
357 0x35, 0x05, 0x0a, 0x00, 0x00, 0xff, 0xff, // atttribute range |
|
358 0x0a, 0x00, 0x00, 0x00, 0x45, 0x00, 0x00, 0x00, 0x6d, 0x00, 0x00 // continuation |
|
359 }; |
|
360 TUint8 responsedataU03b[] = { |
|
361 0x00, 0x28, // this byte count |
|
362 0x00, 0x00, 0x01, 0x00, // the rest of a continuation |
|
363 0x09, 0x00, 0x09, |
|
364 0x35, 0x0a, |
|
365 0x35, 0x08, |
|
366 0x19, 0x11, 0x05, |
|
367 0x0a, 0x00, 0x00, 0x01, 0x00, |
|
368 0x09, 0x01, 0x00, |
|
369 0x25, 0x10, 0x4f, 0x42, 0x45, 0x58, 0x20, 0x4f, 0x62, 0x6a, 0x65, 0x78, 0x74, 0x20, 0x50, 0x75, 0x73, 0x68, |
|
370 0x00 |
|
371 }; |
|
372 testSdpReqL(test, requestdataU03b, sizeof(requestdataU03b), KServiceAttSearchRequest, responsedataU03b, sizeof(responsedataU03b), KServiceAttSearchResponse, DUMMTU); |
|
373 |
|
374 test.Printf(_L("UPF test 04 ")); |
|
375 TUint8 requestdataU04[] = { |
|
376 0x35, 0x03, 0x19, 0x12, 0x34, // UUID list |
|
377 0x00, 0x03, // max handles |
|
378 0x00 // continuation |
|
379 }; |
|
380 TUint8 responsedataU04[] = { |
|
381 0x00, 0x00, // total handle count |
|
382 0x00, 0x00, // this handle count |
|
383 // no handle |
|
384 0x00 // continuation |
|
385 }; |
|
386 testSdpReqL(test, requestdataU04, sizeof(requestdataU04), KServiceSearchRequest, responsedataU04, sizeof(responsedataU04), KServiceSearchResponse, DUMMTU); |
|
387 |
|
388 test.Printf(_L("UPF test 05 ")); |
|
389 TUint8 requestdataU05[] = { |
|
390 0x12, 0x34, 0x56, 0x78, // handle |
|
391 0x01, 0x00, // max bytes |
|
392 0x35, 0x03, // DES header attrib list |
|
393 0x09, 0x00, 0x06, // attribute ID 0006 |
|
394 0x00 // continuation |
|
395 }; |
|
396 TUint8 responsedataU05[] = { |
|
397 0x00, 0x02 // error response |
|
398 }; |
|
399 testSdpReqL(test, &requestdataU05[0], sizeof(requestdataU05), KAttributeRequest, &responsedataU05[0], sizeof(responsedataU05), KErrorResponse, 0x100); |
|
400 |
|
401 test.Printf(_L("UPF test 06 ")); |
|
402 TUint8 requestdataU06[] = { |
|
403 0x35, 0x03, 0x19, 0x11, 0x11, // UUID list |
|
404 0x00, 0x45, // max byte count |
|
405 0x35, 0x03, 0x09, 0xab, 0xcd, // non existent attrib |
|
406 0x00 |
|
407 }; |
|
408 TUint8 responsedataU06[] = { |
|
409 0x00, 0x02, // this byte count |
|
410 0x35, 0x00, |
|
411 0x00 |
|
412 }; |
|
413 testSdpReqL(test, requestdataU06, sizeof(requestdataU06), KServiceAttSearchRequest, responsedataU06, sizeof(responsedataU06), KServiceAttSearchResponse, DUMMTU); |
|
414 |
|
415 // can't do this test - length is handled in ParseNextPacket - fails with wrong code |
|
416 test.Printf(_L("UPF test 07 (can't test) ")); |
|
417 TUint8 requestdataU07[] = { |
|
418 0x00, 0x01, 0x00, 0x02, // handle for OBEX |
|
419 0x01, 0x00, // max bytes |
|
420 0x35, 0x03, // DES header attrib list |
|
421 0x09, 0x00, 0x09, // attribute ID 0009 |
|
422 0x00 // continuation |
|
423 }; |
|
424 TUint8 responsedataU07[] = { |
|
425 0x00, 0x02 // error response |
|
426 }; |
|
427 testSdpReqL(test, &requestdataU07[0], 50, KAttributeRequest, &responsedataU07[0], sizeof(responsedataU07), KErrorResponse, DUMMTU); |
|
428 |
|
429 |
|
430 test.Printf(_L("UPF test 08 ")); |
|
431 TUint8 requestdataU08[] = { |
|
432 0x35, 0x03, 0x09, 0x11, 0x11, // UINT list instead of UUID list |
|
433 0x00, 0x45, // max byte count |
|
434 0x35, 0x03, 0x09, 0x00, 0x09, // non existent attrib |
|
435 0x00 |
|
436 }; |
|
437 TUint8 responsedataU08[] = { |
|
438 0x00, 0x03 // invalid request syntax |
|
439 }; |
|
440 testSdpReqL(test, requestdataU08, sizeof(requestdataU08), KServiceAttSearchRequest, responsedataU08, sizeof(responsedataU08), KErrorResponse, DUMMTU); |
|
441 |
|
442 test.Printf(_L("UPF test 09 ")); |
|
443 TUint8 requestdataU09[] = { |
|
444 0x35, 0x09, // UUID list |
|
445 0x19, 0x11, 0x05, // OBEX |
|
446 0x19, 0x00, 0x03, // RFCOMM |
|
447 0x19, 0x01, 0x00, // L2CAP |
|
448 0x00, 0x45, // max byte count |
|
449 0x35, 0x03, 0x09, 0x00, 0x04, // attrib 04 |
|
450 0x00 |
|
451 }; |
|
452 TUint8 responsedataU09[] = { |
|
453 0x00, 0x1d, |
|
454 0x35, 0x1b, |
|
455 0x35, 0x19, |
|
456 0x09, 0x00, 0x04, |
|
457 0x35, 0x14, |
|
458 0x35, 0x03, 0x19, 0x01, 0x00, |
|
459 0x35, 0x08, 0x19, 0x00, 0x03, 0x0a, 0x00, 0x00, 0x00, 0x03, |
|
460 0x35, 0x03, 0x19, 0x00, 0x08, |
|
461 0x00 |
|
462 }; |
|
463 testSdpReqL(test, requestdataU09, sizeof(requestdataU09), KServiceAttSearchRequest, responsedataU09, sizeof(responsedataU09), KServiceAttSearchResponse, DUMMTU); |
|
464 |
|
465 test.Printf(_L("UPF test 10 ")); |
|
466 TUint8 requestdataU10[] = { |
|
467 0x35, 0x03, 0x19, 0x00, 0x03, // UUID list |
|
468 0x00, 0x02, // max handles |
|
469 0x00 // continuation |
|
470 }; |
|
471 TUint8 responsedataU10[] = { |
|
472 0x00, 0x02, // total handle count |
|
473 0x00, 0x02, // this handle count |
|
474 0x00, 0x01, 0x00, 0x00, // handle |
|
475 0x00, 0x01, 0x00, 0x01, // handle |
|
476 0x00 // continuation |
|
477 }; |
|
478 testSdpReqL(test, &requestdataU10[0], sizeof(requestdataU10), KServiceSearchRequest, &responsedataU10[0], sizeof(responsedataU10), KServiceSearchResponse, DUMMTU); |
|
479 |
|
480 test.Printf(_L("UPF test 11 ")); |
|
481 TUint8 requestdataU11[] = { |
|
482 0x00, 0x01, 0x00, 0x00, // handle for system |
|
483 0x01, 0x00, // max bytes |
|
484 0x35, 0x09, // DES header attrib list |
|
485 0x09, 0x00, 0x06, // attribute exists |
|
486 0x09, 0x00, 0x11, // attribute doesn't exist |
|
487 0x09, 0x01, 0x00, // attribute exists |
|
488 0x00 // continuation |
|
489 }; |
|
490 TUint8 responsedataU11[] = { |
|
491 0x00, 0x2d, // response |
|
492 0x35, 0x2b, |
|
493 0x09, 0x00, 0x06, |
|
494 0x35, 0x0f, 0x0a, 0x00, 0x00, 0x65, 0x6e, 0x0a, 0x00, 0x00, 0x00, 0x6a, 0x0a, 0x00, 0x00, 0x01, 0x00, |
|
495 0x09, 0x01, 0x00, |
|
496 0x25, 0x12, 0x44, 0x69, 0x61, 0x6c, 0x2d, 0x75, 0x70, 0x20, 0x6e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x69, 0x6e, 0x67, |
|
497 0x00 |
|
498 }; |
|
499 testSdpReqL(test, &requestdataU11[0], sizeof(requestdataU11), KAttributeRequest, &responsedataU11[0], sizeof(responsedataU11), KAttributeResponse, DUMMTU); |
|
500 |
|
501 test.Printf(_L("UPF test 12 (can't test)")); |
|
502 |
|
503 // CleanupStack::PopAndDestroy(/*CSdpReqHandler*/); |
|
504 delete gSdpTestDatabase; |
|
505 gSdpTestDatabase = 0; |
|
506 __UHEAP_MARKEND; |
|
507 test.End(); |
|
508 } |
|
509 |
|
510 |
|
511 void TestCL(RTest& test, CSdpDatabase *aDb) |
|
512 { |
|
513 test.Start(_L("Test C -- continuation stress test")); |
|
514 |
|
515 gSdpTestDatabase = aDb; |
|
516 gSdpTestDatabase->EncodeDbL(); |
|
517 |
|
518 sdp_debug_level = 1; // wind the noise down - this works |
|
519 test.Printf(_L("SS for KSdpContTestUUID\n")); |
|
520 TUint8 requestdata00a[] = { |
|
521 0x35, 0x03, 0x19, 0x01, 0x00, // UUID list |
|
522 0xff, 0xff, // max handles |
|
523 0x00 // continuation |
|
524 }; |
|
525 |
|
526 TUint tCount = testSdpContL(test, requestdata00a, sizeof(requestdata00a), KServiceSearchRequest, /*TUint8* aRespData,*/ DUMMTU); |
|
527 test.Printf(_L("SS for KSdpContTestUUID %d continuations\n"), tCount); |
|
528 test.Getch(); |
|
529 |
|
530 test.Printf(_L("AR for all attributes\n")); |
|
531 TUint8 requestdata01[] = { |
|
532 0x00, 0x00, 0x00, 0x00, // handle |
|
533 0x01, 0x00, // max bytes |
|
534 0x35, 0x05, // DES header attrib list |
|
535 0x0a, 0x00, 0x00, 0xff, 0xff, // attribute ID range 0000 to ffff |
|
536 0x00 // continuation |
|
537 }; |
|
538 tCount = testSdpContL(test, requestdata01, sizeof(requestdata01), KAttributeRequest, /*TUint8* aRespData,*/ DUMMTU); |
|
539 test.Printf(_L("AR for all attributes, handle 00000000 %d continuations\n"), tCount); |
|
540 test.Getch(); |
|
541 |
|
542 test.Printf(_L("AR for all attributes\n")); |
|
543 TUint8 requestdata02[] = { |
|
544 0x00, 0x01, 0x00, 0x00, // handle |
|
545 0x01, 0x00, // max bytes |
|
546 0x35, 0x05, // DES header attrib list |
|
547 0x0a, 0x00, 0x00, 0xff, 0xff, // attribute ID range 0000 to ffff |
|
548 0x00 // continuation |
|
549 }; |
|
550 tCount = testSdpContL(test, requestdata02, sizeof(requestdata02), KAttributeRequest, /*TUint8* aRespData,*/ DUMMTU); |
|
551 test.Printf(_L("AR for all attributes, handle 00010000 %d continuations\n"), tCount); |
|
552 test.Getch(); |
|
553 |
|
554 test.Printf(_L("AR for attribute 0004\n")); |
|
555 TUint8 requestdata03[] = { |
|
556 0x00, 0x01, 0x00, 0x00, // handle |
|
557 0x01, 0x00, // max bytes |
|
558 0x35, 0x03, // DES header attrib list |
|
559 0x09, 0x00, 0x04, // attribute ID 0004 |
|
560 0x00 // continuation |
|
561 }; |
|
562 tCount = testSdpContL(test, requestdata03, sizeof(requestdata03), KAttributeRequest, /*TUint8* aRespData,*/ DUMMTU); |
|
563 test.Printf(_L("AR for attribute 0004, handle 00010000 %d continuations\n"), tCount); |
|
564 test.Getch(); |
|
565 |
|
566 test.Printf(_L("AR for all attributes\n")); |
|
567 TUint8 requestdata04[] = { |
|
568 0x00, 0x01, 0x00, 0x03e, // handle |
|
569 0x01, 0x00, // max bytes |
|
570 0x35, 0x05, // DES header attrib list |
|
571 0x0a, 0x00, 0x00, 0xff, 0xff, // attribute ID range 0000 to ffff |
|
572 0x00 // continuation |
|
573 }; |
|
574 tCount = testSdpContL(test, requestdata04, sizeof(requestdata04), KAttributeRequest, /*TUint8* aRespData,*/ DUMMTU); |
|
575 test.Printf(_L("AR for all attributes, handle 0001003e %d continuations\n"), tCount); |
|
576 test.Getch(); |
|
577 |
|
578 sdp_debug_level = 5; |
|
579 |
|
580 test.Printf(_L("SAS for all attributes\n")); |
|
581 TUint8 requestdata05[] = { |
|
582 0x35, 0x03, 0x19, 0x01, 0x00, // UUID list |
|
583 0x01, 0x00, // max byte count |
|
584 0x35, 0x05, // DES header attrib list |
|
585 0x0a, 0x00, 0x00, 0xff, 0xff, // attribute ID range 0000 to ffff |
|
586 0x00 // continuation |
|
587 }; |
|
588 tCount = testSdpContL(test, requestdata05, sizeof(requestdata05), KServiceAttSearchRequest, /*TUint8* aRespData,*/ DUMMTU); |
|
589 // tCount = testSdpCont(test, requestdata05, sizeof(requestdata05), KServiceAttSearchRequest, /*TUint8* aRespData,*/ 102); |
|
590 test.Printf(_L("SAS for all attributes, %d continuations\n"), tCount); |
|
591 test.Getch(); |
|
592 |
|
593 // CleanupStack::PopAndDestroy(/*CSdpReqHandler*/); |
|
594 delete gSdpTestDatabase; |
|
595 gSdpTestDatabase = 0; |
|
596 test.End(); |
|
597 } |