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