| 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 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 210 FakePortAllocator(rtc::Thread* worker_thread, | 211 FakePortAllocator(rtc::Thread* worker_thread, |
| 211 rtc::PacketSocketFactory* factory) | 212 rtc::PacketSocketFactory* factory) |
| 212 : worker_thread_(worker_thread), factory_(factory) { | 213 : worker_thread_(worker_thread), factory_(factory) { |
| 213 if (factory_ == NULL) { | 214 if (factory_ == NULL) { |
| 214 owned_factory_.reset(new rtc::BasicPacketSocketFactory(worker_thread_)); | 215 owned_factory_.reset(new rtc::BasicPacketSocketFactory(worker_thread_)); |
| 215 factory_ = owned_factory_.get(); | 216 factory_ = owned_factory_.get(); |
| 216 } | 217 } |
| 217 } | 218 } |
| 218 | 219 |
| 219 void SetNetworkIgnoreMask(int network_ignore_mask) override {} | 220 void SetNetworkIgnoreMask(int network_ignore_mask) override {} |
| 221 void GetNetworks(std::vector<rtc::Network*>* networks) const override {} |
| 220 | 222 |
| 221 cricket::PortAllocatorSession* CreateSessionInternal( | 223 cricket::PortAllocatorSession* CreateSessionInternal( |
| 222 const std::string& content_name, | 224 const std::string& content_name, |
| 223 int component, | 225 int component, |
| 224 const std::string& ice_ufrag, | 226 const std::string& ice_ufrag, |
| 225 const std::string& ice_pwd) override { | 227 const std::string& ice_pwd) override { |
| 226 return new FakePortAllocatorSession(this, worker_thread_, factory_, | 228 return new FakePortAllocatorSession(this, worker_thread_, factory_, |
| 227 content_name, component, ice_ufrag, | 229 content_name, component, ice_ufrag, |
| 228 ice_pwd); | 230 ice_pwd); |
| 229 } | 231 } |
| 230 | 232 |
| 231 private: | 233 private: |
| 232 rtc::Thread* worker_thread_; | 234 rtc::Thread* worker_thread_; |
| 233 rtc::PacketSocketFactory* factory_; | 235 rtc::PacketSocketFactory* factory_; |
| 234 std::unique_ptr<rtc::BasicPacketSocketFactory> owned_factory_; | 236 std::unique_ptr<rtc::BasicPacketSocketFactory> owned_factory_; |
| 235 }; | 237 }; |
| 236 | 238 |
| 237 } // namespace cricket | 239 } // namespace cricket |
| 238 | 240 |
| 239 #endif // WEBRTC_P2P_BASE_FAKEPORTALLOCATOR_H_ | 241 #endif // WEBRTC_P2P_BASE_FAKEPORTALLOCATOR_H_ |
| OLD | NEW |