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 260 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
271 // Stream closed due to connection error. No reset frame is sent when this | 271 // Stream closed due to connection error. No reset frame is sent when this |
272 // happens. | 272 // happens. |
273 QUIC_STREAM_CONNECTION_ERROR, | 273 QUIC_STREAM_CONNECTION_ERROR, |
274 // GoAway frame sent. No more stream can be created. | 274 // GoAway frame sent. No more stream can be created. |
275 QUIC_STREAM_PEER_GOING_AWAY, | 275 QUIC_STREAM_PEER_GOING_AWAY, |
276 | 276 |
277 // No error. Used as bound while iterating. | 277 // No error. Used as bound while iterating. |
278 QUIC_STREAM_LAST_ERROR, | 278 QUIC_STREAM_LAST_ERROR, |
279 }; | 279 }; |
280 | 280 |
281 // These values must remain stable as they are uploaded to UMA histograms. | |
282 // To add a new error code, use the current value of QUIC_LAST_ERROR and | |
283 // increment QUIC_LAST_ERROR. | |
281 enum QuicErrorCode { | 284 enum QuicErrorCode { |
282 QUIC_NO_ERROR = 0, | 285 QUIC_NO_ERROR = 0, |
283 | 286 |
284 // Connection has reached an invalid state. | 287 // Connection has reached an invalid state. |
285 QUIC_INTERNAL_ERROR, | 288 QUIC_INTERNAL_ERROR = 1, |
286 // There were data frames after the a fin or reset. | 289 // There were data frames after the a fin or reset. |
287 QUIC_STREAM_DATA_AFTER_TERMINATION, | 290 QUIC_STREAM_DATA_AFTER_TERMINATION = 2, |
288 // Control frame is malformed. | 291 // Control frame is malformed. |
289 QUIC_INVALID_PACKET_HEADER, | 292 QUIC_INVALID_PACKET_HEADER = 3, |
290 // Frame data is malformed. | 293 // Frame data is malformed. |
291 QUIC_INVALID_FRAME_DATA, | 294 QUIC_INVALID_FRAME_DATA = 4, |
295 // The packet contained no payload. | |
296 QUIC_MISSING_PAYLOAD = 48, | |
292 // FEC data is malformed. | 297 // FEC data is malformed. |
293 QUIC_INVALID_FEC_DATA, | 298 QUIC_INVALID_FEC_DATA = 5, |
294 // Stream rst data is malformed | 299 // STREAM frame data is malformed |
ramant (doing other things)
2013/08/20 23:27:16
overly nit: consider adding "." at the end of line
Ryan Hamilton
2013/08/20 23:55:36
Done.
| |
295 QUIC_INVALID_RST_STREAM_DATA, | 300 QUIC_INVALID_STREAM_DATA = 46, |
296 // Connection close data is malformed. | 301 // RST_STREAM frame data is malformed |
297 QUIC_INVALID_CONNECTION_CLOSE_DATA, | 302 QUIC_INVALID_RST_STREAM_DATA = 6, |
298 // GoAway data is malformed. | 303 // CONNECTION_CLOSE frame data is malformed. |
299 QUIC_INVALID_GOAWAY_DATA, | 304 QUIC_INVALID_CONNECTION_CLOSE_DATA = 7, |
300 // Ack data is malformed. | 305 // GOAWAY frame data is malformed. |
301 QUIC_INVALID_ACK_DATA, | 306 QUIC_INVALID_GOAWAY_DATA = 8, |
307 // ACK frame data is malformed. | |
308 QUIC_INVALID_ACK_DATA = 9, | |
309 // CONGESTION_FEEDBACK frame data is malformed. | |
310 QUIC_INVALID_CONGESTION_FEEDBACK_DATA = 47, | |
302 // Version negotiation packet is malformed. | 311 // Version negotiation packet is malformed. |
303 QUIC_INVALID_VERSION_NEGOTIATION_PACKET, | 312 QUIC_INVALID_VERSION_NEGOTIATION_PACKET = 10, |
304 // Public RST packet is malformed. | 313 // Public RST packet is malformed. |
305 QUIC_INVALID_PUBLIC_RST_PACKET, | 314 QUIC_INVALID_PUBLIC_RST_PACKET = 11, |
306 // There was an error decrypting. | 315 // There was an error decrypting. |
307 QUIC_DECRYPTION_FAILURE, | 316 QUIC_DECRYPTION_FAILURE = 12, |
308 // There was an error encrypting. | 317 // There was an error encrypting. |
309 QUIC_ENCRYPTION_FAILURE, | 318 QUIC_ENCRYPTION_FAILURE = 13, |
310 // The packet exceeded kMaxPacketSize. | 319 // The packet exceeded kMaxPacketSize. |
311 QUIC_PACKET_TOO_LARGE, | 320 QUIC_PACKET_TOO_LARGE = 14, |
312 // Data was sent for a stream which did not exist. | 321 // Data was sent for a stream which did not exist. |
313 QUIC_PACKET_FOR_NONEXISTENT_STREAM, | 322 QUIC_PACKET_FOR_NONEXISTENT_STREAM = 15, |
314 // The peer is going away. May be a client or server. | 323 // The peer is going away. May be a client or server. |
315 QUIC_PEER_GOING_AWAY, | 324 QUIC_PEER_GOING_AWAY = 16, |
316 // A stream ID was invalid. | 325 // A stream ID was invalid. |
317 QUIC_INVALID_STREAM_ID, | 326 QUIC_INVALID_STREAM_ID = 17, |
318 // Too many streams already open. | 327 // Too many streams already open. |
319 QUIC_TOO_MANY_OPEN_STREAMS, | 328 QUIC_TOO_MANY_OPEN_STREAMS = 18, |
320 // Received public reset for this connection. | 329 // Received public reset for this connection. |
321 QUIC_PUBLIC_RESET, | 330 QUIC_PUBLIC_RESET = 19, |
322 // Invalid protocol version. | 331 // Invalid protocol version. |
323 QUIC_INVALID_VERSION, | 332 QUIC_INVALID_VERSION = 20, |
324 // Stream reset before headers decompressed. | 333 // Stream reset before headers decompressed. |
325 QUIC_STREAM_RST_BEFORE_HEADERS_DECOMPRESSED, | 334 QUIC_STREAM_RST_BEFORE_HEADERS_DECOMPRESSED = 21, |
326 // The Header ID for a stream was too far from the previous. | 335 // The Header ID for a stream was too far from the previous. |
327 QUIC_INVALID_HEADER_ID, | 336 QUIC_INVALID_HEADER_ID = 22, |
328 // Negotiable parameter received during handshake had invalid value. | 337 // Negotiable parameter received during handshake had invalid value. |
329 QUIC_INVALID_NEGOTIATED_VALUE, | 338 QUIC_INVALID_NEGOTIATED_VALUE = 23, |
330 // There was an error decompressing data. | 339 // There was an error decompressing data. |
331 QUIC_DECOMPRESSION_FAILURE, | 340 QUIC_DECOMPRESSION_FAILURE = 24, |
332 // We hit our prenegotiated (or default) timeout | 341 // We hit our prenegotiated (or default) timeout |
333 QUIC_CONNECTION_TIMED_OUT, | 342 QUIC_CONNECTION_TIMED_OUT = 25, |
334 // There was an error encountered migrating addresses | 343 // There was an error encountered migrating addresses |
335 QUIC_ERROR_MIGRATING_ADDRESS, | 344 QUIC_ERROR_MIGRATING_ADDRESS = 26, |
336 // There was an error while writing the packet. | 345 // There was an error while writing the packet. |
337 QUIC_PACKET_WRITE_ERROR, | 346 QUIC_PACKET_WRITE_ERROR = 27, |
338 | 347 |
339 | 348 |
340 // Crypto errors. | 349 // Crypto errors. |
341 | 350 |
342 // Hanshake failed. | 351 // Hanshake failed. |
343 QUIC_HANDSHAKE_FAILED, | 352 QUIC_HANDSHAKE_FAILED = 28, |
344 // Handshake message contained out of order tags. | 353 // Handshake message contained out of order tags. |
345 QUIC_CRYPTO_TAGS_OUT_OF_ORDER, | 354 QUIC_CRYPTO_TAGS_OUT_OF_ORDER = 29, |
346 // Handshake message contained too many entries. | 355 // Handshake message contained too many entries. |
347 QUIC_CRYPTO_TOO_MANY_ENTRIES, | 356 QUIC_CRYPTO_TOO_MANY_ENTRIES = 30, |
348 // Handshake message contained an invalid value length. | 357 // Handshake message contained an invalid value length. |
349 QUIC_CRYPTO_INVALID_VALUE_LENGTH, | 358 QUIC_CRYPTO_INVALID_VALUE_LENGTH = 31, |
350 // A crypto message was received after the handshake was complete. | 359 // A crypto message was received after the handshake was complete. |
351 QUIC_CRYPTO_MESSAGE_AFTER_HANDSHAKE_COMPLETE, | 360 QUIC_CRYPTO_MESSAGE_AFTER_HANDSHAKE_COMPLETE = 32, |
352 // A crypto message was received with an illegal message tag. | 361 // A crypto message was received with an illegal message tag. |
353 QUIC_INVALID_CRYPTO_MESSAGE_TYPE, | 362 QUIC_INVALID_CRYPTO_MESSAGE_TYPE = 33, |
354 // A crypto message was received with an illegal parameter. | 363 // A crypto message was received with an illegal parameter. |
355 QUIC_INVALID_CRYPTO_MESSAGE_PARAMETER, | 364 QUIC_INVALID_CRYPTO_MESSAGE_PARAMETER = 34, |
356 // A crypto message was received with a mandatory parameter missing. | 365 // A crypto message was received with a mandatory parameter missing. |
357 QUIC_CRYPTO_MESSAGE_PARAMETER_NOT_FOUND, | 366 QUIC_CRYPTO_MESSAGE_PARAMETER_NOT_FOUND = 35, |
358 // A crypto message was received with a parameter that has no overlap | 367 // A crypto message was received with a parameter that has no overlap |
359 // with the local parameter. | 368 // with the local parameter. |
360 QUIC_CRYPTO_MESSAGE_PARAMETER_NO_OVERLAP, | 369 QUIC_CRYPTO_MESSAGE_PARAMETER_NO_OVERLAP = 36, |
361 // A crypto message was received that contained a parameter with too few | 370 // A crypto message was received that contained a parameter with too few |
362 // values. | 371 // values. |
363 QUIC_CRYPTO_MESSAGE_INDEX_NOT_FOUND, | 372 QUIC_CRYPTO_MESSAGE_INDEX_NOT_FOUND = 37, |
364 // An internal error occured in crypto processing. | 373 // An internal error occured in crypto processing. |
365 QUIC_CRYPTO_INTERNAL_ERROR, | 374 QUIC_CRYPTO_INTERNAL_ERROR = 38, |
366 // A crypto handshake message specified an unsupported version. | 375 // A crypto handshake message specified an unsupported version. |
367 QUIC_CRYPTO_VERSION_NOT_SUPPORTED, | 376 QUIC_CRYPTO_VERSION_NOT_SUPPORTED = 39, |
368 // There was no intersection between the crypto primitives supported by the | 377 // There was no intersection between the crypto primitives supported by the |
369 // peer and ourselves. | 378 // peer and ourselves. |
370 QUIC_CRYPTO_NO_SUPPORT, | 379 QUIC_CRYPTO_NO_SUPPORT = 40, |
371 // The server rejected our client hello messages too many times. | 380 // The server rejected our client hello messages too many times. |
372 QUIC_CRYPTO_TOO_MANY_REJECTS, | 381 QUIC_CRYPTO_TOO_MANY_REJECTS = 41, |
373 // The client rejected the server's certificate chain or signature. | 382 // The client rejected the server's certificate chain or signature. |
374 QUIC_PROOF_INVALID, | 383 QUIC_PROOF_INVALID = 42, |
375 // A crypto message was received with a duplicate tag. | 384 // A crypto message was received with a duplicate tag. |
376 QUIC_CRYPTO_DUPLICATE_TAG, | 385 QUIC_CRYPTO_DUPLICATE_TAG = 43, |
377 // A crypto message was received with the wrong encryption level (i.e. it | 386 // A crypto message was received with the wrong encryption level (i.e. it |
378 // should have been encrypted but was not.) | 387 // should have been encrypted but was not.) |
379 QUIC_CRYPTO_ENCRYPTION_LEVEL_INCORRECT, | 388 QUIC_CRYPTO_ENCRYPTION_LEVEL_INCORRECT = 44, |
380 // The server config for a server has expired. | 389 // The server config for a server has expired. |
381 QUIC_CRYPTO_SERVER_CONFIG_EXPIRED, | 390 QUIC_CRYPTO_SERVER_CONFIG_EXPIRED = 45, |
382 | 391 |
383 // No error. Used as bound while iterating. | 392 // No error. Used as bound while iterating. |
384 QUIC_LAST_ERROR, | 393 QUIC_LAST_ERROR = 49, |
385 }; | 394 }; |
386 | 395 |
387 struct NET_EXPORT_PRIVATE QuicPacketPublicHeader { | 396 struct NET_EXPORT_PRIVATE QuicPacketPublicHeader { |
388 QuicPacketPublicHeader(); | 397 QuicPacketPublicHeader(); |
389 explicit QuicPacketPublicHeader(const QuicPacketPublicHeader& other); | 398 explicit QuicPacketPublicHeader(const QuicPacketPublicHeader& other); |
390 ~QuicPacketPublicHeader(); | 399 ~QuicPacketPublicHeader(); |
391 | 400 |
392 QuicPacketPublicHeader& operator=(const QuicPacketPublicHeader& other); | 401 QuicPacketPublicHeader& operator=(const QuicPacketPublicHeader& other); |
393 | 402 |
394 // Universal header. All QuicPacket headers will have a guid and public flags. | 403 // Universal header. All QuicPacket headers will have a guid and public flags. |
(...skipping 443 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
838 NET_EXPORT_PRIVATE friend std::ostream& operator<<( | 847 NET_EXPORT_PRIVATE friend std::ostream& operator<<( |
839 std::ostream& os, const QuicConsumedData& s); | 848 std::ostream& os, const QuicConsumedData& s); |
840 | 849 |
841 size_t bytes_consumed; | 850 size_t bytes_consumed; |
842 bool fin_consumed; | 851 bool fin_consumed; |
843 }; | 852 }; |
844 | 853 |
845 } // namespace net | 854 } // namespace net |
846 | 855 |
847 #endif // NET_QUIC_QUIC_PROTOCOL_H_ | 856 #endif // NET_QUIC_QUIC_PROTOCOL_H_ |
OLD | NEW |