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 |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
96 ice_ufrag, | 96 ice_ufrag, |
97 ice_pwd, | 97 ice_pwd, |
98 allocator->flags()), | 98 allocator->flags()), |
99 worker_thread_(worker_thread), | 99 worker_thread_(worker_thread), |
100 factory_(factory), | 100 factory_(factory), |
101 network_("network", "unittest", rtc::IPAddress(INADDR_LOOPBACK), 8), | 101 network_("network", "unittest", rtc::IPAddress(INADDR_LOOPBACK), 8), |
102 port_(), | 102 port_(), |
103 running_(false), | 103 running_(false), |
104 port_config_count_(0), | 104 port_config_count_(0), |
105 stun_servers_(allocator->stun_servers()), | 105 stun_servers_(allocator->stun_servers()), |
106 turn_servers_(allocator->turn_servers()), | 106 turn_servers_(allocator->turn_servers()) { |
107 candidate_filter_(allocator->candidate_filter()) { | |
108 network_.AddIP(rtc::IPAddress(INADDR_LOOPBACK)); | 107 network_.AddIP(rtc::IPAddress(INADDR_LOOPBACK)); |
109 } | 108 } |
110 | 109 |
| 110 void SetCandidateFilter(uint32_t filter) override { |
| 111 candidate_filter_ = filter; |
| 112 } |
| 113 |
111 void StartGettingPorts() override { | 114 void StartGettingPorts() override { |
112 if (!port_) { | 115 if (!port_) { |
113 port_.reset(TestUDPPort::Create(worker_thread_, factory_, &network_, | 116 port_.reset(TestUDPPort::Create(worker_thread_, factory_, &network_, |
114 network_.GetBestIP(), 0, 0, username(), | 117 network_.GetBestIP(), 0, 0, username(), |
115 password(), std::string(), false)); | 118 password(), std::string(), false)); |
116 AddPort(port_.get()); | 119 AddPort(port_.get()); |
117 } | 120 } |
118 ++port_config_count_; | 121 ++port_config_count_; |
119 running_ = true; | 122 running_ = true; |
120 } | 123 } |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
174 rtc::PacketSocketFactory* factory_; | 177 rtc::PacketSocketFactory* factory_; |
175 rtc::Network network_; | 178 rtc::Network network_; |
176 std::unique_ptr<cricket::Port> port_; | 179 std::unique_ptr<cricket::Port> port_; |
177 bool running_; | 180 bool running_; |
178 int port_config_count_; | 181 int port_config_count_; |
179 std::vector<Candidate> candidates_; | 182 std::vector<Candidate> candidates_; |
180 std::vector<PortInterface*> ready_ports_; | 183 std::vector<PortInterface*> ready_ports_; |
181 bool allocation_done_ = false; | 184 bool allocation_done_ = false; |
182 ServerAddresses stun_servers_; | 185 ServerAddresses stun_servers_; |
183 std::vector<RelayServerConfig> turn_servers_; | 186 std::vector<RelayServerConfig> turn_servers_; |
184 uint32_t candidate_filter_; | 187 uint32_t candidate_filter_ = CF_ALL; |
185 int transport_info_update_count_ = 0; | 188 int transport_info_update_count_ = 0; |
186 }; | 189 }; |
187 | 190 |
188 class FakePortAllocator : public cricket::PortAllocator { | 191 class FakePortAllocator : public cricket::PortAllocator { |
189 public: | 192 public: |
190 FakePortAllocator(rtc::Thread* worker_thread, | 193 FakePortAllocator(rtc::Thread* worker_thread, |
191 rtc::PacketSocketFactory* factory) | 194 rtc::PacketSocketFactory* factory) |
192 : worker_thread_(worker_thread), factory_(factory) { | 195 : worker_thread_(worker_thread), factory_(factory) { |
193 if (factory_ == NULL) { | 196 if (factory_ == NULL) { |
194 owned_factory_.reset(new rtc::BasicPacketSocketFactory(worker_thread_)); | 197 owned_factory_.reset(new rtc::BasicPacketSocketFactory(worker_thread_)); |
(...skipping 15 matching lines...) Expand all Loading... |
210 | 213 |
211 private: | 214 private: |
212 rtc::Thread* worker_thread_; | 215 rtc::Thread* worker_thread_; |
213 rtc::PacketSocketFactory* factory_; | 216 rtc::PacketSocketFactory* factory_; |
214 std::unique_ptr<rtc::BasicPacketSocketFactory> owned_factory_; | 217 std::unique_ptr<rtc::BasicPacketSocketFactory> owned_factory_; |
215 }; | 218 }; |
216 | 219 |
217 } // namespace cricket | 220 } // namespace cricket |
218 | 221 |
219 #endif // WEBRTC_P2P_BASE_FAKEPORTALLOCATOR_H_ | 222 #endif // WEBRTC_P2P_BASE_FAKEPORTALLOCATOR_H_ |
OLD | NEW |