Chromium Code Reviews| 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" | 22 #include "webrtc/base/proxyinfo.h" |
| 23 #include "webrtc/base/sigslot.h" | 23 #include "webrtc/base/sigslot.h" |
| 24 #include "webrtc/base/thread.h" | 24 #include "webrtc/base/thread.h" |
| 25 | 25 |
| 26 namespace rtc { | |
| 27 class Network; | |
| 28 } // namespace rtc | |
| 29 | |
| 26 namespace cricket { | 30 namespace cricket { |
| 27 | 31 |
| 28 // PortAllocator is responsible for allocating Port types for a given | 32 // PortAllocator is responsible for allocating Port types for a given |
| 29 // P2PSocket. It also handles port freeing. | 33 // P2PSocket. It also handles port freeing. |
| 30 // | 34 // |
| 31 // Clients can override this class to control port allocation, including | 35 // Clients can override this class to control port allocation, including |
| 32 // what kinds of ports are allocated. | 36 // what kinds of ports are allocated. |
| 33 | 37 |
| 34 enum { | 38 enum { |
| 35 // Disable local UDP ports. This doesn't impact how we connect to relay | 39 // Disable local UDP ports. This doesn't impact how we connect to relay |
| (...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 158 // Default filter should be CF_ALL. | 162 // Default filter should be CF_ALL. |
| 159 virtual void SetCandidateFilter(uint32_t filter) = 0; | 163 virtual void SetCandidateFilter(uint32_t filter) = 0; |
| 160 | 164 |
| 161 // Starts gathering STUN and Relay configurations. | 165 // Starts gathering STUN and Relay configurations. |
| 162 virtual void StartGettingPorts() = 0; | 166 virtual void StartGettingPorts() = 0; |
| 163 virtual void StopGettingPorts() = 0; | 167 virtual void StopGettingPorts() = 0; |
| 164 // Only stop the existing gathering process but may start new ones if needed. | 168 // Only stop the existing gathering process but may start new ones if needed. |
| 165 virtual void ClearGettingPorts() = 0; | 169 virtual void ClearGettingPorts() = 0; |
| 166 // Whether the process of getting ports has been stopped. | 170 // Whether the process of getting ports has been stopped. |
| 167 virtual bool IsGettingPorts() = 0; | 171 virtual bool IsGettingPorts() = 0; |
| 172 virtual void InactivateNetworksInExistingSequences( | |
|
Taylor Brandstetter
2016/06/06 18:18:37
Should probably be "Deactivate".
honghaiz3
2016/06/07 16:42:06
I looked it up in the online dictionary and google
Taylor Brandstetter
2016/06/07 17:13:26
Acknowledged.
| |
| 173 std::vector<rtc::Network*>* networks) {} | |
| 168 | 174 |
| 169 // Another way of getting the information provided by the signals below. | 175 // Another way of getting the information provided by the signals below. |
| 170 // | 176 // |
| 171 // Ports and candidates are not guaranteed to be in the same order as the | 177 // Ports and candidates are not guaranteed to be in the same order as the |
| 172 // signals were emitted in. | 178 // signals were emitted in. |
| 173 virtual std::vector<PortInterface*> ReadyPorts() const = 0; | 179 virtual std::vector<PortInterface*> ReadyPorts() const = 0; |
| 174 virtual std::vector<Candidate> ReadyCandidates() const = 0; | 180 virtual std::vector<Candidate> ReadyCandidates() const = 0; |
| 175 virtual bool CandidatesAllocationDone() const = 0; | 181 virtual bool CandidatesAllocationDone() const = 0; |
| 176 | 182 |
| 177 sigslot::signal2<PortAllocatorSession*, PortInterface*> SignalPortReady; | 183 sigslot::signal2<PortAllocatorSession*, PortInterface*> SignalPortReady; |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 256 | 262 |
| 257 int candidate_pool_size() const { return target_pooled_session_count_; } | 263 int candidate_pool_size() const { return target_pooled_session_count_; } |
| 258 | 264 |
| 259 // Sets the network types to ignore. | 265 // Sets the network types to ignore. |
| 260 // Values are defined by the AdapterType enum. | 266 // Values are defined by the AdapterType enum. |
| 261 // For instance, calling this with | 267 // For instance, calling this with |
| 262 // ADAPTER_TYPE_ETHERNET | ADAPTER_TYPE_LOOPBACK will ignore Ethernet and | 268 // ADAPTER_TYPE_ETHERNET | ADAPTER_TYPE_LOOPBACK will ignore Ethernet and |
| 263 // loopback interfaces. | 269 // loopback interfaces. |
| 264 virtual void SetNetworkIgnoreMask(int network_ignore_mask) = 0; | 270 virtual void SetNetworkIgnoreMask(int network_ignore_mask) = 0; |
| 265 | 271 |
| 272 virtual void GetNetworks(std::vector<rtc::Network*>* networks) const = 0; | |
| 273 | |
| 266 std::unique_ptr<PortAllocatorSession> CreateSession( | 274 std::unique_ptr<PortAllocatorSession> CreateSession( |
| 267 const std::string& sid, | 275 const std::string& sid, |
| 268 const std::string& content_name, | 276 const std::string& content_name, |
| 269 int component, | 277 int component, |
| 270 const std::string& ice_ufrag, | 278 const std::string& ice_ufrag, |
| 271 const std::string& ice_pwd); | 279 const std::string& ice_pwd); |
| 272 | 280 |
| 273 // Get an available pooled session and set the transport information on it. | 281 // Get an available pooled session and set the transport information on it. |
| 274 // | 282 // |
| 275 // Caller takes ownership of the returned session. | 283 // Caller takes ownership of the returned session. |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 348 int target_pooled_session_count_ = 0; | 356 int target_pooled_session_count_ = 0; |
| 349 // This variable represents the total number of pooled sessions | 357 // This variable represents the total number of pooled sessions |
| 350 // both owned by this class and taken by TakePooledSession. | 358 // both owned by this class and taken by TakePooledSession. |
| 351 int allocated_pooled_session_count_ = 0; | 359 int allocated_pooled_session_count_ = 0; |
| 352 std::deque<std::unique_ptr<PortAllocatorSession>> pooled_sessions_; | 360 std::deque<std::unique_ptr<PortAllocatorSession>> pooled_sessions_; |
| 353 }; | 361 }; |
| 354 | 362 |
| 355 } // namespace cricket | 363 } // namespace cricket |
| 356 | 364 |
| 357 #endif // WEBRTC_P2P_BASE_PORTALLOCATOR_H_ | 365 #endif // WEBRTC_P2P_BASE_PORTALLOCATOR_H_ |
| OLD | NEW |