David Ghandehari | 9e5b587 | 2016-07-28 09:50:04 -0700 | [diff] [blame] | 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 |
| 3 | // found in the LICENSE file. |
| 4 | // |
| 5 | // This is the base class for QUIC receive side congestion control. |
| 6 | // This class will provide the QuicCongestionFeedbackFrame objects for outgoing |
| 7 | // packets if needed. |
| 8 | // The acctual receive side algorithm is implemented via the |
| 9 | // ReceiveAlgorithmInterface. |
| 10 | |
| 11 | #ifndef NET_QUIC_CONGESTION_CONTROL_QUIC_RECEIPT_METRICS_COLLECTOR_H_ |
| 12 | #define NET_QUIC_CONGESTION_CONTROL_QUIC_RECEIPT_METRICS_COLLECTOR_H_ |
| 13 | |
| 14 | #include "base/basictypes.h" |
| 15 | #include "base/memory/scoped_ptr.h" |
| 16 | #include "net/base/net_export.h" |
| 17 | #include "net/quic/congestion_control/receive_algorithm_interface.h" |
| 18 | #include "net/quic/quic_clock.h" |
| 19 | #include "net/quic/quic_protocol.h" |
| 20 | |
| 21 | namespace net { |
| 22 | |
| 23 | class NET_EXPORT_PRIVATE QuicReceiptMetricsCollector { |
| 24 | public: |
| 25 | QuicReceiptMetricsCollector(const QuicClock* clock, |
| 26 | CongestionFeedbackType congestion_type); |
| 27 | |
| 28 | virtual ~QuicReceiptMetricsCollector(); |
| 29 | |
| 30 | // Should be called for each ACK packet to decide if we need to attach a |
| 31 | // QuicCongestionFeedbackFrame block. |
| 32 | // Returns false if no QuicCongestionFeedbackFrame block is needed. |
| 33 | // Otherwise fills in feedback and return true. |
| 34 | virtual bool GenerateCongestionFeedback( |
| 35 | QuicCongestionFeedbackFrame* feedback); |
| 36 | |
| 37 | // Should be called for each incoming packet. |
| 38 | // bytes: is the packet size in bytes including IP headers. |
| 39 | // sequence_number: is the unique sequence number from the QUIC packet header. |
| 40 | // timestamp: is the sent timestamp from the QUIC packet header. |
| 41 | // TODO(pwestin) which type should we use for timestamp? |
| 42 | // revived: is set if the packet is lost and then recovered with help of a |
| 43 | // FEC packet. |
| 44 | virtual void RecordIncomingPacket(size_t bytes, |
| 45 | QuicPacketSequenceNumber sequence_number, |
| 46 | QuicTime timestamp, |
| 47 | bool revived); |
| 48 | |
| 49 | // TODO(pwestin) Keep track of the number of FEC recovered packets. |
| 50 | // Needed by all congestion control algorithms. |
| 51 | |
| 52 | private: |
| 53 | scoped_ptr<ReceiveAlgorithmInterface> receive_algorithm_; |
| 54 | }; |
| 55 | |
| 56 | } // namespace net |
| 57 | |
| 58 | #endif // NET_QUIC_CONGESTION_CONTROL_QUIC_RECEIPT_METRICS_COLLECTOR_H_ |