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 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
180 // The available versions of QUIC. Guaranteed that the integer value of the enum | 180 // The available versions of QUIC. Guaranteed that the integer value of the enum |
181 // will match the version number. | 181 // will match the version number. |
182 // When adding a new version to this enum you should add it to | 182 // When adding a new version to this enum you should add it to |
183 // kSupportedQuicVersions (if appropriate), and also add a new case to the | 183 // kSupportedQuicVersions (if appropriate), and also add a new case to the |
184 // helper methods QuicVersionToQuicTag, QuicTagToQuicVersion, and | 184 // helper methods QuicVersionToQuicTag, QuicTagToQuicVersion, and |
185 // QuicVersionToString. | 185 // QuicVersionToString. |
186 enum QuicVersion { | 186 enum QuicVersion { |
187 // Special case to indicate unknown/unsupported QUIC version. | 187 // Special case to indicate unknown/unsupported QUIC version. |
188 QUIC_VERSION_UNSUPPORTED = 0, | 188 QUIC_VERSION_UNSUPPORTED = 0, |
189 | 189 |
190 QUIC_VERSION_6 = 6, | |
191 QUIC_VERSION_7 = 7, | 190 QUIC_VERSION_7 = 7, |
192 QUIC_VERSION_8 = 8, // Current version. | 191 QUIC_VERSION_8 = 8, // Current version. |
193 }; | 192 }; |
194 | 193 |
195 // This vector contains QUIC versions which we currently support. | 194 // This vector contains QUIC versions which we currently support. |
196 // This should be ordered such that the highest supported version is the first | 195 // This should be ordered such that the highest supported version is the first |
197 // element, with subsequent elements in descending order (versions can be | 196 // element, with subsequent elements in descending order (versions can be |
198 // skipped as necessary). | 197 // skipped as necessary). |
199 static const QuicVersion kSupportedQuicVersions[] = | 198 static const QuicVersion kSupportedQuicVersions[] = |
200 {QUIC_VERSION_8, QUIC_VERSION_7, QUIC_VERSION_6}; | 199 {QUIC_VERSION_8, QUIC_VERSION_7}; |
201 | 200 |
202 typedef std::vector<QuicVersion> QuicVersionVector; | 201 typedef std::vector<QuicVersion> QuicVersionVector; |
203 | 202 |
204 // Upper limit on versions we support. | 203 // Upper limit on versions we support. |
205 NET_EXPORT_PRIVATE QuicVersion QuicVersionMax(); | 204 NET_EXPORT_PRIVATE QuicVersion QuicVersionMax(); |
206 | 205 |
| 206 // Lower limit on versions we support. |
| 207 NET_EXPORT_PRIVATE QuicVersion QuicVersionMin(); |
| 208 |
207 // QuicTag is written to and read from the wire, but we prefer to use | 209 // QuicTag is written to and read from the wire, but we prefer to use |
208 // the more readable QuicVersion at other levels. | 210 // the more readable QuicVersion at other levels. |
209 // Helper function which translates from a QuicVersion to a QuicTag. Returns 0 | 211 // Helper function which translates from a QuicVersion to a QuicTag. Returns 0 |
210 // if QuicVersion is unsupported. | 212 // if QuicVersion is unsupported. |
211 NET_EXPORT_PRIVATE QuicTag QuicVersionToQuicTag(const QuicVersion version); | 213 NET_EXPORT_PRIVATE QuicTag QuicVersionToQuicTag(const QuicVersion version); |
212 | 214 |
213 // Returns appropriate QuicVersion from a QuicTag. | 215 // Returns appropriate QuicVersion from a QuicTag. |
214 // Returns QUIC_VERSION_UNSUPPORTED if version_tag cannot be understood. | 216 // Returns QUIC_VERSION_UNSUPPORTED if version_tag cannot be understood. |
215 NET_EXPORT_PRIVATE QuicVersion QuicTagToQuicVersion(const QuicTag version_tag); | 217 NET_EXPORT_PRIVATE QuicVersion QuicTagToQuicVersion(const QuicTag version_tag); |
216 | 218 |
(...skipping 625 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
842 NET_EXPORT_PRIVATE friend std::ostream& operator<<( | 844 NET_EXPORT_PRIVATE friend std::ostream& operator<<( |
843 std::ostream& os, const QuicConsumedData& s); | 845 std::ostream& os, const QuicConsumedData& s); |
844 | 846 |
845 size_t bytes_consumed; | 847 size_t bytes_consumed; |
846 bool fin_consumed; | 848 bool fin_consumed; |
847 }; | 849 }; |
848 | 850 |
849 } // namespace net | 851 } // namespace net |
850 | 852 |
851 #endif // NET_QUIC_QUIC_PROTOCOL_H_ | 853 #endif // NET_QUIC_QUIC_PROTOCOL_H_ |
OLD | NEW |