| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2010 The WebRTC Project Authors. All rights reserved. | 2 * Copyright 2010 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_FAKEPORTALLOCATOR_H_ | 11 #ifndef WEBRTC_P2P_BASE_FAKEPORTALLOCATOR_H_ |
| 12 #define WEBRTC_P2P_BASE_FAKEPORTALLOCATOR_H_ | 12 #define WEBRTC_P2P_BASE_FAKEPORTALLOCATOR_H_ |
| 13 | 13 |
| 14 #include <memory> | 14 #include <memory> |
| 15 #include <string> | 15 #include <string> |
| 16 #include <vector> | 16 #include <vector> |
| 17 | 17 |
| 18 #include "webrtc/base/nethelpers.h" | 18 #include "webrtc/base/nethelpers.h" |
| 19 #include "webrtc/p2p/base/basicpacketsocketfactory.h" | 19 #include "webrtc/p2p/base/basicpacketsocketfactory.h" |
| 20 #include "webrtc/p2p/base/portallocator.h" | 20 #include "webrtc/p2p/base/portallocator.h" |
| 21 #include "webrtc/p2p/base/udpport.h" | 21 #include "webrtc/p2p/base/udpport.h" |
| 22 | 22 |
| 23 namespace rtc { | 23 namespace rtc { |
| 24 class Network; |
| 24 class SocketFactory; | 25 class SocketFactory; |
| 25 class Thread; | 26 class Thread; |
| 26 } | 27 } |
| 27 | 28 |
| 28 namespace cricket { | 29 namespace cricket { |
| 29 | 30 |
| 30 class TestUDPPort : public UDPPort { | 31 class TestUDPPort : public UDPPort { |
| 31 public: | 32 public: |
| 32 static TestUDPPort* Create(rtc::Thread* thread, | 33 static TestUDPPort* Create(rtc::Thread* thread, |
| 33 rtc::PacketSocketFactory* factory, | 34 rtc::PacketSocketFactory* factory, |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 140 | 141 |
| 141 void StopGettingPorts() override { running_ = false; } | 142 void StopGettingPorts() override { running_ = false; } |
| 142 bool IsGettingPorts() override { return running_; } | 143 bool IsGettingPorts() override { return running_; } |
| 143 void ClearGettingPorts() override {} | 144 void ClearGettingPorts() override {} |
| 144 std::vector<PortInterface*> ReadyPorts() const override { | 145 std::vector<PortInterface*> ReadyPorts() const override { |
| 145 return ready_ports_; | 146 return ready_ports_; |
| 146 } | 147 } |
| 147 std::vector<Candidate> ReadyCandidates() const override { | 148 std::vector<Candidate> ReadyCandidates() const override { |
| 148 return candidates_; | 149 return candidates_; |
| 149 } | 150 } |
| 151 |
| 152 std::vector<Candidate> ReadyCandidates(PortInterface* port) const override { |
| 153 return port_->Candidates(); |
| 154 } |
| 155 |
| 150 bool CandidatesAllocationDone() const override { return allocation_done_; } | 156 bool CandidatesAllocationDone() const override { return allocation_done_; } |
| 151 | 157 |
| 152 int port_config_count() { return port_config_count_; } | 158 int port_config_count() { return port_config_count_; } |
| 153 | 159 |
| 154 const ServerAddresses& stun_servers() const { return stun_servers_; } | 160 const ServerAddresses& stun_servers() const { return stun_servers_; } |
| 155 | 161 |
| 156 const std::vector<RelayServerConfig>& turn_servers() const { | 162 const std::vector<RelayServerConfig>& turn_servers() const { |
| 157 return turn_servers_; | 163 return turn_servers_; |
| 158 } | 164 } |
| 159 | 165 |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 211 rtc::PacketSocketFactory* factory) | 217 rtc::PacketSocketFactory* factory) |
| 212 : worker_thread_(worker_thread), factory_(factory) { | 218 : worker_thread_(worker_thread), factory_(factory) { |
| 213 if (factory_ == NULL) { | 219 if (factory_ == NULL) { |
| 214 owned_factory_.reset(new rtc::BasicPacketSocketFactory(worker_thread_)); | 220 owned_factory_.reset(new rtc::BasicPacketSocketFactory(worker_thread_)); |
| 215 factory_ = owned_factory_.get(); | 221 factory_ = owned_factory_.get(); |
| 216 } | 222 } |
| 217 } | 223 } |
| 218 | 224 |
| 219 void SetNetworkIgnoreMask(int network_ignore_mask) override {} | 225 void SetNetworkIgnoreMask(int network_ignore_mask) override {} |
| 220 | 226 |
| 227 rtc::NetworkManager* network_manager() const override { return nullptr; } |
| 228 |
| 221 cricket::PortAllocatorSession* CreateSessionInternal( | 229 cricket::PortAllocatorSession* CreateSessionInternal( |
| 222 const std::string& content_name, | 230 const std::string& content_name, |
| 223 int component, | 231 int component, |
| 224 const std::string& ice_ufrag, | 232 const std::string& ice_ufrag, |
| 225 const std::string& ice_pwd) override { | 233 const std::string& ice_pwd) override { |
| 226 return new FakePortAllocatorSession(this, worker_thread_, factory_, | 234 return new FakePortAllocatorSession(this, worker_thread_, factory_, |
| 227 content_name, component, ice_ufrag, | 235 content_name, component, ice_ufrag, |
| 228 ice_pwd); | 236 ice_pwd); |
| 229 } | 237 } |
| 230 | 238 |
| 231 private: | 239 private: |
| 232 rtc::Thread* worker_thread_; | 240 rtc::Thread* worker_thread_; |
| 233 rtc::PacketSocketFactory* factory_; | 241 rtc::PacketSocketFactory* factory_; |
| 234 std::unique_ptr<rtc::BasicPacketSocketFactory> owned_factory_; | 242 std::unique_ptr<rtc::BasicPacketSocketFactory> owned_factory_; |
| 235 }; | 243 }; |
| 236 | 244 |
| 237 } // namespace cricket | 245 } // namespace cricket |
| 238 | 246 |
| 239 #endif // WEBRTC_P2P_BASE_FAKEPORTALLOCATOR_H_ | 247 #endif // WEBRTC_P2P_BASE_FAKEPORTALLOCATOR_H_ |
| OLD | NEW |