summaryrefslogtreecommitdiffstats
path: root/net/quic/congestion_control/tcp_loss_algorithm.h
blob: 06f62568f06cc5c80c4873d6cf2c85c7e3b03235 (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 2014 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.

#ifndef NET_QUIC_CONGESTION_CONTROL_TCP_LOSS_ALGORITHM_H_
#define NET_QUIC_CONGESTION_CONTROL_TCP_LOSS_ALGORITHM_H_

#include <algorithm>
#include <map>

#include "base/basictypes.h"
#include "net/quic/congestion_control/loss_detection_interface.h"
#include "net/quic/quic_protocol.h"
#include "net/quic/quic_time.h"
#include "net/quic/quic_unacked_packet_map.h"

namespace net {

// Class which implement's TCP's approach of detecting loss when 3 nacks have
// been received for a packet.  Also implements TCP's early retransmit(RFC5827).
class NET_EXPORT_PRIVATE TCPLossAlgorithm : public LossDetectionInterface {
 public:
  TCPLossAlgorithm();
  virtual ~TCPLossAlgorithm() {}

  virtual LossDetectionType GetLossDetectionType() const OVERRIDE;

  // Uses nack counts to decide when packets are lost.
  virtual SequenceNumberSet DetectLostPackets(
      const QuicUnackedPacketMap& unacked_packets,
      const QuicTime& time,
      QuicPacketSequenceNumber largest_observed,
      const RttStats& rtt_stats) OVERRIDE;

  // Returns a non-zero value when the early retransmit timer is active.
  virtual QuicTime GetLossTimeout() const OVERRIDE;

 private:
  QuicTime loss_detection_timeout_;
};

}  // namespace net

#endif  // NET_QUIC_CONGESTION_CONTROL_TCP_LOSS_ALGORITHM_H_