blob: 947b5647d7f46325748d1126623a3b38f9f1c06e [file] [log] [blame]
hbosd565b732016-08-30 14:04:35 -07001/*
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
hbos74e1a4f2016-09-15 23:33:01 -070011#include "webrtc/api/stats/rtcstats_objects.h"
hbosd565b732016-08-30 14:04:35 -070012
13namespace webrtc {
14
hbosc47a0c32016-10-11 14:54:49 -070015const char* RTCStatsIceCandidatePairState::kFrozen = "frozen";
16const char* RTCStatsIceCandidatePairState::kWaiting = "waiting";
17const char* RTCStatsIceCandidatePairState::kInProgress = "inprogress";
18const char* RTCStatsIceCandidatePairState::kFailed = "failed";
19const char* RTCStatsIceCandidatePairState::kSucceeded = "succeeded";
20const char* RTCStatsIceCandidatePairState::kCancelled = "cancelled";
21
22// Strings defined in https://tools.ietf.org/html/rfc5245.
hbosab9f6e42016-10-07 02:18:47 -070023const char* RTCIceCandidateType::kHost = "host";
24const char* RTCIceCandidateType::kSrflx = "srflx";
25const char* RTCIceCandidateType::kPrflx = "prflx";
26const char* RTCIceCandidateType::kRelay = "relay";
27
hbosc47a0c32016-10-11 14:54:49 -070028WEBRTC_RTCSTATS_IMPL(RTCIceCandidatePairStats, RTCStats, "candidate-pair",
29 &transport_id,
30 &local_candidate_id,
31 &remote_candidate_id,
32 &state,
33 &priority,
34 &nominated,
35 &writable,
36 &readable,
37 &bytes_sent,
38 &bytes_received,
39 &total_rtt,
40 &current_rtt,
41 &available_outgoing_bitrate,
42 &available_incoming_bitrate,
43 &requests_received,
44 &requests_sent,
45 &responses_received,
46 &responses_sent,
47 &retransmissions_received,
48 &retransmissions_sent,
49 &consent_requests_received,
50 &consent_requests_sent,
51 &consent_responses_received,
52 &consent_responses_sent);
53
54RTCIceCandidatePairStats::RTCIceCandidatePairStats(
55 const std::string& id, int64_t timestamp_us)
56 : RTCIceCandidatePairStats(std::string(id), timestamp_us) {
57}
58
59RTCIceCandidatePairStats::RTCIceCandidatePairStats(
60 std::string&& id, int64_t timestamp_us)
61 : RTCStats(std::move(id), timestamp_us),
62 transport_id("transportId"),
63 local_candidate_id("localCandidateId"),
64 remote_candidate_id("remoteCandidateId"),
65 state("state"),
66 priority("priority"),
67 nominated("nominated"),
68 writable("writable"),
69 readable("readable"),
70 bytes_sent("bytesSent"),
71 bytes_received("bytesReceived"),
72 total_rtt("totalRtt"),
73 current_rtt("currentRtt"),
74 available_outgoing_bitrate("availableOutgoingBitrate"),
75 available_incoming_bitrate("availableIncomingBitrate"),
76 requests_received("requestsReceived"),
77 requests_sent("requestsSent"),
78 responses_received("responsesReceived"),
79 responses_sent("responsesSent"),
80 retransmissions_received("retransmissionsReceived"),
81 retransmissions_sent("retransmissionsSent"),
82 consent_requests_received("consentRequestsReceived"),
83 consent_requests_sent("consentRequestsSent"),
84 consent_responses_received("consentResponsesReceived"),
85 consent_responses_sent("consentResponsesSent") {
86}
87
88RTCIceCandidatePairStats::RTCIceCandidatePairStats(
89 const RTCIceCandidatePairStats& other)
90 : RTCStats(other.id(), other.timestamp_us()),
91 transport_id(other.transport_id),
92 local_candidate_id(other.local_candidate_id),
93 remote_candidate_id(other.remote_candidate_id),
94 state(other.state),
95 priority(other.priority),
96 nominated(other.nominated),
97 writable(other.writable),
98 readable(other.readable),
99 bytes_sent(other.bytes_sent),
100 bytes_received(other.bytes_received),
101 total_rtt(other.total_rtt),
102 current_rtt(other.current_rtt),
103 available_outgoing_bitrate(other.available_outgoing_bitrate),
104 available_incoming_bitrate(other.available_incoming_bitrate),
105 requests_received(other.requests_received),
106 requests_sent(other.requests_sent),
107 responses_received(other.responses_received),
108 responses_sent(other.responses_sent),
109 retransmissions_received(other.retransmissions_received),
110 retransmissions_sent(other.retransmissions_sent),
111 consent_requests_received(other.consent_requests_received),
112 consent_requests_sent(other.consent_requests_sent),
113 consent_responses_received(other.consent_responses_received),
114 consent_responses_sent(other.consent_responses_sent) {
115}
116
117RTCIceCandidatePairStats::~RTCIceCandidatePairStats() {
118}
119
hbosab9f6e42016-10-07 02:18:47 -0700120WEBRTC_RTCSTATS_IMPL(RTCIceCandidateStats, RTCStats, "ice-candidate",
121 &ip,
122 &port,
123 &protocol,
124 &candidate_type,
125 &priority,
126 &url);
127
128RTCIceCandidateStats::RTCIceCandidateStats(
129 const std::string& id, int64_t timestamp_us)
130 : RTCIceCandidateStats(std::string(id), timestamp_us) {
131}
132
133RTCIceCandidateStats::RTCIceCandidateStats(
134 std::string&& id, int64_t timestamp_us)
135 : RTCStats(std::move(id), timestamp_us),
136 ip("ip"),
137 port("port"),
138 protocol("protocol"),
139 candidate_type("candidateType"),
140 priority("priority"),
141 url("url") {
142}
143
144RTCIceCandidateStats::RTCIceCandidateStats(const RTCIceCandidateStats& other)
145 : RTCStats(other.id(), other.timestamp_us()),
146 ip(other.ip),
147 port(other.port),
148 protocol(other.protocol),
149 candidate_type(other.candidate_type),
150 priority(other.priority),
151 url(other.url) {
152}
153
154RTCIceCandidateStats::~RTCIceCandidateStats() {
155}
156
157const char RTCLocalIceCandidateStats::kType[] = "local-candidate";
158
159RTCLocalIceCandidateStats::RTCLocalIceCandidateStats(
160 const std::string& id, int64_t timestamp_us)
161 : RTCIceCandidateStats(id, timestamp_us) {
162}
163
164RTCLocalIceCandidateStats::RTCLocalIceCandidateStats(
165 std::string&& id, int64_t timestamp_us)
166 : RTCIceCandidateStats(std::move(id), timestamp_us) {
167}
168
169const char* RTCLocalIceCandidateStats::type() const {
170 return kType;
171}
172
173const char RTCRemoteIceCandidateStats::kType[] = "remote-candidate";
174
175RTCRemoteIceCandidateStats::RTCRemoteIceCandidateStats(
176 const std::string& id, int64_t timestamp_us)
177 : RTCIceCandidateStats(id, timestamp_us) {
178}
179
180RTCRemoteIceCandidateStats::RTCRemoteIceCandidateStats(
181 std::string&& id, int64_t timestamp_us)
182 : RTCIceCandidateStats(std::move(id), timestamp_us) {
183}
184
185const char* RTCRemoteIceCandidateStats::type() const {
186 return kType;
187}
188
hbosfc5e0502016-10-06 02:06:10 -0700189WEBRTC_RTCSTATS_IMPL(RTCCertificateStats, RTCStats, "certificate",
190 &fingerprint,
191 &fingerprint_algorithm,
192 &base64_certificate,
193 &issuer_certificate_id);
hbos6ab97ce2016-10-03 14:16:56 -0700194
195RTCCertificateStats::RTCCertificateStats(
196 const std::string& id, int64_t timestamp_us)
197 : RTCCertificateStats(std::string(id), timestamp_us) {
198}
199
200RTCCertificateStats::RTCCertificateStats(
201 std::string&& id, int64_t timestamp_us)
202 : RTCStats(std::move(id), timestamp_us),
203 fingerprint("fingerprint"),
204 fingerprint_algorithm("fingerprintAlgorithm"),
205 base64_certificate("base64Certificate"),
206 issuer_certificate_id("issuerCertificateId") {
207}
208
hbosfc5e0502016-10-06 02:06:10 -0700209RTCCertificateStats::RTCCertificateStats(
210 const RTCCertificateStats& other)
211 : RTCStats(other.id(), other.timestamp_us()),
212 fingerprint(other.fingerprint),
213 fingerprint_algorithm(other.fingerprint_algorithm),
214 base64_certificate(other.base64_certificate),
215 issuer_certificate_id(other.issuer_certificate_id) {
216}
217
218RTCCertificateStats::~RTCCertificateStats() {
219}
220
221WEBRTC_RTCSTATS_IMPL(RTCPeerConnectionStats, RTCStats, "peer-connection",
222 &data_channels_opened,
223 &data_channels_closed);
hbosd565b732016-08-30 14:04:35 -0700224
225RTCPeerConnectionStats::RTCPeerConnectionStats(
hbos0e6758d2016-08-31 07:57:36 -0700226 const std::string& id, int64_t timestamp_us)
227 : RTCPeerConnectionStats(std::string(id), timestamp_us) {
hbosd565b732016-08-30 14:04:35 -0700228}
229
230RTCPeerConnectionStats::RTCPeerConnectionStats(
hbos0e6758d2016-08-31 07:57:36 -0700231 std::string&& id, int64_t timestamp_us)
232 : RTCStats(std::move(id), timestamp_us),
hbosd565b732016-08-30 14:04:35 -0700233 data_channels_opened("dataChannelsOpened"),
234 data_channels_closed("dataChannelsClosed") {
235}
236
hbosfc5e0502016-10-06 02:06:10 -0700237RTCPeerConnectionStats::RTCPeerConnectionStats(
238 const RTCPeerConnectionStats& other)
239 : RTCStats(other.id(), other.timestamp_us()),
240 data_channels_opened(other.data_channels_opened),
241 data_channels_closed(other.data_channels_closed) {
242}
243
244RTCPeerConnectionStats::~RTCPeerConnectionStats() {
245}
246
hbosd565b732016-08-30 14:04:35 -0700247} // namespace webrtc