Home | History | Annotate | Download | only in congestion_control
      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 // The pure virtual class for receive side congestion algorithm.
      6 
      7 #ifndef NET_QUIC_CONGESTION_CONTROL_RECEIVE_ALGORITHM_INTERFACE_H_
      8 #define NET_QUIC_CONGESTION_CONTROL_RECEIVE_ALGORITHM_INTERFACE_H_
      9 
     10 #include "base/basictypes.h"
     11 #include "net/base/net_export.h"
     12 #include "net/quic/quic_clock.h"
     13 #include "net/quic/quic_protocol.h"
     14 #include "net/quic/quic_time.h"
     15 
     16 namespace net {
     17 
     18 class NET_EXPORT_PRIVATE ReceiveAlgorithmInterface {
     19  public:
     20   static ReceiveAlgorithmInterface* Create(const QuicClock* clock,
     21                                            CongestionFeedbackType type);
     22 
     23   virtual ~ReceiveAlgorithmInterface() {}
     24 
     25   // Returns false if no QuicCongestionFeedbackFrame block is needed.
     26   // Otherwise fills in feedback and return true.
     27   virtual bool GenerateCongestionFeedback(
     28       QuicCongestionFeedbackFrame* feedback) = 0;
     29 
     30   // Should be called for each incoming packet.
     31   // bytes: is the packet size in bytes including IP headers.
     32   // sequence_number: is the unique sequence number from the QUIC packet header.
     33   // timestamp: is the sent timestamp from the QUIC packet header.
     34   // revived: is set if the packet is lost and then recovered with help of FEC
     35   // (Forward Error Correction) packet(s).
     36   virtual void RecordIncomingPacket(QuicByteCount bytes,
     37                                     QuicPacketSequenceNumber sequence_number,
     38                                     QuicTime timestamp,
     39                                     bool revived) = 0;
     40 };
     41 
     42 }  // namespace net
     43 
     44 #endif  // NET_QUIC_CONGESTION_CONTROL_RECEIVE_ALGORITHM_INTERFACE_H_
     45