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 class RTCRemoteIceCandidateStats final : public RTCIceCandidateStats { | |
hta-webrtc
2016/10/04 14:12:46
Blank line between top level constructs (such as c
hbos
2016/10/05 10:16:30
Done.
| |
64 public: | |
65 static const char kType[]; | |
66 RTCRemoteIceCandidateStats(const std::string& id, int64_t timestamp_us); | |
67 RTCRemoteIceCandidateStats(std::string&& id, int64_t timestamp_us); | |
68 const char* type() const override { return kType; } | |
69 }; | |
70 | |
20 // https://w3c.github.io/webrtc-stats/#certificatestats-dict* | 71 // https://w3c.github.io/webrtc-stats/#certificatestats-dict* |
21 class RTCCertificateStats : public RTCStats { | 72 class RTCCertificateStats : public RTCStats { |
22 public: | 73 public: |
23 RTCCertificateStats(const std::string& id, int64_t timestamp_us); | 74 RTCCertificateStats(const std::string& id, int64_t timestamp_us); |
24 RTCCertificateStats(std::string&& id, int64_t timestamp_us); | 75 RTCCertificateStats(std::string&& id, int64_t timestamp_us); |
25 | 76 |
26 WEBRTC_RTCSTATS_IMPL(RTCStats, RTCCertificateStats, | 77 WEBRTC_RTCSTATS_IMPL(RTCStats, RTCCertificateStats, |
27 &fingerprint, | 78 &fingerprint, |
28 &fingerprint_algorithm, | 79 &fingerprint_algorithm, |
29 &base64_certificate, | 80 &base64_certificate, |
(...skipping 16 matching lines...) Expand all Loading... | |
46 &data_channels_opened, | 97 &data_channels_opened, |
47 &data_channels_closed); | 98 &data_channels_closed); |
48 | 99 |
49 RTCStatsMember<uint32_t> data_channels_opened; | 100 RTCStatsMember<uint32_t> data_channels_opened; |
50 RTCStatsMember<uint32_t> data_channels_closed; | 101 RTCStatsMember<uint32_t> data_channels_closed; |
51 }; | 102 }; |
52 | 103 |
53 } // namespace webrtc | 104 } // namespace webrtc |
54 | 105 |
55 #endif // WEBRTC_API_STATS_RTCSTATS_OBJECTS_H_ | 106 #endif // WEBRTC_API_STATS_RTCSTATS_OBJECTS_H_ |
OLD | NEW |