Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(573)

Side by Side Diff: net/quic/quic_protocol.h

Issue 1330973002: relnote: Refactor QuicAckFrame::missing_packets to support a change to a (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@Tidy_up_DLOG_messages_101773586
Patch Set: Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 <stdint.h> 9 #include <stdint.h>
10 #include <limits> 10 #include <limits>
(...skipping 704 matching lines...) Expand 10 before | Expand all | Expand 10 after
715 715
716 NET_EXPORT_PRIVATE friend std::ostream& operator<<( 716 NET_EXPORT_PRIVATE friend std::ostream& operator<<(
717 std::ostream& os, const QuicStopWaitingFrame& s); 717 std::ostream& os, const QuicStopWaitingFrame& s);
718 // Entropy hash of all packets up to, but not including, the least unacked 718 // Entropy hash of all packets up to, but not including, the least unacked
719 // packet. 719 // packet.
720 QuicPacketEntropyHash entropy_hash; 720 QuicPacketEntropyHash entropy_hash;
721 // The lowest packet we've sent which is unacked, and we expect an ack for. 721 // The lowest packet we've sent which is unacked, and we expect an ack for.
722 QuicPacketNumber least_unacked; 722 QuicPacketNumber least_unacked;
723 }; 723 };
724 724
725 // A sequence of packet numbers where each number is unique. Intended to be used
726 // in a sliding window fashion, where smaller old packet numbers are removed and
727 // larger new packet numbers are added, with the occasional random access.
728 class NET_EXPORT_PRIVATE PacketNumberQueue {
729 public:
730 PacketNumberQueue();
731 ~PacketNumberQueue();
732
733 using iterator = PacketNumberSet::iterator;
734 using const_iterator = PacketNumberSet::const_iterator;
735
736 // Adds |packet_number| to the set of packets in the queue.
737 void Add(QuicPacketNumber packet_number);
738
739 // Adds packets between [lower, higher) to the set of packets in the queue.
740 void Add(QuicPacketNumber lower, QuicPacketNumber higher);
741
742 // Removes |packet_number| from the set of packets in the queue.
743 void Remove(QuicPacketNumber packet_number);
744
745 // Removes packets with values less than |higher| from the set of packets in
746 // the queue. Returns true if packets were removed.
747 bool RemoveUpTo(QuicPacketNumber higher);
748
749 // Returns true if the queue contains |packet_number|.
750 bool Contains(QuicPacketNumber packet_number) const;
751
752 // Returns true if the queue is empty.
753 bool Empty() const;
754
755 // Returns the minimum packet number stored in the queue. It is undefined
756 // behavior to call this if the queue is empty.
757 QuicPacketNumber Min() const;
758
759 // Returns the maximum packet number stored in the queue. It is undefined
760 // behavior to call this if the queue is empty.
761 QuicPacketNumber Max() const;
762
763 // Returns the number of unique packets stored in the queue.
764 size_t NumPackets() const;
765
766 const_iterator begin() const;
767 const_iterator end() const;
768 const_iterator lower_bound(QuicPacketNumber packet_number) const;
769 const_iterator upper_bound(QuicPacketNumber packet_number) const;
770
771 NET_EXPORT_PRIVATE friend std::ostream& operator<<(
772 std::ostream& os,
773 const PacketNumberQueue& q);
774
775 private:
776 // TODO(jdorfman): Can be optimized using an interval set like data structure.
777 PacketNumberSet packet_numbers_;
778 };
779
725 struct NET_EXPORT_PRIVATE QuicAckFrame { 780 struct NET_EXPORT_PRIVATE QuicAckFrame {
726 QuicAckFrame(); 781 QuicAckFrame();
727 ~QuicAckFrame(); 782 ~QuicAckFrame();
728 783
729 NET_EXPORT_PRIVATE friend std::ostream& operator<<( 784 NET_EXPORT_PRIVATE friend std::ostream& operator<<(
730 std::ostream& os, const QuicAckFrame& s); 785 std::ostream& os, const QuicAckFrame& s);
731 786
732 // Entropy hash of all packets up to largest observed not including missing 787 // Entropy hash of all packets up to largest observed not including missing
733 // packets. 788 // packets.
734 QuicPacketEntropyHash entropy_hash; 789 QuicPacketEntropyHash entropy_hash;
735 790
736 // The highest packet number we've observed from the peer. 791 // The highest packet number we've observed from the peer.
737 // 792 //
738 // In general, this should be the largest packet number we've received. In 793 // In general, this should be the largest packet number we've received. In
739 // the case of truncated acks, we may have to advertise a lower "upper bound" 794 // the case of truncated acks, we may have to advertise a lower "upper bound"
740 // than largest received, to avoid implicitly acking missing packets that 795 // than largest received, to avoid implicitly acking missing packets that
741 // don't fit in the missing packet list due to size limitations. In this 796 // don't fit in the missing packet list due to size limitations. In this
742 // case, largest_observed may be a packet which is also in the missing packets 797 // case, largest_observed may be a packet which is also in the missing packets
743 // list. 798 // list.
744 QuicPacketNumber largest_observed; 799 QuicPacketNumber largest_observed;
745 800
746 // Time elapsed since largest_observed was received until this Ack frame was 801 // Time elapsed since largest_observed was received until this Ack frame was
747 // sent. 802 // sent.
748 QuicTime::Delta delta_time_largest_observed; 803 QuicTime::Delta delta_time_largest_observed;
749 804
750 // TODO(satyamshekhar): Can be optimized using an interval set like data
751 // structure.
752 // The set of packets which we're expecting and have not received. 805 // The set of packets which we're expecting and have not received.
753 PacketNumberSet missing_packets; 806 PacketNumberQueue missing_packets;
754 807
755 // Whether the ack had to be truncated when sent. 808 // Whether the ack had to be truncated when sent.
756 bool is_truncated; 809 bool is_truncated;
757 810
758 // Packets which have been revived via FEC. 811 // Packets which have been revived via FEC.
759 // All of these must also be in missing_packets. 812 // All of these must also be in missing_packets.
760 PacketNumberSet revived_packets; 813 PacketNumberSet revived_packets;
761 814
762 // List of <packet_number, time> for when packets arrived. 815 // List of <packet_number, time> for when packets arrived.
763 PacketTimeList received_packet_times; 816 PacketTimeList received_packet_times;
764 }; 817 };
765 818
766 // True if the packet number is greater than largest_observed or is listed 819 // True if the packet number is greater than largest_observed or is listed
767 // as missing. 820 // as missing.
768 // Always returns false for packet numbers less than least_unacked. 821 // Always returns false for packet numbers less than least_unacked.
769 bool NET_EXPORT_PRIVATE IsAwaitingPacket(const QuicAckFrame& ack_frame, 822 bool NET_EXPORT_PRIVATE IsAwaitingPacket(const QuicAckFrame& ack_frame,
770 QuicPacketNumber packet_number); 823 QuicPacketNumber packet_number);
771 824
772 // Inserts missing packets between [lower, higher).
773 void NET_EXPORT_PRIVATE InsertMissingPacketsBetween(QuicAckFrame* ack_frame,
774 QuicPacketNumber lower,
775 QuicPacketNumber higher);
776
777 // Defines for all types of congestion control algorithms that can be used in 825 // Defines for all types of congestion control algorithms that can be used in
778 // QUIC. Note that this is separate from the congestion feedback type - 826 // QUIC. Note that this is separate from the congestion feedback type -
779 // some congestion control algorithms may use the same feedback type 827 // some congestion control algorithms may use the same feedback type
780 // (Reno and Cubic are the classic example for that). 828 // (Reno and Cubic are the classic example for that).
781 enum CongestionControlType { 829 enum CongestionControlType {
782 kCubic, 830 kCubic,
783 kCubicBytes, 831 kCubicBytes,
784 kReno, 832 kReno,
785 kRenoBytes, 833 kRenoBytes,
786 kBBR, 834 kBBR,
(...skipping 310 matching lines...) Expand 10 before | Expand all | Expand 10 after
1097 : iov(iov), iov_count(iov_count), total_length(total_length) {} 1145 : iov(iov), iov_count(iov_count), total_length(total_length) {}
1098 1146
1099 const struct iovec* iov; 1147 const struct iovec* iov;
1100 const int iov_count; 1148 const int iov_count;
1101 const size_t total_length; 1149 const size_t total_length;
1102 }; 1150 };
1103 1151
1104 } // namespace net 1152 } // namespace net
1105 1153
1106 #endif // NET_QUIC_QUIC_PROTOCOL_H_ 1154 #endif // NET_QUIC_QUIC_PROTOCOL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698