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