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

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

Issue 1458023002: Reland Convert internal representation of Srtp cryptos from string to int (Closed) Base URL: https://chromium.googlesource.com/external/webrtc@master
Patch Set: Created 5 years, 1 month 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/dtlstransportchannel_unittest.cc ('k') | webrtc/p2p/base/p2ptransportchannel.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 2009 The WebRTC Project Authors. All rights reserved. 2 * Copyright 2009 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 224 matching lines...) Expand 10 before | Expand all | Expand 10 after
235 local_cert_ = certificate; 235 local_cert_ = certificate;
236 return true; 236 return true;
237 } 237 }
238 238
239 void SetRemoteSSLCertificate(rtc::FakeSSLCertificate* cert) { 239 void SetRemoteSSLCertificate(rtc::FakeSSLCertificate* cert) {
240 remote_cert_ = cert; 240 remote_cert_ = cert;
241 } 241 }
242 242
243 bool IsDtlsActive() const override { return do_dtls_; } 243 bool IsDtlsActive() const override { return do_dtls_; }
244 244
245 bool SetSrtpCiphers(const std::vector<std::string>& ciphers) override { 245 bool SetSrtpCryptoSuites(const std::vector<int>& ciphers) override {
246 srtp_ciphers_ = ciphers; 246 srtp_ciphers_ = ciphers;
247 return true; 247 return true;
248 } 248 }
249 249
250 bool GetSrtpCryptoSuite(std::string* cipher) override { 250 bool GetSrtpCryptoSuite(int* crypto_suite) override {
251 if (!chosen_srtp_cipher_.empty()) { 251 if (chosen_crypto_suite_ != rtc::SRTP_INVALID_CRYPTO_SUITE) {
252 *cipher = chosen_srtp_cipher_; 252 *crypto_suite = chosen_crypto_suite_;
253 return true; 253 return true;
254 } 254 }
255 return false; 255 return false;
256 } 256 }
257 257
258 bool GetSslCipherSuite(int* cipher) override { return false; } 258 bool GetSslCipherSuite(int* cipher_suite) override { return false; }
259 259
260 rtc::scoped_refptr<rtc::RTCCertificate> GetLocalCertificate() const { 260 rtc::scoped_refptr<rtc::RTCCertificate> GetLocalCertificate() const {
261 return local_cert_; 261 return local_cert_;
262 } 262 }
263 263
264 bool GetRemoteSSLCertificate(rtc::SSLCertificate** cert) const override { 264 bool GetRemoteSSLCertificate(rtc::SSLCertificate** cert) const override {
265 if (!remote_cert_) 265 if (!remote_cert_)
266 return false; 266 return false;
267 267
268 *cert = remote_cert_->GetReference(); 268 *cert = remote_cert_->GetReference();
269 return true; 269 return true;
270 } 270 }
271 271
272 bool ExportKeyingMaterial(const std::string& label, 272 bool ExportKeyingMaterial(const std::string& label,
273 const uint8_t* context, 273 const uint8_t* context,
274 size_t context_len, 274 size_t context_len,
275 bool use_context, 275 bool use_context,
276 uint8_t* result, 276 uint8_t* result,
277 size_t result_len) override { 277 size_t result_len) override {
278 if (!chosen_srtp_cipher_.empty()) { 278 if (chosen_crypto_suite_ != rtc::SRTP_INVALID_CRYPTO_SUITE) {
279 memset(result, 0xff, result_len); 279 memset(result, 0xff, result_len);
280 return true; 280 return true;
281 } 281 }
282 282
283 return false; 283 return false;
284 } 284 }
285 285
286 void NegotiateSrtpCiphers() { 286 void NegotiateSrtpCiphers() {
287 for (std::vector<std::string>::const_iterator it1 = srtp_ciphers_.begin(); 287 for (std::vector<int>::const_iterator it1 = srtp_ciphers_.begin();
288 it1 != srtp_ciphers_.end(); ++it1) { 288 it1 != srtp_ciphers_.end(); ++it1) {
289 for (std::vector<std::string>::const_iterator it2 = 289 for (std::vector<int>::const_iterator it2 = dest_->srtp_ciphers_.begin();
290 dest_->srtp_ciphers_.begin();
291 it2 != dest_->srtp_ciphers_.end(); ++it2) { 290 it2 != dest_->srtp_ciphers_.end(); ++it2) {
292 if (*it1 == *it2) { 291 if (*it1 == *it2) {
293 chosen_srtp_cipher_ = *it1; 292 chosen_crypto_suite_ = *it1;
294 dest_->chosen_srtp_cipher_ = *it2; 293 dest_->chosen_crypto_suite_ = *it2;
295 return; 294 return;
296 } 295 }
297 } 296 }
298 } 297 }
299 } 298 }
300 299
301 bool GetStats(ConnectionInfos* infos) override { 300 bool GetStats(ConnectionInfos* infos) override {
302 ConnectionInfo info; 301 ConnectionInfo info;
303 infos->clear(); 302 infos->clear();
304 infos->push_back(info); 303 infos->push_back(info);
(...skipping 10 matching lines...) Expand all
315 private: 314 private:
316 enum State { STATE_INIT, STATE_CONNECTING, STATE_CONNECTED }; 315 enum State { STATE_INIT, STATE_CONNECTING, STATE_CONNECTED };
317 Transport* transport_; 316 Transport* transport_;
318 FakeTransportChannel* dest_ = nullptr; 317 FakeTransportChannel* dest_ = nullptr;
319 State state_ = STATE_INIT; 318 State state_ = STATE_INIT;
320 bool async_ = false; 319 bool async_ = false;
321 Candidates remote_candidates_; 320 Candidates remote_candidates_;
322 rtc::scoped_refptr<rtc::RTCCertificate> local_cert_; 321 rtc::scoped_refptr<rtc::RTCCertificate> local_cert_;
323 rtc::FakeSSLCertificate* remote_cert_ = nullptr; 322 rtc::FakeSSLCertificate* remote_cert_ = nullptr;
324 bool do_dtls_ = false; 323 bool do_dtls_ = false;
325 std::vector<std::string> srtp_ciphers_; 324 std::vector<int> srtp_ciphers_;
326 std::string chosen_srtp_cipher_; 325 int chosen_crypto_suite_ = rtc::SRTP_INVALID_CRYPTO_SUITE;
327 int receiving_timeout_ = -1; 326 int receiving_timeout_ = -1;
328 bool gather_continually_ = false; 327 bool gather_continually_ = false;
329 IceRole role_ = ICEROLE_UNKNOWN; 328 IceRole role_ = ICEROLE_UNKNOWN;
330 uint64_t tiebreaker_ = 0; 329 uint64_t tiebreaker_ = 0;
331 std::string ice_ufrag_; 330 std::string ice_ufrag_;
332 std::string ice_pwd_; 331 std::string ice_pwd_;
333 std::string remote_ice_ufrag_; 332 std::string remote_ice_ufrag_;
334 std::string remote_ice_pwd_; 333 std::string remote_ice_pwd_;
335 IceMode remote_ice_mode_ = ICEMODE_FULL; 334 IceMode remote_ice_mode_ = ICEMODE_FULL;
336 rtc::SSLProtocolVersion ssl_max_version_ = rtc::SSL_PROTOCOL_DTLS_10; 335 rtc::SSLProtocolVersion ssl_max_version_ = rtc::SSL_PROTOCOL_DTLS_10;
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after
535 } 534 }
536 } 535 }
537 536
538 private: 537 private:
539 bool fail_create_channel_; 538 bool fail_create_channel_;
540 }; 539 };
541 540
542 } // namespace cricket 541 } // namespace cricket
543 542
544 #endif // WEBRTC_P2P_BASE_FAKETRANSPORTCONTROLLER_H_ 543 #endif // WEBRTC_P2P_BASE_FAKETRANSPORTCONTROLLER_H_
OLDNEW
« no previous file with comments | « webrtc/p2p/base/dtlstransportchannel_unittest.cc ('k') | webrtc/p2p/base/p2ptransportchannel.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698