| 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 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 100 | 100 |
| 101 struct ProtocolAddress { | 101 struct ProtocolAddress { |
| 102 rtc::SocketAddress address; | 102 rtc::SocketAddress address; |
| 103 ProtocolType proto; | 103 ProtocolType proto; |
| 104 bool secure; | 104 bool secure; |
| 105 | 105 |
| 106 ProtocolAddress(const rtc::SocketAddress& a, ProtocolType p) | 106 ProtocolAddress(const rtc::SocketAddress& a, ProtocolType p) |
| 107 : address(a), proto(p), secure(false) { } | 107 : address(a), proto(p), secure(false) { } |
| 108 ProtocolAddress(const rtc::SocketAddress& a, ProtocolType p, bool sec) | 108 ProtocolAddress(const rtc::SocketAddress& a, ProtocolType p, bool sec) |
| 109 : address(a), proto(p), secure(sec) { } | 109 : address(a), proto(p), secure(sec) { } |
| 110 |
| 111 bool operator==(const ProtocolAddress& o) const { |
| 112 return address == o.address && proto == o.proto && secure == o.secure; |
| 113 } |
| 114 bool operator!=(const ProtocolAddress& o) const { return !(*this == o); } |
| 110 }; | 115 }; |
| 111 | 116 |
| 112 typedef std::set<rtc::SocketAddress> ServerAddresses; | 117 typedef std::set<rtc::SocketAddress> ServerAddresses; |
| 113 | 118 |
| 114 // Represents a local communication mechanism that can be used to create | 119 // Represents a local communication mechanism that can be used to create |
| 115 // connections to similar mechanisms of the other client. Subclasses of this | 120 // connections to similar mechanisms of the other client. Subclasses of this |
| 116 // one add support for specific mechanisms like local UDP ports. | 121 // one add support for specific mechanisms like local UDP ports. |
| 117 class Port : public PortInterface, public rtc::MessageHandler, | 122 class Port : public PortInterface, public rtc::MessageHandler, |
| 118 public sigslot::has_slots<> { | 123 public sigslot::has_slots<> { |
| 119 public: | 124 public: |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 169 return send_retransmit_count_attribute_; | 174 return send_retransmit_count_attribute_; |
| 170 } | 175 } |
| 171 void set_send_retransmit_count_attribute(bool enable) { | 176 void set_send_retransmit_count_attribute(bool enable) { |
| 172 send_retransmit_count_attribute_ = enable; | 177 send_retransmit_count_attribute_ = enable; |
| 173 } | 178 } |
| 174 | 179 |
| 175 // Identifies the generation that this port was created in. | 180 // Identifies the generation that this port was created in. |
| 176 uint32_t generation() { return generation_; } | 181 uint32_t generation() { return generation_; } |
| 177 void set_generation(uint32_t generation) { generation_ = generation; } | 182 void set_generation(uint32_t generation) { generation_ = generation; } |
| 178 | 183 |
| 179 // ICE requires a single username/password per content/media line. So the | |
| 180 // |ice_username_fragment_| of the ports that belongs to the same content will | |
| 181 // be the same. However this causes a small complication with our relay | |
| 182 // server, which expects different username for RTP and RTCP. | |
| 183 // | |
| 184 // To resolve this problem, we implemented the username_fragment(), | |
| 185 // which returns a different username (calculated from | |
| 186 // |ice_username_fragment_|) for RTCP in the case of ICEPROTO_GOOGLE. And the | |
| 187 // username_fragment() simply returns |ice_username_fragment_| when running | |
| 188 // in ICEPROTO_RFC5245. | |
| 189 // | |
| 190 // As a result the ICEPROTO_GOOGLE will use different usernames for RTP and | |
| 191 // RTCP. And the ICEPROTO_RFC5245 will use same username for both RTP and | |
| 192 // RTCP. | |
| 193 const std::string username_fragment() const; | 184 const std::string username_fragment() const; |
| 194 const std::string& password() const { return password_; } | 185 const std::string& password() const { return password_; } |
| 195 | 186 |
| 187 // May be called when this port was initially created by a pooled |
| 188 // PortAllocatorSession, and is now being assigned to an ICE transport. |
| 189 // Updates the information for candidates as well. |
| 190 void SetIceParameters(int component, |
| 191 const std::string& username_fragment, |
| 192 const std::string& password); |
| 193 |
| 196 // Fired when candidates are discovered by the port. When all candidates | 194 // Fired when candidates are discovered by the port. When all candidates |
| 197 // are discovered that belong to port SignalAddressReady is fired. | 195 // are discovered that belong to port SignalAddressReady is fired. |
| 198 sigslot::signal2<Port*, const Candidate&> SignalCandidateReady; | 196 sigslot::signal2<Port*, const Candidate&> SignalCandidateReady; |
| 199 | 197 |
| 200 // Provides all of the above information in one handy object. | 198 // Provides all of the above information in one handy object. |
| 201 virtual const std::vector<Candidate>& Candidates() const { | 199 virtual const std::vector<Candidate>& Candidates() const { |
| 202 return candidates_; | 200 return candidates_; |
| 203 } | 201 } |
| 204 | 202 |
| 205 // SignalPortComplete is sent when port completes the task of candidates | 203 // SignalPortComplete is sent when port completes the task of candidates |
| (...skipping 466 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 672 const rtc::PacketOptions& options) override; | 670 const rtc::PacketOptions& options) override; |
| 673 int GetError() override { return error_; } | 671 int GetError() override { return error_; } |
| 674 | 672 |
| 675 private: | 673 private: |
| 676 int error_ = 0; | 674 int error_ = 0; |
| 677 }; | 675 }; |
| 678 | 676 |
| 679 } // namespace cricket | 677 } // namespace cricket |
| 680 | 678 |
| 681 #endif // WEBRTC_P2P_BASE_PORT_H_ | 679 #endif // WEBRTC_P2P_BASE_PORT_H_ |
| OLD | NEW |