| 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 virtual void UpdateNetworkCost(); | 304 virtual void UpdateNetworkCost(); |
| 308 | 305 |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 342 | 339 |
| 343 // Checks if the address in addr is compatible with the port's ip. | 340 // Checks if the address in addr is compatible with the port's ip. |
| 344 bool IsCompatibleAddress(const rtc::SocketAddress& addr); | 341 bool IsCompatibleAddress(const rtc::SocketAddress& addr); |
| 345 | 342 |
| 346 // Returns default DSCP value. | 343 // Returns default DSCP value. |
| 347 rtc::DiffServCodePoint DefaultDscpValue() const { | 344 rtc::DiffServCodePoint DefaultDscpValue() const { |
| 348 // No change from what MediaChannel set. | 345 // No change from what MediaChannel set. |
| 349 return rtc::DSCP_NO_CHANGE; | 346 return rtc::DSCP_NO_CHANGE; |
| 350 } | 347 } |
| 351 | 348 |
| 352 uint32_t candidate_filter() { return candidate_filter_; } | |
| 353 | |
| 354 private: | 349 private: |
| 355 void Construct(); | 350 void Construct(); |
| 356 // Called when one of our connections deletes itself. | 351 // Called when one of our connections deletes itself. |
| 357 void OnConnectionDestroyed(Connection* conn); | 352 void OnConnectionDestroyed(Connection* conn); |
| 358 | 353 |
| 359 // Whether this port is dead, and hence, should be destroyed on the controlled | 354 // Whether this port is dead, and hence, should be destroyed on the controlled |
| 360 // side. | 355 // side. |
| 361 bool dead() const { | 356 bool dead() const { |
| 362 return ice_role_ == ICEROLE_CONTROLLED && connections_.empty(); | 357 return ice_role_ == ICEROLE_CONTROLLED && connections_.empty(); |
| 363 } | 358 } |
| (...skipping 27 matching lines...) Expand all Loading... |
| 391 AddressMap connections_; | 386 AddressMap connections_; |
| 392 int timeout_delay_; | 387 int timeout_delay_; |
| 393 bool enable_port_packets_; | 388 bool enable_port_packets_; |
| 394 IceRole ice_role_; | 389 IceRole ice_role_; |
| 395 uint64_t tiebreaker_; | 390 uint64_t tiebreaker_; |
| 396 bool shared_socket_; | 391 bool shared_socket_; |
| 397 // Information to use when going through a proxy. | 392 // Information to use when going through a proxy. |
| 398 std::string user_agent_; | 393 std::string user_agent_; |
| 399 rtc::ProxyInfo proxy_; | 394 rtc::ProxyInfo proxy_; |
| 400 | 395 |
| 401 // Candidate filter is pushed down to Port such that each Port could | |
| 402 // make its own decision on how to create candidates. For example, | |
| 403 // when IceTransportsType is set to relay, both RelayPort and | |
| 404 // TurnPort will hide raddr to avoid local address leakage. | |
| 405 uint32_t candidate_filter_; | |
| 406 | |
| 407 // A virtual cost perceived by the user, usually based on the network type | 396 // A virtual cost perceived by the user, usually based on the network type |
| 408 // (WiFi. vs. Cellular). It takes precedence over the priority when | 397 // (WiFi. vs. Cellular). It takes precedence over the priority when |
| 409 // comparing two connections. | 398 // comparing two connections. |
| 410 uint16_t network_cost_; | 399 uint16_t network_cost_; |
| 411 | 400 |
| 412 friend class Connection; | 401 friend class Connection; |
| 413 }; | 402 }; |
| 414 | 403 |
| 415 // Represents a communication link between a port on the local client and a | 404 // Represents a communication link between a port on the local client and a |
| 416 // port on the remote client. | 405 // port on the remote client. |
| (...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 674 const rtc::PacketOptions& options) override; | 663 const rtc::PacketOptions& options) override; |
| 675 int GetError() override { return error_; } | 664 int GetError() override { return error_; } |
| 676 | 665 |
| 677 private: | 666 private: |
| 678 int error_ = 0; | 667 int error_ = 0; |
| 679 }; | 668 }; |
| 680 | 669 |
| 681 } // namespace cricket | 670 } // namespace cricket |
| 682 | 671 |
| 683 #endif // WEBRTC_P2P_BASE_PORT_H_ | 672 #endif // WEBRTC_P2P_BASE_PORT_H_ |
| OLD | NEW |