|
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: |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 |
|
21 #ifndef C_NATFWCONNECTIONHANDLER_H |
|
22 #define C_NATFWCONNECTIONHANDLER_H |
|
23 |
|
24 #include <e32base.h> |
|
25 #include "natfwconnectivityapidefs.h" |
|
26 |
|
27 class TInetAddr; |
|
28 class CNATFWPluginApi; |
|
29 class MNcmConnectionMultiplexer; |
|
30 class MNATFWPluginObserver; |
|
31 class CNATFWCandidate; |
|
32 class CNATFWCandidatePair; |
|
33 class RTimer; |
|
34 |
|
35 /** |
|
36 * Implements NAT Plug-in interface |
|
37 * |
|
38 * The client uses this interface to send STUN requests. Forwards |
|
39 * client requests to STUN Connection Handler. |
|
40 * |
|
41 * @lib stunplugin.lib |
|
42 * @since S60 v3.2 |
|
43 */ |
|
44 class CNATFWConnectionHandler : public CActive |
|
45 { |
|
46 |
|
47 public: |
|
48 |
|
49 /** |
|
50 * Creates a new instance of NAT FW Plug-in class. |
|
51 * |
|
52 * @since S60 v3.2 |
|
53 * @param aInitParams Initial parameters that will be given to |
|
54 * STUN Connection Handler class. |
|
55 * @return A new instance, ownership is transferred. |
|
56 */ |
|
57 static CNATFWConnectionHandler* NewL( MNATFWPluginObserver* aPluginObserver, |
|
58 CNATFWPluginApi& aPlugin ); |
|
59 |
|
60 |
|
61 virtual ~CNATFWConnectionHandler(); |
|
62 |
|
63 /** |
|
64 * FetchCandidate |
|
65 * |
|
66 * @since S60 v3.2 |
|
67 * @param |
|
68 * @return void |
|
69 */ |
|
70 void PluginInitializeL( TUint32 aIapId, const TDesC8& aDomain, |
|
71 MNcmConnectionMultiplexer& aMultiplexer ); |
|
72 |
|
73 |
|
74 /** |
|
75 * FetchCandidate |
|
76 * |
|
77 * @since S60 v3.2 |
|
78 * @param aStreamId Stream ID |
|
79 * @return void |
|
80 */ |
|
81 void FetchCandidateL( TUint aStreamId ); |
|
82 |
|
83 |
|
84 /** |
|
85 * FetchCandidates |
|
86 * |
|
87 * @since S60 v3.2 |
|
88 * @return void |
|
89 */ |
|
90 void FetchCandidatesL( TUint aStreamId ); |
|
91 |
|
92 /** |
|
93 * PerformConnectivityChecksL |
|
94 * |
|
95 * @since S60 v3.2 |
|
96 * @return void |
|
97 */ |
|
98 void PerformConnectivityChecksL(); |
|
99 |
|
100 /** |
|
101 * Connect |
|
102 * |
|
103 * @since S60 v3.2 |
|
104 * @return void |
|
105 */ |
|
106 void ConnectL(); |
|
107 |
|
108 /** |
|
109 * MNATFWPluginObserver::Notify is called (returned) with stream's |
|
110 * current sending status. |
|
111 * |
|
112 * @since S60 3.2 |
|
113 * @param aStreamId The stream identifier |
|
114 * @param aState The streaming status |
|
115 * @return void |
|
116 */ |
|
117 void SetReceivingStateL( TUint aStreamId, |
|
118 TNATFWStreamingState aState ); |
|
119 |
|
120 /** |
|
121 * MNATFWPluginObserver::Notify is called (returned) with stream's |
|
122 * current sending status. |
|
123 * |
|
124 * @since S60 3.2 |
|
125 * @param aStreamId The stream identifier |
|
126 * @param aDestAddr The address where to send media |
|
127 * @param aState The streaming status |
|
128 * @return void |
|
129 */ |
|
130 void SetSendingStateL( TUint aStreamId, |
|
131 const TInetAddr& aDestAddr, |
|
132 TNATFWStreamingState aState ); |
|
133 |
|
134 // From CActive |
|
135 |
|
136 void RunL(); |
|
137 |
|
138 void DoCancel(); |
|
139 |
|
140 private: |
|
141 |
|
142 CNATFWConnectionHandler( MNATFWPluginObserver* aPluginObserver, |
|
143 CNATFWPluginApi& aPlugin ); |
|
144 |
|
145 void ConstructL(); |
|
146 |
|
147 |
|
148 private: // data |
|
149 |
|
150 enum TNATFWTestPlugInStates |
|
151 { |
|
152 EIdle = 0, |
|
153 EFetchCandidate, |
|
154 EFetchCandidates, |
|
155 EConnectivityChecks, |
|
156 ESetReceivingState, |
|
157 ESetSendingState, |
|
158 EErrorTestAddress |
|
159 }; |
|
160 |
|
161 TNATFWTestPlugInStates iState; |
|
162 |
|
163 /** |
|
164 * IapId |
|
165 */ |
|
166 TUint iIapId; |
|
167 |
|
168 /** |
|
169 * Domain name |
|
170 * own. |
|
171 */ |
|
172 HBufC8* iDomain; |
|
173 |
|
174 /** |
|
175 * Not own. |
|
176 */ |
|
177 MNcmConnectionMultiplexer* iConnMux; |
|
178 |
|
179 /** |
|
180 * Sends notifications to NAT Plug-in observer. |
|
181 * Not own. |
|
182 */ |
|
183 MNATFWPluginObserver* iPluginObserver; |
|
184 |
|
185 /** |
|
186 * Candidate |
|
187 * own. |
|
188 */ |
|
189 CNATFWCandidate* iCandidate; |
|
190 |
|
191 /** |
|
192 * Candidate |
|
193 * own. |
|
194 */ |
|
195 CNATFWCandidatePair* iCandidatePair; |
|
196 |
|
197 /** |
|
198 * Timer |
|
199 */ |
|
200 RTimer iTimer; |
|
201 |
|
202 /** |
|
203 * StreamId |
|
204 */ |
|
205 TUint iStreamId; |
|
206 |
|
207 /** |
|
208 * FetchQueue |
|
209 */ |
|
210 TUint iFetchQueue; |
|
211 |
|
212 TNATFWStreamingState iStreamingStatus; |
|
213 |
|
214 CNATFWPluginApi& iPlugin; |
|
215 }; |
|
216 |
|
217 #endif // C_NATFWCONNECTIONHANDLER_H |