OLD | NEW |
(Empty) | |
| 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 NET_QUIC_QUIC_ERROR_CODES_H_ |
| 6 #define NET_QUIC_QUIC_ERROR_CODES_H_ |
| 7 |
| 8 #include <stdint.h> |
| 9 |
| 10 #include <limits> |
| 11 |
| 12 #include "net/base/net_export.h" |
| 13 |
| 14 namespace net { |
| 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 // No error. Used as bound while iterating. |
| 56 QUIC_STREAM_LAST_ERROR, |
| 57 }; |
| 58 // QuicRstStreamErrorCode is encoded as a single octet on-the-wire. |
| 59 static_assert(static_cast<int>(QUIC_STREAM_LAST_ERROR) <= |
| 60 std::numeric_limits<uint8_t>::max(), |
| 61 "QuicRstStreamErrorCode exceeds single octet"); |
| 62 |
| 63 // These values must remain stable as they are uploaded to UMA histograms. |
| 64 // To add a new error code, use the current value of QUIC_LAST_ERROR and |
| 65 // increment QUIC_LAST_ERROR. |
| 66 enum QuicErrorCode { |
| 67 QUIC_NO_ERROR = 0, |
| 68 |
| 69 // Connection has reached an invalid state. |
| 70 QUIC_INTERNAL_ERROR = 1, |
| 71 // There were data frames after the a fin or reset. |
| 72 QUIC_STREAM_DATA_AFTER_TERMINATION = 2, |
| 73 // Control frame is malformed. |
| 74 QUIC_INVALID_PACKET_HEADER = 3, |
| 75 // Frame data is malformed. |
| 76 QUIC_INVALID_FRAME_DATA = 4, |
| 77 // The packet contained no payload. |
| 78 QUIC_MISSING_PAYLOAD = 48, |
| 79 // FEC data is malformed. |
| 80 QUIC_INVALID_FEC_DATA = 5, |
| 81 // STREAM frame data is malformed. |
| 82 QUIC_INVALID_STREAM_DATA = 46, |
| 83 // STREAM frame data overlaps with buffered data. |
| 84 QUIC_OVERLAPPING_STREAM_DATA = 87, |
| 85 // Received STREAM frame data is not encrypted. |
| 86 QUIC_UNENCRYPTED_STREAM_DATA = 61, |
| 87 // Attempt to send unencrypted STREAM frame. |
| 88 QUIC_ATTEMPT_TO_SEND_UNENCRYPTED_STREAM_DATA = 88, |
| 89 // Received a frame which is likely the result of memory corruption. |
| 90 QUIC_MAYBE_CORRUPTED_MEMORY = 89, |
| 91 // FEC frame data is not encrypted. |
| 92 QUIC_UNENCRYPTED_FEC_DATA = 77, |
| 93 // RST_STREAM frame data is malformed. |
| 94 QUIC_INVALID_RST_STREAM_DATA = 6, |
| 95 // CONNECTION_CLOSE frame data is malformed. |
| 96 QUIC_INVALID_CONNECTION_CLOSE_DATA = 7, |
| 97 // GOAWAY frame data is malformed. |
| 98 QUIC_INVALID_GOAWAY_DATA = 8, |
| 99 // WINDOW_UPDATE frame data is malformed. |
| 100 QUIC_INVALID_WINDOW_UPDATE_DATA = 57, |
| 101 // BLOCKED frame data is malformed. |
| 102 QUIC_INVALID_BLOCKED_DATA = 58, |
| 103 // STOP_WAITING frame data is malformed. |
| 104 QUIC_INVALID_STOP_WAITING_DATA = 60, |
| 105 // PATH_CLOSE frame data is malformed. |
| 106 QUIC_INVALID_PATH_CLOSE_DATA = 78, |
| 107 // ACK frame data is malformed. |
| 108 QUIC_INVALID_ACK_DATA = 9, |
| 109 |
| 110 // Version negotiation packet is malformed. |
| 111 QUIC_INVALID_VERSION_NEGOTIATION_PACKET = 10, |
| 112 // Public RST packet is malformed. |
| 113 QUIC_INVALID_PUBLIC_RST_PACKET = 11, |
| 114 // There was an error decrypting. |
| 115 QUIC_DECRYPTION_FAILURE = 12, |
| 116 // There was an error encrypting. |
| 117 QUIC_ENCRYPTION_FAILURE = 13, |
| 118 // The packet exceeded kMaxPacketSize. |
| 119 QUIC_PACKET_TOO_LARGE = 14, |
| 120 // The peer is going away. May be a client or server. |
| 121 QUIC_PEER_GOING_AWAY = 16, |
| 122 // A stream ID was invalid. |
| 123 QUIC_INVALID_STREAM_ID = 17, |
| 124 // A priority was invalid. |
| 125 QUIC_INVALID_PRIORITY = 49, |
| 126 // Too many streams already open. |
| 127 QUIC_TOO_MANY_OPEN_STREAMS = 18, |
| 128 // The peer created too many available streams. |
| 129 QUIC_TOO_MANY_AVAILABLE_STREAMS = 76, |
| 130 // Received public reset for this connection. |
| 131 QUIC_PUBLIC_RESET = 19, |
| 132 // Invalid protocol version. |
| 133 QUIC_INVALID_VERSION = 20, |
| 134 |
| 135 // The Header ID for a stream was too far from the previous. |
| 136 QUIC_INVALID_HEADER_ID = 22, |
| 137 // Negotiable parameter received during handshake had invalid value. |
| 138 QUIC_INVALID_NEGOTIATED_VALUE = 23, |
| 139 // There was an error decompressing data. |
| 140 QUIC_DECOMPRESSION_FAILURE = 24, |
| 141 // The connection timed out due to no network activity. |
| 142 QUIC_NETWORK_IDLE_TIMEOUT = 25, |
| 143 // The connection timed out waiting for the handshake to complete. |
| 144 QUIC_HANDSHAKE_TIMEOUT = 67, |
| 145 // There was an error encountered migrating addresses. |
| 146 QUIC_ERROR_MIGRATING_ADDRESS = 26, |
| 147 // There was an error encountered migrating port only. |
| 148 QUIC_ERROR_MIGRATING_PORT = 86, |
| 149 // There was an error while writing to the socket. |
| 150 QUIC_PACKET_WRITE_ERROR = 27, |
| 151 // There was an error while reading from the socket. |
| 152 QUIC_PACKET_READ_ERROR = 51, |
| 153 // We received a STREAM_FRAME with no data and no fin flag set. |
| 154 QUIC_EMPTY_STREAM_FRAME_NO_FIN = 50, |
| 155 // We received invalid data on the headers stream. |
| 156 QUIC_INVALID_HEADERS_STREAM_DATA = 56, |
| 157 // The peer received too much data, violating flow control. |
| 158 QUIC_FLOW_CONTROL_RECEIVED_TOO_MUCH_DATA = 59, |
| 159 // The peer sent too much data, violating flow control. |
| 160 QUIC_FLOW_CONTROL_SENT_TOO_MUCH_DATA = 63, |
| 161 // The peer received an invalid flow control window. |
| 162 QUIC_FLOW_CONTROL_INVALID_WINDOW = 64, |
| 163 // The connection has been IP pooled into an existing connection. |
| 164 QUIC_CONNECTION_IP_POOLED = 62, |
| 165 // The connection has too many outstanding sent packets. |
| 166 QUIC_TOO_MANY_OUTSTANDING_SENT_PACKETS = 68, |
| 167 // The connection has too many outstanding received packets. |
| 168 QUIC_TOO_MANY_OUTSTANDING_RECEIVED_PACKETS = 69, |
| 169 // The quic connection has been cancelled. |
| 170 QUIC_CONNECTION_CANCELLED = 70, |
| 171 // Disabled QUIC because of high packet loss rate. |
| 172 QUIC_BAD_PACKET_LOSS_RATE = 71, |
| 173 // Disabled QUIC because of too many PUBLIC_RESETs post handshake. |
| 174 QUIC_PUBLIC_RESETS_POST_HANDSHAKE = 73, |
| 175 // Disabled QUIC because of too many timeouts with streams open. |
| 176 QUIC_TIMEOUTS_WITH_OPEN_STREAMS = 74, |
| 177 // Closed because we failed to serialize a packet. |
| 178 QUIC_FAILED_TO_SERIALIZE_PACKET = 75, |
| 179 // QUIC timed out after too many RTOs. |
| 180 QUIC_TOO_MANY_RTOS = 85, |
| 181 |
| 182 // Crypto errors. |
| 183 |
| 184 // Hanshake failed. |
| 185 QUIC_HANDSHAKE_FAILED = 28, |
| 186 // Handshake message contained out of order tags. |
| 187 QUIC_CRYPTO_TAGS_OUT_OF_ORDER = 29, |
| 188 // Handshake message contained too many entries. |
| 189 QUIC_CRYPTO_TOO_MANY_ENTRIES = 30, |
| 190 // Handshake message contained an invalid value length. |
| 191 QUIC_CRYPTO_INVALID_VALUE_LENGTH = 31, |
| 192 // A crypto message was received after the handshake was complete. |
| 193 QUIC_CRYPTO_MESSAGE_AFTER_HANDSHAKE_COMPLETE = 32, |
| 194 // A crypto message was received with an illegal message tag. |
| 195 QUIC_INVALID_CRYPTO_MESSAGE_TYPE = 33, |
| 196 // A crypto message was received with an illegal parameter. |
| 197 QUIC_INVALID_CRYPTO_MESSAGE_PARAMETER = 34, |
| 198 // An invalid channel id signature was supplied. |
| 199 QUIC_INVALID_CHANNEL_ID_SIGNATURE = 52, |
| 200 // A crypto message was received with a mandatory parameter missing. |
| 201 QUIC_CRYPTO_MESSAGE_PARAMETER_NOT_FOUND = 35, |
| 202 // A crypto message was received with a parameter that has no overlap |
| 203 // with the local parameter. |
| 204 QUIC_CRYPTO_MESSAGE_PARAMETER_NO_OVERLAP = 36, |
| 205 // A crypto message was received that contained a parameter with too few |
| 206 // values. |
| 207 QUIC_CRYPTO_MESSAGE_INDEX_NOT_FOUND = 37, |
| 208 // A demand for an unsupport proof type was received. |
| 209 QUIC_UNSUPPORTED_PROOF_DEMAND = 94, |
| 210 // An internal error occured in crypto processing. |
| 211 QUIC_CRYPTO_INTERNAL_ERROR = 38, |
| 212 // A crypto handshake message specified an unsupported version. |
| 213 QUIC_CRYPTO_VERSION_NOT_SUPPORTED = 39, |
| 214 // A crypto handshake message resulted in a stateless reject. |
| 215 QUIC_CRYPTO_HANDSHAKE_STATELESS_REJECT = 72, |
| 216 // There was no intersection between the crypto primitives supported by the |
| 217 // peer and ourselves. |
| 218 QUIC_CRYPTO_NO_SUPPORT = 40, |
| 219 // The server rejected our client hello messages too many times. |
| 220 QUIC_CRYPTO_TOO_MANY_REJECTS = 41, |
| 221 // The client rejected the server's certificate chain or signature. |
| 222 QUIC_PROOF_INVALID = 42, |
| 223 // A crypto message was received with a duplicate tag. |
| 224 QUIC_CRYPTO_DUPLICATE_TAG = 43, |
| 225 // A crypto message was received with the wrong encryption level (i.e. it |
| 226 // should have been encrypted but was not.) |
| 227 QUIC_CRYPTO_ENCRYPTION_LEVEL_INCORRECT = 44, |
| 228 // The server config for a server has expired. |
| 229 QUIC_CRYPTO_SERVER_CONFIG_EXPIRED = 45, |
| 230 // We failed to setup the symmetric keys for a connection. |
| 231 QUIC_CRYPTO_SYMMETRIC_KEY_SETUP_FAILED = 53, |
| 232 // A handshake message arrived, but we are still validating the |
| 233 // previous handshake message. |
| 234 QUIC_CRYPTO_MESSAGE_WHILE_VALIDATING_CLIENT_HELLO = 54, |
| 235 // A server config update arrived before the handshake is complete. |
| 236 QUIC_CRYPTO_UPDATE_BEFORE_HANDSHAKE_COMPLETE = 65, |
| 237 // CHLO cannot fit in one packet. |
| 238 QUIC_CRYPTO_CHLO_TOO_LARGE = 90, |
| 239 // This connection involved a version negotiation which appears to have been |
| 240 // tampered with. |
| 241 QUIC_VERSION_NEGOTIATION_MISMATCH = 55, |
| 242 |
| 243 // Multipath errors. |
| 244 // Multipath is not enabled, but a packet with multipath flag on is received. |
| 245 QUIC_BAD_MULTIPATH_FLAG = 79, |
| 246 // A path is supposed to exist but does not. |
| 247 QUIC_MULTIPATH_PATH_DOES_NOT_EXIST = 91, |
| 248 // A path is supposed to be active but is not. |
| 249 QUIC_MULTIPATH_PATH_NOT_ACTIVE = 92, |
| 250 |
| 251 // IP address changed causing connection close. |
| 252 QUIC_IP_ADDRESS_CHANGED = 80, |
| 253 |
| 254 // Connection migration errors. |
| 255 // Network changed, but connection had no migratable streams. |
| 256 QUIC_CONNECTION_MIGRATION_NO_MIGRATABLE_STREAMS = 81, |
| 257 // Connection changed networks too many times. |
| 258 QUIC_CONNECTION_MIGRATION_TOO_MANY_CHANGES = 82, |
| 259 // Connection migration was attempted, but there was no new network to |
| 260 // migrate to. |
| 261 QUIC_CONNECTION_MIGRATION_NO_NEW_NETWORK = 83, |
| 262 // Network changed, but connection had one or more non-migratable streams. |
| 263 QUIC_CONNECTION_MIGRATION_NON_MIGRATABLE_STREAM = 84, |
| 264 |
| 265 // Stream frames arrived too discontiguously so that stream sequencer buffer |
| 266 // maintains too many gaps. |
| 267 QUIC_TOO_MANY_FRAME_GAPS = 93, |
| 268 |
| 269 // Sequencer buffer get into weird state where continuing read/write will lead |
| 270 // to crash. |
| 271 QUIC_STREAM_SEQUENCER_INVALID_STATE = 95, |
| 272 |
| 273 // Connection closed because of server hits max number of sessions allowed. |
| 274 // TODO(fayang): Add monitoring for QUIC_TOO_MANY_SESSIONS_ON_SERVER. |
| 275 QUIC_TOO_MANY_SESSIONS_ON_SERVER = 96, |
| 276 |
| 277 // No error. Used as bound while iterating. |
| 278 QUIC_LAST_ERROR = 97, |
| 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); |
| 291 |
| 292 } // namespace net |
| 293 |
| 294 #endif // NET_QUIC_QUIC_ERROR_CODES_H_ |
OLD | NEW |