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 331 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
342 QUIC_MULTIPLE_TERMINATION_OFFSETS, | 342 QUIC_MULTIPLE_TERMINATION_OFFSETS, |
343 // We got bad payload and can not respond to it at the protocol level. | 343 // We got bad payload and can not respond to it at the protocol level. |
344 QUIC_BAD_APPLICATION_PAYLOAD, | 344 QUIC_BAD_APPLICATION_PAYLOAD, |
345 // Stream closed due to connection error. No reset frame is sent when this | 345 // Stream closed due to connection error. No reset frame is sent when this |
346 // happens. | 346 // happens. |
347 QUIC_STREAM_CONNECTION_ERROR, | 347 QUIC_STREAM_CONNECTION_ERROR, |
348 // GoAway frame sent. No more stream can be created. | 348 // GoAway frame sent. No more stream can be created. |
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. |
| 353 QUIC_RST_FLOW_CONTROL_ACCOUNTING, |
352 | 354 |
353 // No error. Used as bound while iterating. | 355 // No error. Used as bound while iterating. |
354 QUIC_STREAM_LAST_ERROR, | 356 QUIC_STREAM_LAST_ERROR, |
355 }; | 357 }; |
356 | 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 NET_EXPORT_PRIVATE QuicRstStreamErrorCode AdjustErrorForVersion( |
| 363 QuicRstStreamErrorCode error_code, |
| 364 QuicVersion version); |
| 365 |
357 // 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. |
358 // 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 |
359 // increment QUIC_LAST_ERROR. | 368 // increment QUIC_LAST_ERROR. |
360 enum QuicErrorCode { | 369 enum QuicErrorCode { |
361 QUIC_NO_ERROR = 0, | 370 QUIC_NO_ERROR = 0, |
362 | 371 |
363 // Connection has reached an invalid state. | 372 // Connection has reached an invalid state. |
364 QUIC_INTERNAL_ERROR = 1, | 373 QUIC_INTERNAL_ERROR = 1, |
365 // There were data frames after the a fin or reset. | 374 // There were data frames after the a fin or reset. |
366 QUIC_STREAM_DATA_AFTER_TERMINATION = 2, | 375 QUIC_STREAM_DATA_AFTER_TERMINATION = 2, |
(...skipping 640 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1007 enum WriteStatus { | 1016 enum WriteStatus { |
1008 WRITE_STATUS_OK, | 1017 WRITE_STATUS_OK, |
1009 WRITE_STATUS_BLOCKED, | 1018 WRITE_STATUS_BLOCKED, |
1010 WRITE_STATUS_ERROR, | 1019 WRITE_STATUS_ERROR, |
1011 }; | 1020 }; |
1012 | 1021 |
1013 // A struct used to return the result of write calls including either the number | 1022 // A struct used to return the result of write calls including either the number |
1014 // of bytes written or the error code, depending upon the status. | 1023 // of bytes written or the error code, depending upon the status. |
1015 struct NET_EXPORT_PRIVATE WriteResult { | 1024 struct NET_EXPORT_PRIVATE WriteResult { |
1016 WriteResult(WriteStatus status, int bytes_written_or_error_code); | 1025 WriteResult(WriteStatus status, int bytes_written_or_error_code); |
| 1026 WriteResult(); |
1017 | 1027 |
1018 WriteStatus status; | 1028 WriteStatus status; |
1019 union { | 1029 union { |
1020 int bytes_written; // only valid when status is OK | 1030 int bytes_written; // only valid when status is OK |
1021 int error_code; // only valid when status is ERROR | 1031 int error_code; // only valid when status is ERROR |
1022 }; | 1032 }; |
1023 }; | 1033 }; |
1024 | 1034 |
1025 } // namespace net | 1035 } // namespace net |
1026 | 1036 |
1027 #endif // NET_QUIC_QUIC_PROTOCOL_H_ | 1037 #endif // NET_QUIC_QUIC_PROTOCOL_H_ |
OLD | NEW |