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 |
11 #ifndef WEBRTC_P2P_BASE_PORT_H_ | 11 #ifndef WEBRTC_P2P_BASE_PORT_H_ |
12 #define WEBRTC_P2P_BASE_PORT_H_ | 12 #define WEBRTC_P2P_BASE_PORT_H_ |
13 | 13 |
14 #include <map> | 14 #include <map> |
15 #include <memory> | 15 #include <memory> |
16 #include <set> | 16 #include <set> |
17 #include <string> | 17 #include <string> |
18 #include <vector> | 18 #include <vector> |
19 | 19 |
20 #include "webrtc/p2p/base/candidate.h" | |
21 #include "webrtc/p2p/base/candidatepairinterface.h" | |
22 #include "webrtc/p2p/base/jseptransport.h" | |
23 #include "webrtc/p2p/base/packetsocketfactory.h" | |
24 #include "webrtc/p2p/base/portinterface.h" | |
25 #include "webrtc/p2p/base/stun.h" | |
26 #include "webrtc/p2p/base/stunrequest.h" | |
27 #include "webrtc/base/asyncpacketsocket.h" | 20 #include "webrtc/base/asyncpacketsocket.h" |
28 #include "webrtc/base/checks.h" | 21 #include "webrtc/base/checks.h" |
29 #include "webrtc/base/network.h" | 22 #include "webrtc/base/network.h" |
30 #include "webrtc/base/optional.h" | 23 #include "webrtc/base/optional.h" |
31 #include "webrtc/base/proxyinfo.h" | 24 #include "webrtc/base/proxyinfo.h" |
32 #include "webrtc/base/ratetracker.h" | 25 #include "webrtc/base/ratetracker.h" |
33 #include "webrtc/base/sigslot.h" | 26 #include "webrtc/base/sigslot.h" |
34 #include "webrtc/base/socketaddress.h" | 27 #include "webrtc/base/socketaddress.h" |
35 #include "webrtc/base/thread.h" | 28 #include "webrtc/base/thread.h" |
| 29 #include "webrtc/p2p/base/candidate.h" |
| 30 #include "webrtc/p2p/base/candidatepairinterface.h" |
| 31 #include "webrtc/p2p/base/jseptransport.h" |
| 32 #include "webrtc/p2p/base/packetlossestimator.h" |
| 33 #include "webrtc/p2p/base/packetsocketfactory.h" |
| 34 #include "webrtc/p2p/base/portinterface.h" |
| 35 #include "webrtc/p2p/base/stun.h" |
| 36 #include "webrtc/p2p/base/stunrequest.h" |
36 | 37 |
37 namespace cricket { | 38 namespace cricket { |
38 | 39 |
39 class Connection; | 40 class Connection; |
40 class ConnectionRequest; | 41 class ConnectionRequest; |
41 | 42 |
42 extern const char LOCAL_PORT_TYPE[]; | 43 extern const char LOCAL_PORT_TYPE[]; |
43 extern const char STUN_PORT_TYPE[]; | 44 extern const char STUN_PORT_TYPE[]; |
44 extern const char PRFLX_PORT_TYPE[]; | 45 extern const char PRFLX_PORT_TYPE[]; |
45 extern const char RELAY_PORT_TYPE[]; | 46 extern const char RELAY_PORT_TYPE[]; |
(...skipping 666 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
712 // https://w3c.github.io/webrtc-stats/#dom-rtcicecandidatepairstats-currentrou
ndtriptime | 713 // https://w3c.github.io/webrtc-stats/#dom-rtcicecandidatepairstats-currentrou
ndtriptime |
713 rtc::Optional<uint32_t> current_round_trip_time_ms_; | 714 rtc::Optional<uint32_t> current_round_trip_time_ms_; |
714 int64_t last_ping_sent_; // last time we sent a ping to the other side | 715 int64_t last_ping_sent_; // last time we sent a ping to the other side |
715 int64_t last_ping_received_; // last time we received a ping from the other | 716 int64_t last_ping_received_; // last time we received a ping from the other |
716 // side | 717 // side |
717 int64_t last_data_received_; | 718 int64_t last_data_received_; |
718 int64_t last_ping_response_received_; | 719 int64_t last_ping_response_received_; |
719 int64_t receiving_unchanged_since_ = 0; | 720 int64_t receiving_unchanged_since_ = 0; |
720 std::vector<SentPing> pings_since_last_response_; | 721 std::vector<SentPing> pings_since_last_response_; |
721 | 722 |
| 723 PacketLossEstimator packet_loss_estimator_; |
| 724 |
722 bool reported_; | 725 bool reported_; |
723 IceCandidatePairState state_; | 726 IceCandidatePairState state_; |
724 // Time duration to switch from receiving to not receiving. | 727 // Time duration to switch from receiving to not receiving. |
725 int receiving_timeout_; | 728 int receiving_timeout_; |
726 int64_t time_created_ms_; | 729 int64_t time_created_ms_; |
727 int num_pings_sent_ = 0; | 730 int num_pings_sent_ = 0; |
728 | 731 |
729 friend class Port; | 732 friend class Port; |
730 friend class ConnectionRequest; | 733 friend class ConnectionRequest; |
731 }; | 734 }; |
732 | 735 |
733 // ProxyConnection defers all the interesting work to the port. | 736 // ProxyConnection defers all the interesting work to the port. |
734 class ProxyConnection : public Connection { | 737 class ProxyConnection : public Connection { |
735 public: | 738 public: |
736 ProxyConnection(Port* port, size_t index, const Candidate& remote_candidate); | 739 ProxyConnection(Port* port, size_t index, const Candidate& remote_candidate); |
737 | 740 |
738 int Send(const void* data, | 741 int Send(const void* data, |
739 size_t size, | 742 size_t size, |
740 const rtc::PacketOptions& options) override; | 743 const rtc::PacketOptions& options) override; |
741 int GetError() override { return error_; } | 744 int GetError() override { return error_; } |
742 | 745 |
743 private: | 746 private: |
744 int error_ = 0; | 747 int error_ = 0; |
745 }; | 748 }; |
746 | 749 |
747 } // namespace cricket | 750 } // namespace cricket |
748 | 751 |
749 #endif // WEBRTC_P2P_BASE_PORT_H_ | 752 #endif // WEBRTC_P2P_BASE_PORT_H_ |
OLD | NEW |