| 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 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 144 sigslot::signal3<TurnPort*, const rtc::SocketAddress&, int> | 144 sigslot::signal3<TurnPort*, const rtc::SocketAddress&, int> |
| 145 SignalCreatePermissionResult; | 145 SignalCreatePermissionResult; |
| 146 void FlushRequests(int msg_type) { request_manager_.Flush(msg_type); } | 146 void FlushRequests(int msg_type) { request_manager_.Flush(msg_type); } |
| 147 bool HasRequests() { return !request_manager_.empty(); } | 147 bool HasRequests() { return !request_manager_.empty(); } |
| 148 void set_credentials(RelayCredentials& credentials) { | 148 void set_credentials(RelayCredentials& credentials) { |
| 149 credentials_ = credentials; | 149 credentials_ = credentials; |
| 150 } | 150 } |
| 151 // Finds the turn entry with |address| and sets its channel id. | 151 // Finds the turn entry with |address| and sets its channel id. |
| 152 // Returns true if the entry is found. | 152 // Returns true if the entry is found. |
| 153 bool SetEntryChannelId(const rtc::SocketAddress& address, int channel_id); | 153 bool SetEntryChannelId(const rtc::SocketAddress& address, int channel_id); |
| 154 // Visible for testing. |
| 155 // Shuts down the turn port, usually because of some fatal errors. |
| 156 void Close(); |
| 154 | 157 |
| 155 protected: | 158 protected: |
| 156 TurnPort(rtc::Thread* thread, | 159 TurnPort(rtc::Thread* thread, |
| 157 rtc::PacketSocketFactory* factory, | 160 rtc::PacketSocketFactory* factory, |
| 158 rtc::Network* network, | 161 rtc::Network* network, |
| 159 rtc::AsyncPacketSocket* socket, | 162 rtc::AsyncPacketSocket* socket, |
| 160 const std::string& username, | 163 const std::string& username, |
| 161 const std::string& password, | 164 const std::string& password, |
| 162 const ProtocolAddress& server_address, | 165 const ProtocolAddress& server_address, |
| 163 const RelayCredentials& credentials, | 166 const RelayCredentials& credentials, |
| (...skipping 30 matching lines...) Expand all Loading... |
| 194 bool CreateTurnClientSocket(); | 197 bool CreateTurnClientSocket(); |
| 195 | 198 |
| 196 void set_nonce(const std::string& nonce) { nonce_ = nonce; } | 199 void set_nonce(const std::string& nonce) { nonce_ = nonce; } |
| 197 void set_realm(const std::string& realm) { | 200 void set_realm(const std::string& realm) { |
| 198 if (realm != realm_) { | 201 if (realm != realm_) { |
| 199 realm_ = realm; | 202 realm_ = realm; |
| 200 UpdateHash(); | 203 UpdateHash(); |
| 201 } | 204 } |
| 202 } | 205 } |
| 203 | 206 |
| 204 // Shuts down the turn port, usually because of some fatal errors. | |
| 205 void Close(); | |
| 206 void OnTurnRefreshError(); | 207 void OnTurnRefreshError(); |
| 207 bool SetAlternateServer(const rtc::SocketAddress& address); | 208 bool SetAlternateServer(const rtc::SocketAddress& address); |
| 208 void ResolveTurnAddress(const rtc::SocketAddress& address); | 209 void ResolveTurnAddress(const rtc::SocketAddress& address); |
| 209 void OnResolveResult(rtc::AsyncResolverInterface* resolver); | 210 void OnResolveResult(rtc::AsyncResolverInterface* resolver); |
| 210 | 211 |
| 211 void AddRequestAuthInfo(StunMessage* msg); | 212 void AddRequestAuthInfo(StunMessage* msg); |
| 212 void OnSendStunPacket(const void* data, size_t size, StunRequest* request); | 213 void OnSendStunPacket(const void* data, size_t size, StunRequest* request); |
| 213 // Stun address from allocate success response. | 214 // Stun address from allocate success response. |
| 214 // Currently used only for testing. | 215 // Currently used only for testing. |
| 215 void OnStunAddress(const rtc::SocketAddress& address); | 216 void OnStunAddress(const rtc::SocketAddress& address); |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 280 friend class TurnEntry; | 281 friend class TurnEntry; |
| 281 friend class TurnAllocateRequest; | 282 friend class TurnAllocateRequest; |
| 282 friend class TurnRefreshRequest; | 283 friend class TurnRefreshRequest; |
| 283 friend class TurnCreatePermissionRequest; | 284 friend class TurnCreatePermissionRequest; |
| 284 friend class TurnChannelBindRequest; | 285 friend class TurnChannelBindRequest; |
| 285 }; | 286 }; |
| 286 | 287 |
| 287 } // namespace cricket | 288 } // namespace cricket |
| 288 | 289 |
| 289 #endif // WEBRTC_P2P_BASE_TURNPORT_H_ | 290 #endif // WEBRTC_P2P_BASE_TURNPORT_H_ |
| OLD | NEW |