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 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
175 bool prepare_address); | 175 bool prepare_address); |
176 void OnCandidateReady(Port* port, const Candidate& c); | 176 void OnCandidateReady(Port* port, const Candidate& c); |
177 void OnPortComplete(Port* port); | 177 void OnPortComplete(Port* port); |
178 void OnPortError(Port* port); | 178 void OnPortError(Port* port); |
179 void OnProtocolEnabled(AllocationSequence* seq, ProtocolType proto); | 179 void OnProtocolEnabled(AllocationSequence* seq, ProtocolType proto); |
180 void OnPortDestroyed(PortInterface* port); | 180 void OnPortDestroyed(PortInterface* port); |
181 void OnShake(); | 181 void OnShake(); |
182 void MaybeSignalCandidatesAllocationDone(); | 182 void MaybeSignalCandidatesAllocationDone(); |
183 void OnPortAllocationComplete(AllocationSequence* seq); | 183 void OnPortAllocationComplete(AllocationSequence* seq); |
184 PortData* FindPort(Port* port); | 184 PortData* FindPort(Port* port); |
185 void GetNetworks(std::vector<rtc::Network*>* networks); | |
185 | 186 |
186 bool CheckCandidateFilter(const Candidate& c); | 187 bool CheckCandidateFilter(const Candidate& c); |
187 | 188 |
188 BasicPortAllocator* allocator_; | 189 BasicPortAllocator* allocator_; |
189 rtc::Thread* network_thread_; | 190 rtc::Thread* network_thread_; |
190 rtc::scoped_ptr<rtc::PacketSocketFactory> owned_socket_factory_; | 191 rtc::scoped_ptr<rtc::PacketSocketFactory> owned_socket_factory_; |
191 rtc::PacketSocketFactory* socket_factory_; | 192 rtc::PacketSocketFactory* socket_factory_; |
192 bool allocation_started_; | 193 bool allocation_started_; |
193 bool network_manager_started_; | 194 bool network_manager_started_; |
194 bool running_; // set when StartGetAllPorts is called | 195 bool running_; // set when StartGetAllPorts is called |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
243 // Performs the allocation of ports, in a sequenced (timed) manner, for a given | 244 // Performs the allocation of ports, in a sequenced (timed) manner, for a given |
244 // network and IP address. | 245 // network and IP address. |
245 class AllocationSequence : public rtc::MessageHandler, | 246 class AllocationSequence : public rtc::MessageHandler, |
246 public sigslot::has_slots<> { | 247 public sigslot::has_slots<> { |
247 public: | 248 public: |
248 enum State { | 249 enum State { |
249 kInit, // Initial state. | 250 kInit, // Initial state. |
250 kRunning, // Started allocating ports. | 251 kRunning, // Started allocating ports. |
251 kStopped, // Stopped from running. | 252 kStopped, // Stopped from running. |
252 kCompleted, // All ports are allocated. | 253 kCompleted, // All ports are allocated. |
254 kTerminated, // An AllocationSequence is terminated when the network | |
255 // it depends on is removed (disconnected). | |
pthatcher1
2015/09/24 17:11:43
How is that different than kStopped?
honghaiz3
2015/09/24 19:27:00
Removed the state.
| |
253 | 256 |
254 // kInit --> kRunning --> {kCompleted|kStopped} | 257 // kInit --> kRunning --> {kCompleted|kStopped} |
258 // | | | | |
259 // --------------------------------> kTerminated | |
255 }; | 260 }; |
256 AllocationSequence(BasicPortAllocatorSession* session, | 261 AllocationSequence(BasicPortAllocatorSession* session, |
257 rtc::Network* network, | 262 rtc::Network* network, |
258 PortConfiguration* config, | 263 PortConfiguration* config, |
259 uint32 flags); | 264 uint32 flags); |
260 ~AllocationSequence(); | 265 ~AllocationSequence(); |
261 bool Init(); | 266 bool Init(); |
262 void Clear(); | 267 void Clear(); |
268 void Terminate(); | |
269 bool IsTerminated() { return state_ == kTerminated; } | |
pthatcher1
2015/09/24 17:11:43
Is this needed when you can just do state() == kTe
honghaiz3
2015/09/24 19:27:00
Removed the new state.
| |
263 | 270 |
264 State state() const { return state_; } | 271 State state() const { return state_; } |
272 const rtc::Network* network() const { return network_; } | |
265 | 273 |
266 // Disables the phases for a new sequence that this one already covers for an | 274 // Disables the phases for a new sequence that this one already covers for an |
267 // equivalent network setup. | 275 // equivalent network setup. |
268 void DisableEquivalentPhases(rtc::Network* network, | 276 void DisableEquivalentPhases(rtc::Network* network, |
269 PortConfiguration* config, | 277 PortConfiguration* config, |
270 uint32* flags); | 278 uint32* flags); |
271 | 279 |
272 // Starts and stops the sequence. When started, it will continue allocating | 280 // Starts and stops the sequence. When started, it will continue allocating |
273 // new ports on its own timed schedule. | 281 // new ports on its own timed schedule. |
274 void Start(); | 282 void Start(); |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
320 rtc::scoped_ptr<rtc::AsyncPacketSocket> udp_socket_; | 328 rtc::scoped_ptr<rtc::AsyncPacketSocket> udp_socket_; |
321 // There will be only one udp port per AllocationSequence. | 329 // There will be only one udp port per AllocationSequence. |
322 UDPPort* udp_port_; | 330 UDPPort* udp_port_; |
323 std::vector<TurnPort*> turn_ports_; | 331 std::vector<TurnPort*> turn_ports_; |
324 int phase_; | 332 int phase_; |
325 }; | 333 }; |
326 | 334 |
327 } // namespace cricket | 335 } // namespace cricket |
328 | 336 |
329 #endif // WEBRTC_P2P_CLIENT_BASICPORTALLOCATOR_H_ | 337 #endif // WEBRTC_P2P_CLIENT_BASICPORTALLOCATOR_H_ |
OLD | NEW |