| 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> | |
| 10 #include <ostream> | 9 #include <ostream> |
| 11 #include <utility> | 10 #include <utility> |
| 12 #include <vector> | 11 #include <vector> |
| 13 | 12 |
| 14 #include "base/basictypes.h" | 13 #include "base/basictypes.h" |
| 15 #include "base/hash_tables.h" | 14 #include "base/hash_tables.h" |
| 16 #include "base/logging.h" | 15 #include "base/logging.h" |
| 17 #include "base/string_piece.h" | 16 #include "base/string_piece.h" |
| 18 #include "net/base/int128.h" | 17 #include "net/base/int128.h" |
| 19 #include "net/base/net_export.h" | 18 #include "net/base/net_export.h" |
| (...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 162 bool fin; | 161 bool fin; |
| 163 uint64 offset; | 162 uint64 offset; |
| 164 base::StringPiece data; | 163 base::StringPiece data; |
| 165 }; | 164 }; |
| 166 | 165 |
| 167 typedef base::hash_set<QuicPacketSequenceNumber> SequenceSet; | 166 typedef base::hash_set<QuicPacketSequenceNumber> SequenceSet; |
| 168 | 167 |
| 169 struct NET_EXPORT_PRIVATE ReceivedPacketInfo { | 168 struct NET_EXPORT_PRIVATE ReceivedPacketInfo { |
| 170 ReceivedPacketInfo(); | 169 ReceivedPacketInfo(); |
| 171 ~ReceivedPacketInfo(); | 170 ~ReceivedPacketInfo(); |
| 172 | |
| 173 void RecordAck(QuicPacketSequenceNumber sequence_number, QuicTime time); | |
| 174 bool ContainsAck(QuicPacketSequenceNumber sequence_number) const; | |
| 175 void ClearAcksBefore(QuicPacketSequenceNumber least_unacked); | |
| 176 | |
| 177 // The highest packet sequence number we've received from the peer. | 171 // The highest packet sequence number we've received from the peer. |
| 178 QuicPacketSequenceNumber largest_received; | 172 QuicPacketSequenceNumber largest_received; |
| 179 | 173 // The time at which we received the above packet. |
| 180 // The set of all received packets and their arrival times. | 174 QuicTime time_received; |
| 181 std::map<QuicPacketSequenceNumber, QuicTime> received_packet_times; | 175 // The set of packets which we're expecting and have not received. |
| 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; |
| 182 }; | 179 }; |
| 183 | 180 |
| 184 struct NET_EXPORT_PRIVATE SentPacketInfo { | 181 struct NET_EXPORT_PRIVATE SentPacketInfo { |
| 185 SentPacketInfo(); | 182 SentPacketInfo(); |
| 186 ~SentPacketInfo(); | 183 ~SentPacketInfo(); |
| 187 // The lowest packet we've sent which is unacked, and we expect an ack for. | 184 // The lowest packet we've sent which is unacked, and we expect an ack for. |
| 188 QuicPacketSequenceNumber least_unacked; | 185 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. | |
| 246 QuicAckFrame(QuicPacketSequenceNumber largest_received, | 244 QuicAckFrame(QuicPacketSequenceNumber largest_received, |
| 247 QuicTime time_received, | 245 QuicTime time_received, |
| 248 QuicPacketSequenceNumber least_unacked); | 246 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 } |
| 249 | 252 |
| 250 NET_EXPORT_PRIVATE friend std::ostream& operator<<(std::ostream& os, | 253 NET_EXPORT_PRIVATE friend std::ostream& operator<<(std::ostream& os, |
| 251 const QuicAckFrame& s); | 254 const QuicAckFrame& s); |
| 252 | 255 |
| 253 SentPacketInfo sent_info; | 256 SentPacketInfo sent_info; |
| 254 ReceivedPacketInfo received_info; | 257 ReceivedPacketInfo received_info; |
| 255 CongestionInfo congestion_info; | 258 CongestionInfo congestion_info; |
| 256 }; | 259 }; |
| 257 | 260 |
| 258 struct NET_EXPORT_PRIVATE QuicRstStreamFrame { | 261 struct NET_EXPORT_PRIVATE QuicRstStreamFrame { |
| (...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 395 return base::StringPiece(data() + kStartOfHashData, kStartOfEncryptedData); | 398 return base::StringPiece(data() + kStartOfHashData, kStartOfEncryptedData); |
| 396 } | 399 } |
| 397 | 400 |
| 398 private: | 401 private: |
| 399 DISALLOW_COPY_AND_ASSIGN(QuicEncryptedPacket); | 402 DISALLOW_COPY_AND_ASSIGN(QuicEncryptedPacket); |
| 400 }; | 403 }; |
| 401 | 404 |
| 402 } // namespace net | 405 } // namespace net |
| 403 | 406 |
| 404 #endif // NET_QUIC_QUIC_PROTOCOL_H_ | 407 #endif // NET_QUIC_QUIC_PROTOCOL_H_ |
| OLD | NEW |