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 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
74 | 74 |
75 // TODO(deadbeef): Unify with PeerConnectionInterface::IceConnectionState | 75 // TODO(deadbeef): Unify with PeerConnectionInterface::IceConnectionState |
76 // once /talk/ and /webrtc/ are combined, and also switch to ENUM_NAME naming | 76 // once /talk/ and /webrtc/ are combined, and also switch to ENUM_NAME naming |
77 // style. | 77 // style. |
78 enum IceGatheringState { | 78 enum IceGatheringState { |
79 kIceGatheringNew = 0, | 79 kIceGatheringNew = 0, |
80 kIceGatheringGathering, | 80 kIceGatheringGathering, |
81 kIceGatheringComplete, | 81 kIceGatheringComplete, |
82 }; | 82 }; |
83 | 83 |
| 84 enum ContinualGatheringPolicy { |
| 85 // All port allocator sessions will stop after a writable connection is found. |
| 86 GATHER_ONCE = 0; |
| 87 // The most recent port allocator session will keep on running. |
| 88 GATHER_CONTINUALLY; |
| 89 // The most recent port allocator session will keep on running, and it will |
| 90 // try to recover connectivity if the channel becomes not connected. |
| 91 GATHER_CONTINUALLY_AND_RECOVER; |
| 92 }; |
| 93 |
84 // Stats that we can return about the connections for a transport channel. | 94 // Stats that we can return about the connections for a transport channel. |
85 // TODO(hta): Rename to ConnectionStats | 95 // TODO(hta): Rename to ConnectionStats |
86 struct ConnectionInfo { | 96 struct ConnectionInfo { |
87 ConnectionInfo() | 97 ConnectionInfo() |
88 : best_connection(false), | 98 : best_connection(false), |
89 writable(false), | 99 writable(false), |
90 receiving(false), | 100 receiving(false), |
91 timeout(false), | 101 timeout(false), |
92 new_connection(false), | 102 new_connection(false), |
93 rtt(0), | 103 rtt(0), |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
151 TransportChannelStatsList channel_stats; | 161 TransportChannelStatsList channel_stats; |
152 }; | 162 }; |
153 | 163 |
154 // Information about ICE configuration. | 164 // Information about ICE configuration. |
155 struct IceConfig { | 165 struct IceConfig { |
156 // The ICE connection receiving timeout value in milliseconds. | 166 // The ICE connection receiving timeout value in milliseconds. |
157 int receiving_timeout = -1; | 167 int receiving_timeout = -1; |
158 // Time interval in milliseconds to ping a backup connection when the ICE | 168 // Time interval in milliseconds to ping a backup connection when the ICE |
159 // channel is strongly connected. | 169 // channel is strongly connected. |
160 int backup_connection_ping_interval = -1; | 170 int backup_connection_ping_interval = -1; |
161 // If true, the most recent port allocator session will keep on running. | 171 |
162 bool gather_continually = false; | 172 ContinualGatheringPolicy gathering_policy = GATHER_ONCE; |
| 173 |
| 174 bool gather_continually() { |
| 175 return gathering_policy == GATHER_CONTINUALLY || |
| 176 gathering_policy == GATHER_CONTINUALLY_AND_RECOVER; |
| 177 } |
163 | 178 |
164 // Whether we should prioritize Relay/Relay candidate when nothing | 179 // Whether we should prioritize Relay/Relay candidate when nothing |
165 // is writable yet. | 180 // is writable yet. |
166 bool prioritize_most_likely_candidate_pairs = false; | 181 bool prioritize_most_likely_candidate_pairs = false; |
167 | 182 |
168 // If the current best connection is both writable and receiving, | 183 // If the current best connection is both writable and receiving, |
169 // then we will also try hard to make sure it is pinged at this rate | 184 // then we will also try hard to make sure it is pinged at this rate |
170 // (Default value is a little less than 2 * STRONG_PING_INTERVAL). | 185 // (Default value is a little less than 2 * STRONG_PING_INTERVAL). |
171 int max_strong_interval = -1; | 186 int max_strong_interval = -1; |
172 | 187 |
| 188 // Interval to check on all networks and to perform ICE regathering on any |
| 189 // active network having no connection on it. |
| 190 int regather_on_failed_networks_interval = -1; |
| 191 |
173 IceConfig() {} | 192 IceConfig() {} |
174 IceConfig(int receiving_timeout_ms, | 193 IceConfig(int receiving_timeout_ms, |
175 int backup_connection_ping_interval, | 194 int backup_connection_ping_interval, |
176 bool gather_continually, | 195 bool gathering_policy, |
177 bool prioritize_most_likely_candidate_pairs, | 196 bool prioritize_most_likely_candidate_pairs, |
178 int max_strong_interval_ms) | 197 int max_strong_interval_ms, |
| 198 int regather_on_failed_networks_interval_ms) |
179 : receiving_timeout(receiving_timeout_ms), | 199 : receiving_timeout(receiving_timeout_ms), |
180 backup_connection_ping_interval(backup_connection_ping_interval), | 200 backup_connection_ping_interval(backup_connection_ping_interval), |
181 gather_continually(gather_continually), | 201 gathering_policy(gathering_policy), |
182 prioritize_most_likely_candidate_pairs( | 202 prioritize_most_likely_candidate_pairs( |
183 prioritize_most_likely_candidate_pairs), | 203 prioritize_most_likely_candidate_pairs), |
184 max_strong_interval(max_strong_interval_ms) {} | 204 max_strong_interval(max_strong_interval_ms), |
| 205 regather_on_failed_networks_interval( |
| 206 regather_on_failed_networks_interval_ms) {} |
185 }; | 207 }; |
186 | 208 |
187 bool BadTransportDescription(const std::string& desc, std::string* err_desc); | 209 bool BadTransportDescription(const std::string& desc, std::string* err_desc); |
188 | 210 |
189 bool IceCredentialsChanged(const std::string& old_ufrag, | 211 bool IceCredentialsChanged(const std::string& old_ufrag, |
190 const std::string& old_pwd, | 212 const std::string& old_pwd, |
191 const std::string& new_ufrag, | 213 const std::string& new_ufrag, |
192 const std::string& new_pwd); | 214 const std::string& new_pwd); |
193 | 215 |
194 class Transport : public sigslot::has_slots<> { | 216 class Transport : public sigslot::has_slots<> { |
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
368 | 390 |
369 ChannelMap channels_; | 391 ChannelMap channels_; |
370 | 392 |
371 RTC_DISALLOW_COPY_AND_ASSIGN(Transport); | 393 RTC_DISALLOW_COPY_AND_ASSIGN(Transport); |
372 }; | 394 }; |
373 | 395 |
374 | 396 |
375 } // namespace cricket | 397 } // namespace cricket |
376 | 398 |
377 #endif // WEBRTC_P2P_BASE_TRANSPORT_H_ | 399 #endif // WEBRTC_P2P_BASE_TRANSPORT_H_ |
OLD | NEW |