/* -*- 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_TOOLS_NDN_AUTOCONFIG_MULTICAST_DISCOVERY_HPP
#define NFD_TOOLS_NDN_AUTOCONFIG_MULTICAST_DISCOVERY_HPP

#include "base.hpp"

#include <ndn-cxx/security/validator-null.hpp>

namespace ndn {
namespace tools {
namespace autoconfig {

/**
 * @brief Multicast discovery stage
 *
 * - Request
 *
 *     The end host sends an Interest over a multicast face.
 *
 *     Interest Name is /localhop/ndn-autoconf/hub.
 *
 * - Response
 *
 *     A producer app on the HUB answer this Interest with a Data packet that contains a
 *     TLV-encoded Uri block.  The value of this block is the URI for the HUB, preferably a
 *     UDP tunnel.
 */
class MulticastDiscovery : public Base
{
public:
  /**
   * @brief Create multicast discovery stage
   * @sa Base::Base
   */
  MulticastDiscovery(Face& face, KeyChain& keyChain, const NextStageCallback& nextStageOnFailure);

  virtual void
  start() override;

private:
  void
  registerHubDiscoveryPrefix(const ConstBufferPtr& buffer);

  void
  onRegisterSuccess();

  void
  onRegisterFailure(const ControlResponse& response);

  void
  setStrategy();

  void
  onSetStrategyFailure(const ControlResponse& response);

  // Start to look for a hub (NDN hub discovery first stage)
  void
  requestHubData();

  void
  onSuccess(Data& data);

private:
  size_t m_nRequestedRegs;
  size_t m_nFinishedRegs;

  ndn::ValidatorNull m_validator;
};

} // namespace autoconfig
} // namespace tools
} // namespace ndn

#endif // NFD_TOOLS_NDN_AUTOCONFIG_MULTICAST_DISCOVERY_HPP
