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 <list> | 10 #include <list> |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
63 const size_t kDefaultInitialWindow = 10; | 63 const size_t kDefaultInitialWindow = 10; |
64 const uint32 kMaxInitialWindow = 100; | 64 const uint32 kMaxInitialWindow = 100; |
65 | 65 |
66 // Default size of initial flow control window, for both stream and session. | 66 // Default size of initial flow control window, for both stream and session. |
67 const uint32 kDefaultFlowControlSendWindow = 16 * 1024; // 16 KB | 67 const uint32 kDefaultFlowControlSendWindow = 16 * 1024; // 16 KB |
68 | 68 |
69 // Maximum size of the congestion window, in packets, for TCP congestion control | 69 // Maximum size of the congestion window, in packets, for TCP congestion control |
70 // algorithms. | 70 // algorithms. |
71 const size_t kMaxTcpCongestionWindow = 200; | 71 const size_t kMaxTcpCongestionWindow = 200; |
72 | 72 |
73 // Size of the socket receive buffer in bytes. | 73 // Default size of the socket receive buffer in bytes. |
74 const QuicByteCount kDefaultSocketReceiveBuffer = 256 * 1024; | 74 const QuicByteCount kDefaultSocketReceiveBuffer = 256 * 1024; |
| 75 // Minimum size of the socket receive buffer in bytes. |
| 76 // Smaller values are ignored. |
| 77 const QuicByteCount kMinSocketReceiveBuffer = 16 * 1024; |
75 | 78 |
76 // Don't allow a client to suggest an RTT longer than 15 seconds. | 79 // Don't allow a client to suggest an RTT longer than 15 seconds. |
77 const uint32 kMaxInitialRoundTripTimeUs = 15 * kNumMicrosPerSecond; | 80 const uint32 kMaxInitialRoundTripTimeUs = 15 * kNumMicrosPerSecond; |
78 | 81 |
79 // Maximum number of open streams per connection. | 82 // Maximum number of open streams per connection. |
80 const size_t kDefaultMaxStreamsPerConnection = 100; | 83 const size_t kDefaultMaxStreamsPerConnection = 100; |
81 | 84 |
82 // Number of bytes reserved for public flags in the packet header. | 85 // Number of bytes reserved for public flags in the packet header. |
83 const size_t kPublicFlagsSize = 1; | 86 const size_t kPublicFlagsSize = 1; |
84 // Number of bytes reserved for version number in the packet header. | 87 // Number of bytes reserved for version number in the packet header. |
(...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
306 | 309 |
307 // This vector contains QUIC versions which we currently support. | 310 // This vector contains QUIC versions which we currently support. |
308 // This should be ordered such that the highest supported version is the first | 311 // This should be ordered such that the highest supported version is the first |
309 // element, with subsequent elements in descending order (versions can be | 312 // element, with subsequent elements in descending order (versions can be |
310 // skipped as necessary). | 313 // skipped as necessary). |
311 // | 314 // |
312 // IMPORTANT: if you are adding to this list, follow the instructions at | 315 // IMPORTANT: if you are adding to this list, follow the instructions at |
313 // http://sites/quic/adding-and-removing-versions | 316 // http://sites/quic/adding-and-removing-versions |
314 static const QuicVersion kSupportedQuicVersions[] = {QUIC_VERSION_23, | 317 static const QuicVersion kSupportedQuicVersions[] = {QUIC_VERSION_23, |
315 QUIC_VERSION_22, | 318 QUIC_VERSION_22, |
316 QUIC_VERSION_21, | |
317 QUIC_VERSION_19}; | 319 QUIC_VERSION_19}; |
318 | 320 |
319 typedef std::vector<QuicVersion> QuicVersionVector; | 321 typedef std::vector<QuicVersion> QuicVersionVector; |
320 | 322 |
321 // Returns a vector of QUIC versions in kSupportedQuicVersions. | 323 // Returns a vector of QUIC versions in kSupportedQuicVersions. |
322 NET_EXPORT_PRIVATE QuicVersionVector QuicSupportedVersions(); | 324 NET_EXPORT_PRIVATE QuicVersionVector QuicSupportedVersions(); |
323 | 325 |
324 // QuicTag is written to and read from the wire, but we prefer to use | 326 // QuicTag is written to and read from the wire, but we prefer to use |
325 // the more readable QuicVersion at other levels. | 327 // the more readable QuicVersion at other levels. |
326 // Helper function which translates from a QuicVersion to a QuicTag. Returns 0 | 328 // Helper function which translates from a QuicVersion to a QuicTag. Returns 0 |
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
493 // We received invalid data on the headers stream. | 495 // We received invalid data on the headers stream. |
494 QUIC_INVALID_HEADERS_STREAM_DATA = 56, | 496 QUIC_INVALID_HEADERS_STREAM_DATA = 56, |
495 // The peer received too much data, violating flow control. | 497 // The peer received too much data, violating flow control. |
496 QUIC_FLOW_CONTROL_RECEIVED_TOO_MUCH_DATA = 59, | 498 QUIC_FLOW_CONTROL_RECEIVED_TOO_MUCH_DATA = 59, |
497 // The peer sent too much data, violating flow control. | 499 // The peer sent too much data, violating flow control. |
498 QUIC_FLOW_CONTROL_SENT_TOO_MUCH_DATA = 63, | 500 QUIC_FLOW_CONTROL_SENT_TOO_MUCH_DATA = 63, |
499 // The peer received an invalid flow control window. | 501 // The peer received an invalid flow control window. |
500 QUIC_FLOW_CONTROL_INVALID_WINDOW = 64, | 502 QUIC_FLOW_CONTROL_INVALID_WINDOW = 64, |
501 // The connection has been IP pooled into an existing connection. | 503 // The connection has been IP pooled into an existing connection. |
502 QUIC_CONNECTION_IP_POOLED = 62, | 504 QUIC_CONNECTION_IP_POOLED = 62, |
| 505 // The connection has too many outstanding sent packets. |
| 506 QUIC_TOO_MANY_OUTSTANDING_SENT_PACKETS = 68, |
| 507 // The connection has too many outstanding received packets. |
| 508 QUIC_TOO_MANY_OUTSTANDING_RECEIVED_PACKETS = 69, |
503 | 509 |
504 // Crypto errors. | 510 // Crypto errors. |
505 | 511 |
506 // Hanshake failed. | 512 // Hanshake failed. |
507 QUIC_HANDSHAKE_FAILED = 28, | 513 QUIC_HANDSHAKE_FAILED = 28, |
508 // Handshake message contained out of order tags. | 514 // Handshake message contained out of order tags. |
509 QUIC_CRYPTO_TAGS_OUT_OF_ORDER = 29, | 515 QUIC_CRYPTO_TAGS_OUT_OF_ORDER = 29, |
510 // Handshake message contained too many entries. | 516 // Handshake message contained too many entries. |
511 QUIC_CRYPTO_TOO_MANY_ENTRIES = 30, | 517 QUIC_CRYPTO_TOO_MANY_ENTRIES = 30, |
512 // Handshake message contained an invalid value length. | 518 // Handshake message contained an invalid value length. |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
550 // A handshake message arrived, but we are still validating the | 556 // A handshake message arrived, but we are still validating the |
551 // previous handshake message. | 557 // previous handshake message. |
552 QUIC_CRYPTO_MESSAGE_WHILE_VALIDATING_CLIENT_HELLO = 54, | 558 QUIC_CRYPTO_MESSAGE_WHILE_VALIDATING_CLIENT_HELLO = 54, |
553 // A server config update arrived before the handshake is complete. | 559 // A server config update arrived before the handshake is complete. |
554 QUIC_CRYPTO_UPDATE_BEFORE_HANDSHAKE_COMPLETE = 65, | 560 QUIC_CRYPTO_UPDATE_BEFORE_HANDSHAKE_COMPLETE = 65, |
555 // This connection involved a version negotiation which appears to have been | 561 // This connection involved a version negotiation which appears to have been |
556 // tampered with. | 562 // tampered with. |
557 QUIC_VERSION_NEGOTIATION_MISMATCH = 55, | 563 QUIC_VERSION_NEGOTIATION_MISMATCH = 55, |
558 | 564 |
559 // No error. Used as bound while iterating. | 565 // No error. Used as bound while iterating. |
560 QUIC_LAST_ERROR = 68, | 566 QUIC_LAST_ERROR = 70, |
561 }; | 567 }; |
562 | 568 |
563 struct NET_EXPORT_PRIVATE QuicPacketPublicHeader { | 569 struct NET_EXPORT_PRIVATE QuicPacketPublicHeader { |
564 QuicPacketPublicHeader(); | 570 QuicPacketPublicHeader(); |
565 explicit QuicPacketPublicHeader(const QuicPacketPublicHeader& other); | 571 explicit QuicPacketPublicHeader(const QuicPacketPublicHeader& other); |
566 ~QuicPacketPublicHeader(); | 572 ~QuicPacketPublicHeader(); |
567 | 573 |
568 // Universal header. All QuicPacket headers will have a connection_id and | 574 // Universal header. All QuicPacket headers will have a connection_id and |
569 // public flags. | 575 // public flags. |
570 QuicConnectionId connection_id; | 576 QuicConnectionId connection_id; |
(...skipping 485 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1056 std::set<QuicAckNotifier*> notifiers; | 1062 std::set<QuicAckNotifier*> notifiers; |
1057 }; | 1063 }; |
1058 | 1064 |
1059 struct NET_EXPORT_PRIVATE TransmissionInfo { | 1065 struct NET_EXPORT_PRIVATE TransmissionInfo { |
1060 // Used by STL when assigning into a map. | 1066 // Used by STL when assigning into a map. |
1061 TransmissionInfo(); | 1067 TransmissionInfo(); |
1062 | 1068 |
1063 // Constructs a Transmission with a new all_tranmissions set | 1069 // Constructs a Transmission with a new all_tranmissions set |
1064 // containing |sequence_number|. | 1070 // containing |sequence_number|. |
1065 TransmissionInfo(RetransmittableFrames* retransmittable_frames, | 1071 TransmissionInfo(RetransmittableFrames* retransmittable_frames, |
1066 QuicSequenceNumberLength sequence_number_length); | |
1067 | |
1068 // Constructs a Transmission with the specified |all_tranmissions| set | |
1069 // and inserts |sequence_number| into it. | |
1070 TransmissionInfo(RetransmittableFrames* retransmittable_frames, | |
1071 QuicSequenceNumberLength sequence_number_length, | 1072 QuicSequenceNumberLength sequence_number_length, |
1072 TransmissionType transmission_type, | 1073 TransmissionType transmission_type, |
1073 SequenceNumberList* all_transmissions); | 1074 QuicTime sent_time); |
1074 | 1075 |
1075 RetransmittableFrames* retransmittable_frames; | 1076 RetransmittableFrames* retransmittable_frames; |
1076 QuicSequenceNumberLength sequence_number_length; | 1077 QuicSequenceNumberLength sequence_number_length; |
1077 // Zero when the packet is serialized, non-zero once it's sent. | 1078 // Zero when the packet is serialized, non-zero once it's sent. |
1078 QuicTime sent_time; | 1079 QuicTime sent_time; |
1079 // Zero when the packet is serialized, non-zero once it's sent. | 1080 // Zero when the packet is serialized, non-zero once it's sent. |
1080 QuicByteCount bytes_sent; | 1081 QuicByteCount bytes_sent; |
1081 size_t nack_count; | 1082 size_t nack_count; |
1082 // Reason why this packet was transmitted. | 1083 // Reason why this packet was transmitted. |
1083 TransmissionType transmission_type; | 1084 TransmissionType transmission_type; |
1084 // Stores the sequence numbers of all transmissions of this packet. | 1085 // Stores the sequence numbers of all transmissions of this packet. |
1085 // Must always be nullptr or have multiple elements. | 1086 // Must always be nullptr or have multiple elements. |
1086 SequenceNumberList* all_transmissions; | 1087 SequenceNumberList* all_transmissions; |
1087 // In flight packets have not been abandoned or lost. | 1088 // In flight packets have not been abandoned or lost. |
1088 bool in_flight; | 1089 bool in_flight; |
1089 // True if the packet can never be acked, so it can be removed. | 1090 // True if the packet can never be acked, so it can be removed. |
1090 bool is_unackable; | 1091 bool is_unackable; |
1091 }; | 1092 }; |
1092 | 1093 |
1093 } // namespace net | 1094 } // namespace net |
1094 | 1095 |
1095 #endif // NET_QUIC_QUIC_PROTOCOL_H_ | 1096 #endif // NET_QUIC_QUIC_PROTOCOL_H_ |
OLD | NEW |