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 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
101 rtc::SocketAddress address; | 101 rtc::SocketAddress address; |
102 ProtocolType proto; | 102 ProtocolType proto; |
103 bool secure; | 103 bool secure; |
104 | 104 |
105 ProtocolAddress(const rtc::SocketAddress& a, ProtocolType p) | 105 ProtocolAddress(const rtc::SocketAddress& a, ProtocolType p) |
106 : address(a), proto(p), secure(false) { } | 106 : address(a), proto(p), secure(false) { } |
107 ProtocolAddress(const rtc::SocketAddress& a, ProtocolType p, bool sec) | 107 ProtocolAddress(const rtc::SocketAddress& a, ProtocolType p, bool sec) |
108 : address(a), proto(p), secure(sec) { } | 108 : address(a), proto(p), secure(sec) { } |
109 }; | 109 }; |
110 | 110 |
| 111 struct IceParameters { |
| 112 std::string ufrag; |
| 113 std::string pwd; |
| 114 IceParameters(const std::string& ice_ufrag, const std::string& ice_pwd) |
| 115 : ufrag(ice_ufrag), pwd(ice_pwd) {} |
| 116 |
| 117 bool operator==(const IceParameters& other) { |
| 118 return ufrag == other.ufrag && pwd == other.pwd; |
| 119 } |
| 120 bool operator!=(const IceParameters& other) { return !(*this == other); } |
| 121 }; |
| 122 |
111 typedef std::set<rtc::SocketAddress> ServerAddresses; | 123 typedef std::set<rtc::SocketAddress> ServerAddresses; |
112 | 124 |
113 // Represents a local communication mechanism that can be used to create | 125 // Represents a local communication mechanism that can be used to create |
114 // connections to similar mechanisms of the other client. Subclasses of this | 126 // connections to similar mechanisms of the other client. Subclasses of this |
115 // one add support for specific mechanisms like local UDP ports. | 127 // one add support for specific mechanisms like local UDP ports. |
116 class Port : public PortInterface, public rtc::MessageHandler, | 128 class Port : public PortInterface, public rtc::MessageHandler, |
117 public sigslot::has_slots<> { | 129 public sigslot::has_slots<> { |
118 public: | 130 public: |
119 Port(rtc::Thread* thread, | 131 Port(rtc::Thread* thread, |
120 rtc::PacketSocketFactory* factory, | 132 rtc::PacketSocketFactory* factory, |
(...skipping 446 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
567 | 579 |
568 // Invoked when Connection receives STUN error response with 487 code. | 580 // Invoked when Connection receives STUN error response with 487 code. |
569 void HandleRoleConflictFromPeer(); | 581 void HandleRoleConflictFromPeer(); |
570 | 582 |
571 State state() const { return state_; } | 583 State state() const { return state_; } |
572 | 584 |
573 IceMode remote_ice_mode() const { return remote_ice_mode_; } | 585 IceMode remote_ice_mode() const { return remote_ice_mode_; } |
574 | 586 |
575 uint32_t ComputeNetworkCost() const; | 587 uint32_t ComputeNetworkCost() const; |
576 | 588 |
| 589 // Update the ICE password and/or generation of the remote candidate if a |
| 590 // ufrag in |remote_ice_parameters| matches the candidate's ufrag, and the |
| 591 // candidate's password and/or ufrag has not been set. |
| 592 // |remote_ice_parameters| should be a list of known ICE parameters ordered |
| 593 // by generation. |
| 594 void MaybeSetRemoteIceCredentialsAndGeneration( |
| 595 const std::vector<IceParameters>& remote_ice_parameters); |
| 596 |
577 // Update the ICE password of the remote candidate if |ice_ufrag| matches | 597 // Update the ICE password of the remote candidate if |ice_ufrag| matches |
578 // the candidate's ufrag, and the candidate's passwrod has not been set. | 598 // the candidate's ufrag, and the candidate's passwrod has not been set. |
579 void MaybeSetRemoteIceCredentials(const std::string& ice_ufrag, | 599 void MaybeSetRemoteIceCredentials(const std::string& ice_ufrag, |
580 const std::string& ice_pwd); | 600 const std::string& ice_pwd); |
581 | 601 |
582 // If |remote_candidate_| is peer reflexive and is equivalent to | 602 // If |remote_candidate_| is peer reflexive and is equivalent to |
583 // |new_candidate| except the type, update |remote_candidate_| to | 603 // |new_candidate| except the type, update |remote_candidate_| to |
584 // |new_candidate|. | 604 // |new_candidate|. |
585 void MaybeUpdatePeerReflexiveCandidate(const Candidate& new_candidate); | 605 void MaybeUpdatePeerReflexiveCandidate(const Candidate& new_candidate); |
586 | 606 |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
667 const rtc::PacketOptions& options) override; | 687 const rtc::PacketOptions& options) override; |
668 int GetError() override { return error_; } | 688 int GetError() override { return error_; } |
669 | 689 |
670 private: | 690 private: |
671 int error_ = 0; | 691 int error_ = 0; |
672 }; | 692 }; |
673 | 693 |
674 } // namespace cricket | 694 } // namespace cricket |
675 | 695 |
676 #endif // WEBRTC_P2P_BASE_PORT_H_ | 696 #endif // WEBRTC_P2P_BASE_PORT_H_ |
OLD | NEW |