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 <limits> | 8 #include <limits> |
9 #include <map> | |
9 #include <ostream> | 10 #include <ostream> |
10 #include <utility> | 11 #include <utility> |
11 #include <vector> | 12 #include <vector> |
12 | 13 |
13 #include "base/basictypes.h" | 14 #include "base/basictypes.h" |
14 #include "base/hash_tables.h" | 15 #include "base/hash_tables.h" |
15 #include "base/logging.h" | 16 #include "base/logging.h" |
16 #include "base/string_piece.h" | 17 #include "base/string_piece.h" |
17 #include "net/base/int128.h" | 18 #include "net/base/int128.h" |
18 #include "net/base/net_export.h" | 19 #include "net/base/net_export.h" |
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
161 bool fin; | 162 bool fin; |
162 uint64 offset; | 163 uint64 offset; |
163 base::StringPiece data; | 164 base::StringPiece data; |
164 }; | 165 }; |
165 | 166 |
166 typedef base::hash_set<QuicPacketSequenceNumber> SequenceSet; | 167 typedef base::hash_set<QuicPacketSequenceNumber> SequenceSet; |
167 | 168 |
168 struct NET_EXPORT_PRIVATE ReceivedPacketInfo { | 169 struct NET_EXPORT_PRIVATE ReceivedPacketInfo { |
169 ReceivedPacketInfo(); | 170 ReceivedPacketInfo(); |
170 ~ReceivedPacketInfo(); | 171 ~ReceivedPacketInfo(); |
172 | |
173 void RecordAck(QuicPacketSequenceNumber sequence_number, QuicTime time); | |
174 bool ContainsAck(QuicPacketSequenceNumber sequence_number) const; | |
175 void ClearAcksBefore(QuicPacketSequenceNumber least_unacked); | |
176 | |
171 // The highest packet sequence number we've received from the peer. | 177 // The highest packet sequence number we've received from the peer. |
172 QuicPacketSequenceNumber largest_received; | 178 QuicPacketSequenceNumber largest_received; |
173 // The time at which we received the above packet. | 179 |
174 QuicTime time_received; | 180 // The set of all received packets and their arrival times. |
jar (doing other things)
2012/11/30 16:50:33
Isn't this really the "trimmed" set? We transmit a
Ian Swett
2012/12/04 21:40:19
Agreed, comment updated in cleanup CL.
| |
175 // The set of packets which we're expecting and have not received. | 181 std::map<QuicPacketSequenceNumber, QuicTime> received_packet_times; |
176 // This includes any packets between the lowest and largest_received | |
177 // which we have neither seen nor been informed are non-retransmitting. | |
178 SequenceSet missing_packets; | |
179 }; | 182 }; |
180 | 183 |
181 struct NET_EXPORT_PRIVATE SentPacketInfo { | 184 struct NET_EXPORT_PRIVATE SentPacketInfo { |
182 SentPacketInfo(); | 185 SentPacketInfo(); |
183 ~SentPacketInfo(); | 186 ~SentPacketInfo(); |
184 // The lowest packet we've sent which is unacked, and we expect an ack for. | 187 // The lowest packet we've sent which is unacked, and we expect an ack for. |
185 QuicPacketSequenceNumber least_unacked; | 188 QuicPacketSequenceNumber least_unacked; |
186 // The set of packets between least_unacked and the last packet we have sent | |
187 // which we will not resend. | |
188 SequenceSet non_retransmiting; | |
189 }; | 189 }; |
190 | 190 |
191 // Defines for all types of congestion feedback that will be negotiated in QUIC, | 191 // Defines for all types of congestion feedback that will be negotiated in QUIC, |
192 // kTCP MUST be supported by all QUIC implementations to guarentee 100% | 192 // kTCP MUST be supported by all QUIC implementations to guarentee 100% |
193 // compatibility. | 193 // compatibility. |
194 enum CongestionFeedbackType { | 194 enum CongestionFeedbackType { |
195 kNone = 0, // No feedback provided | 195 kNone = 0, // No feedback provided |
196 kTCP, // Used to mimic TCP. | 196 kTCP, // Used to mimic TCP. |
197 kInterArrival, // Use additional inter arrival information. | 197 kInterArrival, // Use additional inter arrival information. |
198 kFixRate, // Provided for testing. | 198 kFixRate, // Provided for testing. |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
234 CongestionFeedbackType type; | 234 CongestionFeedbackType type; |
235 union { | 235 union { |
236 CongestionFeedbackMessageTCP tcp; | 236 CongestionFeedbackMessageTCP tcp; |
237 CongestionFeedbackMessageInterArrival inter_arrival; | 237 CongestionFeedbackMessageInterArrival inter_arrival; |
238 CongestionFeedbackMessageFixRate fix_rate; | 238 CongestionFeedbackMessageFixRate fix_rate; |
239 }; | 239 }; |
240 }; | 240 }; |
241 | 241 |
242 struct NET_EXPORT_PRIVATE QuicAckFrame { | 242 struct NET_EXPORT_PRIVATE QuicAckFrame { |
243 QuicAckFrame() {} | 243 QuicAckFrame() {} |
244 // Testing convenience method to construct a QuicAckFrame with all packets | |
245 // from least_unacked to largest_received acked at time_received. | |
244 QuicAckFrame(QuicPacketSequenceNumber largest_received, | 246 QuicAckFrame(QuicPacketSequenceNumber largest_received, |
245 QuicTime time_received, | 247 QuicTime time_received, |
246 QuicPacketSequenceNumber least_unacked) { | 248 QuicPacketSequenceNumber least_unacked); |
247 received_info.largest_received = largest_received; | |
248 received_info.time_received = time_received; | |
249 sent_info.least_unacked = least_unacked; | |
250 congestion_info.type = kNone; | |
251 } | |
252 | 249 |
253 NET_EXPORT_PRIVATE friend std::ostream& operator<<(std::ostream& os, | 250 NET_EXPORT_PRIVATE friend std::ostream& operator<<(std::ostream& os, |
254 const QuicAckFrame& s); | 251 const QuicAckFrame& s); |
255 | 252 |
256 SentPacketInfo sent_info; | 253 SentPacketInfo sent_info; |
257 ReceivedPacketInfo received_info; | 254 ReceivedPacketInfo received_info; |
258 CongestionInfo congestion_info; | 255 CongestionInfo congestion_info; |
259 }; | 256 }; |
260 | 257 |
261 struct NET_EXPORT_PRIVATE QuicRstStreamFrame { | 258 struct NET_EXPORT_PRIVATE QuicRstStreamFrame { |
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
398 return base::StringPiece(data() + kStartOfHashData, kStartOfEncryptedData); | 395 return base::StringPiece(data() + kStartOfHashData, kStartOfEncryptedData); |
399 } | 396 } |
400 | 397 |
401 private: | 398 private: |
402 DISALLOW_COPY_AND_ASSIGN(QuicEncryptedPacket); | 399 DISALLOW_COPY_AND_ASSIGN(QuicEncryptedPacket); |
403 }; | 400 }; |
404 | 401 |
405 } // namespace net | 402 } // namespace net |
406 | 403 |
407 #endif // NET_QUIC_QUIC_PROTOCOL_H_ | 404 #endif // NET_QUIC_QUIC_PROTOCOL_H_ |
OLD | NEW |