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 275 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
286 virtual void OnSentPacket(rtc::AsyncPacketSocket* socket, | 286 virtual void OnSentPacket(rtc::AsyncPacketSocket* socket, |
287 const rtc::SentPacket& sent_packet) = 0; | 287 const rtc::SentPacket& sent_packet) = 0; |
288 | 288 |
289 // Called when the socket is currently able to send. | 289 // Called when the socket is currently able to send. |
290 void OnReadyToSend(); | 290 void OnReadyToSend(); |
291 | 291 |
292 // Called when the Connection discovers a local peer reflexive candidate. | 292 // Called when the Connection discovers a local peer reflexive candidate. |
293 // Returns the index of the new local candidate. | 293 // Returns the index of the new local candidate. |
294 size_t AddPrflxCandidate(const Candidate& local); | 294 size_t AddPrflxCandidate(const Candidate& local); |
295 | 295 |
296 void set_candidate_filter(uint32_t candidate_filter) { | |
297 candidate_filter_ = candidate_filter; | |
298 } | |
299 int16_t network_cost() const { return network_cost_; } | 296 int16_t network_cost() const { return network_cost_; } |
300 | 297 |
301 protected: | 298 protected: |
302 enum { | 299 enum { |
303 MSG_DEAD = 0, | 300 MSG_DEAD = 0, |
304 MSG_FIRST_AVAILABLE | 301 MSG_FIRST_AVAILABLE |
305 }; | 302 }; |
306 | 303 |
307 void set_type(const std::string& type) { type_ = type; } | 304 void set_type(const std::string& type) { type_ = type; } |
308 | 305 |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
340 | 337 |
341 // Checks if the address in addr is compatible with the port's ip. | 338 // Checks if the address in addr is compatible with the port's ip. |
342 bool IsCompatibleAddress(const rtc::SocketAddress& addr); | 339 bool IsCompatibleAddress(const rtc::SocketAddress& addr); |
343 | 340 |
344 // Returns default DSCP value. | 341 // Returns default DSCP value. |
345 rtc::DiffServCodePoint DefaultDscpValue() const { | 342 rtc::DiffServCodePoint DefaultDscpValue() const { |
346 // No change from what MediaChannel set. | 343 // No change from what MediaChannel set. |
347 return rtc::DSCP_NO_CHANGE; | 344 return rtc::DSCP_NO_CHANGE; |
348 } | 345 } |
349 | 346 |
350 uint32_t candidate_filter() { return candidate_filter_; } | |
351 | |
352 private: | 347 private: |
353 void Construct(); | 348 void Construct(); |
354 // Called when one of our connections deletes itself. | 349 // Called when one of our connections deletes itself. |
355 void OnConnectionDestroyed(Connection* conn); | 350 void OnConnectionDestroyed(Connection* conn); |
356 | 351 |
357 // Whether this port is dead, and hence, should be destroyed on the controlled | 352 // Whether this port is dead, and hence, should be destroyed on the controlled |
358 // side. | 353 // side. |
359 bool dead() const { | 354 bool dead() const { |
360 return ice_role_ == ICEROLE_CONTROLLED && connections_.empty(); | 355 return ice_role_ == ICEROLE_CONTROLLED && connections_.empty(); |
361 } | 356 } |
(...skipping 25 matching lines...) Expand all Loading... |
387 AddressMap connections_; | 382 AddressMap connections_; |
388 int timeout_delay_; | 383 int timeout_delay_; |
389 bool enable_port_packets_; | 384 bool enable_port_packets_; |
390 IceRole ice_role_; | 385 IceRole ice_role_; |
391 uint64_t tiebreaker_; | 386 uint64_t tiebreaker_; |
392 bool shared_socket_; | 387 bool shared_socket_; |
393 // Information to use when going through a proxy. | 388 // Information to use when going through a proxy. |
394 std::string user_agent_; | 389 std::string user_agent_; |
395 rtc::ProxyInfo proxy_; | 390 rtc::ProxyInfo proxy_; |
396 | 391 |
397 // Candidate filter is pushed down to Port such that each Port could | |
398 // make its own decision on how to create candidates. For example, | |
399 // when IceTransportsType is set to relay, both RelayPort and | |
400 // TurnPort will hide raddr to avoid local address leakage. | |
401 uint32_t candidate_filter_; | |
402 | |
403 // A virtual cost perceived by the user, usually based on the network type | 392 // A virtual cost perceived by the user, usually based on the network type |
404 // (WiFi. vs. Cellular). It takes precedence over the priority when | 393 // (WiFi. vs. Cellular). It takes precedence over the priority when |
405 // comparing two connections. | 394 // comparing two connections. |
406 uint16_t network_cost_; | 395 uint16_t network_cost_; |
407 | 396 |
408 friend class Connection; | 397 friend class Connection; |
409 }; | 398 }; |
410 | 399 |
411 // Represents a communication link between a port on the local client and a | 400 // Represents a communication link between a port on the local client and a |
412 // port on the remote client. | 401 // port on the remote client. |
(...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
670 const rtc::PacketOptions& options) override; | 659 const rtc::PacketOptions& options) override; |
671 int GetError() override { return error_; } | 660 int GetError() override { return error_; } |
672 | 661 |
673 private: | 662 private: |
674 int error_ = 0; | 663 int error_ = 0; |
675 }; | 664 }; |
676 | 665 |
677 } // namespace cricket | 666 } // namespace cricket |
678 | 667 |
679 #endif // WEBRTC_P2P_BASE_PORT_H_ | 668 #endif // WEBRTC_P2P_BASE_PORT_H_ |
OLD | NEW |