/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
 * Copyright (c) 2014-2019,  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_RIB_SERVICE_HPP
#define NFD_DAEMON_RIB_SERVICE_HPP

#include "common/config-file.hpp"
#include "mgmt/rib-manager.hpp"
#include "rib/fib-updater.hpp"
#include "rib/rib.hpp"

#include <ndn-cxx/face.hpp>
#include <ndn-cxx/mgmt/dispatcher.hpp>
#include <ndn-cxx/mgmt/nfd/controller.hpp>
#include <ndn-cxx/security/key-chain.hpp>
#include <ndn-cxx/transport/transport.hpp>
#include <ndn-cxx/util/scheduler.hpp>

namespace nfd {
namespace rib {

class Readvertise;

/**
 * \brief initializes and executes NFD-RIB service thread
 *
 * Only one instance of this class can be created at any time.
 * After initialization, NFD-RIB instance can be started by running the global io_service.
 */
class Service : noncopyable
{
public:
  /**
   * \brief create NFD-RIB service
   * \param configFile absolute or relative path of configuration file
   * \param keyChain the KeyChain
   * \throw std::logic_error Instance of rib::Service has been already constructed
   * \throw std::logic_error Instance of rib::Service is not constructed on RIB thread
   */
  Service(const std::string& configFile, ndn::KeyChain& keyChain);

  /**
   * \brief create NFD-RIB service
   * \param configSection parsed configuration section
   * \param keyChain the KeyChain
   * \note This constructor overload is more appropriate for integrated environments,
   *       such as NS-3 or android. Error messages related to configuration file
   *       will use "internal://nfd.conf" as configuration filename.
   * \throw std::logic_error Instance of rib::Service has been already constructed
   * \throw std::logic_error Instance of rib::Service is not constructed on RIB thread
   */
  Service(const ConfigSection& configSection, ndn::KeyChain& keyChain);

  /**
   * \brief Destructor
   */
  ~Service();

  /**
   * \brief Get a reference to the only instance of this class
   * \throw std::logic_error No instance has been constructed
   * \throw std::logic_error This function is invoked on a thread other than the RIB thread
   */
  static Service&
  get();

  RibManager&
  getRibManager()
  {
    return m_ribManager;
  }

private:
  template<typename ConfigParseFunc>
  Service(ndn::KeyChain& keyChain, shared_ptr<ndn::Transport> localNfdTransport,
          const ConfigParseFunc& configParse);

  void
  processConfig(const ConfigSection& section, bool isDryRun, const std::string& filename);

  void
  checkConfig(const ConfigSection& section, const std::string& filename);

  void
  applyConfig(const ConfigSection& section, const std::string& filename);

private:
  static Service* s_instance;

  ndn::KeyChain& m_keyChain;
  ndn::Face m_face;
  ndn::nfd::Controller m_nfdController;

  Rib m_rib;
  FibUpdater m_fibUpdater;
  unique_ptr<Readvertise> m_readvertiseNlsr;
  unique_ptr<Readvertise> m_readvertisePropagation;
  ndn::mgmt::Dispatcher m_dispatcher;
  RibManager m_ribManager;
};

} // namespace rib
} // namespace nfd

#endif // NFD_DAEMON_RIB_SERVICE_HPP
