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

#include "module.hpp"
#include "command-parser.hpp"

namespace nfd {
namespace tools {
namespace nfdc {

using ndn::nfd::RibEntry;
using ndn::nfd::Route;

/** \brief provides access to NFD RIB management
 *  \sa https://redmine.named-data.net/projects/nfd/wiki/RibMgmt
 */
class RibModule : public Module, noncopyable
{
public:
  /** \brief register 'route list', 'route show', 'route add', 'route remove' commands
   */
  static void
  registerCommands(CommandParser& parser);

  /** \brief the 'route add' command
   */
  static void
  add(ExecuteContext& ctx);

  void
  fetchStatus(Controller& controller,
              const function<void()>& onSuccess,
              const Controller::DatasetFailCallback& onFailure,
              const CommandOptions& options) override;

  void
  formatStatusXml(std::ostream& os) const override;

  /** \brief format a single status item as XML
   *  \param os output stream
   *  \param item status item
   */
  void
  formatItemXml(std::ostream& os, const RibEntry& item) const;

  void
  formatStatusText(std::ostream& os) const override;

  /** \brief format a single status item as text
   *  \param os output stream
   *  \param item status item
   */
  void
  formatItemText(std::ostream& os, const RibEntry& item) const;

private:
  std::vector<RibEntry> m_status;
};

} // namespace nfdc
} // namespace tools
} // namespace nfd

#endif // NFD_TOOLS_NFDC_RIB_MODULE_HPP
