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 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
183 redirect_hook_ = redirect_hook; | 183 redirect_hook_ = redirect_hook; |
184 } | 184 } |
185 | 185 |
186 void set_enable_otu_nonce(bool enable) { enable_otu_nonce_ = enable; } | 186 void set_enable_otu_nonce(bool enable) { enable_otu_nonce_ = enable; } |
187 | 187 |
188 // If set to true, reject CreatePermission requests to RFC1918 addresses. | 188 // If set to true, reject CreatePermission requests to RFC1918 addresses. |
189 void set_reject_private_addresses(bool filter) { | 189 void set_reject_private_addresses(bool filter) { |
190 reject_private_addresses_ = filter; | 190 reject_private_addresses_ = filter; |
191 } | 191 } |
192 | 192 |
| 193 void set_enable_permission_checks(bool enable) { |
| 194 enable_permission_checks_ = enable; |
| 195 } |
| 196 |
193 // Starts listening for packets from internal clients. | 197 // Starts listening for packets from internal clients. |
194 void AddInternalSocket(rtc::AsyncPacketSocket* socket, | 198 void AddInternalSocket(rtc::AsyncPacketSocket* socket, |
195 ProtocolType proto); | 199 ProtocolType proto); |
196 // Starts listening for the connections on this socket. When someone tries | 200 // Starts listening for the connections on this socket. When someone tries |
197 // to connect, the connection will be accepted and a new internal socket | 201 // to connect, the connection will be accepted and a new internal socket |
198 // will be added. | 202 // will be added. |
199 void AddInternalServerSocket(rtc::AsyncSocket* socket, | 203 void AddInternalServerSocket(rtc::AsyncSocket* socket, |
200 ProtocolType proto); | 204 ProtocolType proto); |
201 // Specifies the factory to use for creating external sockets. | 205 // Specifies the factory to use for creating external sockets. |
202 void SetExternalSocketFactory(rtc::PacketSocketFactory* factory, | 206 void SetExternalSocketFactory(rtc::PacketSocketFactory* factory, |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
261 rtc::Thread* thread_; | 265 rtc::Thread* thread_; |
262 std::string nonce_key_; | 266 std::string nonce_key_; |
263 std::string realm_; | 267 std::string realm_; |
264 std::string software_; | 268 std::string software_; |
265 TurnAuthInterface* auth_hook_; | 269 TurnAuthInterface* auth_hook_; |
266 TurnRedirectInterface* redirect_hook_; | 270 TurnRedirectInterface* redirect_hook_; |
267 // otu - one-time-use. Server will respond with 438 if it's | 271 // otu - one-time-use. Server will respond with 438 if it's |
268 // sees the same nonce in next transaction. | 272 // sees the same nonce in next transaction. |
269 bool enable_otu_nonce_; | 273 bool enable_otu_nonce_; |
270 bool reject_private_addresses_ = false; | 274 bool reject_private_addresses_ = false; |
| 275 // Check for permission when receiving an external packet. |
| 276 bool enable_permission_checks_ = true; |
271 | 277 |
272 InternalSocketMap server_sockets_; | 278 InternalSocketMap server_sockets_; |
273 ServerSocketMap server_listen_sockets_; | 279 ServerSocketMap server_listen_sockets_; |
274 std::unique_ptr<rtc::PacketSocketFactory> external_socket_factory_; | 280 std::unique_ptr<rtc::PacketSocketFactory> external_socket_factory_; |
275 rtc::SocketAddress external_addr_; | 281 rtc::SocketAddress external_addr_; |
276 | 282 |
277 AllocationMap allocations_; | 283 AllocationMap allocations_; |
278 | 284 |
279 // For testing only. If this is non-zero, the next NONCE will be generated | 285 // For testing only. If this is non-zero, the next NONCE will be generated |
280 // from this value, and it will be reset to 0 after generating the NONCE. | 286 // from this value, and it will be reset to 0 after generating the NONCE. |
281 int64_t ts_for_next_nonce_ = 0; | 287 int64_t ts_for_next_nonce_ = 0; |
282 | 288 |
283 friend class TurnServerAllocation; | 289 friend class TurnServerAllocation; |
284 }; | 290 }; |
285 | 291 |
286 } // namespace cricket | 292 } // namespace cricket |
287 | 293 |
288 #endif // WEBRTC_P2P_BASE_TURNSERVER_H_ | 294 #endif // WEBRTC_P2P_BASE_TURNSERVER_H_ |
OLD | NEW |