hbos | d565b73 | 2016-08-30 14:04:35 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2016 The WebRTC Project Authors. All rights reserved. |
| 3 | * |
| 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 |
| 6 | * tree. An additional intellectual property rights grant can be found |
| 7 | * in the file PATENTS. All contributing project authors may |
| 8 | * be found in the AUTHORS file in the root of the source tree. |
| 9 | */ |
| 10 | |
hbos | 74e1a4f | 2016-09-15 23:33:01 -0700 | [diff] [blame] | 11 | #include "webrtc/api/stats/rtcstats_objects.h" |
hbos | d565b73 | 2016-08-30 14:04:35 -0700 | [diff] [blame] | 12 | |
| 13 | namespace webrtc { |
| 14 | |
hbos | ab9f6e4 | 2016-10-07 02:18:47 -0700 | [diff] [blame] | 15 | const char* RTCIceCandidateType::kHost = "host"; |
| 16 | const char* RTCIceCandidateType::kSrflx = "srflx"; |
| 17 | const char* RTCIceCandidateType::kPrflx = "prflx"; |
| 18 | const char* RTCIceCandidateType::kRelay = "relay"; |
| 19 | |
| 20 | WEBRTC_RTCSTATS_IMPL(RTCIceCandidateStats, RTCStats, "ice-candidate", |
| 21 | &ip, |
| 22 | &port, |
| 23 | &protocol, |
| 24 | &candidate_type, |
| 25 | &priority, |
| 26 | &url); |
| 27 | |
| 28 | RTCIceCandidateStats::RTCIceCandidateStats( |
| 29 | const std::string& id, int64_t timestamp_us) |
| 30 | : RTCIceCandidateStats(std::string(id), timestamp_us) { |
| 31 | } |
| 32 | |
| 33 | RTCIceCandidateStats::RTCIceCandidateStats( |
| 34 | std::string&& id, int64_t timestamp_us) |
| 35 | : RTCStats(std::move(id), timestamp_us), |
| 36 | ip("ip"), |
| 37 | port("port"), |
| 38 | protocol("protocol"), |
| 39 | candidate_type("candidateType"), |
| 40 | priority("priority"), |
| 41 | url("url") { |
| 42 | } |
| 43 | |
| 44 | RTCIceCandidateStats::RTCIceCandidateStats(const RTCIceCandidateStats& other) |
| 45 | : RTCStats(other.id(), other.timestamp_us()), |
| 46 | ip(other.ip), |
| 47 | port(other.port), |
| 48 | protocol(other.protocol), |
| 49 | candidate_type(other.candidate_type), |
| 50 | priority(other.priority), |
| 51 | url(other.url) { |
| 52 | } |
| 53 | |
| 54 | RTCIceCandidateStats::~RTCIceCandidateStats() { |
| 55 | } |
| 56 | |
| 57 | const char RTCLocalIceCandidateStats::kType[] = "local-candidate"; |
| 58 | |
| 59 | RTCLocalIceCandidateStats::RTCLocalIceCandidateStats( |
| 60 | const std::string& id, int64_t timestamp_us) |
| 61 | : RTCIceCandidateStats(id, timestamp_us) { |
| 62 | } |
| 63 | |
| 64 | RTCLocalIceCandidateStats::RTCLocalIceCandidateStats( |
| 65 | std::string&& id, int64_t timestamp_us) |
| 66 | : RTCIceCandidateStats(std::move(id), timestamp_us) { |
| 67 | } |
| 68 | |
| 69 | const char* RTCLocalIceCandidateStats::type() const { |
| 70 | return kType; |
| 71 | } |
| 72 | |
| 73 | const char RTCRemoteIceCandidateStats::kType[] = "remote-candidate"; |
| 74 | |
| 75 | RTCRemoteIceCandidateStats::RTCRemoteIceCandidateStats( |
| 76 | const std::string& id, int64_t timestamp_us) |
| 77 | : RTCIceCandidateStats(id, timestamp_us) { |
| 78 | } |
| 79 | |
| 80 | RTCRemoteIceCandidateStats::RTCRemoteIceCandidateStats( |
| 81 | std::string&& id, int64_t timestamp_us) |
| 82 | : RTCIceCandidateStats(std::move(id), timestamp_us) { |
| 83 | } |
| 84 | |
| 85 | const char* RTCRemoteIceCandidateStats::type() const { |
| 86 | return kType; |
| 87 | } |
| 88 | |
hbos | fc5e050 | 2016-10-06 02:06:10 -0700 | [diff] [blame] | 89 | WEBRTC_RTCSTATS_IMPL(RTCCertificateStats, RTCStats, "certificate", |
| 90 | &fingerprint, |
| 91 | &fingerprint_algorithm, |
| 92 | &base64_certificate, |
| 93 | &issuer_certificate_id); |
hbos | 6ab97ce | 2016-10-03 14:16:56 -0700 | [diff] [blame] | 94 | |
| 95 | RTCCertificateStats::RTCCertificateStats( |
| 96 | const std::string& id, int64_t timestamp_us) |
| 97 | : RTCCertificateStats(std::string(id), timestamp_us) { |
| 98 | } |
| 99 | |
| 100 | RTCCertificateStats::RTCCertificateStats( |
| 101 | std::string&& id, int64_t timestamp_us) |
| 102 | : RTCStats(std::move(id), timestamp_us), |
| 103 | fingerprint("fingerprint"), |
| 104 | fingerprint_algorithm("fingerprintAlgorithm"), |
| 105 | base64_certificate("base64Certificate"), |
| 106 | issuer_certificate_id("issuerCertificateId") { |
| 107 | } |
| 108 | |
hbos | fc5e050 | 2016-10-06 02:06:10 -0700 | [diff] [blame] | 109 | RTCCertificateStats::RTCCertificateStats( |
| 110 | const RTCCertificateStats& other) |
| 111 | : RTCStats(other.id(), other.timestamp_us()), |
| 112 | fingerprint(other.fingerprint), |
| 113 | fingerprint_algorithm(other.fingerprint_algorithm), |
| 114 | base64_certificate(other.base64_certificate), |
| 115 | issuer_certificate_id(other.issuer_certificate_id) { |
| 116 | } |
| 117 | |
| 118 | RTCCertificateStats::~RTCCertificateStats() { |
| 119 | } |
| 120 | |
| 121 | WEBRTC_RTCSTATS_IMPL(RTCPeerConnectionStats, RTCStats, "peer-connection", |
| 122 | &data_channels_opened, |
| 123 | &data_channels_closed); |
hbos | d565b73 | 2016-08-30 14:04:35 -0700 | [diff] [blame] | 124 | |
| 125 | RTCPeerConnectionStats::RTCPeerConnectionStats( |
hbos | 0e6758d | 2016-08-31 07:57:36 -0700 | [diff] [blame] | 126 | const std::string& id, int64_t timestamp_us) |
| 127 | : RTCPeerConnectionStats(std::string(id), timestamp_us) { |
hbos | d565b73 | 2016-08-30 14:04:35 -0700 | [diff] [blame] | 128 | } |
| 129 | |
| 130 | RTCPeerConnectionStats::RTCPeerConnectionStats( |
hbos | 0e6758d | 2016-08-31 07:57:36 -0700 | [diff] [blame] | 131 | std::string&& id, int64_t timestamp_us) |
| 132 | : RTCStats(std::move(id), timestamp_us), |
hbos | d565b73 | 2016-08-30 14:04:35 -0700 | [diff] [blame] | 133 | data_channels_opened("dataChannelsOpened"), |
| 134 | data_channels_closed("dataChannelsClosed") { |
| 135 | } |
| 136 | |
hbos | fc5e050 | 2016-10-06 02:06:10 -0700 | [diff] [blame] | 137 | RTCPeerConnectionStats::RTCPeerConnectionStats( |
| 138 | const RTCPeerConnectionStats& other) |
| 139 | : RTCStats(other.id(), other.timestamp_us()), |
| 140 | data_channels_opened(other.data_channels_opened), |
| 141 | data_channels_closed(other.data_channels_closed) { |
| 142 | } |
| 143 | |
| 144 | RTCPeerConnectionStats::~RTCPeerConnectionStats() { |
| 145 | } |
| 146 | |
hbos | d565b73 | 2016-08-30 14:04:35 -0700 | [diff] [blame] | 147 | } // namespace webrtc |