|
1 /* |
|
2 * Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: ICE Communication tests |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 |
|
21 #include "natcomtest.h" |
|
22 |
|
23 #include "natfwconnectivityapi.h" |
|
24 #include "natfwcredentials.h" |
|
25 #include <e32cons.h> |
|
26 #include "natfwconnectivityapidefs.h" |
|
27 #include <e32debug.h> |
|
28 #include "natfwcandidate.h" |
|
29 #include "natfwcandidatepair.h" |
|
30 #include <mmccinterfacedef.h> |
|
31 #include <badesca.h> |
|
32 |
|
33 #include "natcomtestobserver.h" |
|
34 #include "testdefinitions.hrh" |
|
35 #include "natfwtestconsolelogs.h" |
|
36 #include "natcomteststate.h" |
|
37 #include "mccmediastream.h" |
|
38 #include "mccsession.h" |
|
39 #include "mcclink.h" |
|
40 |
|
41 const TInt KQoS = 45; |
|
42 const TInt KStreamCollectionId = 1; |
|
43 |
|
44 const TInt KRtpMediaComponentId = 1; |
|
45 const TInt KRtcpMediaComponentId = 2; |
|
46 |
|
47 _LIT8( KMOUsername, "icemo" ); |
|
48 _LIT8( KMTUsername, "icemt" ); |
|
49 |
|
50 _LIT8( KNATStun, "nokia.stun" ); |
|
51 _LIT8( KNATTurn, "nokia.turn" ); |
|
52 _LIT8( KNATIce, "nokia.ice" ); |
|
53 |
|
54 // --------------------------------------------------------------------------- |
|
55 // CNatComTest::CNatComTest |
|
56 // --------------------------------------------------------------------------- |
|
57 // |
|
58 CNatComTest::CNatComTest( TUint32 aIapId, MNatComTestObserver& aObserver ) : |
|
59 CActive( CActive::EPriorityStandard ), iIapId( aIapId ), |
|
60 iObserver( aObserver ) |
|
61 { |
|
62 iOnlyCandidates = EFalse; |
|
63 iState = EReady; |
|
64 } |
|
65 |
|
66 // --------------------------------------------------------------------------- |
|
67 // CNatComTest::ConstructL |
|
68 // --------------------------------------------------------------------------- |
|
69 // |
|
70 void CNatComTest::ConstructL( const TDesC8& aDomain ) |
|
71 { |
|
72 __NATFWTESTCONSOLE( "CNatComTest::ConstructL -Start" ) |
|
73 const TInt KDefaultGranularity = 1; |
|
74 |
|
75 CActiveScheduler::Add( this ); |
|
76 iDomain = aDomain.AllocL(); |
|
77 iNat = CNATFWConnectivityApi::NewL(); |
|
78 iNat->RegisterObserverForEventsL( *this, |
|
79 MNATFWConnectivityObserver::EAllEvents ); |
|
80 iSession = CMccSession::NewL( iIapId ); |
|
81 iPlugins = new ( ELeave ) CDesC8ArrayFlat( KDefaultGranularity ); |
|
82 |
|
83 __NATFWTESTCONSOLE( "CNatComTest::ConstructL -End" ) |
|
84 } |
|
85 |
|
86 // --------------------------------------------------------------------------- |
|
87 // CNatComTest::NewL |
|
88 // --------------------------------------------------------------------------- |
|
89 // |
|
90 CNatComTest* CNatComTest::NewL( const TDesC8& aDomain, TUint32 aIapId, |
|
91 MNatComTestObserver& aObserver ) |
|
92 { |
|
93 __NATFWTESTCONSOLE( "CNatComTest::NewL" ) |
|
94 CNatComTest* self = CNatComTest::NewLC( aDomain, aIapId, aObserver ); |
|
95 CleanupStack::Pop( self ); |
|
96 return self; |
|
97 } |
|
98 |
|
99 // --------------------------------------------------------------------------- |
|
100 // CNatComTest::NewLC |
|
101 // --------------------------------------------------------------------------- |
|
102 // |
|
103 CNatComTest* CNatComTest::NewLC( const TDesC8& aDomain, TUint32 aIapId, |
|
104 MNatComTestObserver& aObserver ) |
|
105 { |
|
106 __NATFWTESTCONSOLE( "CNatComTest::NewLC" ) |
|
107 CNatComTest* self = new (ELeave) CNatComTest( aIapId, aObserver ); |
|
108 CleanupStack::PushL( self ); |
|
109 self->ConstructL( aDomain ); |
|
110 return self; |
|
111 } |
|
112 |
|
113 // --------------------------------------------------------------------------- |
|
114 // CNatComTest::~CNatComTest |
|
115 // --------------------------------------------------------------------------- |
|
116 // |
|
117 CNatComTest::~CNatComTest() |
|
118 { |
|
119 Cancel(); |
|
120 delete iSession; |
|
121 delete iDomain; |
|
122 delete iNat; |
|
123 delete iPlugins; |
|
124 iLocalCandidates.ResetAndDestroy(); |
|
125 iCandidatePairs.ResetAndDestroy(); |
|
126 iStreamIds.Close(); |
|
127 } |
|
128 |
|
129 // --------------------------------------------------------------------------- |
|
130 // CNatComTest::FetchCandidates |
|
131 // --------------------------------------------------------------------------- |
|
132 // |
|
133 TInt CNatComTest::OnlyFetchCandidates( TUint aProtocol ) |
|
134 { |
|
135 iOnlyCandidates = ETrue; |
|
136 return StartUsingIce( aProtocol, EIceRoleControlling ); |
|
137 } |
|
138 |
|
139 // --------------------------------------------------------------------------- |
|
140 // CNatComTest::StoreLocalCondidates |
|
141 // --------------------------------------------------------------------------- |
|
142 // |
|
143 TInt CNatComTest::StoreLocalCondidates( TUint aProtocol, |
|
144 TBool aUseRtcp ) |
|
145 { |
|
146 RArray<TNatComState> sequence; |
|
147 TInt err; |
|
148 |
|
149 iPlugins->Reset(); |
|
150 TRAP( err, iPlugins->AppendL( KNATIce ) ); |
|
151 if ( err ) |
|
152 { |
|
153 return err; |
|
154 } |
|
155 |
|
156 if ( aUseRtcp ) |
|
157 { |
|
158 sequence.Append( ECreateSession ); |
|
159 sequence.Append( ELoadPlugin ); |
|
160 sequence.Append( ECreateRtpStream ); |
|
161 sequence.Append( EFetchRtpCandidates ); |
|
162 sequence.Append( ECreateRtcpStream ); |
|
163 sequence.Append( EFetchRtcpCandidates ); |
|
164 sequence.Append( EStoreLocalCandidates ); |
|
165 sequence.Append( EEnd ); |
|
166 } |
|
167 else |
|
168 { |
|
169 sequence.Append( ECreateSession ); |
|
170 sequence.Append( ELoadPlugin ); |
|
171 sequence.Append( ECreateRtpStream ); |
|
172 sequence.Append( EFetchRtpCandidates ); |
|
173 sequence.Append( EStoreLocalCandidates ); |
|
174 sequence.Append( EEnd ); |
|
175 } |
|
176 |
|
177 iStateSequence.SetSequence( sequence ); |
|
178 iStateSequence.SetTestType( EIceComTest ); |
|
179 |
|
180 SetTeardownSequence( EIceComTest, aUseRtcp ); |
|
181 |
|
182 err = Start( aProtocol, EIceRoleControlling ); |
|
183 sequence.Close(); |
|
184 return err; |
|
185 } |
|
186 |
|
187 // --------------------------------------------------------------------------- |
|
188 // CNatComTest::StoreLocalCandidate |
|
189 // --------------------------------------------------------------------------- |
|
190 // |
|
191 TInt CNatComTest::StoreLocalCandidate( TUint aProtocol, TComTestType aTestType, |
|
192 TBool aUseRtcp ) |
|
193 { |
|
194 RArray<TNatComState> sequence; |
|
195 TInt err = KErrNone; |
|
196 |
|
197 if ( aUseRtcp ) |
|
198 { |
|
199 sequence.Append( ECreateSession ); |
|
200 sequence.Append( ELoadPlugin ); |
|
201 sequence.Append( ECreateRtpStream ); |
|
202 sequence.Append( EFetchRtpCandidate ); |
|
203 sequence.Append( ECreateRtcpStream ); |
|
204 sequence.Append( EFetchRtcpCandidate ); |
|
205 sequence.Append( EStoreLocalCandidates ); |
|
206 sequence.Append( EEnd ); |
|
207 } |
|
208 else |
|
209 { |
|
210 sequence.Append( ECreateSession ); |
|
211 sequence.Append( ELoadPlugin ); |
|
212 sequence.Append( ECreateRtpStream ); |
|
213 sequence.Append( EFetchRtpCandidate ); |
|
214 sequence.Append( EStoreLocalCandidates ); |
|
215 sequence.Append( EEnd ); |
|
216 } |
|
217 |
|
218 iStateSequence.SetSequence( sequence ); |
|
219 iStateSequence.SetTestType( aTestType ); |
|
220 SetTeardownSequence( aTestType, aUseRtcp ); |
|
221 |
|
222 iPlugins->Reset(); |
|
223 if ( EStunComTest == aTestType ) |
|
224 { |
|
225 TRAP( err, iPlugins->AppendL( KNATStun ) ); |
|
226 } |
|
227 if ( ETurnComTest == aTestType) |
|
228 { |
|
229 TRAP( err, iPlugins->AppendL( KNATTurn ) ); |
|
230 } |
|
231 if ( err ) |
|
232 { |
|
233 return err; |
|
234 } |
|
235 err = Start( aProtocol, EIceRoleControlling ); |
|
236 sequence.Close(); |
|
237 return err; |
|
238 } |
|
239 |
|
240 // --------------------------------------------------------------------------- |
|
241 // CNatComTest::StartComTest |
|
242 // --------------------------------------------------------------------------- |
|
243 // |
|
244 TInt CNatComTest::StartComTest( TUint aProtocol, TComTestType aTestType, |
|
245 TBool aUseRtcp ) |
|
246 { |
|
247 RArray<TNatComState> sequence; |
|
248 TInt err = KErrNone; |
|
249 |
|
250 if ( aUseRtcp ) |
|
251 { |
|
252 sequence.Append( ECreateSession ); |
|
253 sequence.Append( ELoadPlugin ); |
|
254 sequence.Append( ECreateRtpStream ); |
|
255 sequence.Append( EFetchRtpCandidate ); |
|
256 sequence.Append( ECreateRtcpStream ); |
|
257 sequence.Append( EFetchRtcpCandidate ); |
|
258 sequence.Append( ECreateRtpWrapper ); |
|
259 sequence.Append( ECreateRtcpWrapper ); |
|
260 sequence.Append( EPrepareMccLink ); |
|
261 sequence.Append( ESetOutgoingAddr ); |
|
262 sequence.Append( ECreateMediaUpStream ); |
|
263 sequence.Append( ECreateMediaDownStream ); |
|
264 sequence.Append( ESetWrapperIncomingAddr ); |
|
265 sequence.Append( EPause ); |
|
266 sequence.Append( ESetRtpReceivingState ); |
|
267 sequence.Append( ESetRtcpReceivingState ); |
|
268 sequence.Append( ESetRtpSendingState ); |
|
269 sequence.Append( ESetRtcpSendingState ); |
|
270 sequence.Append( EStartMediaDownStream ); |
|
271 sequence.Append( EStartMediaUpStream ); |
|
272 sequence.Append( ERunning ); |
|
273 } |
|
274 else |
|
275 { |
|
276 sequence.Append( ECreateSession ); |
|
277 sequence.Append( ELoadPlugin ); |
|
278 sequence.Append( ECreateRtpStream ); |
|
279 sequence.Append( EFetchRtpCandidate ); |
|
280 sequence.Append( ECreateRtpWrapper ); |
|
281 sequence.Append( EPrepareMccLink ); |
|
282 sequence.Append( ESetOutgoingAddr ); |
|
283 sequence.Append( ECreateMediaUpStream ); |
|
284 sequence.Append( ECreateMediaDownStream ); |
|
285 sequence.Append( ESetWrapperIncomingAddr ); |
|
286 sequence.Append( EPause ); |
|
287 sequence.Append( ESetRtpReceivingState ); |
|
288 sequence.Append( ESetRtpSendingState ); |
|
289 sequence.Append( EStartMediaDownStream ); |
|
290 sequence.Append( EStartMediaUpStream ); |
|
291 sequence.Append( ERunning ); |
|
292 } |
|
293 iStateSequence.SetSequence( sequence ); |
|
294 iStateSequence.SetTestType( aTestType ); |
|
295 SetTeardownSequence( aTestType, aUseRtcp ); |
|
296 |
|
297 iPlugins->Reset(); |
|
298 if ( EStunComTest == aTestType ) |
|
299 { |
|
300 TRAP( err, iPlugins->AppendL( KNATStun ) ); |
|
301 } |
|
302 if ( ETurnComTest == aTestType) |
|
303 { |
|
304 TRAP( err, iPlugins->AppendL( KNATTurn ) ); |
|
305 } |
|
306 if ( err ) |
|
307 { |
|
308 return err; |
|
309 } |
|
310 err = Start( aProtocol, EIceRoleControlling ); |
|
311 sequence.Close(); |
|
312 return err; |
|
313 } |
|
314 |
|
315 // --------------------------------------------------------------------------- |
|
316 // CNatComTest::StartUsingIce |
|
317 // --------------------------------------------------------------------------- |
|
318 // |
|
319 TInt CNatComTest::StartUsingIce( TUint aProtocol, |
|
320 TNATFWIceRole aRole, TBool aUseRtcp ) |
|
321 { |
|
322 RArray<TNatComState> sequence; |
|
323 TInt err; |
|
324 |
|
325 iPlugins->Reset(); |
|
326 TRAP( err, iPlugins->AppendL( KNATIce ) ); |
|
327 if ( err ) |
|
328 { |
|
329 return err; |
|
330 } |
|
331 |
|
332 if ( aUseRtcp ) |
|
333 { |
|
334 sequence.Append( ECreateSession ); |
|
335 sequence.Append( ELoadPlugin ); |
|
336 sequence.Append( ECreateRtpStream ); |
|
337 sequence.Append( EFetchRtpCandidates ); |
|
338 sequence.Append( ECreateRtcpStream ); |
|
339 sequence.Append( EFetchRtcpCandidates ); |
|
340 sequence.Append( ESetOperationMode ); |
|
341 sequence.Append( ESetIdentification ); |
|
342 sequence.Append( EPause ); |
|
343 sequence.Append( EConnectivityChecks ); |
|
344 sequence.Append( EPause ); |
|
345 sequence.Append( ECreateRtpWrapper ); |
|
346 sequence.Append( ECreateRtcpWrapper ); |
|
347 sequence.Append( EPrepareMccLink ); |
|
348 sequence.Append( ESetOutgoingAddr ); |
|
349 sequence.Append( ECreateMediaUpStream ); |
|
350 sequence.Append( ECreateMediaDownStream ); |
|
351 sequence.Append( ESetWrapperIncomingAddr ); |
|
352 sequence.Append( EPause ); |
|
353 |
|
354 if ( EIceRoleControlling == aRole ) |
|
355 { |
|
356 sequence.Append( ESetRtpReceivingState ); |
|
357 sequence.Append( ESetRtcpReceivingState ); |
|
358 sequence.Append( ESetRtpSendingStateIce ); |
|
359 sequence.Append( ESetRtcpSendingStateIce ); |
|
360 sequence.Append( EStartMediaUpStream ); |
|
361 sequence.Append( EStartMediaDownStream ); |
|
362 } |
|
363 else |
|
364 { |
|
365 sequence.Append( ESetRtpReceivingState ); |
|
366 sequence.Append( ESetRtcpReceivingState ); |
|
367 sequence.Append( ESetRtpSendingStateIce ); |
|
368 sequence.Append( ESetRtcpSendingStateIce ); |
|
369 sequence.Append( EStartMediaDownStream ); |
|
370 sequence.Append( EStartMediaUpStream ); |
|
371 } |
|
372 sequence.Append( ERunning ); |
|
373 } |
|
374 else |
|
375 { |
|
376 sequence.Append( ECreateSession ); |
|
377 sequence.Append( ELoadPlugin ); |
|
378 sequence.Append( ECreateRtpStream ); |
|
379 sequence.Append( EFetchRtpCandidates ); |
|
380 sequence.Append( ESetOperationMode ); |
|
381 sequence.Append( ESetIdentification ); |
|
382 sequence.Append( EPause ); |
|
383 sequence.Append( EConnectivityChecks ); |
|
384 sequence.Append( EPause ); |
|
385 sequence.Append( ECreateRtpWrapper ); |
|
386 sequence.Append( EPrepareMccLink ); |
|
387 sequence.Append( ESetOutgoingAddr ); |
|
388 sequence.Append( ECreateMediaUpStream ); |
|
389 sequence.Append( ECreateMediaDownStream ); |
|
390 sequence.Append( ESetWrapperIncomingAddr ); |
|
391 sequence.Append( EPause ); |
|
392 |
|
393 if ( EIceRoleControlling == aRole ) |
|
394 { |
|
395 sequence.Append( ESetRtpReceivingState ); |
|
396 sequence.Append( ESetRtpSendingStateIce ); |
|
397 sequence.Append( EStartMediaUpStream ); |
|
398 sequence.Append( EStartMediaDownStream ); |
|
399 } |
|
400 else |
|
401 { |
|
402 sequence.Append( ESetRtpReceivingState ); |
|
403 sequence.Append( ESetRtpSendingStateIce ); |
|
404 sequence.Append( EStartMediaDownStream ); |
|
405 sequence.Append( EStartMediaUpStream ); |
|
406 } |
|
407 sequence.Append( ERunning ); |
|
408 } |
|
409 |
|
410 iStateSequence.SetSequence( sequence ); |
|
411 iStateSequence.SetTestType( EIceComTest ); |
|
412 |
|
413 SetTeardownSequence( EIceComTest, aUseRtcp ); |
|
414 |
|
415 err = Start( aProtocol, aRole ); |
|
416 sequence.Close(); |
|
417 return err; |
|
418 } |
|
419 |
|
420 |
|
421 // --------------------------------------------------------------------------- |
|
422 // CNatComTest::SetTeardownSequence |
|
423 // --------------------------------------------------------------------------- |
|
424 // |
|
425 void CNatComTest::SetTeardownSequence( TInt aTestType, TBool aUseRtcp ) |
|
426 { |
|
427 RArray<TNatComState> sequence; |
|
428 if ( aUseRtcp ) |
|
429 { |
|
430 if ( EIceComTest == aTestType ) |
|
431 { |
|
432 sequence.Append( EPassiveRtpSendingStateIce ); |
|
433 sequence.Append( EPassiveRtcpSendingStateIce ); |
|
434 } |
|
435 else |
|
436 { |
|
437 sequence.Append( EPassiveRtpSendingState ); |
|
438 sequence.Append( EPassiveRtcpSendingState ); |
|
439 } |
|
440 sequence.Append( EPassiveRtcpReceivingState ); |
|
441 sequence.Append( EPassiveRtpReceivingState ); |
|
442 sequence.Append( ETeardown ); |
|
443 } |
|
444 else |
|
445 { |
|
446 if ( EIceComTest == aTestType ) |
|
447 { |
|
448 sequence.Append( EPassiveRtpSendingStateIce ); |
|
449 } |
|
450 else |
|
451 { |
|
452 sequence.Append( EPassiveRtpSendingState ); |
|
453 } |
|
454 sequence.Append( EPassiveRtpReceivingState ); |
|
455 sequence.Append( ETeardown ); |
|
456 } |
|
457 iTeardownSequence.SetSequence( sequence ); |
|
458 iTeardownSequence.SetTestType( aTestType ); |
|
459 sequence.Close(); |
|
460 } |
|
461 |
|
462 |
|
463 // --------------------------------------------------------------------------- |
|
464 // CNatComTest::Start |
|
465 // --------------------------------------------------------------------------- |
|
466 // |
|
467 TInt CNatComTest::Start( TUint aProtocol, |
|
468 TNATFWIceRole aRole ) |
|
469 { |
|
470 if ( EReady != iState ) |
|
471 { |
|
472 return KErrInUse; |
|
473 } |
|
474 iMode = aRole; |
|
475 iProtocol = aProtocol; |
|
476 iState = iStateSequence.Current(); |
|
477 ActiveRequestCompleted( KErrNone ); |
|
478 return KErrNone; |
|
479 } |
|
480 |
|
481 // --------------------------------------------------------------------------- |
|
482 // CNatComTest::StopL |
|
483 // --------------------------------------------------------------------------- |
|
484 // |
|
485 void CNatComTest::StopL() |
|
486 { |
|
487 RDebug::Print( _L("TEST PRINT: CNatComTest::StopL" ) ); |
|
488 if ( EReady != iState ) |
|
489 { |
|
490 Cancel(); |
|
491 iState = EEnd; |
|
492 ActiveRequestCompleted( KErrNone ); |
|
493 } |
|
494 } |
|
495 |
|
496 |
|
497 // --------------------------------------------------------------------------- |
|
498 // CNatComTest::TeardownL |
|
499 // --------------------------------------------------------------------------- |
|
500 // |
|
501 void CNatComTest::TeardownL() |
|
502 { |
|
503 RDebug::Print( _L("TEST PRINT: CNatComTest::TeardownL -start" ) ); |
|
504 |
|
505 if ( iUpStreamId ) |
|
506 { |
|
507 iSession->CloseMediaStreamL( iUpStreamId ); |
|
508 iUpStreamId = 0; |
|
509 } |
|
510 if ( iDownStreamId ) |
|
511 { |
|
512 iSession->CloseMediaStreamL( iDownStreamId ); |
|
513 iDownStreamId = 0; |
|
514 } |
|
515 if ( iLinkId ) |
|
516 { |
|
517 iSession->CloseLinkL( iLinkId ); |
|
518 } |
|
519 if ( iRtpStreamId ) |
|
520 { |
|
521 iNat->CloseStreamL( iSessionId, iRtpStreamId ); |
|
522 } |
|
523 if ( iRtcpStreamId ) |
|
524 { |
|
525 iNat->CloseStreamL( iSessionId, iRtcpStreamId ); |
|
526 } |
|
527 if ( iSessionId ) |
|
528 { |
|
529 iNat->CloseSessionL( iSessionId ); |
|
530 } |
|
531 |
|
532 iLocalCandidates.ResetAndDestroy(); |
|
533 iCandidatePairs.ResetAndDestroy(); |
|
534 |
|
535 iState = EReady; |
|
536 ActiveRequestCompleted( KErrNone ); |
|
537 |
|
538 RDebug::Print( _L("TEST PRINT: CNatComTest::TeardownL -end" ) ); |
|
539 } |
|
540 |
|
541 // --------------------------------------------------------------------------- |
|
542 // from CActive |
|
543 // CNatComTest::RunL |
|
544 // --------------------------------------------------------------------------- |
|
545 // |
|
546 void CNatComTest::RunL() |
|
547 { |
|
548 __NATFWTESTCONSOLE_INT1( "CNatComTest::RunL", iStatus.Int() ) |
|
549 |
|
550 TInt error; |
|
551 TInetAddr RtpAddr; |
|
552 TInetAddr RtcpAddr; |
|
553 |
|
554 if ( iStatus.Int() || EError == iState || EEnd == iState ) |
|
555 { |
|
556 if ( EError == iState ) |
|
557 { |
|
558 iObserver.Notify( MNatComTestObserver::ETestError, iStatus.Int() ); |
|
559 } |
|
560 if ( iStateSequence.Current() >= ESetRtpSendingState ) |
|
561 { |
|
562 iState = iTeardownSequence.Current(); |
|
563 } |
|
564 else |
|
565 { |
|
566 iState = ETeardown; |
|
567 } |
|
568 } |
|
569 switch( iState ) |
|
570 { |
|
571 case ECreateSession: |
|
572 RDebug::Print( _L("\nTEST PRINT: CreateSession" ) ); |
|
573 CreateSession(); |
|
574 break; |
|
575 case ELoadPlugin: |
|
576 RDebug::Print( _L("\nTEST PRINT: LoadPlugin" ) ); |
|
577 LoadPlugin(); |
|
578 break; |
|
579 case ECreateRtpStream: |
|
580 RDebug::Print( _L("\nTEST PRINT: CreateRtpStream" ) ); |
|
581 CreateRtpStream(); |
|
582 break; |
|
583 case ECreateRtcpStream: |
|
584 RDebug::Print( _L("\nTEST PRINT: CreateRtcpStream" ) ); |
|
585 CreateRtcpStream(); |
|
586 break; |
|
587 case EFetchRtpCandidate: |
|
588 RDebug::Print( _L("\nTEST PRINT: FetchRtpCandidate" ) ); |
|
589 FetchRtpCandidate(); |
|
590 break; |
|
591 case EFetchRtcpCandidate: |
|
592 RDebug::Print( _L("\nTEST PRINT: FetchRtcpCandidate" ) ); |
|
593 FetchRtcpCandidate(); |
|
594 break; |
|
595 case EFetchRtpCandidates: |
|
596 RDebug::Print( _L("\nTEST PRINT: FetchRtpCandidates" ) ); |
|
597 FetchRtpCandidates(); |
|
598 break; |
|
599 case EFetchRtcpCandidates: |
|
600 RDebug::Print( _L("\nTEST PRINT: FetchRtcpCandidates" ) ); |
|
601 FetchRtcpCandidates(); |
|
602 break; |
|
603 case EStoreLocalCandidates: |
|
604 RDebug::Print( _L("\nTEST PRINT: StoreLocalCandidates" ) ); |
|
605 error = iObserver.LocalCandidates( iLocalCandidates ); |
|
606 if ( error ) |
|
607 { |
|
608 __NATFWTESTCONSOLE_INT1( |
|
609 "CNatComTest::Notify; LocalCandidates error:", error ) |
|
610 iState = EError; |
|
611 } |
|
612 else |
|
613 { |
|
614 iState = iStateSequence.Next(); |
|
615 } |
|
616 iOnlyCandidates = EFalse; |
|
617 ActiveRequestCompleted( error ); |
|
618 break; |
|
619 |
|
620 case ESetIdentification: |
|
621 RDebug::Print( _L("\nTEST PRINT: SetIdentification" ) ); |
|
622 SetIdentification(); |
|
623 break; |
|
624 case ESetOperationMode: |
|
625 RDebug::Print( _L("\nTEST PRINT: SetOperationMode" ) ); |
|
626 SetOperationMode(); |
|
627 break; |
|
628 case EPause: |
|
629 RDebug::Print( _L("\nTEST PRINT: Pause" ) ); |
|
630 iState = iStateSequence.Next(); |
|
631 iObserver.DoPause( iStatus ); |
|
632 SetActive(); |
|
633 break; |
|
634 case EConnectivityChecks: |
|
635 RDebug::Print( _L("\nTEST PRINT: ConnectivityChecks" ) ); |
|
636 PerformConnectivityChecks(); |
|
637 break; |
|
638 case ECreateRtpWrapper: |
|
639 RDebug::Print( _L("\nTEST PRINT: CreateRtpWrapper" ) ); |
|
640 CreateRtpWrapper(); |
|
641 break; |
|
642 case ECreateRtcpWrapper: |
|
643 RDebug::Print( _L("\nTEST PRINT: CreateRtcpWrapper" ) ); |
|
644 CreateRtcpWrapper(); |
|
645 break; |
|
646 case EPrepareMccLink: |
|
647 RDebug::Print( _L("\nTEST PRINT: PrepareMccLink" ) ); |
|
648 if ( iRtpMediaWrapper && iRtcpMediaWrapper ) |
|
649 { |
|
650 PrepareMccLinkWithRtcp(); |
|
651 } |
|
652 else |
|
653 { |
|
654 PrepareMccLink(); |
|
655 } |
|
656 break; |
|
657 case ESetOutgoingAddr: |
|
658 RDebug::Print( _L("\nTEST PRINT: SetOutgoingAddr" ) ); |
|
659 iRtpMediaWrapper->OutgoingAddr( RtpAddr ); |
|
660 iSession->SetRemoteAddressL( iLinkId, RtpAddr ); |
|
661 if ( iRtcpMediaWrapper ) |
|
662 { |
|
663 iRtcpMediaWrapper->OutgoingAddr( RtcpAddr ); |
|
664 iSession->SetRemoteAddressL( iLinkId, RtpAddr, |
|
665 RtcpAddr.Port() ); |
|
666 } |
|
667 iState = iStateSequence.Next(); |
|
668 ActiveRequestCompleted( KErrNone ); |
|
669 break; |
|
670 |
|
671 case ECreateMediaUpStream: |
|
672 RDebug::Print( _L("\nTEST PRINT: CreateMediaUpStream" ) ); |
|
673 CreateMediaUpStream(); |
|
674 break; |
|
675 case ECreateMediaDownStream: |
|
676 RDebug::Print( _L("\nTEST PRINT: CreateMediaDownStream" ) ); |
|
677 CreateMediaDownStream(); |
|
678 break; |
|
679 |
|
680 case ESetWrapperIncomingAddr: |
|
681 RDebug::Print( _L("\nTEST PRINT: SetWrapperIncomingAddr" ) ); |
|
682 SetWrapperIncomingAddr(); |
|
683 break; |
|
684 |
|
685 case ESetRtpReceivingState: |
|
686 RDebug::Print( _L("\nTEST PRINT: SetRtpReceivingState" ) ); |
|
687 SetReceivingState( *iRtpMediaWrapper, iRtpStreamId, |
|
688 EStreamingStateActive ); |
|
689 break; |
|
690 |
|
691 case ESetRtpSendingState: |
|
692 RDebug::Print( _L("\nTEST PRINT: SetRtpSendingState" ) ); |
|
693 SetSendingState( *iRtpMediaWrapper, iRtpStreamId, |
|
694 EStreamingStateActive, iStateSequence.TestType(), EFalse ); |
|
695 break; |
|
696 |
|
697 case ESetRtcpReceivingState: |
|
698 RDebug::Print( _L("\nTEST PRINT: SetRtcpReceivingState" ) ); |
|
699 SetReceivingState( *iRtcpMediaWrapper, iRtcpStreamId, |
|
700 EStreamingStateActive ); |
|
701 break; |
|
702 |
|
703 case ESetRtcpSendingState: |
|
704 RDebug::Print( _L("\nTEST PRINT: SetRtcpSendingState" ) ); |
|
705 SetSendingState( *iRtcpMediaWrapper, iRtcpStreamId, |
|
706 EStreamingStateActive, iStateSequence.TestType(), ETrue ); |
|
707 break; |
|
708 |
|
709 case ESetRtpSendingStateIce: |
|
710 RDebug::Print( _L("\nTEST PRINT: SetRtpSendingStateICE" ) ); |
|
711 SetSendingState( *iRtpMediaWrapper, iRtpStreamId, |
|
712 EStreamingStateActive, iStateSequence.TestType(), EFalse ); |
|
713 break; |
|
714 |
|
715 case ESetRtcpSendingStateIce: |
|
716 RDebug::Print( _L("\nTEST PRINT: SetRtcpSendingState" ) ); |
|
717 SetSendingState( *iRtcpMediaWrapper, iRtcpStreamId, |
|
718 EStreamingStateActive, iStateSequence.TestType(), ETrue ); |
|
719 break; |
|
720 |
|
721 case EStartMediaDownStream: |
|
722 RDebug::Print( _L("\nTEST PRINT: StartMediaDownStream" ) ); |
|
723 StartMediaDownStream(); |
|
724 break; |
|
725 case EStartMediaUpStream: |
|
726 RDebug::Print( _L("\nTEST PRINT: StartMediaUpStream" ) ); |
|
727 StartMediaUpStream(); |
|
728 break; |
|
729 |
|
730 case ERunning: |
|
731 RDebug::Print( _L("\nTEST PRINT: Running" ) ); |
|
732 iObserver.Notify( MNatComTestObserver::ERunning, KErrNone ); |
|
733 break; |
|
734 |
|
735 case EPassiveRtpReceivingState: |
|
736 RDebug::Print( _L("\nTEST PRINT: EPassiveRtpReceivingState" ) ); |
|
737 SetReceivingState( *iRtpMediaWrapper, iRtpStreamId, |
|
738 EStreamingStatePassive ); |
|
739 break; |
|
740 |
|
741 case EPassiveRtpSendingState: |
|
742 RDebug::Print( _L("\nTEST PRINT: EPassiveRtpSendingState" ) ); |
|
743 SetSendingState( *iRtpMediaWrapper, iRtpStreamId, |
|
744 EStreamingStatePassive, iStateSequence.TestType(), EFalse ); |
|
745 break; |
|
746 |
|
747 case EPassiveRtcpReceivingState: |
|
748 RDebug::Print( _L("\nTEST PRINT: EPassiveRtcpReceivingState" ) ); |
|
749 SetReceivingState( *iRtcpMediaWrapper, iRtcpStreamId, |
|
750 EStreamingStatePassive ); |
|
751 break; |
|
752 |
|
753 case EPassiveRtcpSendingState: |
|
754 RDebug::Print( _L("\nTEST PRINT: EPassiveRtcpSendingState" ) ); |
|
755 SetSendingState( *iRtcpMediaWrapper, iRtcpStreamId, |
|
756 EStreamingStatePassive, iStateSequence.TestType(), ETrue ); |
|
757 break; |
|
758 |
|
759 case EPassiveRtpSendingStateIce: |
|
760 RDebug::Print( _L("\nTEST PRINT: EPassiveRtpSendingStateIce" ) ); |
|
761 SetSendingState( *iRtpMediaWrapper, iRtpStreamId, |
|
762 EStreamingStatePassive, iStateSequence.TestType(), EFalse ); |
|
763 break; |
|
764 |
|
765 case EPassiveRtcpSendingStateIce: |
|
766 RDebug::Print( _L("\nTEST PRINT: EPassiveRtcpSendingStateIce" ) ); |
|
767 SetSendingState( *iRtcpMediaWrapper, iRtcpStreamId, |
|
768 EStreamingStatePassive, iStateSequence.TestType(), ETrue ); |
|
769 break; |
|
770 |
|
771 case ETeardown: |
|
772 RDebug::Print( _L("\nTEST PRINT: Teardown" ) ); |
|
773 TeardownL(); |
|
774 break; |
|
775 case EReady: |
|
776 RDebug::Print( _L("\nTEST PRINT: Ready" ) ); |
|
777 iObserver.Notify( MNatComTestObserver::ETestEnd, iStatus.Int() ); |
|
778 break; |
|
779 default : |
|
780 break; |
|
781 } |
|
782 } |
|
783 |
|
784 // --------------------------------------------------------------------------- |
|
785 // from CActive |
|
786 // CNatComTest::DoCancel |
|
787 // --------------------------------------------------------------------------- |
|
788 // |
|
789 void CNatComTest::DoCancel() |
|
790 { |
|
791 } |
|
792 |
|
793 |
|
794 // --------------------------------------------------------------------------- |
|
795 // From class MNATFWConnectivityObserver |
|
796 // CNatComTest::EventOccured |
|
797 // --------------------------------------------------------------------------- |
|
798 // |
|
799 void CNatComTest::EventOccured( TUint aSessionId, TUint aStreamId, |
|
800 TNATFWConnectivityEvent aEvent, TInt aError, TAny* aEventData ) |
|
801 { |
|
802 RDebug::Print( _L( |
|
803 "TEST PRINT: CNatComTest::EventOccured - sessionId:%d streamId:%d Event:%d Error:%d\n" ), |
|
804 aSessionId, aStreamId, aEvent, aError ); |
|
805 |
|
806 TInt error = aError; |
|
807 |
|
808 if ( ESessionCreated == aEvent ) |
|
809 { |
|
810 iObserver.Notify( MNatComTestObserver::ESessionCreated, error ); |
|
811 iState = iStateSequence.Next(); |
|
812 ActiveRequestCompleted( error ); |
|
813 } |
|
814 else if ( EFetchingCompleted == aEvent ) |
|
815 { |
|
816 iState = iStateSequence.Next(); |
|
817 iObserver.Notify( MNatComTestObserver::EFetchingCompleted, error ); |
|
818 ActiveRequestCompleted( error ); |
|
819 } |
|
820 else if ( EConnChecksCompleted == aEvent ) |
|
821 { |
|
822 iObserver.Notify( MNatComTestObserver::EConnChecksCompleted, error ); |
|
823 if ( KErrNone == error ) |
|
824 { |
|
825 if( iStreamIds.Count() == iCandidatePairs.Count() ) |
|
826 { |
|
827 error = iObserver.CandidatePairs( iCandidatePairs ); |
|
828 iState = iStateSequence.Next(); |
|
829 } |
|
830 } |
|
831 ActiveRequestCompleted( error ); |
|
832 } |
|
833 else if ( EReceivingActivated == aEvent || ESendingActivated == aEvent ) |
|
834 { |
|
835 iState = iStateSequence.Next(); |
|
836 ActiveRequestCompleted( aError ); |
|
837 } |
|
838 else if ( EReceivingDeactivated == aEvent || ESendingDeactivated == aEvent ) |
|
839 { |
|
840 iState = iState = iTeardownSequence.Next(); |
|
841 ActiveRequestCompleted( aError ); |
|
842 } |
|
843 else if ( ELocalCandidateFound == aEvent ) |
|
844 { |
|
845 if ( EFetchRtpCandidate == iState ) |
|
846 { |
|
847 static_cast<CNATFWCandidate*>( aEventData )->SetComponentId( KRtpMediaComponentId ); |
|
848 } |
|
849 if ( EFetchRtcpCandidate == iState ) |
|
850 { |
|
851 static_cast<CNATFWCandidate*>( aEventData )->SetComponentId( KRtcpMediaComponentId ); |
|
852 } |
|
853 iLocalCandidates.Append( static_cast<CNATFWCandidate*>( aEventData ) ); |
|
854 iObserver.Notify( MNatComTestObserver::ELocalCandidateFound, KErrNone ); |
|
855 } |
|
856 else if ( ECandidatePairFound == aEvent ) |
|
857 { |
|
858 iObserver.Notify( MNatComTestObserver::ENewCandPairFound, KErrNone ); |
|
859 iCandidatePairs.Append( static_cast<CNATFWCandidatePair*>( aEventData ) ); |
|
860 } |
|
861 else if ( EGeneralError == aEvent ) |
|
862 { |
|
863 iObserver.Notify( MNatComTestObserver::ETestError, aError ); |
|
864 ActiveRequestCompleted( aError ); |
|
865 } |
|
866 else |
|
867 { |
|
868 __NATFWTESTCONSOLE_INT2( "CNatComTest::Notify; aEvent:", |
|
869 aEvent, " aError:", error ) |
|
870 } |
|
871 } |
|
872 |
|
873 |
|
874 |
|
875 // --------------------------------------------------------------------------- |
|
876 // CNatComTest::CreateSession |
|
877 // --------------------------------------------------------------------------- |
|
878 // |
|
879 void CNatComTest::CreateSession() |
|
880 { |
|
881 TRAPD( err, iSessionId = iNat->CreateSessionL( iIapId, *iDomain ) ); |
|
882 if ( err ) |
|
883 { |
|
884 __NATFWTESTCONSOLE_INT1( "CNatComTest::CreateSessio Leaves:", err ) |
|
885 iObserver.Notify( MNatComTestObserver::ESessionCreated, err ); |
|
886 iState = EError; |
|
887 ActiveRequestCompleted( err ); |
|
888 } |
|
889 else |
|
890 { |
|
891 iStatus = KRequestPending; |
|
892 SetActive(); |
|
893 } |
|
894 } |
|
895 |
|
896 // --------------------------------------------------------------------------- |
|
897 // CNatComTest::LoadPlugin |
|
898 // --------------------------------------------------------------------------- |
|
899 // |
|
900 void CNatComTest::LoadPlugin() |
|
901 { |
|
902 TInt loadedPluginInd( 0 ); |
|
903 |
|
904 TRAPD( err, iNat->LoadPluginL( iSessionId, *iPlugins, loadedPluginInd ) ); |
|
905 |
|
906 if ( err ) |
|
907 { |
|
908 __NATFWTESTCONSOLE_INT1( "CNatComTest::LoadPlugin Leaves:", err ) |
|
909 iState = EError; |
|
910 } |
|
911 else |
|
912 { |
|
913 iState = iStateSequence.Next(); |
|
914 } |
|
915 ActiveRequestCompleted( err ); |
|
916 } |
|
917 |
|
918 // --------------------------------------------------------------------------- |
|
919 // CNatComTest::CreateRtpStream |
|
920 // --------------------------------------------------------------------------- |
|
921 // |
|
922 void CNatComTest::CreateRtpStream() |
|
923 { |
|
924 iState = iStateSequence.Next(); |
|
925 TRAPD( err, iRtpStreamId = iNat->CreateStreamL( iSessionId, iProtocol, KQoS ) ); |
|
926 if ( err ) |
|
927 { |
|
928 iState = EError; |
|
929 __NATFWTESTCONSOLE_INT1( "CNatComTest::CreateStream Leaves:", err ) |
|
930 } |
|
931 iStreamIds.Append( iRtpStreamId ); |
|
932 iObserver.Notify( MNatComTestObserver::EStreamCreated, err ); |
|
933 ActiveRequestCompleted( err ); |
|
934 } |
|
935 |
|
936 // --------------------------------------------------------------------------- |
|
937 // CNatComTest::CreateRtcpStream |
|
938 // --------------------------------------------------------------------------- |
|
939 // |
|
940 void CNatComTest::CreateRtcpStream() |
|
941 { |
|
942 iState = iStateSequence.Next(); |
|
943 TRAPD( err, iRtcpStreamId = iNat->CreateStreamL( |
|
944 iSessionId, iProtocol, KQoS ) ); |
|
945 if ( err ) |
|
946 { |
|
947 iState = EError; |
|
948 __NATFWTESTCONSOLE_INT1( "CNatComTest::CreateStream Leaves:", err ) |
|
949 } |
|
950 iStreamIds.Append( iRtpStreamId ); |
|
951 iObserver.Notify( MNatComTestObserver::EStreamCreated, err ); |
|
952 ActiveRequestCompleted( err ); |
|
953 } |
|
954 |
|
955 // --------------------------------------------------------------------------- |
|
956 // CNatComTest::SetIdentification |
|
957 // --------------------------------------------------------------------------- |
|
958 // |
|
959 void CNatComTest::SetIdentification() |
|
960 { |
|
961 TInt count; |
|
962 TInt error = KErrNotFound; |
|
963 |
|
964 iState = iStateSequence.Next(); |
|
965 |
|
966 CNATFWCredentials* inboundIdentification = |
|
967 CNATFWCredentials::NewLC(); |
|
968 |
|
969 CNATFWCredentials* outboundIdentification = |
|
970 CNATFWCredentials::NewLC(); |
|
971 |
|
972 inboundIdentification->SetStreamCollectionId( KStreamCollectionId ); |
|
973 outboundIdentification->SetStreamCollectionId( KStreamCollectionId ); |
|
974 |
|
975 if ( iMode == EIceRoleControlling ) |
|
976 { |
|
977 outboundIdentification->SetDirection( CNATFWCredentials::EOutbound ); |
|
978 outboundIdentification->SetUsernameL( KMOUsername ); |
|
979 outboundIdentification->SetPasswordL( KMOUsername ); |
|
980 |
|
981 inboundIdentification->SetDirection( CNATFWCredentials::EInbound ); |
|
982 inboundIdentification->SetUsernameL( KMTUsername ); |
|
983 inboundIdentification->SetPasswordL( KMTUsername ); |
|
984 } |
|
985 else |
|
986 { |
|
987 outboundIdentification->SetDirection( CNATFWCredentials::EOutbound ); |
|
988 outboundIdentification->SetUsernameL( KMTUsername ); |
|
989 outboundIdentification->SetPasswordL( KMTUsername ); |
|
990 |
|
991 inboundIdentification->SetDirection( CNATFWCredentials::EInbound ); |
|
992 inboundIdentification->SetUsernameL( KMOUsername ); |
|
993 inboundIdentification->SetPasswordL( KMOUsername ); |
|
994 } |
|
995 |
|
996 count = iLocalCandidates.Count(); |
|
997 |
|
998 for ( TInt i( 0 ); i < count; i++ ) |
|
999 { |
|
1000 TRAP( error, iNat->SetCredentialsL( |
|
1001 *iLocalCandidates[i], *outboundIdentification ) ); |
|
1002 if ( error ) |
|
1003 { |
|
1004 iState = EError; |
|
1005 __NATFWTESTCONSOLE_INT1( "CNatComTest::SetIdentification Leaves:", error ) |
|
1006 } |
|
1007 else |
|
1008 { |
|
1009 TRAP( error, iNat->SetCredentialsL( |
|
1010 *iLocalCandidates[i], *inboundIdentification ) ); |
|
1011 if ( error ) |
|
1012 { |
|
1013 iState = EError; |
|
1014 __NATFWTESTCONSOLE_INT1( "CNatComTest::SetIdentification Leaves:", error ) |
|
1015 } |
|
1016 } |
|
1017 } |
|
1018 |
|
1019 |
|
1020 CleanupStack::PopAndDestroy( outboundIdentification ); |
|
1021 CleanupStack::PopAndDestroy( inboundIdentification ); |
|
1022 |
|
1023 iObserver.Notify( MNatComTestObserver::ESetIdentification, error ); |
|
1024 ActiveRequestCompleted( error ); |
|
1025 } |
|
1026 |
|
1027 // --------------------------------------------------------------------------- |
|
1028 // CNatComTest::FetchRTPCandidate |
|
1029 // --------------------------------------------------------------------------- |
|
1030 // |
|
1031 void CNatComTest::FetchRtpCandidate() |
|
1032 { |
|
1033 TRAPD( err, iNat->FetchCandidateL( |
|
1034 iSessionId, iRtpStreamId, KAfInet ) ); |
|
1035 if ( err ) |
|
1036 { |
|
1037 __NATFWTESTCONSOLE_INT1( "CNatComTest::FetchCandidate Leaves:", err ) |
|
1038 iObserver.Notify( MNatComTestObserver::EFetchingCompleted, err ); |
|
1039 iState = EError; |
|
1040 ActiveRequestCompleted( err ); |
|
1041 } |
|
1042 else |
|
1043 { |
|
1044 iStatus = KRequestPending; |
|
1045 SetActive(); |
|
1046 } |
|
1047 } |
|
1048 |
|
1049 // --------------------------------------------------------------------------- |
|
1050 // CNatComTest::FetchRTPCandidate |
|
1051 // --------------------------------------------------------------------------- |
|
1052 // |
|
1053 void CNatComTest::FetchRtcpCandidate() |
|
1054 { |
|
1055 TRAPD( err, iNat->FetchCandidateL( |
|
1056 iSessionId, iRtcpStreamId, KAfInet ) ); |
|
1057 if ( err ) |
|
1058 { |
|
1059 __NATFWTESTCONSOLE_INT1( "CNatComTest::FetchCandidate Leaves:", err ) |
|
1060 iObserver.Notify( MNatComTestObserver::EFetchingCompleted, err ); |
|
1061 iState = EError; |
|
1062 ActiveRequestCompleted( err ); |
|
1063 } |
|
1064 else |
|
1065 { |
|
1066 iStatus = KRequestPending; |
|
1067 SetActive(); |
|
1068 } |
|
1069 } |
|
1070 |
|
1071 // --------------------------------------------------------------------------- |
|
1072 // CNatComTest::FetchRTPCandidates |
|
1073 // --------------------------------------------------------------------------- |
|
1074 // |
|
1075 void CNatComTest::FetchRtpCandidates() |
|
1076 { |
|
1077 TRAPD( err, iNat->FetchCandidatesL( |
|
1078 iSessionId, iRtpStreamId, KStreamCollectionId, KRtpMediaComponentId, |
|
1079 KAfInet ) ); |
|
1080 if ( err ) |
|
1081 { |
|
1082 __NATFWTESTCONSOLE_INT1( "CNatComTest::FetchCandidates Leaves:", err ) |
|
1083 iObserver.Notify( MNatComTestObserver::EFetchingCompleted, err ); |
|
1084 iState = EError; |
|
1085 ActiveRequestCompleted( err ); |
|
1086 } |
|
1087 else |
|
1088 { |
|
1089 iStatus = KRequestPending; |
|
1090 SetActive(); |
|
1091 } |
|
1092 } |
|
1093 |
|
1094 // --------------------------------------------------------------------------- |
|
1095 // CNatComTest::FetchRTCPCandidates |
|
1096 // --------------------------------------------------------------------------- |
|
1097 // |
|
1098 void CNatComTest::FetchRtcpCandidates() |
|
1099 { |
|
1100 TRAPD( err, iNat->FetchCandidatesL( |
|
1101 iSessionId, iRtcpStreamId, KStreamCollectionId, KRtcpMediaComponentId, |
|
1102 KAfInet ) ); |
|
1103 if ( err ) |
|
1104 { |
|
1105 __NATFWTESTCONSOLE_INT1( "CNatComTest::FetchCandidates Leaves:", err ) |
|
1106 iObserver.Notify( MNatComTestObserver::EFetchingCompleted, err ); |
|
1107 iState = EError; |
|
1108 ActiveRequestCompleted( err ); |
|
1109 } |
|
1110 else |
|
1111 { |
|
1112 iStatus = KRequestPending; |
|
1113 SetActive(); |
|
1114 } |
|
1115 } |
|
1116 |
|
1117 // --------------------------------------------------------------------------- |
|
1118 // CNatComTest::SetOperationMode |
|
1119 // --------------------------------------------------------------------------- |
|
1120 // |
|
1121 void CNatComTest::SetOperationMode() |
|
1122 { |
|
1123 iState = iStateSequence.Next(); |
|
1124 TRAPD( err, iNat->SetRoleL( iSessionId, iMode ) ); |
|
1125 if ( err ) |
|
1126 { |
|
1127 iState = EError; |
|
1128 __NATFWTESTCONSOLE_INT1( "CNatComTest::SetOperationMode Leaves:", err ) |
|
1129 } |
|
1130 iObserver.Notify( MNatComTestObserver::ESetOperationMode, err ); |
|
1131 ActiveRequestCompleted( err ); |
|
1132 } |
|
1133 |
|
1134 // --------------------------------------------------------------------------- |
|
1135 // CNatComTest::PerformConnectivityChecks |
|
1136 // --------------------------------------------------------------------------- |
|
1137 // |
|
1138 void CNatComTest::PerformConnectivityChecks() |
|
1139 { |
|
1140 RPointerArray<CNATFWCandidate> remoteCandidates; |
|
1141 |
|
1142 TInt error = iObserver.RemoteCandidates( remoteCandidates ); |
|
1143 if ( error ) |
|
1144 { |
|
1145 __NATFWTESTCONSOLE_INT1( |
|
1146 "CNatComTest::PerformConnectivityChecks error in RemoteCandidates reading:", error ) |
|
1147 } |
|
1148 else |
|
1149 { |
|
1150 RPointerArray<CNATFWCandidate> targetCands; |
|
1151 |
|
1152 // RTP Stream |
|
1153 GetCandidatesAssosiatedToL( |
|
1154 KStreamCollectionId, |
|
1155 KRtpMediaComponentId, |
|
1156 remoteCandidates, |
|
1157 targetCands ); |
|
1158 SetToCandidatesL( iSessionId, iRtpStreamId, targetCands ); |
|
1159 targetCands.Reset(); |
|
1160 |
|
1161 // RTCP Stream |
|
1162 GetCandidatesAssosiatedToL( |
|
1163 KStreamCollectionId, |
|
1164 KRtcpMediaComponentId, |
|
1165 remoteCandidates, |
|
1166 targetCands ); |
|
1167 SetToCandidatesL( iSessionId, iRtcpStreamId, targetCands ); |
|
1168 targetCands.Close(); |
|
1169 |
|
1170 TRAP( error, iNat->PerformConnectivityChecksL( iSessionId, remoteCandidates ) ); |
|
1171 if ( error ) |
|
1172 { |
|
1173 __NATFWTESTCONSOLE_INT1( "CNatComTest::PerformConnectivityChecks Leaves:", error ) |
|
1174 } |
|
1175 } |
|
1176 |
|
1177 if ( error ) |
|
1178 { |
|
1179 iObserver.Notify( MNatComTestObserver::EConnChecksCompleted, error ); |
|
1180 iState = EError; |
|
1181 ActiveRequestCompleted( error ); |
|
1182 } |
|
1183 else |
|
1184 { |
|
1185 iStatus = KRequestPending; |
|
1186 SetActive(); |
|
1187 } |
|
1188 remoteCandidates.ResetAndDestroy(); |
|
1189 } |
|
1190 |
|
1191 // --------------------------------------------------------------------------- |
|
1192 // CNatComTest::CreateRTPWrapper |
|
1193 // --------------------------------------------------------------------------- |
|
1194 // |
|
1195 void CNatComTest::CreateRtpWrapper() |
|
1196 { |
|
1197 TRAPD( error, iRtpMediaWrapper = &iNat->CreateWrapperL( iSessionId, iRtpStreamId ) ); |
|
1198 if ( error ) |
|
1199 { |
|
1200 __NATFWTESTCONSOLE_INT1( "CNatComTest::CreateWrapper CreateWrapper error", error ) |
|
1201 } |
|
1202 else |
|
1203 { |
|
1204 iState = iStateSequence.Next(); |
|
1205 } |
|
1206 ActiveRequestCompleted( error ); |
|
1207 } |
|
1208 |
|
1209 // --------------------------------------------------------------------------- |
|
1210 // CNatComTest::CreateRTCPWrapper |
|
1211 // --------------------------------------------------------------------------- |
|
1212 // |
|
1213 void CNatComTest::CreateRtcpWrapper() |
|
1214 { |
|
1215 TRAPD( error, iRtcpMediaWrapper = &iNat->CreateWrapperL( iSessionId, iRtcpStreamId ) ); |
|
1216 if ( error ) |
|
1217 { |
|
1218 __NATFWTESTCONSOLE_INT1( "CNatComTest::CreateWrapper CreateWrapper error", error ) |
|
1219 } |
|
1220 else |
|
1221 { |
|
1222 iState = iStateSequence.Next(); |
|
1223 } |
|
1224 ActiveRequestCompleted( error ); |
|
1225 } |
|
1226 |
|
1227 // --------------------------------------------------------------------------- |
|
1228 // CNatComTest::PrepareMccLink |
|
1229 // --------------------------------------------------------------------------- |
|
1230 // |
|
1231 void CNatComTest::PrepareMccLink() |
|
1232 { |
|
1233 TInetAddr addr; |
|
1234 iRtpMediaWrapper->OutgoingAddr( addr ); |
|
1235 |
|
1236 TRAPD( error, iSession->CreateLinkL( iLinkId, KMccLinkGeneral, addr, iStatus ) ); |
|
1237 if ( error ) |
|
1238 { |
|
1239 __NATFWTESTCONSOLE_INT1( |
|
1240 "CNatComTest::PrepareMccLink error in CreateLinkL ", error ); |
|
1241 |
|
1242 iState = EError; |
|
1243 ActiveRequestCompleted( error ); |
|
1244 } |
|
1245 else |
|
1246 { |
|
1247 iState = iStateSequence.Next(); |
|
1248 SetActive(); |
|
1249 } |
|
1250 } |
|
1251 |
|
1252 // --------------------------------------------------------------------------- |
|
1253 // CNatComTest::PrepareMccLinkWithRtcp |
|
1254 // --------------------------------------------------------------------------- |
|
1255 // |
|
1256 void CNatComTest::PrepareMccLinkWithRtcp() |
|
1257 { |
|
1258 TInetAddr RtpAddr; |
|
1259 TInetAddr RtcpAddr; |
|
1260 |
|
1261 iRtpMediaWrapper->OutgoingAddr( RtpAddr ); |
|
1262 iRtcpMediaWrapper->OutgoingAddr( RtcpAddr ); |
|
1263 |
|
1264 TRAPD( error, iSession->CreateLinkL( iLinkId, KMccLinkGeneral, RtpAddr, |
|
1265 RtcpAddr.Port(), iStatus ) ); |
|
1266 if ( error ) |
|
1267 { |
|
1268 __NATFWTESTCONSOLE_INT1( |
|
1269 "CNatComTest::PrepareMccLinkWithRtcp error in CreateLinkL ", error ); |
|
1270 |
|
1271 iState = EError; |
|
1272 ActiveRequestCompleted( error ); |
|
1273 } |
|
1274 else |
|
1275 { |
|
1276 iState = iStateSequence.Next(); |
|
1277 SetActive(); |
|
1278 } |
|
1279 } |
|
1280 |
|
1281 // --------------------------------------------------------------------------- |
|
1282 // CNatComTest::SetWrapperIncomingAddr |
|
1283 // --------------------------------------------------------------------------- |
|
1284 // |
|
1285 void CNatComTest::SetWrapperIncomingAddr() |
|
1286 { |
|
1287 TInetAddr addr = iSession->NetSettings().iLocalAddress; |
|
1288 |
|
1289 if ( iRtpMediaWrapper && iRtcpMediaWrapper ) |
|
1290 { |
|
1291 iRtpMediaWrapper->SetIncomingAddrL( addr ); |
|
1292 |
|
1293 addr.SetPort( iSession->NetSettings().iLocalRtcpPort ); |
|
1294 iRtcpMediaWrapper->SetIncomingAddrL( addr ); |
|
1295 } |
|
1296 else |
|
1297 { |
|
1298 iRtpMediaWrapper->SetIncomingAddrL( addr ); |
|
1299 } |
|
1300 iState = iStateSequence.Next(); |
|
1301 ActiveRequestCompleted( KErrNone ); |
|
1302 } |
|
1303 |
|
1304 // --------------------------------------------------------------------------- |
|
1305 // CNatComTest::SetReceivingState |
|
1306 // --------------------------------------------------------------------------- |
|
1307 // |
|
1308 void CNatComTest::SetReceivingState( MNATFWSocketMediaConnWrapper& aWrapper, |
|
1309 TUint aStreamId, TNATFWStreamingState aStreamingState ) |
|
1310 { |
|
1311 // natfw <- rtp |
|
1312 TRAPD( error, aWrapper.SetReceivingStateL( aStreamingState ) ); |
|
1313 if ( error ) |
|
1314 { |
|
1315 __NATFWTESTCONSOLE_INT1( |
|
1316 "CNatComTest::SetReceivingState Wrapper Leave: ", error ) |
|
1317 if ( EStreamingStateActive == aStreamingState ) |
|
1318 { |
|
1319 iState = EError; |
|
1320 ActiveRequestCompleted( error ); |
|
1321 return; |
|
1322 } |
|
1323 } |
|
1324 // natfw <- peer |
|
1325 error = SetReceivingStatus( aStreamId, aStreamingState ); |
|
1326 if( error ) |
|
1327 { |
|
1328 if ( EStreamingStatePassive == aStreamingState ) |
|
1329 { |
|
1330 iState = iTeardownSequence.Next(); |
|
1331 } |
|
1332 else |
|
1333 { |
|
1334 iState = EError; |
|
1335 } |
|
1336 ActiveRequestCompleted( error ); |
|
1337 } |
|
1338 else |
|
1339 { |
|
1340 iStatus = KRequestPending; |
|
1341 SetActive(); |
|
1342 } |
|
1343 } |
|
1344 |
|
1345 // --------------------------------------------------------------------------- |
|
1346 // CNatComTest::SetSendingState |
|
1347 // --------------------------------------------------------------------------- |
|
1348 // |
|
1349 void CNatComTest::SetSendingState( MNATFWSocketMediaConnWrapper& aWrapper, |
|
1350 TUint aStreamId, TNATFWStreamingState aStreamingState, |
|
1351 TInt aTestType, TBool aRtcp ) |
|
1352 { |
|
1353 RPointerArray<CNATFWCandidate> remoteCandidates; |
|
1354 RPointerArray<CNATFWCandidate> targetCandidates; |
|
1355 TInetAddr destAddress; |
|
1356 |
|
1357 // natfw -> rtp |
|
1358 TRAPD( error, aWrapper.SetSendingStateL( aStreamingState ) ); |
|
1359 if ( error ) |
|
1360 { |
|
1361 __NATFWTESTCONSOLE_INT1( |
|
1362 "CNatComTest::SetSendingState Wrapper Leave: ", error ) |
|
1363 if ( EStreamingStateActive == aStreamingState ) |
|
1364 { |
|
1365 iState = EError; |
|
1366 ActiveRequestCompleted( error ); |
|
1367 return; |
|
1368 } |
|
1369 } |
|
1370 |
|
1371 // natfw -> peer |
|
1372 if ( EIceComTest == aTestType ) |
|
1373 { |
|
1374 TRAP( error, destAddress = RemoteCandidateAddrByStreamIdL( |
|
1375 aStreamId ) ); |
|
1376 if ( error ) |
|
1377 { |
|
1378 __NATFWTESTCONSOLE_INT1( |
|
1379 "RemoteCandidates reading error:", error ) |
|
1380 if ( EStreamingStatePassive == aStreamingState ) |
|
1381 { |
|
1382 iState = iTeardownSequence.Next(); |
|
1383 } |
|
1384 else |
|
1385 { |
|
1386 iState = EError; |
|
1387 } |
|
1388 ActiveRequestCompleted( error ); |
|
1389 return; |
|
1390 } |
|
1391 } |
|
1392 else |
|
1393 { |
|
1394 error = iObserver.RemoteCandidates( remoteCandidates ); |
|
1395 if ( error ) |
|
1396 { |
|
1397 __NATFWTESTCONSOLE_INT1( |
|
1398 "CNatComTest::SetSendingState -RemoteCandidates error:", error ) |
|
1399 if ( EStreamingStatePassive == aStreamingState ) |
|
1400 { |
|
1401 iState = iTeardownSequence.Next(); |
|
1402 } |
|
1403 else |
|
1404 { |
|
1405 iState = EError; |
|
1406 } |
|
1407 ActiveRequestCompleted( error ); |
|
1408 remoteCandidates.ResetAndDestroy(); |
|
1409 targetCandidates.Close(); |
|
1410 return; |
|
1411 } |
|
1412 if ( aRtcp ) |
|
1413 { |
|
1414 GetCandidatesAssosiatedToL( KRtcpMediaComponentId, |
|
1415 remoteCandidates, targetCandidates ); |
|
1416 } |
|
1417 else |
|
1418 { |
|
1419 GetCandidatesAssosiatedToL( KRtpMediaComponentId, |
|
1420 remoteCandidates, targetCandidates ); |
|
1421 } |
|
1422 destAddress = targetCandidates[0]->TransportAddr(); |
|
1423 } |
|
1424 |
|
1425 error = SetSendingStatus( aStreamId, aStreamingState, destAddress ); |
|
1426 if ( error ) |
|
1427 { |
|
1428 if ( EStreamingStatePassive == aStreamingState ) |
|
1429 { |
|
1430 iState = iTeardownSequence.Next(); |
|
1431 } |
|
1432 else |
|
1433 { |
|
1434 iState = EError; |
|
1435 } |
|
1436 ActiveRequestCompleted( error ); |
|
1437 } |
|
1438 else |
|
1439 { |
|
1440 iStatus = KRequestPending; |
|
1441 SetActive(); |
|
1442 } |
|
1443 remoteCandidates.ResetAndDestroy(); |
|
1444 targetCandidates.Close(); |
|
1445 } |
|
1446 |
|
1447 // --------------------------------------------------------------------------- |
|
1448 // CNatComTest::CreateMediaUpStream |
|
1449 // --------------------------------------------------------------------------- |
|
1450 // |
|
1451 void CNatComTest::CreateMediaUpStream() |
|
1452 { |
|
1453 TRAPD( error, iSession->CreateMediaStreamL( iUpStreamId, iLinkId, |
|
1454 EUpStream, iStatus ) ); |
|
1455 if ( error ) |
|
1456 { |
|
1457 __NATFWTESTCONSOLE_INT1( |
|
1458 "CNatComTest::CreateMediaUpStream error in Creation ", |
|
1459 error ); |
|
1460 |
|
1461 iState = EError; |
|
1462 ActiveRequestCompleted( error ); |
|
1463 } |
|
1464 else |
|
1465 { |
|
1466 iState = iStateSequence.Next(); |
|
1467 SetActive(); |
|
1468 } |
|
1469 } |
|
1470 |
|
1471 // --------------------------------------------------------------------------- |
|
1472 // CNatComTest::CreateMediaDownStream |
|
1473 // --------------------------------------------------------------------------- |
|
1474 // |
|
1475 void CNatComTest::CreateMediaDownStream() |
|
1476 { |
|
1477 TRAPD( error, iSession->CreateMediaStreamL( iDownStreamId, iLinkId, |
|
1478 EDownStream, iStatus ) ); |
|
1479 if ( error ) |
|
1480 { |
|
1481 __NATFWTESTCONSOLE_INT1( |
|
1482 "CNatComTest::CreateMediaDownStream error in Creation ", |
|
1483 error ); |
|
1484 |
|
1485 iState = EError; |
|
1486 ActiveRequestCompleted( error ); |
|
1487 } |
|
1488 else |
|
1489 { |
|
1490 iState = iStateSequence.Next(); |
|
1491 SetActive(); |
|
1492 } |
|
1493 } |
|
1494 |
|
1495 // --------------------------------------------------------------------------- |
|
1496 // CNatComTest::StartMediaDownStream |
|
1497 // --------------------------------------------------------------------------- |
|
1498 // |
|
1499 void CNatComTest::StartMediaDownStream() |
|
1500 { |
|
1501 TRAPD( error, iSession->StartStreamL( iDownStreamId, iStatus ) ); |
|
1502 if( error ) |
|
1503 { |
|
1504 __NATFWTESTCONSOLE_INT1( |
|
1505 "CNatComTest::StartMediaDownStream error in StartStreamL", error ); |
|
1506 |
|
1507 iState = EError; |
|
1508 ActiveRequestCompleted( error ); |
|
1509 } |
|
1510 else |
|
1511 { |
|
1512 iState = iStateSequence.Next(); |
|
1513 SetActive(); |
|
1514 } |
|
1515 } |
|
1516 |
|
1517 // --------------------------------------------------------------------------- |
|
1518 // CNatComTest::StartMediaUpStream |
|
1519 // --------------------------------------------------------------------------- |
|
1520 // |
|
1521 void CNatComTest::StartMediaUpStream() |
|
1522 { |
|
1523 TRAPD( error, iSession->StartStreamL( iUpStreamId, iStatus ) ); |
|
1524 if( error ) |
|
1525 { |
|
1526 __NATFWTESTCONSOLE_INT1( |
|
1527 "CNatComTest::StartMediaUpStream error in StartStreamL", error ); |
|
1528 |
|
1529 iState = EError; |
|
1530 ActiveRequestCompleted( error ); |
|
1531 } |
|
1532 else |
|
1533 { |
|
1534 iState = iStateSequence.Next(); |
|
1535 SetActive(); |
|
1536 } |
|
1537 } |
|
1538 |
|
1539 |
|
1540 // --------------------------------------------------------------------------- |
|
1541 // CNatComTest::SetRtpReceivingStatus |
|
1542 // --------------------------------------------------------------------------- |
|
1543 // |
|
1544 TInt CNatComTest::SetReceivingStatus( TUint aStreamId, |
|
1545 TNATFWStreamingState aState ) |
|
1546 { |
|
1547 TInt error; |
|
1548 switch( iStateSequence.TestType() ) |
|
1549 { |
|
1550 case ETurnComTest: |
|
1551 case EStunComTest: |
|
1552 TRAP( error, iNat->SetReceivingStateL( |
|
1553 LocalCandidateByStreamIdL( aStreamId ), aState ) ); |
|
1554 break; |
|
1555 case EIceComTest: |
|
1556 TRAP( error, iNat->SetReceivingStateL( |
|
1557 IceLocalCandidateByStreamIdL( aStreamId ), aState ) ); |
|
1558 break; |
|
1559 } |
|
1560 if ( error ) |
|
1561 { |
|
1562 __NATFWTESTCONSOLE_INT1( |
|
1563 "CNatComTest::SetReceivingStatus error ", error ); |
|
1564 } |
|
1565 return error; |
|
1566 } |
|
1567 |
|
1568 |
|
1569 // --------------------------------------------------------------------------- |
|
1570 // CNatComTest::SetRtpSendingStatus |
|
1571 // --------------------------------------------------------------------------- |
|
1572 // |
|
1573 TInt CNatComTest::SetSendingStatus( TUint aStreamId, |
|
1574 TNATFWStreamingState aState, const TInetAddr& aDestAddr ) |
|
1575 { |
|
1576 TInt error; |
|
1577 switch( iStateSequence.TestType() ) |
|
1578 { |
|
1579 case ETurnComTest: |
|
1580 case EStunComTest: |
|
1581 TRAP( error, iNat->SetSendingStateL( |
|
1582 LocalCandidateByStreamIdL( aStreamId ), aState, aDestAddr ) ); |
|
1583 break; |
|
1584 |
|
1585 case EIceComTest: |
|
1586 TRAP( error, iNat->SetSendingStateL( |
|
1587 IceLocalCandidateByStreamIdL( aStreamId ), aState, aDestAddr ) ); |
|
1588 break; |
|
1589 } |
|
1590 |
|
1591 if ( KErrNone != error ) |
|
1592 { |
|
1593 __NATFWTESTCONSOLE_INT1( |
|
1594 "CNatComTest::SetSendingStatus error ", error ); |
|
1595 } |
|
1596 return error; |
|
1597 } |
|
1598 |
|
1599 |
|
1600 // --------------------------------------------------------------------------- |
|
1601 // CNatComTest::RemoteCandidateAddrByStreamIdL |
|
1602 // --------------------------------------------------------------------------- |
|
1603 // |
|
1604 const TInetAddr CNatComTest::RemoteCandidateAddrByStreamIdL( TUint aStreamId ) |
|
1605 { |
|
1606 __NATFWTESTCONSOLE_INT1( "CNatComTest::RemoteCandidateAddrByStreamIdL ", |
|
1607 aStreamId ) |
|
1608 TInt count = iCandidatePairs.Count(); |
|
1609 for ( TInt i( 0 ); i < count; ++i ) |
|
1610 { |
|
1611 if ( iCandidatePairs[ i ]->RemoteCandidate().StreamId() == aStreamId ) |
|
1612 { |
|
1613 return iCandidatePairs[ i ]->RemoteCandidate().TransportAddr(); |
|
1614 } |
|
1615 } |
|
1616 __NATFWTESTCONSOLE( "RemoteCandidate not found" ) |
|
1617 User::Leave( KErrNotFound ); |
|
1618 return NULL; |
|
1619 } |
|
1620 |
|
1621 // --------------------------------------------------------------------------- |
|
1622 // CNatComTest::GetCandidatesAssosiatedToL |
|
1623 // --------------------------------------------------------------------------- |
|
1624 // |
|
1625 void CNatComTest::GetCandidatesAssosiatedToL( |
|
1626 TInt aStreamCollectionId, |
|
1627 TInt aComponentId, |
|
1628 const RPointerArray<CNATFWCandidate>& aSource, |
|
1629 RPointerArray<CNATFWCandidate>& aTarget ) |
|
1630 { |
|
1631 TInt count = aSource.Count(); |
|
1632 for ( TInt i( 0 ); i < count; ++i ) |
|
1633 { |
|
1634 if ( aSource[i]->StreamCollectionId() == aStreamCollectionId && |
|
1635 aSource[i]->ComponentId() == aComponentId ) |
|
1636 { |
|
1637 aTarget.AppendL( aSource[i] ); |
|
1638 } |
|
1639 } |
|
1640 } |
|
1641 |
|
1642 // --------------------------------------------------------------------------- |
|
1643 // CNatComTest::GetCandidatesAssosiatedToL |
|
1644 // --------------------------------------------------------------------------- |
|
1645 // |
|
1646 void CNatComTest::GetCandidatesAssosiatedToL( |
|
1647 TInt aMediaComponentId, |
|
1648 const RPointerArray<CNATFWCandidate>& aSource, |
|
1649 RPointerArray<CNATFWCandidate>& aTarget ) |
|
1650 { |
|
1651 TInt count = aSource.Count(); |
|
1652 for ( TInt i( 0 ); i < count; ++i ) |
|
1653 { |
|
1654 if ( aSource[i]->ComponentId() == aMediaComponentId ) |
|
1655 { |
|
1656 aTarget.AppendL( aSource[i] ); |
|
1657 } |
|
1658 } |
|
1659 } |
|
1660 |
|
1661 // -------------------------------------------------------------------------- |
|
1662 // CNatComTest::IceLocalCandidateByStreamIdL |
|
1663 // -------------------------------------------------------------------------- |
|
1664 // |
|
1665 const CNATFWCandidate& CNatComTest::IceLocalCandidateByStreamIdL( TUint aStreamId ) |
|
1666 { |
|
1667 __NATFWTESTCONSOLE_INT1( "CNatComTest::IceLocalCandidateByStreamIdL ", |
|
1668 aStreamId ) |
|
1669 TInt count = iCandidatePairs.Count(); |
|
1670 for ( TInt i( 0 ); i < count; ++i ) |
|
1671 { |
|
1672 if ( iCandidatePairs[ i ]-> |
|
1673 LocalCandidate().StreamId() == aStreamId ) |
|
1674 { |
|
1675 return iCandidatePairs[ i ]->LocalCandidate(); |
|
1676 } |
|
1677 } |
|
1678 __NATFWTESTCONSOLE( "LocalCandidate not found" ) |
|
1679 User::Leave( KErrNotFound ); |
|
1680 } |
|
1681 |
|
1682 // -------------------------------------------------------------------------- |
|
1683 // CNatComTest::LocalCandidateByStreamIdL |
|
1684 // -------------------------------------------------------------------------- |
|
1685 // |
|
1686 const CNATFWCandidate& CNatComTest::LocalCandidateByStreamIdL( TUint aStreamId ) |
|
1687 { |
|
1688 __NATFWTESTCONSOLE_INT1( "CNatComTest::LocalCandidateByStreamIdL ", |
|
1689 aStreamId ) |
|
1690 TInt count = iLocalCandidates.Count(); |
|
1691 for ( TInt i( 0 ); i < count; ++i ) |
|
1692 { |
|
1693 if ( iLocalCandidates[i]->StreamId() == aStreamId ) |
|
1694 { |
|
1695 return *iLocalCandidates[i]; |
|
1696 } |
|
1697 } |
|
1698 __NATFWTESTCONSOLE( "LocalCandidate not found" ) |
|
1699 User::Leave( KErrNotFound ); |
|
1700 } |
|
1701 |
|
1702 |
|
1703 // --------------------------------------------------------------------------- |
|
1704 // CNatComTest::SetToCandidatesL |
|
1705 // --------------------------------------------------------------------------- |
|
1706 // |
|
1707 void CNatComTest::SetToCandidatesL( TUint aSessionId, TInt aStreamId, |
|
1708 RPointerArray<CNATFWCandidate>& aTarget ) |
|
1709 { |
|
1710 TInt count = aTarget.Count(); |
|
1711 for ( TInt i( 0 ); i < count; ++i ) |
|
1712 { |
|
1713 aTarget[i]->SetSessionId( aSessionId ); |
|
1714 aTarget[i]->SetStreamId( aStreamId ); |
|
1715 } |
|
1716 } |
|
1717 |
|
1718 // --------------------------------------------------------------------------- |
|
1719 // CNatComTest::ActiveRequestCompleted |
|
1720 // --------------------------------------------------------------------------- |
|
1721 // |
|
1722 void CNatComTest::ActiveRequestCompleted( TInt aError ) |
|
1723 { |
|
1724 __NATFWTESTCONSOLE( "CNatComTest::ActiveRequestCompleted" ) |
|
1725 TRequestStatus* status = &iStatus; |
|
1726 if ( !IsActive() ) |
|
1727 { |
|
1728 iStatus = KRequestPending; |
|
1729 SetActive(); |
|
1730 } |
|
1731 User::RequestComplete( status, aError ); |
|
1732 } |