OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2012 The WebRTC Project Authors. All rights reserved. | 2 * Copyright 2012 The WebRTC Project Authors. All rights reserved. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
9 */ | 9 */ |
10 | 10 |
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
171 const std::string& password, | 171 const std::string& password, |
172 const ProtocolAddress& server_address, | 172 const ProtocolAddress& server_address, |
173 const RelayCredentials& credentials, | 173 const RelayCredentials& credentials, |
174 int server_priority, | 174 int server_priority, |
175 const std::string& origin); | 175 const std::string& origin); |
176 | 176 |
177 private: | 177 private: |
178 enum { | 178 enum { |
179 MSG_ALLOCATE_ERROR = MSG_FIRST_AVAILABLE, | 179 MSG_ALLOCATE_ERROR = MSG_FIRST_AVAILABLE, |
180 MSG_ALLOCATE_MISMATCH, | 180 MSG_ALLOCATE_MISMATCH, |
181 MSG_TRY_ALTERNATE_SERVER | 181 MSG_TRY_ALTERNATE_SERVER, |
| 182 MSG_REFRESH_ERROR |
182 }; | 183 }; |
183 | 184 |
184 typedef std::list<TurnEntry*> EntryList; | 185 typedef std::list<TurnEntry*> EntryList; |
185 typedef std::map<rtc::Socket::Option, int> SocketOptionsMap; | 186 typedef std::map<rtc::Socket::Option, int> SocketOptionsMap; |
186 typedef std::set<rtc::SocketAddress> AttemptedServerSet; | 187 typedef std::set<rtc::SocketAddress> AttemptedServerSet; |
187 | 188 |
188 virtual void OnMessage(rtc::Message* pmsg); | 189 virtual void OnMessage(rtc::Message* pmsg); |
189 | 190 |
190 bool CreateTurnClientSocket(); | 191 bool CreateTurnClientSocket(); |
191 | 192 |
192 void set_nonce(const std::string& nonce) { nonce_ = nonce; } | 193 void set_nonce(const std::string& nonce) { nonce_ = nonce; } |
193 void set_realm(const std::string& realm) { | 194 void set_realm(const std::string& realm) { |
194 if (realm != realm_) { | 195 if (realm != realm_) { |
195 realm_ = realm; | 196 realm_ = realm; |
196 UpdateHash(); | 197 UpdateHash(); |
197 } | 198 } |
198 } | 199 } |
199 | 200 |
200 // Shuts down the turn port, usually because of some fatal errors. | 201 // Shuts down the turn port, usually because of some fatal errors. |
201 void Close(); | 202 void Close(); |
202 void OnTurnRefreshError() { Close(); } | 203 void OnTurnRefreshError(); |
203 bool SetAlternateServer(const rtc::SocketAddress& address); | 204 bool SetAlternateServer(const rtc::SocketAddress& address); |
204 void ResolveTurnAddress(const rtc::SocketAddress& address); | 205 void ResolveTurnAddress(const rtc::SocketAddress& address); |
205 void OnResolveResult(rtc::AsyncResolverInterface* resolver); | 206 void OnResolveResult(rtc::AsyncResolverInterface* resolver); |
206 | 207 |
207 void AddRequestAuthInfo(StunMessage* msg); | 208 void AddRequestAuthInfo(StunMessage* msg); |
208 void OnSendStunPacket(const void* data, size_t size, StunRequest* request); | 209 void OnSendStunPacket(const void* data, size_t size, StunRequest* request); |
209 // Stun address from allocate success response. | 210 // Stun address from allocate success response. |
210 // Currently used only for testing. | 211 // Currently used only for testing. |
211 void OnStunAddress(const rtc::SocketAddress& address); | 212 void OnStunAddress(const rtc::SocketAddress& address); |
212 void OnAllocateSuccess(const rtc::SocketAddress& address, | 213 void OnAllocateSuccess(const rtc::SocketAddress& address, |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
276 friend class TurnEntry; | 277 friend class TurnEntry; |
277 friend class TurnAllocateRequest; | 278 friend class TurnAllocateRequest; |
278 friend class TurnRefreshRequest; | 279 friend class TurnRefreshRequest; |
279 friend class TurnCreatePermissionRequest; | 280 friend class TurnCreatePermissionRequest; |
280 friend class TurnChannelBindRequest; | 281 friend class TurnChannelBindRequest; |
281 }; | 282 }; |
282 | 283 |
283 } // namespace cricket | 284 } // namespace cricket |
284 | 285 |
285 #endif // WEBRTC_P2P_BASE_TURNPORT_H_ | 286 #endif // WEBRTC_P2P_BASE_TURNPORT_H_ |
OLD | NEW |