summaryrefslogtreecommitdiff
path: root/chromium/net/quic/congestion_control/receive_algorithm_interface.h
blob: e2bae4bb7933f3e8b0109a8a1122dd2da1ca6e72 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
// The pure virtual class for receive side congestion algorithm.

#ifndef NET_QUIC_CONGESTION_CONTROL_RECEIVE_ALGORITHM_INTERFACE_H_
#define NET_QUIC_CONGESTION_CONTROL_RECEIVE_ALGORITHM_INTERFACE_H_

#include "base/basictypes.h"
#include "net/base/net_export.h"
#include "net/quic/quic_clock.h"
#include "net/quic/quic_protocol.h"
#include "net/quic/quic_time.h"

namespace net {

class NET_EXPORT_PRIVATE ReceiveAlgorithmInterface {
 public:
  static ReceiveAlgorithmInterface* Create(const QuicClock* clock,
                                           CongestionFeedbackType type);

  virtual ~ReceiveAlgorithmInterface() {}

  // Returns false if no QuicCongestionFeedbackFrame block is needed.
  // Otherwise fills in feedback and return true.
  virtual bool GenerateCongestionFeedback(
      QuicCongestionFeedbackFrame* feedback) = 0;

  // Should be called for each incoming packet.
  // bytes: is the packet size in bytes including IP headers.
  // sequence_number: is the unique sequence number from the QUIC packet header.
  // timestamp: is the sent timestamp from the QUIC packet header.
  // revived: is set if the packet is lost and then recovered with help of FEC
  // (Forward Error Correction) packet(s).
  virtual void RecordIncomingPacket(QuicByteCount bytes,
                                    QuicPacketSequenceNumber sequence_number,
                                    QuicTime timestamp,
                                    bool revived) = 0;
};

}  // namespace net

#endif  // NET_QUIC_CONGESTION_CONTROL_RECEIVE_ALGORITHM_INTERFACE_H_