Rename PacketHeaderFormat::GOOGLE_QUIC_PACKET to QUIC_Q043_PACKET
To modern readers of the code, Google QUIC implies Q046, but Q046 is not of the form GOOGLE_QUIC_PACKET. Renaming the enum value improves readability of the code, with the help of extensive comments in the enum defininition.
PiperOrigin-RevId: 775336278
diff --git a/quiche/quic/core/quic_buffered_packet_store.cc b/quiche/quic/core/quic_buffered_packet_store.cc
index 6d78007..f70acb0 100644
--- a/quiche/quic/core/quic_buffered_packet_store.cc
+++ b/quiche/quic/core/quic_buffered_packet_store.cc
@@ -137,7 +137,7 @@
const QuicSocketAddress& self_address = packet_info.self_address;
const QuicSocketAddress& peer_address = packet_info.peer_address;
const ParsedQuicVersion& version = packet_info.version;
- const bool ietf_quic = packet_info.form != GOOGLE_QUIC_PACKET;
+ const bool ietf_quic = packet_info.form != GOOGLE_QUIC_Q043_PACKET;
const bool is_chlo = parsed_chlo.has_value();
const bool is_ietf_initial_packet =
(version.IsKnown() && packet_info.form == IETF_QUIC_LONG_HEADER_PACKET &&
diff --git a/quiche/quic/core/quic_buffered_packet_store_test.cc b/quiche/quic/core/quic_buffered_packet_store_test.cc
index 3244ab2..3790254 100644
--- a/quiche/quic/core/quic_buffered_packet_store_test.cc
+++ b/quiche/quic/core/quic_buffered_packet_store_test.cc
@@ -190,7 +190,7 @@
TEST_F(QuicBufferedPacketStoreTest, SimpleEnqueueAndDeliverPacket) {
QuicConnectionId connection_id = TestConnectionId(1);
- EnqueuePacketToStore(store_, connection_id, GOOGLE_QUIC_PACKET,
+ EnqueuePacketToStore(store_, connection_id, GOOGLE_QUIC_Q043_PACKET,
INVALID_PACKET_TYPE, packet_, self_address_,
peer_address_, invalid_version_, kNoParsedChlo,
connection_id_generator_);
@@ -268,11 +268,11 @@
TEST_F(QuicBufferedPacketStoreTest, DifferentPacketAddressOnOneConnection) {
QuicSocketAddress addr_with_new_port(QuicIpAddress::Any4(), 256);
QuicConnectionId connection_id = TestConnectionId(1);
- EnqueuePacketToStore(store_, connection_id, GOOGLE_QUIC_PACKET,
+ EnqueuePacketToStore(store_, connection_id, GOOGLE_QUIC_Q043_PACKET,
INVALID_PACKET_TYPE, packet_, self_address_,
peer_address_, invalid_version_, kNoParsedChlo,
connection_id_generator_);
- EnqueuePacketToStore(store_, connection_id, GOOGLE_QUIC_PACKET,
+ EnqueuePacketToStore(store_, connection_id, GOOGLE_QUIC_Q043_PACKET,
INVALID_PACKET_TYPE, packet_, self_address_,
addr_with_new_port, invalid_version_, kNoParsedChlo,
connection_id_generator_);
@@ -289,11 +289,11 @@
size_t num_connections = 10;
for (uint64_t conn_id = 1; conn_id <= num_connections; ++conn_id) {
QuicConnectionId connection_id = TestConnectionId(conn_id);
- EnqueuePacketToStore(store_, connection_id, GOOGLE_QUIC_PACKET,
+ EnqueuePacketToStore(store_, connection_id, GOOGLE_QUIC_Q043_PACKET,
INVALID_PACKET_TYPE, packet_, self_address_,
peer_address_, invalid_version_, kNoParsedChlo,
connection_id_generator_);
- EnqueuePacketToStore(store_, connection_id, GOOGLE_QUIC_PACKET,
+ EnqueuePacketToStore(store_, connection_id, GOOGLE_QUIC_Q043_PACKET,
INVALID_PACKET_TYPE, packet_, self_address_,
peer_address_, invalid_version_, kNoParsedChlo,
connection_id_generator_);
@@ -323,8 +323,8 @@
for (size_t i = 1; i <= kMaxPacketsPerConnection; ++i) {
// All packets will be buffered except the last one.
EnqueuePacketResult result = EnqueuePacketToStore(
- store_, connection_id, GOOGLE_QUIC_PACKET, INVALID_PACKET_TYPE, packet_,
- self_address_, peer_address_, invalid_version_, kNoParsedChlo,
+ store_, connection_id, GOOGLE_QUIC_Q043_PACKET, INVALID_PACKET_TYPE,
+ packet_, self_address_, peer_address_, invalid_version_, kNoParsedChlo,
connection_id_generator_);
if (i != kMaxPacketsPerConnection) {
EXPECT_EQ(EnqueuePacketResult::SUCCESS, result);
@@ -345,8 +345,8 @@
for (uint64_t conn_id = 1; conn_id <= kNumConnections; ++conn_id) {
QuicConnectionId connection_id = TestConnectionId(conn_id);
EnqueuePacketResult result = EnqueuePacketToStore(
- store_, connection_id, GOOGLE_QUIC_PACKET, INVALID_PACKET_TYPE, packet_,
- self_address_, peer_address_, invalid_version_, kNoParsedChlo,
+ store_, connection_id, GOOGLE_QUIC_Q043_PACKET, INVALID_PACKET_TYPE,
+ packet_, self_address_, peer_address_, invalid_version_, kNoParsedChlo,
connection_id_generator_);
if (conn_id <= kMaxConnectionsWithoutCHLO) {
EXPECT_EQ(EnqueuePacketResult::SUCCESS, result);
@@ -374,12 +374,12 @@
size_t num_chlos =
kDefaultMaxConnectionsInStore - kMaxConnectionsWithoutCHLO + 1;
for (uint64_t conn_id = 1; conn_id <= num_chlos; ++conn_id) {
- EXPECT_EQ(
- EnqueuePacketResult::SUCCESS,
- EnqueuePacketToStore(store_, TestConnectionId(conn_id),
- GOOGLE_QUIC_PACKET, INVALID_PACKET_TYPE, packet_,
- self_address_, peer_address_, valid_version_,
- kDefaultParsedChlo, connection_id_generator_));
+ EXPECT_EQ(EnqueuePacketResult::SUCCESS,
+ EnqueuePacketToStore(store_, TestConnectionId(conn_id),
+ GOOGLE_QUIC_Q043_PACKET, INVALID_PACKET_TYPE,
+ packet_, self_address_, peer_address_,
+ valid_version_, kDefaultParsedChlo,
+ connection_id_generator_));
}
// Send data packets on another |kMaxConnectionsWithoutCHLO| connections.
@@ -388,9 +388,9 @@
conn_id <= (kDefaultMaxConnectionsInStore + 1); ++conn_id) {
QuicConnectionId connection_id = TestConnectionId(conn_id);
EnqueuePacketResult result = EnqueuePacketToStore(
- store_, connection_id, GOOGLE_QUIC_PACKET, INVALID_PACKET_TYPE, packet_,
- self_address_, peer_address_, valid_version_, kDefaultParsedChlo,
- connection_id_generator_);
+ store_, connection_id, GOOGLE_QUIC_Q043_PACKET, INVALID_PACKET_TYPE,
+ packet_, self_address_, peer_address_, valid_version_,
+ kDefaultParsedChlo, connection_id_generator_);
if (conn_id <= kDefaultMaxConnectionsInStore) {
EXPECT_EQ(EnqueuePacketResult::SUCCESS, result);
} else {
@@ -402,7 +402,7 @@
TEST_F(QuicBufferedPacketStoreTest, BasicGeneratorBuffering) {
EXPECT_EQ(EnqueuePacketResult::SUCCESS,
EnqueuePacketToStore(
- store_, TestConnectionId(1), GOOGLE_QUIC_PACKET,
+ store_, TestConnectionId(1), GOOGLE_QUIC_Q043_PACKET,
INVALID_PACKET_TYPE, packet_, self_address_, peer_address_,
valid_version_, kDefaultParsedChlo, connection_id_generator_));
QuicConnectionId delivered_conn_id;
@@ -417,12 +417,12 @@
MockConnectionIdGenerator generator2;
EXPECT_EQ(EnqueuePacketResult::SUCCESS,
EnqueuePacketToStore(
- store_, TestConnectionId(1), GOOGLE_QUIC_PACKET,
+ store_, TestConnectionId(1), GOOGLE_QUIC_Q043_PACKET,
INVALID_PACKET_TYPE, packet_, self_address_, peer_address_,
valid_version_, kDefaultParsedChlo, connection_id_generator_));
EXPECT_EQ(EnqueuePacketResult::SUCCESS,
EnqueuePacketToStore(store_, TestConnectionId(1),
- GOOGLE_QUIC_PACKET, INVALID_PACKET_TYPE,
+ GOOGLE_QUIC_Q043_PACKET, INVALID_PACKET_TYPE,
packet_, self_address_, peer_address_,
valid_version_, kNoParsedChlo, generator2));
QuicConnectionId delivered_conn_id;
@@ -440,10 +440,10 @@
EXPECT_EQ(EnqueuePacketResult::SUCCESS,
// connection_id_generator_ will be ignored because the chlo has
// not been parsed.
- EnqueuePacketToStore(store_, connection_id, GOOGLE_QUIC_PACKET,
- INVALID_PACKET_TYPE, packet_, self_address_,
- peer_address_, invalid_version_,
- kNoParsedChlo, connection_id_generator_));
+ EnqueuePacketToStore(
+ store_, connection_id, GOOGLE_QUIC_Q043_PACKET,
+ INVALID_PACKET_TYPE, packet_, self_address_, peer_address_,
+ invalid_version_, kNoParsedChlo, connection_id_generator_));
}
// Buffer CHLOs on other connections till store is full.
@@ -451,9 +451,9 @@
i <= kDefaultMaxConnectionsInStore + 1; ++i) {
QuicConnectionId connection_id = TestConnectionId(i);
EnqueuePacketResult rs = EnqueuePacketToStore(
- store_, connection_id, GOOGLE_QUIC_PACKET, INVALID_PACKET_TYPE, packet_,
- self_address_, peer_address_, valid_version_, kDefaultParsedChlo,
- connection_id_generator_);
+ store_, connection_id, GOOGLE_QUIC_Q043_PACKET, INVALID_PACKET_TYPE,
+ packet_, self_address_, peer_address_, valid_version_,
+ kDefaultParsedChlo, connection_id_generator_);
if (i <= kDefaultMaxConnectionsInStore) {
EXPECT_EQ(EnqueuePacketResult::SUCCESS, rs);
EXPECT_TRUE(store_.HasChloForConnection(connection_id));
@@ -469,7 +469,7 @@
// delivered at last.
EXPECT_EQ(EnqueuePacketResult::SUCCESS,
EnqueuePacketToStore(
- store_, TestConnectionId(1), GOOGLE_QUIC_PACKET,
+ store_, TestConnectionId(1), GOOGLE_QUIC_Q043_PACKET,
INVALID_PACKET_TYPE, packet_, self_address_, peer_address_,
valid_version_, kDefaultParsedChlo, connection_id_generator_));
EXPECT_TRUE(store_.HasChloForConnection(TestConnectionId(1)));
@@ -498,21 +498,21 @@
// connections both with and without CHLOs.
TEST_F(QuicBufferedPacketStoreTest, PacketQueueExpiredBeforeDelivery) {
QuicConnectionId connection_id = TestConnectionId(1);
- EnqueuePacketToStore(store_, connection_id, GOOGLE_QUIC_PACKET,
+ EnqueuePacketToStore(store_, connection_id, GOOGLE_QUIC_Q043_PACKET,
INVALID_PACKET_TYPE, packet_, self_address_,
peer_address_, invalid_version_, kNoParsedChlo,
connection_id_generator_);
EXPECT_EQ(EnqueuePacketResult::SUCCESS,
- EnqueuePacketToStore(store_, connection_id, GOOGLE_QUIC_PACKET,
+ EnqueuePacketToStore(store_, connection_id, GOOGLE_QUIC_Q043_PACKET,
INVALID_PACKET_TYPE, packet_, self_address_,
peer_address_, valid_version_,
kDefaultParsedChlo, connection_id_generator_));
QuicConnectionId connection_id2 = TestConnectionId(2);
EXPECT_EQ(EnqueuePacketResult::SUCCESS,
- EnqueuePacketToStore(store_, connection_id2, GOOGLE_QUIC_PACKET,
- INVALID_PACKET_TYPE, packet_, self_address_,
- peer_address_, invalid_version_, kNoParsedChlo,
- connection_id_generator_));
+ EnqueuePacketToStore(
+ store_, connection_id2, GOOGLE_QUIC_Q043_PACKET,
+ INVALID_PACKET_TYPE, packet_, self_address_, peer_address_,
+ invalid_version_, kNoParsedChlo, connection_id_generator_));
// CHLO on connection 3 arrives 1ms later.
clock_.AdvanceTime(QuicTime::Delta::FromMilliseconds(1));
@@ -520,7 +520,7 @@
// Use different client address to differentiate packets from different
// connections.
QuicSocketAddress another_client_address(QuicIpAddress::Any4(), 255);
- EnqueuePacketToStore(store_, connection_id3, GOOGLE_QUIC_PACKET,
+ EnqueuePacketToStore(store_, connection_id3, GOOGLE_QUIC_Q043_PACKET,
INVALID_PACKET_TYPE, packet_, self_address_,
another_client_address, valid_version_,
kDefaultParsedChlo, connection_id_generator_);
@@ -557,11 +557,11 @@
// Test the alarm is reset by enqueueing 2 packets for 4th connection and wait
// for them to expire.
QuicConnectionId connection_id4 = TestConnectionId(4);
- EnqueuePacketToStore(store_, connection_id4, GOOGLE_QUIC_PACKET,
+ EnqueuePacketToStore(store_, connection_id4, GOOGLE_QUIC_Q043_PACKET,
INVALID_PACKET_TYPE, packet_, self_address_,
peer_address_, invalid_version_, kNoParsedChlo,
connection_id_generator_);
- EnqueuePacketToStore(store_, connection_id4, GOOGLE_QUIC_PACKET,
+ EnqueuePacketToStore(store_, connection_id4, GOOGLE_QUIC_Q043_PACKET,
INVALID_PACKET_TYPE, packet_, self_address_,
peer_address_, invalid_version_, kNoParsedChlo,
connection_id_generator_);
@@ -578,11 +578,11 @@
QuicConnectionId connection_id = TestConnectionId(1);
// Enqueue some packets
- EnqueuePacketToStore(store_, connection_id, GOOGLE_QUIC_PACKET,
+ EnqueuePacketToStore(store_, connection_id, GOOGLE_QUIC_Q043_PACKET,
INVALID_PACKET_TYPE, packet_, self_address_,
peer_address_, invalid_version_, kNoParsedChlo,
connection_id_generator_);
- EnqueuePacketToStore(store_, connection_id, GOOGLE_QUIC_PACKET,
+ EnqueuePacketToStore(store_, connection_id, GOOGLE_QUIC_Q043_PACKET,
INVALID_PACKET_TYPE, packet_, self_address_,
peer_address_, invalid_version_, kNoParsedChlo,
connection_id_generator_);
@@ -608,15 +608,15 @@
QuicConnectionId connection_id = TestConnectionId(1);
// Enqueue some packets, which include a CHLO
- EnqueuePacketToStore(store_, connection_id, GOOGLE_QUIC_PACKET,
+ EnqueuePacketToStore(store_, connection_id, GOOGLE_QUIC_Q043_PACKET,
INVALID_PACKET_TYPE, packet_, self_address_,
peer_address_, invalid_version_, kNoParsedChlo,
connection_id_generator_);
- EnqueuePacketToStore(store_, connection_id, GOOGLE_QUIC_PACKET,
+ EnqueuePacketToStore(store_, connection_id, GOOGLE_QUIC_Q043_PACKET,
INVALID_PACKET_TYPE, packet_, self_address_,
peer_address_, valid_version_, kDefaultParsedChlo,
connection_id_generator_);
- EnqueuePacketToStore(store_, connection_id, GOOGLE_QUIC_PACKET,
+ EnqueuePacketToStore(store_, connection_id, GOOGLE_QUIC_Q043_PACKET,
INVALID_PACKET_TYPE, packet_, self_address_,
peer_address_, invalid_version_, kNoParsedChlo,
connection_id_generator_);
@@ -643,11 +643,11 @@
QuicConnectionId connection_id_2 = TestConnectionId(2);
// Enqueue some packets for two connection IDs
- EnqueuePacketToStore(store_, connection_id_1, GOOGLE_QUIC_PACKET,
+ EnqueuePacketToStore(store_, connection_id_1, GOOGLE_QUIC_Q043_PACKET,
INVALID_PACKET_TYPE, packet_, self_address_,
peer_address_, invalid_version_, kNoParsedChlo,
connection_id_generator_);
- EnqueuePacketToStore(store_, connection_id_1, GOOGLE_QUIC_PACKET,
+ EnqueuePacketToStore(store_, connection_id_1, GOOGLE_QUIC_Q043_PACKET,
INVALID_PACKET_TYPE, packet_, self_address_,
peer_address_, invalid_version_, kNoParsedChlo,
connection_id_generator_);
@@ -709,7 +709,7 @@
std::optional<uint8_t> tls_alert;
EXPECT_FALSE(store_.HasBufferedPackets(connection_id));
- EnqueuePacketToStore(store_, connection_id, GOOGLE_QUIC_PACKET,
+ EnqueuePacketToStore(store_, connection_id, GOOGLE_QUIC_Q043_PACKET,
INVALID_PACKET_TYPE, packet_, self_address_,
peer_address_, valid_version_, kNoParsedChlo,
connection_id_generator_);
@@ -732,11 +732,11 @@
auto packets = GetFirstFlightOfPackets(valid_version_, config);
ASSERT_EQ(packets.size(), 2u);
- EnqueuePacketToStore(store_, connection_id, GOOGLE_QUIC_PACKET,
+ EnqueuePacketToStore(store_, connection_id, GOOGLE_QUIC_Q043_PACKET,
INVALID_PACKET_TYPE, *packets[0], self_address_,
peer_address_, valid_version_, kNoParsedChlo,
connection_id_generator_);
- EnqueuePacketToStore(store_, connection_id, GOOGLE_QUIC_PACKET,
+ EnqueuePacketToStore(store_, connection_id, GOOGLE_QUIC_Q043_PACKET,
INVALID_PACKET_TYPE, *packets[1], self_address_,
peer_address_, valid_version_, kNoParsedChlo,
connection_id_generator_);
@@ -856,7 +856,7 @@
QuicReceivedPacket ect1_packet(packet_content_.data(), packet_content_.size(),
packet_time_, false, 0, true, nullptr, 0,
false, ECN_ECT1);
- EnqueuePacketToStore(store_, connection_id, GOOGLE_QUIC_PACKET,
+ EnqueuePacketToStore(store_, connection_id, GOOGLE_QUIC_Q043_PACKET,
INVALID_PACKET_TYPE, ect1_packet, self_address_,
peer_address_, valid_version_, kNoParsedChlo,
connection_id_generator_);
diff --git a/quiche/quic/core/quic_connection.cc b/quiche/quic/core/quic_connection.cc
index fa8330a..1e6279e 100644
--- a/quiche/quic/core/quic_connection.cc
+++ b/quiche/quic/core/quic_connection.cc
@@ -3134,7 +3134,8 @@
if (!version_negotiated_) {
if (perspective_ == Perspective::IS_CLIENT) {
- QUICHE_DCHECK(!header.version_flag || header.form != GOOGLE_QUIC_PACKET);
+ QUICHE_DCHECK(!header.version_flag ||
+ header.form != GOOGLE_QUIC_Q043_PACKET);
version_negotiated_ = true;
OnSuccessfulVersionNegotiation();
}
diff --git a/quiche/quic/core/quic_dispatcher.cc b/quiche/quic/core/quic_dispatcher.cc
index e27a522..2de8701 100644
--- a/quiche/quic/core/quic_dispatcher.cc
+++ b/quiche/quic/core/quic_dispatcher.cc
@@ -1081,8 +1081,8 @@
<< ", error_code:" << error_code
<< ", error_details:" << error_details;
time_wait_list_manager_->AddConnectionIdToTimeWait(
- action, TimeWaitConnectionInfo(format != GOOGLE_QUIC_PACKET, nullptr,
- {server_connection_id}));
+ action, TimeWaitConnectionInfo(format != GOOGLE_QUIC_Q043_PACKET,
+ nullptr, {server_connection_id}));
return;
}
@@ -1112,7 +1112,7 @@
}
// This also adds the connection to time wait list.
terminator.CloseConnection(error_code, error_details,
- format != GOOGLE_QUIC_PACKET,
+ format != GOOGLE_QUIC_Q043_PACKET,
/*active_connection_ids=*/
std::move(active_connection_ids));
@@ -1137,11 +1137,11 @@
std::vector<std::unique_ptr<QuicEncryptedPacket>> termination_packets;
termination_packets.push_back(QuicFramer::BuildVersionNegotiationPacket(
server_connection_id, EmptyQuicConnectionId(),
- /*ietf_quic=*/format != GOOGLE_QUIC_PACKET, use_length_prefix,
+ /*ietf_quic=*/format != GOOGLE_QUIC_Q043_PACKET, use_length_prefix,
/*versions=*/{}));
time_wait_list_manager()->AddConnectionIdToTimeWait(
QuicTimeWaitListManager::SEND_TERMINATION_PACKETS,
- TimeWaitConnectionInfo(/*ietf_quic=*/format != GOOGLE_QUIC_PACKET,
+ TimeWaitConnectionInfo(/*ietf_quic=*/format != GOOGLE_QUIC_Q043_PACKET,
&termination_packets, {server_connection_id}));
}
@@ -1163,7 +1163,7 @@
StatelesslyTerminateConnection(
self_address, peer_address, early_arrived_packets.original_connection_id,
early_arrived_packets.ietf_quic ? IETF_QUIC_LONG_HEADER_PACKET
- : GOOGLE_QUIC_PACKET,
+ : GOOGLE_QUIC_Q043_PACKET,
/*version_flag=*/true,
early_arrived_packets.version.HasLengthPrefixedConnectionIds(),
early_arrived_packets.version, error_code,
@@ -1509,7 +1509,7 @@
QUIC_CODE_COUNT(quic_donot_send_reset_repeatedly);
return;
}
- if (packet_info.form != GOOGLE_QUIC_PACKET) {
+ if (packet_info.form != GOOGLE_QUIC_Q043_PACKET) {
// Drop IETF packets smaller than the minimal stateless reset length.
if (packet_info.packet.length() <=
QuicFramer::GetMinStatelessResetPacketLength()) {
@@ -1545,7 +1545,7 @@
time_wait_list_manager()->SendPublicReset(
packet_info.self_address, packet_info.peer_address,
packet_info.destination_connection_id,
- packet_info.form != GOOGLE_QUIC_PACKET, packet_info.packet.length(),
+ packet_info.form != GOOGLE_QUIC_Q043_PACKET, packet_info.packet.length(),
GetPerPacketContext());
}
@@ -1561,9 +1561,10 @@
}
time_wait_list_manager()->SendVersionNegotiationPacket(
packet_info.destination_connection_id, packet_info.source_connection_id,
- packet_info.form != GOOGLE_QUIC_PACKET, packet_info.use_length_prefix,
- GetSupportedVersions(), packet_info.self_address,
- packet_info.peer_address, GetPerPacketContext());
+ packet_info.form != GOOGLE_QUIC_Q043_PACKET,
+ packet_info.use_length_prefix, GetSupportedVersions(),
+ packet_info.self_address, packet_info.peer_address,
+ GetPerPacketContext());
return true;
}
diff --git a/quiche/quic/core/quic_framer.cc b/quiche/quic/core/quic_framer.cc
index e99d996..8e8dca9 100644
--- a/quiche/quic/core/quic_framer.cc
+++ b/quiche/quic/core/quic_framer.cc
@@ -228,7 +228,7 @@
// Used to get packet number space before packet gets decrypted.
PacketNumberSpace GetPacketNumberSpace(const QuicPacketHeader& header) {
switch (header.form) {
- case GOOGLE_QUIC_PACKET:
+ case GOOGLE_QUIC_Q043_PACKET:
QUIC_BUG(quic_bug_10850_5)
<< "Try to get packet number space of Google QUIC packet";
break;
@@ -257,7 +257,7 @@
EncryptionLevel GetEncryptionLevel(const QuicPacketHeader& header) {
switch (header.form) {
- case GOOGLE_QUIC_PACKET:
+ case GOOGLE_QUIC_Q043_PACKET:
QUIC_BUG(quic_bug_10850_7)
<< "Cannot determine EncryptionLevel from Google QUIC header";
break;
@@ -1728,7 +1728,7 @@
const QuicEncryptedPacket& packet,
char* decrypted_buffer,
size_t buffer_length) {
- QUICHE_DCHECK_NE(GOOGLE_QUIC_PACKET, header->form);
+ QUICHE_DCHECK_NE(GOOGLE_QUIC_Q043_PACKET, header->form);
QUICHE_DCHECK(!header->has_possible_stateless_reset_token);
header->length_length = quiche::VARIABLE_LENGTH_INTEGER_LENGTH_0;
header->remaining_packet_length = 0;
@@ -4551,9 +4551,9 @@
bool key_phase;
bool attempt_key_update = false;
if (version().KnowsWhichDecrypterToUse()) {
- if (header.form == GOOGLE_QUIC_PACKET) {
+ if (header.form == GOOGLE_QUIC_Q043_PACKET) {
QUIC_BUG(quic_bug_10850_68)
- << "Attempted to decrypt GOOGLE_QUIC_PACKET with a version that "
+ << "Attempted to decrypt GOOGLE_QUIC_Q043_PACKET with a version that "
"knows which decrypter to use";
return false;
}
@@ -6710,7 +6710,7 @@
bool* version_present, QuicVersionLabel* version_label,
ParsedQuicVersion* parsed_version,
absl::string_view* destination_connection_id, std::string* detailed_error) {
- *format = GOOGLE_QUIC_PACKET;
+ *format = GOOGLE_QUIC_Q043_PACKET;
*version_present = (*first_byte & PACKET_PUBLIC_FLAGS_VERSION) != 0;
uint8_t destination_connection_id_length = 0;
if ((*first_byte & PACKET_PUBLIC_FLAGS_8BYTE_CONNECTION_ID) != 0) {
@@ -6736,7 +6736,7 @@
bool* version_present, QuicVersionLabel* version_label,
ParsedQuicVersion* parsed_version,
QuicConnectionId* destination_connection_id, std::string* detailed_error) {
- *format = GOOGLE_QUIC_PACKET;
+ *format = GOOGLE_QUIC_Q043_PACKET;
*version_present = (*first_byte & PACKET_PUBLIC_FLAGS_VERSION) != 0;
uint8_t destination_connection_id_length = 0;
if ((*first_byte & PACKET_PUBLIC_FLAGS_8BYTE_CONNECTION_ID) != 0) {
diff --git a/quiche/quic/core/quic_framer_test.cc b/quiche/quic/core/quic_framer_test.cc
index 337b6b8..ecefa2a 100644
--- a/quiche/quic/core/quic_framer_test.cc
+++ b/quiche/quic/core/quic_framer_test.cc
@@ -1228,7 +1228,7 @@
}
QuicEncryptedPacket encrypted(AsChars(p), p_length, false);
- PacketHeaderFormat format = GOOGLE_QUIC_PACKET;
+ PacketHeaderFormat format = GOOGLE_QUIC_Q043_PACKET;
QuicLongHeaderType long_packet_type = INVALID_PACKET_TYPE;
bool version_flag = false;
absl::string_view destination_connection_id, source_connection_id;
@@ -1257,7 +1257,7 @@
TEST_P(QuicFramerTest, AllZeroPacketParsingFails) {
unsigned char packet[1200] = {};
QuicEncryptedPacket encrypted(AsChars(packet), ABSL_ARRAYSIZE(packet), false);
- PacketHeaderFormat format = GOOGLE_QUIC_PACKET;
+ PacketHeaderFormat format = GOOGLE_QUIC_Q043_PACKET;
QuicLongHeaderType long_packet_type = INVALID_PACKET_TYPE;
bool version_flag = false;
absl::string_view destination_connection_id, source_connection_id;
@@ -1323,7 +1323,7 @@
}
uint8_t first_byte = 0x33;
- PacketHeaderFormat format = GOOGLE_QUIC_PACKET;
+ PacketHeaderFormat format = GOOGLE_QUIC_Q043_PACKET;
bool version_present = false, has_length_prefix = false;
QuicVersionLabel version_label = 0;
ParsedQuicVersion parsed_version = UnsupportedQuicVersion();
@@ -1387,7 +1387,7 @@
size_t p_length = ABSL_ARRAYSIZE(packet);
uint8_t first_byte = 0x33;
- PacketHeaderFormat format = GOOGLE_QUIC_PACKET;
+ PacketHeaderFormat format = GOOGLE_QUIC_Q043_PACKET;
bool version_present = false, has_length_prefix = false;
QuicVersionLabel version_label = 0;
ParsedQuicVersion parsed_version = UnsupportedQuicVersion();
@@ -13619,7 +13619,7 @@
QuicEncryptedPacket encrypted(reinterpret_cast<const char*>(packet),
sizeof(packet));
- PacketHeaderFormat format = GOOGLE_QUIC_PACKET;
+ PacketHeaderFormat format = GOOGLE_QUIC_Q043_PACKET;
QuicLongHeaderType long_packet_type = INVALID_PACKET_TYPE;
bool version_present = false, has_length_prefix = true;
QuicVersionLabel version_label = 33;
@@ -13698,7 +13698,7 @@
QuicEncryptedPacket encrypted(reinterpret_cast<const char*>(packet),
sizeof(packet));
- PacketHeaderFormat format = GOOGLE_QUIC_PACKET;
+ PacketHeaderFormat format = GOOGLE_QUIC_Q043_PACKET;
QuicLongHeaderType long_packet_type = INVALID_PACKET_TYPE;
bool version_present = false, has_length_prefix = false;
QuicVersionLabel version_label = 33;
diff --git a/quiche/quic/core/quic_packets.cc b/quiche/quic/core/quic_packets.cc
index d127cea..0346ae1 100644
--- a/quiche/quic/core/quic_packets.cc
+++ b/quiche/quic/core/quic_packets.cc
@@ -162,7 +162,7 @@
: destination_connection_id(EmptyQuicConnectionId()),
possible_stateless_reset_token({}),
packet_number_length(PACKET_4BYTE_PACKET_NUMBER),
- form(GOOGLE_QUIC_PACKET),
+ form(GOOGLE_QUIC_Q043_PACKET),
type_byte(0),
destination_connection_id_included(CONNECTION_ID_PRESENT),
source_connection_id_included(CONNECTION_ID_ABSENT),
@@ -551,7 +551,7 @@
: self_address(self_address),
peer_address(peer_address),
packet(packet),
- form(GOOGLE_QUIC_PACKET),
+ form(GOOGLE_QUIC_Q043_PACKET),
long_packet_type(INVALID_PACKET_TYPE),
version_flag(false),
use_length_prefix(false),
diff --git a/quiche/quic/core/quic_time_wait_list_manager.cc b/quiche/quic/core/quic_time_wait_list_manager.cc
index 5727be4..45be2df 100644
--- a/quiche/quic/core/quic_time_wait_list_manager.cc
+++ b/quiche/quic/core/quic_time_wait_list_manager.cc
@@ -205,7 +205,7 @@
connection_data->info.ietf_quic,
received_packet_length, std::move(packet_context));
return;
- case GOOGLE_QUIC_PACKET:
+ case GOOGLE_QUIC_Q043_PACKET:
if (connection_data->info.ietf_quic) {
QUIC_CODE_COUNT(quic_received_gquic_packet_for_ietf_quic);
}
diff --git a/quiche/quic/core/quic_time_wait_list_manager_test.cc b/quiche/quic/core/quic_time_wait_list_manager_test.cc
index 883d348..069018e 100644
--- a/quiche/quic/core/quic_time_wait_list_manager_test.cc
+++ b/quiche/quic/core/quic_time_wait_list_manager_test.cc
@@ -157,7 +157,7 @@
void ProcessPacket(QuicConnectionId connection_id) {
time_wait_list_manager_.ProcessPacket(
- self_address_, peer_address_, connection_id, GOOGLE_QUIC_PACKET,
+ self_address_, peer_address_, connection_id, GOOGLE_QUIC_Q043_PACKET,
kTestPacketSize, std::make_unique<QuicPerPacketContext>());
}
diff --git a/quiche/quic/core/quic_types.cc b/quiche/quic/core/quic_types.cc
index aa69d02..a974c40 100644
--- a/quiche/quic/core/quic_types.cc
+++ b/quiche/quic/core/quic_types.cc
@@ -240,7 +240,7 @@
switch (format) {
RETURN_STRING_LITERAL(IETF_QUIC_LONG_HEADER_PACKET);
RETURN_STRING_LITERAL(IETF_QUIC_SHORT_HEADER_PACKET);
- RETURN_STRING_LITERAL(GOOGLE_QUIC_PACKET);
+ RETURN_STRING_LITERAL(GOOGLE_QUIC_Q043_PACKET);
default:
return absl::StrCat("Unknown (", static_cast<int>(format), ")");
}
diff --git a/quiche/quic/core/quic_types.h b/quiche/quic/core/quic_types.h
index 836ee4f..fc42d29 100644
--- a/quiche/quic/core/quic_types.h
+++ b/quiche/quic/core/quic_types.h
@@ -558,9 +558,24 @@
};
enum PacketHeaderFormat : uint8_t {
+ // Indicates that the packet is either an IETF QUIC long header packet or a
+ // Google-QUIC Q046 long header packet. The Q046 long header format differs
+ // from true IETF-QUIC in that each connection ID length is encoded in 4 bits
+ // instead of 8.
IETF_QUIC_LONG_HEADER_PACKET,
+ // Indicates that the packet is either an IETF QUIC short header packet or a
+ // Google-QUIC Q046 short header packet. The formats are identical.
IETF_QUIC_SHORT_HEADER_PACKET,
- GOOGLE_QUIC_PACKET,
+ // Indicates that the packet is an obsolete Google-QUIC Q043 packet. While
+ // QUICHE no longer supports Q043 (which had a very different packet header
+ // format) GOOGLE_QUIC_Q043_PACKET is only used to detect these packets in
+ // order to send an appropriately formatted Q043 version negotiation packet.
+ // There are bits in the first byte to indicate if there is a connection ID
+ // present (which must be 8 bytes long) and if there is a version present.
+ // Connection ID (with no length prefix) and version follow, in that order.
+ // The first byte bit-pattern that indicates Q043 (or earlier) is
+ // 0b00xx1xxx, where 'x' is any value.
+ GOOGLE_QUIC_Q043_PACKET,
};
QUICHE_EXPORT std::string PacketHeaderFormatToString(PacketHeaderFormat format);
diff --git a/quiche/quic/test_tools/fuzzing/quic_framer_process_data_packet_fuzzer.cc b/quiche/quic/test_tools/fuzzing/quic_framer_process_data_packet_fuzzer.cc
index 8caff25..10afa3a 100644
--- a/quiche/quic/test_tools/fuzzing/quic_framer_process_data_packet_fuzzer.cc
+++ b/quiche/quic/test_tools/fuzzing/quic_framer_process_data_packet_fuzzer.cc
@@ -110,7 +110,7 @@
header.remaining_packet_length = 0;
- if (header.form != quic::GOOGLE_QUIC_PACKET && header.version_flag) {
+ if (header.form != quic::GOOGLE_QUIC_Q043_PACKET && header.version_flag) {
header.long_packet_type = static_cast<QuicLongHeaderType>(
provider->ConsumeIntegralInRange<uint8_t>(
// INITIAL, ZERO_RTT_PROTECTED, or HANDSHAKE.
diff --git a/quiche/quic/test_tools/quic_test_utils.h b/quiche/quic/test_tools/quic_test_utils.h
index b3e8790..e1bf985 100644
--- a/quiche/quic/test_tools/quic_test_utils.h
+++ b/quiche/quic/test_tools/quic_test_utils.h
@@ -223,7 +223,7 @@
uint64_t largest_acked);
// Returns the encryption level that corresponds to the header type in
-// |header|. If the header is for GOOGLE_QUIC_PACKET instead of an
+// |header|. If the header is for GOOGLE_QUIC_Q043_PACKET instead of an
// IETF-invariants packet, this function returns ENCRYPTION_INITIAL.
EncryptionLevel HeaderToEncryptionLevel(const QuicPacketHeader& header);