| 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 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 191 | 191 |
| 192 struct NET_EXPORT_PRIVATE ReceivedPacketInfo { | 192 struct NET_EXPORT_PRIVATE ReceivedPacketInfo { |
| 193 ReceivedPacketInfo(); | 193 ReceivedPacketInfo(); |
| 194 ~ReceivedPacketInfo(); | 194 ~ReceivedPacketInfo(); |
| 195 NET_EXPORT_PRIVATE friend std::ostream& operator<<( | 195 NET_EXPORT_PRIVATE friend std::ostream& operator<<( |
| 196 std::ostream& os, const ReceivedPacketInfo& s); | 196 std::ostream& os, const ReceivedPacketInfo& s); |
| 197 | 197 |
| 198 // Records a packet receipt. | 198 // Records a packet receipt. |
| 199 void RecordReceived(QuicPacketSequenceNumber sequence_number); | 199 void RecordReceived(QuicPacketSequenceNumber sequence_number); |
| 200 | 200 |
| 201 // True if the sequence number is greater than largest_received or is listed | 201 // True if the sequence number is greater than largest_observed or is listed |
| 202 // as missing. | 202 // as missing. |
| 203 // Always returns false for sequence numbers less than least_unacked. | 203 // Always returns false for sequence numbers less than least_unacked. |
| 204 bool IsAwaitingPacket(QuicPacketSequenceNumber sequence_number) const; | 204 bool IsAwaitingPacket(QuicPacketSequenceNumber sequence_number) const; |
| 205 | 205 |
| 206 // Clears all missing packets less than |least_unacked|. | 206 // Clears all missing packets less than |least_unacked|. |
| 207 void ClearMissingBefore(QuicPacketSequenceNumber least_unacked); | 207 void ClearMissingBefore(QuicPacketSequenceNumber least_unacked); |
| 208 | 208 |
| 209 // The highest packet sequence number we've received from the peer. | 209 // The highest packet sequence number we've observed from the peer. |
| 210 QuicPacketSequenceNumber largest_received; | 210 // |
| 211 // In general, this should be the largest packet number we've received. In |
| 212 // the case of truncated acks, we may have to advertise a lower "upper bound" |
| 213 // than largest received, to avoid implicitly acking missing packets that |
| 214 // don't fit in the missing packet list due to size limitations. In this |
| 215 // case, largest_observed may be a packet which is also in the missing packets |
| 216 // list. |
| 217 QuicPacketSequenceNumber largest_observed; |
| 211 | 218 |
| 212 // The set of packets which we're expecting and have not received. | 219 // The set of packets which we're expecting and have not received. |
| 213 SequenceSet missing_packets; | 220 SequenceSet missing_packets; |
| 214 }; | 221 }; |
| 215 | 222 |
| 216 struct NET_EXPORT_PRIVATE SentPacketInfo { | 223 struct NET_EXPORT_PRIVATE SentPacketInfo { |
| 217 SentPacketInfo(); | 224 SentPacketInfo(); |
| 218 ~SentPacketInfo(); | 225 ~SentPacketInfo(); |
| 219 NET_EXPORT_PRIVATE friend std::ostream& operator<<( | 226 NET_EXPORT_PRIVATE friend std::ostream& operator<<( |
| 220 std::ostream& os, const SentPacketInfo& s); | 227 std::ostream& os, const SentPacketInfo& s); |
| 221 | 228 |
| 222 // The lowest packet we've sent which is unacked, and we expect an ack for. | 229 // The lowest packet we've sent which is unacked, and we expect an ack for. |
| 223 QuicPacketSequenceNumber least_unacked; | 230 QuicPacketSequenceNumber least_unacked; |
| 224 }; | 231 }; |
| 225 | 232 |
| 226 struct NET_EXPORT_PRIVATE QuicAckFrame { | 233 struct NET_EXPORT_PRIVATE QuicAckFrame { |
| 227 QuicAckFrame() {} | 234 QuicAckFrame() {} |
| 228 // Testing convenience method to construct a QuicAckFrame with all packets | 235 // Testing convenience method to construct a QuicAckFrame with all packets |
| 229 // from least_unacked to largest_received acked. | 236 // from least_unacked to largest_observed acked. |
| 230 QuicAckFrame(QuicPacketSequenceNumber largest_received, | 237 QuicAckFrame(QuicPacketSequenceNumber largest_observed, |
| 231 QuicPacketSequenceNumber least_unacked); | 238 QuicPacketSequenceNumber least_unacked); |
| 232 | 239 |
| 233 NET_EXPORT_PRIVATE friend std::ostream& operator<<( | 240 NET_EXPORT_PRIVATE friend std::ostream& operator<<( |
| 234 std::ostream& os, const QuicAckFrame& s); | 241 std::ostream& os, const QuicAckFrame& s); |
| 235 | 242 |
| 236 SentPacketInfo sent_info; | 243 SentPacketInfo sent_info; |
| 237 ReceivedPacketInfo received_info; | 244 ReceivedPacketInfo received_info; |
| 238 }; | 245 }; |
| 239 | 246 |
| 240 // Defines for all types of congestion feedback that will be negotiated in QUIC, | 247 // Defines for all types of congestion feedback that will be negotiated in QUIC, |
| (...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 426 return base::StringPiece(data() + kStartOfHashData, kStartOfEncryptedData); | 433 return base::StringPiece(data() + kStartOfHashData, kStartOfEncryptedData); |
| 427 } | 434 } |
| 428 | 435 |
| 429 private: | 436 private: |
| 430 DISALLOW_COPY_AND_ASSIGN(QuicEncryptedPacket); | 437 DISALLOW_COPY_AND_ASSIGN(QuicEncryptedPacket); |
| 431 }; | 438 }; |
| 432 | 439 |
| 433 } // namespace net | 440 } // namespace net |
| 434 | 441 |
| 435 #endif // NET_QUIC_QUIC_PROTOCOL_H_ | 442 #endif // NET_QUIC_QUIC_PROTOCOL_H_ |
| OLD | NEW |