/* -*- 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_MGMT_RIB_MANAGER_HPP
#define NFD_DAEMON_MGMT_RIB_MANAGER_HPP

#include "manager-base.hpp"
#include "core/config-file.hpp"
#include "rib/route.hpp"

#include <ndn-cxx/mgmt/nfd/controller.hpp>
#include <ndn-cxx/mgmt/nfd/face-event-notification.hpp>
#include <ndn-cxx/mgmt/nfd/face-monitor.hpp>
#include <ndn-cxx/security/validator-config.hpp>
#include <ndn-cxx/util/scheduler.hpp>

namespace nfd {

namespace rib {
class Rib;
class RibUpdate;
} // namespace rib

/**
 * @brief Implements the RIB Management of NFD Management Protocol.
 * @sa https://redmine.named-data.net/projects/nfd/wiki/RibMgmt
 */
class RibManager : public ManagerBase
{
public:
  RibManager(rib::Rib& rib, ndn::Face& face, ndn::KeyChain& keyChain,
             ndn::nfd::Controller& nfdController, Dispatcher& dispatcher);

  /**
   * @brief Apply localhost_security configuration.
   */
  void
  applyLocalhostConfig(const ConfigSection& section, const std::string& filename);

  /**
   * @brief Apply localhop_security configuration and allow accepting commands on
   *        /localhop/nfd/rib prefix.
   */
  void
  enableLocalhop(const ConfigSection& section, const std::string& filename);

  /**
   * @brief Disallow accepting commands on /localhop/nfd/rib prefix.
   */
  void
  disableLocalhop();

  /**
   * @brief Start accepting commands and dataset requests.
   */
  void
  registerWithNfd();

  /**
   * @brief Enable NDNLP IncomingFaceId field in order to support self-registration commands.
   */
  void
  enableLocalFields();

public: // self-learning support
  enum class SlAnnounceResult {
    OK,                 ///< RIB and FIB have been updated
    ERROR,              ///< unspecified error
    VALIDATION_FAILURE, ///< the announcement cannot be verified against the trust schema
    EXPIRED,            ///< the announcement has expired
    NOT_FOUND,          ///< route does not exist (slRenew only)
  };

  using SlAnnounceCallback = std::function<void(SlAnnounceResult res)>;
  using SlFindAnnCallback = std::function<void(optional<ndn::PrefixAnnouncement>)>;

  /** \brief Insert a route by prefix announcement from self-learning strategy.
   *  \param pa A prefix announcement. It must contain the Data.
   *  \param faceId Face on which the announcement arrives.
   *  \param maxLifetime Maximum route lifetime as imposed by self-learning strategy.
   *  \param cb Callback to receive the operation result.
   *
   *  If \p pa passes validation and is unexpired, inserts or replaces a route for the announced
   *  name and faceId whose lifetime is set to the earlier of now+maxLifetime or prefix
   *  announcement expiration time, updates FIB, and invokes \p cb with SlAnnounceResult::OK.
   *  In case \p pa expires when validation completes, invokes \p cb with SlAnnounceResult::EXPIRED.
   *  If \p pa cannot be verified by the trust schema given in rib.localhop_security config key,
   *  or the relevant config has not been loaded via \c enableLocalHop, invokes \p cb with
   *  SlAnnounceResult::VALIDATION_FAILURE.
   *
   *  Self-learning strategy invokes this method after receiving a Data carrying a prefix
   *  announcement.
   */
  void
  slAnnounce(const ndn::PrefixAnnouncement& pa, uint64_t faceId, time::milliseconds maxLifetime,
             const SlAnnounceCallback& cb);

  /** \brief Renew a route created by prefix announcement from self-learning strategy.
   *  \param name Data name, for finding RIB entry by longest-prefix-match.
   *  \param faceId Nexthop face.
   *  \param maxLifetime Maximum route lifetime as imposed by self-learning strategy.
   *  \param cb Callback to receive the operation result.
   *
   *  If the specified route exists, prolongs its lifetime to the earlier of now+maxLifetime or
   *  prefix announcement expiration time, and invokes \p cb with SlAnnounceResult::OK.
   *  If the prefix announcement has expired, invokes \p cb with SlAnnounceResult::EXPIRED.
   *  If the route is not found, invokes \p cb with SlAnnounceResult::NOT_FOUND.
   *
   *  Self-learning strategy invokes this method after an Interest forwarded via a learned route
   *  is satisfied.
   *
   *  \bug In current implementation, if an slAnnounce operation is in progress to create a Route
   *       or replace a prefix announcement, slRenew could fail because Route does not exist in
   *       existing RIB, or overwrite the new prefix announcement with an old one.
   */
  void
  slRenew(const Name& name, uint64_t faceId, time::milliseconds maxLifetime,
          const SlAnnounceCallback& cb);

  /** \brief Retrieve an outgoing prefix announcement for self-learning strategy.
   *  \param name Data name.
   *  \param cb Callback to receive a prefix announcement that announces a prefix of \p name, or
   *            nullopt if no RIB entry is found by longest-prefix-match of \p name.
   *
   *  Self-learning strategy invokes this method before sending a Data in reply to a discovery
   *  Interest, so as to attach a prefix announcement onto that Data.
   *
   *  \bug In current implementation, if an slAnnounce operation is in progress, slFindAnn does not
   *       wait for that operation to complete and its result reflects the prior RIB state.
   */
  void
  slFindAnn(const Name& name, const SlFindAnnCallback& cb) const;

private: // RIB and FibUpdater actions
  enum class RibUpdateResult
  {
    OK,
    ERROR,
    EXPIRED,
  };

  static SlAnnounceResult
  getSlAnnounceResultFromRibUpdateResult(RibUpdateResult r);

  /** \brief Start adding a route to RIB and FIB.
   *  \param name route name
   *  \param route route parameters; may contain absolute expiration time
   *  \param expires relative expiration time; if specified, overwrites \c route.expires
   *  \param done completion callback
   */
  void
  beginAddRoute(const Name& name, rib::Route route, optional<time::nanoseconds> expires,
                const std::function<void(RibUpdateResult)>& done);

  /** \brief Start removing a route from RIB and FIB.
   *  \param name route name
   *  \param route route parameters
   *  \param done completion callback
   */
  void
  beginRemoveRoute(const Name& name, const rib::Route& route,
                   const std::function<void(RibUpdateResult)>& done);

  void
  beginRibUpdate(const rib::RibUpdate& update,
                 const std::function<void(RibUpdateResult)>& done);

private: // management Dispatcher related
  void
  registerTopPrefix(const Name& topPrefix);

  /** \brief Serve rib/register command.
   */
  void
  registerEntry(const Name& topPrefix, const Interest& interest,
                ControlParameters parameters,
                const ndn::mgmt::CommandContinuation& done);

  /** \brief Serve rib/unregister command.
   */
  void
  unregisterEntry(const Name& topPrefix, const Interest& interest,
                  ControlParameters parameters,
                  const ndn::mgmt::CommandContinuation& done);

  /** \brief Serve rib/list dataset.
   */
  void
  listEntries(const Name& topPrefix, const Interest& interest,
              ndn::mgmt::StatusDatasetContext& context);

  void
  setFaceForSelfRegistration(const Interest& request, ControlParameters& parameters);

  ndn::mgmt::Authorization
  makeAuthorization(const std::string& verb) override;

private: // Face monitor
  void
  fetchActiveFaces();

  void
  onFetchActiveFacesFailure(uint32_t code, const std::string& reason);

  void
  onFaceDestroyedEvent(uint64_t faceId);

PUBLIC_WITH_TESTS_ELSE_PRIVATE:
  void
  scheduleActiveFaceFetch(const time::seconds& timeToWait);

  void
  removeInvalidFaces(const std::vector<ndn::nfd::FaceStatus>& activeFaces);

  void
  onNotification(const ndn::nfd::FaceEventNotification& notification);

public:
  static const Name LOCALHOP_TOP_PREFIX;

private:
  rib::Rib& m_rib;
  ndn::KeyChain& m_keyChain;
  ndn::nfd::Controller& m_nfdController;
  Dispatcher& m_dispatcher;

  ndn::nfd::FaceMonitor m_faceMonitor;
  ndn::ValidatorConfig m_localhostValidator;
  ndn::ValidatorConfig m_localhopValidator;
  bool m_isLocalhopEnabled;

  scheduler::ScopedEventId m_activeFaceFetchEvent;
  using FaceIdSet = std::set<uint64_t>;
  FaceIdSet m_registeredFaces; ///< contains FaceIds with one or more Routes in the RIB
};

std::ostream&
operator<<(std::ostream& os, RibManager::SlAnnounceResult res);

} // namespace nfd

#endif // NFD_DAEMON_MGMT_RIB_MANAGER_HPP
