/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/**
 * Copyright (c) 2014-2016,  Regents of the University of California,
 *                           Arizona Board of Regents,
 *                           Colorado State University,
 *                           University Pierre & Marie Curie, Sorbonne University,
 *                           Washington University in St. Louis,
 *                           Beijing Institute of Technology,
 *                           The University of Memphis.
 *
 * This file is part of NFD (Named Data Networking Forwarding Daemon).
 * See AUTHORS.md for complete list of NFD authors and contributors.
 *
 * NFD is free software: you can redistribute it and/or modify it under the terms
 * of the GNU General Public License as published by the Free Software Foundation,
 * either version 3 of the License, or (at your option) any later version.
 *
 * NFD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
 * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
 * PURPOSE.  See the GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License along with
 * NFD, e.g., in COPYING.md file.  If not, see <http://www.gnu.org/licenses/>.
 */

#ifndef NFD_DAEMON_FW_RTT_ESTIMATOR_HPP
#define NFD_DAEMON_FW_RTT_ESTIMATOR_HPP

#include "core/common.hpp"

namespace nfd {

/**
 * \brief implements the Mean-Deviation RTT estimator
 *
 * reference: ns3::RttMeanDeviation
 *
 * This RttEstimator algorithm is designed for TCP, which is a continuous stream.
 * NDN Interest-Data traffic is not always a continuous stream,
 * so NDN may need a different RttEstimator.
 * The design of a more suitable RttEstimator is a research question.
 */
class RttEstimator
{
public:
  typedef time::microseconds Duration;

  static Duration
  getInitialRtt(void)
  {
    return time::seconds(1);
  }

  RttEstimator(uint16_t maxMultiplier = 16,
               Duration minRto = time::milliseconds(1),
               double gain = 0.1);

  void
  addMeasurement(Duration measure);

  void
  incrementMultiplier();

  void
  doubleMultiplier();

  Duration
  computeRto() const;

private:
  uint16_t m_maxMultiplier;
  double m_minRto;

  double m_rtt;
  double m_gain;
  double m_variance;
  uint16_t m_multiplier;
  uint32_t m_nSamples;
};

} // namespace nfd

#endif // NFD_DAEMON_FW_RTT_ESTIMATOR_HPP
