|
1 /* |
|
2 * Copyright (c) 2006 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 "natfwstunclient.h" |
|
23 //#include "cstunclientimplementation.h" |
|
24 |
|
25 |
|
26 // ======== MEMBER FUNCTIONS ======== |
|
27 |
|
28 // --------------------------------------------------------------------------- |
|
29 // CSTUNClient::NewL |
|
30 // --------------------------------------------------------------------------- |
|
31 // |
|
32 EXPORT_C CSTUNClient* CSTUNClient::NewL( |
|
33 TInt aRetransmitInterval, |
|
34 const TDesC8& aServerAddress, |
|
35 TUint aServerPort, |
|
36 const TDesC8& aServiceName, |
|
37 RSocketServ& aSocketServ, |
|
38 RConnection& aConnection, |
|
39 CDeltaTimer& aTimer, |
|
40 MSTUNClientObserver& aObserver, |
|
41 TBool aObtainSharedSecret, |
|
42 TBool aFailIfNoSRVRecordsFound, |
|
43 TBool aIcmpReceiverUsed, |
|
44 MNcmConnectionMultiplexer* aMultiplexer, |
|
45 TTransportProtocol aTransportProtocol ) |
|
46 { |
|
47 CSTUNClient* self = CSTUNClient::NewLC( aRetransmitInterval, |
|
48 aServerAddress, |
|
49 aServerPort, |
|
50 aServiceName, |
|
51 aSocketServ, |
|
52 aConnection, |
|
53 aTimer, |
|
54 aObserver, |
|
55 aObtainSharedSecret, |
|
56 aFailIfNoSRVRecordsFound, |
|
57 aIcmpReceiverUsed , |
|
58 aMultiplexer, |
|
59 aTransportProtocol ); |
|
60 CleanupStack::Pop( self ); |
|
61 return self; |
|
62 } |
|
63 |
|
64 // --------------------------------------------------------------------------- |
|
65 // CSTUNClient::NewL - overloaded for ICE connectivity checks |
|
66 // --------------------------------------------------------------------------- |
|
67 // |
|
68 EXPORT_C CSTUNClient* CSTUNClient::NewL( |
|
69 TInt aRetransmitInterval, |
|
70 CDeltaTimer& aTimer, |
|
71 MSTUNClientObserver& aObserver, |
|
72 MNcmConnectionMultiplexer* aMultiplexer, |
|
73 TTransportProtocol aTransportProtocol ) |
|
74 { |
|
75 CSTUNClient* self = CSTUNClient::NewLC( aRetransmitInterval, |
|
76 aTimer, |
|
77 aObserver, |
|
78 aMultiplexer, |
|
79 aTransportProtocol ); |
|
80 CleanupStack::Pop( self ); |
|
81 return self; |
|
82 } |
|
83 |
|
84 // --------------------------------------------------------------------------- |
|
85 // CSTUNClient::NewLC |
|
86 // --------------------------------------------------------------------------- |
|
87 // |
|
88 EXPORT_C CSTUNClient* CSTUNClient::NewLC( |
|
89 TInt /*aRetransmitInterval*/, |
|
90 const TDesC8& /*aServerAddress*/, |
|
91 TUint /*aServerPort*/, |
|
92 const TDesC8& /*aNatProtocol*/, |
|
93 RSocketServ& /*aSocketServ*/, |
|
94 RConnection& /*aConnection*/, |
|
95 CDeltaTimer& /*aTimer*/, |
|
96 MSTUNClientObserver& /*aObserver*/, |
|
97 TBool /*aObtainSharedSecret*/, |
|
98 TBool /*aFailIfNoSRVRecordsFound*/, |
|
99 TBool /*aIcmpReceiverUsed*/, |
|
100 MNcmConnectionMultiplexer* /*aMultiplexer*/, |
|
101 TTransportProtocol /*aTransportProtocol*/ ) |
|
102 { |
|
103 CSTUNClient* self = new ( ELeave ) CSTUNClient(); |
|
104 CleanupStack::PushL( self ); |
|
105 /* self->ConstructL( aRetransmitInterval, |
|
106 aServerAddress, |
|
107 aServerPort, |
|
108 aNatProtocol, |
|
109 aSocketServ, |
|
110 aConnection, |
|
111 aTimer, |
|
112 aObserver, |
|
113 aObtainSharedSecret, |
|
114 aFailIfNoSRVRecordsFound, |
|
115 aIcmpReceiverUsed, |
|
116 aMultiplexer, |
|
117 aTransportProtocol ); */ |
|
118 return self; |
|
119 } |
|
120 |
|
121 // --------------------------------------------------------------------------- |
|
122 // CSTUNClient::NewLC - overloaded for ICE connectivity checks |
|
123 // --------------------------------------------------------------------------- |
|
124 // |
|
125 EXPORT_C CSTUNClient* CSTUNClient::NewLC( |
|
126 TInt /*aRetransmitInterval*/, |
|
127 CDeltaTimer& /*aTimer*/, |
|
128 MSTUNClientObserver& /*aObserver*/, |
|
129 MNcmConnectionMultiplexer* /*aMultiplexer*/, |
|
130 TTransportProtocol /*aTransportProtocol*/ ) |
|
131 { |
|
132 CSTUNClient* self = new ( ELeave ) CSTUNClient(); |
|
133 CleanupStack::PushL( self ); |
|
134 /* self->ConstructL( aRetransmitInterval, |
|
135 aTimer, |
|
136 aObserver, |
|
137 aMultiplexer );*/ |
|
138 return self; |
|
139 } |
|
140 |
|
141 // --------------------------------------------------------------------------- |
|
142 // CSTUNClient::CSTUNClient |
|
143 // --------------------------------------------------------------------------- |
|
144 // |
|
145 CSTUNClient::CSTUNClient() |
|
146 { |
|
147 } |
|
148 |
|
149 // --------------------------------------------------------------------------- |
|
150 // CSTUNClient::CSTUNClient |
|
151 // Dummy implementation, as copy constructor is declared private and not used. |
|
152 // --------------------------------------------------------------------------- |
|
153 // |
|
154 CSTUNClient::CSTUNClient( const CSTUNClient& /*aClient*/ ) |
|
155 { |
|
156 } |
|
157 |
|
158 // --------------------------------------------------------------------------- |
|
159 // CSTUNClient::ConstructL |
|
160 // --------------------------------------------------------------------------- |
|
161 // |
|
162 /*void CSTUNClient::ConstructL( TInt aRetransmitInterval, |
|
163 const TDesC8& aServerAddress, |
|
164 TUint aServerPort, |
|
165 const TDesC8& aNatProtocol, |
|
166 RSocketServ& aSocketServ, |
|
167 RConnection& aConnection, |
|
168 CDeltaTimer& aTimer, |
|
169 MSTUNClientObserver& aObserver, |
|
170 TBool aObtainSharedSecret, |
|
171 TBool aFailIfNoSRVRecordsFound, |
|
172 TBool aIcmpReceiverUsed, |
|
173 MNcmConnectionMultiplexer* aMultiplexer ) |
|
174 { |
|
175 iImplementation = CSTUNClientImplementation::NewL( *this, |
|
176 aRetransmitInterval, |
|
177 aServerAddress, |
|
178 aServerPort, |
|
179 aNatProtocol, |
|
180 aSocketServ, |
|
181 aConnection, |
|
182 aTimer, |
|
183 aObserver, |
|
184 aObtainSharedSecret, |
|
185 aFailIfNoSRVRecordsFound, |
|
186 aIcmpReceiverUsed, |
|
187 aMultiplexer ); |
|
188 }*/ |
|
189 |
|
190 // --------------------------------------------------------------------------- |
|
191 // CSTUNClient::ConstructL - overloaded for ICE connectivity checks |
|
192 // --------------------------------------------------------------------------- |
|
193 // |
|
194 /*void CSTUNClient::ConstructL( TInt aRetransmitInterval, |
|
195 CDeltaTimer& aTimer, |
|
196 MSTUNClientObserver& aObserver, |
|
197 MNcmConnectionMultiplexer* aMultiplexer ) |
|
198 { |
|
199 iImplementation = CSTUNClientImplementation::NewL( *this, |
|
200 aRetransmitInterval, |
|
201 aTimer, |
|
202 aObserver, |
|
203 aMultiplexer ); |
|
204 }*/ |
|
205 |
|
206 |
|
207 // --------------------------------------------------------------------------- |
|
208 // CSTUNClient::~CSTUNClient |
|
209 // --------------------------------------------------------------------------- |
|
210 // |
|
211 EXPORT_C CSTUNClient::~CSTUNClient() |
|
212 { |
|
213 // delete iImplementation; |
|
214 } |
|
215 |
|
216 // --------------------------------------------------------------------------- |
|
217 // CSTUNClient::IsInitialized |
|
218 // --------------------------------------------------------------------------- |
|
219 // |
|
220 EXPORT_C TBool CSTUNClient::IsInitialized() const |
|
221 { |
|
222 // __TEST_INVARIANT; |
|
223 |
|
224 // return iImplementation->IsInitialized(); |
|
225 return ETrue; |
|
226 } |
|
227 |
|
228 // --------------------------------------------------------------------------- |
|
229 // CSTUNClient::STUNServerAddrL |
|
230 // --------------------------------------------------------------------------- |
|
231 // |
|
232 EXPORT_C const TInetAddr& CSTUNClient::STUNServerAddrL() const |
|
233 { |
|
234 // __TEST_INVARIANT; |
|
235 return KInetAddrAny; |
|
236 // return iImplementation->STUNServerAddrL(); |
|
237 } |
|
238 |
|
239 // --------------------------------------------------------------------------- |
|
240 // CSTUNClient::SetCredentialsL |
|
241 // --------------------------------------------------------------------------- |
|
242 // |
|
243 EXPORT_C void CSTUNClient::SetCredentialsL( const TDesC8& /*aUsername*/, |
|
244 const TDesC8& /*aPasswd*/ ) |
|
245 { |
|
246 //__TEST_INVARIANT; |
|
247 |
|
248 // iImplementation->SetCredentialsL( aUsername, aPasswd ); |
|
249 } |
|
250 |
|
251 // --------------------------------------------------------------------------- |
|
252 // CSTUNClient::SharedSecretObtained |
|
253 // --------------------------------------------------------------------------- |
|
254 // |
|
255 EXPORT_C TBool CSTUNClient::SharedSecretObtained() const |
|
256 { |
|
257 __TEST_INVARIANT; |
|
258 |
|
259 // return iImplementation->SharedSecretObtained(); |
|
260 return ETrue; |
|
261 } |
|
262 |
|
263 // --------------------------------------------------------------------------- |
|
264 // CSTUNClient::ObtainTransactionIDL |
|
265 // --------------------------------------------------------------------------- |
|
266 // |
|
267 EXPORT_C void CSTUNClient::ObtainTransactionIDL( TDesC8& /*aTransactionID*/ ) |
|
268 { |
|
269 /* TNATFWUNSAFTransactionID& transactionID = |
|
270 static_cast<TNATFWUNSAFTransactionID&>( aTransactionID );*/ |
|
271 // iImplementation->ObtainTransactionIDL( transactionID ); |
|
272 } |
|
273 |
|
274 // --------------------------------------------------------------------------- |
|
275 // CSTUNClient::Implementation |
|
276 // --------------------------------------------------------------------------- |
|
277 // |
|
278 /*CSTUNClientImplementation& CSTUNClient::Implementation() |
|
279 { |
|
280 __TEST_INVARIANT; |
|
281 |
|
282 return *iImplementation; |
|
283 }*/ |
|
284 |
|
285 // ----------------------------------------------------------------------------- |
|
286 // CSTUNClient::__DbgTestInvariant |
|
287 // ----------------------------------------------------------------------------- |
|
288 // |
|
289 void CSTUNClient::__DbgTestInvariant() const |
|
290 { |
|
291 } |