| 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 613 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 624 // informed. | 624 // informed. |
| 625 QuicAckNotifier* notifier; | 625 QuicAckNotifier* notifier; |
| 626 }; | 626 }; |
| 627 | 627 |
| 628 // TODO(ianswett): Re-evaluate the trade-offs of hash_set vs set when framing | 628 // TODO(ianswett): Re-evaluate the trade-offs of hash_set vs set when framing |
| 629 // is finalized. | 629 // is finalized. |
| 630 typedef std::set<QuicPacketSequenceNumber> SequenceNumberSet; | 630 typedef std::set<QuicPacketSequenceNumber> SequenceNumberSet; |
| 631 // TODO(pwestin): Add a way to enforce the max size of this map. | 631 // TODO(pwestin): Add a way to enforce the max size of this map. |
| 632 typedef std::map<QuicPacketSequenceNumber, QuicTime> TimeMap; | 632 typedef std::map<QuicPacketSequenceNumber, QuicTime> TimeMap; |
| 633 | 633 |
| 634 struct NET_EXPORT_PRIVATE ReceivedPacketInfo { | 634 struct NET_EXPORT_PRIVATE QuicStopWaitingFrame { |
| 635 ReceivedPacketInfo(); | 635 QuicStopWaitingFrame(); |
| 636 ~ReceivedPacketInfo(); | 636 ~QuicStopWaitingFrame(); |
| 637 | 637 |
| 638 NET_EXPORT_PRIVATE friend std::ostream& operator<<( | 638 NET_EXPORT_PRIVATE friend std::ostream& operator<<( |
| 639 std::ostream& os, const ReceivedPacketInfo& s); | 639 std::ostream& os, const QuicStopWaitingFrame& s); |
| 640 // Entropy hash of all packets up to, but not including, the least unacked |
| 641 // packet. |
| 642 QuicPacketEntropyHash entropy_hash; |
| 643 // The lowest packet we've sent which is unacked, and we expect an ack for. |
| 644 QuicPacketSequenceNumber least_unacked; |
| 645 }; |
| 646 |
| 647 struct NET_EXPORT_PRIVATE QuicAckFrame { |
| 648 QuicAckFrame(); |
| 649 ~QuicAckFrame(); |
| 650 |
| 651 NET_EXPORT_PRIVATE friend std::ostream& operator<<( |
| 652 std::ostream& os, const QuicAckFrame& s); |
| 640 | 653 |
| 641 // Entropy hash of all packets up to largest observed not including missing | 654 // Entropy hash of all packets up to largest observed not including missing |
| 642 // packets. | 655 // packets. |
| 643 QuicPacketEntropyHash entropy_hash; | 656 QuicPacketEntropyHash entropy_hash; |
| 644 | 657 |
| 645 // The highest packet sequence number we've observed from the peer. | 658 // The highest packet sequence number we've observed from the peer. |
| 646 // | 659 // |
| 647 // In general, this should be the largest packet number we've received. In | 660 // In general, this should be the largest packet number we've received. In |
| 648 // the case of truncated acks, we may have to advertise a lower "upper bound" | 661 // the case of truncated acks, we may have to advertise a lower "upper bound" |
| 649 // than largest received, to avoid implicitly acking missing packets that | 662 // than largest received, to avoid implicitly acking missing packets that |
| (...skipping 16 matching lines...) Expand all Loading... |
| 666 | 679 |
| 667 // Packets which have been revived via FEC. | 680 // Packets which have been revived via FEC. |
| 668 // All of these must also be in missing_packets. | 681 // All of these must also be in missing_packets. |
| 669 SequenceNumberSet revived_packets; | 682 SequenceNumberSet revived_packets; |
| 670 }; | 683 }; |
| 671 | 684 |
| 672 // True if the sequence number is greater than largest_observed or is listed | 685 // True if the sequence number is greater than largest_observed or is listed |
| 673 // as missing. | 686 // as missing. |
| 674 // Always returns false for sequence numbers less than least_unacked. | 687 // Always returns false for sequence numbers less than least_unacked. |
| 675 bool NET_EXPORT_PRIVATE IsAwaitingPacket( | 688 bool NET_EXPORT_PRIVATE IsAwaitingPacket( |
| 676 const ReceivedPacketInfo& received_info, | 689 const QuicAckFrame& ack_frame, |
| 677 QuicPacketSequenceNumber sequence_number); | 690 QuicPacketSequenceNumber sequence_number); |
| 678 | 691 |
| 679 // Inserts missing packets between [lower, higher). | 692 // Inserts missing packets between [lower, higher). |
| 680 void NET_EXPORT_PRIVATE InsertMissingPacketsBetween( | 693 void NET_EXPORT_PRIVATE InsertMissingPacketsBetween( |
| 681 ReceivedPacketInfo* received_info, | 694 QuicAckFrame* ack_frame, |
| 682 QuicPacketSequenceNumber lower, | 695 QuicPacketSequenceNumber lower, |
| 683 QuicPacketSequenceNumber higher); | 696 QuicPacketSequenceNumber higher); |
| 684 | 697 |
| 685 struct NET_EXPORT_PRIVATE QuicStopWaitingFrame { | |
| 686 QuicStopWaitingFrame(); | |
| 687 ~QuicStopWaitingFrame(); | |
| 688 | |
| 689 NET_EXPORT_PRIVATE friend std::ostream& operator<<( | |
| 690 std::ostream& os, const QuicStopWaitingFrame& s); | |
| 691 | |
| 692 // Entropy hash of all packets up to, but not including, the least unacked | |
| 693 // packet. | |
| 694 QuicPacketEntropyHash entropy_hash; | |
| 695 // The lowest packet we've sent which is unacked, and we expect an ack for. | |
| 696 QuicPacketSequenceNumber least_unacked; | |
| 697 }; | |
| 698 | |
| 699 struct NET_EXPORT_PRIVATE QuicAckFrame { | |
| 700 QuicAckFrame(); | |
| 701 | |
| 702 NET_EXPORT_PRIVATE friend std::ostream& operator<<( | |
| 703 std::ostream& os, const QuicAckFrame& s); | |
| 704 | |
| 705 // TODO(ianswett): Inline the fields of received_info. | |
| 706 ReceivedPacketInfo received_info; | |
| 707 }; | |
| 708 | |
| 709 // Defines for all types of congestion feedback that will be negotiated in QUIC, | 698 // Defines for all types of congestion feedback that will be negotiated in QUIC, |
| 710 // kTCP MUST be supported by all QUIC implementations to guarantee 100% | 699 // kTCP MUST be supported by all QUIC implementations to guarantee 100% |
| 711 // compatibility. | 700 // compatibility. |
| 712 enum CongestionFeedbackType { | 701 enum CongestionFeedbackType { |
| 713 kTCP, // Used to mimic TCP. | 702 kTCP, // Used to mimic TCP. |
| 714 kInterArrival, // Use additional inter arrival information. | 703 kInterArrival, // Use additional inter arrival information. |
| 715 }; | 704 }; |
| 716 | 705 |
| 717 // Defines for all types of congestion control algorithms that can be used in | 706 // Defines for all types of congestion control algorithms that can be used in |
| 718 // QUIC. Note that this is separate from the congestion feedback type - | 707 // QUIC. Note that this is separate from the congestion feedback type - |
| (...skipping 345 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1064 // Stores the sequence numbers of all transmissions of this packet. | 1053 // Stores the sequence numbers of all transmissions of this packet. |
| 1065 // Can never be null. | 1054 // Can never be null. |
| 1066 SequenceNumberSet* all_transmissions; | 1055 SequenceNumberSet* all_transmissions; |
| 1067 // In flight packets have not been abandoned or lost. | 1056 // In flight packets have not been abandoned or lost. |
| 1068 bool in_flight; | 1057 bool in_flight; |
| 1069 }; | 1058 }; |
| 1070 | 1059 |
| 1071 } // namespace net | 1060 } // namespace net |
| 1072 | 1061 |
| 1073 #endif // NET_QUIC_QUIC_PROTOCOL_H_ | 1062 #endif // NET_QUIC_QUIC_PROTOCOL_H_ |
| OLD | NEW |