Constify transport stats
BUG=None Change-Id: I441a46dea97d9a9022b96aaadef1d7348c6f90ee Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/364124 Commit-Queue: Philipp Hancke <phancke@meta.com> Reviewed-by: Harald Alvestrand <hta@webrtc.org> Reviewed-by: Henrik Boström <hbos@webrtc.org> Cr-Commit-Position: refs/heads/main@{#43148}
This commit is contained in:
parent
4b53e9af61
commit
4f732f4847
@ -225,7 +225,7 @@ bool DtlsTransport::GetDtlsRole(rtc::SSLRole* role) const {
|
||||
return true;
|
||||
}
|
||||
|
||||
bool DtlsTransport::GetSslCipherSuite(int* cipher) {
|
||||
bool DtlsTransport::GetSslCipherSuite(int* cipher) const {
|
||||
if (dtls_state() != webrtc::DtlsTransportState::kConnected) {
|
||||
return false;
|
||||
}
|
||||
@ -415,7 +415,7 @@ bool DtlsTransport::SetupDtls() {
|
||||
return true;
|
||||
}
|
||||
|
||||
bool DtlsTransport::GetSrtpCryptoSuite(int* cipher) {
|
||||
bool DtlsTransport::GetSrtpCryptoSuite(int* cipher) const {
|
||||
if (dtls_state() != webrtc::DtlsTransportState::kConnected) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -156,7 +156,7 @@ class DtlsTransport : public DtlsTransportInternal {
|
||||
// Find out which TLS version was negotiated
|
||||
bool GetSslVersionBytes(int* version) const override;
|
||||
// Find out which DTLS-SRTP cipher was negotiated
|
||||
bool GetSrtpCryptoSuite(int* cipher) override;
|
||||
bool GetSrtpCryptoSuite(int* cipher) const override;
|
||||
|
||||
// Find out which signature algorithm was used by the peer. Returns values
|
||||
// from
|
||||
@ -168,7 +168,7 @@ class DtlsTransport : public DtlsTransportInternal {
|
||||
bool SetDtlsRole(rtc::SSLRole role) override;
|
||||
|
||||
// Find out which DTLS cipher was negotiated
|
||||
bool GetSslCipherSuite(int* cipher) override;
|
||||
bool GetSslCipherSuite(int* cipher) const override;
|
||||
std::optional<absl::string_view> GetTlsCipherSuiteName() const override;
|
||||
|
||||
// Once DTLS has been established, this method retrieves the certificate
|
||||
|
||||
@ -65,11 +65,11 @@ class DtlsTransportInternal : public rtc::PacketTransportInternal {
|
||||
virtual bool GetSslVersionBytes(int* version) const = 0;
|
||||
// Finds out which DTLS-SRTP cipher was negotiated.
|
||||
// TODO(zhihuang): Remove this once all dependencies implement this.
|
||||
virtual bool GetSrtpCryptoSuite(int* cipher) = 0;
|
||||
virtual bool GetSrtpCryptoSuite(int* cipher) const = 0;
|
||||
|
||||
// Finds out which DTLS cipher was negotiated.
|
||||
// TODO(zhihuang): Remove this once all dependencies implement this.
|
||||
virtual bool GetSslCipherSuite(int* cipher) = 0;
|
||||
virtual bool GetSslCipherSuite(int* cipher) const = 0;
|
||||
virtual std::optional<absl::string_view> GetTlsCipherSuiteName() const = 0;
|
||||
|
||||
// Find out which signature algorithm was used by the peer. Returns values
|
||||
|
||||
@ -194,7 +194,7 @@ class FakeDtlsTransport : public DtlsTransportInternal {
|
||||
*version = 0x0102;
|
||||
return true;
|
||||
}
|
||||
bool GetSrtpCryptoSuite(int* crypto_suite) override {
|
||||
bool GetSrtpCryptoSuite(int* crypto_suite) const override {
|
||||
if (!do_dtls_) {
|
||||
return false;
|
||||
}
|
||||
@ -203,7 +203,7 @@ class FakeDtlsTransport : public DtlsTransportInternal {
|
||||
}
|
||||
void SetSrtpCryptoSuite(int crypto_suite) { crypto_suite_ = crypto_suite; }
|
||||
|
||||
bool GetSslCipherSuite(int* cipher_suite) override {
|
||||
bool GetSslCipherSuite(int* cipher_suite) const override {
|
||||
if (ssl_cipher_suite_) {
|
||||
*cipher_suite = *ssl_cipher_suite_;
|
||||
return true;
|
||||
|
||||
@ -317,7 +317,7 @@ std::optional<rtc::SSLRole> JsepTransport::GetDtlsRole() const {
|
||||
return std::optional<rtc::SSLRole>(dtls_role);
|
||||
}
|
||||
|
||||
bool JsepTransport::GetStats(TransportStats* stats) {
|
||||
bool JsepTransport::GetStats(TransportStats* stats) const {
|
||||
TRACE_EVENT0("webrtc", "JsepTransport::GetStats");
|
||||
RTC_DCHECK_RUN_ON(network_thread_);
|
||||
stats->transport_name = mid();
|
||||
@ -634,7 +634,7 @@ webrtc::RTCError JsepTransport::NegotiateDtlsRole(
|
||||
|
||||
bool JsepTransport::GetTransportStats(DtlsTransportInternal* dtls_transport,
|
||||
int component,
|
||||
TransportStats* stats) {
|
||||
TransportStats* stats) const {
|
||||
RTC_DCHECK_RUN_ON(network_thread_);
|
||||
RTC_DCHECK(dtls_transport);
|
||||
TransportChannelStats substats;
|
||||
|
||||
@ -147,8 +147,7 @@ class JsepTransport {
|
||||
// negotiated yet.
|
||||
std::optional<rtc::SSLRole> GetDtlsRole() const;
|
||||
|
||||
// TODO(deadbeef): Make this const. See comment in transportcontroller.h.
|
||||
bool GetStats(TransportStats* stats);
|
||||
bool GetStats(TransportStats* stats) const;
|
||||
|
||||
const JsepTransportDescription* local_description() const {
|
||||
RTC_DCHECK_RUN_ON(network_thread_);
|
||||
@ -285,7 +284,7 @@ class JsepTransport {
|
||||
|
||||
bool GetTransportStats(DtlsTransportInternal* dtls_transport,
|
||||
int component,
|
||||
TransportStats* stats);
|
||||
TransportStats* stats) const;
|
||||
|
||||
// Owning thread, for safety checks
|
||||
const rtc::Thread* const network_thread_;
|
||||
|
||||
@ -443,10 +443,11 @@ RTCError JsepTransportController::RemoveRemoteCandidates(
|
||||
}
|
||||
|
||||
bool JsepTransportController::GetStats(const std::string& transport_name,
|
||||
cricket::TransportStats* stats) {
|
||||
cricket::TransportStats* stats) const {
|
||||
RTC_DCHECK_RUN_ON(network_thread_);
|
||||
|
||||
cricket::JsepTransport* transport = GetJsepTransportByName(transport_name);
|
||||
const cricket::JsepTransport* transport =
|
||||
GetJsepTransportByName(transport_name);
|
||||
if (!transport) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -247,10 +247,7 @@ class JsepTransportController : public PayloadTypeSuggester,
|
||||
PayloadType payload_type,
|
||||
const cricket::Codec& codec) override;
|
||||
|
||||
// TODO(deadbeef): GetStats isn't const because all the way down to
|
||||
// OpenSSLStreamAdapter, GetSslCipherSuite and GetDtlsSrtpCryptoSuite are not
|
||||
// const. Fix this.
|
||||
bool GetStats(const std::string& mid, cricket::TransportStats* stats);
|
||||
bool GetStats(const std::string& mid, cricket::TransportStats* stats) const;
|
||||
|
||||
bool initial_offerer() const { return initial_offerer_ && *initial_offerer_; }
|
||||
|
||||
|
||||
@ -330,7 +330,7 @@ std::optional<absl::string_view> OpenSSLStreamAdapter::GetTlsCipherSuiteName()
|
||||
return SSL_CIPHER_standard_name(current_cipher);
|
||||
}
|
||||
|
||||
bool OpenSSLStreamAdapter::GetSslCipherSuite(int* cipher_suite) {
|
||||
bool OpenSSLStreamAdapter::GetSslCipherSuite(int* cipher_suite) const {
|
||||
if (state_ != SSL_CONNECTED) {
|
||||
return false;
|
||||
}
|
||||
@ -437,7 +437,7 @@ bool OpenSSLStreamAdapter::SetDtlsSrtpCryptoSuites(
|
||||
return true;
|
||||
}
|
||||
|
||||
bool OpenSSLStreamAdapter::GetDtlsSrtpCryptoSuite(int* crypto_suite) {
|
||||
bool OpenSSLStreamAdapter::GetDtlsSrtpCryptoSuite(int* crypto_suite) const {
|
||||
RTC_DCHECK(state_ == SSL_CONNECTED);
|
||||
if (state_ != SSL_CONNECTED) {
|
||||
return false;
|
||||
|
||||
@ -107,7 +107,7 @@ class OpenSSLStreamAdapter final : public SSLStreamAdapter,
|
||||
|
||||
std::optional<absl::string_view> GetTlsCipherSuiteName() const override;
|
||||
|
||||
bool GetSslCipherSuite(int* cipher) override;
|
||||
bool GetSslCipherSuite(int* cipher) const override;
|
||||
[[deprecated("Use GetSslVersionBytes")]] SSLProtocolVersion GetSslVersion()
|
||||
const override;
|
||||
bool GetSslVersionBytes(int* version) const override;
|
||||
@ -123,7 +123,7 @@ class OpenSSLStreamAdapter final : public SSLStreamAdapter,
|
||||
|
||||
// DTLS-SRTP interface
|
||||
bool SetDtlsSrtpCryptoSuites(const std::vector<int>& crypto_suites) override;
|
||||
bool GetDtlsSrtpCryptoSuite(int* crypto_suite) override;
|
||||
bool GetDtlsSrtpCryptoSuite(int* crypto_suite) const override;
|
||||
|
||||
bool IsTlsConnected() override;
|
||||
|
||||
|
||||
@ -87,10 +87,6 @@ std::unique_ptr<SSLStreamAdapter> SSLStreamAdapter::Create(
|
||||
std::move(handshake_error));
|
||||
}
|
||||
|
||||
bool SSLStreamAdapter::GetSslCipherSuite(int* cipher_suite) {
|
||||
return false;
|
||||
}
|
||||
|
||||
bool SSLStreamAdapter::ExportKeyingMaterial(absl::string_view label,
|
||||
const uint8_t* context,
|
||||
size_t context_len,
|
||||
@ -100,15 +96,6 @@ bool SSLStreamAdapter::ExportKeyingMaterial(absl::string_view label,
|
||||
return false; // Default is unsupported
|
||||
}
|
||||
|
||||
bool SSLStreamAdapter::SetDtlsSrtpCryptoSuites(
|
||||
const std::vector<int>& crypto_suites) {
|
||||
return false;
|
||||
}
|
||||
|
||||
bool SSLStreamAdapter::GetDtlsSrtpCryptoSuite(int* crypto_suite) {
|
||||
return false;
|
||||
}
|
||||
|
||||
bool SSLStreamAdapter::IsBoringSsl() {
|
||||
return OpenSSLStreamAdapter::IsBoringSsl();
|
||||
}
|
||||
|
||||
@ -184,7 +184,7 @@ class SSLStreamAdapter : public StreamInterface {
|
||||
|
||||
// Retrieves the IANA registration id of the cipher suite used for the
|
||||
// connection (e.g. 0x2F for "TLS_RSA_WITH_AES_128_CBC_SHA").
|
||||
virtual bool GetSslCipherSuite(int* cipher_suite);
|
||||
virtual bool GetSslCipherSuite(int* cipher_suite) const = 0;
|
||||
// Returns the name of the cipher suite used for the DTLS transport,
|
||||
// as defined in the "Description" column of the IANA cipher suite registry.
|
||||
virtual std::optional<absl::string_view> GetTlsCipherSuiteName() const = 0;
|
||||
@ -220,8 +220,9 @@ class SSLStreamAdapter : public StreamInterface {
|
||||
virtual uint16_t GetPeerSignatureAlgorithm() const = 0;
|
||||
|
||||
// DTLS-SRTP interface
|
||||
virtual bool SetDtlsSrtpCryptoSuites(const std::vector<int>& crypto_suites);
|
||||
virtual bool GetDtlsSrtpCryptoSuite(int* crypto_suite);
|
||||
virtual bool SetDtlsSrtpCryptoSuites(
|
||||
const std::vector<int>& crypto_suites) = 0;
|
||||
virtual bool GetDtlsSrtpCryptoSuite(int* crypto_suite) const = 0;
|
||||
|
||||
// Returns true if a TLS connection has been established.
|
||||
// The only difference between this and "GetState() == SE_OPEN" is that if
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user