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); } | |
115 }; | 110 }; |
116 | 111 |
117 typedef std::set<rtc::SocketAddress> ServerAddresses; | 112 typedef std::set<rtc::SocketAddress> ServerAddresses; |
118 | 113 |
119 // Represents a local communication mechanism that can be used to create | 114 // Represents a local communication mechanism that can be used to create |
120 // connections to similar mechanisms of the other client. Subclasses of this | 115 // connections to similar mechanisms of the other client. Subclasses of this |
121 // one add support for specific mechanisms like local UDP ports. | 116 // one add support for specific mechanisms like local UDP ports. |
122 class Port : public PortInterface, public rtc::MessageHandler, | 117 class Port : public PortInterface, public rtc::MessageHandler, |
123 public sigslot::has_slots<> { | 118 public sigslot::has_slots<> { |
124 public: | 119 public: |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
174 return send_retransmit_count_attribute_; | 169 return send_retransmit_count_attribute_; |
175 } | 170 } |
176 void set_send_retransmit_count_attribute(bool enable) { | 171 void set_send_retransmit_count_attribute(bool enable) { |
177 send_retransmit_count_attribute_ = enable; | 172 send_retransmit_count_attribute_ = enable; |
178 } | 173 } |
179 | 174 |
180 // Identifies the generation that this port was created in. | 175 // Identifies the generation that this port was created in. |
181 uint32_t generation() { return generation_; } | 176 uint32_t generation() { return generation_; } |
182 void set_generation(uint32_t generation) { generation_ = generation; } | 177 void set_generation(uint32_t generation) { generation_ = generation; } |
183 | 178 |
| 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. |
184 const std::string username_fragment() const; | 193 const std::string username_fragment() const; |
185 const std::string& password() const { return password_; } | 194 const std::string& password() const { return password_; } |
186 | 195 |
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 | |
194 // Fired when candidates are discovered by the port. When all candidates | 196 // Fired when candidates are discovered by the port. When all candidates |
195 // are discovered that belong to port SignalAddressReady is fired. | 197 // are discovered that belong to port SignalAddressReady is fired. |
196 sigslot::signal2<Port*, const Candidate&> SignalCandidateReady; | 198 sigslot::signal2<Port*, const Candidate&> SignalCandidateReady; |
197 | 199 |
198 // Provides all of the above information in one handy object. | 200 // Provides all of the above information in one handy object. |
199 virtual const std::vector<Candidate>& Candidates() const { | 201 virtual const std::vector<Candidate>& Candidates() const { |
200 return candidates_; | 202 return candidates_; |
201 } | 203 } |
202 | 204 |
203 // SignalPortComplete is sent when port completes the task of candidates | 205 // SignalPortComplete is sent when port completes the task of candidates |
(...skipping 466 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
670 const rtc::PacketOptions& options) override; | 672 const rtc::PacketOptions& options) override; |
671 int GetError() override { return error_; } | 673 int GetError() override { return error_; } |
672 | 674 |
673 private: | 675 private: |
674 int error_ = 0; | 676 int error_ = 0; |
675 }; | 677 }; |
676 | 678 |
677 } // namespace cricket | 679 } // namespace cricket |
678 | 680 |
679 #endif // WEBRTC_P2P_BASE_PORT_H_ | 681 #endif // WEBRTC_P2P_BASE_PORT_H_ |
OLD | NEW |