|
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 #ifndef NATCOMTEST_H |
|
22 #define NATCOMTEST_H |
|
23 |
|
24 #include <e32base.h> |
|
25 |
|
26 #include "natfwconnectivityapidefs.h" |
|
27 #include "mnatfwconnectivityobserver.h" |
|
28 #include "natcomteststate.h" |
|
29 |
|
30 class CNATFWConnectivityApi; |
|
31 class MNatComTestObserver; |
|
32 class CNATFWCredentials; |
|
33 class CNATFWCandidatePair; |
|
34 class CNATFWCandidate; |
|
35 class CConsoleBase; |
|
36 class CMccMediaStream; |
|
37 class CMccLink; |
|
38 class CMccSession; |
|
39 class MNATFWSocketMediaConnWrapper; |
|
40 class TInetAddr; |
|
41 class CDesC8Array; |
|
42 |
|
43 enum TComTestType |
|
44 { |
|
45 EIceComTest = 0, |
|
46 EStunComTest, |
|
47 ETurnComTest |
|
48 }; |
|
49 |
|
50 |
|
51 class CNatComTest : |
|
52 public CActive, |
|
53 public MNATFWConnectivityObserver |
|
54 { |
|
55 public: |
|
56 |
|
57 static CNatComTest* NewL( const TDesC8& aDomain, TUint32 aIapId, |
|
58 MNatComTestObserver& aObserver ); |
|
59 |
|
60 static CNatComTest* NewLC( const TDesC8& aDomain, TUint32 aIapId, |
|
61 MNatComTestObserver& aObserver ); |
|
62 |
|
63 virtual ~CNatComTest(); |
|
64 |
|
65 TInt StartComTest( TUint aProtocol, TComTestType aTestType, |
|
66 TBool aUseRtcp ); |
|
67 |
|
68 TInt OnlyFetchCandidates( TUint aProtocol ); |
|
69 |
|
70 TInt StartUsingIce( TUint aProtocol, |
|
71 TNATFWIceRole aRole, TBool aUseRtcp = EFalse ); |
|
72 |
|
73 TInt StoreLocalCondidates( TUint aProtocol, TBool aUseRtcp = EFalse ); |
|
74 |
|
75 TInt StoreLocalCandidate( TUint aProtocol, |
|
76 TComTestType aTestType, TBool aUseRtcp ); |
|
77 |
|
78 void StopL(); |
|
79 |
|
80 protected: |
|
81 |
|
82 TInt Start( TUint aProtocol, TNATFWIceRole aRole ); |
|
83 |
|
84 // from CActive |
|
85 |
|
86 void RunL(); |
|
87 |
|
88 void DoCancel(); |
|
89 |
|
90 // from base class MNATFWConnectivityObserver |
|
91 |
|
92 void EventOccured( TUint aSessionId, TUint aStreamId, |
|
93 TNATFWConnectivityEvent aEvent, TInt aError, TAny* aEventData ); |
|
94 |
|
95 private: |
|
96 |
|
97 CNatComTest( TUint32 aIapId, MNatComTestObserver& aObserver ); |
|
98 |
|
99 void ConstructL( const TDesC8& aDomain ); |
|
100 |
|
101 void ActiveRequestCompleted( TInt aError ); |
|
102 |
|
103 const TInetAddr RemoteCandidateAddrByStreamIdL( TUint aStreamId ); |
|
104 |
|
105 void GetCandidatesAssosiatedToL( TInt aStreamCollectionId, |
|
106 TInt aComponentId, const RPointerArray<CNATFWCandidate>& aSource, |
|
107 RPointerArray<CNATFWCandidate>& aTarget ); |
|
108 |
|
109 void GetCandidatesAssosiatedToL( TInt aMediaComponentId, |
|
110 const RPointerArray<CNATFWCandidate>& aSource, |
|
111 RPointerArray<CNATFWCandidate>& aTarget ); |
|
112 |
|
113 const CNATFWCandidate& IceLocalCandidateByStreamIdL( TUint aStreamId ); |
|
114 |
|
115 const CNATFWCandidate& LocalCandidateByStreamIdL( TUint aStreamId ); |
|
116 |
|
117 void SetToCandidatesL( TUint aSessionId, TInt aStreamId, |
|
118 RPointerArray<CNATFWCandidate>& aTarget ); |
|
119 |
|
120 void SetTeardownSequence( TInt aTestType, TBool aUseRtcp ); |
|
121 |
|
122 |
|
123 void CreateSession(); |
|
124 void LoadPlugin(); |
|
125 void CreateRtpStream(); |
|
126 void CreateRtcpStream(); |
|
127 void SetIdentification(); |
|
128 void FetchRtpCandidates(); |
|
129 void FetchRtcpCandidates(); |
|
130 void FetchRtpCandidate(); |
|
131 void FetchRtcpCandidate(); |
|
132 void SetOperationMode(); |
|
133 void PerformConnectivityChecks(); |
|
134 void CreateRtpWrapper(); |
|
135 void CreateRtcpWrapper(); |
|
136 void PrepareMccLink(); |
|
137 void PrepareMccLinkWithRtcp(); |
|
138 void SetWrapperIncomingAddr(); |
|
139 void SetReceivingState( MNATFWSocketMediaConnWrapper& aWrapper, |
|
140 TUint aStreamId, TNATFWStreamingState aStreamingState ); |
|
141 void SetSendingState( MNATFWSocketMediaConnWrapper& aWrapper, |
|
142 TUint aStreamId, TNATFWStreamingState aStreamingState, |
|
143 TInt aTestType, TBool aRtcp ); |
|
144 void CreateMediaUpStream(); |
|
145 void CreateMediaDownStream(); |
|
146 void StartMediaUpStream(); |
|
147 void StartMediaDownStream(); |
|
148 TInt SetSendingStatus( TUint aStreamId, |
|
149 TNATFWStreamingState aState, const TInetAddr& aDestAddr ); |
|
150 TInt SetReceivingStatus( TUint aStreamId, TNATFWStreamingState aState ); |
|
151 void TeardownL(); |
|
152 |
|
153 private: // data |
|
154 |
|
155 TUint32 iIapId; |
|
156 MNatComTestObserver& iObserver; |
|
157 TUint iProtocol; |
|
158 CNATFWConnectivityApi* iNat; |
|
159 HBufC8* iDomain; |
|
160 TUint iSessionId; |
|
161 TUint iRtpStreamId; |
|
162 TUint iRtcpStreamId; |
|
163 RPointerArray<CNATFWCandidate> iLocalCandidates; |
|
164 RPointerArray<CNATFWCandidatePair> iCandidatePairs; |
|
165 TNATFWIceRole iMode; |
|
166 CConsoleBase* iConsole; |
|
167 TBool iOnlyCandidates; |
|
168 |
|
169 CMccSession* iSession; |
|
170 TInt32 iLinkId; |
|
171 TInt32 iUpStreamId; |
|
172 TInt32 iDownStreamId; |
|
173 |
|
174 TNatComState iState; |
|
175 TNatComTestState iStateSequence; |
|
176 TNatComTestState iTeardownSequence; |
|
177 |
|
178 MNATFWSocketMediaConnWrapper* iRtpMediaWrapper; |
|
179 MNATFWSocketMediaConnWrapper* iRtcpMediaWrapper; |
|
180 |
|
181 RArray<TInt> iStreamIds; |
|
182 CDesC8Array* iPlugins; |
|
183 }; |
|
184 #endif // NATCOMTEST_H |