| 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_ERROR_CODES_H_ | 5 #ifndef NET_QUIC_QUIC_ERROR_CODES_H_ |
| 6 #define NET_QUIC_QUIC_ERROR_CODES_H_ | 6 #define NET_QUIC_QUIC_ERROR_CODES_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <limits> | 10 #include <limits> |
| 11 | 11 |
| 12 #include "net/base/net_export.h" |
| 13 |
| 12 namespace net { | 14 namespace net { |
| 13 | 15 |
| 14 enum QuicRstStreamErrorCode { | 16 enum QuicRstStreamErrorCode { |
| 15 // Complete response has been sent, sending a RST to ask the other endpoint | 17 // Complete response has been sent, sending a RST to ask the other endpoint |
| 16 // to stop sending request data without discarding the response. | 18 // to stop sending request data without discarding the response. |
| 17 QUIC_STREAM_NO_ERROR = 0, | 19 QUIC_STREAM_NO_ERROR = 0, |
| 18 | 20 |
| 19 // There was some error which halted stream processing. | 21 // There was some error which halted stream processing. |
| 20 QUIC_ERROR_PROCESSING_STREAM, | 22 QUIC_ERROR_PROCESSING_STREAM, |
| 21 // We got two fin or reset offsets which did not match. | 23 // We got two fin or reset offsets which did not match. |
| (...skipping 24 matching lines...) Expand all Loading... |
| 46 QUIC_PROMISE_VARY_MISMATCH, | 48 QUIC_PROMISE_VARY_MISMATCH, |
| 47 // Only GET and HEAD methods allowed. | 49 // Only GET and HEAD methods allowed. |
| 48 QUIC_INVALID_PROMISE_METHOD, | 50 QUIC_INVALID_PROMISE_METHOD, |
| 49 // The push stream is unclaimed and timed out. | 51 // The push stream is unclaimed and timed out. |
| 50 QUIC_PUSH_STREAM_TIMED_OUT, | 52 QUIC_PUSH_STREAM_TIMED_OUT, |
| 51 // Received headers were too large. | 53 // Received headers were too large. |
| 52 QUIC_HEADERS_TOO_LARGE, | 54 QUIC_HEADERS_TOO_LARGE, |
| 53 // No error. Used as bound while iterating. | 55 // No error. Used as bound while iterating. |
| 54 QUIC_STREAM_LAST_ERROR, | 56 QUIC_STREAM_LAST_ERROR, |
| 55 }; | 57 }; |
| 56 // QUIC error codes are encoded to a single octet on-the-wire. | 58 // QuicRstStreamErrorCode is encoded as a single octet on-the-wire. |
| 57 static_assert(static_cast<int>(QUIC_STREAM_LAST_ERROR) <= | 59 static_assert(static_cast<int>(QUIC_STREAM_LAST_ERROR) <= |
| 58 std::numeric_limits<uint8_t>::max(), | 60 std::numeric_limits<uint8_t>::max(), |
| 59 "QuicErrorCode exceeds single octet"); | 61 "QuicRstStreamErrorCode exceeds single octet"); |
| 60 | 62 |
| 61 // These values must remain stable as they are uploaded to UMA histograms. | 63 // These values must remain stable as they are uploaded to UMA histograms. |
| 62 // To add a new error code, use the current value of QUIC_LAST_ERROR and | 64 // To add a new error code, use the current value of QUIC_LAST_ERROR and |
| 63 // increment QUIC_LAST_ERROR. | 65 // increment QUIC_LAST_ERROR. |
| 64 enum QuicErrorCode { | 66 enum QuicErrorCode { |
| 65 QUIC_NO_ERROR = 0, | 67 QUIC_NO_ERROR = 0, |
| 66 | 68 |
| 67 // Connection has reached an invalid state. | 69 // Connection has reached an invalid state. |
| 68 QUIC_INTERNAL_ERROR = 1, | 70 QUIC_INTERNAL_ERROR = 1, |
| 69 // There were data frames after the a fin or reset. | 71 // There were data frames after the a fin or reset. |
| (...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 268 // to crash. | 270 // to crash. |
| 269 QUIC_STREAM_SEQUENCER_INVALID_STATE = 95, | 271 QUIC_STREAM_SEQUENCER_INVALID_STATE = 95, |
| 270 | 272 |
| 271 // Connection closed because of server hits max number of sessions allowed. | 273 // Connection closed because of server hits max number of sessions allowed. |
| 272 // TODO(fayang): Add monitoring for QUIC_TOO_MANY_SESSIONS_ON_SERVER. | 274 // TODO(fayang): Add monitoring for QUIC_TOO_MANY_SESSIONS_ON_SERVER. |
| 273 QUIC_TOO_MANY_SESSIONS_ON_SERVER = 96, | 275 QUIC_TOO_MANY_SESSIONS_ON_SERVER = 96, |
| 274 | 276 |
| 275 // No error. Used as bound while iterating. | 277 // No error. Used as bound while iterating. |
| 276 QUIC_LAST_ERROR = 97, | 278 QUIC_LAST_ERROR = 97, |
| 277 }; | 279 }; |
| 280 // QuicErrorCodes is encoded as a single octet on-the-wire. |
| 281 static_assert(static_cast<int>(QUIC_LAST_ERROR) <= |
| 282 std::numeric_limits<uint8_t>::max(), |
| 283 "QuicErrorCode exceeds single octet"); |
| 284 |
| 285 // Returns the name of the QuicRstStreamErrorCode as a char* |
| 286 NET_EXPORT_PRIVATE const char* QuicRstStreamErrorCodeToString( |
| 287 QuicRstStreamErrorCode error); |
| 288 |
| 289 // Returns the name of the QuicErrorCode as a char* |
| 290 NET_EXPORT_PRIVATE const char* QuicErrorCodeToString(QuicErrorCode error); |
| 278 | 291 |
| 279 } // namespace net | 292 } // namespace net |
| 280 | 293 |
| 281 #endif // NET_QUIC_QUIC_ERROR_CODES_H_ | 294 #endif // NET_QUIC_QUIC_ERROR_CODES_H_ |
| OLD | NEW |