| 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 |
| (...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 171 // Ports and candidates are not guaranteed to be in the same order as the | 171 // Ports and candidates are not guaranteed to be in the same order as the |
| 172 // signals were emitted in. | 172 // signals were emitted in. |
| 173 virtual std::vector<PortInterface*> ReadyPorts() const = 0; | 173 virtual std::vector<PortInterface*> ReadyPorts() const = 0; |
| 174 virtual std::vector<Candidate> ReadyCandidates() const = 0; | 174 virtual std::vector<Candidate> ReadyCandidates() const = 0; |
| 175 virtual bool CandidatesAllocationDone() const = 0; | 175 virtual bool CandidatesAllocationDone() const = 0; |
| 176 | 176 |
| 177 sigslot::signal2<PortAllocatorSession*, PortInterface*> SignalPortReady; | 177 sigslot::signal2<PortAllocatorSession*, PortInterface*> SignalPortReady; |
| 178 sigslot::signal2<PortAllocatorSession*, | 178 sigslot::signal2<PortAllocatorSession*, |
| 179 const std::vector<Candidate>&> SignalCandidatesReady; | 179 const std::vector<Candidate>&> SignalCandidatesReady; |
| 180 sigslot::signal1<PortAllocatorSession*> SignalCandidatesAllocationDone; | 180 sigslot::signal1<PortAllocatorSession*> SignalCandidatesAllocationDone; |
| 181 // A TURN port is pruned if a higher-priority TURN port becomes ready |
| 182 // (pairable). When it is pruned, it will not be used for creating |
| 183 // connections and its candidates will not be sent to the remote side |
| 184 // if they have not been sent. |
| 185 sigslot::signal2<PortAllocatorSession*, PortInterface*> SignalPortPruned; |
| 181 | 186 |
| 182 virtual uint32_t generation() { return generation_; } | 187 virtual uint32_t generation() { return generation_; } |
| 183 virtual void set_generation(uint32_t generation) { generation_ = generation; } | 188 virtual void set_generation(uint32_t generation) { generation_ = generation; } |
| 184 sigslot::signal1<PortAllocatorSession*> SignalDestroyed; | 189 sigslot::signal1<PortAllocatorSession*> SignalDestroyed; |
| 185 | 190 |
| 186 protected: | 191 protected: |
| 187 // This method is called when a pooled session (which doesn't have these | 192 // This method is called when a pooled session (which doesn't have these |
| 188 // properties initially) is returned by PortAllocator::TakePooledSession, | 193 // properties initially) is returned by PortAllocator::TakePooledSession, |
| 189 // and the content name, component, and ICE ufrag/pwd are updated. | 194 // and the content name, component, and ICE ufrag/pwd are updated. |
| 190 // | 195 // |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 246 // Set STUN and TURN servers to be used in future sessions, and set | 251 // Set STUN and TURN servers to be used in future sessions, and set |
| 247 // candidate pool size, as described in JSEP. | 252 // candidate pool size, as described in JSEP. |
| 248 // | 253 // |
| 249 // If the servers are changing and the candidate pool size is nonzero, | 254 // If the servers are changing and the candidate pool size is nonzero, |
| 250 // existing pooled sessions will be destroyed and new ones created. | 255 // existing pooled sessions will be destroyed and new ones created. |
| 251 // | 256 // |
| 252 // If the servers are not changing but the candidate pool size is, | 257 // If the servers are not changing but the candidate pool size is, |
| 253 // pooled sessions will be either created or destroyed as necessary. | 258 // pooled sessions will be either created or destroyed as necessary. |
| 254 void SetConfiguration(const ServerAddresses& stun_servers, | 259 void SetConfiguration(const ServerAddresses& stun_servers, |
| 255 const std::vector<RelayServerConfig>& turn_servers, | 260 const std::vector<RelayServerConfig>& turn_servers, |
| 256 int candidate_pool_size); | 261 int candidate_pool_size, |
| 262 bool prune_turn_ports); |
| 257 | 263 |
| 258 const ServerAddresses& stun_servers() const { return stun_servers_; } | 264 const ServerAddresses& stun_servers() const { return stun_servers_; } |
| 259 | 265 |
| 260 const std::vector<RelayServerConfig>& turn_servers() const { | 266 const std::vector<RelayServerConfig>& turn_servers() const { |
| 261 return turn_servers_; | 267 return turn_servers_; |
| 262 } | 268 } |
| 263 | 269 |
| 264 int candidate_pool_size() const { return target_pooled_session_count_; } | 270 int candidate_pool_size() const { return target_pooled_session_count_; } |
| 265 | 271 |
| 266 // Sets the network types to ignore. | 272 // Sets the network types to ignore. |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 320 bool allow_tcp_listen() const { return allow_tcp_listen_; } | 326 bool allow_tcp_listen() const { return allow_tcp_listen_; } |
| 321 void set_allow_tcp_listen(bool allow_tcp_listen) { | 327 void set_allow_tcp_listen(bool allow_tcp_listen) { |
| 322 allow_tcp_listen_ = allow_tcp_listen; | 328 allow_tcp_listen_ = allow_tcp_listen; |
| 323 } | 329 } |
| 324 | 330 |
| 325 uint32_t candidate_filter() { return candidate_filter_; } | 331 uint32_t candidate_filter() { return candidate_filter_; } |
| 326 void set_candidate_filter(uint32_t filter) { | 332 void set_candidate_filter(uint32_t filter) { |
| 327 candidate_filter_ = filter; | 333 candidate_filter_ = filter; |
| 328 } | 334 } |
| 329 | 335 |
| 336 bool prune_turn_ports() const { return prune_turn_ports_; } |
| 337 |
| 330 // Gets/Sets the Origin value used for WebRTC STUN requests. | 338 // Gets/Sets the Origin value used for WebRTC STUN requests. |
| 331 const std::string& origin() const { return origin_; } | 339 const std::string& origin() const { return origin_; } |
| 332 void set_origin(const std::string& origin) { origin_ = origin; } | 340 void set_origin(const std::string& origin) { origin_ = origin; } |
| 333 | 341 |
| 334 protected: | 342 protected: |
| 335 virtual PortAllocatorSession* CreateSessionInternal( | 343 virtual PortAllocatorSession* CreateSessionInternal( |
| 336 const std::string& content_name, | 344 const std::string& content_name, |
| 337 int component, | 345 int component, |
| 338 const std::string& ice_ufrag, | 346 const std::string& ice_ufrag, |
| 339 const std::string& ice_pwd) = 0; | 347 const std::string& ice_pwd) = 0; |
| (...skipping 10 matching lines...) Expand all Loading... |
| 350 | 358 |
| 351 private: | 359 private: |
| 352 ServerAddresses stun_servers_; | 360 ServerAddresses stun_servers_; |
| 353 std::vector<RelayServerConfig> turn_servers_; | 361 std::vector<RelayServerConfig> turn_servers_; |
| 354 // The last size passed into SetConfiguration. | 362 // The last size passed into SetConfiguration. |
| 355 int target_pooled_session_count_ = 0; | 363 int target_pooled_session_count_ = 0; |
| 356 // This variable represents the total number of pooled sessions | 364 // This variable represents the total number of pooled sessions |
| 357 // both owned by this class and taken by TakePooledSession. | 365 // both owned by this class and taken by TakePooledSession. |
| 358 int allocated_pooled_session_count_ = 0; | 366 int allocated_pooled_session_count_ = 0; |
| 359 std::deque<std::unique_ptr<PortAllocatorSession>> pooled_sessions_; | 367 std::deque<std::unique_ptr<PortAllocatorSession>> pooled_sessions_; |
| 368 bool prune_turn_ports_ = false; |
| 360 }; | 369 }; |
| 361 | 370 |
| 362 } // namespace cricket | 371 } // namespace cricket |
| 363 | 372 |
| 364 #endif // WEBRTC_P2P_BASE_PORTALLOCATOR_H_ | 373 #endif // WEBRTC_P2P_BASE_PORTALLOCATOR_H_ |
| OLD | NEW |