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 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
86 // Limit on the delta between header IDs. | 86 // Limit on the delta between header IDs. |
87 const QuicHeaderId kMaxHeaderIdDelta = 100; | 87 const QuicHeaderId kMaxHeaderIdDelta = 100; |
88 | 88 |
89 // Reserved ID for the crypto stream. | 89 // Reserved ID for the crypto stream. |
90 // TODO(rch): ensure that this is not usable by any other streams. | 90 // TODO(rch): ensure that this is not usable by any other streams. |
91 const QuicStreamId kCryptoStreamId = 1; | 91 const QuicStreamId kCryptoStreamId = 1; |
92 | 92 |
93 // Value which indicates this packet is not FEC protected. | 93 // Value which indicates this packet is not FEC protected. |
94 const uint8 kNoFecOffset = 0xFF; | 94 const uint8 kNoFecOffset = 0xFF; |
95 | 95 |
96 const int64 kDefaultTimeoutUs = 600000000; // 10 minutes. | 96 // This is the default network timeout a for connection till the crypto |
| 97 // handshake succeeds and the negotiated timeout from the handshake is received. |
| 98 const int64 kDefaultInitialTimeoutSecs = 30; // 30 secs. |
| 99 const int64 kDefaultTimeoutSecs = 60 * 10; // 10 minutes. |
97 | 100 |
98 enum Retransmission { | 101 enum Retransmission { |
99 NOT_RETRANSMISSION, | 102 NOT_RETRANSMISSION, |
100 IS_RETRANSMISSION, | 103 IS_RETRANSMISSION, |
101 }; | 104 }; |
102 | 105 |
103 enum HasRetransmittableData { | 106 enum HasRetransmittableData { |
104 NO_RETRANSMITTABLE_DATA, | 107 NO_RETRANSMITTABLE_DATA, |
105 HAS_RETRANSMITTABLE_DATA, | 108 HAS_RETRANSMITTABLE_DATA, |
106 }; | 109 }; |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
166 // Stream rst data is malformed | 169 // Stream rst data is malformed |
167 QUIC_INVALID_RST_STREAM_DATA, | 170 QUIC_INVALID_RST_STREAM_DATA, |
168 // Connection close data is malformed. | 171 // Connection close data is malformed. |
169 QUIC_INVALID_CONNECTION_CLOSE_DATA, | 172 QUIC_INVALID_CONNECTION_CLOSE_DATA, |
170 // GoAway data is malformed. | 173 // GoAway data is malformed. |
171 QUIC_INVALID_GOAWAY_DATA, | 174 QUIC_INVALID_GOAWAY_DATA, |
172 // Ack data is malformed. | 175 // Ack data is malformed. |
173 QUIC_INVALID_ACK_DATA, | 176 QUIC_INVALID_ACK_DATA, |
174 // Version negotiation packet is malformed. | 177 // Version negotiation packet is malformed. |
175 QUIC_INVALID_VERSION_NEGOTIATION_PACKET, | 178 QUIC_INVALID_VERSION_NEGOTIATION_PACKET, |
| 179 // Public RST packet is malformed. |
| 180 QUIC_INVALID_PUBLIC_RST_PACKET, |
176 // There was an error decrypting. | 181 // There was an error decrypting. |
177 QUIC_DECRYPTION_FAILURE, | 182 QUIC_DECRYPTION_FAILURE, |
178 // There was an error encrypting. | 183 // There was an error encrypting. |
179 QUIC_ENCRYPTION_FAILURE, | 184 QUIC_ENCRYPTION_FAILURE, |
180 // The packet exceeded kMaxPacketSize. | 185 // The packet exceeded kMaxPacketSize. |
181 QUIC_PACKET_TOO_LARGE, | 186 QUIC_PACKET_TOO_LARGE, |
182 // Data was sent for a stream which did not exist. | 187 // Data was sent for a stream which did not exist. |
183 QUIC_PACKET_FOR_NONEXISTENT_STREAM, | 188 QUIC_PACKET_FOR_NONEXISTENT_STREAM, |
184 // The peer is going away. May be a client or server. | 189 // The peer is going away. May be a client or server. |
185 QUIC_PEER_GOING_AWAY, | 190 QUIC_PEER_GOING_AWAY, |
186 // A stream ID was invalid. | 191 // A stream ID was invalid. |
187 QUIC_INVALID_STREAM_ID, | 192 QUIC_INVALID_STREAM_ID, |
188 // Too many streams already open. | 193 // Too many streams already open. |
189 QUIC_TOO_MANY_OPEN_STREAMS, | 194 QUIC_TOO_MANY_OPEN_STREAMS, |
190 // Received public reset for this connection. | 195 // Received public reset for this connection. |
191 QUIC_PUBLIC_RESET, | 196 QUIC_PUBLIC_RESET, |
192 // Invalid protocol version. | 197 // Invalid protocol version. |
193 QUIC_INVALID_VERSION, | 198 QUIC_INVALID_VERSION, |
194 // Stream reset before headers decompressed. | 199 // Stream reset before headers decompressed. |
195 QUIC_STREAM_RST_BEFORE_HEADERS_DECOMPRESSED, | 200 QUIC_STREAM_RST_BEFORE_HEADERS_DECOMPRESSED, |
196 // The Header ID for a stream was too far from the previous. | 201 // The Header ID for a stream was too far from the previous. |
197 QUIC_INVALID_HEADER_ID, | 202 QUIC_INVALID_HEADER_ID, |
198 | 203 // Negotiable parameter received during handshake had invalid value. |
| 204 QUIC_INVALID_NEGOTIATED_VALUE, |
| 205 // There was an error decompressing data. |
| 206 QUIC_DECOMPRESSION_FAILURE, |
199 // We hit our prenegotiated (or default) timeout | 207 // We hit our prenegotiated (or default) timeout |
200 QUIC_CONNECTION_TIMED_OUT, | 208 QUIC_CONNECTION_TIMED_OUT, |
| 209 // There was an error encountered migrating addresses |
| 210 QUIC_ERROR_MIGRATING_ADDRESS, |
| 211 // There was an error while writing the packet. |
| 212 QUIC_PACKET_WRITE_ERROR, |
| 213 |
201 | 214 |
202 // Crypto errors. | 215 // Crypto errors. |
203 | 216 |
204 // Handshake message contained out of order tags. | 217 // Handshake message contained out of order tags. |
205 QUIC_CRYPTO_TAGS_OUT_OF_ORDER, | 218 QUIC_CRYPTO_TAGS_OUT_OF_ORDER, |
206 // Handshake message contained too many entries. | 219 // Handshake message contained too many entries. |
207 QUIC_CRYPTO_TOO_MANY_ENTRIES, | 220 QUIC_CRYPTO_TOO_MANY_ENTRIES, |
208 // Handshake message contained an invalid value length. | 221 // Handshake message contained an invalid value length. |
209 QUIC_CRYPTO_INVALID_VALUE_LENGTH, | 222 QUIC_CRYPTO_INVALID_VALUE_LENGTH, |
210 // A crypto message was received after the handshake was complete. | 223 // A crypto message was received after the handshake was complete. |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
251 // stored in memory as a little endian uint32, we need | 264 // stored in memory as a little endian uint32, we need |
252 // to reverse the order of the bytes. | 265 // to reverse the order of the bytes. |
253 // | 266 // |
254 // The TAG macro is used in header files to ensure that we don't create static | 267 // The TAG macro is used in header files to ensure that we don't create static |
255 // initialisers. In normal code, the MakeQuicTag function should be used. | 268 // initialisers. In normal code, the MakeQuicTag function should be used. |
256 #define TAG(a, b, c, d) ((d << 24) + (c << 16) + (b << 8) + a) | 269 #define TAG(a, b, c, d) ((d << 24) + (c << 16) + (b << 8) + a) |
257 const QuicTag kUnsupportedVersion = -1; | 270 const QuicTag kUnsupportedVersion = -1; |
258 // Each time the wire format changes, this need needs to be incremented. | 271 // Each time the wire format changes, this need needs to be incremented. |
259 // At some point, we will actually freeze the wire format and make an official | 272 // At some point, we will actually freeze the wire format and make an official |
260 // version number, but this works for now. | 273 // version number, but this works for now. |
261 const QuicTag kQuicVersion1 = TAG('Q', '0', '0', '1'); | 274 const QuicTag kQuicVersion1 = TAG('Q', '0', '0', '2'); |
262 #undef TAG | 275 #undef TAG |
263 | 276 |
264 // MakeQuicTag returns a value given the four bytes. For example: | 277 // MakeQuicTag returns a value given the four bytes. For example: |
265 // MakeQuicTag('C', 'H', 'L', 'O'); | 278 // MakeQuicTag('C', 'H', 'L', 'O'); |
266 uint32 NET_EXPORT_PRIVATE MakeQuicTag(char a, char b, char c, char d); | 279 uint32 NET_EXPORT_PRIVATE MakeQuicTag(char a, char b, char c, char d); |
267 | 280 |
268 struct NET_EXPORT_PRIVATE QuicPacketPublicHeader { | 281 struct NET_EXPORT_PRIVATE QuicPacketPublicHeader { |
269 QuicPacketPublicHeader(); | 282 QuicPacketPublicHeader(); |
270 explicit QuicPacketPublicHeader(const QuicPacketPublicHeader& other); | 283 explicit QuicPacketPublicHeader(const QuicPacketPublicHeader& other); |
271 ~QuicPacketPublicHeader(); | 284 ~QuicPacketPublicHeader(); |
(...skipping 431 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
703 NET_EXPORT_PRIVATE friend std::ostream& operator<<( | 716 NET_EXPORT_PRIVATE friend std::ostream& operator<<( |
704 std::ostream& os, const QuicConsumedData& s); | 717 std::ostream& os, const QuicConsumedData& s); |
705 | 718 |
706 size_t bytes_consumed; | 719 size_t bytes_consumed; |
707 bool fin_consumed; | 720 bool fin_consumed; |
708 }; | 721 }; |
709 | 722 |
710 } // namespace net | 723 } // namespace net |
711 | 724 |
712 #endif // NET_QUIC_QUIC_PROTOCOL_H_ | 725 #endif // NET_QUIC_QUIC_PROTOCOL_H_ |
OLD | NEW |