OLD | NEW |
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 <limits> | 9 #include <limits> |
10 #include <map> | 10 #include <map> |
(...skipping 338 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
349 QUIC_STREAM_PEER_GOING_AWAY, | 349 QUIC_STREAM_PEER_GOING_AWAY, |
350 // The stream has been cancelled. | 350 // The stream has been cancelled. |
351 QUIC_STREAM_CANCELLED, | 351 QUIC_STREAM_CANCELLED, |
352 // Sending a RST to allow for proper flow control accounting. | 352 // Sending a RST to allow for proper flow control accounting. |
353 QUIC_RST_FLOW_CONTROL_ACCOUNTING, | 353 QUIC_RST_FLOW_CONTROL_ACCOUNTING, |
354 | 354 |
355 // No error. Used as bound while iterating. | 355 // No error. Used as bound while iterating. |
356 QUIC_STREAM_LAST_ERROR, | 356 QUIC_STREAM_LAST_ERROR, |
357 }; | 357 }; |
358 | 358 |
| 359 // Because receiving an unknown QuicRstStreamErrorCode results in connection |
| 360 // teardown, we use this to make sure any errors predating a given version are |
| 361 // downgraded to the most appropriate existing error. |
| 362 QuicRstStreamErrorCode AdjustErrorForVersion( |
| 363 QuicRstStreamErrorCode error_code, |
| 364 QuicVersion version); |
| 365 |
359 // These values must remain stable as they are uploaded to UMA histograms. | 366 // These values must remain stable as they are uploaded to UMA histograms. |
360 // To add a new error code, use the current value of QUIC_LAST_ERROR and | 367 // To add a new error code, use the current value of QUIC_LAST_ERROR and |
361 // increment QUIC_LAST_ERROR. | 368 // increment QUIC_LAST_ERROR. |
362 enum QuicErrorCode { | 369 enum QuicErrorCode { |
363 QUIC_NO_ERROR = 0, | 370 QUIC_NO_ERROR = 0, |
364 | 371 |
365 // Connection has reached an invalid state. | 372 // Connection has reached an invalid state. |
366 QUIC_INTERNAL_ERROR = 1, | 373 QUIC_INTERNAL_ERROR = 1, |
367 // There were data frames after the a fin or reset. | 374 // There were data frames after the a fin or reset. |
368 QUIC_STREAM_DATA_AFTER_TERMINATION = 2, | 375 QUIC_STREAM_DATA_AFTER_TERMINATION = 2, |
(...skipping 652 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1021 WriteStatus status; | 1028 WriteStatus status; |
1022 union { | 1029 union { |
1023 int bytes_written; // only valid when status is OK | 1030 int bytes_written; // only valid when status is OK |
1024 int error_code; // only valid when status is ERROR | 1031 int error_code; // only valid when status is ERROR |
1025 }; | 1032 }; |
1026 }; | 1033 }; |
1027 | 1034 |
1028 } // namespace net | 1035 } // namespace net |
1029 | 1036 |
1030 #endif // NET_QUIC_QUIC_PROTOCOL_H_ | 1037 #endif // NET_QUIC_QUIC_PROTOCOL_H_ |
OLD | NEW |