zhihuang | 86abd6f | 2016-12-19 11:54:05 -0800 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2016 The WebRTC Project Authors. All rights reserved. |
| 3 | * |
| 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 |
| 6 | * tree. An additional intellectual property rights grant can be found |
| 7 | * in the file PATENTS. All contributing project authors may |
| 8 | * be found in the AUTHORS file in the root of the source tree. |
| 9 | */ |
| 10 | |
Steve Anton | 10542f2 | 2019-01-11 09:11:00 -0800 | [diff] [blame] | 11 | #ifndef P2P_BASE_ICE_TRANSPORT_INTERNAL_H_ |
| 12 | #define P2P_BASE_ICE_TRANSPORT_INTERNAL_H_ |
zhihuang | 86abd6f | 2016-12-19 11:54:05 -0800 | [diff] [blame] | 13 | |
Yves Gerey | 3e70781 | 2018-11-28 16:47:49 +0100 | [diff] [blame] | 14 | #include <stdint.h> |
Jonas Olsson | a4d8737 | 2019-07-05 19:08:33 +0200 | [diff] [blame] | 15 | |
zhihuang | 86abd6f | 2016-12-19 11:54:05 -0800 | [diff] [blame] | 16 | #include <string> |
Taylor Brandstetter | 6e2e7ce | 2017-12-19 10:26:23 -0800 | [diff] [blame] | 17 | #include <vector> |
zhihuang | 86abd6f | 2016-12-19 11:54:05 -0800 | [diff] [blame] | 18 | |
Yves Gerey | 3e70781 | 2018-11-28 16:47:49 +0100 | [diff] [blame] | 19 | #include "absl/types/optional.h" |
Patrik Höglund | e2d6a06 | 2017-10-05 14:53:33 +0200 | [diff] [blame] | 20 | #include "api/candidate.h" |
Jonas Olsson | 81125f0 | 2018-10-09 10:52:04 +0200 | [diff] [blame] | 21 | #include "api/transport/enums.h" |
Jonas Oreland | e8e7d7b | 2019-05-29 09:30:55 +0200 | [diff] [blame] | 22 | #include "p2p/base/connection.h" |
Steve Anton | 10542f2 | 2019-01-11 09:11:00 -0800 | [diff] [blame] | 23 | #include "p2p/base/packet_transport_internal.h" |
Taylor Brandstetter | 6e2e7ce | 2017-12-19 10:26:23 -0800 | [diff] [blame] | 24 | #include "p2p/base/port.h" |
Steve Anton | 10542f2 | 2019-01-11 09:11:00 -0800 | [diff] [blame] | 25 | #include "p2p/base/transport_description.h" |
Yves Gerey | 3e70781 | 2018-11-28 16:47:49 +0100 | [diff] [blame] | 26 | #include "rtc_base/network_constants.h" |
Mirko Bonadei | ac19414 | 2018-10-22 17:08:37 +0200 | [diff] [blame] | 27 | #include "rtc_base/system/rtc_export.h" |
Yves Gerey | 3e70781 | 2018-11-28 16:47:49 +0100 | [diff] [blame] | 28 | #include "rtc_base/third_party/sigslot/sigslot.h" |
Steve Anton | 10542f2 | 2019-01-11 09:11:00 -0800 | [diff] [blame] | 29 | #include "rtc_base/time_utils.h" |
zhihuang | 86abd6f | 2016-12-19 11:54:05 -0800 | [diff] [blame] | 30 | |
zhihuang | 86abd6f | 2016-12-19 11:54:05 -0800 | [diff] [blame] | 31 | namespace cricket { |
| 32 | |
Jonas Oreland | 149dc72 | 2019-08-28 08:10:27 +0200 | [diff] [blame] | 33 | struct IceTransportStats { |
| 34 | CandidateStatsList candidate_stats_list; |
| 35 | ConnectionInfos connection_infos; |
| 36 | // Number of times the selected candidate pair has changed |
| 37 | // Initially 0 and 1 once the first candidate pair has been selected. |
| 38 | // The counter is increase also when "unselecting" a connection. |
| 39 | uint32_t selected_candidate_pair_changes = 0; |
| 40 | }; |
| 41 | |
Taylor Brandstetter | 6e2e7ce | 2017-12-19 10:26:23 -0800 | [diff] [blame] | 42 | typedef std::vector<Candidate> Candidates; |
| 43 | |
Alex Loiko | 9289eda | 2018-11-23 16:18:59 +0000 | [diff] [blame] | 44 | enum IceConnectionState { |
| 45 | kIceConnectionConnecting = 0, |
| 46 | kIceConnectionFailed, |
| 47 | kIceConnectionConnected, // Writable, but still checking one or more |
| 48 | // connections |
| 49 | kIceConnectionCompleted, |
| 50 | }; |
| 51 | |
Taylor Brandstetter | 6e2e7ce | 2017-12-19 10:26:23 -0800 | [diff] [blame] | 52 | // TODO(deadbeef): Unify with PeerConnectionInterface::IceConnectionState |
| 53 | // once /talk/ and /webrtc/ are combined, and also switch to ENUM_NAME naming |
| 54 | // style. |
| 55 | enum IceGatheringState { |
| 56 | kIceGatheringNew = 0, |
| 57 | kIceGatheringGathering, |
| 58 | kIceGatheringComplete, |
| 59 | }; |
| 60 | |
| 61 | enum ContinualGatheringPolicy { |
| 62 | // All port allocator sessions will stop after a writable connection is found. |
| 63 | GATHER_ONCE = 0, |
| 64 | // The most recent port allocator session will keep on running. |
| 65 | GATHER_CONTINUALLY, |
Taylor Brandstetter | 6e2e7ce | 2017-12-19 10:26:23 -0800 | [diff] [blame] | 66 | }; |
| 67 | |
| 68 | // ICE Nomination mode. |
| 69 | enum class NominationMode { |
| 70 | REGULAR, // Nominate once per ICE restart (Not implemented yet). |
| 71 | AGGRESSIVE, // Nominate every connection except that it will behave as if |
| 72 | // REGULAR when the remote is an ICE-LITE endpoint. |
| 73 | SEMI_AGGRESSIVE // Our current implementation of the nomination algorithm. |
| 74 | // The details are described in P2PTransportChannel. |
| 75 | }; |
| 76 | |
| 77 | // Information about ICE configuration. |
Danil Chapovalov | 00c7183 | 2018-06-15 15:58:38 +0200 | [diff] [blame] | 78 | // TODO(deadbeef): Use absl::optional to represent unset values, instead of |
Taylor Brandstetter | 6e2e7ce | 2017-12-19 10:26:23 -0800 | [diff] [blame] | 79 | // -1. |
| 80 | struct IceConfig { |
| 81 | // The ICE connection receiving timeout value in milliseconds. |
Danil Chapovalov | 00c7183 | 2018-06-15 15:58:38 +0200 | [diff] [blame] | 82 | absl::optional<int> receiving_timeout; |
Taylor Brandstetter | 6e2e7ce | 2017-12-19 10:26:23 -0800 | [diff] [blame] | 83 | // Time interval in milliseconds to ping a backup connection when the ICE |
| 84 | // channel is strongly connected. |
Danil Chapovalov | 00c7183 | 2018-06-15 15:58:38 +0200 | [diff] [blame] | 85 | absl::optional<int> backup_connection_ping_interval; |
Taylor Brandstetter | 6e2e7ce | 2017-12-19 10:26:23 -0800 | [diff] [blame] | 86 | |
| 87 | ContinualGatheringPolicy continual_gathering_policy = GATHER_ONCE; |
| 88 | |
| 89 | bool gather_continually() const { |
Qingsi Wang | 241d0c1 | 2018-06-05 16:44:10 -0700 | [diff] [blame] | 90 | return continual_gathering_policy == GATHER_CONTINUALLY; |
Taylor Brandstetter | 6e2e7ce | 2017-12-19 10:26:23 -0800 | [diff] [blame] | 91 | } |
| 92 | |
| 93 | // Whether we should prioritize Relay/Relay candidate when nothing |
| 94 | // is writable yet. |
| 95 | bool prioritize_most_likely_candidate_pairs = false; |
| 96 | |
| 97 | // Writable connections are pinged at a slower rate once stablized. |
Danil Chapovalov | 00c7183 | 2018-06-15 15:58:38 +0200 | [diff] [blame] | 98 | absl::optional<int> stable_writable_connection_ping_interval; |
Taylor Brandstetter | 6e2e7ce | 2017-12-19 10:26:23 -0800 | [diff] [blame] | 99 | |
| 100 | // If set to true, this means the ICE transport should presume TURN-to-TURN |
| 101 | // candidate pairs will succeed, even before a binding response is received. |
| 102 | bool presume_writable_when_fully_relayed = false; |
| 103 | |
Qingsi Wang | 1fe119f | 2019-05-31 16:55:33 -0700 | [diff] [blame] | 104 | // If true, after the ICE transport type (as the candidate filter used by the |
| 105 | // port allocator) is changed such that new types of ICE candidates are |
| 106 | // allowed by the new filter, e.g. from CF_RELAY to CF_ALL, candidates that |
| 107 | // have been gathered by the ICE transport but filtered out and not signaled |
| 108 | // to the upper layers, will be surfaced. |
| 109 | bool surface_ice_candidates_on_ice_transport_type_changed = false; |
| 110 | |
Taylor Brandstetter | 6e2e7ce | 2017-12-19 10:26:23 -0800 | [diff] [blame] | 111 | // Interval to check on all networks and to perform ICE regathering on any |
| 112 | // active network having no connection on it. |
Danil Chapovalov | 00c7183 | 2018-06-15 15:58:38 +0200 | [diff] [blame] | 113 | absl::optional<int> regather_on_failed_networks_interval; |
Taylor Brandstetter | 6e2e7ce | 2017-12-19 10:26:23 -0800 | [diff] [blame] | 114 | |
| 115 | // Interval to perform ICE regathering on all networks |
| 116 | // The delay in milliseconds is sampled from the uniform distribution [a, b] |
Danil Chapovalov | 00c7183 | 2018-06-15 15:58:38 +0200 | [diff] [blame] | 117 | absl::optional<rtc::IntervalRange> regather_all_networks_interval_range; |
Taylor Brandstetter | 6e2e7ce | 2017-12-19 10:26:23 -0800 | [diff] [blame] | 118 | |
| 119 | // The time period in which we will not switch the selected connection |
| 120 | // when a new connection becomes receiving but the selected connection is not |
| 121 | // in case that the selected connection may become receiving soon. |
Danil Chapovalov | 00c7183 | 2018-06-15 15:58:38 +0200 | [diff] [blame] | 122 | absl::optional<int> receiving_switching_delay; |
Taylor Brandstetter | 6e2e7ce | 2017-12-19 10:26:23 -0800 | [diff] [blame] | 123 | |
| 124 | // TODO(honghaiz): Change the default to regular nomination. |
| 125 | // Default nomination mode if the remote does not support renomination. |
| 126 | NominationMode default_nomination_mode = NominationMode::SEMI_AGGRESSIVE; |
| 127 | |
Qingsi Wang | e6826d2 | 2018-03-08 14:55:14 -0800 | [diff] [blame] | 128 | // The interval in milliseconds at which ICE checks (STUN pings) will be sent |
| 129 | // for a candidate pair when it is both writable and receiving (strong |
| 130 | // connectivity). This parameter overrides the default value given by |
| 131 | // |STRONG_PING_INTERVAL| in p2ptransport.h if set. |
Danil Chapovalov | 00c7183 | 2018-06-15 15:58:38 +0200 | [diff] [blame] | 132 | absl::optional<int> ice_check_interval_strong_connectivity; |
Qingsi Wang | e6826d2 | 2018-03-08 14:55:14 -0800 | [diff] [blame] | 133 | // The interval in milliseconds at which ICE checks (STUN pings) will be sent |
| 134 | // for a candidate pair when it is either not writable or not receiving (weak |
| 135 | // connectivity). This parameter overrides the default value given by |
| 136 | // |WEAK_PING_INTERVAL| in p2ptransport.h if set. |
Danil Chapovalov | 00c7183 | 2018-06-15 15:58:38 +0200 | [diff] [blame] | 137 | absl::optional<int> ice_check_interval_weak_connectivity; |
Taylor Brandstetter | 6e2e7ce | 2017-12-19 10:26:23 -0800 | [diff] [blame] | 138 | // ICE checks (STUN pings) will not be sent at higher rate (lower interval) |
| 139 | // than this, no matter what other settings there are. |
| 140 | // Measure in milliseconds. |
Qingsi Wang | e6826d2 | 2018-03-08 14:55:14 -0800 | [diff] [blame] | 141 | // |
| 142 | // Note that this parameter overrides both the above check intervals for |
| 143 | // candidate pairs with strong or weak connectivity, if either of the above |
| 144 | // interval is shorter than the min interval. |
Danil Chapovalov | 00c7183 | 2018-06-15 15:58:38 +0200 | [diff] [blame] | 145 | absl::optional<int> ice_check_min_interval; |
Qingsi Wang | 22e623a | 2018-03-13 10:53:57 -0700 | [diff] [blame] | 146 | // The min time period for which a candidate pair must wait for response to |
| 147 | // connectivity checks before it becomes unwritable. This parameter |
| 148 | // overrides the default value given by |CONNECTION_WRITE_CONNECT_TIMEOUT| |
| 149 | // in port.h if set, when determining the writability of a candidate pair. |
Danil Chapovalov | 00c7183 | 2018-06-15 15:58:38 +0200 | [diff] [blame] | 150 | absl::optional<int> ice_unwritable_timeout; |
Qingsi Wang | 22e623a | 2018-03-13 10:53:57 -0700 | [diff] [blame] | 151 | |
| 152 | // The min number of connectivity checks that a candidate pair must sent |
| 153 | // without receiving response before it becomes unwritable. This parameter |
| 154 | // overrides the default value given by |CONNECTION_WRITE_CONNECT_FAILURES| in |
| 155 | // port.h if set, when determining the writability of a candidate pair. |
Danil Chapovalov | 00c7183 | 2018-06-15 15:58:38 +0200 | [diff] [blame] | 156 | absl::optional<int> ice_unwritable_min_checks; |
Jiawei Ou | 9d4fd555 | 2018-12-06 23:30:17 -0800 | [diff] [blame] | 157 | |
| 158 | // The min time period for which a candidate pair must wait for response to |
| 159 | // connectivity checks it becomes inactive. This parameter overrides the |
| 160 | // default value given by |CONNECTION_WRITE_TIMEOUT| in port.h if set, when |
| 161 | // determining the writability of a candidate pair. |
| 162 | absl::optional<int> ice_inactive_timeout; |
| 163 | |
Qingsi Wang | db53f8e | 2018-02-20 14:45:49 -0800 | [diff] [blame] | 164 | // The interval in milliseconds at which STUN candidates will resend STUN |
| 165 | // binding requests to keep NAT bindings open. |
Danil Chapovalov | 00c7183 | 2018-06-15 15:58:38 +0200 | [diff] [blame] | 166 | absl::optional<int> stun_keepalive_interval; |
Taylor Brandstetter | 6e2e7ce | 2017-12-19 10:26:23 -0800 | [diff] [blame] | 167 | |
Danil Chapovalov | 00c7183 | 2018-06-15 15:58:38 +0200 | [diff] [blame] | 168 | absl::optional<rtc::AdapterType> network_preference; |
Qingsi Wang | 9a5c6f8 | 2018-02-01 10:38:40 -0800 | [diff] [blame] | 169 | |
Taylor Brandstetter | 6e2e7ce | 2017-12-19 10:26:23 -0800 | [diff] [blame] | 170 | IceConfig(); |
| 171 | IceConfig(int receiving_timeout_ms, |
| 172 | int backup_connection_ping_interval, |
| 173 | ContinualGatheringPolicy gathering_policy, |
| 174 | bool prioritize_most_likely_candidate_pairs, |
| 175 | int stable_writable_connection_ping_interval_ms, |
| 176 | bool presume_writable_when_fully_relayed, |
| 177 | int regather_on_failed_networks_interval_ms, |
Qingsi Wang | 866e08d | 2018-03-22 17:54:23 -0700 | [diff] [blame] | 178 | int receiving_switching_delay_ms); |
Taylor Brandstetter | 6e2e7ce | 2017-12-19 10:26:23 -0800 | [diff] [blame] | 179 | ~IceConfig(); |
Qingsi Wang | 866e08d | 2018-03-22 17:54:23 -0700 | [diff] [blame] | 180 | |
| 181 | // Helper getters for parameters with implementation-specific default value. |
| 182 | // By convention, parameters with default value are represented by |
Danil Chapovalov | 00c7183 | 2018-06-15 15:58:38 +0200 | [diff] [blame] | 183 | // absl::optional and setting a parameter to null restores its default value. |
Qingsi Wang | 866e08d | 2018-03-22 17:54:23 -0700 | [diff] [blame] | 184 | int receiving_timeout_or_default() const; |
| 185 | int backup_connection_ping_interval_or_default() const; |
| 186 | int stable_writable_connection_ping_interval_or_default() const; |
| 187 | int regather_on_failed_networks_interval_or_default() const; |
| 188 | int receiving_switching_delay_or_default() const; |
| 189 | int ice_check_interval_strong_connectivity_or_default() const; |
| 190 | int ice_check_interval_weak_connectivity_or_default() const; |
| 191 | int ice_check_min_interval_or_default() const; |
| 192 | int ice_unwritable_timeout_or_default() const; |
| 193 | int ice_unwritable_min_checks_or_default() const; |
Jiawei Ou | 9d4fd555 | 2018-12-06 23:30:17 -0800 | [diff] [blame] | 194 | int ice_inactive_timeout_or_default() const; |
Qingsi Wang | 866e08d | 2018-03-22 17:54:23 -0700 | [diff] [blame] | 195 | int stun_keepalive_interval_or_default() const; |
Taylor Brandstetter | 6e2e7ce | 2017-12-19 10:26:23 -0800 | [diff] [blame] | 196 | }; |
| 197 | |
zhihuang | b2cdd93 | 2017-01-19 16:54:25 -0800 | [diff] [blame] | 198 | // TODO(zhihuang): Replace this with |
| 199 | // PeerConnectionInterface::IceConnectionState. |
zhihuang | d06adf6 | 2017-01-12 15:58:31 -0800 | [diff] [blame] | 200 | enum class IceTransportState { |
zhihuang | 86abd6f | 2016-12-19 11:54:05 -0800 | [diff] [blame] | 201 | STATE_INIT, |
| 202 | STATE_CONNECTING, // Will enter this state once a connection is created |
| 203 | STATE_COMPLETED, |
zhihuang | d06adf6 | 2017-01-12 15:58:31 -0800 | [diff] [blame] | 204 | STATE_FAILED |
zhihuang | 86abd6f | 2016-12-19 11:54:05 -0800 | [diff] [blame] | 205 | }; |
| 206 | |
| 207 | // TODO(zhihuang): Remove this once it's no longer used in |
| 208 | // remoting/protocol/libjingle_transport_factory.cc |
| 209 | enum IceProtocolType { |
| 210 | ICEPROTO_RFC5245 // Standard RFC 5245 version of ICE. |
| 211 | }; |
| 212 | |
| 213 | // IceTransportInternal is an internal abstract class that does ICE. |
| 214 | // Once the public interface is supported, |
Niels Möller | c6ec4b1 | 2018-10-24 14:10:53 +0200 | [diff] [blame] | 215 | // (https://www.w3.org/TR/webrtc/#rtcicetransport) |
zhihuang | 86abd6f | 2016-12-19 11:54:05 -0800 | [diff] [blame] | 216 | // the IceTransportInterface will be split from this class. |
Mirko Bonadei | ac19414 | 2018-10-22 17:08:37 +0200 | [diff] [blame] | 217 | class RTC_EXPORT IceTransportInternal : public rtc::PacketTransportInternal { |
zhihuang | 86abd6f | 2016-12-19 11:54:05 -0800 | [diff] [blame] | 218 | public: |
Steve Anton | 33f69db | 2017-10-30 10:01:15 -0700 | [diff] [blame] | 219 | IceTransportInternal(); |
| 220 | ~IceTransportInternal() override; |
zhihuang | 86abd6f | 2016-12-19 11:54:05 -0800 | [diff] [blame] | 221 | |
Jonas Olsson | 81125f0 | 2018-10-09 10:52:04 +0200 | [diff] [blame] | 222 | // TODO(bugs.webrtc.org/9308): Remove GetState once all uses have been |
| 223 | // migrated to GetIceTransportState. |
zhihuang | d06adf6 | 2017-01-12 15:58:31 -0800 | [diff] [blame] | 224 | virtual IceTransportState GetState() const = 0; |
Jonas Olsson | 81125f0 | 2018-10-09 10:52:04 +0200 | [diff] [blame] | 225 | virtual webrtc::IceTransportState GetIceTransportState() const = 0; |
zhihuang | 86abd6f | 2016-12-19 11:54:05 -0800 | [diff] [blame] | 226 | |
zhihuang | 86abd6f | 2016-12-19 11:54:05 -0800 | [diff] [blame] | 227 | virtual int component() const = 0; |
| 228 | |
| 229 | virtual IceRole GetIceRole() const = 0; |
| 230 | |
| 231 | virtual void SetIceRole(IceRole role) = 0; |
| 232 | |
| 233 | virtual void SetIceTiebreaker(uint64_t tiebreaker) = 0; |
| 234 | |
| 235 | // TODO(zhihuang): Remove this once it's no longer called in |
| 236 | // remoting/protocol/libjingle_transport_factory.cc |
| 237 | virtual void SetIceProtocolType(IceProtocolType type) {} |
| 238 | |
| 239 | virtual void SetIceCredentials(const std::string& ice_ufrag, |
Steve Anton | 33f69db | 2017-10-30 10:01:15 -0700 | [diff] [blame] | 240 | const std::string& ice_pwd); |
zhihuang | 86abd6f | 2016-12-19 11:54:05 -0800 | [diff] [blame] | 241 | |
| 242 | virtual void SetRemoteIceCredentials(const std::string& ice_ufrag, |
Steve Anton | 33f69db | 2017-10-30 10:01:15 -0700 | [diff] [blame] | 243 | const std::string& ice_pwd); |
zhihuang | 86abd6f | 2016-12-19 11:54:05 -0800 | [diff] [blame] | 244 | |
| 245 | // The ufrag and pwd in |ice_params| must be set |
| 246 | // before candidate gathering can start. |
| 247 | virtual void SetIceParameters(const IceParameters& ice_params) = 0; |
| 248 | |
| 249 | virtual void SetRemoteIceParameters(const IceParameters& ice_params) = 0; |
| 250 | |
| 251 | virtual void SetRemoteIceMode(IceMode mode) = 0; |
| 252 | |
| 253 | virtual void SetIceConfig(const IceConfig& config) = 0; |
| 254 | |
| 255 | // Start gathering candidates if not already started, or if an ICE restart |
| 256 | // occurred. |
| 257 | virtual void MaybeStartGathering() = 0; |
| 258 | |
zhihuang | 86abd6f | 2016-12-19 11:54:05 -0800 | [diff] [blame] | 259 | virtual void AddRemoteCandidate(const Candidate& candidate) = 0; |
| 260 | |
| 261 | virtual void RemoveRemoteCandidate(const Candidate& candidate) = 0; |
| 262 | |
Harald Alvestrand | 4241cf5 | 2019-01-21 09:29:42 +0100 | [diff] [blame] | 263 | virtual void RemoveAllRemoteCandidates() = 0; |
| 264 | |
zhihuang | 86abd6f | 2016-12-19 11:54:05 -0800 | [diff] [blame] | 265 | virtual IceGatheringState gathering_state() const = 0; |
| 266 | |
zhihuang | d06adf6 | 2017-01-12 15:58:31 -0800 | [diff] [blame] | 267 | // Returns the current stats for this connection. |
Jonas Oreland | 149dc72 | 2019-08-28 08:10:27 +0200 | [diff] [blame] | 268 | virtual bool GetStats(IceTransportStats* ice_transport_stats) = 0; |
zhihuang | d06adf6 | 2017-01-12 15:58:31 -0800 | [diff] [blame] | 269 | |
skvlad | d030912 | 2017-02-02 17:18:37 -0800 | [diff] [blame] | 270 | // Returns RTT estimate over the currently active connection, or an empty |
Danil Chapovalov | 00c7183 | 2018-06-15 15:58:38 +0200 | [diff] [blame] | 271 | // absl::optional if there is none. |
| 272 | virtual absl::optional<int> GetRttEstimate() = 0; |
skvlad | d030912 | 2017-02-02 17:18:37 -0800 | [diff] [blame] | 273 | |
Qingsi Wang | e5defb1 | 2019-08-15 11:01:53 -0700 | [diff] [blame] | 274 | // TODO(qingsi): Remove this method once Chrome does not depend on it anymore. |
Harald Alvestrand | 4241cf5 | 2019-01-21 09:29:42 +0100 | [diff] [blame] | 275 | virtual const Connection* selected_connection() const = 0; |
| 276 | |
Qingsi Wang | e5defb1 | 2019-08-15 11:01:53 -0700 | [diff] [blame] | 277 | // Returns the selected candidate pair, or an empty absl::optional if there is |
| 278 | // none. |
| 279 | virtual absl::optional<const CandidatePair> GetSelectedCandidatePair() |
| 280 | const = 0; |
| 281 | |
zhihuang | 86abd6f | 2016-12-19 11:54:05 -0800 | [diff] [blame] | 282 | sigslot::signal1<IceTransportInternal*> SignalGatheringState; |
| 283 | |
| 284 | // Handles sending and receiving of candidates. |
| 285 | sigslot::signal2<IceTransportInternal*, const Candidate&> |
| 286 | SignalCandidateGathered; |
| 287 | |
Eldar Rello | da13ea2 | 2019-06-01 12:23:43 +0300 | [diff] [blame] | 288 | sigslot::signal2<IceTransportInternal*, const IceCandidateErrorEvent&> |
| 289 | SignalCandidateError; |
| 290 | |
zhihuang | 86abd6f | 2016-12-19 11:54:05 -0800 | [diff] [blame] | 291 | sigslot::signal2<IceTransportInternal*, const Candidates&> |
| 292 | SignalCandidatesRemoved; |
| 293 | |
Zhi Huang | 942bc2e | 2017-11-13 13:26:07 -0800 | [diff] [blame] | 294 | // Deprecated by PacketTransportInternal::SignalNetworkRouteChanged. |
zhihuang | 86abd6f | 2016-12-19 11:54:05 -0800 | [diff] [blame] | 295 | // This signal occurs when there is a change in the way that packets are |
| 296 | // being routed, i.e. to a different remote location. The candidate |
| 297 | // indicates where and how we are currently sending media. |
Zhi Huang | 942bc2e | 2017-11-13 13:26:07 -0800 | [diff] [blame] | 298 | // TODO(zhihuang): Update the Chrome remoting to use the new |
| 299 | // SignalNetworkRouteChanged. |
zhihuang | 86abd6f | 2016-12-19 11:54:05 -0800 | [diff] [blame] | 300 | sigslot::signal2<IceTransportInternal*, const Candidate&> SignalRouteChange; |
| 301 | |
Alex Drake | 00c7ecf | 2019-08-06 10:54:47 -0700 | [diff] [blame] | 302 | sigslot::signal1<const cricket::CandidatePairChangeEvent&> |
| 303 | SignalCandidatePairChanged; |
| 304 | |
zhihuang | d06adf6 | 2017-01-12 15:58:31 -0800 | [diff] [blame] | 305 | // Invoked when there is conflict in the ICE role between local and remote |
| 306 | // agents. |
| 307 | sigslot::signal1<IceTransportInternal*> SignalRoleConflict; |
| 308 | |
| 309 | // Emitted whenever the transport state changed. |
Jonas Olsson | 81125f0 | 2018-10-09 10:52:04 +0200 | [diff] [blame] | 310 | // TODO(bugs.webrtc.org/9308): Remove once all uses have migrated to the new |
| 311 | // IceTransportState. |
zhihuang | d06adf6 | 2017-01-12 15:58:31 -0800 | [diff] [blame] | 312 | sigslot::signal1<IceTransportInternal*> SignalStateChanged; |
| 313 | |
Jonas Olsson | 81125f0 | 2018-10-09 10:52:04 +0200 | [diff] [blame] | 314 | // Emitted whenever the new standards-compliant transport state changed. |
| 315 | sigslot::signal1<IceTransportInternal*> SignalIceTransportStateChanged; |
| 316 | |
zhihuang | 86abd6f | 2016-12-19 11:54:05 -0800 | [diff] [blame] | 317 | // Invoked when the transport is being destroyed. |
| 318 | sigslot::signal1<IceTransportInternal*> SignalDestroyed; |
zhihuang | 86abd6f | 2016-12-19 11:54:05 -0800 | [diff] [blame] | 319 | }; |
| 320 | |
| 321 | } // namespace cricket |
zhihuang | d06adf6 | 2017-01-12 15:58:31 -0800 | [diff] [blame] | 322 | |
Steve Anton | 10542f2 | 2019-01-11 09:11:00 -0800 | [diff] [blame] | 323 | #endif // P2P_BASE_ICE_TRANSPORT_INTERNAL_H_ |