QUICHE team | a6ef0a6 | 2019-03-07 20:34:33 -0500 | [diff] [blame] | 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 |
| 3 | // found in the LICENSE file. |
| 4 | |
| 5 | #ifndef QUICHE_QUIC_CORE_QUIC_ERROR_CODES_H_ |
| 6 | #define QUICHE_QUIC_CORE_QUIC_ERROR_CODES_H_ |
| 7 | |
| 8 | #include <cstdint> |
| 9 | #include <limits> |
wub | 2b5942f | 2019-04-11 13:22:50 -0700 | [diff] [blame] | 10 | #include <string> |
QUICHE team | a6ef0a6 | 2019-03-07 20:34:33 -0500 | [diff] [blame] | 11 | |
| 12 | #include "net/third_party/quiche/src/quic/platform/api/quic_export.h" |
| 13 | |
| 14 | namespace quic { |
| 15 | |
| 16 | enum QuicRstStreamErrorCode { |
| 17 | // Complete response has been sent, sending a RST to ask the other endpoint |
| 18 | // to stop sending request data without discarding the response. |
| 19 | QUIC_STREAM_NO_ERROR = 0, |
| 20 | |
| 21 | // There was some error which halted stream processing. |
| 22 | QUIC_ERROR_PROCESSING_STREAM, |
| 23 | // We got two fin or reset offsets which did not match. |
| 24 | QUIC_MULTIPLE_TERMINATION_OFFSETS, |
| 25 | // We got bad payload and can not respond to it at the protocol level. |
| 26 | QUIC_BAD_APPLICATION_PAYLOAD, |
| 27 | // Stream closed due to connection error. No reset frame is sent when this |
| 28 | // happens. |
| 29 | QUIC_STREAM_CONNECTION_ERROR, |
| 30 | // GoAway frame sent. No more stream can be created. |
| 31 | QUIC_STREAM_PEER_GOING_AWAY, |
| 32 | // The stream has been cancelled. |
| 33 | QUIC_STREAM_CANCELLED, |
| 34 | // Closing stream locally, sending a RST to allow for proper flow control |
| 35 | // accounting. Sent in response to a RST from the peer. |
| 36 | QUIC_RST_ACKNOWLEDGEMENT, |
| 37 | // Receiver refused to create the stream (because its limit on open streams |
| 38 | // has been reached). The sender should retry the request later (using |
| 39 | // another stream). |
| 40 | QUIC_REFUSED_STREAM, |
| 41 | // Invalid URL in PUSH_PROMISE request header. |
| 42 | QUIC_INVALID_PROMISE_URL, |
| 43 | // Server is not authoritative for this URL. |
| 44 | QUIC_UNAUTHORIZED_PROMISE_URL, |
| 45 | // Can't have more than one active PUSH_PROMISE per URL. |
| 46 | QUIC_DUPLICATE_PROMISE_URL, |
| 47 | // Vary check failed. |
| 48 | QUIC_PROMISE_VARY_MISMATCH, |
| 49 | // Only GET and HEAD methods allowed. |
| 50 | QUIC_INVALID_PROMISE_METHOD, |
| 51 | // The push stream is unclaimed and timed out. |
| 52 | QUIC_PUSH_STREAM_TIMED_OUT, |
| 53 | // Received headers were too large. |
| 54 | QUIC_HEADERS_TOO_LARGE, |
| 55 | // The data is not likely arrive in time. |
| 56 | QUIC_STREAM_TTL_EXPIRED, |
renjietang | 963c2ec | 2019-09-12 11:46:50 -0700 | [diff] [blame] | 57 | // The stream received data that goes beyond its close offset. |
| 58 | QUIC_DATA_AFTER_CLOSE_OFFSET, |
QUICHE team | a6ef0a6 | 2019-03-07 20:34:33 -0500 | [diff] [blame] | 59 | // No error. Used as bound while iterating. |
| 60 | QUIC_STREAM_LAST_ERROR, |
| 61 | }; |
| 62 | // QuicRstStreamErrorCode is encoded as a single octet on-the-wire. |
| 63 | static_assert(static_cast<int>(QUIC_STREAM_LAST_ERROR) <= |
| 64 | std::numeric_limits<uint8_t>::max(), |
| 65 | "QuicRstStreamErrorCode exceeds single octet"); |
| 66 | |
| 67 | // These values must remain stable as they are uploaded to UMA histograms. |
| 68 | // To add a new error code, use the current value of QUIC_LAST_ERROR and |
| 69 | // increment QUIC_LAST_ERROR. |
| 70 | enum QuicErrorCode { |
| 71 | QUIC_NO_ERROR = 0, |
| 72 | |
| 73 | // Connection has reached an invalid state. |
| 74 | QUIC_INTERNAL_ERROR = 1, |
| 75 | // There were data frames after the a fin or reset. |
| 76 | QUIC_STREAM_DATA_AFTER_TERMINATION = 2, |
| 77 | // Control frame is malformed. |
| 78 | QUIC_INVALID_PACKET_HEADER = 3, |
| 79 | // Frame data is malformed. |
| 80 | QUIC_INVALID_FRAME_DATA = 4, |
| 81 | // The packet contained no payload. |
| 82 | QUIC_MISSING_PAYLOAD = 48, |
| 83 | // FEC data is malformed. |
| 84 | QUIC_INVALID_FEC_DATA = 5, |
| 85 | // STREAM frame data is malformed. |
| 86 | QUIC_INVALID_STREAM_DATA = 46, |
| 87 | // STREAM frame data overlaps with buffered data. |
| 88 | QUIC_OVERLAPPING_STREAM_DATA = 87, |
| 89 | // Received STREAM frame data is not encrypted. |
| 90 | QUIC_UNENCRYPTED_STREAM_DATA = 61, |
| 91 | // Attempt to send unencrypted STREAM frame. |
| 92 | QUIC_ATTEMPT_TO_SEND_UNENCRYPTED_STREAM_DATA = 88, |
| 93 | // Received a frame which is likely the result of memory corruption. |
| 94 | QUIC_MAYBE_CORRUPTED_MEMORY = 89, |
| 95 | // FEC frame data is not encrypted. |
| 96 | QUIC_UNENCRYPTED_FEC_DATA = 77, |
| 97 | // RST_STREAM frame data is malformed. |
| 98 | QUIC_INVALID_RST_STREAM_DATA = 6, |
| 99 | // CONNECTION_CLOSE frame data is malformed. |
| 100 | QUIC_INVALID_CONNECTION_CLOSE_DATA = 7, |
| 101 | // GOAWAY frame data is malformed. |
| 102 | QUIC_INVALID_GOAWAY_DATA = 8, |
| 103 | // WINDOW_UPDATE frame data is malformed. |
| 104 | QUIC_INVALID_WINDOW_UPDATE_DATA = 57, |
| 105 | // BLOCKED frame data is malformed. |
| 106 | QUIC_INVALID_BLOCKED_DATA = 58, |
| 107 | // STOP_WAITING frame data is malformed. |
| 108 | QUIC_INVALID_STOP_WAITING_DATA = 60, |
| 109 | // PATH_CLOSE frame data is malformed. |
| 110 | QUIC_INVALID_PATH_CLOSE_DATA = 78, |
| 111 | // ACK frame data is malformed. |
| 112 | QUIC_INVALID_ACK_DATA = 9, |
| 113 | // Message frame data is malformed. |
| 114 | QUIC_INVALID_MESSAGE_DATA = 112, |
| 115 | |
| 116 | // Version negotiation packet is malformed. |
| 117 | QUIC_INVALID_VERSION_NEGOTIATION_PACKET = 10, |
| 118 | // Public RST packet is malformed. |
| 119 | QUIC_INVALID_PUBLIC_RST_PACKET = 11, |
| 120 | // There was an error decrypting. |
| 121 | QUIC_DECRYPTION_FAILURE = 12, |
| 122 | // There was an error encrypting. |
| 123 | QUIC_ENCRYPTION_FAILURE = 13, |
dschinazi | 66dea07 | 2019-04-09 11:41:06 -0700 | [diff] [blame] | 124 | // The packet exceeded kMaxOutgoingPacketSize. |
QUICHE team | a6ef0a6 | 2019-03-07 20:34:33 -0500 | [diff] [blame] | 125 | QUIC_PACKET_TOO_LARGE = 14, |
| 126 | // The peer is going away. May be a client or server. |
| 127 | QUIC_PEER_GOING_AWAY = 16, |
| 128 | // A stream ID was invalid. |
| 129 | QUIC_INVALID_STREAM_ID = 17, |
| 130 | // A priority was invalid. |
| 131 | QUIC_INVALID_PRIORITY = 49, |
| 132 | // Too many streams already open. |
| 133 | QUIC_TOO_MANY_OPEN_STREAMS = 18, |
| 134 | // The peer created too many available streams. |
| 135 | QUIC_TOO_MANY_AVAILABLE_STREAMS = 76, |
| 136 | // Received public reset for this connection. |
| 137 | QUIC_PUBLIC_RESET = 19, |
| 138 | // Invalid protocol version. |
| 139 | QUIC_INVALID_VERSION = 20, |
| 140 | |
| 141 | // The Header ID for a stream was too far from the previous. |
| 142 | QUIC_INVALID_HEADER_ID = 22, |
| 143 | // Negotiable parameter received during handshake had invalid value. |
| 144 | QUIC_INVALID_NEGOTIATED_VALUE = 23, |
| 145 | // There was an error decompressing data. |
| 146 | QUIC_DECOMPRESSION_FAILURE = 24, |
| 147 | // The connection timed out due to no network activity. |
| 148 | QUIC_NETWORK_IDLE_TIMEOUT = 25, |
| 149 | // The connection timed out waiting for the handshake to complete. |
| 150 | QUIC_HANDSHAKE_TIMEOUT = 67, |
| 151 | // There was an error encountered migrating addresses. |
| 152 | QUIC_ERROR_MIGRATING_ADDRESS = 26, |
| 153 | // There was an error encountered migrating port only. |
| 154 | QUIC_ERROR_MIGRATING_PORT = 86, |
| 155 | // There was an error while writing to the socket. |
| 156 | QUIC_PACKET_WRITE_ERROR = 27, |
| 157 | // There was an error while reading from the socket. |
| 158 | QUIC_PACKET_READ_ERROR = 51, |
| 159 | // We received a STREAM_FRAME with no data and no fin flag set. |
| 160 | QUIC_EMPTY_STREAM_FRAME_NO_FIN = 50, |
| 161 | // We received invalid data on the headers stream. |
| 162 | QUIC_INVALID_HEADERS_STREAM_DATA = 56, |
| 163 | // Invalid data on the headers stream received because of decompression |
| 164 | // failure. |
| 165 | QUIC_HEADERS_STREAM_DATA_DECOMPRESS_FAILURE = 97, |
| 166 | // The peer received too much data, violating flow control. |
| 167 | QUIC_FLOW_CONTROL_RECEIVED_TOO_MUCH_DATA = 59, |
| 168 | // The peer sent too much data, violating flow control. |
| 169 | QUIC_FLOW_CONTROL_SENT_TOO_MUCH_DATA = 63, |
| 170 | // The peer received an invalid flow control window. |
| 171 | QUIC_FLOW_CONTROL_INVALID_WINDOW = 64, |
| 172 | // The connection has been IP pooled into an existing connection. |
| 173 | QUIC_CONNECTION_IP_POOLED = 62, |
| 174 | // The connection has too many outstanding sent packets. |
| 175 | QUIC_TOO_MANY_OUTSTANDING_SENT_PACKETS = 68, |
| 176 | // The connection has too many outstanding received packets. |
| 177 | QUIC_TOO_MANY_OUTSTANDING_RECEIVED_PACKETS = 69, |
| 178 | // The quic connection has been cancelled. |
| 179 | QUIC_CONNECTION_CANCELLED = 70, |
| 180 | // Disabled QUIC because of high packet loss rate. |
| 181 | QUIC_BAD_PACKET_LOSS_RATE = 71, |
| 182 | // Disabled QUIC because of too many PUBLIC_RESETs post handshake. |
| 183 | QUIC_PUBLIC_RESETS_POST_HANDSHAKE = 73, |
| 184 | // Closed because we failed to serialize a packet. |
| 185 | QUIC_FAILED_TO_SERIALIZE_PACKET = 75, |
| 186 | // QUIC timed out after too many RTOs. |
| 187 | QUIC_TOO_MANY_RTOS = 85, |
| 188 | |
| 189 | // Crypto errors. |
| 190 | |
| 191 | // Handshake failed. |
| 192 | QUIC_HANDSHAKE_FAILED = 28, |
| 193 | // Handshake message contained out of order tags. |
| 194 | QUIC_CRYPTO_TAGS_OUT_OF_ORDER = 29, |
| 195 | // Handshake message contained too many entries. |
| 196 | QUIC_CRYPTO_TOO_MANY_ENTRIES = 30, |
| 197 | // Handshake message contained an invalid value length. |
| 198 | QUIC_CRYPTO_INVALID_VALUE_LENGTH = 31, |
| 199 | // A crypto message was received after the handshake was complete. |
| 200 | QUIC_CRYPTO_MESSAGE_AFTER_HANDSHAKE_COMPLETE = 32, |
| 201 | // A crypto message was received with an illegal message tag. |
| 202 | QUIC_INVALID_CRYPTO_MESSAGE_TYPE = 33, |
| 203 | // A crypto message was received with an illegal parameter. |
| 204 | QUIC_INVALID_CRYPTO_MESSAGE_PARAMETER = 34, |
| 205 | // An invalid channel id signature was supplied. |
| 206 | QUIC_INVALID_CHANNEL_ID_SIGNATURE = 52, |
| 207 | // A crypto message was received with a mandatory parameter missing. |
| 208 | QUIC_CRYPTO_MESSAGE_PARAMETER_NOT_FOUND = 35, |
| 209 | // A crypto message was received with a parameter that has no overlap |
| 210 | // with the local parameter. |
| 211 | QUIC_CRYPTO_MESSAGE_PARAMETER_NO_OVERLAP = 36, |
| 212 | // A crypto message was received that contained a parameter with too few |
| 213 | // values. |
| 214 | QUIC_CRYPTO_MESSAGE_INDEX_NOT_FOUND = 37, |
| 215 | // A demand for an unsupport proof type was received. |
| 216 | QUIC_UNSUPPORTED_PROOF_DEMAND = 94, |
| 217 | // An internal error occurred in crypto processing. |
| 218 | QUIC_CRYPTO_INTERNAL_ERROR = 38, |
| 219 | // A crypto handshake message specified an unsupported version. |
| 220 | QUIC_CRYPTO_VERSION_NOT_SUPPORTED = 39, |
wub | 5f64ec4 | 2019-06-06 07:31:19 -0700 | [diff] [blame] | 221 | // (Deprecated) A crypto handshake message resulted in a stateless reject. |
| 222 | // QUIC_CRYPTO_HANDSHAKE_STATELESS_REJECT = 72, |
QUICHE team | a6ef0a6 | 2019-03-07 20:34:33 -0500 | [diff] [blame] | 223 | // There was no intersection between the crypto primitives supported by the |
| 224 | // peer and ourselves. |
| 225 | QUIC_CRYPTO_NO_SUPPORT = 40, |
| 226 | // The server rejected our client hello messages too many times. |
| 227 | QUIC_CRYPTO_TOO_MANY_REJECTS = 41, |
| 228 | // The client rejected the server's certificate chain or signature. |
| 229 | QUIC_PROOF_INVALID = 42, |
| 230 | // A crypto message was received with a duplicate tag. |
| 231 | QUIC_CRYPTO_DUPLICATE_TAG = 43, |
| 232 | // A crypto message was received with the wrong encryption level (i.e. it |
| 233 | // should have been encrypted but was not.) |
| 234 | QUIC_CRYPTO_ENCRYPTION_LEVEL_INCORRECT = 44, |
| 235 | // The server config for a server has expired. |
| 236 | QUIC_CRYPTO_SERVER_CONFIG_EXPIRED = 45, |
| 237 | // We failed to setup the symmetric keys for a connection. |
| 238 | QUIC_CRYPTO_SYMMETRIC_KEY_SETUP_FAILED = 53, |
| 239 | // A handshake message arrived, but we are still validating the |
| 240 | // previous handshake message. |
| 241 | QUIC_CRYPTO_MESSAGE_WHILE_VALIDATING_CLIENT_HELLO = 54, |
| 242 | // A server config update arrived before the handshake is complete. |
| 243 | QUIC_CRYPTO_UPDATE_BEFORE_HANDSHAKE_COMPLETE = 65, |
| 244 | // CHLO cannot fit in one packet. |
| 245 | QUIC_CRYPTO_CHLO_TOO_LARGE = 90, |
| 246 | // This connection involved a version negotiation which appears to have been |
| 247 | // tampered with. |
| 248 | QUIC_VERSION_NEGOTIATION_MISMATCH = 55, |
| 249 | |
| 250 | // Multipath errors. |
| 251 | // Multipath is not enabled, but a packet with multipath flag on is received. |
| 252 | QUIC_BAD_MULTIPATH_FLAG = 79, |
| 253 | // A path is supposed to exist but does not. |
| 254 | QUIC_MULTIPATH_PATH_DOES_NOT_EXIST = 91, |
| 255 | // A path is supposed to be active but is not. |
| 256 | QUIC_MULTIPATH_PATH_NOT_ACTIVE = 92, |
| 257 | |
| 258 | // IP address changed causing connection close. |
| 259 | QUIC_IP_ADDRESS_CHANGED = 80, |
| 260 | |
| 261 | // Connection migration errors. |
| 262 | // Network changed, but connection had no migratable streams. |
| 263 | QUIC_CONNECTION_MIGRATION_NO_MIGRATABLE_STREAMS = 81, |
| 264 | // Connection changed networks too many times. |
| 265 | QUIC_CONNECTION_MIGRATION_TOO_MANY_CHANGES = 82, |
| 266 | // Connection migration was attempted, but there was no new network to |
| 267 | // migrate to. |
| 268 | QUIC_CONNECTION_MIGRATION_NO_NEW_NETWORK = 83, |
| 269 | // Network changed, but connection had one or more non-migratable streams. |
| 270 | QUIC_CONNECTION_MIGRATION_NON_MIGRATABLE_STREAM = 84, |
| 271 | // Network changed, but connection migration was disabled by config. |
| 272 | QUIC_CONNECTION_MIGRATION_DISABLED_BY_CONFIG = 99, |
| 273 | // Network changed, but error was encountered on the alternative network. |
| 274 | QUIC_CONNECTION_MIGRATION_INTERNAL_ERROR = 100, |
| 275 | // Network changed, but handshake is not confirmed yet. |
| 276 | QUIC_CONNECTION_MIGRATION_HANDSHAKE_UNCONFIRMED = 111, |
| 277 | |
| 278 | // Stream frames arrived too discontiguously so that stream sequencer buffer |
| 279 | // maintains too many intervals. |
| 280 | QUIC_TOO_MANY_STREAM_DATA_INTERVALS = 93, |
| 281 | |
| 282 | // Sequencer buffer get into weird state where continuing read/write will lead |
| 283 | // to crash. |
| 284 | QUIC_STREAM_SEQUENCER_INVALID_STATE = 95, |
| 285 | |
| 286 | // Connection closed because of server hits max number of sessions allowed. |
| 287 | QUIC_TOO_MANY_SESSIONS_ON_SERVER = 96, |
| 288 | |
| 289 | // Receive a RST_STREAM with offset larger than kMaxStreamLength. |
| 290 | QUIC_STREAM_LENGTH_OVERFLOW = 98, |
QUICHE team | a6ef0a6 | 2019-03-07 20:34:33 -0500 | [diff] [blame] | 291 | // Received a MAX DATA frame with errors. |
| 292 | QUIC_INVALID_MAX_DATA_FRAME_DATA = 102, |
| 293 | // Received a MAX STREAM DATA frame with errors. |
| 294 | QUIC_INVALID_MAX_STREAM_DATA_FRAME_DATA = 103, |
fkastenholz | 3c4eabf | 2019-04-22 07:49:59 -0700 | [diff] [blame] | 295 | // Received a MAX_STREAMS frame with bad data |
| 296 | QUIC_MAX_STREAMS_DATA = 104, |
| 297 | // Received a STREAMS_BLOCKED frame with bad data |
| 298 | QUIC_STREAMS_BLOCKED_DATA = 105, |
QUICHE team | a6ef0a6 | 2019-03-07 20:34:33 -0500 | [diff] [blame] | 299 | // Error deframing a STREAM BLOCKED frame. |
| 300 | QUIC_INVALID_STREAM_BLOCKED_DATA = 106, |
| 301 | // NEW CONNECTION ID frame data is malformed. |
| 302 | QUIC_INVALID_NEW_CONNECTION_ID_DATA = 107, |
| 303 | // Received a MAX STREAM DATA frame with errors. |
| 304 | QUIC_INVALID_STOP_SENDING_FRAME_DATA = 108, |
| 305 | // Error deframing PATH CHALLENGE or PATH RESPONSE frames. |
| 306 | QUIC_INVALID_PATH_CHALLENGE_DATA = 109, |
| 307 | QUIC_INVALID_PATH_RESPONSE_DATA = 110, |
| 308 | // This is used to indicate an IETF QUIC PROTOCOL VIOLATION |
| 309 | // transport error within Google (pre-v99) QUIC. |
| 310 | IETF_QUIC_PROTOCOL_VIOLATION = 113, |
| 311 | QUIC_INVALID_NEW_TOKEN = 114, |
| 312 | |
| 313 | // Received stream data on a WRITE_UNIDIRECTIONAL stream. |
| 314 | QUIC_DATA_RECEIVED_ON_WRITE_UNIDIRECTIONAL_STREAM = 115, |
| 315 | // Try to send stream data on a READ_UNIDIRECTIONAL stream. |
| 316 | QUIC_TRY_TO_WRITE_DATA_ON_READ_UNIDIRECTIONAL_STREAM = 116, |
| 317 | |
| 318 | // RETIRE CONNECTION ID frame data is malformed. |
| 319 | QUIC_INVALID_RETIRE_CONNECTION_ID_DATA = 117, |
fkastenholz | 3c4eabf | 2019-04-22 07:49:59 -0700 | [diff] [blame] | 320 | |
| 321 | // Error in a received STREAMS BLOCKED frame. |
| 322 | QUIC_STREAMS_BLOCKED_ERROR = 118, |
| 323 | // Error in a received MAX STREAMS frame |
| 324 | QUIC_MAX_STREAMS_ERROR = 119, |
QUICHE team | a6ef0a6 | 2019-03-07 20:34:33 -0500 | [diff] [blame] | 325 | // Error in Http decoder |
| 326 | QUIC_HTTP_DECODER_ERROR = 120, |
| 327 | // Connection from stale host needs to be cancelled. |
| 328 | QUIC_STALE_CONNECTION_CANCELLED = 121, |
| 329 | |
fkastenholz | e9d71a8 | 2019-04-09 05:12:13 -0700 | [diff] [blame] | 330 | // A pseudo error, used as an extended error reason code in the error_details |
| 331 | // of IETF-QUIC CONNECTION_CLOSE frames. It is used in |
| 332 | // OnConnectionClosed upcalls to indicate that extended error information was |
| 333 | // not available in a received CONNECTION_CLOSE frame. |
| 334 | QUIC_IETF_GQUIC_ERROR_MISSING = 122, |
| 335 | |
renjietang | 28c04b7 | 2019-07-01 15:08:09 -0700 | [diff] [blame] | 336 | // Received WindowUpdate on a READ_UNIDIRECTIONAL stream. |
| 337 | QUIC_WINDOW_UPDATE_RECEIVED_ON_READ_UNIDIRECTIONAL_STREAM = 123, |
| 338 | |
fayang | 83d7e3e | 2019-07-31 14:45:19 -0700 | [diff] [blame] | 339 | // There are too many buffered control frames in control frame manager. |
| 340 | QUIC_TOO_MANY_BUFFERED_CONTROL_FRAMES = 124, |
| 341 | |
vasilvv | efc6af8 | 2019-10-11 12:46:56 -0700 | [diff] [blame] | 342 | // QuicTransport received invalid client indication. |
| 343 | QUIC_TRANSPORT_INVALID_CLIENT_INDICATION = 125, |
| 344 | |
bnc | 13753e6 | 2019-10-17 04:40:09 -0700 | [diff] [blame] | 345 | // Internal error codes for QPACK errors. |
| 346 | QUIC_QPACK_DECOMPRESSION_FAILED = 126, |
| 347 | QUIC_QPACK_ENCODER_STREAM_ERROR = 127, |
| 348 | QUIC_QPACK_DECODER_STREAM_ERROR = 128, |
| 349 | |
renjietang | 15afba3 | 2019-10-23 14:32:35 -0700 | [diff] [blame] | 350 | // Received stream data beyond close offset. |
| 351 | QUIC_STREAM_DATA_BEYOND_CLOSE_OFFSET = 129, |
| 352 | |
| 353 | // Received multiple close offset. |
| 354 | QUIC_STREAM_MULTIPLE_OFFSET = 130, |
| 355 | |
QUICHE team | a6ef0a6 | 2019-03-07 20:34:33 -0500 | [diff] [blame] | 356 | // No error. Used as bound while iterating. |
renjietang | 15afba3 | 2019-10-23 14:32:35 -0700 | [diff] [blame] | 357 | QUIC_LAST_ERROR = 131, |
QUICHE team | a6ef0a6 | 2019-03-07 20:34:33 -0500 | [diff] [blame] | 358 | }; |
fkastenholz | 88d08f4 | 2019-09-06 07:38:04 -0700 | [diff] [blame] | 359 | // QuicErrorCodes is encoded as four octets on-the-wire when doing Google QUIC, |
| 360 | // or a varint62 when doing IETF QUIC. Ensure that its value does not exceed |
| 361 | // the smaller of the two limits. |
| 362 | static_assert(static_cast<uint64_t>(QUIC_LAST_ERROR) <= |
| 363 | static_cast<uint64_t>(std::numeric_limits<uint32_t>::max()), |
| 364 | "QuicErrorCode exceeds four octets"); |
QUICHE team | a6ef0a6 | 2019-03-07 20:34:33 -0500 | [diff] [blame] | 365 | |
| 366 | // Returns the name of the QuicRstStreamErrorCode as a char* |
| 367 | QUIC_EXPORT_PRIVATE const char* QuicRstStreamErrorCodeToString( |
| 368 | QuicRstStreamErrorCode error); |
| 369 | |
| 370 | // Returns the name of the QuicErrorCode as a char* |
dschinazi | f25169a | 2019-10-23 08:12:18 -0700 | [diff] [blame] | 371 | QUIC_EXPORT_PRIVATE const char* QuicErrorCodeToString(QuicErrorCode error); |
QUICHE team | a6ef0a6 | 2019-03-07 20:34:33 -0500 | [diff] [blame] | 372 | |
bnc | 13753e6 | 2019-10-17 04:40:09 -0700 | [diff] [blame] | 373 | // Wire values for QPACK errors. |
| 374 | // https://quicwg.org/base-drafts/draft-ietf-quic-qpack.html#error-code-registration |
| 375 | enum QuicHttpQpackErrorCode { |
| 376 | IETF_QUIC_HTTP_QPACK_DECOMPRESSION_FAILED = 0x200, |
| 377 | IETF_QUIC_HTTP_QPACK_ENCODER_STREAM_ERROR = 0x201, |
| 378 | IETF_QUIC_HTTP_QPACK_DECODER_STREAM_ERROR = 0x202 |
| 379 | }; |
| 380 | |
wub | 2b5942f | 2019-04-11 13:22:50 -0700 | [diff] [blame] | 381 | QUIC_EXPORT_PRIVATE inline std::string HistogramEnumString( |
| 382 | QuicErrorCode enum_value) { |
| 383 | return QuicErrorCodeToString(enum_value); |
| 384 | } |
| 385 | |
| 386 | QUIC_EXPORT_PRIVATE inline std::string HistogramEnumDescription( |
dschinazi | 17d4242 | 2019-06-18 16:35:07 -0700 | [diff] [blame] | 387 | QuicErrorCode /*dummy*/) { |
wub | 2b5942f | 2019-04-11 13:22:50 -0700 | [diff] [blame] | 388 | return "cause"; |
| 389 | } |
| 390 | |
QUICHE team | a6ef0a6 | 2019-03-07 20:34:33 -0500 | [diff] [blame] | 391 | } // namespace quic |
| 392 | |
| 393 | #endif // QUICHE_QUIC_CORE_QUIC_ERROR_CODES_H_ |