OLD | NEW |
---|---|
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 Loading... | |
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 SrtpCipherType GetSrtpCipherType(const std::string& cipher) { | |
92 if (cipher == "AES_CM_128_HMAC_SHA1_32") | |
juberti
2015/09/24 13:41:15
is there some pre-existing constant somewhere we c
guoweis_webrtc
2015/09/24 18:27:13
Done.
| |
93 return SrtpCipherType_AES_CM_128_HMAC_SHA1_32; | |
94 if (cipher == "AES_CM_128_HMAC_SHA1_80") | |
95 return SrtpCipherType_AES_CM_128_HMAC_SHA1_80; | |
96 return SrtpCipherType_Unknown; | |
juberti
2015/09/24 13:41:15
Usually we don't replicate 'Type' in enum values.
guoweis_webrtc
2015/09/24 18:27:13
Done.
| |
97 } | |
98 | |
91 IceCandidatePairType GetIceCandidatePairCounter( | 99 IceCandidatePairType GetIceCandidatePairCounter( |
92 const cricket::Candidate& local, | 100 const cricket::Candidate& local, |
93 const cricket::Candidate& remote) { | 101 const cricket::Candidate& remote) { |
94 const auto& l = local.type(); | 102 const auto& l = local.type(); |
95 const auto& r = remote.type(); | 103 const auto& r = remote.type(); |
96 const auto& host = LOCAL_PORT_TYPE; | 104 const auto& host = LOCAL_PORT_TYPE; |
97 const auto& srflx = STUN_PORT_TYPE; | 105 const auto& srflx = STUN_PORT_TYPE; |
98 const auto& relay = RELAY_PORT_TYPE; | 106 const auto& relay = RELAY_PORT_TYPE; |
99 const auto& prflx = PRFLX_PORT_TYPE; | 107 const auto& prflx = PRFLX_PORT_TYPE; |
100 if (l == host && r == host) { | 108 if (l == host && r == host) { |
(...skipping 1946 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2047 kPeerConnectionAddressFamilyCounter_Max); | 2055 kPeerConnectionAddressFamilyCounter_Max); |
2048 } else { | 2056 } else { |
2049 RTC_CHECK(0); | 2057 RTC_CHECK(0); |
2050 } | 2058 } |
2051 | 2059 |
2052 return; | 2060 return; |
2053 } | 2061 } |
2054 } | 2062 } |
2055 } | 2063 } |
2056 | 2064 |
2065 // Since this is reported in the first OnTransportCompleted, in the non-bundled | |
2066 // case, we might not be reporting anything other than the first completed | |
2067 // channel. | |
2057 void WebRtcSession::ReportNegotiatedCiphers( | 2068 void WebRtcSession::ReportNegotiatedCiphers( |
2058 const cricket::TransportStats& stats) { | 2069 const cricket::TransportStats& stats) { |
2059 RTC_DCHECK(metrics_observer_ != NULL); | 2070 RTC_DCHECK(metrics_observer_ != NULL); |
2060 if (!dtls_enabled_ || stats.channel_stats.empty()) { | 2071 if (!dtls_enabled_ || stats.channel_stats.empty()) { |
2061 return; | 2072 return; |
2062 } | 2073 } |
2063 | 2074 |
2064 const std::string& srtp_cipher = stats.channel_stats[0].srtp_cipher; | 2075 const std::string& srtp_cipher = stats.channel_stats[0].srtp_cipher; |
2065 const std::string& ssl_cipher = stats.channel_stats[0].ssl_cipher; | 2076 const rtc::SslCipher ssl_cipher = stats.channel_stats[0].ssl_cipher; |
2066 if (srtp_cipher.empty() && ssl_cipher.empty()) { | 2077 if (srtp_cipher.empty() && ssl_cipher.rfc_name.empty()) { |
2067 return; | 2078 return; |
2068 } | 2079 } |
2069 | 2080 |
2070 PeerConnectionMetricsName srtp_name; | 2081 PeerConnectionEnumCounterType srtp_counter_type; |
2071 PeerConnectionMetricsName ssl_name; | 2082 PeerConnectionEnumCounterType ssl_counter_type; |
2072 if (stats.content_name == cricket::CN_AUDIO) { | 2083 if (stats.content_name == cricket::CN_AUDIO) { |
2073 srtp_name = kAudioSrtpCipher; | 2084 srtp_counter_type = kEnumCounterAudioSrtpCipher; |
2074 ssl_name = kAudioSslCipher; | 2085 ssl_counter_type = kEnumCounterAudioSslCipher; |
2075 } else if (stats.content_name == cricket::CN_VIDEO) { | 2086 } else if (stats.content_name == cricket::CN_VIDEO) { |
2076 srtp_name = kVideoSrtpCipher; | 2087 srtp_counter_type = kEnumCounterVideoSrtpCipher; |
2077 ssl_name = kVideoSslCipher; | 2088 ssl_counter_type = kEnumCounterVideoSslCipher; |
2078 } else if (stats.content_name == cricket::CN_DATA) { | 2089 } else if (stats.content_name == cricket::CN_DATA) { |
2079 srtp_name = kDataSrtpCipher; | 2090 srtp_counter_type = kEnumCounterDataSrtpCipher; |
2080 ssl_name = kDataSslCipher; | 2091 ssl_counter_type = kEnumCounterDataSslCipher; |
2081 } else { | 2092 } else { |
2082 RTC_NOTREACHED(); | 2093 RTC_NOTREACHED(); |
2083 return; | 2094 return; |
2084 } | 2095 } |
2085 | 2096 |
2086 if (!srtp_cipher.empty()) { | 2097 if (!srtp_cipher.empty()) { |
2087 metrics_observer_->AddHistogramSample(srtp_name, srtp_cipher); | 2098 metrics_observer_->IncrementEnumCounter( |
2099 srtp_counter_type, GetSrtpCipherType(srtp_cipher), SrtpCipherType_Max); | |
2088 } | 2100 } |
2089 if (!ssl_cipher.empty()) { | 2101 if (!ssl_cipher.rfc_name.empty()) { |
2090 metrics_observer_->AddHistogramSample(ssl_name, ssl_cipher); | 2102 RTC_DCHECK(ssl_cipher.ssl_id); |
2103 metrics_observer_->IncrementSparseEnumCounter(ssl_counter_type, | |
2104 ssl_cipher.ssl_id); | |
2091 } | 2105 } |
2092 } | 2106 } |
2093 | 2107 |
2094 } // namespace webrtc | 2108 } // namespace webrtc |
OLD | NEW |