| 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 238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 249 // When adding a new version to this enum you should add it to | 249 // When adding a new version to this enum you should add it to |
| 250 // kSupportedQuicVersions (if appropriate), and also add a new case to the | 250 // kSupportedQuicVersions (if appropriate), and also add a new case to the |
| 251 // helper methods QuicVersionToQuicTag, QuicTagToQuicVersion, and | 251 // helper methods QuicVersionToQuicTag, QuicTagToQuicVersion, and |
| 252 // QuicVersionToString. | 252 // QuicVersionToString. |
| 253 enum QuicVersion { | 253 enum QuicVersion { |
| 254 // Special case to indicate unknown/unsupported QUIC version. | 254 // Special case to indicate unknown/unsupported QUIC version. |
| 255 QUIC_VERSION_UNSUPPORTED = 0, | 255 QUIC_VERSION_UNSUPPORTED = 0, |
| 256 | 256 |
| 257 QUIC_VERSION_12 = 12, | 257 QUIC_VERSION_12 = 12, |
| 258 QUIC_VERSION_13 = 13, | 258 QUIC_VERSION_13 = 13, |
| 259 QUIC_VERSION_14 = 14, // Current version. | 259 QUIC_VERSION_14 = 14, |
| 260 QUIC_VERSION_15 = 15, // Current version. |
| 260 }; | 261 }; |
| 261 | 262 |
| 262 // This vector contains QUIC versions which we currently support. | 263 // This vector contains QUIC versions which we currently support. |
| 263 // This should be ordered such that the highest supported version is the first | 264 // This should be ordered such that the highest supported version is the first |
| 264 // element, with subsequent elements in descending order (versions can be | 265 // element, with subsequent elements in descending order (versions can be |
| 265 // skipped as necessary). | 266 // skipped as necessary). |
| 266 // | 267 // |
| 267 // IMPORTANT: if you are addding to this list, follow the instructions at | 268 // IMPORTANT: if you are addding to this list, follow the instructions at |
| 268 // http://sites/quic/adding-and-removing-versions | 269 // http://sites/quic/adding-and-removing-versions |
| 269 static const QuicVersion kSupportedQuicVersions[] = {QUIC_VERSION_14, | 270 static const QuicVersion kSupportedQuicVersions[] = {QUIC_VERSION_15, |
| 271 QUIC_VERSION_14, |
| 270 QUIC_VERSION_13, | 272 QUIC_VERSION_13, |
| 271 QUIC_VERSION_12}; | 273 QUIC_VERSION_12}; |
| 272 | 274 |
| 273 typedef std::vector<QuicVersion> QuicVersionVector; | 275 typedef std::vector<QuicVersion> QuicVersionVector; |
| 274 | 276 |
| 275 // Returns a vector of QUIC versions in kSupportedQuicVersions. | 277 // Returns a vector of QUIC versions in kSupportedQuicVersions. |
| 276 NET_EXPORT_PRIVATE QuicVersionVector QuicSupportedVersions(); | 278 NET_EXPORT_PRIVATE QuicVersionVector QuicSupportedVersions(); |
| 277 | 279 |
| 278 // QuicTag is written to and read from the wire, but we prefer to use | 280 // QuicTag is written to and read from the wire, but we prefer to use |
| 279 // the more readable QuicVersion at other levels. | 281 // the more readable QuicVersion at other levels. |
| (...skipping 321 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 601 // sent. | 603 // sent. |
| 602 QuicTime::Delta delta_time_largest_observed; | 604 QuicTime::Delta delta_time_largest_observed; |
| 603 | 605 |
| 604 // TODO(satyamshekhar): Can be optimized using an interval set like data | 606 // TODO(satyamshekhar): Can be optimized using an interval set like data |
| 605 // structure. | 607 // structure. |
| 606 // The set of packets which we're expecting and have not received. | 608 // The set of packets which we're expecting and have not received. |
| 607 SequenceNumberSet missing_packets; | 609 SequenceNumberSet missing_packets; |
| 608 | 610 |
| 609 // Whether the ack had to be truncated when sent. | 611 // Whether the ack had to be truncated when sent. |
| 610 bool is_truncated; | 612 bool is_truncated; |
| 613 |
| 614 // Packets which have been revived via FEC. |
| 615 // All of these must also be in missing_packets. |
| 616 SequenceNumberSet revived_packets; |
| 611 }; | 617 }; |
| 612 | 618 |
| 613 // True if the sequence number is greater than largest_observed or is listed | 619 // True if the sequence number is greater than largest_observed or is listed |
| 614 // as missing. | 620 // as missing. |
| 615 // Always returns false for sequence numbers less than least_unacked. | 621 // Always returns false for sequence numbers less than least_unacked. |
| 616 bool NET_EXPORT_PRIVATE IsAwaitingPacket( | 622 bool NET_EXPORT_PRIVATE IsAwaitingPacket( |
| 617 const ReceivedPacketInfo& received_info, | 623 const ReceivedPacketInfo& received_info, |
| 618 QuicPacketSequenceNumber sequence_number); | 624 QuicPacketSequenceNumber sequence_number); |
| 619 | 625 |
| 620 // Inserts missing packets between [lower, higher). | 626 // Inserts missing packets between [lower, higher). |
| (...skipping 378 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 999 WriteStatus status; | 1005 WriteStatus status; |
| 1000 union { | 1006 union { |
| 1001 int bytes_written; // only valid when status is OK | 1007 int bytes_written; // only valid when status is OK |
| 1002 int error_code; // only valid when status is ERROR | 1008 int error_code; // only valid when status is ERROR |
| 1003 }; | 1009 }; |
| 1004 }; | 1010 }; |
| 1005 | 1011 |
| 1006 } // namespace net | 1012 } // namespace net |
| 1007 | 1013 |
| 1008 #endif // NET_QUIC_QUIC_PROTOCOL_H_ | 1014 #endif // NET_QUIC_QUIC_PROTOCOL_H_ |
| OLD | NEW |