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

Side by Side Diff: webrtc/p2p/base/fakedtlstransport.h

Issue 2761143002: Support encrypted RTP extensions (RFC 6904) (Closed)
Patch Set: Fix compile error on win_x64 bots. Created 3 years, 5 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
« no previous file with comments | « webrtc/p2p/base/dtlstransportinternal.h ('k') | webrtc/pc/channel.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2017 The WebRTC Project Authors. All rights reserved. 2 * Copyright 2017 The WebRTC Project Authors. All rights reserved.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license 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 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 6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may 7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree. 8 * be found in the AUTHORS file in the root of the source tree.
9 */ 9 */
10 10
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
84 if (dest && !dest_) { 84 if (dest && !dest_) {
85 // This simulates the DTLS handshake. 85 // This simulates the DTLS handshake.
86 dest_ = dest; 86 dest_ = dest;
87 if (local_cert_ && dest_->local_cert_) { 87 if (local_cert_ && dest_->local_cert_) {
88 do_dtls_ = true; 88 do_dtls_ = true;
89 } 89 }
90 SetWritable(true); 90 SetWritable(true);
91 if (!asymmetric) { 91 if (!asymmetric) {
92 dest->SetDestination(this, true); 92 dest->SetDestination(this, true);
93 } 93 }
94 dtls_state_ = DTLS_TRANSPORT_CONNECTED;
94 ice_transport_->SetDestination( 95 ice_transport_->SetDestination(
95 static_cast<FakeIceTransport*>(dest->ice_transport()), asymmetric); 96 static_cast<FakeIceTransport*>(dest->ice_transport()), asymmetric);
96 } else { 97 } else {
97 // Simulates loss of connectivity, by asymmetrically forgetting dest_. 98 // Simulates loss of connectivity, by asymmetrically forgetting dest_.
98 dest_ = nullptr; 99 dest_ = nullptr;
99 SetWritable(false); 100 SetWritable(false);
100 ice_transport_->SetDestination(nullptr, asymmetric); 101 ice_transport_->SetDestination(nullptr, asymmetric);
101 } 102 }
102 } 103 }
103 104
(...skipping 11 matching lines...) Expand all
115 return true; 116 return true;
116 } 117 }
117 bool SetSslRole(rtc::SSLRole role) override { 118 bool SetSslRole(rtc::SSLRole role) override {
118 ssl_role_ = role; 119 ssl_role_ = role;
119 return true; 120 return true;
120 } 121 }
121 bool GetSslRole(rtc::SSLRole* role) const override { 122 bool GetSslRole(rtc::SSLRole* role) const override {
122 *role = ssl_role_; 123 *role = ssl_role_;
123 return true; 124 return true;
124 } 125 }
126 const rtc::CryptoOptions& crypto_options() const override {
127 return crypto_options_;
128 }
129 void SetCryptoOptions(const rtc::CryptoOptions& crypto_options) {
130 crypto_options_ = crypto_options;
131 }
125 bool SetLocalCertificate( 132 bool SetLocalCertificate(
126 const rtc::scoped_refptr<rtc::RTCCertificate>& certificate) override { 133 const rtc::scoped_refptr<rtc::RTCCertificate>& certificate) override {
127 local_cert_ = certificate; 134 local_cert_ = certificate;
128 return true; 135 return true;
129 } 136 }
130 void SetRemoteSSLCertificate(rtc::FakeSSLCertificate* cert) { 137 void SetRemoteSSLCertificate(rtc::FakeSSLCertificate* cert) {
131 remote_cert_ = cert; 138 remote_cert_ = cert;
132 } 139 }
133 bool IsDtlsActive() const override { return do_dtls_; } 140 bool IsDtlsActive() const override { return do_dtls_; }
134 bool GetSrtpCryptoSuite(int* crypto_suite) override { 141 bool GetSrtpCryptoSuite(int* crypto_suite) override {
135 if (!do_dtls_) { 142 if (!do_dtls_) {
136 return false; 143 return false;
137 } 144 }
138 *crypto_suite = rtc::SRTP_AES128_CM_SHA1_80; 145 *crypto_suite = crypto_suite_;
139 return true; 146 return true;
140 } 147 }
148 void SetSrtpCryptoSuite(int crypto_suite) {
149 crypto_suite_ = crypto_suite;
150 }
141 bool GetSslCipherSuite(int* cipher_suite) override { return false; } 151 bool GetSslCipherSuite(int* cipher_suite) override { return false; }
142 rtc::scoped_refptr<rtc::RTCCertificate> GetLocalCertificate() const override { 152 rtc::scoped_refptr<rtc::RTCCertificate> GetLocalCertificate() const override {
143 return local_cert_; 153 return local_cert_;
144 } 154 }
145 std::unique_ptr<rtc::SSLCertificate> GetRemoteSSLCertificate() 155 std::unique_ptr<rtc::SSLCertificate> GetRemoteSSLCertificate()
146 const override { 156 const override {
147 return remote_cert_ ? std::unique_ptr<rtc::SSLCertificate>( 157 return remote_cert_ ? std::unique_ptr<rtc::SSLCertificate>(
148 remote_cert_->GetReference()) 158 remote_cert_->GetReference())
149 : nullptr; 159 : nullptr;
150 } 160 }
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
223 std::unique_ptr<FakeIceTransport> owned_ice_transport_; 233 std::unique_ptr<FakeIceTransport> owned_ice_transport_;
224 std::string transport_name_; 234 std::string transport_name_;
225 int component_; 235 int component_;
226 FakeDtlsTransport* dest_ = nullptr; 236 FakeDtlsTransport* dest_ = nullptr;
227 rtc::scoped_refptr<rtc::RTCCertificate> local_cert_; 237 rtc::scoped_refptr<rtc::RTCCertificate> local_cert_;
228 rtc::FakeSSLCertificate* remote_cert_ = nullptr; 238 rtc::FakeSSLCertificate* remote_cert_ = nullptr;
229 bool do_dtls_ = false; 239 bool do_dtls_ = false;
230 rtc::SSLProtocolVersion ssl_max_version_ = rtc::SSL_PROTOCOL_DTLS_12; 240 rtc::SSLProtocolVersion ssl_max_version_ = rtc::SSL_PROTOCOL_DTLS_12;
231 rtc::SSLFingerprint dtls_fingerprint_; 241 rtc::SSLFingerprint dtls_fingerprint_;
232 rtc::SSLRole ssl_role_ = rtc::SSL_CLIENT; 242 rtc::SSLRole ssl_role_ = rtc::SSL_CLIENT;
243 int crypto_suite_ = rtc::SRTP_AES128_CM_SHA1_80;
244 rtc::CryptoOptions crypto_options_;
233 245
234 DtlsTransportState dtls_state_ = DTLS_TRANSPORT_NEW; 246 DtlsTransportState dtls_state_ = DTLS_TRANSPORT_NEW;
235 247
236 bool receiving_ = false; 248 bool receiving_ = false;
237 bool writable_ = false; 249 bool writable_ = false;
238 }; 250 };
239 251
240 } // namespace cricket 252 } // namespace cricket
241 253
242 #endif // WEBRTC_P2P_BASE_FAKEDTLSTRANSPORT_H_ 254 #endif // WEBRTC_P2P_BASE_FAKEDTLSTRANSPORT_H_
OLDNEW
« no previous file with comments | « webrtc/p2p/base/dtlstransportinternal.h ('k') | webrtc/pc/channel.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698