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 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
171 Connection* FindNextPingableConnection(); | 171 Connection* FindNextPingableConnection(); |
172 | 172 |
173 // Public for unit tests. | 173 // Public for unit tests. |
174 const std::vector<Connection*>& connections() const { return connections_; } | 174 const std::vector<Connection*>& connections() const { return connections_; } |
175 | 175 |
176 // Public for unit tests. | 176 // Public for unit tests. |
177 PortAllocatorSession* allocator_session() { | 177 PortAllocatorSession* allocator_session() { |
178 return allocator_sessions_.back(); | 178 return allocator_sessions_.back(); |
179 } | 179 } |
180 | 180 |
| 181 // Public for unit tests. |
| 182 const std::vector<RemoteCandidate>& remote_candidates() const { |
| 183 return remote_candidates_; |
| 184 } |
| 185 |
181 private: | 186 private: |
182 rtc::Thread* thread() { return worker_thread_; } | 187 rtc::Thread* thread() { return worker_thread_; } |
183 bool IsGettingPorts() { return allocator_session()->IsGettingPorts(); } | 188 bool IsGettingPorts() { return allocator_session()->IsGettingPorts(); } |
184 | 189 |
185 // A transport channel is weak if the current best connection is either | 190 // A transport channel is weak if the current best connection is either |
186 // not receiving or not writable, or if there is no best connection at all. | 191 // not receiving or not writable, or if there is no best connection at all. |
187 bool weak() const; | 192 bool weak() const; |
188 void UpdateConnectionStates(); | 193 void UpdateConnectionStates(); |
189 void RequestSort(); | 194 void RequestSort(); |
190 void SortConnections(); | 195 void SortConnections(); |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
240 void PruneConnections(); | 245 void PruneConnections(); |
241 Connection* best_nominated_connection() const; | 246 Connection* best_nominated_connection() const; |
242 bool IsBackupConnection(Connection* conn) const; | 247 bool IsBackupConnection(Connection* conn) const; |
243 | 248 |
244 // Returns the latest remote ICE parameters or nullptr if there are no remote | 249 // Returns the latest remote ICE parameters or nullptr if there are no remote |
245 // ICE parameters yet. | 250 // ICE parameters yet. |
246 IceParameters* remote_ice() { | 251 IceParameters* remote_ice() { |
247 return remote_ice_parameters_.empty() ? nullptr | 252 return remote_ice_parameters_.empty() ? nullptr |
248 : &remote_ice_parameters_.back(); | 253 : &remote_ice_parameters_.back(); |
249 } | 254 } |
| 255 // Returns the remote IceParameters and generation that match |ufrag| |
| 256 // if found, and returns nullptr otherwise. |
| 257 const IceParameters* FindRemoteIceFromUfrag(const std::string& ufrag, |
| 258 uint32_t* generation); |
250 // Returns the index of the latest remote ICE parameters, or 0 if no remote | 259 // Returns the index of the latest remote ICE parameters, or 0 if no remote |
251 // ICE parameters have been received. | 260 // ICE parameters have been received. |
252 uint32_t remote_ice_generation() { | 261 uint32_t remote_ice_generation() { |
253 return remote_ice_parameters_.empty() | 262 return remote_ice_parameters_.empty() |
254 ? 0 | 263 ? 0 |
255 : static_cast<uint32_t>(remote_ice_parameters_.size() - 1); | 264 : static_cast<uint32_t>(remote_ice_parameters_.size() - 1); |
256 } | 265 } |
257 | 266 |
258 P2PTransport* transport_; | 267 P2PTransport* transport_; |
259 PortAllocator* allocator_; | 268 PortAllocator* allocator_; |
(...skipping 27 matching lines...) Expand all Loading... |
287 bool gather_continually_ = false; | 296 bool gather_continually_ = false; |
288 int weak_ping_delay_ = WEAK_PING_DELAY; | 297 int weak_ping_delay_ = WEAK_PING_DELAY; |
289 TransportChannelState state_ = TransportChannelState::STATE_INIT; | 298 TransportChannelState state_ = TransportChannelState::STATE_INIT; |
290 | 299 |
291 RTC_DISALLOW_COPY_AND_ASSIGN(P2PTransportChannel); | 300 RTC_DISALLOW_COPY_AND_ASSIGN(P2PTransportChannel); |
292 }; | 301 }; |
293 | 302 |
294 } // namespace cricket | 303 } // namespace cricket |
295 | 304 |
296 #endif // WEBRTC_P2P_BASE_P2PTRANSPORTCHANNEL_H_ | 305 #endif // WEBRTC_P2P_BASE_P2PTRANSPORTCHANNEL_H_ |
OLD | NEW |