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 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
207 // Returns the name of this transport. | 207 // Returns the name of this transport. |
208 const std::string& name() const { return name_; } | 208 const std::string& name() const { return name_; } |
209 | 209 |
210 // Returns the port allocator object for this transport. | 210 // Returns the port allocator object for this transport. |
211 PortAllocator* port_allocator() { return allocator_; } | 211 PortAllocator* port_allocator() { return allocator_; } |
212 | 212 |
213 bool ready_for_remote_candidates() const { | 213 bool ready_for_remote_candidates() const { |
214 return local_description_set_ && remote_description_set_; | 214 return local_description_set_ && remote_description_set_; |
215 } | 215 } |
216 | 216 |
217 // Returns whether the client has requested the channels to connect. | |
218 bool connect_requested() const { return connect_requested_; } | |
219 | |
220 void SetIceRole(IceRole role); | 217 void SetIceRole(IceRole role); |
221 IceRole ice_role() const { return ice_role_; } | 218 IceRole ice_role() const { return ice_role_; } |
222 | 219 |
223 void SetIceTiebreaker(uint64_t IceTiebreaker) { tiebreaker_ = IceTiebreaker; } | 220 void SetIceTiebreaker(uint64_t IceTiebreaker) { tiebreaker_ = IceTiebreaker; } |
224 uint64_t IceTiebreaker() { return tiebreaker_; } | 221 uint64_t IceTiebreaker() { return tiebreaker_; } |
225 | 222 |
226 void SetIceConfig(const IceConfig& config); | 223 void SetIceConfig(const IceConfig& config); |
227 | 224 |
228 // Must be called before applying local session description. | 225 // Must be called before applying local session description. |
229 virtual void SetLocalCertificate( | 226 virtual void SetLocalCertificate( |
(...skipping 23 matching lines...) Expand all Loading... |
253 // Set the local TransportDescription to be used by TransportChannels. | 250 // Set the local TransportDescription to be used by TransportChannels. |
254 bool SetLocalTransportDescription(const TransportDescription& description, | 251 bool SetLocalTransportDescription(const TransportDescription& description, |
255 ContentAction action, | 252 ContentAction action, |
256 std::string* error_desc); | 253 std::string* error_desc); |
257 | 254 |
258 // Set the remote TransportDescription to be used by TransportChannels. | 255 // Set the remote TransportDescription to be used by TransportChannels. |
259 bool SetRemoteTransportDescription(const TransportDescription& description, | 256 bool SetRemoteTransportDescription(const TransportDescription& description, |
260 ContentAction action, | 257 ContentAction action, |
261 std::string* error_desc); | 258 std::string* error_desc); |
262 | 259 |
263 // Tells all current and future channels to start connecting. | |
264 void ConnectChannels(); | |
265 | |
266 // Tells channels to start gathering candidates if necessary. | 260 // Tells channels to start gathering candidates if necessary. |
267 // Should be called after ConnectChannels() has been called at least once, | 261 // Should be called after ConnectChannels() has been called at least once, |
268 // which will happen in SetLocalTransportDescription. | 262 // which will happen in SetLocalTransportDescription. |
269 void MaybeStartGathering(); | 263 void MaybeStartGathering(); |
270 | 264 |
271 // Resets all of the channels back to their initial state. They are no | 265 // Resets all of the channels back to their initial state. They are no |
272 // longer connecting. | 266 // longer connecting. |
273 void ResetChannels(); | 267 void ResetChannels(); |
274 | 268 |
275 // Destroys every channel created so far. | 269 // Destroys every channel created so far. |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
357 // Candidate component => TransportChannelImpl* | 351 // Candidate component => TransportChannelImpl* |
358 typedef std::map<int, TransportChannelImpl*> ChannelMap; | 352 typedef std::map<int, TransportChannelImpl*> ChannelMap; |
359 | 353 |
360 // Helper function that invokes the given function on every channel. | 354 // Helper function that invokes the given function on every channel. |
361 typedef void (TransportChannelImpl::* TransportChannelFunc)(); | 355 typedef void (TransportChannelImpl::* TransportChannelFunc)(); |
362 void CallChannels(TransportChannelFunc func); | 356 void CallChannels(TransportChannelFunc func); |
363 | 357 |
364 const std::string name_; | 358 const std::string name_; |
365 PortAllocator* const allocator_; | 359 PortAllocator* const allocator_; |
366 bool channels_destroyed_ = false; | 360 bool channels_destroyed_ = false; |
367 bool connect_requested_ = false; | |
368 IceRole ice_role_ = ICEROLE_UNKNOWN; | 361 IceRole ice_role_ = ICEROLE_UNKNOWN; |
369 uint64_t tiebreaker_ = 0; | 362 uint64_t tiebreaker_ = 0; |
370 IceMode remote_ice_mode_ = ICEMODE_FULL; | 363 IceMode remote_ice_mode_ = ICEMODE_FULL; |
371 IceConfig ice_config_; | 364 IceConfig ice_config_; |
372 std::unique_ptr<TransportDescription> local_description_; | 365 std::unique_ptr<TransportDescription> local_description_; |
373 std::unique_ptr<TransportDescription> remote_description_; | 366 std::unique_ptr<TransportDescription> remote_description_; |
374 bool local_description_set_ = false; | 367 bool local_description_set_ = false; |
375 bool remote_description_set_ = false; | 368 bool remote_description_set_ = false; |
376 | 369 |
377 ChannelMap channels_; | 370 ChannelMap channels_; |
378 | 371 |
379 RTC_DISALLOW_COPY_AND_ASSIGN(Transport); | 372 RTC_DISALLOW_COPY_AND_ASSIGN(Transport); |
380 }; | 373 }; |
381 | 374 |
382 | 375 |
383 } // namespace cricket | 376 } // namespace cricket |
384 | 377 |
385 #endif // WEBRTC_P2P_BASE_TRANSPORT_H_ | 378 #endif // WEBRTC_P2P_BASE_TRANSPORT_H_ |
OLD | NEW |