| 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 <memory> | 15 #include <memory> |
| 16 #include <string> | 16 #include <string> |
| 17 #include <vector> | 17 #include <vector> |
| 18 | 18 |
| 19 #include "webrtc/base/asyncinvoker.h" | 19 #include "webrtc/base/asyncinvoker.h" |
| 20 #include "webrtc/base/sigslot.h" | 20 #include "webrtc/base/sigslot.h" |
| 21 #include "webrtc/base/sslstreamadapter.h" | 21 #include "webrtc/base/sslstreamadapter.h" |
| 22 #include "webrtc/p2p/base/candidate.h" | 22 #include "webrtc/p2p/base/candidate.h" |
| 23 #include "webrtc/p2p/base/transport.h" | 23 #include "webrtc/p2p/base/transport.h" |
| 24 | 24 |
| 25 namespace rtc { | 25 namespace rtc { |
| 26 class Thread; | 26 class Thread; |
| 27 } | 27 } |
| 28 namespace webrtc { |
| 29 class MetricsObserverInterface; |
| 30 } |
| 28 | 31 |
| 29 namespace cricket { | 32 namespace cricket { |
| 30 | 33 |
| 31 class TransportController : public sigslot::has_slots<>, | 34 class TransportController : public sigslot::has_slots<>, |
| 32 public rtc::MessageHandler { | 35 public rtc::MessageHandler { |
| 33 public: | 36 public: |
| 34 // If |redetermine_role_on_ice_restart| is true, ICE role is redetermined | 37 // If |redetermine_role_on_ice_restart| is true, ICE role is redetermined |
| 35 // upon setting a local transport description that indicates an ICE restart. | 38 // upon setting a local transport description that indicates an ICE restart. |
| 36 // For the constructor that doesn't take this parameter, it defaults to true. | 39 // For the constructor that doesn't take this parameter, it defaults to true. |
| 37 TransportController(rtc::Thread* signaling_thread, | 40 TransportController(rtc::Thread* signaling_thread, |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 122 sigslot::signal2<const std::string&, const Candidates&> | 125 sigslot::signal2<const std::string&, const Candidates&> |
| 123 SignalCandidatesGathered; | 126 SignalCandidatesGathered; |
| 124 | 127 |
| 125 sigslot::signal1<const Candidates&> SignalCandidatesRemoved; | 128 sigslot::signal1<const Candidates&> SignalCandidatesRemoved; |
| 126 | 129 |
| 127 // for unit test | 130 // for unit test |
| 128 const rtc::scoped_refptr<rtc::RTCCertificate>& certificate_for_testing(); | 131 const rtc::scoped_refptr<rtc::RTCCertificate>& certificate_for_testing(); |
| 129 | 132 |
| 130 sigslot::signal1<rtc::SSLHandshakeError> SignalDtlsHandshakeError; | 133 sigslot::signal1<rtc::SSLHandshakeError> SignalDtlsHandshakeError; |
| 131 | 134 |
| 135 void SetMetricsObserver(webrtc::MetricsObserverInterface* metrics_observer); |
| 136 |
| 132 protected: | 137 protected: |
| 133 // Protected and virtual so we can override it in unit tests. | 138 // Protected and virtual so we can override it in unit tests. |
| 134 virtual Transport* CreateTransport_n(const std::string& transport_name); | 139 virtual Transport* CreateTransport_n(const std::string& transport_name); |
| 135 | 140 |
| 136 // For unit tests | 141 // For unit tests |
| 137 const std::map<std::string, Transport*>& transports() { return transports_; } | 142 const std::map<std::string, Transport*>& transports() { return transports_; } |
| 138 Transport* GetTransport_n(const std::string& transport_name); | 143 Transport* GetTransport_n(const std::string& transport_name); |
| 139 | 144 |
| 140 private: | 145 private: |
| 141 void OnMessage(rtc::Message* pmsg) override; | 146 void OnMessage(rtc::Message* pmsg) override; |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 231 | 236 |
| 232 // TODO(deadbeef): Move the fields below down to the transports themselves | 237 // TODO(deadbeef): Move the fields below down to the transports themselves |
| 233 IceConfig ice_config_; | 238 IceConfig ice_config_; |
| 234 IceRole ice_role_ = ICEROLE_CONTROLLING; | 239 IceRole ice_role_ = ICEROLE_CONTROLLING; |
| 235 bool redetermine_role_on_ice_restart_; | 240 bool redetermine_role_on_ice_restart_; |
| 236 uint64_t ice_tiebreaker_ = rtc::CreateRandomId64(); | 241 uint64_t ice_tiebreaker_ = rtc::CreateRandomId64(); |
| 237 rtc::scoped_refptr<rtc::RTCCertificate> certificate_; | 242 rtc::scoped_refptr<rtc::RTCCertificate> certificate_; |
| 238 rtc::AsyncInvoker invoker_; | 243 rtc::AsyncInvoker invoker_; |
| 239 // True if QUIC is used instead of DTLS. | 244 // True if QUIC is used instead of DTLS. |
| 240 bool quic_ = false; | 245 bool quic_ = false; |
| 246 |
| 247 webrtc::MetricsObserverInterface* metrics_observer_ = nullptr; |
| 241 }; | 248 }; |
| 242 | 249 |
| 243 } // namespace cricket | 250 } // namespace cricket |
| 244 | 251 |
| 245 #endif // WEBRTC_P2P_BASE_TRANSPORTCONTROLLER_H_ | 252 #endif // WEBRTC_P2P_BASE_TRANSPORTCONTROLLER_H_ |
| OLD | NEW |