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

Side by Side Diff: net/quic/core/crypto/quic_crypto_server_config.cc

Issue 2512833002: adds std:: to stl types (Closed)
Patch Set: Created 4 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 | « no previous file | net/quic/core/crypto/quic_crypto_server_config_test.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "net/quic/core/crypto/quic_crypto_server_config.h" 5 #include "net/quic/core/crypto/quic_crypto_server_config.h"
6 6
7 #include <stdlib.h> 7 #include <stdlib.h>
8 8
9 #include <algorithm> 9 #include <algorithm>
10 #include <memory> 10 #include <memory>
(...skipping 396 matching lines...) Expand 10 before | Expand all | Expand 10 after
407 } 407 }
408 408
409 CryptoHandshakeMessage* QuicCryptoServerConfig::AddDefaultConfig( 409 CryptoHandshakeMessage* QuicCryptoServerConfig::AddDefaultConfig(
410 QuicRandom* rand, 410 QuicRandom* rand,
411 const QuicClock* clock, 411 const QuicClock* clock,
412 const ConfigOptions& options) { 412 const ConfigOptions& options) {
413 return AddConfig(GenerateConfig(rand, clock, options), clock->WallNow()); 413 return AddConfig(GenerateConfig(rand, clock, options), clock->WallNow());
414 } 414 }
415 415
416 bool QuicCryptoServerConfig::SetConfigs( 416 bool QuicCryptoServerConfig::SetConfigs(
417 const vector<std::unique_ptr<QuicServerConfigProtobuf>>& protobufs, 417 const std::vector<std::unique_ptr<QuicServerConfigProtobuf>>& protobufs,
418 const QuicWallTime now) { 418 const QuicWallTime now) {
419 vector<scoped_refptr<Config>> parsed_configs; 419 std::vector<scoped_refptr<Config>> parsed_configs;
420 bool ok = true; 420 bool ok = true;
421 421
422 for (auto& protobuf : protobufs) { 422 for (auto& protobuf : protobufs) {
423 scoped_refptr<Config> config(ParseConfigProtobuf(protobuf)); 423 scoped_refptr<Config> config(ParseConfigProtobuf(protobuf));
424 if (!config.get()) { 424 if (!config.get()) {
425 ok = false; 425 ok = false;
426 break; 426 break;
427 } 427 }
428 428
429 parsed_configs.push_back(config); 429 parsed_configs.push_back(config);
430 } 430 }
431 431
432 if (parsed_configs.empty()) { 432 if (parsed_configs.empty()) {
433 LOG(WARNING) << "New config list is empty."; 433 LOG(WARNING) << "New config list is empty.";
434 ok = false; 434 ok = false;
435 } 435 }
436 436
437 if (!ok) { 437 if (!ok) {
438 LOG(WARNING) << "Rejecting QUIC configs because of above errors"; 438 LOG(WARNING) << "Rejecting QUIC configs because of above errors";
439 } else { 439 } else {
440 VLOG(1) << "Updating configs:"; 440 VLOG(1) << "Updating configs:";
441 441
442 base::AutoLock locked(configs_lock_); 442 base::AutoLock locked(configs_lock_);
443 ConfigMap new_configs; 443 ConfigMap new_configs;
444 444
445 for (vector<scoped_refptr<Config>>::const_iterator i = 445 for (std::vector<scoped_refptr<Config>>::const_iterator i =
446 parsed_configs.begin(); 446 parsed_configs.begin();
447 i != parsed_configs.end(); ++i) { 447 i != parsed_configs.end(); ++i) {
448 scoped_refptr<Config> config = *i; 448 scoped_refptr<Config> config = *i;
449 449
450 ConfigMap::iterator it = configs_.find(config->id); 450 ConfigMap::iterator it = configs_.find(config->id);
451 if (it != configs_.end()) { 451 if (it != configs_.end()) {
452 VLOG(1) << "Keeping scid: " << QuicUtils::HexEncode(config->id) 452 VLOG(1) << "Keeping scid: " << QuicUtils::HexEncode(config->id)
453 << " orbit: " 453 << " orbit: "
454 << QuicUtils::HexEncode( 454 << QuicUtils::HexEncode(
455 reinterpret_cast<const char*>(config->orbit), kOrbitSize) 455 reinterpret_cast<const char*>(config->orbit), kOrbitSize)
(...skipping 657 matching lines...) Expand 10 before | Expand all | Expand 10 after
1113 // Primary times are equal, sort backwards by priority. 1113 // Primary times are equal, sort backwards by priority.
1114 return a->priority < b->priority; 1114 return a->priority < b->priority;
1115 } else { 1115 } else {
1116 // Primary times and priorities are equal, sort by config id. 1116 // Primary times and priorities are equal, sort by config id.
1117 return a->id < b->id; 1117 return a->id < b->id;
1118 } 1118 }
1119 } 1119 }
1120 1120
1121 void QuicCryptoServerConfig::SelectNewPrimaryConfig( 1121 void QuicCryptoServerConfig::SelectNewPrimaryConfig(
1122 const QuicWallTime now) const { 1122 const QuicWallTime now) const {
1123 vector<scoped_refptr<Config>> configs; 1123 std::vector<scoped_refptr<Config>> configs;
1124 configs.reserve(configs_.size()); 1124 configs.reserve(configs_.size());
1125 1125
1126 for (ConfigMap::const_iterator it = configs_.begin(); it != configs_.end(); 1126 for (ConfigMap::const_iterator it = configs_.begin(); it != configs_.end();
1127 ++it) { 1127 ++it) {
1128 // TODO(avd) Exclude expired configs? 1128 // TODO(avd) Exclude expired configs?
1129 configs.push_back(it->second); 1129 configs.push_back(it->second);
1130 } 1130 }
1131 1131
1132 if (configs.empty()) { 1132 if (configs.empty()) {
1133 if (primary_config_.get()) { 1133 if (primary_config_.get()) {
(...skipping 684 matching lines...) Expand 10 before | Expand all | Expand 10 after
1818 return nullptr; 1818 return nullptr;
1819 } 1819 }
1820 config->id = scid.as_string(); 1820 config->id = scid.as_string();
1821 1821
1822 const QuicTag* aead_tags; 1822 const QuicTag* aead_tags;
1823 size_t aead_len; 1823 size_t aead_len;
1824 if (msg->GetTaglist(kAEAD, &aead_tags, &aead_len) != QUIC_NO_ERROR) { 1824 if (msg->GetTaglist(kAEAD, &aead_tags, &aead_len) != QUIC_NO_ERROR) {
1825 LOG(WARNING) << "Server config message is missing AEAD"; 1825 LOG(WARNING) << "Server config message is missing AEAD";
1826 return nullptr; 1826 return nullptr;
1827 } 1827 }
1828 config->aead = vector<QuicTag>(aead_tags, aead_tags + aead_len); 1828 config->aead = std::vector<QuicTag>(aead_tags, aead_tags + aead_len);
1829 1829
1830 const QuicTag* kexs_tags; 1830 const QuicTag* kexs_tags;
1831 size_t kexs_len; 1831 size_t kexs_len;
1832 if (msg->GetTaglist(kKEXS, &kexs_tags, &kexs_len) != QUIC_NO_ERROR) { 1832 if (msg->GetTaglist(kKEXS, &kexs_tags, &kexs_len) != QUIC_NO_ERROR) {
1833 LOG(WARNING) << "Server config message is missing KEXS"; 1833 LOG(WARNING) << "Server config message is missing KEXS";
1834 return nullptr; 1834 return nullptr;
1835 } 1835 }
1836 1836
1837 const QuicTag* tbkp_tags; 1837 const QuicTag* tbkp_tags;
1838 size_t tbkp_len; 1838 size_t tbkp_len;
1839 QuicErrorCode err; 1839 QuicErrorCode err;
1840 if ((err = msg->GetTaglist(kTBKP, &tbkp_tags, &tbkp_len)) != 1840 if ((err = msg->GetTaglist(kTBKP, &tbkp_tags, &tbkp_len)) !=
1841 QUIC_CRYPTO_MESSAGE_PARAMETER_NOT_FOUND && 1841 QUIC_CRYPTO_MESSAGE_PARAMETER_NOT_FOUND &&
1842 err != QUIC_NO_ERROR) { 1842 err != QUIC_NO_ERROR) {
1843 LOG(WARNING) << "Server config message is missing or has invalid TBKP"; 1843 LOG(WARNING) << "Server config message is missing or has invalid TBKP";
1844 return nullptr; 1844 return nullptr;
1845 } 1845 }
1846 config->tb_key_params = vector<QuicTag>(tbkp_tags, tbkp_tags + tbkp_len); 1846 config->tb_key_params = std::vector<QuicTag>(tbkp_tags, tbkp_tags + tbkp_len);
1847 1847
1848 StringPiece orbit; 1848 StringPiece orbit;
1849 if (!msg->GetStringPiece(kORBT, &orbit)) { 1849 if (!msg->GetStringPiece(kORBT, &orbit)) {
1850 LOG(WARNING) << "Server config message is missing ORBT"; 1850 LOG(WARNING) << "Server config message is missing ORBT";
1851 return nullptr; 1851 return nullptr;
1852 } 1852 }
1853 1853
1854 if (orbit.size() != kOrbitSize) { 1854 if (orbit.size() != kOrbitSize) {
1855 LOG(WARNING) << "Orbit value in server config is the wrong length." 1855 LOG(WARNING) << "Orbit value in server config is the wrong length."
1856 " Got " 1856 " Got "
(...skipping 424 matching lines...) Expand 10 before | Expand all | Expand 10 after
2281 source_address_token_boxer(nullptr) {} 2281 source_address_token_boxer(nullptr) {}
2282 2282
2283 QuicCryptoServerConfig::Config::~Config() { 2283 QuicCryptoServerConfig::Config::~Config() {
2284 } 2284 }
2285 2285
2286 QuicSignedServerConfig::QuicSignedServerConfig() 2286 QuicSignedServerConfig::QuicSignedServerConfig()
2287 : send_expect_ct_header(false) {} 2287 : send_expect_ct_header(false) {}
2288 QuicSignedServerConfig::~QuicSignedServerConfig() {} 2288 QuicSignedServerConfig::~QuicSignedServerConfig() {}
2289 2289
2290 } // namespace net 2290 } // namespace net
OLDNEW
« no previous file with comments | « no previous file | net/quic/core/crypto/quic_crypto_server_config_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698