OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2004 The WebRTC Project Authors. All rights reserved. | 2 * Copyright 2004 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 |
11 #ifndef WEBRTC_P2P_BASE_PORTALLOCATOR_H_ | 11 #ifndef WEBRTC_P2P_BASE_PORTALLOCATOR_H_ |
12 #define WEBRTC_P2P_BASE_PORTALLOCATOR_H_ | 12 #define WEBRTC_P2P_BASE_PORTALLOCATOR_H_ |
13 | 13 |
14 #include <deque> | 14 #include <deque> |
15 #include <memory> | 15 #include <memory> |
16 #include <string> | 16 #include <string> |
17 #include <vector> | 17 #include <vector> |
18 | 18 |
19 #include "webrtc/p2p/base/port.h" | 19 #include "webrtc/p2p/base/port.h" |
20 #include "webrtc/p2p/base/portinterface.h" | 20 #include "webrtc/p2p/base/portinterface.h" |
21 #include "webrtc/base/helpers.h" | 21 #include "webrtc/base/helpers.h" |
22 #include "webrtc/base/proxyinfo.h" | |
23 #include "webrtc/base/sigslot.h" | 22 #include "webrtc/base/sigslot.h" |
24 #include "webrtc/base/thread.h" | 23 #include "webrtc/base/thread.h" |
25 | 24 |
26 namespace webrtc { | 25 namespace webrtc { |
27 class MetricsObserverInterface; | 26 class MetricsObserverInterface; |
28 } | 27 } |
29 | 28 |
30 namespace cricket { | 29 namespace cricket { |
31 | 30 |
32 // PortAllocator is responsible for allocating Port types for a given | 31 // PortAllocator is responsible for allocating Port types for a given |
(...skipping 326 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
359 int component, | 358 int component, |
360 const std::string& ice_ufrag, | 359 const std::string& ice_ufrag, |
361 const std::string& ice_pwd); | 360 const std::string& ice_pwd); |
362 | 361 |
363 // Returns the next session that would be returned by TakePooledSession. | 362 // Returns the next session that would be returned by TakePooledSession. |
364 const PortAllocatorSession* GetPooledSession() const; | 363 const PortAllocatorSession* GetPooledSession() const; |
365 | 364 |
366 uint32_t flags() const { return flags_; } | 365 uint32_t flags() const { return flags_; } |
367 void set_flags(uint32_t flags) { flags_ = flags; } | 366 void set_flags(uint32_t flags) { flags_ = flags; } |
368 | 367 |
369 const std::string& user_agent() const { return agent_; } | |
370 const rtc::ProxyInfo& proxy() const { return proxy_; } | |
371 void set_proxy(const std::string& agent, const rtc::ProxyInfo& proxy) { | |
372 agent_ = agent; | |
373 proxy_ = proxy; | |
374 } | |
375 | |
376 // Gets/Sets the port range to use when choosing client ports. | 368 // Gets/Sets the port range to use when choosing client ports. |
377 int min_port() const { return min_port_; } | 369 int min_port() const { return min_port_; } |
378 int max_port() const { return max_port_; } | 370 int max_port() const { return max_port_; } |
379 bool SetPortRange(int min_port, int max_port) { | 371 bool SetPortRange(int min_port, int max_port) { |
380 if (min_port > max_port) { | 372 if (min_port > max_port) { |
381 return false; | 373 return false; |
382 } | 374 } |
383 | 375 |
384 min_port_ = min_port; | 376 min_port_ = min_port; |
385 max_port_ = max_port; | 377 max_port_ = max_port; |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
418 | 410 |
419 webrtc::MetricsObserverInterface* metrics_observer() { | 411 webrtc::MetricsObserverInterface* metrics_observer() { |
420 return metrics_observer_; | 412 return metrics_observer_; |
421 } | 413 } |
422 | 414 |
423 const std::deque<std::unique_ptr<PortAllocatorSession>>& pooled_sessions() { | 415 const std::deque<std::unique_ptr<PortAllocatorSession>>& pooled_sessions() { |
424 return pooled_sessions_; | 416 return pooled_sessions_; |
425 } | 417 } |
426 | 418 |
427 uint32_t flags_; | 419 uint32_t flags_; |
428 std::string agent_; | |
429 rtc::ProxyInfo proxy_; | |
430 int min_port_; | 420 int min_port_; |
431 int max_port_; | 421 int max_port_; |
432 uint32_t step_delay_; | 422 uint32_t step_delay_; |
433 bool allow_tcp_listen_; | 423 bool allow_tcp_listen_; |
434 uint32_t candidate_filter_; | 424 uint32_t candidate_filter_; |
435 std::string origin_; | 425 std::string origin_; |
436 | 426 |
437 private: | 427 private: |
438 ServerAddresses stun_servers_; | 428 ServerAddresses stun_servers_; |
439 std::vector<RelayServerConfig> turn_servers_; | 429 std::vector<RelayServerConfig> turn_servers_; |
440 int candidate_pool_size_ = 0; // Last value passed into SetConfiguration. | 430 int candidate_pool_size_ = 0; // Last value passed into SetConfiguration. |
441 std::deque<std::unique_ptr<PortAllocatorSession>> pooled_sessions_; | 431 std::deque<std::unique_ptr<PortAllocatorSession>> pooled_sessions_; |
442 bool prune_turn_ports_ = false; | 432 bool prune_turn_ports_ = false; |
443 | 433 |
444 webrtc::MetricsObserverInterface* metrics_observer_ = nullptr; | 434 webrtc::MetricsObserverInterface* metrics_observer_ = nullptr; |
445 }; | 435 }; |
446 | 436 |
447 } // namespace cricket | 437 } // namespace cricket |
448 | 438 |
449 #endif // WEBRTC_P2P_BASE_PORTALLOCATOR_H_ | 439 #endif // WEBRTC_P2P_BASE_PORTALLOCATOR_H_ |
OLD | NEW |