| 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 240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 251 void ResetChannels(); | 251 void ResetChannels(); |
| 252 | 252 |
| 253 // Destroys every channel created so far. | 253 // Destroys every channel created so far. |
| 254 void DestroyAllChannels(); | 254 void DestroyAllChannels(); |
| 255 | 255 |
| 256 bool GetStats(TransportStats* stats); | 256 bool GetStats(TransportStats* stats); |
| 257 | 257 |
| 258 // Called when one or more candidates are ready from the remote peer. | 258 // Called when one or more candidates are ready from the remote peer. |
| 259 bool AddRemoteCandidates(const std::vector<Candidate>& candidates, | 259 bool AddRemoteCandidates(const std::vector<Candidate>& candidates, |
| 260 std::string* error); | 260 std::string* error); |
| 261 bool RemoveRemoteCandidates(const std::vector<Candidate>& candidates, | 261 |
| 262 std::string* error); | 262 // If candidate is not acceptable, returns false and sets error. |
| 263 // Call this before calling OnRemoteCandidates. |
| 264 virtual bool VerifyCandidate(const Candidate& candidate, |
| 265 std::string* error); |
| 263 | 266 |
| 264 virtual bool GetSslRole(rtc::SSLRole* ssl_role) const { return false; } | 267 virtual bool GetSslRole(rtc::SSLRole* ssl_role) const { return false; } |
| 265 | 268 |
| 266 // Must be called before channel is starting to connect. | 269 // Must be called before channel is starting to connect. |
| 267 virtual bool SetSslMaxProtocolVersion(rtc::SSLProtocolVersion version) { | 270 virtual bool SetSslMaxProtocolVersion(rtc::SSLProtocolVersion version) { |
| 268 return false; | 271 return false; |
| 269 } | 272 } |
| 270 | 273 |
| 271 protected: | 274 protected: |
| 272 // These are called by Create/DestroyChannel above in order to create or | 275 // These are called by Create/DestroyChannel above in order to create or |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 306 std::string* error_desc); | 309 std::string* error_desc); |
| 307 | 310 |
| 308 // Pushes down the transport parameters obtained via negotiation. | 311 // Pushes down the transport parameters obtained via negotiation. |
| 309 // Derived classes can set their specific parameters here, but must call the | 312 // Derived classes can set their specific parameters here, but must call the |
| 310 // base as well. | 313 // base as well. |
| 311 virtual bool ApplyNegotiatedTransportDescription( | 314 virtual bool ApplyNegotiatedTransportDescription( |
| 312 TransportChannelImpl* channel, | 315 TransportChannelImpl* channel, |
| 313 std::string* error_desc); | 316 std::string* error_desc); |
| 314 | 317 |
| 315 private: | 318 private: |
| 316 // If a candidate is not acceptable, returns false and sets error. | |
| 317 // Call this before calling OnRemoteCandidates. | |
| 318 bool VerifyCandidate(const Candidate& candidate, std::string* error); | |
| 319 bool VerifyCandidates(const Candidates& candidates, std::string* error); | |
| 320 | |
| 321 // Candidate component => TransportChannelImpl* | 319 // Candidate component => TransportChannelImpl* |
| 322 typedef std::map<int, TransportChannelImpl*> ChannelMap; | 320 typedef std::map<int, TransportChannelImpl*> ChannelMap; |
| 323 | 321 |
| 324 // Helper function that invokes the given function on every channel. | 322 // Helper function that invokes the given function on every channel. |
| 325 typedef void (TransportChannelImpl::* TransportChannelFunc)(); | 323 typedef void (TransportChannelImpl::* TransportChannelFunc)(); |
| 326 void CallChannels(TransportChannelFunc func); | 324 void CallChannels(TransportChannelFunc func); |
| 327 | 325 |
| 328 const std::string name_; | 326 const std::string name_; |
| 329 PortAllocator* const allocator_; | 327 PortAllocator* const allocator_; |
| 330 bool channels_destroyed_ = false; | 328 bool channels_destroyed_ = false; |
| 331 bool connect_requested_ = false; | 329 bool connect_requested_ = false; |
| 332 IceRole ice_role_ = ICEROLE_UNKNOWN; | 330 IceRole ice_role_ = ICEROLE_UNKNOWN; |
| 333 uint64_t tiebreaker_ = 0; | 331 uint64_t tiebreaker_ = 0; |
| 334 IceMode remote_ice_mode_ = ICEMODE_FULL; | 332 IceMode remote_ice_mode_ = ICEMODE_FULL; |
| 335 IceConfig ice_config_; | 333 IceConfig ice_config_; |
| 336 rtc::scoped_ptr<TransportDescription> local_description_; | 334 rtc::scoped_ptr<TransportDescription> local_description_; |
| 337 rtc::scoped_ptr<TransportDescription> remote_description_; | 335 rtc::scoped_ptr<TransportDescription> remote_description_; |
| 338 bool local_description_set_ = false; | 336 bool local_description_set_ = false; |
| 339 bool remote_description_set_ = false; | 337 bool remote_description_set_ = false; |
| 340 | 338 |
| 341 ChannelMap channels_; | 339 ChannelMap channels_; |
| 342 | 340 |
| 343 RTC_DISALLOW_COPY_AND_ASSIGN(Transport); | 341 RTC_DISALLOW_COPY_AND_ASSIGN(Transport); |
| 344 }; | 342 }; |
| 345 | 343 |
| 346 | 344 |
| 347 } // namespace cricket | 345 } // namespace cricket |
| 348 | 346 |
| 349 #endif // WEBRTC_P2P_BASE_TRANSPORT_H_ | 347 #endif // WEBRTC_P2P_BASE_TRANSPORT_H_ |
| OLD | NEW |