Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright 2015 The WebRTC Project Authors. All rights reserved. | 2 * Copyright 2015 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_TRANSPORTCONTROLLER_H_ | 11 #ifndef WEBRTC_P2P_BASE_TRANSPORTCONTROLLER_H_ |
| 12 #define WEBRTC_P2P_BASE_TRANSPORTCONTROLLER_H_ | 12 #define WEBRTC_P2P_BASE_TRANSPORTCONTROLLER_H_ |
| 13 | 13 |
| 14 #include <map> | 14 #include <map> |
| 15 #include <string> | 15 #include <string> |
| 16 #include <vector> | 16 #include <vector> |
| 17 | 17 |
| 18 #include "webrtc/base/asyncinvoker.h" | 18 #include "webrtc/base/asyncinvoker.h" |
| 19 #include "webrtc/base/sigslot.h" | 19 #include "webrtc/base/sigslot.h" |
| 20 #include "webrtc/base/sslstreamadapter.h" | 20 #include "webrtc/base/sslstreamadapter.h" |
| 21 #include "webrtc/p2p/base/candidate.h" | 21 #include "webrtc/p2p/base/candidate.h" |
| 22 #include "webrtc/p2p/base/transport.h" | 22 #include "webrtc/p2p/base/transport.h" |
| 23 | 23 |
| 24 namespace rtc { | 24 namespace rtc { |
| 25 class Thread; | 25 class Thread; |
| 26 } | 26 } |
| 27 | 27 |
| 28 namespace cricket { | 28 namespace cricket { |
| 29 | 29 |
| 30 class P2PTransportChannel; | |
| 31 class QuicTransportChannel; | |
| 32 | |
| 30 class TransportController : public sigslot::has_slots<>, | 33 class TransportController : public sigslot::has_slots<>, |
| 31 public rtc::MessageHandler { | 34 public rtc::MessageHandler { |
| 32 public: | 35 public: |
| 33 TransportController(rtc::Thread* signaling_thread, | 36 TransportController(rtc::Thread* signaling_thread, |
| 34 rtc::Thread* worker_thread, | 37 rtc::Thread* worker_thread, |
| 35 PortAllocator* port_allocator); | 38 PortAllocator* port_allocator); |
| 36 | 39 |
| 37 virtual ~TransportController(); | 40 virtual ~TransportController(); |
| 38 | 41 |
| 39 rtc::Thread* signaling_thread() const { return signaling_thread_; } | 42 rtc::Thread* signaling_thread() const { return signaling_thread_; } |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 82 // Creates a channel if it doesn't exist. Otherwise, increments a reference | 85 // Creates a channel if it doesn't exist. Otherwise, increments a reference |
| 83 // count and returns an existing channel. | 86 // count and returns an existing channel. |
| 84 virtual TransportChannel* CreateTransportChannel_w( | 87 virtual TransportChannel* CreateTransportChannel_w( |
| 85 const std::string& transport_name, | 88 const std::string& transport_name, |
| 86 int component); | 89 int component); |
| 87 | 90 |
| 88 // Decrements a channel's reference count, and destroys the channel if | 91 // Decrements a channel's reference count, and destroys the channel if |
| 89 // nothing is referencing it. | 92 // nothing is referencing it. |
| 90 virtual void DestroyTransportChannel_w(const std::string& transport_name, | 93 virtual void DestroyTransportChannel_w(const std::string& transport_name, |
| 91 int component); | 94 int component); |
| 95 // Activates QUIC usage instead of DTLS if |use_quic| is true and the USE_QUIC | |
| 96 // macro is defined. | |
|
pthatcher1
2016/03/30 20:34:50
Just say "if USE_QUIC is defined"
mikescarlett
2016/04/05 19:58:53
I made this simpler by putting it behind HAVE_QUIC
| |
| 97 void set_quic(bool use_quic); | |
| 98 bool quic() const { return quic_; } | |
| 99 QuicTransportChannel* quic_transport_channel() const; | |
|
pthatcher1
2016/03/30 20:34:50
Doesn't this need to be behind USE_QUIC?
mikescarlett
2016/04/05 19:58:53
Yes. Done. (Also removed quic_transport_channel()
| |
| 92 | 100 |
| 93 // All of these signals are fired on the signalling thread. | 101 // All of these signals are fired on the signalling thread. |
| 94 | 102 |
| 95 // If any transport failed => failed, | 103 // If any transport failed => failed, |
| 96 // Else if all completed => completed, | 104 // Else if all completed => completed, |
| 97 // Else if all connected => connected, | 105 // Else if all connected => connected, |
| 98 // Else => connecting | 106 // Else => connecting |
| 99 sigslot::signal1<IceConnectionState> SignalConnectionState; | 107 sigslot::signal1<IceConnectionState> SignalConnectionState; |
| 100 | 108 |
| 101 // Receiving if any transport is receiving | 109 // Receiving if any transport is receiving |
| (...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 214 IceGatheringState gathering_state_ = kIceGatheringNew; | 222 IceGatheringState gathering_state_ = kIceGatheringNew; |
| 215 | 223 |
| 216 // TODO(deadbeef): Move the fields below down to the transports themselves | 224 // TODO(deadbeef): Move the fields below down to the transports themselves |
| 217 IceConfig ice_config_; | 225 IceConfig ice_config_; |
| 218 IceRole ice_role_ = ICEROLE_CONTROLLING; | 226 IceRole ice_role_ = ICEROLE_CONTROLLING; |
| 219 // Flag which will be set to true after the first role switch | 227 // Flag which will be set to true after the first role switch |
| 220 bool ice_role_switch_ = false; | 228 bool ice_role_switch_ = false; |
| 221 uint64_t ice_tiebreaker_ = rtc::CreateRandomId64(); | 229 uint64_t ice_tiebreaker_ = rtc::CreateRandomId64(); |
| 222 rtc::scoped_refptr<rtc::RTCCertificate> certificate_; | 230 rtc::scoped_refptr<rtc::RTCCertificate> certificate_; |
| 223 rtc::AsyncInvoker invoker_; | 231 rtc::AsyncInvoker invoker_; |
| 232 | |
| 233 // True if QUIC is used instead of DTLS. | |
| 234 bool quic_ = false; | |
| 235 #ifdef USE_QUIC | |
| 236 rtc::scoped_ptr<P2PTransportChannel> ice_transport_channel_; | |
| 237 // Owned by TransportController. This is not a scoped_ptr because its pointer | |
| 238 // is added to |transports_|. | |
| 239 QuicTransportChannel* quic_transport_channel_ = nullptr; | |
| 240 #endif // USE_QUIC | |
| 224 }; | 241 }; |
| 225 | 242 |
| 226 } // namespace cricket | 243 } // namespace cricket |
| 227 | 244 |
| 228 #endif // WEBRTC_P2P_BASE_TRANSPORTCONTROLLER_H_ | 245 #endif // WEBRTC_P2P_BASE_TRANSPORTCONTROLLER_H_ |
| OLD | NEW |