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 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
135 const rtc::IPAddress& ip, | 135 const rtc::IPAddress& ip, |
136 uint16_t min_port, | 136 uint16_t min_port, |
137 uint16_t max_port, | 137 uint16_t max_port, |
138 const std::string& username_fragment, | 138 const std::string& username_fragment, |
139 const std::string& password); | 139 const std::string& password); |
140 virtual ~Port(); | 140 virtual ~Port(); |
141 | 141 |
142 virtual const std::string& Type() const { return type_; } | 142 virtual const std::string& Type() const { return type_; } |
143 virtual rtc::Network* Network() const { return network_; } | 143 virtual rtc::Network* Network() const { return network_; } |
144 | 144 |
| 145 virtual void FailAndDestroyConnections(); |
| 146 |
145 // Methods to set/get ICE role and tiebreaker values. | 147 // Methods to set/get ICE role and tiebreaker values. |
146 IceRole GetIceRole() const { return ice_role_; } | 148 IceRole GetIceRole() const { return ice_role_; } |
147 void SetIceRole(IceRole role) { ice_role_ = role; } | 149 void SetIceRole(IceRole role) { ice_role_ = role; } |
148 | 150 |
149 void SetIceTiebreaker(uint64_t tiebreaker) { tiebreaker_ = tiebreaker; } | 151 void SetIceTiebreaker(uint64_t tiebreaker) { tiebreaker_ = tiebreaker; } |
150 uint64_t IceTiebreaker() const { return tiebreaker_; } | 152 uint64_t IceTiebreaker() const { return tiebreaker_; } |
151 | 153 |
152 virtual bool SharedSocket() const { return shared_socket_; } | 154 virtual bool SharedSocket() const { return shared_socket_; } |
153 void ResetSharedSocket() { shared_socket_ = false; } | 155 void ResetSharedSocket() { shared_socket_ = false; } |
154 | 156 |
155 // The thread on which this port performs its I/O. | 157 // The thread on which this port performs its I/O. |
156 rtc::Thread* thread() { return thread_; } | 158 rtc::Thread* thread() { return thread_; } |
157 | 159 |
158 // The factory used to create the sockets of this port. | 160 // The factory used to create the sockets of this port. |
159 rtc::PacketSocketFactory* socket_factory() const { return factory_; } | 161 rtc::PacketSocketFactory* socket_factory() const { return factory_; } |
160 void set_socket_factory(rtc::PacketSocketFactory* factory) { | 162 void set_socket_factory(rtc::PacketSocketFactory* factory) { |
161 factory_ = factory; | 163 factory_ = factory; |
162 } | 164 } |
163 | 165 |
| 166 void CloseAndSignalCandidateRemovals(); |
| 167 |
164 // For debugging purposes. | 168 // For debugging purposes. |
165 const std::string& content_name() const { return content_name_; } | 169 const std::string& content_name() const { return content_name_; } |
166 void set_content_name(const std::string& content_name) { | 170 void set_content_name(const std::string& content_name) { |
167 content_name_ = content_name; | 171 content_name_ = content_name; |
168 } | 172 } |
169 | 173 |
170 int component() const { return component_; } | 174 int component() const { return component_; } |
171 void set_component(int component) { component_ = component; } | 175 void set_component(int component) { component_ = component; } |
172 | 176 |
173 bool send_retransmit_count_attribute() const { | 177 bool send_retransmit_count_attribute() const { |
(...skipping 14 matching lines...) Expand all Loading... |
188 // PortAllocatorSession, and is now being assigned to an ICE transport. | 192 // PortAllocatorSession, and is now being assigned to an ICE transport. |
189 // Updates the information for candidates as well. | 193 // Updates the information for candidates as well. |
190 void SetIceParameters(int component, | 194 void SetIceParameters(int component, |
191 const std::string& username_fragment, | 195 const std::string& username_fragment, |
192 const std::string& password); | 196 const std::string& password); |
193 | 197 |
194 // Fired when candidates are discovered by the port. When all candidates | 198 // Fired when candidates are discovered by the port. When all candidates |
195 // are discovered that belong to port SignalAddressReady is fired. | 199 // are discovered that belong to port SignalAddressReady is fired. |
196 sigslot::signal2<Port*, const Candidate&> SignalCandidateReady; | 200 sigslot::signal2<Port*, const Candidate&> SignalCandidateReady; |
197 | 201 |
| 202 // Fired when candidates need to be signaled for removing on the remote side. |
| 203 sigslot::signal2<Port*, const std::vector<Candidate>&> |
| 204 SignalCandidatesRemoved; |
| 205 |
198 // Provides all of the above information in one handy object. | 206 // Provides all of the above information in one handy object. |
199 virtual const std::vector<Candidate>& Candidates() const { | 207 virtual const std::vector<Candidate>& Candidates() const { |
200 return candidates_; | 208 return candidates_; |
201 } | 209 } |
202 | 210 |
203 // SignalPortComplete is sent when port completes the task of candidates | 211 // SignalPortComplete is sent when port completes the task of candidates |
204 // allocation. | 212 // allocation. |
205 sigslot::signal1<Port*> SignalPortComplete; | 213 sigslot::signal1<Port*> SignalPortComplete; |
206 // This signal sent when port fails to allocate candidates and this port | 214 // This signal sent when port fails to allocate candidates and this port |
207 // can't be used in establishing the connections. When port is in shared mode | 215 // can't be used in establishing the connections. When port is in shared mode |
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
390 std::vector<Candidate> candidates_; | 398 std::vector<Candidate> candidates_; |
391 AddressMap connections_; | 399 AddressMap connections_; |
392 int timeout_delay_; | 400 int timeout_delay_; |
393 bool enable_port_packets_; | 401 bool enable_port_packets_; |
394 IceRole ice_role_; | 402 IceRole ice_role_; |
395 uint64_t tiebreaker_; | 403 uint64_t tiebreaker_; |
396 bool shared_socket_; | 404 bool shared_socket_; |
397 // Information to use when going through a proxy. | 405 // Information to use when going through a proxy. |
398 std::string user_agent_; | 406 std::string user_agent_; |
399 rtc::ProxyInfo proxy_; | 407 rtc::ProxyInfo proxy_; |
| 408 bool closed_ = false; |
400 | 409 |
401 // A virtual cost perceived by the user, usually based on the network type | 410 // A virtual cost perceived by the user, usually based on the network type |
402 // (WiFi. vs. Cellular). It takes precedence over the priority when | 411 // (WiFi. vs. Cellular). It takes precedence over the priority when |
403 // comparing two connections. | 412 // comparing two connections. |
404 uint16_t network_cost_; | 413 uint16_t network_cost_; |
405 | 414 |
406 friend class Connection; | 415 friend class Connection; |
407 }; | 416 }; |
408 | 417 |
409 // Represents a communication link between a port on the local client and a | 418 // Represents a communication link between a port on the local client and a |
(...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
665 const rtc::PacketOptions& options) override; | 674 const rtc::PacketOptions& options) override; |
666 int GetError() override { return error_; } | 675 int GetError() override { return error_; } |
667 | 676 |
668 private: | 677 private: |
669 int error_ = 0; | 678 int error_ = 0; |
670 }; | 679 }; |
671 | 680 |
672 } // namespace cricket | 681 } // namespace cricket |
673 | 682 |
674 #endif // WEBRTC_P2P_BASE_PORT_H_ | 683 #endif // WEBRTC_P2P_BASE_PORT_H_ |
OLD | NEW |