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 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
82 | 82 |
83 enum IcePriorityValue { | 83 enum IcePriorityValue { |
84 // The reason we are choosing Relay preference 2 is because, we can run | 84 // The reason we are choosing Relay preference 2 is because, we can run |
85 // Relay from client to server on UDP/TCP/TLS. To distinguish the transport | 85 // Relay from client to server on UDP/TCP/TLS. To distinguish the transport |
86 // protocol, we prefer UDP over TCP over TLS. | 86 // protocol, we prefer UDP over TCP over TLS. |
87 // For UDP ICE_TYPE_PREFERENCE_RELAY will be 2. | 87 // For UDP ICE_TYPE_PREFERENCE_RELAY will be 2. |
88 // For TCP ICE_TYPE_PREFERENCE_RELAY will be 1. | 88 // For TCP ICE_TYPE_PREFERENCE_RELAY will be 1. |
89 // For TLS ICE_TYPE_PREFERENCE_RELAY will be 0. | 89 // For TLS ICE_TYPE_PREFERENCE_RELAY will be 0. |
90 // Check turnport.cc for setting these values. | 90 // Check turnport.cc for setting these values. |
91 ICE_TYPE_PREFERENCE_RELAY = 2, | 91 ICE_TYPE_PREFERENCE_RELAY = 2, |
| 92 ICE_TYPE_PREFERENCE_PRFLX_TCP = 80, |
92 ICE_TYPE_PREFERENCE_HOST_TCP = 90, | 93 ICE_TYPE_PREFERENCE_HOST_TCP = 90, |
93 ICE_TYPE_PREFERENCE_SRFLX = 100, | 94 ICE_TYPE_PREFERENCE_SRFLX = 100, |
94 ICE_TYPE_PREFERENCE_PRFLX = 110, | 95 ICE_TYPE_PREFERENCE_PRFLX = 110, |
95 ICE_TYPE_PREFERENCE_HOST = 126 | 96 ICE_TYPE_PREFERENCE_HOST = 126 |
96 }; | 97 }; |
97 | 98 |
98 const char* ProtoToString(ProtocolType proto); | 99 const char* ProtoToString(ProtocolType proto); |
99 bool StringToProto(const char* value, ProtocolType* proto); | 100 bool StringToProto(const char* value, ProtocolType* proto); |
100 | 101 |
101 struct ProtocolAddress { | 102 struct ProtocolAddress { |
(...skipping 547 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
649 int64_t last_data_received_; | 650 int64_t last_data_received_; |
650 int64_t last_ping_response_received_; | 651 int64_t last_ping_response_received_; |
651 std::vector<SentPing> pings_since_last_response_; | 652 std::vector<SentPing> pings_since_last_response_; |
652 | 653 |
653 rtc::RateTracker recv_rate_tracker_; | 654 rtc::RateTracker recv_rate_tracker_; |
654 rtc::RateTracker send_rate_tracker_; | 655 rtc::RateTracker send_rate_tracker_; |
655 | 656 |
656 ConnectionInfo stats_; | 657 ConnectionInfo stats_; |
657 | 658 |
658 private: | 659 private: |
659 void MaybeAddPrflxCandidate(ConnectionRequest* request, | 660 // Update the local candidate based on the mapped address attribute. |
660 StunMessage* response); | 661 // If the local candidate changed, fires SignalStateChange. |
| 662 void MaybeUpdateLocalCandidate(ConnectionRequest* request, |
| 663 StunMessage* response); |
661 | 664 |
662 bool reported_; | 665 bool reported_; |
663 State state_; | 666 State state_; |
664 // Time duration to switch from receiving to not receiving. | 667 // Time duration to switch from receiving to not receiving. |
665 int receiving_timeout_; | 668 int receiving_timeout_; |
666 int64_t time_created_ms_; | 669 int64_t time_created_ms_; |
667 int num_pings_sent_ = 0; | 670 int num_pings_sent_ = 0; |
668 | 671 |
669 friend class Port; | 672 friend class Port; |
670 friend class ConnectionRequest; | 673 friend class ConnectionRequest; |
671 }; | 674 }; |
672 | 675 |
673 // ProxyConnection defers all the interesting work to the port. | 676 // ProxyConnection defers all the interesting work to the port. |
674 class ProxyConnection : public Connection { | 677 class ProxyConnection : public Connection { |
675 public: | 678 public: |
676 ProxyConnection(Port* port, size_t index, const Candidate& remote_candidate); | 679 ProxyConnection(Port* port, size_t index, const Candidate& remote_candidate); |
677 | 680 |
678 int Send(const void* data, | 681 int Send(const void* data, |
679 size_t size, | 682 size_t size, |
680 const rtc::PacketOptions& options) override; | 683 const rtc::PacketOptions& options) override; |
681 int GetError() override { return error_; } | 684 int GetError() override { return error_; } |
682 | 685 |
683 private: | 686 private: |
684 int error_ = 0; | 687 int error_ = 0; |
685 }; | 688 }; |
686 | 689 |
687 } // namespace cricket | 690 } // namespace cricket |
688 | 691 |
689 #endif // WEBRTC_P2P_BASE_PORT_H_ | 692 #endif // WEBRTC_P2P_BASE_PORT_H_ |
OLD | NEW |