1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
|
From 9424add9d73432a794b7944790253213cce6dcb8 Mon Sep 17 00:00:00 2001
From: danzh <danzh@google.com>
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<const uint8_t*>(
@@ -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<TransportParameters::PreferredAddress>(
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<const char*>(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 <string>
-
#include "net/third_party/quiche/src/quic/core/quic_socket_address_coder.h"
+#include <cstring>
+#include <string>
+#include <vector>
+
namespace quic {
namespace {
|