OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2016 The WebRTC Project Authors. All rights reserved. | 2 * Copyright 2016 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_API_STATS_RTCSTATS_OBJECTS_H_ | 11 #ifndef WEBRTC_API_STATS_RTCSTATS_OBJECTS_H_ |
12 #define WEBRTC_API_STATS_RTCSTATS_OBJECTS_H_ | 12 #define WEBRTC_API_STATS_RTCSTATS_OBJECTS_H_ |
13 | 13 |
14 #include <string> | 14 #include <string> |
15 | 15 |
16 #include "webrtc/api/stats/rtcstats.h" | 16 #include "webrtc/api/stats/rtcstats.h" |
17 | 17 |
18 namespace webrtc { | 18 namespace webrtc { |
19 | 19 |
20 // https://w3c.github.io/webrtc-stats/#certificatestats-dict* | 20 // https://www.w3.org/TR/webrtc/#rtcicecandidatetype-enum |
21 class RTCCertificateStats : public RTCStats { | 21 struct RTCIceCandidateType { |
| 22 static const char* kHost; |
| 23 static const char* kSrflx; |
| 24 static const char* kPrflx; |
| 25 static const char* kRelay; |
| 26 }; |
| 27 |
| 28 // https://w3c.github.io/webrtc-stats/#icecandidate-dict* |
| 29 class RTCIceCandidateStats : public RTCStats { |
22 public: | 30 public: |
23 WEBRTC_RTCSTATS_DECL(); | 31 WEBRTC_RTCSTATS_DECL(); |
24 | 32 |
| 33 RTCIceCandidateStats(const RTCIceCandidateStats& other); |
| 34 ~RTCIceCandidateStats() override; |
| 35 |
| 36 RTCStatsMember<std::string> ip; |
| 37 RTCStatsMember<int32_t> port; |
| 38 RTCStatsMember<std::string> protocol; |
| 39 // TODO(hbos): Support enum types? "RTCStatsMember<RTCIceCandidateType>"? |
| 40 RTCStatsMember<std::string> candidate_type; |
| 41 RTCStatsMember<int32_t> priority; |
| 42 RTCStatsMember<std::string> url; |
| 43 |
| 44 protected: |
| 45 RTCIceCandidateStats(const std::string& id, int64_t timestamp_us); |
| 46 RTCIceCandidateStats(std::string&& id, int64_t timestamp_us); |
| 47 }; |
| 48 |
| 49 // In the spec both local and remote varieties are of type RTCIceCandidateStats. |
| 50 // But here we define them as subclasses of |RTCIceCandidateStats| because the |
| 51 // |kType| need to be different ("RTCStatsType type") in the local/remote case. |
| 52 // https://w3c.github.io/webrtc-stats/#rtcstatstype-str* |
| 53 class RTCLocalIceCandidateStats final : public RTCIceCandidateStats { |
| 54 public: |
| 55 static const char kType[]; |
| 56 RTCLocalIceCandidateStats(const std::string& id, int64_t timestamp_us); |
| 57 RTCLocalIceCandidateStats(std::string&& id, int64_t timestamp_us); |
| 58 const char* type() const override; |
| 59 }; |
| 60 |
| 61 class RTCRemoteIceCandidateStats final : public RTCIceCandidateStats { |
| 62 public: |
| 63 static const char kType[]; |
| 64 RTCRemoteIceCandidateStats(const std::string& id, int64_t timestamp_us); |
| 65 RTCRemoteIceCandidateStats(std::string&& id, int64_t timestamp_us); |
| 66 const char* type() const override; |
| 67 }; |
| 68 |
| 69 // https://w3c.github.io/webrtc-stats/#certificatestats-dict* |
| 70 class RTCCertificateStats final : public RTCStats { |
| 71 public: |
| 72 WEBRTC_RTCSTATS_DECL(); |
| 73 |
25 RTCCertificateStats(const std::string& id, int64_t timestamp_us); | 74 RTCCertificateStats(const std::string& id, int64_t timestamp_us); |
26 RTCCertificateStats(std::string&& id, int64_t timestamp_us); | 75 RTCCertificateStats(std::string&& id, int64_t timestamp_us); |
27 RTCCertificateStats(const RTCCertificateStats& other); | 76 RTCCertificateStats(const RTCCertificateStats& other); |
28 ~RTCCertificateStats() override; | 77 ~RTCCertificateStats() override; |
29 | 78 |
30 RTCStatsMember<std::string> fingerprint; | 79 RTCStatsMember<std::string> fingerprint; |
31 RTCStatsMember<std::string> fingerprint_algorithm; | 80 RTCStatsMember<std::string> fingerprint_algorithm; |
32 RTCStatsMember<std::string> base64_certificate; | 81 RTCStatsMember<std::string> base64_certificate; |
33 RTCStatsMember<std::string> issuer_certificate_id; | 82 RTCStatsMember<std::string> issuer_certificate_id; |
34 }; | 83 }; |
35 | 84 |
36 // https://w3c.github.io/webrtc-stats/#pcstats-dict* | 85 // https://w3c.github.io/webrtc-stats/#pcstats-dict* |
37 // TODO(hbos): Tracking bug crbug.com/636818 | 86 // TODO(hbos): Tracking bug crbug.com/636818 |
38 class RTCPeerConnectionStats : public RTCStats { | 87 class RTCPeerConnectionStats final : public RTCStats { |
39 public: | 88 public: |
40 WEBRTC_RTCSTATS_DECL(); | 89 WEBRTC_RTCSTATS_DECL(); |
41 | 90 |
42 RTCPeerConnectionStats(const std::string& id, int64_t timestamp_us); | 91 RTCPeerConnectionStats(const std::string& id, int64_t timestamp_us); |
43 RTCPeerConnectionStats(std::string&& id, int64_t timestamp_us); | 92 RTCPeerConnectionStats(std::string&& id, int64_t timestamp_us); |
44 RTCPeerConnectionStats(const RTCPeerConnectionStats& other); | 93 RTCPeerConnectionStats(const RTCPeerConnectionStats& other); |
45 ~RTCPeerConnectionStats() override; | 94 ~RTCPeerConnectionStats() override; |
46 | 95 |
47 RTCStatsMember<uint32_t> data_channels_opened; | 96 RTCStatsMember<uint32_t> data_channels_opened; |
48 RTCStatsMember<uint32_t> data_channels_closed; | 97 RTCStatsMember<uint32_t> data_channels_closed; |
49 }; | 98 }; |
50 | 99 |
51 } // namespace webrtc | 100 } // namespace webrtc |
52 | 101 |
53 #endif // WEBRTC_API_STATS_RTCSTATS_OBJECTS_H_ | 102 #endif // WEBRTC_API_STATS_RTCSTATS_OBJECTS_H_ |
OLD | NEW |