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 | cc555c5 | 2016-10-18 12:48:31 -0700 | [diff] [blame] | 15 | const char* RTCDataChannelState::kConnecting = "connecting"; |
| 16 | const char* RTCDataChannelState::kOpen = "open"; |
| 17 | const char* RTCDataChannelState::kClosing = "closing"; |
| 18 | const char* RTCDataChannelState::kClosed = "closed"; |
| 19 | |
hbos | c47a0c3 | 2016-10-11 14:54:49 -0700 | [diff] [blame] | 20 | const char* RTCStatsIceCandidatePairState::kFrozen = "frozen"; |
| 21 | const char* RTCStatsIceCandidatePairState::kWaiting = "waiting"; |
| 22 | const char* RTCStatsIceCandidatePairState::kInProgress = "inprogress"; |
| 23 | const char* RTCStatsIceCandidatePairState::kFailed = "failed"; |
| 24 | const char* RTCStatsIceCandidatePairState::kSucceeded = "succeeded"; |
| 25 | const char* RTCStatsIceCandidatePairState::kCancelled = "cancelled"; |
| 26 | |
| 27 | // Strings defined in https://tools.ietf.org/html/rfc5245. |
hbos | ab9f6e4 | 2016-10-07 02:18:47 -0700 | [diff] [blame] | 28 | const char* RTCIceCandidateType::kHost = "host"; |
| 29 | const char* RTCIceCandidateType::kSrflx = "srflx"; |
| 30 | const char* RTCIceCandidateType::kPrflx = "prflx"; |
| 31 | const char* RTCIceCandidateType::kRelay = "relay"; |
| 32 | |
hbos | c47a0c3 | 2016-10-11 14:54:49 -0700 | [diff] [blame] | 33 | WEBRTC_RTCSTATS_IMPL(RTCIceCandidatePairStats, RTCStats, "candidate-pair", |
| 34 | &transport_id, |
| 35 | &local_candidate_id, |
| 36 | &remote_candidate_id, |
| 37 | &state, |
| 38 | &priority, |
| 39 | &nominated, |
| 40 | &writable, |
| 41 | &readable, |
| 42 | &bytes_sent, |
| 43 | &bytes_received, |
| 44 | &total_rtt, |
| 45 | ¤t_rtt, |
| 46 | &available_outgoing_bitrate, |
| 47 | &available_incoming_bitrate, |
| 48 | &requests_received, |
| 49 | &requests_sent, |
| 50 | &responses_received, |
| 51 | &responses_sent, |
| 52 | &retransmissions_received, |
| 53 | &retransmissions_sent, |
| 54 | &consent_requests_received, |
| 55 | &consent_requests_sent, |
| 56 | &consent_responses_received, |
| 57 | &consent_responses_sent); |
| 58 | |
| 59 | RTCIceCandidatePairStats::RTCIceCandidatePairStats( |
| 60 | const std::string& id, int64_t timestamp_us) |
| 61 | : RTCIceCandidatePairStats(std::string(id), timestamp_us) { |
| 62 | } |
| 63 | |
| 64 | RTCIceCandidatePairStats::RTCIceCandidatePairStats( |
| 65 | std::string&& id, int64_t timestamp_us) |
| 66 | : RTCStats(std::move(id), timestamp_us), |
| 67 | transport_id("transportId"), |
| 68 | local_candidate_id("localCandidateId"), |
| 69 | remote_candidate_id("remoteCandidateId"), |
| 70 | state("state"), |
| 71 | priority("priority"), |
| 72 | nominated("nominated"), |
| 73 | writable("writable"), |
| 74 | readable("readable"), |
| 75 | bytes_sent("bytesSent"), |
| 76 | bytes_received("bytesReceived"), |
| 77 | total_rtt("totalRtt"), |
| 78 | current_rtt("currentRtt"), |
| 79 | available_outgoing_bitrate("availableOutgoingBitrate"), |
| 80 | available_incoming_bitrate("availableIncomingBitrate"), |
| 81 | requests_received("requestsReceived"), |
| 82 | requests_sent("requestsSent"), |
| 83 | responses_received("responsesReceived"), |
| 84 | responses_sent("responsesSent"), |
| 85 | retransmissions_received("retransmissionsReceived"), |
| 86 | retransmissions_sent("retransmissionsSent"), |
| 87 | consent_requests_received("consentRequestsReceived"), |
| 88 | consent_requests_sent("consentRequestsSent"), |
| 89 | consent_responses_received("consentResponsesReceived"), |
| 90 | consent_responses_sent("consentResponsesSent") { |
| 91 | } |
| 92 | |
| 93 | RTCIceCandidatePairStats::RTCIceCandidatePairStats( |
| 94 | const RTCIceCandidatePairStats& other) |
| 95 | : RTCStats(other.id(), other.timestamp_us()), |
| 96 | transport_id(other.transport_id), |
| 97 | local_candidate_id(other.local_candidate_id), |
| 98 | remote_candidate_id(other.remote_candidate_id), |
| 99 | state(other.state), |
| 100 | priority(other.priority), |
| 101 | nominated(other.nominated), |
| 102 | writable(other.writable), |
| 103 | readable(other.readable), |
| 104 | bytes_sent(other.bytes_sent), |
| 105 | bytes_received(other.bytes_received), |
| 106 | total_rtt(other.total_rtt), |
| 107 | current_rtt(other.current_rtt), |
| 108 | available_outgoing_bitrate(other.available_outgoing_bitrate), |
| 109 | available_incoming_bitrate(other.available_incoming_bitrate), |
| 110 | requests_received(other.requests_received), |
| 111 | requests_sent(other.requests_sent), |
| 112 | responses_received(other.responses_received), |
| 113 | responses_sent(other.responses_sent), |
| 114 | retransmissions_received(other.retransmissions_received), |
| 115 | retransmissions_sent(other.retransmissions_sent), |
| 116 | consent_requests_received(other.consent_requests_received), |
| 117 | consent_requests_sent(other.consent_requests_sent), |
| 118 | consent_responses_received(other.consent_responses_received), |
| 119 | consent_responses_sent(other.consent_responses_sent) { |
| 120 | } |
| 121 | |
| 122 | RTCIceCandidatePairStats::~RTCIceCandidatePairStats() { |
| 123 | } |
| 124 | |
hbos | ab9f6e4 | 2016-10-07 02:18:47 -0700 | [diff] [blame] | 125 | WEBRTC_RTCSTATS_IMPL(RTCIceCandidateStats, RTCStats, "ice-candidate", |
| 126 | &ip, |
| 127 | &port, |
| 128 | &protocol, |
| 129 | &candidate_type, |
| 130 | &priority, |
| 131 | &url); |
| 132 | |
| 133 | RTCIceCandidateStats::RTCIceCandidateStats( |
| 134 | const std::string& id, int64_t timestamp_us) |
| 135 | : RTCIceCandidateStats(std::string(id), timestamp_us) { |
| 136 | } |
| 137 | |
| 138 | RTCIceCandidateStats::RTCIceCandidateStats( |
| 139 | std::string&& id, int64_t timestamp_us) |
| 140 | : RTCStats(std::move(id), timestamp_us), |
| 141 | ip("ip"), |
| 142 | port("port"), |
| 143 | protocol("protocol"), |
| 144 | candidate_type("candidateType"), |
| 145 | priority("priority"), |
| 146 | url("url") { |
| 147 | } |
| 148 | |
| 149 | RTCIceCandidateStats::RTCIceCandidateStats(const RTCIceCandidateStats& other) |
| 150 | : RTCStats(other.id(), other.timestamp_us()), |
| 151 | ip(other.ip), |
| 152 | port(other.port), |
| 153 | protocol(other.protocol), |
| 154 | candidate_type(other.candidate_type), |
| 155 | priority(other.priority), |
| 156 | url(other.url) { |
| 157 | } |
| 158 | |
| 159 | RTCIceCandidateStats::~RTCIceCandidateStats() { |
| 160 | } |
| 161 | |
| 162 | const char RTCLocalIceCandidateStats::kType[] = "local-candidate"; |
| 163 | |
| 164 | RTCLocalIceCandidateStats::RTCLocalIceCandidateStats( |
| 165 | const std::string& id, int64_t timestamp_us) |
| 166 | : RTCIceCandidateStats(id, timestamp_us) { |
| 167 | } |
| 168 | |
| 169 | RTCLocalIceCandidateStats::RTCLocalIceCandidateStats( |
| 170 | std::string&& id, int64_t timestamp_us) |
| 171 | : RTCIceCandidateStats(std::move(id), timestamp_us) { |
| 172 | } |
| 173 | |
| 174 | const char* RTCLocalIceCandidateStats::type() const { |
| 175 | return kType; |
| 176 | } |
| 177 | |
| 178 | const char RTCRemoteIceCandidateStats::kType[] = "remote-candidate"; |
| 179 | |
| 180 | RTCRemoteIceCandidateStats::RTCRemoteIceCandidateStats( |
| 181 | const std::string& id, int64_t timestamp_us) |
| 182 | : RTCIceCandidateStats(id, timestamp_us) { |
| 183 | } |
| 184 | |
| 185 | RTCRemoteIceCandidateStats::RTCRemoteIceCandidateStats( |
| 186 | std::string&& id, int64_t timestamp_us) |
| 187 | : RTCIceCandidateStats(std::move(id), timestamp_us) { |
| 188 | } |
| 189 | |
| 190 | const char* RTCRemoteIceCandidateStats::type() const { |
| 191 | return kType; |
| 192 | } |
| 193 | |
hbos | fc5e050 | 2016-10-06 02:06:10 -0700 | [diff] [blame] | 194 | WEBRTC_RTCSTATS_IMPL(RTCCertificateStats, RTCStats, "certificate", |
| 195 | &fingerprint, |
| 196 | &fingerprint_algorithm, |
| 197 | &base64_certificate, |
| 198 | &issuer_certificate_id); |
hbos | 6ab97ce | 2016-10-03 14:16:56 -0700 | [diff] [blame] | 199 | |
| 200 | RTCCertificateStats::RTCCertificateStats( |
| 201 | const std::string& id, int64_t timestamp_us) |
| 202 | : RTCCertificateStats(std::string(id), timestamp_us) { |
| 203 | } |
| 204 | |
| 205 | RTCCertificateStats::RTCCertificateStats( |
| 206 | std::string&& id, int64_t timestamp_us) |
| 207 | : RTCStats(std::move(id), timestamp_us), |
| 208 | fingerprint("fingerprint"), |
| 209 | fingerprint_algorithm("fingerprintAlgorithm"), |
| 210 | base64_certificate("base64Certificate"), |
| 211 | issuer_certificate_id("issuerCertificateId") { |
| 212 | } |
| 213 | |
hbos | fc5e050 | 2016-10-06 02:06:10 -0700 | [diff] [blame] | 214 | RTCCertificateStats::RTCCertificateStats( |
| 215 | const RTCCertificateStats& other) |
| 216 | : RTCStats(other.id(), other.timestamp_us()), |
| 217 | fingerprint(other.fingerprint), |
| 218 | fingerprint_algorithm(other.fingerprint_algorithm), |
| 219 | base64_certificate(other.base64_certificate), |
| 220 | issuer_certificate_id(other.issuer_certificate_id) { |
| 221 | } |
| 222 | |
| 223 | RTCCertificateStats::~RTCCertificateStats() { |
| 224 | } |
| 225 | |
hbos | cc555c5 | 2016-10-18 12:48:31 -0700 | [diff] [blame] | 226 | WEBRTC_RTCSTATS_IMPL(RTCDataChannelStats, RTCStats, "data-channel", |
| 227 | &label, |
| 228 | &protocol, |
| 229 | &datachannelid, |
| 230 | &state, |
| 231 | &messages_sent, |
| 232 | &bytes_sent, |
| 233 | &messages_received, |
| 234 | &bytes_received); |
| 235 | |
| 236 | RTCDataChannelStats::RTCDataChannelStats( |
| 237 | const std::string& id, int64_t timestamp_us) |
| 238 | : RTCDataChannelStats(std::string(id), timestamp_us) { |
| 239 | } |
| 240 | |
| 241 | RTCDataChannelStats::RTCDataChannelStats( |
| 242 | std::string&& id, int64_t timestamp_us) |
| 243 | : RTCStats(std::move(id), timestamp_us), |
| 244 | label("label"), |
| 245 | protocol("protocol"), |
| 246 | datachannelid("datachannelid"), |
| 247 | state("state"), |
| 248 | messages_sent("messagesSent"), |
| 249 | bytes_sent("bytesSent"), |
| 250 | messages_received("messagesReceived"), |
| 251 | bytes_received("bytesReceived") { |
| 252 | } |
| 253 | |
| 254 | RTCDataChannelStats::RTCDataChannelStats( |
| 255 | const RTCDataChannelStats& other) |
| 256 | : RTCStats(other.id(), other.timestamp_us()), |
| 257 | label(other.label), |
| 258 | protocol(other.protocol), |
| 259 | datachannelid(other.datachannelid), |
| 260 | state(other.state), |
| 261 | messages_sent(other.messages_sent), |
| 262 | bytes_sent(other.bytes_sent), |
| 263 | messages_received(other.messages_received), |
| 264 | bytes_received(other.bytes_received) { |
| 265 | } |
| 266 | |
| 267 | RTCDataChannelStats::~RTCDataChannelStats() { |
| 268 | } |
| 269 | |
hbos | fc5e050 | 2016-10-06 02:06:10 -0700 | [diff] [blame] | 270 | WEBRTC_RTCSTATS_IMPL(RTCPeerConnectionStats, RTCStats, "peer-connection", |
| 271 | &data_channels_opened, |
| 272 | &data_channels_closed); |
hbos | d565b73 | 2016-08-30 14:04:35 -0700 | [diff] [blame] | 273 | |
| 274 | RTCPeerConnectionStats::RTCPeerConnectionStats( |
hbos | 0e6758d | 2016-08-31 07:57:36 -0700 | [diff] [blame] | 275 | const std::string& id, int64_t timestamp_us) |
| 276 | : RTCPeerConnectionStats(std::string(id), timestamp_us) { |
hbos | d565b73 | 2016-08-30 14:04:35 -0700 | [diff] [blame] | 277 | } |
| 278 | |
| 279 | RTCPeerConnectionStats::RTCPeerConnectionStats( |
hbos | 0e6758d | 2016-08-31 07:57:36 -0700 | [diff] [blame] | 280 | std::string&& id, int64_t timestamp_us) |
| 281 | : RTCStats(std::move(id), timestamp_us), |
hbos | d565b73 | 2016-08-30 14:04:35 -0700 | [diff] [blame] | 282 | data_channels_opened("dataChannelsOpened"), |
| 283 | data_channels_closed("dataChannelsClosed") { |
| 284 | } |
| 285 | |
hbos | fc5e050 | 2016-10-06 02:06:10 -0700 | [diff] [blame] | 286 | RTCPeerConnectionStats::RTCPeerConnectionStats( |
| 287 | const RTCPeerConnectionStats& other) |
| 288 | : RTCStats(other.id(), other.timestamp_us()), |
| 289 | data_channels_opened(other.data_channels_opened), |
| 290 | data_channels_closed(other.data_channels_closed) { |
| 291 | } |
| 292 | |
| 293 | RTCPeerConnectionStats::~RTCPeerConnectionStats() { |
| 294 | } |
| 295 | |
hbos | d565b73 | 2016-08-30 14:04:35 -0700 | [diff] [blame] | 296 | } // namespace webrtc |