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 29 matching lines...) Expand all Loading... |
40 // Set to kDefaultNetworkIgnoreMask by default. | 40 // Set to kDefaultNetworkIgnoreMask by default. |
41 void SetNetworkIgnoreMask(int network_ignore_mask) override { | 41 void SetNetworkIgnoreMask(int network_ignore_mask) override { |
42 // TODO(phoglund): implement support for other types than loopback. | 42 // TODO(phoglund): implement support for other types than loopback. |
43 // See https://code.google.com/p/webrtc/issues/detail?id=4288. | 43 // See https://code.google.com/p/webrtc/issues/detail?id=4288. |
44 // Then remove set_network_ignore_list from NetworkManager. | 44 // Then remove set_network_ignore_list from NetworkManager. |
45 network_ignore_mask_ = network_ignore_mask; | 45 network_ignore_mask_ = network_ignore_mask; |
46 } | 46 } |
47 | 47 |
48 int network_ignore_mask() const { return network_ignore_mask_; } | 48 int network_ignore_mask() const { return network_ignore_mask_; } |
49 | 49 |
50 rtc::NetworkManager* network_manager() { return network_manager_; } | 50 rtc::NetworkManager* network_manager() const override { |
| 51 return network_manager_; |
| 52 } |
51 | 53 |
52 // If socket_factory() is set to NULL each PortAllocatorSession | 54 // If socket_factory() is set to NULL each PortAllocatorSession |
53 // creates its own socket factory. | 55 // creates its own socket factory. |
54 rtc::PacketSocketFactory* socket_factory() { return socket_factory_; } | 56 rtc::PacketSocketFactory* socket_factory() { return socket_factory_; } |
55 | 57 |
56 PortAllocatorSession* CreateSessionInternal( | 58 PortAllocatorSession* CreateSessionInternal( |
57 const std::string& content_name, | 59 const std::string& content_name, |
58 int component, | 60 int component, |
59 const std::string& ice_ufrag, | 61 const std::string& ice_ufrag, |
60 const std::string& ice_pwd) override; | 62 const std::string& ice_pwd) override; |
(...skipping 21 matching lines...) Expand all Loading... |
82 int component, | 84 int component, |
83 const std::string& ice_ufrag, | 85 const std::string& ice_ufrag, |
84 const std::string& ice_pwd); | 86 const std::string& ice_pwd); |
85 ~BasicPortAllocatorSession(); | 87 ~BasicPortAllocatorSession(); |
86 | 88 |
87 virtual BasicPortAllocator* allocator() { return allocator_; } | 89 virtual BasicPortAllocator* allocator() { return allocator_; } |
88 rtc::Thread* network_thread() { return network_thread_; } | 90 rtc::Thread* network_thread() { return network_thread_; } |
89 rtc::PacketSocketFactory* socket_factory() { return socket_factory_; } | 91 rtc::PacketSocketFactory* socket_factory() { return socket_factory_; } |
90 | 92 |
91 void SetCandidateFilter(uint32_t filter) override; | 93 void SetCandidateFilter(uint32_t filter) override; |
| 94 |
92 void StartGettingPorts() override; | 95 void StartGettingPorts() override; |
93 void StopGettingPorts() override; | 96 void StopGettingPorts() override; |
94 void ClearGettingPorts() override; | 97 void ClearGettingPorts() override; |
95 bool IsGettingPorts() override { return running_; } | 98 bool IsGettingPorts() override { return running_; } |
96 // These will all be cricket::Ports. | 99 // These will all be cricket::Ports. |
97 std::vector<PortInterface*> ReadyPorts() const override; | 100 std::vector<PortInterface*> ReadyPorts() const override; |
98 std::vector<Candidate> ReadyCandidates() const override; | 101 std::vector<Candidate> ReadyCandidates() const override; |
| 102 std::vector<Candidate> ReadyCandidates(PortInterface* port) const override; |
99 bool CandidatesAllocationDone() const override; | 103 bool CandidatesAllocationDone() const override; |
| 104 void GetPortsOnNetworks(const std::vector<rtc::Network*>* networks) override; |
100 | 105 |
101 protected: | 106 protected: |
102 void UpdateIceParametersInternal() override; | 107 void UpdateIceParametersInternal() override; |
103 | 108 |
104 // Starts the process of getting the port configurations. | 109 // Starts the process of getting the port configurations. |
105 virtual void GetPortConfigurations(); | 110 virtual void GetPortConfigurations(); |
106 | 111 |
107 // Adds a port configuration that is now ready. Once we have one for each | 112 // Adds a port configuration that is now ready. Once we have one for each |
108 // network (or a timeout occurs), we will start allocating ports. | 113 // network (or a timeout occurs), we will start allocating ports. |
109 virtual void ConfigReady(PortConfiguration* config); | 114 virtual void ConfigReady(PortConfiguration* config); |
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
248 | 253 |
249 // kInit --> kRunning --> {kCompleted|kStopped} | 254 // kInit --> kRunning --> {kCompleted|kStopped} |
250 }; | 255 }; |
251 AllocationSequence(BasicPortAllocatorSession* session, | 256 AllocationSequence(BasicPortAllocatorSession* session, |
252 rtc::Network* network, | 257 rtc::Network* network, |
253 PortConfiguration* config, | 258 PortConfiguration* config, |
254 uint32_t flags); | 259 uint32_t flags); |
255 ~AllocationSequence(); | 260 ~AllocationSequence(); |
256 bool Init(); | 261 bool Init(); |
257 void Clear(); | 262 void Clear(); |
258 void OnNetworkRemoved(); | 263 void OnNetworkInactivated(); |
259 | 264 |
260 State state() const { return state_; } | 265 State state() const { return state_; } |
261 const rtc::Network* network() const { return network_; } | 266 const rtc::Network* network() const { return network_; } |
262 bool network_removed() const { return network_removed_; } | 267 |
| 268 bool network_inactive() const { return network_inactive_; } |
| 269 void set_network_inactive(bool network_inactive) { |
| 270 network_inactive_ = network_inactive; |
| 271 } |
263 | 272 |
264 // Disables the phases for a new sequence that this one already covers for an | 273 // Disables the phases for a new sequence that this one already covers for an |
265 // equivalent network setup. | 274 // equivalent network setup. |
266 void DisableEquivalentPhases(rtc::Network* network, | 275 void DisableEquivalentPhases(rtc::Network* network, |
267 PortConfiguration* config, | 276 PortConfiguration* config, |
268 uint32_t* flags); | 277 uint32_t* flags); |
269 | 278 |
270 // Starts and stops the sequence. When started, it will continue allocating | 279 // Starts and stops the sequence. When started, it will continue allocating |
271 // new ports on its own timed schedule. | 280 // new ports on its own timed schedule. |
272 void Start(); | 281 void Start(); |
(...skipping 29 matching lines...) Expand all Loading... |
302 | 311 |
303 void OnReadPacket(rtc::AsyncPacketSocket* socket, | 312 void OnReadPacket(rtc::AsyncPacketSocket* socket, |
304 const char* data, | 313 const char* data, |
305 size_t size, | 314 size_t size, |
306 const rtc::SocketAddress& remote_addr, | 315 const rtc::SocketAddress& remote_addr, |
307 const rtc::PacketTime& packet_time); | 316 const rtc::PacketTime& packet_time); |
308 | 317 |
309 void OnPortDestroyed(PortInterface* port); | 318 void OnPortDestroyed(PortInterface* port); |
310 | 319 |
311 BasicPortAllocatorSession* session_; | 320 BasicPortAllocatorSession* session_; |
312 bool network_removed_ = false; | 321 bool network_inactive_ = false; |
313 rtc::Network* network_; | 322 rtc::Network* network_; |
314 rtc::IPAddress ip_; | 323 rtc::IPAddress ip_; |
315 PortConfiguration* config_; | 324 PortConfiguration* config_; |
316 State state_; | 325 State state_; |
317 uint32_t flags_; | 326 uint32_t flags_; |
318 ProtocolList protocols_; | 327 ProtocolList protocols_; |
319 std::unique_ptr<rtc::AsyncPacketSocket> udp_socket_; | 328 std::unique_ptr<rtc::AsyncPacketSocket> udp_socket_; |
320 // There will be only one udp port per AllocationSequence. | 329 // There will be only one udp port per AllocationSequence. |
321 UDPPort* udp_port_; | 330 UDPPort* udp_port_; |
322 std::vector<TurnPort*> turn_ports_; | 331 std::vector<TurnPort*> turn_ports_; |
323 int phase_; | 332 int phase_; |
324 }; | 333 }; |
325 | 334 |
326 } // namespace cricket | 335 } // namespace cricket |
327 | 336 |
328 #endif // WEBRTC_P2P_CLIENT_BASICPORTALLOCATOR_H_ | 337 #endif // WEBRTC_P2P_CLIENT_BASICPORTALLOCATOR_H_ |
OLD | NEW |