|
1 /* |
|
2 * Copyright (c) 2006-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 #include "stunassert.h" |
|
22 #include "natfwstunrelaybinding.h" |
|
23 #include "cstunrelaybindingimplementation.h" |
|
24 #include "natfwstunclient.h" |
|
25 #include "cstunclientimplementation.h" |
|
26 #include "ut_cnatfwturnconnectionhandler.h" |
|
27 |
|
28 |
|
29 const TInt KRtoValueUsedInRefreshTest = 555; |
|
30 |
|
31 // ======== MEMBER FUNCTIONS ======== |
|
32 |
|
33 // --------------------------------------------------------------------------- |
|
34 // CSTUNRelayBinding::NewL |
|
35 // --------------------------------------------------------------------------- |
|
36 // |
|
37 EXPORT_C CSTUNRelayBinding* CSTUNRelayBinding::NewL( CSTUNClient& aSTUNClient, |
|
38 TUint aStreamId, |
|
39 TUint aConnectionId ) |
|
40 { |
|
41 __ASSERT_ALWAYS( aSTUNClient.IsInitialized(), User::Leave( KErrNotReady ) ); |
|
42 CSTUNRelayBinding* self = CSTUNRelayBinding::NewLC( aSTUNClient, |
|
43 aStreamId, |
|
44 aConnectionId ); |
|
45 CleanupStack::Pop( self ); |
|
46 return self; |
|
47 } |
|
48 |
|
49 // --------------------------------------------------------------------------- |
|
50 // CSTUNRelayBinding::NewLC |
|
51 // --------------------------------------------------------------------------- |
|
52 // |
|
53 EXPORT_C CSTUNRelayBinding* CSTUNRelayBinding::NewLC( CSTUNClient& aSTUNClient, |
|
54 TUint aStreamId, |
|
55 TUint aConnectionId ) |
|
56 { |
|
57 CSTUNRelayBinding* self = new ( ELeave ) CSTUNRelayBinding(); |
|
58 CleanupStack::PushL( self ); |
|
59 self->ConstructL( aSTUNClient, aStreamId, aConnectionId ); |
|
60 return self; |
|
61 } |
|
62 |
|
63 // --------------------------------------------------------------------------- |
|
64 // CSTUNRelayBinding::CSTUNRelayBinding |
|
65 // --------------------------------------------------------------------------- |
|
66 // |
|
67 CSTUNRelayBinding::CSTUNRelayBinding() |
|
68 { |
|
69 } |
|
70 |
|
71 // --------------------------------------------------------------------------- |
|
72 // CSTUNRelayBinding::CSTUNRelayBinding |
|
73 // Dummy implementation, as copy constructor is declared private and not used. |
|
74 // --------------------------------------------------------------------------- |
|
75 // |
|
76 CSTUNRelayBinding::CSTUNRelayBinding( const CBinding& /*aBinding*/ ) |
|
77 { |
|
78 } |
|
79 |
|
80 |
|
81 // --------------------------------------------------------------------------- |
|
82 // CSTUNRelayBinding::ConstructL - overloaded |
|
83 // --------------------------------------------------------------------------- |
|
84 // |
|
85 void CSTUNRelayBinding::ConstructL( CSTUNClient& /*aSTUNClient*/, |
|
86 TUint /*aStreamId*/, |
|
87 TUint /*aConnectionId*/ ) |
|
88 { |
|
89 /* __ASSERT_ALWAYS( aSTUNClient.Implementation().MultiplexerInstance(), |
|
90 User::Leave( KErrBadHandle ) ); |
|
91 iImplementation = |
|
92 CSTUNRelayBindingImplementation::NewL( *this, |
|
93 aSTUNClient.Implementation(), |
|
94 aStreamId, |
|
95 aConnectionId, |
|
96 aSTUNClient.Implementation().MultiplexerInstance() );*/ |
|
97 } |
|
98 |
|
99 // --------------------------------------------------------------------------- |
|
100 // CSTUNRelayBinding::ConstructL |
|
101 // --------------------------------------------------------------------------- |
|
102 // |
|
103 void CSTUNRelayBinding::ConstructL( CSTUNClient& /*aSTUNClient*/, |
|
104 RSocket& /*aSocket*/ ) |
|
105 { |
|
106 } |
|
107 |
|
108 // --------------------------------------------------------------------------- |
|
109 // CSTUNRelayBinding::~CSTUNRelayBinding |
|
110 // --------------------------------------------------------------------------- |
|
111 // |
|
112 EXPORT_C CSTUNRelayBinding::~CSTUNRelayBinding() |
|
113 { |
|
114 // delete iImplementation; |
|
115 } |
|
116 |
|
117 // --------------------------------------------------------------------------- |
|
118 // CSTUNRelayBinding::CancelRequest |
|
119 // --------------------------------------------------------------------------- |
|
120 // |
|
121 EXPORT_C void CSTUNRelayBinding::CancelRequest() |
|
122 { |
|
123 // Implementation().CancelRequest(); |
|
124 } |
|
125 |
|
126 // --------------------------------------------------------------------------- |
|
127 // CSTUNRelayBinding::AllocateRequestL |
|
128 // --------------------------------------------------------------------------- |
|
129 // |
|
130 EXPORT_C void CSTUNRelayBinding::AllocateRequestL( TUint aRtoValue ) |
|
131 { |
|
132 // Implementation().AllocateRequestL(); |
|
133 |
|
134 if ( KRtoValueUsedInRefreshTest == aRtoValue ) |
|
135 { |
|
136 if ( UT_CNATFWTurnConnectionHandler::iActiveSchedulerWait.IsStarted() ) |
|
137 { |
|
138 UT_CNATFWTurnConnectionHandler::iActiveSchedulerWait.AsyncStop(); |
|
139 } |
|
140 } |
|
141 } |
|
142 |
|
143 // --------------------------------------------------------------------------- |
|
144 // CSTUNRelayBinding::AddressResolved |
|
145 // --------------------------------------------------------------------------- |
|
146 // |
|
147 EXPORT_C TBool CSTUNRelayBinding::AddressResolved() const |
|
148 { |
|
149 return ETrue; |
|
150 // return Implementation().AddressResolved(); |
|
151 } |
|
152 |
|
153 // --------------------------------------------------------------------------- |
|
154 // CSTUNRelayBinding::PublicAddr |
|
155 // --------------------------------------------------------------------------- |
|
156 // |
|
157 EXPORT_C const TInetAddr& CSTUNRelayBinding::PublicAddr() const |
|
158 { |
|
159 // return Implementation().PublicAddr(); |
|
160 return KInetAddrAny; |
|
161 } |
|
162 |
|
163 // --------------------------------------------------------------------------- |
|
164 // CSTUNRelayBinding::RelayAddr |
|
165 // --------------------------------------------------------------------------- |
|
166 // |
|
167 EXPORT_C const TInetAddr& CSTUNRelayBinding::RelayAddr() const |
|
168 { |
|
169 // return Implementation().RelayAddr(); |
|
170 return KInetAddrAny; |
|
171 } |
|
172 |
|
173 // --------------------------------------------------------------------------- |
|
174 // CSTUNRelayBinding::HandleDataL |
|
175 // --------------------------------------------------------------------------- |
|
176 // |
|
177 EXPORT_C HBufC8* CSTUNRelayBinding::HandleDataL( const TDesC8& /*aData*/, |
|
178 TBool& /*aConsumed*/, TInetAddr& /*aRemoteAddr*/ ) |
|
179 { |
|
180 HBufC8* buffer = NULL; |
|
181 // return Implementation().HandleDataL( aData, aConsumed, aRemoteAddr ); |
|
182 return buffer; |
|
183 } |
|
184 |
|
185 // --------------------------------------------------------------------------- |
|
186 // CSTUNRelayBinding::SetICESpecificAttributes |
|
187 // --------------------------------------------------------------------------- |
|
188 // |
|
189 EXPORT_C void CSTUNRelayBinding::SetICESpecificAttributes( |
|
190 const TICEAttributes& /*aAttributes*/ ) |
|
191 { |
|
192 // Implementation().SetICESpecificAttributes( aAttributes ); |
|
193 } |
|
194 |
|
195 // --------------------------------------------------------------------------- |
|
196 // CSTUNRelayBinding::SetActiveDestinationRequestL |
|
197 // --------------------------------------------------------------------------- |
|
198 // |
|
199 EXPORT_C void CSTUNRelayBinding::SetActiveDestinationRequestL( |
|
200 const TInetAddr& /*aRemoteAddr*/, TUint32& /*aTimerValue*/ ) |
|
201 { |
|
202 // Implementation().SetActiveDestinationRequestL( aRemoteAddr, aTimerValue ); |
|
203 } |
|
204 |
|
205 // --------------------------------------------------------------------------- |
|
206 // CSTUNRelayBinding::SendIndicationL |
|
207 // --------------------------------------------------------------------------- |
|
208 // |
|
209 EXPORT_C void CSTUNRelayBinding::SendIndicationL( |
|
210 const TInetAddr& /*aRemoteAddr*/, const TDesC8& /*aData*/, TBool /*aAddFingerprint*/ ) |
|
211 { |
|
212 // Implementation().SendIndicationL( aRemoteAddr, aData ); |
|
213 } |
|
214 |
|
215 // --------------------------------------------------------------------------- |
|
216 // CSTUNRelayBinding::ConnectRequestL |
|
217 // --------------------------------------------------------------------------- |
|
218 // |
|
219 EXPORT_C void CSTUNRelayBinding::ConnectRequestL( const TInetAddr& /*aRemoteAddr*/ ) |
|
220 { |
|
221 // Implementation().ConnectRequestL( aRemoteAddr ); |
|
222 } |
|
223 |
|
224 // --------------------------------------------------------------------------- |
|
225 // CSTUNRelayBinding::StreamId |
|
226 // --------------------------------------------------------------------------- |
|
227 // |
|
228 EXPORT_C TUint CSTUNRelayBinding::StreamId() const |
|
229 { |
|
230 // return Implementation().StreamId(); |
|
231 return 222; |
|
232 } |
|
233 |
|
234 // --------------------------------------------------------------------------- |
|
235 // CSTUNRelayBinding::ConnectionId |
|
236 // --------------------------------------------------------------------------- |
|
237 // |
|
238 EXPORT_C TUint CSTUNRelayBinding::ConnectionId() const |
|
239 { |
|
240 return 2; |
|
241 } |
|
242 |
|
243 // --------------------------------------------------------------------------- |
|
244 // CSTUNRelayBinding::STUNClient |
|
245 // --------------------------------------------------------------------------- |
|
246 // |
|
247 EXPORT_C const CSTUNClient* CSTUNRelayBinding::STUNClient() const |
|
248 { |
|
249 CSTUNClient* client = NULL; |
|
250 // return Implementation().STUNClient(); |
|
251 return client; |
|
252 } |
|
253 |
|
254 // --------------------------------------------------------------------------- |
|
255 // CSTUNRelayBinding::AlternateServerAddr |
|
256 // --------------------------------------------------------------------------- |
|
257 // |
|
258 EXPORT_C const TInetAddr& CSTUNRelayBinding::AlternateServerAddr() const |
|
259 { |
|
260 return TInetAddr(); |
|
261 } |
|
262 |
|
263 // --------------------------------------------------------------------------- |
|
264 // CSTUNRelayBinding::RealmFromResponse |
|
265 // --------------------------------------------------------------------------- |
|
266 // |
|
267 EXPORT_C const HBufC8* CSTUNRelayBinding::RealmFromResponse() const |
|
268 { |
|
269 // return Implementation().RealmFromResponse(); |
|
270 return NULL; |
|
271 } |
|
272 |
|
273 // --------------------------------------------------------------------------- |
|
274 // CSTUNRelayBinding::Implementation |
|
275 // --------------------------------------------------------------------------- |
|
276 // |
|
277 CBindingImplementation& CSTUNRelayBinding::Implementation() |
|
278 { |
|
279 // __TEST_INVARIANT; |
|
280 |
|
281 // return *iImplementation; |
|
282 CBindingImplementation* impl = NULL; |
|
283 return *impl; |
|
284 } |
|
285 |
|
286 // --------------------------------------------------------------------------- |
|
287 // CSTUNRelayBinding::Implementation |
|
288 // --------------------------------------------------------------------------- |
|
289 // |
|
290 const CBindingImplementation& CSTUNRelayBinding::Implementation() const |
|
291 { |
|
292 // __TEST_INVARIANT; |
|
293 |
|
294 // return *iImplementation; |
|
295 CBindingImplementation* impl = NULL; |
|
296 return *impl; |
|
297 } |
|
298 |