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

Side by Side Diff: net/quic/core/quic_protocol.h

Issue 2514493002: Move QUIC error codes to quic_error_codes.h. No behavior change. (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 | « net/quic/core/quic_error_codes.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 #ifndef NET_QUIC_QUIC_PROTOCOL_H_ 5 #ifndef NET_QUIC_QUIC_PROTOCOL_H_
6 #define NET_QUIC_QUIC_PROTOCOL_H_ 6 #define NET_QUIC_QUIC_PROTOCOL_H_
7 7
8 #include <stddef.h> 8 #include <stddef.h>
9 #include <stdint.h> 9 #include <stdint.h>
10 10
(...skipping 13 matching lines...) Expand all
24 #include "base/memory/ref_counted.h" 24 #include "base/memory/ref_counted.h"
25 #include "base/strings/string_piece.h" 25 #include "base/strings/string_piece.h"
26 #include "net/base/int128.h" 26 #include "net/base/int128.h"
27 #include "net/base/iovec.h" 27 #include "net/base/iovec.h"
28 #include "net/base/ip_endpoint.h" 28 #include "net/base/ip_endpoint.h"
29 #include "net/base/net_export.h" 29 #include "net/base/net_export.h"
30 #include "net/quic/core/interval_set.h" 30 #include "net/quic/core/interval_set.h"
31 #include "net/quic/core/quic_bandwidth.h" 31 #include "net/quic/core/quic_bandwidth.h"
32 #include "net/quic/core/quic_buffer_allocator.h" 32 #include "net/quic/core/quic_buffer_allocator.h"
33 #include "net/quic/core/quic_constants.h" 33 #include "net/quic/core/quic_constants.h"
34 #include "net/quic/core/quic_error_codes.h"
34 #include "net/quic/core/quic_time.h" 35 #include "net/quic/core/quic_time.h"
35 #include "net/quic/core/quic_types.h" 36 #include "net/quic/core/quic_types.h"
36 #include "net/quic/core/quic_versions.h" 37 #include "net/quic/core/quic_versions.h"
37 38
38 namespace net { 39 namespace net {
39 40
40 class QuicPacket; 41 class QuicPacket;
41 struct QuicPacketHeader; 42 struct QuicPacketHeader;
42 class QuicAckListenerInterface; 43 class QuicAckListenerInterface;
43 44
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after
202 GetStartOfEncryptedData(QuicVersion version, const QuicPacketHeader& header); 203 GetStartOfEncryptedData(QuicVersion version, const QuicPacketHeader& header);
203 204
204 NET_EXPORT_PRIVATE size_t 205 NET_EXPORT_PRIVATE size_t
205 GetStartOfEncryptedData(QuicVersion version, 206 GetStartOfEncryptedData(QuicVersion version,
206 QuicConnectionIdLength connection_id_length, 207 QuicConnectionIdLength connection_id_length,
207 bool include_version, 208 bool include_version,
208 bool include_path_id, 209 bool include_path_id,
209 bool include_diversification_nonce, 210 bool include_diversification_nonce,
210 QuicPacketNumberLength packet_number_length); 211 QuicPacketNumberLength packet_number_length);
211 212
212 enum QuicRstStreamErrorCode {
213 // Complete response has been sent, sending a RST to ask the other endpoint
214 // to stop sending request data without discarding the response.
215 QUIC_STREAM_NO_ERROR = 0,
216
217 // There was some error which halted stream processing.
218 QUIC_ERROR_PROCESSING_STREAM,
219 // We got two fin or reset offsets which did not match.
220 QUIC_MULTIPLE_TERMINATION_OFFSETS,
221 // We got bad payload and can not respond to it at the protocol level.
222 QUIC_BAD_APPLICATION_PAYLOAD,
223 // Stream closed due to connection error. No reset frame is sent when this
224 // happens.
225 QUIC_STREAM_CONNECTION_ERROR,
226 // GoAway frame sent. No more stream can be created.
227 QUIC_STREAM_PEER_GOING_AWAY,
228 // The stream has been cancelled.
229 QUIC_STREAM_CANCELLED,
230 // Closing stream locally, sending a RST to allow for proper flow control
231 // accounting. Sent in response to a RST from the peer.
232 QUIC_RST_ACKNOWLEDGEMENT,
233 // Receiver refused to create the stream (because its limit on open streams
234 // has been reached). The sender should retry the request later (using
235 // another stream).
236 QUIC_REFUSED_STREAM,
237 // Invalid URL in PUSH_PROMISE request header.
238 QUIC_INVALID_PROMISE_URL,
239 // Server is not authoritative for this URL.
240 QUIC_UNAUTHORIZED_PROMISE_URL,
241 // Can't have more than one active PUSH_PROMISE per URL.
242 QUIC_DUPLICATE_PROMISE_URL,
243 // Vary check failed.
244 QUIC_PROMISE_VARY_MISMATCH,
245 // Only GET and HEAD methods allowed.
246 QUIC_INVALID_PROMISE_METHOD,
247 // The push stream is unclaimed and timed out.
248 QUIC_PUSH_STREAM_TIMED_OUT,
249 // Received headers were too large.
250 QUIC_HEADERS_TOO_LARGE,
251 // No error. Used as bound while iterating.
252 QUIC_STREAM_LAST_ERROR,
253 };
254 // QUIC error codes are encoded to a single octet on-the-wire.
255 static_assert(static_cast<int>(QUIC_STREAM_LAST_ERROR) <=
256 std::numeric_limits<uint8_t>::max(),
257 "QuicErrorCode exceeds single octet");
258
259 // These values must remain stable as they are uploaded to UMA histograms.
260 // To add a new error code, use the current value of QUIC_LAST_ERROR and
261 // increment QUIC_LAST_ERROR.
262 enum QuicErrorCode {
263 QUIC_NO_ERROR = 0,
264
265 // Connection has reached an invalid state.
266 QUIC_INTERNAL_ERROR = 1,
267 // There were data frames after the a fin or reset.
268 QUIC_STREAM_DATA_AFTER_TERMINATION = 2,
269 // Control frame is malformed.
270 QUIC_INVALID_PACKET_HEADER = 3,
271 // Frame data is malformed.
272 QUIC_INVALID_FRAME_DATA = 4,
273 // The packet contained no payload.
274 QUIC_MISSING_PAYLOAD = 48,
275 // FEC data is malformed.
276 QUIC_INVALID_FEC_DATA = 5,
277 // STREAM frame data is malformed.
278 QUIC_INVALID_STREAM_DATA = 46,
279 // STREAM frame data overlaps with buffered data.
280 QUIC_OVERLAPPING_STREAM_DATA = 87,
281 // Received STREAM frame data is not encrypted.
282 QUIC_UNENCRYPTED_STREAM_DATA = 61,
283 // Attempt to send unencrypted STREAM frame.
284 QUIC_ATTEMPT_TO_SEND_UNENCRYPTED_STREAM_DATA = 88,
285 // Received a frame which is likely the result of memory corruption.
286 QUIC_MAYBE_CORRUPTED_MEMORY = 89,
287 // FEC frame data is not encrypted.
288 QUIC_UNENCRYPTED_FEC_DATA = 77,
289 // RST_STREAM frame data is malformed.
290 QUIC_INVALID_RST_STREAM_DATA = 6,
291 // CONNECTION_CLOSE frame data is malformed.
292 QUIC_INVALID_CONNECTION_CLOSE_DATA = 7,
293 // GOAWAY frame data is malformed.
294 QUIC_INVALID_GOAWAY_DATA = 8,
295 // WINDOW_UPDATE frame data is malformed.
296 QUIC_INVALID_WINDOW_UPDATE_DATA = 57,
297 // BLOCKED frame data is malformed.
298 QUIC_INVALID_BLOCKED_DATA = 58,
299 // STOP_WAITING frame data is malformed.
300 QUIC_INVALID_STOP_WAITING_DATA = 60,
301 // PATH_CLOSE frame data is malformed.
302 QUIC_INVALID_PATH_CLOSE_DATA = 78,
303 // ACK frame data is malformed.
304 QUIC_INVALID_ACK_DATA = 9,
305
306 // Version negotiation packet is malformed.
307 QUIC_INVALID_VERSION_NEGOTIATION_PACKET = 10,
308 // Public RST packet is malformed.
309 QUIC_INVALID_PUBLIC_RST_PACKET = 11,
310 // There was an error decrypting.
311 QUIC_DECRYPTION_FAILURE = 12,
312 // There was an error encrypting.
313 QUIC_ENCRYPTION_FAILURE = 13,
314 // The packet exceeded kMaxPacketSize.
315 QUIC_PACKET_TOO_LARGE = 14,
316 // The peer is going away. May be a client or server.
317 QUIC_PEER_GOING_AWAY = 16,
318 // A stream ID was invalid.
319 QUIC_INVALID_STREAM_ID = 17,
320 // A priority was invalid.
321 QUIC_INVALID_PRIORITY = 49,
322 // Too many streams already open.
323 QUIC_TOO_MANY_OPEN_STREAMS = 18,
324 // The peer created too many available streams.
325 QUIC_TOO_MANY_AVAILABLE_STREAMS = 76,
326 // Received public reset for this connection.
327 QUIC_PUBLIC_RESET = 19,
328 // Invalid protocol version.
329 QUIC_INVALID_VERSION = 20,
330
331 // The Header ID for a stream was too far from the previous.
332 QUIC_INVALID_HEADER_ID = 22,
333 // Negotiable parameter received during handshake had invalid value.
334 QUIC_INVALID_NEGOTIATED_VALUE = 23,
335 // There was an error decompressing data.
336 QUIC_DECOMPRESSION_FAILURE = 24,
337 // The connection timed out due to no network activity.
338 QUIC_NETWORK_IDLE_TIMEOUT = 25,
339 // The connection timed out waiting for the handshake to complete.
340 QUIC_HANDSHAKE_TIMEOUT = 67,
341 // There was an error encountered migrating addresses.
342 QUIC_ERROR_MIGRATING_ADDRESS = 26,
343 // There was an error encountered migrating port only.
344 QUIC_ERROR_MIGRATING_PORT = 86,
345 // There was an error while writing to the socket.
346 QUIC_PACKET_WRITE_ERROR = 27,
347 // There was an error while reading from the socket.
348 QUIC_PACKET_READ_ERROR = 51,
349 // We received a STREAM_FRAME with no data and no fin flag set.
350 QUIC_EMPTY_STREAM_FRAME_NO_FIN = 50,
351 // We received invalid data on the headers stream.
352 QUIC_INVALID_HEADERS_STREAM_DATA = 56,
353 // The peer received too much data, violating flow control.
354 QUIC_FLOW_CONTROL_RECEIVED_TOO_MUCH_DATA = 59,
355 // The peer sent too much data, violating flow control.
356 QUIC_FLOW_CONTROL_SENT_TOO_MUCH_DATA = 63,
357 // The peer received an invalid flow control window.
358 QUIC_FLOW_CONTROL_INVALID_WINDOW = 64,
359 // The connection has been IP pooled into an existing connection.
360 QUIC_CONNECTION_IP_POOLED = 62,
361 // The connection has too many outstanding sent packets.
362 QUIC_TOO_MANY_OUTSTANDING_SENT_PACKETS = 68,
363 // The connection has too many outstanding received packets.
364 QUIC_TOO_MANY_OUTSTANDING_RECEIVED_PACKETS = 69,
365 // The quic connection has been cancelled.
366 QUIC_CONNECTION_CANCELLED = 70,
367 // Disabled QUIC because of high packet loss rate.
368 QUIC_BAD_PACKET_LOSS_RATE = 71,
369 // Disabled QUIC because of too many PUBLIC_RESETs post handshake.
370 QUIC_PUBLIC_RESETS_POST_HANDSHAKE = 73,
371 // Disabled QUIC because of too many timeouts with streams open.
372 QUIC_TIMEOUTS_WITH_OPEN_STREAMS = 74,
373 // Closed because we failed to serialize a packet.
374 QUIC_FAILED_TO_SERIALIZE_PACKET = 75,
375 // QUIC timed out after too many RTOs.
376 QUIC_TOO_MANY_RTOS = 85,
377
378 // Crypto errors.
379
380 // Hanshake failed.
381 QUIC_HANDSHAKE_FAILED = 28,
382 // Handshake message contained out of order tags.
383 QUIC_CRYPTO_TAGS_OUT_OF_ORDER = 29,
384 // Handshake message contained too many entries.
385 QUIC_CRYPTO_TOO_MANY_ENTRIES = 30,
386 // Handshake message contained an invalid value length.
387 QUIC_CRYPTO_INVALID_VALUE_LENGTH = 31,
388 // A crypto message was received after the handshake was complete.
389 QUIC_CRYPTO_MESSAGE_AFTER_HANDSHAKE_COMPLETE = 32,
390 // A crypto message was received with an illegal message tag.
391 QUIC_INVALID_CRYPTO_MESSAGE_TYPE = 33,
392 // A crypto message was received with an illegal parameter.
393 QUIC_INVALID_CRYPTO_MESSAGE_PARAMETER = 34,
394 // An invalid channel id signature was supplied.
395 QUIC_INVALID_CHANNEL_ID_SIGNATURE = 52,
396 // A crypto message was received with a mandatory parameter missing.
397 QUIC_CRYPTO_MESSAGE_PARAMETER_NOT_FOUND = 35,
398 // A crypto message was received with a parameter that has no overlap
399 // with the local parameter.
400 QUIC_CRYPTO_MESSAGE_PARAMETER_NO_OVERLAP = 36,
401 // A crypto message was received that contained a parameter with too few
402 // values.
403 QUIC_CRYPTO_MESSAGE_INDEX_NOT_FOUND = 37,
404 // A demand for an unsupport proof type was received.
405 QUIC_UNSUPPORTED_PROOF_DEMAND = 94,
406 // An internal error occured in crypto processing.
407 QUIC_CRYPTO_INTERNAL_ERROR = 38,
408 // A crypto handshake message specified an unsupported version.
409 QUIC_CRYPTO_VERSION_NOT_SUPPORTED = 39,
410 // A crypto handshake message resulted in a stateless reject.
411 QUIC_CRYPTO_HANDSHAKE_STATELESS_REJECT = 72,
412 // There was no intersection between the crypto primitives supported by the
413 // peer and ourselves.
414 QUIC_CRYPTO_NO_SUPPORT = 40,
415 // The server rejected our client hello messages too many times.
416 QUIC_CRYPTO_TOO_MANY_REJECTS = 41,
417 // The client rejected the server's certificate chain or signature.
418 QUIC_PROOF_INVALID = 42,
419 // A crypto message was received with a duplicate tag.
420 QUIC_CRYPTO_DUPLICATE_TAG = 43,
421 // A crypto message was received with the wrong encryption level (i.e. it
422 // should have been encrypted but was not.)
423 QUIC_CRYPTO_ENCRYPTION_LEVEL_INCORRECT = 44,
424 // The server config for a server has expired.
425 QUIC_CRYPTO_SERVER_CONFIG_EXPIRED = 45,
426 // We failed to setup the symmetric keys for a connection.
427 QUIC_CRYPTO_SYMMETRIC_KEY_SETUP_FAILED = 53,
428 // A handshake message arrived, but we are still validating the
429 // previous handshake message.
430 QUIC_CRYPTO_MESSAGE_WHILE_VALIDATING_CLIENT_HELLO = 54,
431 // A server config update arrived before the handshake is complete.
432 QUIC_CRYPTO_UPDATE_BEFORE_HANDSHAKE_COMPLETE = 65,
433 // CHLO cannot fit in one packet.
434 QUIC_CRYPTO_CHLO_TOO_LARGE = 90,
435 // This connection involved a version negotiation which appears to have been
436 // tampered with.
437 QUIC_VERSION_NEGOTIATION_MISMATCH = 55,
438
439 // Multipath errors.
440 // Multipath is not enabled, but a packet with multipath flag on is received.
441 QUIC_BAD_MULTIPATH_FLAG = 79,
442 // A path is supposed to exist but does not.
443 QUIC_MULTIPATH_PATH_DOES_NOT_EXIST = 91,
444 // A path is supposed to be active but is not.
445 QUIC_MULTIPATH_PATH_NOT_ACTIVE = 92,
446
447 // IP address changed causing connection close.
448 QUIC_IP_ADDRESS_CHANGED = 80,
449
450 // Connection migration errors.
451 // Network changed, but connection had no migratable streams.
452 QUIC_CONNECTION_MIGRATION_NO_MIGRATABLE_STREAMS = 81,
453 // Connection changed networks too many times.
454 QUIC_CONNECTION_MIGRATION_TOO_MANY_CHANGES = 82,
455 // Connection migration was attempted, but there was no new network to
456 // migrate to.
457 QUIC_CONNECTION_MIGRATION_NO_NEW_NETWORK = 83,
458 // Network changed, but connection had one or more non-migratable streams.
459 QUIC_CONNECTION_MIGRATION_NON_MIGRATABLE_STREAM = 84,
460
461 // Stream frames arrived too discontiguously so that stream sequencer buffer
462 // maintains too many gaps.
463 QUIC_TOO_MANY_FRAME_GAPS = 93,
464
465 // Sequencer buffer get into weird state where continuing read/write will lead
466 // to crash.
467 QUIC_STREAM_SEQUENCER_INVALID_STATE = 95,
468
469 // Connection closed because of server hits max number of sessions allowed.
470 // TODO(fayang): Add monitoring for QUIC_TOO_MANY_SESSIONS_ON_SERVER.
471 QUIC_TOO_MANY_SESSIONS_ON_SERVER = 96,
472
473 // No error. Used as bound while iterating.
474 QUIC_LAST_ERROR = 97,
475 };
476
477 typedef std::array<char, 32> DiversificationNonce; 213 typedef std::array<char, 32> DiversificationNonce;
478 214
479 struct NET_EXPORT_PRIVATE QuicPacketPublicHeader { 215 struct NET_EXPORT_PRIVATE QuicPacketPublicHeader {
480 QuicPacketPublicHeader(); 216 QuicPacketPublicHeader();
481 explicit QuicPacketPublicHeader(const QuicPacketPublicHeader& other); 217 explicit QuicPacketPublicHeader(const QuicPacketPublicHeader& other);
482 ~QuicPacketPublicHeader(); 218 ~QuicPacketPublicHeader();
483 219
484 // Universal header. All QuicPacket headers will have a connection_id and 220 // Universal header. All QuicPacket headers will have a connection_id and
485 // public flags. 221 // public flags.
486 QuicConnectionId connection_id; 222 QuicConnectionId connection_id;
(...skipping 771 matching lines...) Expand 10 before | Expand all | Expand 10 after
1258 : iov(iov), iov_count(iov_count), total_length(total_length) {} 994 : iov(iov), iov_count(iov_count), total_length(total_length) {}
1259 995
1260 const struct iovec* iov; 996 const struct iovec* iov;
1261 const int iov_count; 997 const int iov_count;
1262 const size_t total_length; 998 const size_t total_length;
1263 }; 999 };
1264 1000
1265 } // namespace net 1001 } // namespace net
1266 1002
1267 #endif // NET_QUIC_QUIC_PROTOCOL_H_ 1003 #endif // NET_QUIC_QUIC_PROTOCOL_H_
OLDNEW
« no previous file with comments | « net/quic/core/quic_error_codes.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698