blob: 3d82d09e4a4ad1eff57acd390b48e531bccb4709 [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
hboscc555c52016-10-18 12:48:31 -070015const char* RTCDataChannelState::kConnecting = "connecting";
16const char* RTCDataChannelState::kOpen = "open";
17const char* RTCDataChannelState::kClosing = "closing";
18const char* RTCDataChannelState::kClosed = "closed";
19
hbosc47a0c32016-10-11 14:54:49 -070020const char* RTCStatsIceCandidatePairState::kFrozen = "frozen";
21const char* RTCStatsIceCandidatePairState::kWaiting = "waiting";
22const char* RTCStatsIceCandidatePairState::kInProgress = "inprogress";
23const char* RTCStatsIceCandidatePairState::kFailed = "failed";
24const char* RTCStatsIceCandidatePairState::kSucceeded = "succeeded";
25const char* RTCStatsIceCandidatePairState::kCancelled = "cancelled";
26
27// Strings defined in https://tools.ietf.org/html/rfc5245.
hbosab9f6e42016-10-07 02:18:47 -070028const char* RTCIceCandidateType::kHost = "host";
29const char* RTCIceCandidateType::kSrflx = "srflx";
30const char* RTCIceCandidateType::kPrflx = "prflx";
31const char* RTCIceCandidateType::kRelay = "relay";
32
hbosc47a0c32016-10-11 14:54:49 -070033WEBRTC_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 &current_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
59RTCIceCandidatePairStats::RTCIceCandidatePairStats(
60 const std::string& id, int64_t timestamp_us)
61 : RTCIceCandidatePairStats(std::string(id), timestamp_us) {
62}
63
64RTCIceCandidatePairStats::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
93RTCIceCandidatePairStats::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
122RTCIceCandidatePairStats::~RTCIceCandidatePairStats() {
123}
124
hbosab9f6e42016-10-07 02:18:47 -0700125WEBRTC_RTCSTATS_IMPL(RTCIceCandidateStats, RTCStats, "ice-candidate",
126 &ip,
127 &port,
128 &protocol,
129 &candidate_type,
130 &priority,
131 &url);
132
133RTCIceCandidateStats::RTCIceCandidateStats(
134 const std::string& id, int64_t timestamp_us)
135 : RTCIceCandidateStats(std::string(id), timestamp_us) {
136}
137
138RTCIceCandidateStats::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
149RTCIceCandidateStats::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
159RTCIceCandidateStats::~RTCIceCandidateStats() {
160}
161
162const char RTCLocalIceCandidateStats::kType[] = "local-candidate";
163
164RTCLocalIceCandidateStats::RTCLocalIceCandidateStats(
165 const std::string& id, int64_t timestamp_us)
166 : RTCIceCandidateStats(id, timestamp_us) {
167}
168
169RTCLocalIceCandidateStats::RTCLocalIceCandidateStats(
170 std::string&& id, int64_t timestamp_us)
171 : RTCIceCandidateStats(std::move(id), timestamp_us) {
172}
173
174const char* RTCLocalIceCandidateStats::type() const {
175 return kType;
176}
177
178const char RTCRemoteIceCandidateStats::kType[] = "remote-candidate";
179
180RTCRemoteIceCandidateStats::RTCRemoteIceCandidateStats(
181 const std::string& id, int64_t timestamp_us)
182 : RTCIceCandidateStats(id, timestamp_us) {
183}
184
185RTCRemoteIceCandidateStats::RTCRemoteIceCandidateStats(
186 std::string&& id, int64_t timestamp_us)
187 : RTCIceCandidateStats(std::move(id), timestamp_us) {
188}
189
190const char* RTCRemoteIceCandidateStats::type() const {
191 return kType;
192}
193
hbosfc5e0502016-10-06 02:06:10 -0700194WEBRTC_RTCSTATS_IMPL(RTCCertificateStats, RTCStats, "certificate",
195 &fingerprint,
196 &fingerprint_algorithm,
197 &base64_certificate,
198 &issuer_certificate_id);
hbos6ab97ce2016-10-03 14:16:56 -0700199
200RTCCertificateStats::RTCCertificateStats(
201 const std::string& id, int64_t timestamp_us)
202 : RTCCertificateStats(std::string(id), timestamp_us) {
203}
204
205RTCCertificateStats::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
hbosfc5e0502016-10-06 02:06:10 -0700214RTCCertificateStats::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
223RTCCertificateStats::~RTCCertificateStats() {
224}
225
hboscc555c52016-10-18 12:48:31 -0700226WEBRTC_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
236RTCDataChannelStats::RTCDataChannelStats(
237 const std::string& id, int64_t timestamp_us)
238 : RTCDataChannelStats(std::string(id), timestamp_us) {
239}
240
241RTCDataChannelStats::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
254RTCDataChannelStats::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
267RTCDataChannelStats::~RTCDataChannelStats() {
268}
269
hbosfc5e0502016-10-06 02:06:10 -0700270WEBRTC_RTCSTATS_IMPL(RTCPeerConnectionStats, RTCStats, "peer-connection",
271 &data_channels_opened,
272 &data_channels_closed);
hbosd565b732016-08-30 14:04:35 -0700273
274RTCPeerConnectionStats::RTCPeerConnectionStats(
hbos0e6758d2016-08-31 07:57:36 -0700275 const std::string& id, int64_t timestamp_us)
276 : RTCPeerConnectionStats(std::string(id), timestamp_us) {
hbosd565b732016-08-30 14:04:35 -0700277}
278
279RTCPeerConnectionStats::RTCPeerConnectionStats(
hbos0e6758d2016-08-31 07:57:36 -0700280 std::string&& id, int64_t timestamp_us)
281 : RTCStats(std::move(id), timestamp_us),
hbosd565b732016-08-30 14:04:35 -0700282 data_channels_opened("dataChannelsOpened"),
283 data_channels_closed("dataChannelsClosed") {
284}
285
hbosfc5e0502016-10-06 02:06:10 -0700286RTCPeerConnectionStats::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
293RTCPeerConnectionStats::~RTCPeerConnectionStats() {
294}
295
hbosd565b732016-08-30 14:04:35 -0700296} // namespace webrtc