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://www.w3.org/TR/webrtc/#rtcicecandidatetype-enum |
| 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 { |
| 30 public: |
| 31 WEBRTC_RTCSTATS_IMPL(RTCStats, RTCIceCandidateStats, |
| 32 &ip, |
| 33 &port, |
| 34 &protocol, |
| 35 &candidate_type, |
| 36 &priority, |
| 37 &url); |
| 38 |
| 39 RTCStatsMember<std::string> ip; |
| 40 RTCStatsMember<int32_t> port; |
| 41 RTCStatsMember<std::string> protocol; |
| 42 // TODO(hbos): Support enum types? "RTCStatsMember<RTCIceCandidateType>"? |
| 43 RTCStatsMember<std::string> candidate_type; |
| 44 RTCStatsMember<int32_t> priority; |
| 45 RTCStatsMember<std::string> url; |
| 46 |
| 47 protected: |
| 48 RTCIceCandidateStats(const std::string& id, int64_t timestamp_us); |
| 49 RTCIceCandidateStats(std::string&& id, int64_t timestamp_us); |
| 50 }; |
| 51 |
| 52 // In the spec both local and remote varieties are of type RTCIceCandidateStats. |
| 53 // But here we define them as subclasses of |RTCIceCandidateStats| because the |
| 54 // |kType| need to be different ("RTCStatsType type") in the local/remote case. |
| 55 // https://w3c.github.io/webrtc-stats/#rtcstatstype-str* |
| 56 class RTCLocalIceCandidateStats final : public RTCIceCandidateStats { |
| 57 public: |
| 58 static const char kType[]; |
| 59 RTCLocalIceCandidateStats(const std::string& id, int64_t timestamp_us); |
| 60 RTCLocalIceCandidateStats(std::string&& id, int64_t timestamp_us); |
| 61 const char* type() const override { return kType; } |
| 62 }; |
| 63 |
| 64 class RTCRemoteIceCandidateStats final : public RTCIceCandidateStats { |
| 65 public: |
| 66 static const char kType[]; |
| 67 RTCRemoteIceCandidateStats(const std::string& id, int64_t timestamp_us); |
| 68 RTCRemoteIceCandidateStats(std::string&& id, int64_t timestamp_us); |
| 69 const char* type() const override { return kType; } |
| 70 }; |
| 71 |
20 // https://w3c.github.io/webrtc-stats/#certificatestats-dict* | 72 // https://w3c.github.io/webrtc-stats/#certificatestats-dict* |
21 class RTCCertificateStats : public RTCStats { | 73 class RTCCertificateStats : public RTCStats { |
22 public: | 74 public: |
23 RTCCertificateStats(const std::string& id, int64_t timestamp_us); | 75 RTCCertificateStats(const std::string& id, int64_t timestamp_us); |
24 RTCCertificateStats(std::string&& id, int64_t timestamp_us); | 76 RTCCertificateStats(std::string&& id, int64_t timestamp_us); |
25 | 77 |
26 WEBRTC_RTCSTATS_IMPL(RTCStats, RTCCertificateStats, | 78 WEBRTC_RTCSTATS_IMPL(RTCStats, RTCCertificateStats, |
27 &fingerprint, | 79 &fingerprint, |
28 &fingerprint_algorithm, | 80 &fingerprint_algorithm, |
29 &base64_certificate, | 81 &base64_certificate, |
(...skipping 16 matching lines...) Expand all Loading... |
46 &data_channels_opened, | 98 &data_channels_opened, |
47 &data_channels_closed); | 99 &data_channels_closed); |
48 | 100 |
49 RTCStatsMember<uint32_t> data_channels_opened; | 101 RTCStatsMember<uint32_t> data_channels_opened; |
50 RTCStatsMember<uint32_t> data_channels_closed; | 102 RTCStatsMember<uint32_t> data_channels_closed; |
51 }; | 103 }; |
52 | 104 |
53 } // namespace webrtc | 105 } // namespace webrtc |
54 | 106 |
55 #endif // WEBRTC_API_STATS_RTCSTATS_OBJECTS_H_ | 107 #endif // WEBRTC_API_STATS_RTCSTATS_OBJECTS_H_ |
OLD | NEW |