From 9424add9d73432a794b7944790253213cce6dcb8 Mon Sep 17 00:00:00 2001 From: danzh Date: Thu, 06 Jun 2019 14:04:36 -0700 Subject: [PATCH] gfe-relnote: (n/a) code cleanup. Fix envoy compile errors. Add #include header for std library. Reference TransportParameters when using its enum TransportParameterId. PiperOrigin-RevId: 251922363 Change-Id: Iba38660e5adc3069e377829acec44267658b11c6 --- diff --git a/net/third_party/quiche/src/quic/core/crypto/transport_parameters.cc b/net/third_party/quiche/src/quic/core/crypto/transport_parameters.cc index ee0ebf0..e5df9fe 100644 --- a/net/third_party/quiche/src/quic/core/crypto/transport_parameters.cc +++ b/net/third_party/quiche/src/quic/core/crypto/transport_parameters.cc @@ -62,37 +62,37 @@ std::string TransportParameterIdToString( TransportParameters::TransportParameterId param_id) { switch (param_id) { - case kOriginalConnectionId: + case TransportParameters::kOriginalConnectionId: return "original_connection_id"; - case kIdleTimeout: + case TransportParameters::kIdleTimeout: return "idle_timeout"; - case kStatelessResetToken: + case TransportParameters::kStatelessResetToken: return "stateless_reset_token"; - case kMaxPacketSize: + case TransportParameters::kMaxPacketSize: return "max_packet_size"; - case kInitialMaxData: + case TransportParameters::kInitialMaxData: return "initial_max_data"; - case kInitialMaxStreamDataBidiLocal: + case TransportParameters::kInitialMaxStreamDataBidiLocal: return "initial_max_stream_data_bidi_local"; - case kInitialMaxStreamDataBidiRemote: + case TransportParameters::kInitialMaxStreamDataBidiRemote: return "initial_max_stream_data_bidi_remote"; - case kInitialMaxStreamDataUni: + case TransportParameters::kInitialMaxStreamDataUni: return "initial_max_stream_data_uni"; - case kInitialMaxStreamsBidi: + case TransportParameters::kInitialMaxStreamsBidi: return "initial_max_streams_bidi"; - case kInitialMaxStreamsUni: + case TransportParameters::kInitialMaxStreamsUni: return "initial_max_streams_uni"; - case kAckDelayExponent: + case TransportParameters::kAckDelayExponent: return "ack_delay_exponent"; - case kMaxAckDelay: + case TransportParameters::kMaxAckDelay: return "max_ack_delay"; - case kDisableMigration: + case TransportParameters::kDisableMigration: return "disable_migration"; - case kPreferredAddress: + case TransportParameters::kPreferredAddress: return "preferred_address"; - case kGoogleQuicParam: + case TransportParameters::kGoogleQuicParam: return "google"; - case kGoogleQuicVersion: + case TransportParameters::kGoogleQuicVersion: return "google-version"; } return "Unknown(" + QuicTextUtils::Uint64ToString(param_id) + ")"; @@ -390,7 +390,7 @@ CBB original_connection_id_param; if (!in.original_connection_id.IsEmpty()) { DCHECK_EQ(Perspective::IS_SERVER, in.perspective); - if (!CBB_add_u16(¶ms, kOriginalConnectionId) || + if (!CBB_add_u16(¶ms, TransportParameters::kOriginalConnectionId) || !CBB_add_u16_length_prefixed(¶ms, &original_connection_id_param) || !CBB_add_bytes( &original_connection_id_param, @@ -412,7 +412,7 @@ if (!in.stateless_reset_token.empty()) { DCHECK_EQ(kStatelessResetTokenLength, in.stateless_reset_token.size()); DCHECK_EQ(Perspective::IS_SERVER, in.perspective); - if (!CBB_add_u16(¶ms, kStatelessResetToken) || + if (!CBB_add_u16(¶ms, TransportParameters::kStatelessResetToken) || !CBB_add_u16_length_prefixed(¶ms, &stateless_reset_token_param) || !CBB_add_bytes(&stateless_reset_token_param, in.stateless_reset_token.data(), @@ -438,7 +438,7 @@ // disable_migration if (in.disable_migration) { - if (!CBB_add_u16(¶ms, kDisableMigration) || + if (!CBB_add_u16(¶ms, TransportParameters::kDisableMigration) || !CBB_add_u16(¶ms, 0u)) { // 0 is the length of this parameter. QUIC_BUG << "Failed to write disable_migration for " << in; return false; @@ -458,7 +458,7 @@ QUIC_BUG << "Bad lengths " << *in.preferred_address; return false; } - if (!CBB_add_u16(¶ms, kPreferredAddress) || + if (!CBB_add_u16(¶ms, TransportParameters::kPreferredAddress) || !CBB_add_u16_length_prefixed(¶ms, &preferred_address_params) || !CBB_add_bytes( &preferred_address_params, @@ -491,7 +491,7 @@ if (in.google_quic_params) { const QuicData& serialized_google_quic_params = in.google_quic_params->GetSerialized(); - if (!CBB_add_u16(¶ms, kGoogleQuicParam) || + if (!CBB_add_u16(¶ms, TransportParameters::kGoogleQuicParam) || !CBB_add_u16_length_prefixed(¶ms, &google_quic_params) || !CBB_add_bytes(&google_quic_params, reinterpret_cast( @@ -505,7 +505,7 @@ // Google-specific version extension. CBB google_version_params; - if (!CBB_add_u16(¶ms, kGoogleQuicVersion) || + if (!CBB_add_u16(¶ms, TransportParameters::kGoogleQuicVersion) || !CBB_add_u16_length_prefixed(¶ms, &google_version_params) || !CBB_add_u32(&google_version_params, in.version)) { QUIC_BUG << "Failed to write Google version extension for " << in; @@ -565,7 +565,7 @@ } bool parse_success = true; switch (param_id) { - case kOriginalConnectionId: + case TransportParameters::kOriginalConnectionId: if (!out->original_connection_id.IsEmpty()) { QUIC_DLOG(ERROR) << "Received a second original connection ID"; return false; @@ -581,10 +581,10 @@ CBS_len(&value)); } break; - case kIdleTimeout: + case TransportParameters::kIdleTimeout: parse_success = out->idle_timeout_milliseconds.ReadFromCbs(&value); break; - case kStatelessResetToken: + case TransportParameters::kStatelessResetToken: if (!out->stateless_reset_token.empty()) { QUIC_DLOG(ERROR) << "Received a second stateless reset token"; return false; @@ -597,36 +597,36 @@ out->stateless_reset_token.assign(CBS_data(&value), CBS_data(&value) + CBS_len(&value)); break; - case kMaxPacketSize: + case TransportParameters::kMaxPacketSize: parse_success = out->max_packet_size.ReadFromCbs(&value); break; - case kInitialMaxData: + case TransportParameters::kInitialMaxData: parse_success = out->initial_max_data.ReadFromCbs(&value); break; - case kInitialMaxStreamDataBidiLocal: + case TransportParameters::kInitialMaxStreamDataBidiLocal: parse_success = out->initial_max_stream_data_bidi_local.ReadFromCbs(&value); break; - case kInitialMaxStreamDataBidiRemote: + case TransportParameters::kInitialMaxStreamDataBidiRemote: parse_success = out->initial_max_stream_data_bidi_remote.ReadFromCbs(&value); break; - case kInitialMaxStreamDataUni: + case TransportParameters::kInitialMaxStreamDataUni: parse_success = out->initial_max_stream_data_uni.ReadFromCbs(&value); break; - case kInitialMaxStreamsBidi: + case TransportParameters::kInitialMaxStreamsBidi: parse_success = out->initial_max_streams_bidi.ReadFromCbs(&value); break; - case kInitialMaxStreamsUni: + case TransportParameters::kInitialMaxStreamsUni: parse_success = out->initial_max_streams_uni.ReadFromCbs(&value); break; - case kAckDelayExponent: + case TransportParameters::kAckDelayExponent: parse_success = out->ack_delay_exponent.ReadFromCbs(&value); break; - case kMaxAckDelay: + case TransportParameters::kMaxAckDelay: parse_success = out->max_ack_delay.ReadFromCbs(&value); break; - case kDisableMigration: + case TransportParameters::kDisableMigration: if (out->disable_migration) { QUIC_DLOG(ERROR) << "Received a second disable migration"; return false; @@ -638,7 +638,7 @@ } out->disable_migration = true; break; - case kPreferredAddress: { + case TransportParameters::kPreferredAddress: { uint16_t ipv4_port, ipv6_port; in_addr ipv4_address; in6_addr ipv6_address; @@ -692,7 +692,7 @@ QuicMakeUnique( preferred_address); } break; - case kGoogleQuicParam: { + case TransportParameters::kGoogleQuicParam: { if (out->google_quic_params) { QUIC_DLOG(ERROR) << "Received a second Google parameter"; return false; @@ -701,7 +701,7 @@ reinterpret_cast(CBS_data(&value)), CBS_len(&value)); out->google_quic_params = CryptoFramer::ParseMessage(serialized_params); } break; - case kGoogleQuicVersion: { + case TransportParameters::kGoogleQuicVersion: { if (!CBS_get_u32(&value, &out->version)) { QUIC_DLOG(ERROR) << "Failed to parse Google version extension"; return false; diff --git a/quic/core/quic_socket_address_coder.cc b/quic/core/quic_socket_address_coder.cc index 2527fc9..b26103d 100644 --- a/net/third_party/quiche/src/quic/core/quic_socket_address_coder.cc +++ b/net/third_party/quiche/src/quic/core/quic_socket_address_coder.cc @@ -2,10 +2,12 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include - #include "net/third_party/quiche/src/quic/core/quic_socket_address_coder.h" +#include +#include +#include + namespace quic { namespace {