Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1)

Side by Side Diff: talk/app/webrtc/webrtcsession.cc

Issue 1337673002: Change WebRTC SslCipher to be exposed as number only. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc@master
Patch Set: Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * libjingle 2 * libjingle
3 * Copyright 2012 Google Inc. 3 * Copyright 2012 Google Inc.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met: 6 * modification, are permitted provided that the following conditions are met:
7 * 7 *
8 * 1. Redistributions of source code must retain the above copyright notice, 8 * 1. Redistributions of source code must retain the above copyright notice,
9 * this list of conditions and the following disclaimer. 9 * this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright notice, 10 * 2. Redistributions in binary form must reproduce the above copyright notice,
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
81 const char kSdpWithoutIceUfragPwd[] = 81 const char kSdpWithoutIceUfragPwd[] =
82 "Called with SDP without ice-ufrag and ice-pwd."; 82 "Called with SDP without ice-ufrag and ice-pwd.";
83 const char kSessionError[] = "Session error code: "; 83 const char kSessionError[] = "Session error code: ";
84 const char kSessionErrorDesc[] = "Session error description: "; 84 const char kSessionErrorDesc[] = "Session error description: ";
85 const char kDtlsSetupFailureRtp[] = 85 const char kDtlsSetupFailureRtp[] =
86 "Couldn't set up DTLS-SRTP on RTP channel."; 86 "Couldn't set up DTLS-SRTP on RTP channel.";
87 const char kDtlsSetupFailureRtcp[] = 87 const char kDtlsSetupFailureRtcp[] =
88 "Couldn't set up DTLS-SRTP on RTCP channel."; 88 "Couldn't set up DTLS-SRTP on RTCP channel.";
89 const int kMaxUnsignalledRecvStreams = 20; 89 const int kMaxUnsignalledRecvStreams = 20;
90 90
91 CryptoCipherType GetCipherType(const std::string& cipher) {
92 if (cipher == "AES_CM_128_HMAC_SHA1_32")
93 return CipherType_AES_CM_128_HMAC_SHA1_32;
94 if (cipher == "AES_CM_128_HMAC_SHA1_80")
95 return CipherType_AES_CM_128_HMAC_SHA1_80;
96 if (cipher == "TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA")
97 return CipherType_TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA;
98 if (cipher == "TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256")
99 return CipherType_TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256;
100 return CipherType_Unknown;
101 }
102
91 IceCandidatePairType GetIceCandidatePairCounter( 103 IceCandidatePairType GetIceCandidatePairCounter(
92 const cricket::Candidate& local, 104 const cricket::Candidate& local,
93 const cricket::Candidate& remote) { 105 const cricket::Candidate& remote) {
94 const auto& l = local.type(); 106 const auto& l = local.type();
95 const auto& r = remote.type(); 107 const auto& r = remote.type();
96 const auto& host = LOCAL_PORT_TYPE; 108 const auto& host = LOCAL_PORT_TYPE;
97 const auto& srflx = STUN_PORT_TYPE; 109 const auto& srflx = STUN_PORT_TYPE;
98 const auto& relay = RELAY_PORT_TYPE; 110 const auto& relay = RELAY_PORT_TYPE;
99 const auto& prflx = PRFLX_PORT_TYPE; 111 const auto& prflx = PRFLX_PORT_TYPE;
100 if (l == host && r == host) { 112 if (l == host && r == host) {
(...skipping 1944 matching lines...) Expand 10 before | Expand all | Expand 10 after
2045 kPeerConnectionAddressFamilyCounter_Max); 2057 kPeerConnectionAddressFamilyCounter_Max);
2046 } else { 2058 } else {
2047 CHECK(0); 2059 CHECK(0);
2048 } 2060 }
2049 2061
2050 return; 2062 return;
2051 } 2063 }
2052 } 2064 }
2053 } 2065 }
2054 2066
2067 // Since this is reported in OnTransportCompleted
pthatcher1 2015/09/16 03:52:30 This comment doesn't make sense to me.
guoweis_webrtc 2015/09/22 19:59:39 Done.
2055 void WebRtcSession::ReportNegotiatedCiphers( 2068 void WebRtcSession::ReportNegotiatedCiphers(
2056 const cricket::TransportStats& stats) { 2069 const cricket::TransportStats& stats) {
2057 DCHECK(metrics_observer_ != NULL); 2070 DCHECK(metrics_observer_ != NULL);
2058 if (!dtls_enabled_ || stats.channel_stats.empty()) { 2071 if (!dtls_enabled_ || stats.channel_stats.empty()) {
2059 return; 2072 return;
2060 } 2073 }
2061 2074
2062 const std::string& srtp_cipher = stats.channel_stats[0].srtp_cipher; 2075 const std::string& srtp_cipher = stats.channel_stats[0].srtp_cipher;
2063 const std::string& ssl_cipher = stats.channel_stats[0].ssl_cipher; 2076 const std::string& ssl_cipher = stats.channel_stats[0].ssl_cipher;
2064 if (srtp_cipher.empty() && ssl_cipher.empty()) { 2077 if (srtp_cipher.empty() && ssl_cipher.empty()) {
2065 return; 2078 return;
2066 } 2079 }
2067 2080
2068 PeerConnectionMetricsName srtp_name; 2081 PeerConnectionEnumCounterType srtp_counter_type;
2069 PeerConnectionMetricsName ssl_name; 2082 PeerConnectionEnumCounterType ssl_counter_type;
2070 if (stats.content_name == cricket::CN_AUDIO) { 2083 if (stats.content_name == cricket::CN_AUDIO) {
2071 srtp_name = kAudioSrtpCipher; 2084 srtp_counter_type = kEnumCounterAudioSrtpCipher;
2072 ssl_name = kAudioSslCipher; 2085 ssl_counter_type = kEnumCounterAudioSslCipher;
2073 } else if (stats.content_name == cricket::CN_VIDEO) { 2086 } else if (stats.content_name == cricket::CN_VIDEO) {
2074 srtp_name = kVideoSrtpCipher; 2087 srtp_counter_type = kEnumCounterVideoSrtpCipher;
2075 ssl_name = kVideoSslCipher; 2088 ssl_counter_type = kEnumCounterVideoSslCipher;
2076 } else if (stats.content_name == cricket::CN_DATA) { 2089 } else if (stats.content_name == cricket::CN_DATA) {
2077 srtp_name = kDataSrtpCipher; 2090 srtp_counter_type = kEnumCounterDataSrtpCipher;
2078 ssl_name = kDataSslCipher; 2091 ssl_counter_type = kEnumCounterDataSslCipher;
2079 } else { 2092 } else {
2080 RTC_NOTREACHED(); 2093 RTC_NOTREACHED();
2081 return; 2094 return;
2082 } 2095 }
2083 2096
2084 if (!srtp_cipher.empty()) { 2097 if (!srtp_cipher.empty()) {
2085 metrics_observer_->AddHistogramSample(srtp_name, srtp_cipher); 2098 metrics_observer_->IncrementEnumCounter(
2099 srtp_counter_type, GetCipherType(srtp_cipher), CipherType_Max);
2086 } 2100 }
2087 if (!ssl_cipher.empty()) { 2101 if (!ssl_cipher.empty()) {
2088 metrics_observer_->AddHistogramSample(ssl_name, ssl_cipher); 2102 metrics_observer_->IncrementEnumCounter(
2103 ssl_counter_type, GetCipherType(ssl_cipher), CipherType_Max);
2089 } 2104 }
2090 } 2105 }
2091 2106
2092 } // namespace webrtc 2107 } // namespace webrtc
OLDNEW
« talk/app/webrtc/peerconnection_unittest.cc ('K') | « talk/app/webrtc/umametrics.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698