blob: 3c80404f9c6d7ed181efc8b9d78ca74363f43563 [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
hbosab9f6e42016-10-07 02:18:47 -070015const char* RTCIceCandidateType::kHost = "host";
16const char* RTCIceCandidateType::kSrflx = "srflx";
17const char* RTCIceCandidateType::kPrflx = "prflx";
18const char* RTCIceCandidateType::kRelay = "relay";
19
20WEBRTC_RTCSTATS_IMPL(RTCIceCandidateStats, RTCStats, "ice-candidate",
21 &ip,
22 &port,
23 &protocol,
24 &candidate_type,
25 &priority,
26 &url);
27
28RTCIceCandidateStats::RTCIceCandidateStats(
29 const std::string& id, int64_t timestamp_us)
30 : RTCIceCandidateStats(std::string(id), timestamp_us) {
31}
32
33RTCIceCandidateStats::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
44RTCIceCandidateStats::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
54RTCIceCandidateStats::~RTCIceCandidateStats() {
55}
56
57const char RTCLocalIceCandidateStats::kType[] = "local-candidate";
58
59RTCLocalIceCandidateStats::RTCLocalIceCandidateStats(
60 const std::string& id, int64_t timestamp_us)
61 : RTCIceCandidateStats(id, timestamp_us) {
62}
63
64RTCLocalIceCandidateStats::RTCLocalIceCandidateStats(
65 std::string&& id, int64_t timestamp_us)
66 : RTCIceCandidateStats(std::move(id), timestamp_us) {
67}
68
69const char* RTCLocalIceCandidateStats::type() const {
70 return kType;
71}
72
73const char RTCRemoteIceCandidateStats::kType[] = "remote-candidate";
74
75RTCRemoteIceCandidateStats::RTCRemoteIceCandidateStats(
76 const std::string& id, int64_t timestamp_us)
77 : RTCIceCandidateStats(id, timestamp_us) {
78}
79
80RTCRemoteIceCandidateStats::RTCRemoteIceCandidateStats(
81 std::string&& id, int64_t timestamp_us)
82 : RTCIceCandidateStats(std::move(id), timestamp_us) {
83}
84
85const char* RTCRemoteIceCandidateStats::type() const {
86 return kType;
87}
88
hbosfc5e0502016-10-06 02:06:10 -070089WEBRTC_RTCSTATS_IMPL(RTCCertificateStats, RTCStats, "certificate",
90 &fingerprint,
91 &fingerprint_algorithm,
92 &base64_certificate,
93 &issuer_certificate_id);
hbos6ab97ce2016-10-03 14:16:56 -070094
95RTCCertificateStats::RTCCertificateStats(
96 const std::string& id, int64_t timestamp_us)
97 : RTCCertificateStats(std::string(id), timestamp_us) {
98}
99
100RTCCertificateStats::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
hbosfc5e0502016-10-06 02:06:10 -0700109RTCCertificateStats::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
118RTCCertificateStats::~RTCCertificateStats() {
119}
120
121WEBRTC_RTCSTATS_IMPL(RTCPeerConnectionStats, RTCStats, "peer-connection",
122 &data_channels_opened,
123 &data_channels_closed);
hbosd565b732016-08-30 14:04:35 -0700124
125RTCPeerConnectionStats::RTCPeerConnectionStats(
hbos0e6758d2016-08-31 07:57:36 -0700126 const std::string& id, int64_t timestamp_us)
127 : RTCPeerConnectionStats(std::string(id), timestamp_us) {
hbosd565b732016-08-30 14:04:35 -0700128}
129
130RTCPeerConnectionStats::RTCPeerConnectionStats(
hbos0e6758d2016-08-31 07:57:36 -0700131 std::string&& id, int64_t timestamp_us)
132 : RTCStats(std::move(id), timestamp_us),
hbosd565b732016-08-30 14:04:35 -0700133 data_channels_opened("dataChannelsOpened"),
134 data_channels_closed("dataChannelsClosed") {
135}
136
hbosfc5e0502016-10-06 02:06:10 -0700137RTCPeerConnectionStats::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
144RTCPeerConnectionStats::~RTCPeerConnectionStats() {
145}
146
hbosd565b732016-08-30 14:04:35 -0700147} // namespace webrtc