12a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)// Copyright (c) 2012 The Chromium Authors. All rights reserved.
22a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)// Use of this source code is governed by a BSD-style license that can be
32a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)// found in the LICENSE file.
42a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)//
52a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)// TCP receiver side congestion algorithm, emulates the behaviour of TCP.
62a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)
72a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)#ifndef NET_QUIC_CONGESTION_CONTROL_TCP_RECEIVER_H_
82a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)#define NET_QUIC_CONGESTION_CONTROL_TCP_RECEIVER_H_
92a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)
102a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)#include "base/basictypes.h"
112a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)#include "base/compiler_specific.h"
122a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)#include "net/base/net_export.h"
132a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)#include "net/quic/congestion_control/receive_algorithm_interface.h"
142a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)#include "net/quic/quic_clock.h"
152a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)#include "net/quic/quic_protocol.h"
162a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)
172a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)namespace net {
182a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)
192a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)class NET_EXPORT_PRIVATE TcpReceiver : public ReceiveAlgorithmInterface {
202a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) public:
212a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  TcpReceiver();
222a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)
231e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles)  // Size of the (currently fixed) receive window.
241e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles)  static const QuicByteCount kReceiveWindowTCP;
251e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles)
262a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  // Start implementation of SendAlgorithmInterface.
272a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  virtual bool GenerateCongestionFeedback(
282a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)      QuicCongestionFeedbackFrame* feedback) OVERRIDE;
292a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)
302a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  virtual void RecordIncomingPacket(QuicByteCount bytes,
312a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)                                    QuicPacketSequenceNumber sequence_number,
322a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)                                    QuicTime timestamp,
332a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)                                    bool revived) OVERRIDE;
342a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)
352a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) private:
362a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  // We need to keep track of FEC recovered packets.
372a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  int accumulated_number_of_recoverd_lost_packets_;
382a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  QuicByteCount receive_window_;
392a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)
402a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  DISALLOW_COPY_AND_ASSIGN(TcpReceiver);
412a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)};
422a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)
432a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)}  // namespace net
442a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)#endif  // NET_QUIC_CONGESTION_CONTROL_TCP_RECEIVER_H_
45