mgmt: move management/nfd-* to mgmt/nfd/
refs #3760
Change-Id: Ib4bde3412b5c39b9f4f46113199cebe78704505e
diff --git a/src/detail/face-impl.hpp b/src/detail/face-impl.hpp
index a7c332d..998ab34 100644
--- a/src/detail/face-impl.hpp
+++ b/src/detail/face-impl.hpp
@@ -37,8 +37,8 @@
#include "../transport/unix-transport.hpp"
#include "../transport/tcp-transport.hpp"
-#include "../management/nfd-controller.hpp"
-#include "../management/nfd-command-options.hpp"
+#include "../mgmt/nfd/controller.hpp"
+#include "../mgmt/nfd/command-options.hpp"
#include "../lp/packet.hpp"
#include "../lp/tags.hpp"
diff --git a/src/detail/registered-prefix.hpp b/src/detail/registered-prefix.hpp
index bdc69bf..5b08167 100644
--- a/src/detail/registered-prefix.hpp
+++ b/src/detail/registered-prefix.hpp
@@ -27,8 +27,8 @@
#include "../interest.hpp"
#include "interest-filter-record.hpp"
-#include "management/nfd-command-options.hpp"
-#include "management/nfd-control-parameters.hpp"
+#include "mgmt/nfd/command-options.hpp"
+#include "mgmt/nfd/control-parameters.hpp"
namespace ndn {
diff --git a/src/management/nfd-channel-status.hpp b/src/management/nfd-channel-status.hpp
index 422de2b..524d9f9 100644
--- a/src/management/nfd-channel-status.hpp
+++ b/src/management/nfd-channel-status.hpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/**
- * Copyright (c) 2013-2015 Regents of the University of California.
+ * Copyright (c) 2013-2016 Regents of the University of California.
*
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
*
@@ -19,64 +19,7 @@
* See AUTHORS.md for complete list of ndn-cxx authors and contributors.
*/
-#ifndef NDN_MANAGEMENT_NFD_CHANNEL_STATUS_HPP
-#define NDN_MANAGEMENT_NFD_CHANNEL_STATUS_HPP
-
-#include "../encoding/block.hpp"
-
-namespace ndn {
-namespace nfd {
-
-/**
- * @ingroup management
- * @brief represents NFD Channel Status dataset
- * @sa http://redmine.named-data.net/projects/nfd/wiki/FaceMgmt#Channel-Dataset
+/** \file
+ * \deprecated Use mgmt/nfd/channel-status.hpp
*/
-class ChannelStatus
-{
-public:
- class Error : public tlv::Error
- {
- public:
- explicit
- Error(const std::string& what)
- : tlv::Error(what)
- {
- }
- };
-
- ChannelStatus();
-
- explicit
- ChannelStatus(const Block& payload);
-
- template<encoding::Tag TAG>
- size_t
- wireEncode(EncodingImpl<TAG>& encoder) const;
-
- const Block&
- wireEncode() const;
-
- void
- wireDecode(const Block& wire);
-
-public: // getters & setters
- const std::string&
- getLocalUri() const
- {
- return m_localUri;
- }
-
- ChannelStatus&
- setLocalUri(const std::string localUri);
-
-private:
- std::string m_localUri;
-
- mutable Block m_wire;
-};
-
-} // namespace nfd
-} // namespace ndn
-
-#endif // NDN_MANAGEMENT_NFD_CHANNEL_STATUS_HPP
+#include "../mgmt/nfd/channel-status.hpp"
diff --git a/src/management/nfd-command-options.hpp b/src/management/nfd-command-options.hpp
index 4ca0a6b..7cf8c77 100644
--- a/src/management/nfd-command-options.hpp
+++ b/src/management/nfd-command-options.hpp
@@ -19,178 +19,7 @@
* See AUTHORS.md for complete list of ndn-cxx authors and contributors.
*/
-#ifndef NDN_MANAGEMENT_NFD_COMMAND_OPTIONS_HPP
-#define NDN_MANAGEMENT_NFD_COMMAND_OPTIONS_HPP
-
-#include "../security/signing-info.hpp"
-
-#define NDN_MANAGEMENT_NFD_COMMAND_OPTIONS_KEEP_DEPRECATED_SIGNING_PARAMS
-
-namespace ndn {
-
-namespace security {
-namespace v1 {
-class IdentityCertificate;
-} // namespace v1
-} // namespace security
-
-namespace nfd {
-
-/** \ingroup management
- * \brief contains options for ControlCommand execution
- * \note This type is intentionally copyable
+/** \file
+ * \deprecated Use mgmt/nfd/command-options.hpp
*/
-class CommandOptions
-{
-public:
- /** \brief constructs CommandOptions
- * \post getTimeout() == DEFAULT_TIMEOUT
- * \post getPrefix() == DEFAULT_PREFIX
- * \post getSigningInfo().getSignerType() == SIGNER_TYPE_NULL
- */
- CommandOptions();
-
- /** \return command timeout
- */
- const time::milliseconds&
- getTimeout() const
- {
- return m_timeout;
- }
-
- /** \brief sets command timeout
- * \param timeout the new command timeout, must be positive
- * \throw std::out_of_range if timeout is non-positive
- * \return self
- */
- CommandOptions&
- setTimeout(const time::milliseconds& timeout);
-
- /** \return command prefix
- */
- const Name&
- getPrefix() const
- {
- return m_prefix;
- }
-
- /** \brief sets command prefix
- * \return self
- */
- CommandOptions&
- setPrefix(const Name& prefix);
-
- /** \return signing parameters
- */
- const security::SigningInfo&
- getSigningInfo() const
- {
- return m_signingInfo;
- }
-
- /** \brief sets signing parameters
- * \return self
- */
- CommandOptions&
- setSigningInfo(const security::SigningInfo& signingInfo);
-
-#ifdef NDN_MANAGEMENT_NFD_COMMAND_OPTIONS_KEEP_DEPRECATED_SIGNING_PARAMS
-public: // signing parameters
- /** \deprecated use getSigningInfo and setSigningInfo
- * \brief indicates the selection of signing parameters
- */
- enum SigningParamsKind {
- /** \brief picks the default signing identity and certificate
- */
- SIGNING_PARAMS_DEFAULT,
- /** \brief picks the default certificate of a specific identity Name
- */
- SIGNING_PARAMS_IDENTITY,
- /** \brief picks a specific identity certificate
- */
- SIGNING_PARAMS_CERTIFICATE
- };
-
- /** \deprecated use getSigningInfo and setSigningInfo
- * \return selection of signing parameters
- */
- DEPRECATED(
- SigningParamsKind
- getSigningParamsKind() const);
-
- /** \deprecated use getSigningInfo and setSigningInfo
- * \return identity Name
- * \pre getSigningParamsKind() == SIGNING_PARAMS_IDENTITY
- */
- DEPRECATED(
- const Name&
- getSigningIdentity() const);
-
- /** \deprecated use getSigningInfo and setSigningInfo
- * \return certificate Name
- * \pre getSigningParamsKind() == SIGNING_PARAMS_CERTIFICATE
- */
- DEPRECATED(
- const Name&
- getSigningCertificate() const);
-
- /** \deprecated use getSigningInfo and setSigningInfo
- * \brief chooses to use default identity and certificate
- * \post getSigningParamsKind() == SIGNING_PARAMS_DEFAULT
- * \return self
- */
- DEPRECATED(
- CommandOptions&
- setSigningDefault());
-
- /** \deprecated use getSigningInfo and setSigningInfo
- * \brief chooses to use a specific identity and its default certificate
- * \post getSigningParamsKind() == SIGNING_PARAMS_IDENTITY
- * \post getIdentityName() == identityName
- * \return self
- */
- DEPRECATED(
- CommandOptions&
- setSigningIdentity(const Name& identityName));
-
- /** \deprecated use getSigningInfo and setSigningInfo
- * \brief chooses to use a specific identity certificate
- * \param certificateName identity certificate Name
- * \throw std::invalid_argument if certificateName is invalid
- * \post getSigningParamsKind() == SIGNING_PARAMS_CERTIFICATE
- * \post getSigningCertificate() == certificateName
- * \return self
- */
- DEPRECATED(
- CommandOptions&
- setSigningCertificate(const Name& certificateName));
-
- /** \deprecated use getSigningInfo and setSigningInfo
- * \brief chooses to use a specific identity certificate
- * \details This is equivalent to .setIdentityCertificate(certificate.getName())
- */
- DEPRECATED(
- CommandOptions&
- setSigningCertificate(const security::v1::IdentityCertificate& certificate));
-
-#endif // NDN_MANAGEMENT_NFD_COMMAND_OPTIONS_KEEP_DEPRECATED_SIGNING_PARAMS
-
-public:
- /** \brief gives the default command timeout: 10000ms
- */
- static const time::milliseconds DEFAULT_TIMEOUT;
-
- /** \brief gives the default command prefix: ndn:/localhost/nfd
- */
- static const Name DEFAULT_PREFIX;
-
-private:
- time::milliseconds m_timeout;
- Name m_prefix;
- security::SigningInfo m_signingInfo;
-};
-
-} // namespace nfd
-} // namespace ndn
-
-#endif // NDN_MANAGEMENT_NFD_COMMAND_OPTIONS_HPP
+#include "../mgmt/nfd/command-options.hpp"
diff --git a/src/management/nfd-control-command.hpp b/src/management/nfd-control-command.hpp
index 169d837..393e174 100644
--- a/src/management/nfd-control-command.hpp
+++ b/src/management/nfd-control-command.hpp
@@ -19,330 +19,7 @@
* See AUTHORS.md for complete list of ndn-cxx authors and contributors.
*/
-#ifndef NDN_MANAGEMENT_NFD_CONTROL_COMMAND_HPP
-#define NDN_MANAGEMENT_NFD_CONTROL_COMMAND_HPP
-
-#include "nfd-control-parameters.hpp"
-
-namespace ndn {
-namespace nfd {
-
-/**
- * \ingroup management
- * \brief base class of NFD ControlCommand
- * \sa http://redmine.named-data.net/projects/nfd/wiki/ControlCommand
+/** \file
+ * \deprecated Use mgmt/nfd/control-command.hpp
*/
-class ControlCommand : noncopyable
-{
-public:
- /** \brief represents an error in ControlParameters
- */
- class ArgumentError : public std::invalid_argument
- {
- public:
- explicit
- ArgumentError(const std::string& what)
- : std::invalid_argument(what)
- {
- }
- };
-
- virtual
- ~ControlCommand();
-
- /** \brief validate request parameters
- * \throw ArgumentError if parameters are invalid
- */
- virtual void
- validateRequest(const ControlParameters& parameters) const;
-
- /** \brief apply default values to missing fields in request
- */
- virtual void
- applyDefaultsToRequest(ControlParameters& parameters) const;
-
- /** \brief validate response parameters
- * \throw ArgumentError if parameters are invalid
- */
- virtual void
- validateResponse(const ControlParameters& parameters) const;
-
- /** \brief apply default values to missing fields in response
- */
- virtual void
- applyDefaultsToResponse(ControlParameters& parameters) const;
-
- /** \brief construct the Name for a request Interest
- * \throw ArgumentError if parameters are invalid
- */
- Name
- getRequestName(const Name& commandPrefix, const ControlParameters& parameters) const;
-
-protected:
- ControlCommand(const std::string& module, const std::string& verb);
-
- class FieldValidator
- {
- public:
- FieldValidator();
-
- /** \brief declare a required field
- */
- FieldValidator&
- required(ControlParameterField field)
- {
- m_required[field] = true;
- return *this;
- }
-
- /** \brief declare an optional field
- */
- FieldValidator&
- optional(ControlParameterField field)
- {
- m_optional[field] = true;
- return *this;
- }
-
- /** \brief verify that all required fields are present,
- * and all present fields are either required or optional
- * \throw ArgumentError
- */
- void
- validate(const ControlParameters& parameters) const;
-
- private:
- std::vector<bool> m_required;
- std::vector<bool> m_optional;
- };
-
-protected:
- /** \brief FieldValidator for request ControlParameters
- *
- * Constructor of subclass should populate this validator.
- */
- FieldValidator m_requestValidator;
- /** \brief FieldValidator for response ControlParameters
- *
- * Constructor of subclass should populate this validator.
- */
- FieldValidator m_responseValidator;
-
-private:
- name::Component m_module;
- name::Component m_verb;
-};
-
-
-/**
- * \ingroup management
- * \brief represents a faces/create command
- * \sa http://redmine.named-data.net/projects/nfd/wiki/FaceMgmt#Create-a-face
- */
-class FaceCreateCommand : public ControlCommand
-{
-public:
- FaceCreateCommand();
-
- virtual void
- applyDefaultsToRequest(ControlParameters& parameters) const override;
-
- virtual void
- validateRequest(const ControlParameters& parameters) const override;
-
- virtual void
- validateResponse(const ControlParameters& parameters) const override;
-};
-
-
-/**
- * \ingroup management
- * \brief represents a faces/update command
- * \sa http://redmine.named-data.net/projects/nfd/wiki/FaceMgmt#Update-a-face
- */
-class FaceUpdateCommand : public ControlCommand
-{
-public:
- FaceUpdateCommand();
-
- virtual void
- applyDefaultsToRequest(ControlParameters& parameters) const override;
-
- virtual void
- validateRequest(const ControlParameters& parameters) const override;
-
- /**
- * \note This can only validate ControlParameters in a success response.
- * Failure responses should be validated with validateRequest.
- */
- virtual void
- validateResponse(const ControlParameters& parameters) const override;
-};
-
-
-/**
- * \ingroup management
- * \brief represents a faces/destroy command
- * \sa http://redmine.named-data.net/projects/nfd/wiki/FaceMgmt#Destroy-a-face
- */
-class FaceDestroyCommand : public ControlCommand
-{
-public:
- FaceDestroyCommand();
-
- virtual void
- validateRequest(const ControlParameters& parameters) const override;
-
- virtual void
- validateResponse(const ControlParameters& parameters) const override;
-};
-
-
-/**
- * \ingroup management
- * \brief Base class for faces/[*]-local-control commands
- */
-class FaceLocalControlCommand : public ControlCommand
-{
-public:
- virtual void
- validateRequest(const ControlParameters& parameters) const override;
-
- virtual void
- validateResponse(const ControlParameters& parameters) const override;
-
-protected:
- explicit
- FaceLocalControlCommand(const std::string& verb);
-};
-
-
-/**
- * \ingroup management
- * \brief represents a faces/enable-local-control command
- * \sa http://redmine.named-data.net/projects/nfd/wiki/FaceMgmt#Enable-a-LocalControlHeader-feature
- */
-class FaceEnableLocalControlCommand : public FaceLocalControlCommand
-{
-public:
- FaceEnableLocalControlCommand();
-};
-
-
-/**
- * \ingroup management
- * \brief represents a faces/disable-local-control command
- * \sa http://redmine.named-data.net/projects/nfd/wiki/FaceMgmt#Disable-a-LocalControlHeader-feature
- */
-class FaceDisableLocalControlCommand : public FaceLocalControlCommand
-{
-public:
- FaceDisableLocalControlCommand();
-};
-
-
-/**
- * \ingroup management
- * \brief represents a fib/add-nexthop command
- * \sa http://redmine.named-data.net/projects/nfd/wiki/FibMgmt#Add-a-nexthop
- */
-class FibAddNextHopCommand : public ControlCommand
-{
-public:
- FibAddNextHopCommand();
-
- virtual void
- applyDefaultsToRequest(ControlParameters& parameters) const override;
-
- virtual void
- validateResponse(const ControlParameters& parameters) const override;
-};
-
-
-/**
- * \ingroup management
- * \brief represents a fib/remove-nexthop command
- * \sa http://redmine.named-data.net/projects/nfd/wiki/FibMgmt#Remove-a-nexthop
- */
-class FibRemoveNextHopCommand : public ControlCommand
-{
-public:
- FibRemoveNextHopCommand();
-
- virtual void
- applyDefaultsToRequest(ControlParameters& parameters) const override;
-
- virtual void
- validateResponse(const ControlParameters& parameters) const override;
-};
-
-
-/**
- * \ingroup management
- * \brief represents a strategy-choice/set command
- * \sa http://redmine.named-data.net/projects/nfd/wiki/StrategyChoice#Set-the-strategy-for-a-namespace
- */
-class StrategyChoiceSetCommand : public ControlCommand
-{
-public:
- StrategyChoiceSetCommand();
-};
-
-
-/**
- * \ingroup management
- * \brief represents a strategy-choice/set command
- * \sa http://redmine.named-data.net/projects/nfd/wiki/StrategyChoice#Unset-the-strategy-for-a-namespace
- */
-class StrategyChoiceUnsetCommand : public ControlCommand
-{
-public:
- StrategyChoiceUnsetCommand();
-
- virtual void
- validateRequest(const ControlParameters& parameters) const override;
-
- virtual void
- validateResponse(const ControlParameters& parameters) const override;
-};
-
-
-/**
- * \ingroup management
- * \brief represents a rib/register command
- * \sa http://redmine.named-data.net/projects/nfd/wiki/RibMgmt#Register-a-route
- */
-class RibRegisterCommand : public ControlCommand
-{
-public:
- RibRegisterCommand();
-
- virtual void
- applyDefaultsToRequest(ControlParameters& parameters) const override;
-
- virtual void
- validateResponse(const ControlParameters& parameters) const override;
-};
-
-
-/**
- * \ingroup management
- * \brief represents a rib/unregister command
- * \sa http://redmine.named-data.net/projects/nfd/wiki/RibMgmt#Unregister-a-route
- */
-class RibUnregisterCommand : public ControlCommand
-{
-public:
- RibUnregisterCommand();
-
- virtual void
- applyDefaultsToRequest(ControlParameters& parameters) const override;
-
- virtual void
- validateResponse(const ControlParameters& parameters) const override;
-};
-
-} // namespace nfd
-} // namespace ndn
-
-#endif // NDN_MANAGEMENT_NFD_CONTROL_COMMAND_HPP
+#include "../mgmt/nfd/control-command.hpp"
diff --git a/src/management/nfd-control-parameters.hpp b/src/management/nfd-control-parameters.hpp
index 92f40b8..a22bc6f 100644
--- a/src/management/nfd-control-parameters.hpp
+++ b/src/management/nfd-control-parameters.hpp
@@ -19,496 +19,7 @@
* See AUTHORS.md for complete list of ndn-cxx authors and contributors.
*/
-#ifndef NDN_MANAGEMENT_NFD_CONTROL_PARAMETERS_HPP
-#define NDN_MANAGEMENT_NFD_CONTROL_PARAMETERS_HPP
-
-#include "../encoding/nfd-constants.hpp"
-#include "../name.hpp"
-#include "../util/time.hpp"
-#include "../mgmt/control-parameters.hpp"
-
-namespace ndn {
-namespace nfd {
-
-/**
- * \ingroup management
+/** \file
+ * \deprecated Use mgmt/nfd/control-parameters.hpp
*/
-enum ControlParameterField {
- CONTROL_PARAMETER_NAME,
- CONTROL_PARAMETER_FACE_ID,
- CONTROL_PARAMETER_URI,
- CONTROL_PARAMETER_LOCAL_CONTROL_FEATURE,
- CONTROL_PARAMETER_ORIGIN,
- CONTROL_PARAMETER_COST,
- CONTROL_PARAMETER_FLAGS,
- CONTROL_PARAMETER_MASK,
- CONTROL_PARAMETER_STRATEGY,
- CONTROL_PARAMETER_EXPIRATION_PERIOD,
- CONTROL_PARAMETER_FACE_PERSISTENCY,
- CONTROL_PARAMETER_UBOUND
-};
-
-const std::string CONTROL_PARAMETER_FIELD[CONTROL_PARAMETER_UBOUND] = {
- "Name",
- "FaceId",
- "Uri",
- "LocalControlFeature",
- "Origin",
- "Cost",
- "Flags",
- "Mask",
- "Strategy",
- "ExpirationPeriod",
- "FacePersistency"
-};
-
-/**
- * \ingroup management
- * \deprecated use Flags+Mask fields instead
- */
-enum LocalControlFeature {
- LOCAL_CONTROL_FEATURE_INCOMING_FACE_ID = 1,
- LOCAL_CONTROL_FEATURE_NEXT_HOP_FACE_ID = 2
-};
-
-/**
- * \ingroup management
- * \brief represents parameters in a ControlCommand request or response
- * \sa http://redmine.named-data.net/projects/nfd/wiki/ControlCommand#ControlParameters
- * \details This type is copyable because it's an abstraction of a TLV type.
- */
-class ControlParameters : public ndn::mgmt::ControlParameters
-{
-public:
- class Error : public tlv::Error
- {
- public:
- explicit
- Error(const std::string& what)
- : tlv::Error(what)
- {
- }
- };
-
- ControlParameters();
-
- explicit
- ControlParameters(const Block& block);
-
- template<encoding::Tag TAG>
- size_t
- wireEncode(EncodingImpl<TAG>& encoder) const;
-
- virtual Block
- wireEncode() const final;
-
- virtual void
- wireDecode(const Block& wire) final;
-
-public: // getters & setters
- bool
- hasName() const
- {
- return m_hasFields[CONTROL_PARAMETER_NAME];
- }
-
- const Name&
- getName() const
- {
- BOOST_ASSERT(this->hasName());
- return m_name;
- }
-
- ControlParameters&
- setName(const Name& name)
- {
- m_wire.reset();
- m_name = name;
- m_hasFields[CONTROL_PARAMETER_NAME] = true;
- return *this;
- }
-
- ControlParameters&
- unsetName()
- {
- m_wire.reset();
- m_hasFields[CONTROL_PARAMETER_NAME] = false;
- return *this;
- }
-
- bool
- hasFaceId() const
- {
- return m_hasFields[CONTROL_PARAMETER_FACE_ID];
- }
-
- uint64_t
- getFaceId() const
- {
- BOOST_ASSERT(this->hasFaceId());
- return m_faceId;
- }
-
- ControlParameters&
- setFaceId(uint64_t faceId)
- {
- m_wire.reset();
- m_faceId = faceId;
- m_hasFields[CONTROL_PARAMETER_FACE_ID] = true;
- return *this;
- }
-
- ControlParameters&
- unsetFaceId()
- {
- m_wire.reset();
- m_hasFields[CONTROL_PARAMETER_FACE_ID] = false;
- return *this;
- }
-
- bool
- hasUri() const
- {
- return m_hasFields[CONTROL_PARAMETER_URI];
- }
-
- const std::string&
- getUri() const
- {
- BOOST_ASSERT(this->hasUri());
- return m_uri;
- }
-
- ControlParameters&
- setUri(const std::string& uri)
- {
- m_wire.reset();
- m_uri = uri;
- m_hasFields[CONTROL_PARAMETER_URI] = true;
- return *this;
- }
-
- ControlParameters&
- unsetUri()
- {
- m_wire.reset();
- m_hasFields[CONTROL_PARAMETER_URI] = false;
- return *this;
- }
-
- /**
- * \deprecated use Flags+Mask fields instead
- */
- bool
- hasLocalControlFeature() const
- {
- return m_hasFields[CONTROL_PARAMETER_LOCAL_CONTROL_FEATURE];
- }
-
- /**
- * \deprecated use Flags+Mask fields instead
- */
- LocalControlFeature
- getLocalControlFeature() const
- {
- BOOST_ASSERT(this->hasLocalControlFeature());
- return m_localControlFeature;
- }
-
- /**
- * \deprecated use Flags+Mask fields instead
- */
- ControlParameters&
- setLocalControlFeature(LocalControlFeature localControlFeature)
- {
- m_wire.reset();
- m_localControlFeature = localControlFeature;
- m_hasFields[CONTROL_PARAMETER_LOCAL_CONTROL_FEATURE] = true;
- return *this;
- }
-
- /**
- * \deprecated use Flags+Mask fields instead
- */
- ControlParameters&
- unsetLocalControlFeature()
- {
- m_wire.reset();
- m_hasFields[CONTROL_PARAMETER_LOCAL_CONTROL_FEATURE] = false;
- return *this;
- }
-
- bool
- hasOrigin() const
- {
- return m_hasFields[CONTROL_PARAMETER_ORIGIN];
- }
-
- uint64_t
- getOrigin() const
- {
- BOOST_ASSERT(this->hasOrigin());
- return m_origin;
- }
-
- ControlParameters&
- setOrigin(uint64_t origin)
- {
- m_wire.reset();
- m_origin = origin;
- m_hasFields[CONTROL_PARAMETER_ORIGIN] = true;
- return *this;
- }
-
- ControlParameters&
- unsetOrigin()
- {
- m_wire.reset();
- m_hasFields[CONTROL_PARAMETER_ORIGIN] = false;
- return *this;
- }
-
- bool
- hasCost() const
- {
- return m_hasFields[CONTROL_PARAMETER_COST];
- }
-
- uint64_t
- getCost() const
- {
- BOOST_ASSERT(this->hasCost());
- return m_cost;
- }
-
- ControlParameters&
- setCost(uint64_t cost)
- {
- m_wire.reset();
- m_cost = cost;
- m_hasFields[CONTROL_PARAMETER_COST] = true;
- return *this;
- }
-
- ControlParameters&
- unsetCost()
- {
- m_wire.reset();
- m_hasFields[CONTROL_PARAMETER_COST] = false;
- return *this;
- }
-
- bool
- hasFlags() const
- {
- return m_hasFields[CONTROL_PARAMETER_FLAGS];
- }
-
- uint64_t
- getFlags() const
- {
- BOOST_ASSERT(this->hasFlags());
- return m_flags;
- }
-
- ControlParameters&
- setFlags(uint64_t flags)
- {
- m_wire.reset();
- m_flags = flags;
- m_hasFields[CONTROL_PARAMETER_FLAGS] = true;
- return *this;
- }
-
- ControlParameters&
- unsetFlags()
- {
- m_wire.reset();
- m_hasFields[CONTROL_PARAMETER_FLAGS] = false;
- return *this;
- }
-
- bool
- hasMask() const
- {
- return m_hasFields[CONTROL_PARAMETER_MASK];
- }
-
- uint64_t
- getMask() const
- {
- BOOST_ASSERT(this->hasMask());
- return m_mask;
- }
-
- ControlParameters&
- setMask(uint64_t mask)
- {
- m_wire.reset();
- m_mask = mask;
- m_hasFields[CONTROL_PARAMETER_MASK] = true;
- return *this;
- }
-
- ControlParameters&
- unsetMask()
- {
- m_wire.reset();
- m_hasFields[CONTROL_PARAMETER_MASK] = false;
- return *this;
- }
-
- bool
- hasStrategy() const
- {
- return m_hasFields[CONTROL_PARAMETER_STRATEGY];
- }
-
- const Name&
- getStrategy() const
- {
- BOOST_ASSERT(this->hasStrategy());
- return m_strategy;
- }
-
- ControlParameters&
- setStrategy(const Name& strategy)
- {
- m_wire.reset();
- m_strategy = strategy;
- m_hasFields[CONTROL_PARAMETER_STRATEGY] = true;
- return *this;
- }
-
- ControlParameters&
- unsetStrategy()
- {
- m_wire.reset();
- m_hasFields[CONTROL_PARAMETER_STRATEGY] = false;
- return *this;
- }
-
- bool
- hasExpirationPeriod() const
- {
- return m_hasFields[CONTROL_PARAMETER_EXPIRATION_PERIOD];
- }
-
- const time::milliseconds&
- getExpirationPeriod() const
- {
- BOOST_ASSERT(this->hasExpirationPeriod());
- return m_expirationPeriod;
- }
-
- ControlParameters&
- setExpirationPeriod(const time::milliseconds& expirationPeriod)
- {
- m_wire.reset();
- m_expirationPeriod = expirationPeriod;
- m_hasFields[CONTROL_PARAMETER_EXPIRATION_PERIOD] = true;
- return *this;
- }
-
- ControlParameters&
- unsetExpirationPeriod()
- {
- m_wire.reset();
- m_hasFields[CONTROL_PARAMETER_EXPIRATION_PERIOD] = false;
- return *this;
- }
-
- bool
- hasFacePersistency() const
- {
- return m_hasFields[CONTROL_PARAMETER_FACE_PERSISTENCY];
- }
-
- FacePersistency
- getFacePersistency() const
- {
- BOOST_ASSERT(this->hasFacePersistency());
- return m_facePersistency;
- }
-
- ControlParameters&
- setFacePersistency(FacePersistency persistency)
- {
- m_wire.reset();
- m_facePersistency = persistency;
- m_hasFields[CONTROL_PARAMETER_FACE_PERSISTENCY] = true;
- return *this;
- }
-
- ControlParameters&
- unsetFacePersistency()
- {
- m_wire.reset();
- m_hasFields[CONTROL_PARAMETER_FACE_PERSISTENCY] = false;
- return *this;
- }
-
- const std::vector<bool>&
- getPresentFields() const
- {
- return m_hasFields;
- }
-
-public: // Flags and Mask helpers
- /**
- * \return whether bit is enabled in Mask
- * \param bit bit position within range [0, 64) (least significant bit is 0)
- */
- bool
- hasFlagBit(size_t bit) const;
-
- /**
- * \return bit at a position in Flags
- * \param bit bit position within range [0, 64) (least significant bit is 0)
- */
- bool
- getFlagBit(size_t bit) const;
-
- /**
- * \brief set a bit in Flags
- * \param bit bit position within range [0, 64) (least significant bit is 0)
- * \param value new value in Flags
- * \param wantMask if true, enable the bit in Mask
- */
- ControlParameters&
- setFlagBit(size_t bit, bool value, bool wantMask = true);
-
- /**
- * \brief disable a bit in Mask
- * \param bit bit position within range [0, 64) (least significant bit is 0)
- * \post If all bits are disabled, Flags and Mask fields are deleted.
- */
- ControlParameters&
- unsetFlagBit(size_t bit);
-
-private: // fields
- std::vector<bool> m_hasFields;
-
- Name m_name;
- uint64_t m_faceId;
- std::string m_uri;
- LocalControlFeature m_localControlFeature;
- uint64_t m_origin;
- uint64_t m_cost;
- uint64_t m_flags;
- uint64_t m_mask;
- Name m_strategy;
- time::milliseconds m_expirationPeriod;
- FacePersistency m_facePersistency;
-
-private:
- mutable Block m_wire;
-};
-
-std::ostream&
-operator<<(std::ostream& os, const ControlParameters& parameters);
-
-} // namespace nfd
-} // namespace ndn
-
-#endif // NDN_MANAGEMENT_NFD_CONTROL_PARAMETERS_HPP
+#include "../mgmt/nfd/control-parameters.hpp"
diff --git a/src/management/nfd-control-response.hpp b/src/management/nfd-control-response.hpp
index 44f2007..74e38f3 100644
--- a/src/management/nfd-control-response.hpp
+++ b/src/management/nfd-control-response.hpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/**
- * Copyright (c) 2013-2015 Regents of the University of California.
+ * Copyright (c) 2013-2016 Regents of the University of California.
*
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
*
@@ -19,17 +19,7 @@
* See AUTHORS.md for complete list of ndn-cxx authors and contributors.
*/
-#ifndef NDN_MANAGEMENT_CONTROL_RESPONSE_HPP
-#define NDN_MANAGEMENT_CONTROL_RESPONSE_HPP
-
-#include "../mgmt/dispatcher.hpp"
-
-namespace ndn {
-namespace nfd {
-
-typedef ndn::mgmt::ControlResponse ControlResponse;
-
-} // namespace nfd
-} // namespace ndn
-
-#endif // NDN_MANAGEMENT_CONTROL_RESPONSE_HPP
+/** \file
+ * \deprecated Use mgmt/nfd/control-response.hpp
+ */
+#include "../mgmt/nfd/control-response.hpp"
diff --git a/src/management/nfd-controller.hpp b/src/management/nfd-controller.hpp
index 8674a61..b127d57 100644
--- a/src/management/nfd-controller.hpp
+++ b/src/management/nfd-controller.hpp
@@ -19,203 +19,7 @@
* See AUTHORS.md for complete list of ndn-cxx authors and contributors.
*/
-#ifndef NDN_MANAGEMENT_NFD_CONTROLLER_HPP
-#define NDN_MANAGEMENT_NFD_CONTROLLER_HPP
-
-#include "nfd-control-command.hpp"
-#include "nfd-control-response.hpp"
-#include "nfd-status-dataset.hpp"
-#include "nfd-command-options.hpp"
-#include "../security/validator-null.hpp"
-
-namespace ndn {
-
-namespace security {
-class KeyChain;
-class Validator;
-} // namespace security
-class Face;
-
-namespace nfd {
-
-/**
- * \defgroup management Management
- * \brief Classes and data structures to manage NDN forwarder
+/** \file
+ * \deprecated Use mgmt/nfd/controller.hpp
*/
-
-/**
- * \ingroup management
- * \brief NFD Management protocol client
- * \sa https://redmine.named-data.net/projects/nfd/wiki/Management
- */
-class Controller : noncopyable
-{
-public:
- /** \brief a callback on command success
- */
- typedef function<void(const ControlParameters&)> CommandSucceedCallback;
-
- /** \brief a callback on command failure
- */
- typedef function<void(const ControlResponse&)> CommandFailCallback;
-
- /** \brief a callback on dataset retrieval failure
- */
- typedef function<void(uint32_t code, const std::string& reason)> DatasetFailCallback;
-
- /** \brief construct a Controller that uses face for transport,
- * and uses the passed KeyChain to sign commands
- */
- Controller(Face& face, security::KeyChain& keyChain, security::Validator& validator = s_validatorNull);
-
- /** \brief start command execution
- */
- template<typename Command>
- void
- start(const ControlParameters& parameters,
- const CommandSucceedCallback& onSuccess,
- const CommandFailCallback& onFailure,
- const CommandOptions& options = CommandOptions())
- {
- shared_ptr<ControlCommand> command = make_shared<Command>();
- this->startCommand(command, parameters, onSuccess, onFailure, options);
- }
-
- /** \brief start dataset fetching
- */
- template<typename Dataset>
- typename std::enable_if<std::is_default_constructible<Dataset>::value>::type
- fetch(const std::function<void(typename Dataset::ResultType)>& onSuccess,
- const DatasetFailCallback& onFailure,
- const CommandOptions& options = CommandOptions())
- {
- this->fetchDataset(make_shared<Dataset>(), onSuccess, onFailure, options);
- }
-
- /** \brief start dataset fetching
- */
- template<typename Dataset, typename ParamType = typename Dataset::ParamType>
- void
- fetch(const ParamType& param,
- const std::function<void(typename Dataset::ResultType)>& onSuccess,
- const DatasetFailCallback& onFailure,
- const CommandOptions& options = CommandOptions())
- {
- this->fetchDataset(make_shared<Dataset>(param), onSuccess, onFailure, options);
- }
-
-private:
- void
- startCommand(const shared_ptr<ControlCommand>& command,
- const ControlParameters& parameters,
- const CommandSucceedCallback& onSuccess,
- const CommandFailCallback& onFailure,
- const CommandOptions& options);
-
- void
- processCommandResponse(const Data& data,
- const shared_ptr<ControlCommand>& command,
- const CommandSucceedCallback& onSuccess,
- const CommandFailCallback& onFailure);
-
- void
- processValidatedCommandResponse(const Data& data,
- const shared_ptr<ControlCommand>& command,
- const CommandSucceedCallback& onSuccess,
- const CommandFailCallback& onFailure);
-
- template<typename Dataset>
- void
- fetchDataset(shared_ptr<Dataset> dataset,
- const std::function<void(typename Dataset::ResultType)>& onSuccess,
- const DatasetFailCallback& onFailure,
- const CommandOptions& options);
-
- void
- fetchDataset(const Name& prefix,
- const std::function<void(const ConstBufferPtr&)>& processResponse,
- const DatasetFailCallback& onFailure,
- const CommandOptions& options);
-
- template<typename Dataset>
- void
- processDatasetResponse(shared_ptr<Dataset> dataset,
- const std::function<void(typename Dataset::ResultType)>& onSuccess,
- const DatasetFailCallback& onFailure,
- ConstBufferPtr payload);
-
- void
- processDatasetFetchError(const DatasetFailCallback& onFailure, uint32_t code, std::string msg);
-
-public:
- /** \brief error code for timeout
- */
- static const uint32_t ERROR_TIMEOUT;
-
- /** \brief error code for network Nack
- */
- static const uint32_t ERROR_NACK;
-
- /** \brief error code for response validation failure
- */
- static const uint32_t ERROR_VALIDATION;
-
- /** \brief error code for server error
- */
- static const uint32_t ERROR_SERVER;
-
- /** \brief inclusive lower bound of error codes
- */
- static const uint32_t ERROR_LBOUND;
-
-protected:
- Face& m_face;
- security::KeyChain& m_keyChain;
- security::Validator& m_validator;
-
-private:
- static ValidatorNull s_validatorNull;
-};
-
-template<typename Dataset>
-inline void
-Controller::fetchDataset(shared_ptr<Dataset> dataset,
- const std::function<void(typename Dataset::ResultType)>& onSuccess1,
- const DatasetFailCallback& onFailure1,
- const CommandOptions& options)
-{
- const std::function<void(typename Dataset::ResultType)>& onSuccess = onSuccess1 ?
- onSuccess1 : [] (const typename Dataset::ResultType&) {};
- const DatasetFailCallback& onFailure = onFailure1 ?
- onFailure1 : [] (uint32_t, const std::string&) {};
-
- Name prefix = dataset->getDatasetPrefix(options.getPrefix());
- this->fetchDataset(prefix,
- bind(&Controller::processDatasetResponse<Dataset>, this, dataset, onSuccess, onFailure, _1),
- onFailure,
- options);
-}
-
-template<typename Dataset>
-inline void
-Controller::processDatasetResponse(shared_ptr<Dataset> dataset,
- const std::function<void(typename Dataset::ResultType)>& onSuccess,
- const DatasetFailCallback& onFailure,
- ConstBufferPtr payload)
-{
- typename Dataset::ResultType result;
- try {
- result = dataset->parseResult(payload);
- }
- catch (const tlv::Error& e) {
- onFailure(ERROR_SERVER, e.what());
- return;
- }
-
- onSuccess(result);
-}
-
-} // namespace nfd
-} // namespace ndn
-
-#endif // NDN_MANAGEMENT_NFD_CONTROLLER_HPP
+#include "../mgmt/nfd/controller.hpp"
diff --git a/src/management/nfd-face-event-notification.hpp b/src/management/nfd-face-event-notification.hpp
index 56325ef..3749390 100644
--- a/src/management/nfd-face-event-notification.hpp
+++ b/src/management/nfd-face-event-notification.hpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/**
- * Copyright (c) 2013-2015 Regents of the University of California.
+ * Copyright (c) 2013-2016 Regents of the University of California.
*
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
*
@@ -19,76 +19,7 @@
* See AUTHORS.md for complete list of ndn-cxx authors and contributors.
*/
-#ifndef NDN_MANAGEMENT_NFD_FACE_EVENT_NOTIFICATION_HPP
-#define NDN_MANAGEMENT_NFD_FACE_EVENT_NOTIFICATION_HPP
-
-#include "nfd-face-traits.hpp"
-#include "../encoding/block.hpp"
-
-namespace ndn {
-namespace nfd {
-
-/**
- * \ingroup management
+/** \file
+ * \deprecated Use mgmt/nfd/face-event-notification.hpp
*/
-enum FaceEventKind {
- FACE_EVENT_CREATED = 1,
- FACE_EVENT_DESTROYED = 2
-};
-
-/**
- * \ingroup management
- * \brief represents a Face status change notification
- * \sa http://redmine.named-data.net/projects/nfd/wiki/FaceMgmt#Face-Status-Change-Notification
- */
-class FaceEventNotification : public FaceTraits<FaceEventNotification>
-{
-public:
- FaceEventNotification();
-
- explicit
- FaceEventNotification(const Block& block);
-
- /** \brief prepend FaceEventNotification to the encoder
- */
- template<encoding::Tag TAG>
- size_t
- wireEncode(EncodingImpl<TAG>& encoder) const;
-
- /** \brief encode FaceEventNotification
- */
- const Block&
- wireEncode() const;
-
- /** \brief decode FaceEventNotification
- */
- void
- wireDecode(const Block& wire);
-
-public: // getters & setters
- FaceEventKind
- getKind() const
- {
- return m_kind;
- }
-
- FaceEventNotification&
- setKind(FaceEventKind kind);
-
-protected:
- void
- wireReset() const;
-
-private:
- FaceEventKind m_kind;
-
- mutable Block m_wire;
-};
-
-std::ostream&
-operator<<(std::ostream& os, const FaceEventNotification& notification);
-
-} // namespace nfd
-} // namespace ndn
-
-#endif // NDN_MANAGEMENT_NFD_FACE_EVENT_NOTIFICATION_HPP
+#include "../mgmt/nfd/face-event-notification.hpp"
diff --git a/src/management/nfd-face-monitor.hpp b/src/management/nfd-face-monitor.hpp
index da6e510..f6bc943 100644
--- a/src/management/nfd-face-monitor.hpp
+++ b/src/management/nfd-face-monitor.hpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/**
- * Copyright (c) 2013-2014 Regents of the University of California.
+ * Copyright (c) 2013-2016 Regents of the University of California.
*
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
*
@@ -19,54 +19,7 @@
* See AUTHORS.md for complete list of ndn-cxx authors and contributors.
*/
-/**
- * Original copyright notice from NFD:
- *
- * Copyright (c) 2014, 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/>.
+/** \file
+ * \deprecated Use mgmt/nfd/face-monitor.hpp
*/
-
-#ifndef NDN_MANAGEMENT_NFD_FACE_MONITOR_HPP
-#define NDN_MANAGEMENT_NFD_FACE_MONITOR_HPP
-
-#include "../util/notification-subscriber.hpp"
-#include "nfd-face-event-notification.hpp"
-
-namespace ndn {
-namespace nfd {
-
-/** \brief A subscriber for Face status change notification stream
- * \sa http://redmine.named-data.net/projects/nfd/wiki/FaceMgmt#Face-Status-Change-Notification
- */
-class FaceMonitor : public util::NotificationSubscriber<FaceEventNotification>
-{
-public:
- FaceMonitor(Face& face)
- : NotificationSubscriber<nfd::FaceEventNotification>(face, "ndn:/localhost/nfd/faces/events")
- {
- }
-};
-
-} // namespace nfd
-} // namespace ndn
-
-#endif // NDN_MANAGEMENT_NFD_FACE_MONITOR_HPP
+#include "../mgmt/nfd/face-monitor.hpp"
diff --git a/src/management/nfd-face-query-filter.hpp b/src/management/nfd-face-query-filter.hpp
index 30ea386..345af3e 100644
--- a/src/management/nfd-face-query-filter.hpp
+++ b/src/management/nfd-face-query-filter.hpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/**
- * Copyright (c) 2013-2015 Regents of the University of California.
+ * Copyright (c) 2013-2016 Regents of the University of California.
*
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
*
@@ -19,213 +19,7 @@
* See AUTHORS.md for complete list of ndn-cxx authors and contributors.
*/
-#ifndef NDN_MANAGEMENT_NFD_FACE_QUERY_FILTER_HPP
-#define NDN_MANAGEMENT_NFD_FACE_QUERY_FILTER_HPP
-
-#include "../encoding/block.hpp"
-#include "../encoding/nfd-constants.hpp"
-
-namespace ndn {
-namespace nfd {
-
-/**
- * \ingroup management
- * \brief represents Face Query Filter
- * \sa http://redmine.named-data.net/projects/nfd/wiki/FaceMgmt#Query-Operation
+/** \file
+ * \deprecated Use mgmt/nfd/face-query-filter.hpp
*/
-class FaceQueryFilter
-{
-public:
- class Error : public tlv::Error
- {
- public:
- explicit
- Error(const std::string& what)
- : tlv::Error(what)
- {
- }
- };
-
- FaceQueryFilter();
-
- explicit
- FaceQueryFilter(const Block& block);
-
- /** \brief prepend FaceQueryFilter to the encoder
- */
- template<encoding::Tag TAG>
- size_t
- wireEncode(EncodingImpl<TAG>& encoder) const;
-
- /** \brief encode FaceQueryFilter
- */
- const Block&
- wireEncode() const;
-
- /** \brief decode FaceQueryFilter
- */
- void
- wireDecode(const Block& wire);
-
-public: // getters & setters
-
- bool
- hasFaceId() const
- {
- return m_hasFaceId;
- }
-
- uint64_t
- getFaceId() const
- {
- BOOST_ASSERT(this->hasFaceId());
- return m_faceId;
- }
-
- FaceQueryFilter&
- setFaceId(uint64_t faceId);
-
- FaceQueryFilter&
- unsetFaceId();
-
- bool
- hasUriScheme() const
- {
- return m_hasUriScheme;
- }
-
- const std::string&
- getUriScheme() const
- {
- BOOST_ASSERT(this->hasUriScheme());
- return m_uriScheme;
- }
-
- FaceQueryFilter&
- setUriScheme(const std::string& uriScheme);
-
- FaceQueryFilter&
- unsetUriScheme();
-
- bool
- hasRemoteUri() const
- {
- return m_hasRemoteUri;
- }
-
- const std::string&
- getRemoteUri() const
- {
- BOOST_ASSERT(this->hasRemoteUri());
- return m_remoteUri;
- }
-
- FaceQueryFilter&
- setRemoteUri(const std::string& remoteUri);
-
- FaceQueryFilter&
- unsetRemoteUri();
-
- bool
- hasLocalUri() const
- {
- return m_hasLocalUri;
- }
-
- const std::string&
- getLocalUri() const
- {
- BOOST_ASSERT(this->hasLocalUri());
- return m_localUri;
- }
-
- FaceQueryFilter&
- setLocalUri(const std::string& localUri);
-
- FaceQueryFilter&
- unsetLocalUri();
-
- bool
- hasFaceScope() const
- {
- return m_hasFaceScope;
- }
-
- FaceScope
- getFaceScope() const
- {
- BOOST_ASSERT(this->hasFaceScope());
- return m_faceScope;
- }
-
- FaceQueryFilter&
- setFaceScope(FaceScope faceScope);
-
- FaceQueryFilter&
- unsetFaceScope();
-
- bool
- hasFacePersistency() const
- {
- return m_hasFacePersistency;
- }
-
- FacePersistency
- getFacePersistency() const
- {
- BOOST_ASSERT(this->hasFacePersistency());
- return m_facePersistency;
- }
-
- FaceQueryFilter&
- setFacePersistency(FacePersistency facePersistency);
-
- FaceQueryFilter&
- unsetFacePersistency();
-
- bool
- hasLinkType() const
- {
- return m_hasLinkType;
- }
-
- LinkType
- getLinkType() const
- {
- BOOST_ASSERT(this->hasLinkType());
- return m_linkType;
- }
-
- FaceQueryFilter&
- setLinkType(LinkType linkType);
-
- FaceQueryFilter&
- unsetLinkType();
-
-private:
- uint64_t m_faceId;
- std::string m_uriScheme;
- std::string m_remoteUri;
- std::string m_localUri;
- FaceScope m_faceScope;
- FacePersistency m_facePersistency;
- LinkType m_linkType;
-
- bool m_hasFaceId;
- bool m_hasUriScheme;
- bool m_hasRemoteUri;
- bool m_hasLocalUri;
- bool m_hasFaceScope;
- bool m_hasFacePersistency;
- bool m_hasLinkType;
-
- mutable Block m_wire;
-};
-
-std::ostream&
-operator<<(std::ostream& os, const FaceQueryFilter& filter);
-
-} // namespace nfd
-} // namespace ndn
-
-#endif // NDN_MANAGEMENT_NFD_FACE_QUERY_FILTER_HPP
+#include "../mgmt/nfd/face-query-filter.hpp"
diff --git a/src/management/nfd-face-status.hpp b/src/management/nfd-face-status.hpp
index 521f3d3..13e4919 100644
--- a/src/management/nfd-face-status.hpp
+++ b/src/management/nfd-face-status.hpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/**
- * Copyright (c) 2013-2015 Regents of the University of California.
+ * Copyright (c) 2013-2016 Regents of the University of California.
*
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
*
@@ -19,157 +19,7 @@
* See AUTHORS.md for complete list of ndn-cxx authors and contributors.
*/
-#ifndef NDN_MANAGEMENT_NFD_FACE_STATUS_HPP
-#define NDN_MANAGEMENT_NFD_FACE_STATUS_HPP
-
-#include "nfd-face-traits.hpp" // include this first, to ensure it compiles on its own.
-#include "../encoding/block.hpp"
-#include "../util/time.hpp"
-
-namespace ndn {
-namespace nfd {
-
-/**
- * \ingroup management
- * \brief represents Face status
- * \sa http://redmine.named-data.net/projects/nfd/wiki/FaceMgmt#Face-Dataset
+/** \file
+ * \deprecated Use mgmt/nfd/face-status.hpp
*/
-class FaceStatus : public FaceTraits<FaceStatus>
-{
-public:
- FaceStatus();
-
- explicit
- FaceStatus(const Block& block);
-
- /** \brief prepend FaceStatus to the encoder
- */
- template<encoding::Tag TAG>
- size_t
- wireEncode(EncodingImpl<TAG>& encoder) const;
-
- /** \brief encode FaceStatus
- */
- const Block&
- wireEncode() const;
-
- /** \brief decode FaceStatus
- */
- void
- wireDecode(const Block& wire);
-
-public: // getters & setters
- bool
- hasExpirationPeriod() const
- {
- return m_hasExpirationPeriod;
- }
-
- const time::milliseconds&
- getExpirationPeriod() const
- {
- BOOST_ASSERT(m_hasExpirationPeriod);
- return m_expirationPeriod;
- }
-
- FaceStatus&
- setExpirationPeriod(const time::milliseconds& expirationPeriod);
-
- uint64_t
- getNInInterests() const
- {
- return m_nInInterests;
- }
-
- FaceStatus&
- setNInInterests(uint64_t nInInterests);
-
- uint64_t
- getNInDatas() const
- {
- return m_nInDatas;
- }
-
- FaceStatus&
- setNInDatas(uint64_t nInDatas);
-
- uint64_t
- getNInNacks() const
- {
- return m_nInNacks;
- }
-
- FaceStatus&
- setNInNacks(uint64_t nInNacks);
-
- uint64_t
- getNOutInterests() const
- {
- return m_nOutInterests;
- }
-
- FaceStatus&
- setNOutInterests(uint64_t nOutInterests);
-
- uint64_t
- getNOutDatas() const
- {
- return m_nOutDatas;
- }
-
- FaceStatus&
- setNOutDatas(uint64_t nOutDatas);
-
- uint64_t
- getNOutNacks() const
- {
- return m_nOutNacks;
- }
-
- FaceStatus&
- setNOutNacks(uint64_t nOutNacks);
-
- uint64_t
- getNInBytes() const
- {
- return m_nInBytes;
- }
-
- FaceStatus&
- setNInBytes(uint64_t nInBytes);
-
- uint64_t
- getNOutBytes() const
- {
- return m_nOutBytes;
- }
-
- FaceStatus&
- setNOutBytes(uint64_t nOutBytes);
-
-protected:
- void
- wireReset() const;
-
-private:
- time::milliseconds m_expirationPeriod;
- bool m_hasExpirationPeriod;
- uint64_t m_nInInterests;
- uint64_t m_nInDatas;
- uint64_t m_nInNacks;
- uint64_t m_nOutInterests;
- uint64_t m_nOutDatas;
- uint64_t m_nOutNacks;
- uint64_t m_nInBytes;
- uint64_t m_nOutBytes;
-
- mutable Block m_wire;
-};
-
-std::ostream&
-operator<<(std::ostream& os, const FaceStatus& status);
-
-} // namespace nfd
-} // namespace ndn
-
-#endif // NDN_MANAGEMENT_NFD_FACE_STATUS_HPP
+#include "../mgmt/nfd/face-status.hpp"
diff --git a/src/management/nfd-face-traits.hpp b/src/management/nfd-face-traits.hpp
index f473d8a..914c4d5 100644
--- a/src/management/nfd-face-traits.hpp
+++ b/src/management/nfd-face-traits.hpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/**
- * Copyright (c) 2013-2014 Regents of the University of California.
+ * Copyright (c) 2013-2016 Regents of the University of California.
*
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
*
@@ -19,139 +19,7 @@
* See AUTHORS.md for complete list of ndn-cxx authors and contributors.
*/
-#ifndef NDN_MANAGEMENT_NFD_FACE_TRAITS_HPP
-#define NDN_MANAGEMENT_NFD_FACE_TRAITS_HPP
-
-#include "../encoding/tlv-nfd.hpp"
-
-namespace ndn {
-namespace nfd {
-
-/** \ingroup management
- * \brief providers getters and setters of face information fields
- * \tparam C the concrete class; it must provide .wireReset() method
- to clear wire encoding when a field changes
+/** \file
+ * \deprecated Use mgmt/nfd/face-traits.hpp
*/
-template<class C>
-class FaceTraits
-{
-public:
- class Error : public tlv::Error
- {
- public:
- explicit
- Error(const std::string& what)
- : tlv::Error(what)
- {
- }
- };
-
- FaceTraits()
- : m_faceId(0)
- , m_faceScope(FACE_SCOPE_NON_LOCAL)
- , m_facePersistency(FACE_PERSISTENCY_PERSISTENT)
- , m_linkType(LINK_TYPE_POINT_TO_POINT)
- {
- }
-
- uint64_t
- getFaceId() const
- {
- return m_faceId;
- }
-
- C&
- setFaceId(uint64_t faceId)
- {
- wireReset();
- m_faceId = faceId;
- return static_cast<C&>(*this);
- }
-
- const std::string&
- getRemoteUri() const
- {
- return m_remoteUri;
- }
-
- C&
- setRemoteUri(const std::string& remoteUri)
- {
- wireReset();
- m_remoteUri = remoteUri;
- return static_cast<C&>(*this);
- }
-
- const std::string&
- getLocalUri() const
- {
- return m_localUri;
- }
-
- C&
- setLocalUri(const std::string& localUri)
- {
- wireReset();
- m_localUri = localUri;
- return static_cast<C&>(*this);
- }
-
- FaceScope
- getFaceScope() const
- {
- return m_faceScope;
- }
-
- C&
- setFaceScope(FaceScope faceScope)
- {
- wireReset();
- m_faceScope = faceScope;
- return static_cast<C&>(*this);
- }
-
- FacePersistency
- getFacePersistency() const
- {
- return m_facePersistency;
- }
-
- C&
- setFacePersistency(FacePersistency facePersistency)
- {
- wireReset();
- m_facePersistency = facePersistency;
- return static_cast<C&>(*this);
- }
-
- LinkType
- getLinkType() const
- {
- return m_linkType;
- }
-
- C&
- setLinkType(LinkType linkType)
- {
- wireReset();
- m_linkType = linkType;
- return static_cast<C&>(*this);
- }
-
-protected:
- virtual void
- wireReset() const = 0;
-
-protected:
- uint64_t m_faceId;
- std::string m_remoteUri;
- std::string m_localUri;
- FaceScope m_faceScope;
- FacePersistency m_facePersistency;
- LinkType m_linkType;
-};
-
-} // namespace nfd
-} // namespace ndn
-
-#endif // NDN_MANAGEMENT_NFD_FACE_TRAITS_HPP
+#include "../mgmt/nfd/face-traits.hpp"
diff --git a/src/management/nfd-fib-entry.hpp b/src/management/nfd-fib-entry.hpp
index f1f3003..5f3a4c3 100644
--- a/src/management/nfd-fib-entry.hpp
+++ b/src/management/nfd-fib-entry.hpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/**
- * Copyright (c) 2013-2015 Regents of the University of California.
+ * Copyright (c) 2013-2016 Regents of the University of California.
*
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
*
@@ -19,137 +19,7 @@
* See AUTHORS.md for complete list of ndn-cxx authors and contributors.
*/
-#ifndef NDN_MANAGEMENT_NFD_FIB_ENTRY_HPP
-#define NDN_MANAGEMENT_NFD_FIB_ENTRY_HPP
-
-#include "../encoding/block.hpp"
-#include "../name.hpp"
-#include <list>
-
-namespace ndn {
-namespace nfd {
-
-/** @ingroup management
+/** \file
+ * \deprecated Use mgmt/nfd/fib-entry.hpp
*/
-class NextHopRecord
-{
-public:
- class Error : public tlv::Error
- {
- public:
- explicit
- Error(const std::string& what)
- : tlv::Error(what)
- {
- }
- };
-
- NextHopRecord();
-
- explicit
- NextHopRecord(const Block& block);
-
- uint64_t
- getFaceId() const
- {
- return m_faceId;
- }
-
- NextHopRecord&
- setFaceId(uint64_t faceId);
-
- uint64_t
- getCost() const
- {
- return m_cost;
- }
-
- NextHopRecord&
- setCost(uint64_t cost);
-
- template<encoding::Tag TAG>
- size_t
- wireEncode(EncodingImpl<TAG>& block) const;
-
- const Block&
- wireEncode() const;
-
- void
- wireDecode(const Block& wire);
-
-private:
- uint64_t m_faceId;
- uint64_t m_cost;
-
- mutable Block m_wire;
-};
-
-/** @ingroup management
- */
-class FibEntry
-{
-public:
- class Error : public tlv::Error
- {
- public:
- explicit
- Error(const std::string& what)
- : tlv::Error(what)
- {
- }
- };
-
- FibEntry();
-
- explicit
- FibEntry(const Block& block);
-
- const Name&
- getPrefix() const
- {
- return m_prefix;
- }
-
- FibEntry&
- setPrefix(const Name& prefix);
-
- const std::list<NextHopRecord>&
- getNextHopRecords() const
- {
- return m_nextHopRecords;
- }
-
- FibEntry&
- addNextHopRecord(const NextHopRecord& nextHopRecord);
-
- template<typename T>
- FibEntry&
- setNextHopRecords(const T& begin, const T& end)
- {
- m_nextHopRecords.clear();
- m_nextHopRecords.assign(begin, end);
- m_wire.reset();
- return *this;
- }
-
- template<encoding::Tag TAG>
- size_t
- wireEncode(EncodingImpl<TAG>& block) const;
-
- const Block&
- wireEncode() const;
-
- void
- wireDecode(const Block& wire);
-
-private:
- Name m_prefix;
- std::list<NextHopRecord> m_nextHopRecords;
-
- mutable Block m_wire;
-};
-
-} // namespace nfd
-} // namespace ndn
-
-#endif // NDN_MANAGEMENT_NFD_FIB_ENTRY_HPP
+#include "../mgmt/nfd/fib-entry.hpp"
diff --git a/src/management/nfd-forwarder-status.hpp b/src/management/nfd-forwarder-status.hpp
index 7083cb6..ca9a944 100644
--- a/src/management/nfd-forwarder-status.hpp
+++ b/src/management/nfd-forwarder-status.hpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/**
- * Copyright (c) 2013-2015 Regents of the University of California.
+ * Copyright (c) 2013-2016 Regents of the University of California.
*
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
*
@@ -19,207 +19,7 @@
* See AUTHORS.md for complete list of ndn-cxx authors and contributors.
*/
-#ifndef NDN_MANAGEMENT_NFD_FORWARDER_STATUS_HPP
-#define NDN_MANAGEMENT_NFD_FORWARDER_STATUS_HPP
-
-#include "../encoding/block.hpp"
-#include "../util/time.hpp"
-
-namespace ndn {
-namespace nfd {
-
-/**
- * \ingroup management
- * \brief represents NFD Forwarder Status
- * \sa http://redmine.named-data.net/projects/nfd/wiki/ForwarderStatus
+/** \file
+ * \deprecated Use mgmt/nfd/forwarder-status.hpp
*/
-class ForwarderStatus
-{
-public:
- class Error : public tlv::Error
- {
- public:
- explicit
- Error(const std::string& what)
- : tlv::Error(what)
- {
- }
- };
-
- ForwarderStatus();
-
- explicit
- ForwarderStatus(const Block& payload);
-
- /** \brief prepend ForwarderStatus as a Content block to the encoder
- *
- * The outermost Content element isn't part of ForwardStatus structure.
- */
- template<encoding::Tag TAG>
- size_t
- wireEncode(EncodingImpl<TAG>& encoder) const;
-
- /** \brief encode ForwarderStatus as a Content block
- *
- * The outermost Content element isn't part of ForwardStatus structure.
- */
- const Block&
- wireEncode() const;
-
- /** \brief decode ForwarderStatus from a Content block
- *
- * The outermost Content element isn't part of ForwardStatus structure.
- */
- void
- wireDecode(const Block& wire);
-
-public: // getters & setters
- const std::string&
- getNfdVersion() const
- {
- return m_nfdVersion;
- }
-
- ForwarderStatus&
- setNfdVersion(const std::string& nfdVersion);
-
- const time::system_clock::TimePoint&
- getStartTimestamp() const
- {
- return m_startTimestamp;
- }
-
- ForwarderStatus&
- setStartTimestamp(const time::system_clock::TimePoint& startTimestamp);
-
- const time::system_clock::TimePoint&
- getCurrentTimestamp() const
- {
- return m_currentTimestamp;
- }
-
- ForwarderStatus&
- setCurrentTimestamp(const time::system_clock::TimePoint& currentTimestamp);
-
- size_t
- getNNameTreeEntries() const
- {
- return m_nNameTreeEntries;
- }
-
- ForwarderStatus&
- setNNameTreeEntries(size_t nNameTreeEntries);
-
- size_t
- getNFibEntries() const
- {
- return m_nFibEntries;
- }
-
- ForwarderStatus&
- setNFibEntries(size_t nFibEntries);
-
- size_t
- getNPitEntries() const
- {
- return m_nPitEntries;
- }
-
- ForwarderStatus&
- setNPitEntries(size_t nPitEntries);
-
- size_t
- getNMeasurementsEntries() const
- {
- return m_nMeasurementsEntries;
- }
-
- ForwarderStatus&
- setNMeasurementsEntries(size_t nMeasurementsEntries);
-
- size_t
- getNCsEntries() const
- {
- return m_nCsEntries;
- }
-
- ForwarderStatus&
- setNCsEntries(size_t nCsEntries);
-
- uint64_t
- getNInInterests() const
- {
- return m_nInInterests;
- }
-
- ForwarderStatus&
- setNInInterests(uint64_t nInInterests);
-
- uint64_t
- getNInDatas() const
- {
- return m_nInDatas;
- }
-
- ForwarderStatus&
- setNInDatas(uint64_t nInDatas);
-
- uint64_t
- getNInNacks() const
- {
- return m_nInNacks;
- }
-
- ForwarderStatus&
- setNInNacks(uint64_t nInNacks);
-
- uint64_t
- getNOutInterests() const
- {
- return m_nOutInterests;
- }
-
- ForwarderStatus&
- setNOutInterests(uint64_t nOutInterests);
-
- uint64_t
- getNOutDatas() const
- {
- return m_nOutDatas;
- }
-
- ForwarderStatus&
- setNOutDatas(uint64_t nOutDatas);
-
- uint64_t
- getNOutNacks() const
- {
- return m_nOutNacks;
- }
-
- ForwarderStatus&
- setNOutNacks(uint64_t nOutNacks);
-
-private:
- std::string m_nfdVersion;
- time::system_clock::TimePoint m_startTimestamp;
- time::system_clock::TimePoint m_currentTimestamp;
- size_t m_nNameTreeEntries;
- size_t m_nFibEntries;
- size_t m_nPitEntries;
- size_t m_nMeasurementsEntries;
- size_t m_nCsEntries;
- uint64_t m_nInInterests;
- uint64_t m_nInDatas;
- uint64_t m_nInNacks;
- uint64_t m_nOutInterests;
- uint64_t m_nOutDatas;
- uint64_t m_nOutNacks;
-
- mutable Block m_wire;
-};
-
-} // namespace nfd
-} // namespace ndn
-
-#endif // NDN_MANAGEMENT_NFD_FORWARDER_STATUS_HPP
+#include "../mgmt/nfd/forwarder-status.hpp"
diff --git a/src/management/nfd-rib-entry.hpp b/src/management/nfd-rib-entry.hpp
index ad5fe92..2673e6c 100644
--- a/src/management/nfd-rib-entry.hpp
+++ b/src/management/nfd-rib-entry.hpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/**
- * Copyright (c) 2013-2015 Regents of the University of California.
+ * Copyright (c) 2013-2016 Regents of the University of California.
*
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
*
@@ -19,269 +19,7 @@
* See AUTHORS.md for complete list of ndn-cxx authors and contributors.
*/
-#ifndef NDN_MANAGEMENT_NFD_RIB_ENTRY_HPP
-#define NDN_MANAGEMENT_NFD_RIB_ENTRY_HPP
-
-#include "nfd-rib-flags.hpp" // include this first, to ensure it compiles on its own.
-#include "../name.hpp"
-#include "../util/time.hpp"
-
-#include <list>
-
-namespace ndn {
-namespace nfd {
-
-/**
- * @ingroup management
- *
- * @brief Data abstraction for Route
- *
- * A route indicates the availability of content via a certain face and
- * provides meta-information about the face.
- *
- * Route := ROUTE-TYPE TLV-LENGTH
- * FaceId
- * Origin
- * Cost
- * Flags
- * ExpirationPeriod?
- *
- * @sa http://redmine.named-data.net/projects/nfd/wiki/RibMgmt
+/** \file
+ * \deprecated Use mgmt/nfd/rib-entry.hpp
*/
-class Route : public RibFlagsTraits<Route>
-{
-public:
- class Error : public tlv::Error
- {
- public:
- explicit
- Error(const std::string& what) : tlv::Error(what)
- {
- }
- };
-
- Route();
-
- explicit
- Route(const Block& block);
-
- uint64_t
- getFaceId() const
- {
- return m_faceId;
- }
-
- Route&
- setFaceId(uint64_t faceId)
- {
- m_faceId = faceId;
- m_wire.reset();
- return *this;
- }
-
- uint64_t
- getOrigin() const
- {
- return m_origin;
- }
-
- /** @brief set Origin
- * @param origin a code defined in ndn::nfd::RouteOrigin
- */
- Route&
- setOrigin(uint64_t origin)
- {
- m_origin = origin;
- m_wire.reset();
- return *this;
- }
-
- uint64_t
- getCost() const
- {
- return m_cost;
- }
-
- Route&
- setCost(uint64_t cost)
- {
- m_cost = cost;
- m_wire.reset();
- return *this;
- }
-
- uint64_t
- getFlags() const
- {
- return m_flags;
- }
-
- /** @brief set route inheritance flags
- * @param flags a bitwise OR'ed code from ndn::nfd::RouteFlags
- */
- Route&
- setFlags(uint64_t flags)
- {
- m_flags = flags;
- m_wire.reset();
- return *this;
- }
-
- static const time::milliseconds INFINITE_EXPIRATION_PERIOD;
-
- const time::milliseconds&
- getExpirationPeriod() const
- {
- return m_expirationPeriod;
- }
-
- Route&
- setExpirationPeriod(const time::milliseconds& expirationPeriod)
- {
- m_expirationPeriod = expirationPeriod;
-
- m_hasInfiniteExpirationPeriod = m_expirationPeriod == INFINITE_EXPIRATION_PERIOD;
-
- m_wire.reset();
- return *this;
- }
-
- bool
- hasInfiniteExpirationPeriod() const
- {
- return m_hasInfiniteExpirationPeriod;
- }
-
- template<encoding::Tag TAG>
- size_t
- wireEncode(EncodingImpl<TAG>& block) const;
-
- const Block&
- wireEncode() const;
-
- void
- wireDecode(const Block& wire);
-
-private:
- uint64_t m_faceId;
- uint64_t m_origin;
- uint64_t m_cost;
- uint64_t m_flags;
- time::milliseconds m_expirationPeriod;
- bool m_hasInfiniteExpirationPeriod;
-
- mutable Block m_wire;
-};
-
-std::ostream&
-operator<<(std::ostream& os, const Route& route);
-
-/**
- * @ingroup management
- *
- * @brief Data abstraction for RIB entry
- *
- * A RIB entry contains one or more routes for the name prefix
- *
- * RibEntry := RIB-ENTRY-TYPE TLV-LENGTH
- * Name
- * Route+
- *
- * @sa http://redmine.named-data.net/projects/nfd/wiki/RibMgmt
- */
-class RibEntry
-{
-public:
- class Error : public tlv::Error
- {
- public:
- Error(const std::string& what) : tlv::Error(what)
- {
- }
- };
-
- typedef std::list<Route> RouteList;
- typedef RouteList::const_iterator iterator;
-
- RibEntry();
-
- explicit
- RibEntry(const Block& block);
-
- const Name&
- getName() const
- {
- return m_prefix;
- }
-
- RibEntry&
- setName(const Name& prefix)
- {
- m_prefix = prefix;
- m_wire.reset();
- return *this;
- }
-
- const std::list<Route>&
- getRoutes() const
- {
- return m_routes;
- }
-
- RibEntry&
- addRoute(const Route& route)
- {
- m_routes.push_back(route);
- m_wire.reset();
- return *this;
- }
-
- RibEntry&
- clearRoutes()
- {
- m_routes.clear();
- return *this;
- }
-
- template<encoding::Tag TAG>
- size_t
- wireEncode(EncodingImpl<TAG>& block) const;
-
- const Block&
- wireEncode() const;
-
- void
- wireDecode(const Block& wire);
-
- iterator
- begin() const;
-
- iterator
- end() const;
-
-private:
- Name m_prefix;
- RouteList m_routes;
-
- mutable Block m_wire;
-};
-
-inline RibEntry::iterator
-RibEntry::begin() const
-{
- return m_routes.begin();
-}
-
-inline RibEntry::iterator
-RibEntry::end() const
-{
- return m_routes.end();
-}
-
-std::ostream&
-operator<<(std::ostream& os, const RibEntry& entry);
-
-} // namespace nfd
-} // namespace ndn
-
-#endif // NDN_MANAGEMENT_NFD_RIB_ENTRY_HPP
+#include "../mgmt/nfd/rib-entry.hpp"
diff --git a/src/management/nfd-rib-flags.hpp b/src/management/nfd-rib-flags.hpp
index 07e36d1..8a15a34 100644
--- a/src/management/nfd-rib-flags.hpp
+++ b/src/management/nfd-rib-flags.hpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/**
- * Copyright (c) 2013-2014 Regents of the University of California.
+ * Copyright (c) 2013-2016 Regents of the University of California.
*
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
*
@@ -19,39 +19,7 @@
* See AUTHORS.md for complete list of ndn-cxx authors and contributors.
*/
-#ifndef NDN_MANAGEMENT_NFD_RIB_FLAGS_HPP
-#define NDN_MANAGEMENT_NFD_RIB_FLAGS_HPP
-
-#include "../encoding/nfd-constants.hpp"
-
-namespace ndn {
-namespace nfd {
-
-/**
- * \ingroup management
- * \brief implements getters to each RIB flag
- *
- * \tparam T class containing a RibFlags field and implements
- * `RibFlags getFlags() const` method
+/** \file
+ * \deprecated Use mgmt/nfd/rib-flags.hpp
*/
-template<typename T>
-class RibFlagsTraits
-{
-public:
- bool
- isChildInherit() const
- {
- return static_cast<const T*>(this)->getFlags() & ROUTE_FLAG_CHILD_INHERIT;
- }
-
- bool
- isRibCapture() const
- {
- return static_cast<const T*>(this)->getFlags() & ROUTE_FLAG_CAPTURE;
- }
-};
-
-} // namespace nfd
-} // namespace ndn
-
-#endif // NDN_MANAGEMENT_NFD_RIB_FLAGS_HPP
+#include "../mgmt/nfd/rib-flags.hpp"
diff --git a/src/management/nfd-status-dataset.hpp b/src/management/nfd-status-dataset.hpp
index 363186e..0f2d72a 100644
--- a/src/management/nfd-status-dataset.hpp
+++ b/src/management/nfd-status-dataset.hpp
@@ -19,234 +19,7 @@
* See AUTHORS.md for complete list of ndn-cxx authors and contributors.
*/
-#ifndef NDN_MANAGEMENT_NFD_STATUS_DATASET_HPP
-#define NDN_MANAGEMENT_NFD_STATUS_DATASET_HPP
-
-#include "../name.hpp"
-#include "nfd-forwarder-status.hpp"
-#include "nfd-face-status.hpp"
-#include "nfd-face-query-filter.hpp"
-#include "nfd-channel-status.hpp"
-#include "nfd-fib-entry.hpp"
-#include "nfd-strategy-choice.hpp"
-#include "nfd-rib-entry.hpp"
-
-namespace ndn {
-namespace nfd {
-
-/**
- * \ingroup management
- * \brief base class of NFD StatusDataset
- * \sa http://redmine.named-data.net/projects/nfd/wiki/StatusDataset
+/** \file
+ * \deprecated Use mgmt/nfd/status-dataset.hpp
*/
-class StatusDataset : noncopyable
-{
-public:
-#ifdef DOXYGEN
- /**
- * \brief if defined, specifies constructor argument type;
- * otherwise, constructor has no argument
- */
- typedef int ParamType;
-#endif
-
- /**
- * \brief constructs a name prefix for the dataset
- * \param prefix top-level prefix, such as ndn:/localhost/nfd
- * \return name prefix without version and segment components
- */
- Name
- getDatasetPrefix(const Name& prefix) const;
-
-#ifdef DOXYGEN
- /**
- * \brief provides the result type, usually a vector
- */
- typedef std::vector<int> ResultType;
-#endif
-
- /**
- * \brief indicates reassembled payload cannot be parsed as ResultType
- */
- class ParseResultError : public tlv::Error
- {
- public:
- explicit
- ParseResultError(const std::string& what)
- : tlv::Error(what)
- {
- }
- };
-
-#ifdef DOXYGEN
- /**
- * \brief parses a result from reassembled payload
- * \param payload reassembled payload
- * \throw tlv::Error cannot parse payload
- */
- ResultType
- parseResult(ConstBufferPtr payload) const;
-#endif
-
-protected:
- /**
- * \brief constructs a StatusDataset instance with given sub-prefix
- * \param datasetName dataset name after top-level prefix, such as faces/list
- */
- explicit
- StatusDataset(const PartialName& datasetName);
-
-private:
- /**
- * \brief appends parameters to the dataset name prefix
- * \param[in,out] the dataset name prefix onto which parameter components can be appended
- */
- virtual void
- addParameters(Name& name) const;
-
-private:
- PartialName m_datasetName;
-};
-
-
-/**
- * \ingroup management
- * \brief represents a status/general dataset
- * \sa http://redmine.named-data.net/projects/nfd/wiki/ForwarderStatus#General-Status-Dataset
- */
-class ForwarderGeneralStatusDataset : public StatusDataset
-{
-public:
- ForwarderGeneralStatusDataset();
-
- typedef ForwarderStatus ResultType;
-
- ResultType
- parseResult(ConstBufferPtr payload) const;
-};
-
-
-/**
- * \ingroup management
- * \brief provides common functionality among FaceDataset and FaceQueryDataset
- */
-class FaceDatasetBase : public StatusDataset
-{
-public:
- typedef std::vector<FaceStatus> ResultType;
-
- ResultType
- parseResult(ConstBufferPtr payload) const;
-
-protected:
- explicit
- FaceDatasetBase(const PartialName& datasetName);
-};
-
-
-/**
- * \ingroup management
- * \brief represents a faces/list dataset
- * \sa http://redmine.named-data.net/projects/nfd/wiki/FaceMgmt#Face-Dataset
- */
-class FaceDataset : public FaceDatasetBase
-{
-public:
- FaceDataset();
-};
-
-
-/**
- * \ingroup management
- * \brief represents a faces/query dataset
- * \sa http://redmine.named-data.net/projects/nfd/wiki/FaceMgmt#Query-Operation
- */
-class FaceQueryDataset : public FaceDatasetBase
-{
-public:
- typedef FaceQueryFilter ParamType;
-
- explicit
- FaceQueryDataset(const FaceQueryFilter& filter);
-
-private:
- virtual void
- addParameters(Name& name) const override;
-
-private:
- FaceQueryFilter m_filter;
-};
-
-
-/**
- * \ingroup management
- * \brief represents a faces/channels dataset
- * \sa https://redmine.named-data.net/projects/nfd/wiki/FaceMgmt#Channel-Dataset
- */
-class ChannelDataset : public StatusDataset
-{
-public:
- ChannelDataset();
-
- typedef std::vector<ChannelStatus> ResultType;
-
- ResultType
- parseResult(ConstBufferPtr payload) const;
-};
-
-
-/**
- * \ingroup management
- * \brief represents a fib/list dataset
- * \sa http://redmine.named-data.net/projects/nfd/wiki/FibMgmt#FIB-Dataset
- */
-class FibDataset : public StatusDataset
-{
-public:
- FibDataset();
-
- typedef std::vector<FibEntry> ResultType;
-
- ResultType
- parseResult(ConstBufferPtr payload) const;
-};
-
-
-/**
- * \ingroup management
- * \brief represents a strategy-choice/list dataset
- * \sa http://redmine.named-data.net/projects/nfd/wiki/StrategyChoice#Strategy-Choice-Dataset
- */
-class StrategyChoiceDataset : public StatusDataset
-{
-public:
- StrategyChoiceDataset();
-
- typedef std::vector<StrategyChoice> ResultType;
-
- ResultType
- parseResult(ConstBufferPtr payload) const;
-};
-
-
-/**
- * \ingroup management
- * \brief represents a rib/list dataset
- * \sa http://redmine.named-data.net/projects/nfd/wiki/RibMgmt#RIB-Dataset
- */
-class RibDataset : public StatusDataset
-{
-public:
- RibDataset();
-
- typedef std::vector<RibEntry> ResultType;
-
- ResultType
- parseResult(ConstBufferPtr payload) const;
-};
-
-
-} // namespace nfd
-} // namespace ndn
-
-#endif // NDN_MANAGEMENT_NFD_STATUS_DATASET_HPP
+#include "../mgmt/nfd/status-dataset.hpp"
diff --git a/src/management/nfd-strategy-choice.hpp b/src/management/nfd-strategy-choice.hpp
index 4d8e781..1b31c0d 100644
--- a/src/management/nfd-strategy-choice.hpp
+++ b/src/management/nfd-strategy-choice.hpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/**
- * Copyright (c) 2013-2015 Regents of the University of California.
+ * Copyright (c) 2013-2016 Regents of the University of California.
*
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
*
@@ -19,75 +19,7 @@
* See AUTHORS.md for complete list of ndn-cxx authors and contributors.
*/
-#ifndef NDN_MANAGEMENT_NFD_STRATEGY_CHOICE_HPP
-#define NDN_MANAGEMENT_NFD_STRATEGY_CHOICE_HPP
-
-#include "../encoding/block.hpp"
-#include "../name.hpp"
-
-namespace ndn {
-namespace nfd {
-
-/**
- * @ingroup management
- * @brief represents NFD StrategyChoice dataset
- * @sa http://redmine.named-data.net/projects/nfd/wiki/StrategyChoice#Strategy-Choice-Dataset
+/** \file
+ * \deprecated Use mgmt/nfd/strategy-choice.hpp
*/
-class StrategyChoice
-{
-public:
- class Error : public tlv::Error
- {
- public:
- explicit
- Error(const std::string& what)
- : tlv::Error(what)
- {
- }
- };
-
- StrategyChoice();
-
- explicit
- StrategyChoice(const Block& payload);
-
- template<encoding::Tag TAG>
- size_t
- wireEncode(EncodingImpl<TAG>& encoder) const;
-
- const Block&
- wireEncode() const;
-
- void
- wireDecode(const Block& wire);
-
-public: // getters & setters
- const Name&
- getName() const
- {
- return m_name;
- }
-
- StrategyChoice&
- setName(const Name& name);
-
- const Name&
- getStrategy() const
- {
- return m_strategy;
- }
-
- StrategyChoice&
- setStrategy(const Name& strategy);
-
-private:
- Name m_name; // namespace
- Name m_strategy; // strategy for the namespace
-
- mutable Block m_wire;
-};
-
-} // namespace nfd
-} // namespace ndn
-
-#endif // NDN_MANAGEMENT_NFD_STRATEGY_CHOICE_HPP
+#include "../mgmt/nfd/strategy-choice.hpp"
diff --git a/src/management/nfd-channel-status.cpp b/src/mgmt/nfd/channel-status.cpp
similarity index 96%
rename from src/management/nfd-channel-status.cpp
rename to src/mgmt/nfd/channel-status.cpp
index b53d198..bbbfdf4 100644
--- a/src/management/nfd-channel-status.cpp
+++ b/src/mgmt/nfd/channel-status.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/**
- * Copyright (c) 2013-2015 Regents of the University of California.
+ * Copyright (c) 2013-2016 Regents of the University of California.
*
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
*
@@ -19,7 +19,7 @@
* See AUTHORS.md for complete list of ndn-cxx authors and contributors.
*/
-#include "nfd-channel-status.hpp"
+#include "channel-status.hpp"
#include "encoding/tlv-nfd.hpp"
#include "encoding/block-helpers.hpp"
#include "util/concepts.hpp"
diff --git a/src/mgmt/nfd/channel-status.hpp b/src/mgmt/nfd/channel-status.hpp
new file mode 100644
index 0000000..5a2aae8
--- /dev/null
+++ b/src/mgmt/nfd/channel-status.hpp
@@ -0,0 +1,82 @@
+/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
+/**
+ * Copyright (c) 2013-2016 Regents of the University of California.
+ *
+ * This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
+ *
+ * ndn-cxx library is free software: you can redistribute it and/or modify it under the
+ * terms of the GNU Lesser General Public License as published by the Free Software
+ * Foundation, either version 3 of the License, or (at your option) any later version.
+ *
+ * ndn-cxx library 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 Lesser General Public License for more details.
+ *
+ * You should have received copies of the GNU General Public License and GNU Lesser
+ * General Public License along with ndn-cxx, e.g., in COPYING.md file. If not, see
+ * <http://www.gnu.org/licenses/>.
+ *
+ * See AUTHORS.md for complete list of ndn-cxx authors and contributors.
+ */
+
+#ifndef NDN_MGMT_NFD_CHANNEL_STATUS_HPP
+#define NDN_MGMT_NFD_CHANNEL_STATUS_HPP
+
+#include "../../encoding/block.hpp"
+
+namespace ndn {
+namespace nfd {
+
+/**
+ * @ingroup management
+ * @brief represents NFD Channel Status dataset
+ * @sa http://redmine.named-data.net/projects/nfd/wiki/FaceMgmt#Channel-Dataset
+ */
+class ChannelStatus
+{
+public:
+ class Error : public tlv::Error
+ {
+ public:
+ explicit
+ Error(const std::string& what)
+ : tlv::Error(what)
+ {
+ }
+ };
+
+ ChannelStatus();
+
+ explicit
+ ChannelStatus(const Block& payload);
+
+ template<encoding::Tag TAG>
+ size_t
+ wireEncode(EncodingImpl<TAG>& encoder) const;
+
+ const Block&
+ wireEncode() const;
+
+ void
+ wireDecode(const Block& wire);
+
+public: // getters & setters
+ const std::string&
+ getLocalUri() const
+ {
+ return m_localUri;
+ }
+
+ ChannelStatus&
+ setLocalUri(const std::string localUri);
+
+private:
+ std::string m_localUri;
+
+ mutable Block m_wire;
+};
+
+} // namespace nfd
+} // namespace ndn
+
+#endif // NDN_MGMT_NFD_CHANNEL_STATUS_HPP
diff --git a/src/management/nfd-command-options.cpp b/src/mgmt/nfd/command-options.cpp
similarity index 96%
rename from src/management/nfd-command-options.cpp
rename to src/mgmt/nfd/command-options.cpp
index 6794483..557cce3 100644
--- a/src/management/nfd-command-options.cpp
+++ b/src/mgmt/nfd/command-options.cpp
@@ -19,11 +19,11 @@
* See AUTHORS.md for complete list of ndn-cxx authors and contributors.
*/
-#include "nfd-command-options.hpp"
+#include "command-options.hpp"
#ifdef NDN_MANAGEMENT_NFD_COMMAND_OPTIONS_KEEP_DEPRECATED_SIGNING_PARAMS
-#include "../security/v1/identity-certificate.hpp"
-#include "../security/signing-helpers.hpp"
+#include "../../security/v1/identity-certificate.hpp"
+#include "../../security/signing-helpers.hpp"
#endif // NDN_MANAGEMENT_NFD_COMMAND_OPTIONS_KEEP_DEPRECATED_SIGNING_PARAMS
namespace ndn {
diff --git a/src/mgmt/nfd/command-options.hpp b/src/mgmt/nfd/command-options.hpp
new file mode 100644
index 0000000..efde928
--- /dev/null
+++ b/src/mgmt/nfd/command-options.hpp
@@ -0,0 +1,196 @@
+/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
+/**
+ * Copyright (c) 2013-2016 Regents of the University of California.
+ *
+ * This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
+ *
+ * ndn-cxx library is free software: you can redistribute it and/or modify it under the
+ * terms of the GNU Lesser General Public License as published by the Free Software
+ * Foundation, either version 3 of the License, or (at your option) any later version.
+ *
+ * ndn-cxx library 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 Lesser General Public License for more details.
+ *
+ * You should have received copies of the GNU General Public License and GNU Lesser
+ * General Public License along with ndn-cxx, e.g., in COPYING.md file. If not, see
+ * <http://www.gnu.org/licenses/>.
+ *
+ * See AUTHORS.md for complete list of ndn-cxx authors and contributors.
+ */
+
+#ifndef NDN_MGMT_NFD_COMMAND_OPTIONS_HPP
+#define NDN_MGMT_NFD_COMMAND_OPTIONS_HPP
+
+#include "../../security/signing-info.hpp"
+
+#define NDN_MGMT_NFD_COMMAND_OPTIONS_KEEP_DEPRECATED_SIGNING_PARAMS
+
+namespace ndn {
+
+namespace security {
+namespace v1 {
+class IdentityCertificate;
+} // namespace v1
+} // namespace security
+
+namespace nfd {
+
+/** \ingroup management
+ * \brief contains options for ControlCommand execution
+ * \note This type is intentionally copyable
+ */
+class CommandOptions
+{
+public:
+ /** \brief constructs CommandOptions
+ * \post getTimeout() == DEFAULT_TIMEOUT
+ * \post getPrefix() == DEFAULT_PREFIX
+ * \post getSigningInfo().getSignerType() == SIGNER_TYPE_NULL
+ */
+ CommandOptions();
+
+ /** \return command timeout
+ */
+ const time::milliseconds&
+ getTimeout() const
+ {
+ return m_timeout;
+ }
+
+ /** \brief sets command timeout
+ * \param timeout the new command timeout, must be positive
+ * \throw std::out_of_range if timeout is non-positive
+ * \return self
+ */
+ CommandOptions&
+ setTimeout(const time::milliseconds& timeout);
+
+ /** \return command prefix
+ */
+ const Name&
+ getPrefix() const
+ {
+ return m_prefix;
+ }
+
+ /** \brief sets command prefix
+ * \return self
+ */
+ CommandOptions&
+ setPrefix(const Name& prefix);
+
+ /** \return signing parameters
+ */
+ const security::SigningInfo&
+ getSigningInfo() const
+ {
+ return m_signingInfo;
+ }
+
+ /** \brief sets signing parameters
+ * \return self
+ */
+ CommandOptions&
+ setSigningInfo(const security::SigningInfo& signingInfo);
+
+#ifdef NDN_MGMT_NFD_COMMAND_OPTIONS_KEEP_DEPRECATED_SIGNING_PARAMS
+public: // signing parameters
+ /** \deprecated use getSigningInfo and setSigningInfo
+ * \brief indicates the selection of signing parameters
+ */
+ enum SigningParamsKind {
+ /** \brief picks the default signing identity and certificate
+ */
+ SIGNING_PARAMS_DEFAULT,
+ /** \brief picks the default certificate of a specific identity Name
+ */
+ SIGNING_PARAMS_IDENTITY,
+ /** \brief picks a specific identity certificate
+ */
+ SIGNING_PARAMS_CERTIFICATE
+ };
+
+ /** \deprecated use getSigningInfo and setSigningInfo
+ * \return selection of signing parameters
+ */
+ DEPRECATED(
+ SigningParamsKind
+ getSigningParamsKind() const);
+
+ /** \deprecated use getSigningInfo and setSigningInfo
+ * \return identity Name
+ * \pre getSigningParamsKind() == SIGNING_PARAMS_IDENTITY
+ */
+ DEPRECATED(
+ const Name&
+ getSigningIdentity() const);
+
+ /** \deprecated use getSigningInfo and setSigningInfo
+ * \return certificate Name
+ * \pre getSigningParamsKind() == SIGNING_PARAMS_CERTIFICATE
+ */
+ DEPRECATED(
+ const Name&
+ getSigningCertificate() const);
+
+ /** \deprecated use getSigningInfo and setSigningInfo
+ * \brief chooses to use default identity and certificate
+ * \post getSigningParamsKind() == SIGNING_PARAMS_DEFAULT
+ * \return self
+ */
+ DEPRECATED(
+ CommandOptions&
+ setSigningDefault());
+
+ /** \deprecated use getSigningInfo and setSigningInfo
+ * \brief chooses to use a specific identity and its default certificate
+ * \post getSigningParamsKind() == SIGNING_PARAMS_IDENTITY
+ * \post getIdentityName() == identityName
+ * \return self
+ */
+ DEPRECATED(
+ CommandOptions&
+ setSigningIdentity(const Name& identityName));
+
+ /** \deprecated use getSigningInfo and setSigningInfo
+ * \brief chooses to use a specific identity certificate
+ * \param certificateName identity certificate Name
+ * \throw std::invalid_argument if certificateName is invalid
+ * \post getSigningParamsKind() == SIGNING_PARAMS_CERTIFICATE
+ * \post getSigningCertificate() == certificateName
+ * \return self
+ */
+ DEPRECATED(
+ CommandOptions&
+ setSigningCertificate(const Name& certificateName));
+
+ /** \deprecated use getSigningInfo and setSigningInfo
+ * \brief chooses to use a specific identity certificate
+ * \details This is equivalent to .setIdentityCertificate(certificate.getName())
+ */
+ DEPRECATED(
+ CommandOptions&
+ setSigningCertificate(const security::v1::IdentityCertificate& certificate));
+
+#endif // NDN_MGMT_NFD_COMMAND_OPTIONS_KEEP_DEPRECATED_SIGNING_PARAMS
+
+public:
+ /** \brief gives the default command timeout: 10000ms
+ */
+ static const time::milliseconds DEFAULT_TIMEOUT;
+
+ /** \brief gives the default command prefix: ndn:/localhost/nfd
+ */
+ static const Name DEFAULT_PREFIX;
+
+private:
+ time::milliseconds m_timeout;
+ Name m_prefix;
+ security::SigningInfo m_signingInfo;
+};
+
+} // namespace nfd
+} // namespace ndn
+
+#endif // NDN_MGMT_NFD_COMMAND_OPTIONS_HPP
diff --git a/src/management/nfd-control-command.cpp b/src/mgmt/nfd/control-command.cpp
similarity index 98%
rename from src/management/nfd-control-command.cpp
rename to src/mgmt/nfd/control-command.cpp
index 45c2a08..2a6eda7 100644
--- a/src/management/nfd-control-command.cpp
+++ b/src/mgmt/nfd/control-command.cpp
@@ -19,8 +19,8 @@
* See AUTHORS.md for complete list of ndn-cxx authors and contributors.
*/
-#include "nfd-control-command.hpp"
-#include "nfd-command-options.hpp" // only used in deprecated functions
+#include "control-command.hpp"
+#include "command-options.hpp" // only used in deprecated functions
namespace ndn {
namespace nfd {
diff --git a/src/mgmt/nfd/control-command.hpp b/src/mgmt/nfd/control-command.hpp
new file mode 100644
index 0000000..7544156
--- /dev/null
+++ b/src/mgmt/nfd/control-command.hpp
@@ -0,0 +1,348 @@
+/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
+/**
+ * Copyright (c) 2013-2016 Regents of the University of California.
+ *
+ * This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
+ *
+ * ndn-cxx library is free software: you can redistribute it and/or modify it under the
+ * terms of the GNU Lesser General Public License as published by the Free Software
+ * Foundation, either version 3 of the License, or (at your option) any later version.
+ *
+ * ndn-cxx library 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 Lesser General Public License for more details.
+ *
+ * You should have received copies of the GNU General Public License and GNU Lesser
+ * General Public License along with ndn-cxx, e.g., in COPYING.md file. If not, see
+ * <http://www.gnu.org/licenses/>.
+ *
+ * See AUTHORS.md for complete list of ndn-cxx authors and contributors.
+ */
+
+#ifndef NDN_MGMT_NFD_CONTROL_COMMAND_HPP
+#define NDN_MGMT_NFD_CONTROL_COMMAND_HPP
+
+#include "control-parameters.hpp"
+
+namespace ndn {
+namespace nfd {
+
+/**
+ * \ingroup management
+ * \brief base class of NFD ControlCommand
+ * \sa http://redmine.named-data.net/projects/nfd/wiki/ControlCommand
+ */
+class ControlCommand : noncopyable
+{
+public:
+ /** \brief represents an error in ControlParameters
+ */
+ class ArgumentError : public std::invalid_argument
+ {
+ public:
+ explicit
+ ArgumentError(const std::string& what)
+ : std::invalid_argument(what)
+ {
+ }
+ };
+
+ virtual
+ ~ControlCommand();
+
+ /** \brief validate request parameters
+ * \throw ArgumentError if parameters are invalid
+ */
+ virtual void
+ validateRequest(const ControlParameters& parameters) const;
+
+ /** \brief apply default values to missing fields in request
+ */
+ virtual void
+ applyDefaultsToRequest(ControlParameters& parameters) const;
+
+ /** \brief validate response parameters
+ * \throw ArgumentError if parameters are invalid
+ */
+ virtual void
+ validateResponse(const ControlParameters& parameters) const;
+
+ /** \brief apply default values to missing fields in response
+ */
+ virtual void
+ applyDefaultsToResponse(ControlParameters& parameters) const;
+
+ /** \brief construct the Name for a request Interest
+ * \throw ArgumentError if parameters are invalid
+ */
+ Name
+ getRequestName(const Name& commandPrefix, const ControlParameters& parameters) const;
+
+protected:
+ ControlCommand(const std::string& module, const std::string& verb);
+
+ class FieldValidator
+ {
+ public:
+ FieldValidator();
+
+ /** \brief declare a required field
+ */
+ FieldValidator&
+ required(ControlParameterField field)
+ {
+ m_required[field] = true;
+ return *this;
+ }
+
+ /** \brief declare an optional field
+ */
+ FieldValidator&
+ optional(ControlParameterField field)
+ {
+ m_optional[field] = true;
+ return *this;
+ }
+
+ /** \brief verify that all required fields are present,
+ * and all present fields are either required or optional
+ * \throw ArgumentError
+ */
+ void
+ validate(const ControlParameters& parameters) const;
+
+ private:
+ std::vector<bool> m_required;
+ std::vector<bool> m_optional;
+ };
+
+protected:
+ /** \brief FieldValidator for request ControlParameters
+ *
+ * Constructor of subclass should populate this validator.
+ */
+ FieldValidator m_requestValidator;
+ /** \brief FieldValidator for response ControlParameters
+ *
+ * Constructor of subclass should populate this validator.
+ */
+ FieldValidator m_responseValidator;
+
+private:
+ name::Component m_module;
+ name::Component m_verb;
+};
+
+
+/**
+ * \ingroup management
+ * \brief represents a faces/create command
+ * \sa http://redmine.named-data.net/projects/nfd/wiki/FaceMgmt#Create-a-face
+ */
+class FaceCreateCommand : public ControlCommand
+{
+public:
+ FaceCreateCommand();
+
+ virtual void
+ applyDefaultsToRequest(ControlParameters& parameters) const override;
+
+ virtual void
+ validateRequest(const ControlParameters& parameters) const override;
+
+ virtual void
+ validateResponse(const ControlParameters& parameters) const override;
+};
+
+
+/**
+ * \ingroup management
+ * \brief represents a faces/update command
+ * \sa http://redmine.named-data.net/projects/nfd/wiki/FaceMgmt#Update-a-face
+ */
+class FaceUpdateCommand : public ControlCommand
+{
+public:
+ FaceUpdateCommand();
+
+ virtual void
+ applyDefaultsToRequest(ControlParameters& parameters) const override;
+
+ virtual void
+ validateRequest(const ControlParameters& parameters) const override;
+
+ /**
+ * \note This can only validate ControlParameters in a success response.
+ * Failure responses should be validated with validateRequest.
+ */
+ virtual void
+ validateResponse(const ControlParameters& parameters) const override;
+};
+
+
+/**
+ * \ingroup management
+ * \brief represents a faces/destroy command
+ * \sa http://redmine.named-data.net/projects/nfd/wiki/FaceMgmt#Destroy-a-face
+ */
+class FaceDestroyCommand : public ControlCommand
+{
+public:
+ FaceDestroyCommand();
+
+ virtual void
+ validateRequest(const ControlParameters& parameters) const override;
+
+ virtual void
+ validateResponse(const ControlParameters& parameters) const override;
+};
+
+
+/**
+ * \ingroup management
+ * \brief Base class for faces/[*]-local-control commands
+ */
+class FaceLocalControlCommand : public ControlCommand
+{
+public:
+ virtual void
+ validateRequest(const ControlParameters& parameters) const override;
+
+ virtual void
+ validateResponse(const ControlParameters& parameters) const override;
+
+protected:
+ explicit
+ FaceLocalControlCommand(const std::string& verb);
+};
+
+
+/**
+ * \ingroup management
+ * \brief represents a faces/enable-local-control command
+ * \sa http://redmine.named-data.net/projects/nfd/wiki/FaceMgmt#Enable-a-LocalControlHeader-feature
+ */
+class FaceEnableLocalControlCommand : public FaceLocalControlCommand
+{
+public:
+ FaceEnableLocalControlCommand();
+};
+
+
+/**
+ * \ingroup management
+ * \brief represents a faces/disable-local-control command
+ * \sa http://redmine.named-data.net/projects/nfd/wiki/FaceMgmt#Disable-a-LocalControlHeader-feature
+ */
+class FaceDisableLocalControlCommand : public FaceLocalControlCommand
+{
+public:
+ FaceDisableLocalControlCommand();
+};
+
+
+/**
+ * \ingroup management
+ * \brief represents a fib/add-nexthop command
+ * \sa http://redmine.named-data.net/projects/nfd/wiki/FibMgmt#Add-a-nexthop
+ */
+class FibAddNextHopCommand : public ControlCommand
+{
+public:
+ FibAddNextHopCommand();
+
+ virtual void
+ applyDefaultsToRequest(ControlParameters& parameters) const override;
+
+ virtual void
+ validateResponse(const ControlParameters& parameters) const override;
+};
+
+
+/**
+ * \ingroup management
+ * \brief represents a fib/remove-nexthop command
+ * \sa http://redmine.named-data.net/projects/nfd/wiki/FibMgmt#Remove-a-nexthop
+ */
+class FibRemoveNextHopCommand : public ControlCommand
+{
+public:
+ FibRemoveNextHopCommand();
+
+ virtual void
+ applyDefaultsToRequest(ControlParameters& parameters) const override;
+
+ virtual void
+ validateResponse(const ControlParameters& parameters) const override;
+};
+
+
+/**
+ * \ingroup management
+ * \brief represents a strategy-choice/set command
+ * \sa http://redmine.named-data.net/projects/nfd/wiki/StrategyChoice#Set-the-strategy-for-a-namespace
+ */
+class StrategyChoiceSetCommand : public ControlCommand
+{
+public:
+ StrategyChoiceSetCommand();
+};
+
+
+/**
+ * \ingroup management
+ * \brief represents a strategy-choice/set command
+ * \sa http://redmine.named-data.net/projects/nfd/wiki/StrategyChoice#Unset-the-strategy-for-a-namespace
+ */
+class StrategyChoiceUnsetCommand : public ControlCommand
+{
+public:
+ StrategyChoiceUnsetCommand();
+
+ virtual void
+ validateRequest(const ControlParameters& parameters) const override;
+
+ virtual void
+ validateResponse(const ControlParameters& parameters) const override;
+};
+
+
+/**
+ * \ingroup management
+ * \brief represents a rib/register command
+ * \sa http://redmine.named-data.net/projects/nfd/wiki/RibMgmt#Register-a-route
+ */
+class RibRegisterCommand : public ControlCommand
+{
+public:
+ RibRegisterCommand();
+
+ virtual void
+ applyDefaultsToRequest(ControlParameters& parameters) const override;
+
+ virtual void
+ validateResponse(const ControlParameters& parameters) const override;
+};
+
+
+/**
+ * \ingroup management
+ * \brief represents a rib/unregister command
+ * \sa http://redmine.named-data.net/projects/nfd/wiki/RibMgmt#Unregister-a-route
+ */
+class RibUnregisterCommand : public ControlCommand
+{
+public:
+ RibUnregisterCommand();
+
+ virtual void
+ applyDefaultsToRequest(ControlParameters& parameters) const override;
+
+ virtual void
+ validateResponse(const ControlParameters& parameters) const override;
+};
+
+} // namespace nfd
+} // namespace ndn
+
+#endif // NDN_MGMT_NFD_CONTROL_COMMAND_HPP
diff --git a/src/management/nfd-control-parameters.cpp b/src/mgmt/nfd/control-parameters.cpp
similarity index 99%
rename from src/management/nfd-control-parameters.cpp
rename to src/mgmt/nfd/control-parameters.cpp
index f68ca26..30f8fe9 100644
--- a/src/management/nfd-control-parameters.cpp
+++ b/src/mgmt/nfd/control-parameters.cpp
@@ -19,7 +19,7 @@
* See AUTHORS.md for complete list of ndn-cxx authors and contributors.
*/
-#include "nfd-control-parameters.hpp"
+#include "control-parameters.hpp"
#include "encoding/tlv-nfd.hpp"
#include "encoding/block-helpers.hpp"
#include "util/concepts.hpp"
diff --git a/src/mgmt/nfd/control-parameters.hpp b/src/mgmt/nfd/control-parameters.hpp
new file mode 100644
index 0000000..d57c75d
--- /dev/null
+++ b/src/mgmt/nfd/control-parameters.hpp
@@ -0,0 +1,514 @@
+/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
+/**
+ * Copyright (c) 2013-2016 Regents of the University of California.
+ *
+ * This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
+ *
+ * ndn-cxx library is free software: you can redistribute it and/or modify it under the
+ * terms of the GNU Lesser General Public License as published by the Free Software
+ * Foundation, either version 3 of the License, or (at your option) any later version.
+ *
+ * ndn-cxx library 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 Lesser General Public License for more details.
+ *
+ * You should have received copies of the GNU General Public License and GNU Lesser
+ * General Public License along with ndn-cxx, e.g., in COPYING.md file. If not, see
+ * <http://www.gnu.org/licenses/>.
+ *
+ * See AUTHORS.md for complete list of ndn-cxx authors and contributors.
+ */
+
+#ifndef NDN_MGMT_NFD_CONTROL_PARAMETERS_HPP
+#define NDN_MGMT_NFD_CONTROL_PARAMETERS_HPP
+
+#include "../../encoding/nfd-constants.hpp"
+#include "../../name.hpp"
+#include "../../util/time.hpp"
+#include "../control-parameters.hpp"
+
+namespace ndn {
+namespace nfd {
+
+/**
+ * \ingroup management
+ */
+enum ControlParameterField {
+ CONTROL_PARAMETER_NAME,
+ CONTROL_PARAMETER_FACE_ID,
+ CONTROL_PARAMETER_URI,
+ CONTROL_PARAMETER_LOCAL_CONTROL_FEATURE,
+ CONTROL_PARAMETER_ORIGIN,
+ CONTROL_PARAMETER_COST,
+ CONTROL_PARAMETER_FLAGS,
+ CONTROL_PARAMETER_MASK,
+ CONTROL_PARAMETER_STRATEGY,
+ CONTROL_PARAMETER_EXPIRATION_PERIOD,
+ CONTROL_PARAMETER_FACE_PERSISTENCY,
+ CONTROL_PARAMETER_UBOUND
+};
+
+const std::string CONTROL_PARAMETER_FIELD[CONTROL_PARAMETER_UBOUND] = {
+ "Name",
+ "FaceId",
+ "Uri",
+ "LocalControlFeature",
+ "Origin",
+ "Cost",
+ "Flags",
+ "Mask",
+ "Strategy",
+ "ExpirationPeriod",
+ "FacePersistency"
+};
+
+/**
+ * \ingroup management
+ * \deprecated use Flags+Mask fields instead
+ */
+enum LocalControlFeature {
+ LOCAL_CONTROL_FEATURE_INCOMING_FACE_ID = 1,
+ LOCAL_CONTROL_FEATURE_NEXT_HOP_FACE_ID = 2
+};
+
+/**
+ * \ingroup management
+ * \brief represents parameters in a ControlCommand request or response
+ * \sa http://redmine.named-data.net/projects/nfd/wiki/ControlCommand#ControlParameters
+ * \details This type is copyable because it's an abstraction of a TLV type.
+ */
+class ControlParameters : public ndn::mgmt::ControlParameters
+{
+public:
+ class Error : public tlv::Error
+ {
+ public:
+ explicit
+ Error(const std::string& what)
+ : tlv::Error(what)
+ {
+ }
+ };
+
+ ControlParameters();
+
+ explicit
+ ControlParameters(const Block& block);
+
+ template<encoding::Tag TAG>
+ size_t
+ wireEncode(EncodingImpl<TAG>& encoder) const;
+
+ virtual Block
+ wireEncode() const final;
+
+ virtual void
+ wireDecode(const Block& wire) final;
+
+public: // getters & setters
+ bool
+ hasName() const
+ {
+ return m_hasFields[CONTROL_PARAMETER_NAME];
+ }
+
+ const Name&
+ getName() const
+ {
+ BOOST_ASSERT(this->hasName());
+ return m_name;
+ }
+
+ ControlParameters&
+ setName(const Name& name)
+ {
+ m_wire.reset();
+ m_name = name;
+ m_hasFields[CONTROL_PARAMETER_NAME] = true;
+ return *this;
+ }
+
+ ControlParameters&
+ unsetName()
+ {
+ m_wire.reset();
+ m_hasFields[CONTROL_PARAMETER_NAME] = false;
+ return *this;
+ }
+
+ bool
+ hasFaceId() const
+ {
+ return m_hasFields[CONTROL_PARAMETER_FACE_ID];
+ }
+
+ uint64_t
+ getFaceId() const
+ {
+ BOOST_ASSERT(this->hasFaceId());
+ return m_faceId;
+ }
+
+ ControlParameters&
+ setFaceId(uint64_t faceId)
+ {
+ m_wire.reset();
+ m_faceId = faceId;
+ m_hasFields[CONTROL_PARAMETER_FACE_ID] = true;
+ return *this;
+ }
+
+ ControlParameters&
+ unsetFaceId()
+ {
+ m_wire.reset();
+ m_hasFields[CONTROL_PARAMETER_FACE_ID] = false;
+ return *this;
+ }
+
+ bool
+ hasUri() const
+ {
+ return m_hasFields[CONTROL_PARAMETER_URI];
+ }
+
+ const std::string&
+ getUri() const
+ {
+ BOOST_ASSERT(this->hasUri());
+ return m_uri;
+ }
+
+ ControlParameters&
+ setUri(const std::string& uri)
+ {
+ m_wire.reset();
+ m_uri = uri;
+ m_hasFields[CONTROL_PARAMETER_URI] = true;
+ return *this;
+ }
+
+ ControlParameters&
+ unsetUri()
+ {
+ m_wire.reset();
+ m_hasFields[CONTROL_PARAMETER_URI] = false;
+ return *this;
+ }
+
+ /**
+ * \deprecated use Flags+Mask fields instead
+ */
+ bool
+ hasLocalControlFeature() const
+ {
+ return m_hasFields[CONTROL_PARAMETER_LOCAL_CONTROL_FEATURE];
+ }
+
+ /**
+ * \deprecated use Flags+Mask fields instead
+ */
+ LocalControlFeature
+ getLocalControlFeature() const
+ {
+ BOOST_ASSERT(this->hasLocalControlFeature());
+ return m_localControlFeature;
+ }
+
+ /**
+ * \deprecated use Flags+Mask fields instead
+ */
+ ControlParameters&
+ setLocalControlFeature(LocalControlFeature localControlFeature)
+ {
+ m_wire.reset();
+ m_localControlFeature = localControlFeature;
+ m_hasFields[CONTROL_PARAMETER_LOCAL_CONTROL_FEATURE] = true;
+ return *this;
+ }
+
+ /**
+ * \deprecated use Flags+Mask fields instead
+ */
+ ControlParameters&
+ unsetLocalControlFeature()
+ {
+ m_wire.reset();
+ m_hasFields[CONTROL_PARAMETER_LOCAL_CONTROL_FEATURE] = false;
+ return *this;
+ }
+
+ bool
+ hasOrigin() const
+ {
+ return m_hasFields[CONTROL_PARAMETER_ORIGIN];
+ }
+
+ uint64_t
+ getOrigin() const
+ {
+ BOOST_ASSERT(this->hasOrigin());
+ return m_origin;
+ }
+
+ ControlParameters&
+ setOrigin(uint64_t origin)
+ {
+ m_wire.reset();
+ m_origin = origin;
+ m_hasFields[CONTROL_PARAMETER_ORIGIN] = true;
+ return *this;
+ }
+
+ ControlParameters&
+ unsetOrigin()
+ {
+ m_wire.reset();
+ m_hasFields[CONTROL_PARAMETER_ORIGIN] = false;
+ return *this;
+ }
+
+ bool
+ hasCost() const
+ {
+ return m_hasFields[CONTROL_PARAMETER_COST];
+ }
+
+ uint64_t
+ getCost() const
+ {
+ BOOST_ASSERT(this->hasCost());
+ return m_cost;
+ }
+
+ ControlParameters&
+ setCost(uint64_t cost)
+ {
+ m_wire.reset();
+ m_cost = cost;
+ m_hasFields[CONTROL_PARAMETER_COST] = true;
+ return *this;
+ }
+
+ ControlParameters&
+ unsetCost()
+ {
+ m_wire.reset();
+ m_hasFields[CONTROL_PARAMETER_COST] = false;
+ return *this;
+ }
+
+ bool
+ hasFlags() const
+ {
+ return m_hasFields[CONTROL_PARAMETER_FLAGS];
+ }
+
+ uint64_t
+ getFlags() const
+ {
+ BOOST_ASSERT(this->hasFlags());
+ return m_flags;
+ }
+
+ ControlParameters&
+ setFlags(uint64_t flags)
+ {
+ m_wire.reset();
+ m_flags = flags;
+ m_hasFields[CONTROL_PARAMETER_FLAGS] = true;
+ return *this;
+ }
+
+ ControlParameters&
+ unsetFlags()
+ {
+ m_wire.reset();
+ m_hasFields[CONTROL_PARAMETER_FLAGS] = false;
+ return *this;
+ }
+
+ bool
+ hasMask() const
+ {
+ return m_hasFields[CONTROL_PARAMETER_MASK];
+ }
+
+ uint64_t
+ getMask() const
+ {
+ BOOST_ASSERT(this->hasMask());
+ return m_mask;
+ }
+
+ ControlParameters&
+ setMask(uint64_t mask)
+ {
+ m_wire.reset();
+ m_mask = mask;
+ m_hasFields[CONTROL_PARAMETER_MASK] = true;
+ return *this;
+ }
+
+ ControlParameters&
+ unsetMask()
+ {
+ m_wire.reset();
+ m_hasFields[CONTROL_PARAMETER_MASK] = false;
+ return *this;
+ }
+
+ bool
+ hasStrategy() const
+ {
+ return m_hasFields[CONTROL_PARAMETER_STRATEGY];
+ }
+
+ const Name&
+ getStrategy() const
+ {
+ BOOST_ASSERT(this->hasStrategy());
+ return m_strategy;
+ }
+
+ ControlParameters&
+ setStrategy(const Name& strategy)
+ {
+ m_wire.reset();
+ m_strategy = strategy;
+ m_hasFields[CONTROL_PARAMETER_STRATEGY] = true;
+ return *this;
+ }
+
+ ControlParameters&
+ unsetStrategy()
+ {
+ m_wire.reset();
+ m_hasFields[CONTROL_PARAMETER_STRATEGY] = false;
+ return *this;
+ }
+
+ bool
+ hasExpirationPeriod() const
+ {
+ return m_hasFields[CONTROL_PARAMETER_EXPIRATION_PERIOD];
+ }
+
+ const time::milliseconds&
+ getExpirationPeriod() const
+ {
+ BOOST_ASSERT(this->hasExpirationPeriod());
+ return m_expirationPeriod;
+ }
+
+ ControlParameters&
+ setExpirationPeriod(const time::milliseconds& expirationPeriod)
+ {
+ m_wire.reset();
+ m_expirationPeriod = expirationPeriod;
+ m_hasFields[CONTROL_PARAMETER_EXPIRATION_PERIOD] = true;
+ return *this;
+ }
+
+ ControlParameters&
+ unsetExpirationPeriod()
+ {
+ m_wire.reset();
+ m_hasFields[CONTROL_PARAMETER_EXPIRATION_PERIOD] = false;
+ return *this;
+ }
+
+ bool
+ hasFacePersistency() const
+ {
+ return m_hasFields[CONTROL_PARAMETER_FACE_PERSISTENCY];
+ }
+
+ FacePersistency
+ getFacePersistency() const
+ {
+ BOOST_ASSERT(this->hasFacePersistency());
+ return m_facePersistency;
+ }
+
+ ControlParameters&
+ setFacePersistency(FacePersistency persistency)
+ {
+ m_wire.reset();
+ m_facePersistency = persistency;
+ m_hasFields[CONTROL_PARAMETER_FACE_PERSISTENCY] = true;
+ return *this;
+ }
+
+ ControlParameters&
+ unsetFacePersistency()
+ {
+ m_wire.reset();
+ m_hasFields[CONTROL_PARAMETER_FACE_PERSISTENCY] = false;
+ return *this;
+ }
+
+ const std::vector<bool>&
+ getPresentFields() const
+ {
+ return m_hasFields;
+ }
+
+public: // Flags and Mask helpers
+ /**
+ * \return whether bit is enabled in Mask
+ * \param bit bit position within range [0, 64) (least significant bit is 0)
+ */
+ bool
+ hasFlagBit(size_t bit) const;
+
+ /**
+ * \return bit at a position in Flags
+ * \param bit bit position within range [0, 64) (least significant bit is 0)
+ */
+ bool
+ getFlagBit(size_t bit) const;
+
+ /**
+ * \brief set a bit in Flags
+ * \param bit bit position within range [0, 64) (least significant bit is 0)
+ * \param value new value in Flags
+ * \param wantMask if true, enable the bit in Mask
+ */
+ ControlParameters&
+ setFlagBit(size_t bit, bool value, bool wantMask = true);
+
+ /**
+ * \brief disable a bit in Mask
+ * \param bit bit position within range [0, 64) (least significant bit is 0)
+ * \post If all bits are disabled, Flags and Mask fields are deleted.
+ */
+ ControlParameters&
+ unsetFlagBit(size_t bit);
+
+private: // fields
+ std::vector<bool> m_hasFields;
+
+ Name m_name;
+ uint64_t m_faceId;
+ std::string m_uri;
+ LocalControlFeature m_localControlFeature;
+ uint64_t m_origin;
+ uint64_t m_cost;
+ uint64_t m_flags;
+ uint64_t m_mask;
+ Name m_strategy;
+ time::milliseconds m_expirationPeriod;
+ FacePersistency m_facePersistency;
+
+private:
+ mutable Block m_wire;
+};
+
+std::ostream&
+operator<<(std::ostream& os, const ControlParameters& parameters);
+
+} // namespace nfd
+} // namespace ndn
+
+#endif // NDN_MGMT_NFD_CONTROL_PARAMETERS_HPP
diff --git a/src/mgmt/nfd/control-response.hpp b/src/mgmt/nfd/control-response.hpp
new file mode 100644
index 0000000..8234e2d
--- /dev/null
+++ b/src/mgmt/nfd/control-response.hpp
@@ -0,0 +1,35 @@
+/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
+/**
+ * Copyright (c) 2013-2016 Regents of the University of California.
+ *
+ * This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
+ *
+ * ndn-cxx library is free software: you can redistribute it and/or modify it under the
+ * terms of the GNU Lesser General Public License as published by the Free Software
+ * Foundation, either version 3 of the License, or (at your option) any later version.
+ *
+ * ndn-cxx library 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 Lesser General Public License for more details.
+ *
+ * You should have received copies of the GNU General Public License and GNU Lesser
+ * General Public License along with ndn-cxx, e.g., in COPYING.md file. If not, see
+ * <http://www.gnu.org/licenses/>.
+ *
+ * See AUTHORS.md for complete list of ndn-cxx authors and contributors.
+ */
+
+#ifndef NDN_MANAGEMENT_CONTROL_RESPONSE_HPP
+#define NDN_MANAGEMENT_CONTROL_RESPONSE_HPP
+
+#include "../dispatcher.hpp"
+
+namespace ndn {
+namespace nfd {
+
+typedef ndn::mgmt::ControlResponse ControlResponse;
+
+} // namespace nfd
+} // namespace ndn
+
+#endif // NDN_MANAGEMENT_CONTROL_RESPONSE_HPP
diff --git a/src/management/nfd-controller.cpp b/src/mgmt/nfd/controller.cpp
similarity index 97%
rename from src/management/nfd-controller.cpp
rename to src/mgmt/nfd/controller.cpp
index b395d6b..cfb7956 100644
--- a/src/management/nfd-controller.cpp
+++ b/src/mgmt/nfd/controller.cpp
@@ -19,10 +19,10 @@
* See AUTHORS.md for complete list of ndn-cxx authors and contributors.
*/
-#include "nfd-controller.hpp"
-#include "../face.hpp"
-#include "../security/key-chain.hpp"
-#include "../util/segment-fetcher.hpp"
+#include "controller.hpp"
+#include "../../face.hpp"
+#include "../../security/key-chain.hpp"
+#include "../../util/segment-fetcher.hpp"
namespace ndn {
namespace nfd {
diff --git a/src/mgmt/nfd/controller.hpp b/src/mgmt/nfd/controller.hpp
new file mode 100644
index 0000000..3d3808c
--- /dev/null
+++ b/src/mgmt/nfd/controller.hpp
@@ -0,0 +1,221 @@
+/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
+/**
+ * Copyright (c) 2013-2016 Regents of the University of California.
+ *
+ * This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
+ *
+ * ndn-cxx library is free software: you can redistribute it and/or modify it under the
+ * terms of the GNU Lesser General Public License as published by the Free Software
+ * Foundation, either version 3 of the License, or (at your option) any later version.
+ *
+ * ndn-cxx library 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 Lesser General Public License for more details.
+ *
+ * You should have received copies of the GNU General Public License and GNU Lesser
+ * General Public License along with ndn-cxx, e.g., in COPYING.md file. If not, see
+ * <http://www.gnu.org/licenses/>.
+ *
+ * See AUTHORS.md for complete list of ndn-cxx authors and contributors.
+ */
+
+#ifndef NDN_MGMT_NFD_CONTROLLER_HPP
+#define NDN_MGMT_NFD_CONTROLLER_HPP
+
+#include "control-command.hpp"
+#include "control-response.hpp"
+#include "status-dataset.hpp"
+#include "command-options.hpp"
+#include "../../security/validator-null.hpp"
+
+namespace ndn {
+
+namespace security {
+class KeyChain;
+class Validator;
+} // namespace security
+class Face;
+
+namespace nfd {
+
+/**
+ * \defgroup management Management
+ * \brief Classes and data structures to manage NDN forwarder
+ */
+
+/**
+ * \ingroup management
+ * \brief NFD Management protocol client
+ * \sa https://redmine.named-data.net/projects/nfd/wiki/Management
+ */
+class Controller : noncopyable
+{
+public:
+ /** \brief a callback on command success
+ */
+ typedef function<void(const ControlParameters&)> CommandSucceedCallback;
+
+ /** \brief a callback on command failure
+ */
+ typedef function<void(const ControlResponse&)> CommandFailCallback;
+
+ /** \brief a callback on dataset retrieval failure
+ */
+ typedef function<void(uint32_t code, const std::string& reason)> DatasetFailCallback;
+
+ /** \brief construct a Controller that uses face for transport,
+ * and uses the passed KeyChain to sign commands
+ */
+ Controller(Face& face, security::KeyChain& keyChain, security::Validator& validator = s_validatorNull);
+
+ /** \brief start command execution
+ */
+ template<typename Command>
+ void
+ start(const ControlParameters& parameters,
+ const CommandSucceedCallback& onSuccess,
+ const CommandFailCallback& onFailure,
+ const CommandOptions& options = CommandOptions())
+ {
+ shared_ptr<ControlCommand> command = make_shared<Command>();
+ this->startCommand(command, parameters, onSuccess, onFailure, options);
+ }
+
+ /** \brief start dataset fetching
+ */
+ template<typename Dataset>
+ typename std::enable_if<std::is_default_constructible<Dataset>::value>::type
+ fetch(const std::function<void(typename Dataset::ResultType)>& onSuccess,
+ const DatasetFailCallback& onFailure,
+ const CommandOptions& options = CommandOptions())
+ {
+ this->fetchDataset(make_shared<Dataset>(), onSuccess, onFailure, options);
+ }
+
+ /** \brief start dataset fetching
+ */
+ template<typename Dataset, typename ParamType = typename Dataset::ParamType>
+ void
+ fetch(const ParamType& param,
+ const std::function<void(typename Dataset::ResultType)>& onSuccess,
+ const DatasetFailCallback& onFailure,
+ const CommandOptions& options = CommandOptions())
+ {
+ this->fetchDataset(make_shared<Dataset>(param), onSuccess, onFailure, options);
+ }
+
+private:
+ void
+ startCommand(const shared_ptr<ControlCommand>& command,
+ const ControlParameters& parameters,
+ const CommandSucceedCallback& onSuccess,
+ const CommandFailCallback& onFailure,
+ const CommandOptions& options);
+
+ void
+ processCommandResponse(const Data& data,
+ const shared_ptr<ControlCommand>& command,
+ const CommandSucceedCallback& onSuccess,
+ const CommandFailCallback& onFailure);
+
+ void
+ processValidatedCommandResponse(const Data& data,
+ const shared_ptr<ControlCommand>& command,
+ const CommandSucceedCallback& onSuccess,
+ const CommandFailCallback& onFailure);
+
+ template<typename Dataset>
+ void
+ fetchDataset(shared_ptr<Dataset> dataset,
+ const std::function<void(typename Dataset::ResultType)>& onSuccess,
+ const DatasetFailCallback& onFailure,
+ const CommandOptions& options);
+
+ void
+ fetchDataset(const Name& prefix,
+ const std::function<void(const ConstBufferPtr&)>& processResponse,
+ const DatasetFailCallback& onFailure,
+ const CommandOptions& options);
+
+ template<typename Dataset>
+ void
+ processDatasetResponse(shared_ptr<Dataset> dataset,
+ const std::function<void(typename Dataset::ResultType)>& onSuccess,
+ const DatasetFailCallback& onFailure,
+ ConstBufferPtr payload);
+
+ void
+ processDatasetFetchError(const DatasetFailCallback& onFailure, uint32_t code, std::string msg);
+
+public:
+ /** \brief error code for timeout
+ */
+ static const uint32_t ERROR_TIMEOUT;
+
+ /** \brief error code for network Nack
+ */
+ static const uint32_t ERROR_NACK;
+
+ /** \brief error code for response validation failure
+ */
+ static const uint32_t ERROR_VALIDATION;
+
+ /** \brief error code for server error
+ */
+ static const uint32_t ERROR_SERVER;
+
+ /** \brief inclusive lower bound of error codes
+ */
+ static const uint32_t ERROR_LBOUND;
+
+protected:
+ Face& m_face;
+ security::KeyChain& m_keyChain;
+ security::Validator& m_validator;
+
+private:
+ static ValidatorNull s_validatorNull;
+};
+
+template<typename Dataset>
+inline void
+Controller::fetchDataset(shared_ptr<Dataset> dataset,
+ const std::function<void(typename Dataset::ResultType)>& onSuccess1,
+ const DatasetFailCallback& onFailure1,
+ const CommandOptions& options)
+{
+ const std::function<void(typename Dataset::ResultType)>& onSuccess = onSuccess1 ?
+ onSuccess1 : [] (const typename Dataset::ResultType&) {};
+ const DatasetFailCallback& onFailure = onFailure1 ?
+ onFailure1 : [] (uint32_t, const std::string&) {};
+
+ Name prefix = dataset->getDatasetPrefix(options.getPrefix());
+ this->fetchDataset(prefix,
+ bind(&Controller::processDatasetResponse<Dataset>, this, dataset, onSuccess, onFailure, _1),
+ onFailure,
+ options);
+}
+
+template<typename Dataset>
+inline void
+Controller::processDatasetResponse(shared_ptr<Dataset> dataset,
+ const std::function<void(typename Dataset::ResultType)>& onSuccess,
+ const DatasetFailCallback& onFailure,
+ ConstBufferPtr payload)
+{
+ typename Dataset::ResultType result;
+ try {
+ result = dataset->parseResult(payload);
+ }
+ catch (const tlv::Error& e) {
+ onFailure(ERROR_SERVER, e.what());
+ return;
+ }
+
+ onSuccess(result);
+}
+
+} // namespace nfd
+} // namespace ndn
+
+#endif // NDN_MGMT_NFD_CONTROLLER_HPP
diff --git a/src/management/nfd-face-event-notification.cpp b/src/mgmt/nfd/face-event-notification.cpp
similarity index 97%
rename from src/management/nfd-face-event-notification.cpp
rename to src/mgmt/nfd/face-event-notification.cpp
index 5f80fe8..3422ee8 100644
--- a/src/management/nfd-face-event-notification.cpp
+++ b/src/mgmt/nfd/face-event-notification.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/**
- * Copyright (c) 2013-2015 Regents of the University of California.
+ * Copyright (c) 2013-2016 Regents of the University of California.
*
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
*
@@ -19,7 +19,7 @@
* See AUTHORS.md for complete list of ndn-cxx authors and contributors.
*/
-#include "nfd-face-event-notification.hpp"
+#include "face-event-notification.hpp"
#include "encoding/tlv-nfd.hpp"
#include "encoding/block-helpers.hpp"
#include "util/concepts.hpp"
diff --git a/src/mgmt/nfd/face-event-notification.hpp b/src/mgmt/nfd/face-event-notification.hpp
new file mode 100644
index 0000000..a4d1ea7
--- /dev/null
+++ b/src/mgmt/nfd/face-event-notification.hpp
@@ -0,0 +1,94 @@
+/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
+/**
+ * Copyright (c) 2013-2016 Regents of the University of California.
+ *
+ * This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
+ *
+ * ndn-cxx library is free software: you can redistribute it and/or modify it under the
+ * terms of the GNU Lesser General Public License as published by the Free Software
+ * Foundation, either version 3 of the License, or (at your option) any later version.
+ *
+ * ndn-cxx library 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 Lesser General Public License for more details.
+ *
+ * You should have received copies of the GNU General Public License and GNU Lesser
+ * General Public License along with ndn-cxx, e.g., in COPYING.md file. If not, see
+ * <http://www.gnu.org/licenses/>.
+ *
+ * See AUTHORS.md for complete list of ndn-cxx authors and contributors.
+ */
+
+#ifndef NDN_MGMT_NFD_FACE_EVENT_NOTIFICATION_HPP
+#define NDN_MGMT_NFD_FACE_EVENT_NOTIFICATION_HPP
+
+#include "face-traits.hpp"
+#include "../../encoding/block.hpp"
+
+namespace ndn {
+namespace nfd {
+
+/**
+ * \ingroup management
+ */
+enum FaceEventKind {
+ FACE_EVENT_CREATED = 1,
+ FACE_EVENT_DESTROYED = 2
+};
+
+/**
+ * \ingroup management
+ * \brief represents a Face status change notification
+ * \sa http://redmine.named-data.net/projects/nfd/wiki/FaceMgmt#Face-Status-Change-Notification
+ */
+class FaceEventNotification : public FaceTraits<FaceEventNotification>
+{
+public:
+ FaceEventNotification();
+
+ explicit
+ FaceEventNotification(const Block& block);
+
+ /** \brief prepend FaceEventNotification to the encoder
+ */
+ template<encoding::Tag TAG>
+ size_t
+ wireEncode(EncodingImpl<TAG>& encoder) const;
+
+ /** \brief encode FaceEventNotification
+ */
+ const Block&
+ wireEncode() const;
+
+ /** \brief decode FaceEventNotification
+ */
+ void
+ wireDecode(const Block& wire);
+
+public: // getters & setters
+ FaceEventKind
+ getKind() const
+ {
+ return m_kind;
+ }
+
+ FaceEventNotification&
+ setKind(FaceEventKind kind);
+
+protected:
+ void
+ wireReset() const;
+
+private:
+ FaceEventKind m_kind;
+
+ mutable Block m_wire;
+};
+
+std::ostream&
+operator<<(std::ostream& os, const FaceEventNotification& notification);
+
+} // namespace nfd
+} // namespace ndn
+
+#endif // NDN_MGMT_NFD_FACE_EVENT_NOTIFICATION_HPP
diff --git a/src/mgmt/nfd/face-monitor.hpp b/src/mgmt/nfd/face-monitor.hpp
new file mode 100644
index 0000000..5429ea1
--- /dev/null
+++ b/src/mgmt/nfd/face-monitor.hpp
@@ -0,0 +1,72 @@
+/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
+/**
+ * Copyright (c) 2013-2016 Regents of the University of California.
+ *
+ * This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
+ *
+ * ndn-cxx library is free software: you can redistribute it and/or modify it under the
+ * terms of the GNU Lesser General Public License as published by the Free Software
+ * Foundation, either version 3 of the License, or (at your option) any later version.
+ *
+ * ndn-cxx library 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 Lesser General Public License for more details.
+ *
+ * You should have received copies of the GNU General Public License and GNU Lesser
+ * General Public License along with ndn-cxx, e.g., in COPYING.md file. If not, see
+ * <http://www.gnu.org/licenses/>.
+ *
+ * See AUTHORS.md for complete list of ndn-cxx authors and contributors.
+ */
+
+/**
+ * Original copyright notice from NFD:
+ *
+ * Copyright (c) 2014, 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 NDN_MGMT_NFD_FACE_MONITOR_HPP
+#define NDN_MGMT_NFD_FACE_MONITOR_HPP
+
+#include "../../util/notification-subscriber.hpp"
+#include "face-event-notification.hpp"
+
+namespace ndn {
+namespace nfd {
+
+/** \brief A subscriber for Face status change notification stream
+ * \sa http://redmine.named-data.net/projects/nfd/wiki/FaceMgmt#Face-Status-Change-Notification
+ */
+class FaceMonitor : public util::NotificationSubscriber<FaceEventNotification>
+{
+public:
+ FaceMonitor(Face& face)
+ : NotificationSubscriber<nfd::FaceEventNotification>(face, "ndn:/localhost/nfd/faces/events")
+ {
+ }
+};
+
+} // namespace nfd
+} // namespace ndn
+
+#endif // NDN_MGMT_NFD_FACE_MONITOR_HPP
diff --git a/src/management/nfd-face-query-filter.cpp b/src/mgmt/nfd/face-query-filter.cpp
similarity index 98%
rename from src/management/nfd-face-query-filter.cpp
rename to src/mgmt/nfd/face-query-filter.cpp
index bd10d2b..ffaae90 100644
--- a/src/management/nfd-face-query-filter.cpp
+++ b/src/mgmt/nfd/face-query-filter.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/**
- * Copyright (c) 2013-2015 Regents of the University of California.
+ * Copyright (c) 2013-2016 Regents of the University of California.
*
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
*
@@ -19,7 +19,7 @@
* See AUTHORS.md for complete list of ndn-cxx authors and contributors.
*/
-#include "nfd-face-query-filter.hpp"
+#include "face-query-filter.hpp"
#include "encoding/tlv-nfd.hpp"
#include "encoding/block-helpers.hpp"
#include "util/concepts.hpp"
diff --git a/src/mgmt/nfd/face-query-filter.hpp b/src/mgmt/nfd/face-query-filter.hpp
new file mode 100644
index 0000000..e0bb393
--- /dev/null
+++ b/src/mgmt/nfd/face-query-filter.hpp
@@ -0,0 +1,231 @@
+/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
+/**
+ * Copyright (c) 2013-2016 Regents of the University of California.
+ *
+ * This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
+ *
+ * ndn-cxx library is free software: you can redistribute it and/or modify it under the
+ * terms of the GNU Lesser General Public License as published by the Free Software
+ * Foundation, either version 3 of the License, or (at your option) any later version.
+ *
+ * ndn-cxx library 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 Lesser General Public License for more details.
+ *
+ * You should have received copies of the GNU General Public License and GNU Lesser
+ * General Public License along with ndn-cxx, e.g., in COPYING.md file. If not, see
+ * <http://www.gnu.org/licenses/>.
+ *
+ * See AUTHORS.md for complete list of ndn-cxx authors and contributors.
+ */
+
+#ifndef NDN_MGMT_NFD_FACE_QUERY_FILTER_HPP
+#define NDN_MGMT_NFD_FACE_QUERY_FILTER_HPP
+
+#include "../../encoding/block.hpp"
+#include "../../encoding/nfd-constants.hpp"
+
+namespace ndn {
+namespace nfd {
+
+/**
+ * \ingroup management
+ * \brief represents Face Query Filter
+ * \sa http://redmine.named-data.net/projects/nfd/wiki/FaceMgmt#Query-Operation
+ */
+class FaceQueryFilter
+{
+public:
+ class Error : public tlv::Error
+ {
+ public:
+ explicit
+ Error(const std::string& what)
+ : tlv::Error(what)
+ {
+ }
+ };
+
+ FaceQueryFilter();
+
+ explicit
+ FaceQueryFilter(const Block& block);
+
+ /** \brief prepend FaceQueryFilter to the encoder
+ */
+ template<encoding::Tag TAG>
+ size_t
+ wireEncode(EncodingImpl<TAG>& encoder) const;
+
+ /** \brief encode FaceQueryFilter
+ */
+ const Block&
+ wireEncode() const;
+
+ /** \brief decode FaceQueryFilter
+ */
+ void
+ wireDecode(const Block& wire);
+
+public: // getters & setters
+
+ bool
+ hasFaceId() const
+ {
+ return m_hasFaceId;
+ }
+
+ uint64_t
+ getFaceId() const
+ {
+ BOOST_ASSERT(this->hasFaceId());
+ return m_faceId;
+ }
+
+ FaceQueryFilter&
+ setFaceId(uint64_t faceId);
+
+ FaceQueryFilter&
+ unsetFaceId();
+
+ bool
+ hasUriScheme() const
+ {
+ return m_hasUriScheme;
+ }
+
+ const std::string&
+ getUriScheme() const
+ {
+ BOOST_ASSERT(this->hasUriScheme());
+ return m_uriScheme;
+ }
+
+ FaceQueryFilter&
+ setUriScheme(const std::string& uriScheme);
+
+ FaceQueryFilter&
+ unsetUriScheme();
+
+ bool
+ hasRemoteUri() const
+ {
+ return m_hasRemoteUri;
+ }
+
+ const std::string&
+ getRemoteUri() const
+ {
+ BOOST_ASSERT(this->hasRemoteUri());
+ return m_remoteUri;
+ }
+
+ FaceQueryFilter&
+ setRemoteUri(const std::string& remoteUri);
+
+ FaceQueryFilter&
+ unsetRemoteUri();
+
+ bool
+ hasLocalUri() const
+ {
+ return m_hasLocalUri;
+ }
+
+ const std::string&
+ getLocalUri() const
+ {
+ BOOST_ASSERT(this->hasLocalUri());
+ return m_localUri;
+ }
+
+ FaceQueryFilter&
+ setLocalUri(const std::string& localUri);
+
+ FaceQueryFilter&
+ unsetLocalUri();
+
+ bool
+ hasFaceScope() const
+ {
+ return m_hasFaceScope;
+ }
+
+ FaceScope
+ getFaceScope() const
+ {
+ BOOST_ASSERT(this->hasFaceScope());
+ return m_faceScope;
+ }
+
+ FaceQueryFilter&
+ setFaceScope(FaceScope faceScope);
+
+ FaceQueryFilter&
+ unsetFaceScope();
+
+ bool
+ hasFacePersistency() const
+ {
+ return m_hasFacePersistency;
+ }
+
+ FacePersistency
+ getFacePersistency() const
+ {
+ BOOST_ASSERT(this->hasFacePersistency());
+ return m_facePersistency;
+ }
+
+ FaceQueryFilter&
+ setFacePersistency(FacePersistency facePersistency);
+
+ FaceQueryFilter&
+ unsetFacePersistency();
+
+ bool
+ hasLinkType() const
+ {
+ return m_hasLinkType;
+ }
+
+ LinkType
+ getLinkType() const
+ {
+ BOOST_ASSERT(this->hasLinkType());
+ return m_linkType;
+ }
+
+ FaceQueryFilter&
+ setLinkType(LinkType linkType);
+
+ FaceQueryFilter&
+ unsetLinkType();
+
+private:
+ uint64_t m_faceId;
+ std::string m_uriScheme;
+ std::string m_remoteUri;
+ std::string m_localUri;
+ FaceScope m_faceScope;
+ FacePersistency m_facePersistency;
+ LinkType m_linkType;
+
+ bool m_hasFaceId;
+ bool m_hasUriScheme;
+ bool m_hasRemoteUri;
+ bool m_hasLocalUri;
+ bool m_hasFaceScope;
+ bool m_hasFacePersistency;
+ bool m_hasLinkType;
+
+ mutable Block m_wire;
+};
+
+std::ostream&
+operator<<(std::ostream& os, const FaceQueryFilter& filter);
+
+} // namespace nfd
+} // namespace ndn
+
+#endif // NDN_MGMT_NFD_FACE_QUERY_FILTER_HPP
diff --git a/src/management/nfd-face-status.cpp b/src/mgmt/nfd/face-status.cpp
similarity index 98%
rename from src/management/nfd-face-status.cpp
rename to src/mgmt/nfd/face-status.cpp
index ca24a99..bdc7404 100644
--- a/src/management/nfd-face-status.cpp
+++ b/src/mgmt/nfd/face-status.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/**
- * Copyright (c) 2013-2015 Regents of the University of California.
+ * Copyright (c) 2013-2016 Regents of the University of California.
*
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
*
@@ -19,7 +19,7 @@
* See AUTHORS.md for complete list of ndn-cxx authors and contributors.
*/
-#include "nfd-face-status.hpp"
+#include "face-status.hpp"
#include "encoding/tlv-nfd.hpp"
#include "encoding/block-helpers.hpp"
#include "util/concepts.hpp"
diff --git a/src/mgmt/nfd/face-status.hpp b/src/mgmt/nfd/face-status.hpp
new file mode 100644
index 0000000..4f20e53
--- /dev/null
+++ b/src/mgmt/nfd/face-status.hpp
@@ -0,0 +1,175 @@
+/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
+/**
+ * Copyright (c) 2013-2016 Regents of the University of California.
+ *
+ * This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
+ *
+ * ndn-cxx library is free software: you can redistribute it and/or modify it under the
+ * terms of the GNU Lesser General Public License as published by the Free Software
+ * Foundation, either version 3 of the License, or (at your option) any later version.
+ *
+ * ndn-cxx library 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 Lesser General Public License for more details.
+ *
+ * You should have received copies of the GNU General Public License and GNU Lesser
+ * General Public License along with ndn-cxx, e.g., in COPYING.md file. If not, see
+ * <http://www.gnu.org/licenses/>.
+ *
+ * See AUTHORS.md for complete list of ndn-cxx authors and contributors.
+ */
+
+#ifndef NDN_MGMT_NFD_FACE_STATUS_HPP
+#define NDN_MGMT_NFD_FACE_STATUS_HPP
+
+#include "face-traits.hpp" // include this first, to ensure it compiles on its own.
+#include "../../encoding/block.hpp"
+#include "../../util/time.hpp"
+
+namespace ndn {
+namespace nfd {
+
+/**
+ * \ingroup management
+ * \brief represents Face status
+ * \sa http://redmine.named-data.net/projects/nfd/wiki/FaceMgmt#Face-Dataset
+ */
+class FaceStatus : public FaceTraits<FaceStatus>
+{
+public:
+ FaceStatus();
+
+ explicit
+ FaceStatus(const Block& block);
+
+ /** \brief prepend FaceStatus to the encoder
+ */
+ template<encoding::Tag TAG>
+ size_t
+ wireEncode(EncodingImpl<TAG>& encoder) const;
+
+ /** \brief encode FaceStatus
+ */
+ const Block&
+ wireEncode() const;
+
+ /** \brief decode FaceStatus
+ */
+ void
+ wireDecode(const Block& wire);
+
+public: // getters & setters
+ bool
+ hasExpirationPeriod() const
+ {
+ return m_hasExpirationPeriod;
+ }
+
+ const time::milliseconds&
+ getExpirationPeriod() const
+ {
+ BOOST_ASSERT(m_hasExpirationPeriod);
+ return m_expirationPeriod;
+ }
+
+ FaceStatus&
+ setExpirationPeriod(const time::milliseconds& expirationPeriod);
+
+ uint64_t
+ getNInInterests() const
+ {
+ return m_nInInterests;
+ }
+
+ FaceStatus&
+ setNInInterests(uint64_t nInInterests);
+
+ uint64_t
+ getNInDatas() const
+ {
+ return m_nInDatas;
+ }
+
+ FaceStatus&
+ setNInDatas(uint64_t nInDatas);
+
+ uint64_t
+ getNInNacks() const
+ {
+ return m_nInNacks;
+ }
+
+ FaceStatus&
+ setNInNacks(uint64_t nInNacks);
+
+ uint64_t
+ getNOutInterests() const
+ {
+ return m_nOutInterests;
+ }
+
+ FaceStatus&
+ setNOutInterests(uint64_t nOutInterests);
+
+ uint64_t
+ getNOutDatas() const
+ {
+ return m_nOutDatas;
+ }
+
+ FaceStatus&
+ setNOutDatas(uint64_t nOutDatas);
+
+ uint64_t
+ getNOutNacks() const
+ {
+ return m_nOutNacks;
+ }
+
+ FaceStatus&
+ setNOutNacks(uint64_t nOutNacks);
+
+ uint64_t
+ getNInBytes() const
+ {
+ return m_nInBytes;
+ }
+
+ FaceStatus&
+ setNInBytes(uint64_t nInBytes);
+
+ uint64_t
+ getNOutBytes() const
+ {
+ return m_nOutBytes;
+ }
+
+ FaceStatus&
+ setNOutBytes(uint64_t nOutBytes);
+
+protected:
+ void
+ wireReset() const;
+
+private:
+ time::milliseconds m_expirationPeriod;
+ bool m_hasExpirationPeriod;
+ uint64_t m_nInInterests;
+ uint64_t m_nInDatas;
+ uint64_t m_nInNacks;
+ uint64_t m_nOutInterests;
+ uint64_t m_nOutDatas;
+ uint64_t m_nOutNacks;
+ uint64_t m_nInBytes;
+ uint64_t m_nOutBytes;
+
+ mutable Block m_wire;
+};
+
+std::ostream&
+operator<<(std::ostream& os, const FaceStatus& status);
+
+} // namespace nfd
+} // namespace ndn
+
+#endif // NDN_MGMT_NFD_FACE_STATUS_HPP
diff --git a/src/mgmt/nfd/face-traits.hpp b/src/mgmt/nfd/face-traits.hpp
new file mode 100644
index 0000000..d9422c3
--- /dev/null
+++ b/src/mgmt/nfd/face-traits.hpp
@@ -0,0 +1,157 @@
+/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
+/**
+ * Copyright (c) 2013-2016 Regents of the University of California.
+ *
+ * This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
+ *
+ * ndn-cxx library is free software: you can redistribute it and/or modify it under the
+ * terms of the GNU Lesser General Public License as published by the Free Software
+ * Foundation, either version 3 of the License, or (at your option) any later version.
+ *
+ * ndn-cxx library 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 Lesser General Public License for more details.
+ *
+ * You should have received copies of the GNU General Public License and GNU Lesser
+ * General Public License along with ndn-cxx, e.g., in COPYING.md file. If not, see
+ * <http://www.gnu.org/licenses/>.
+ *
+ * See AUTHORS.md for complete list of ndn-cxx authors and contributors.
+ */
+
+#ifndef NDN_MGMT_NFD_FACE_TRAITS_HPP
+#define NDN_MGMT_NFD_FACE_TRAITS_HPP
+
+#include "../../encoding/tlv-nfd.hpp"
+
+namespace ndn {
+namespace nfd {
+
+/** \ingroup management
+ * \brief providers getters and setters of face information fields
+ * \tparam C the concrete class; it must provide .wireReset() method
+ to clear wire encoding when a field changes
+ */
+template<class C>
+class FaceTraits
+{
+public:
+ class Error : public tlv::Error
+ {
+ public:
+ explicit
+ Error(const std::string& what)
+ : tlv::Error(what)
+ {
+ }
+ };
+
+ FaceTraits()
+ : m_faceId(0)
+ , m_faceScope(FACE_SCOPE_NON_LOCAL)
+ , m_facePersistency(FACE_PERSISTENCY_PERSISTENT)
+ , m_linkType(LINK_TYPE_POINT_TO_POINT)
+ {
+ }
+
+ uint64_t
+ getFaceId() const
+ {
+ return m_faceId;
+ }
+
+ C&
+ setFaceId(uint64_t faceId)
+ {
+ wireReset();
+ m_faceId = faceId;
+ return static_cast<C&>(*this);
+ }
+
+ const std::string&
+ getRemoteUri() const
+ {
+ return m_remoteUri;
+ }
+
+ C&
+ setRemoteUri(const std::string& remoteUri)
+ {
+ wireReset();
+ m_remoteUri = remoteUri;
+ return static_cast<C&>(*this);
+ }
+
+ const std::string&
+ getLocalUri() const
+ {
+ return m_localUri;
+ }
+
+ C&
+ setLocalUri(const std::string& localUri)
+ {
+ wireReset();
+ m_localUri = localUri;
+ return static_cast<C&>(*this);
+ }
+
+ FaceScope
+ getFaceScope() const
+ {
+ return m_faceScope;
+ }
+
+ C&
+ setFaceScope(FaceScope faceScope)
+ {
+ wireReset();
+ m_faceScope = faceScope;
+ return static_cast<C&>(*this);
+ }
+
+ FacePersistency
+ getFacePersistency() const
+ {
+ return m_facePersistency;
+ }
+
+ C&
+ setFacePersistency(FacePersistency facePersistency)
+ {
+ wireReset();
+ m_facePersistency = facePersistency;
+ return static_cast<C&>(*this);
+ }
+
+ LinkType
+ getLinkType() const
+ {
+ return m_linkType;
+ }
+
+ C&
+ setLinkType(LinkType linkType)
+ {
+ wireReset();
+ m_linkType = linkType;
+ return static_cast<C&>(*this);
+ }
+
+protected:
+ virtual void
+ wireReset() const = 0;
+
+protected:
+ uint64_t m_faceId;
+ std::string m_remoteUri;
+ std::string m_localUri;
+ FaceScope m_faceScope;
+ FacePersistency m_facePersistency;
+ LinkType m_linkType;
+};
+
+} // namespace nfd
+} // namespace ndn
+
+#endif // NDN_MGMT_NFD_FACE_TRAITS_HPP
diff --git a/src/management/nfd-fib-entry.cpp b/src/mgmt/nfd/fib-entry.cpp
similarity index 98%
rename from src/management/nfd-fib-entry.cpp
rename to src/mgmt/nfd/fib-entry.cpp
index fb07329..dd1092f 100644
--- a/src/management/nfd-fib-entry.cpp
+++ b/src/mgmt/nfd/fib-entry.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/**
- * Copyright (c) 2013-2015 Regents of the University of California.
+ * Copyright (c) 2013-2016 Regents of the University of California.
*
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
*
@@ -19,7 +19,7 @@
* See AUTHORS.md for complete list of ndn-cxx authors and contributors.
*/
-#include "nfd-fib-entry.hpp"
+#include "fib-entry.hpp"
#include <sstream>
#include "encoding/tlv-nfd.hpp"
#include "encoding/block-helpers.hpp"
diff --git a/src/mgmt/nfd/fib-entry.hpp b/src/mgmt/nfd/fib-entry.hpp
new file mode 100644
index 0000000..6a7304c
--- /dev/null
+++ b/src/mgmt/nfd/fib-entry.hpp
@@ -0,0 +1,155 @@
+/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
+/**
+ * Copyright (c) 2013-2016 Regents of the University of California.
+ *
+ * This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
+ *
+ * ndn-cxx library is free software: you can redistribute it and/or modify it under the
+ * terms of the GNU Lesser General Public License as published by the Free Software
+ * Foundation, either version 3 of the License, or (at your option) any later version.
+ *
+ * ndn-cxx library 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 Lesser General Public License for more details.
+ *
+ * You should have received copies of the GNU General Public License and GNU Lesser
+ * General Public License along with ndn-cxx, e.g., in COPYING.md file. If not, see
+ * <http://www.gnu.org/licenses/>.
+ *
+ * See AUTHORS.md for complete list of ndn-cxx authors and contributors.
+ */
+
+#ifndef NDN_MGMT_NFD_FIB_ENTRY_HPP
+#define NDN_MGMT_NFD_FIB_ENTRY_HPP
+
+#include "../../encoding/block.hpp"
+#include "../../name.hpp"
+#include <list>
+
+namespace ndn {
+namespace nfd {
+
+/** @ingroup management
+ */
+class NextHopRecord
+{
+public:
+ class Error : public tlv::Error
+ {
+ public:
+ explicit
+ Error(const std::string& what)
+ : tlv::Error(what)
+ {
+ }
+ };
+
+ NextHopRecord();
+
+ explicit
+ NextHopRecord(const Block& block);
+
+ uint64_t
+ getFaceId() const
+ {
+ return m_faceId;
+ }
+
+ NextHopRecord&
+ setFaceId(uint64_t faceId);
+
+ uint64_t
+ getCost() const
+ {
+ return m_cost;
+ }
+
+ NextHopRecord&
+ setCost(uint64_t cost);
+
+ template<encoding::Tag TAG>
+ size_t
+ wireEncode(EncodingImpl<TAG>& block) const;
+
+ const Block&
+ wireEncode() const;
+
+ void
+ wireDecode(const Block& wire);
+
+private:
+ uint64_t m_faceId;
+ uint64_t m_cost;
+
+ mutable Block m_wire;
+};
+
+/** @ingroup management
+ */
+class FibEntry
+{
+public:
+ class Error : public tlv::Error
+ {
+ public:
+ explicit
+ Error(const std::string& what)
+ : tlv::Error(what)
+ {
+ }
+ };
+
+ FibEntry();
+
+ explicit
+ FibEntry(const Block& block);
+
+ const Name&
+ getPrefix() const
+ {
+ return m_prefix;
+ }
+
+ FibEntry&
+ setPrefix(const Name& prefix);
+
+ const std::list<NextHopRecord>&
+ getNextHopRecords() const
+ {
+ return m_nextHopRecords;
+ }
+
+ FibEntry&
+ addNextHopRecord(const NextHopRecord& nextHopRecord);
+
+ template<typename T>
+ FibEntry&
+ setNextHopRecords(const T& begin, const T& end)
+ {
+ m_nextHopRecords.clear();
+ m_nextHopRecords.assign(begin, end);
+ m_wire.reset();
+ return *this;
+ }
+
+ template<encoding::Tag TAG>
+ size_t
+ wireEncode(EncodingImpl<TAG>& block) const;
+
+ const Block&
+ wireEncode() const;
+
+ void
+ wireDecode(const Block& wire);
+
+private:
+ Name m_prefix;
+ std::list<NextHopRecord> m_nextHopRecords;
+
+ mutable Block m_wire;
+};
+
+} // namespace nfd
+} // namespace ndn
+
+#endif // NDN_MGMT_NFD_FIB_ENTRY_HPP
diff --git a/src/management/nfd-forwarder-status.cpp b/src/mgmt/nfd/forwarder-status.cpp
similarity index 98%
rename from src/management/nfd-forwarder-status.cpp
rename to src/mgmt/nfd/forwarder-status.cpp
index 8292f19..21fee56 100644
--- a/src/management/nfd-forwarder-status.cpp
+++ b/src/mgmt/nfd/forwarder-status.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/**
- * Copyright (c) 2013-2015 Regents of the University of California.
+ * Copyright (c) 2013-2016 Regents of the University of California.
*
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
*
@@ -19,7 +19,7 @@
* See AUTHORS.md for complete list of ndn-cxx authors and contributors.
*/
-#include "nfd-forwarder-status.hpp"
+#include "forwarder-status.hpp"
#include "encoding/tlv-nfd.hpp"
#include "encoding/block-helpers.hpp"
#include "util/concepts.hpp"
diff --git a/src/mgmt/nfd/forwarder-status.hpp b/src/mgmt/nfd/forwarder-status.hpp
new file mode 100644
index 0000000..4601610
--- /dev/null
+++ b/src/mgmt/nfd/forwarder-status.hpp
@@ -0,0 +1,225 @@
+/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
+/**
+ * Copyright (c) 2013-2016 Regents of the University of California.
+ *
+ * This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
+ *
+ * ndn-cxx library is free software: you can redistribute it and/or modify it under the
+ * terms of the GNU Lesser General Public License as published by the Free Software
+ * Foundation, either version 3 of the License, or (at your option) any later version.
+ *
+ * ndn-cxx library 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 Lesser General Public License for more details.
+ *
+ * You should have received copies of the GNU General Public License and GNU Lesser
+ * General Public License along with ndn-cxx, e.g., in COPYING.md file. If not, see
+ * <http://www.gnu.org/licenses/>.
+ *
+ * See AUTHORS.md for complete list of ndn-cxx authors and contributors.
+ */
+
+#ifndef NDN_MGMT_NFD_FORWARDER_STATUS_HPP
+#define NDN_MGMT_NFD_FORWARDER_STATUS_HPP
+
+#include "../../encoding/block.hpp"
+#include "../../util/time.hpp"
+
+namespace ndn {
+namespace nfd {
+
+/**
+ * \ingroup management
+ * \brief represents NFD Forwarder Status
+ * \sa http://redmine.named-data.net/projects/nfd/wiki/ForwarderStatus
+ */
+class ForwarderStatus
+{
+public:
+ class Error : public tlv::Error
+ {
+ public:
+ explicit
+ Error(const std::string& what)
+ : tlv::Error(what)
+ {
+ }
+ };
+
+ ForwarderStatus();
+
+ explicit
+ ForwarderStatus(const Block& payload);
+
+ /** \brief prepend ForwarderStatus as a Content block to the encoder
+ *
+ * The outermost Content element isn't part of ForwardStatus structure.
+ */
+ template<encoding::Tag TAG>
+ size_t
+ wireEncode(EncodingImpl<TAG>& encoder) const;
+
+ /** \brief encode ForwarderStatus as a Content block
+ *
+ * The outermost Content element isn't part of ForwardStatus structure.
+ */
+ const Block&
+ wireEncode() const;
+
+ /** \brief decode ForwarderStatus from a Content block
+ *
+ * The outermost Content element isn't part of ForwardStatus structure.
+ */
+ void
+ wireDecode(const Block& wire);
+
+public: // getters & setters
+ const std::string&
+ getNfdVersion() const
+ {
+ return m_nfdVersion;
+ }
+
+ ForwarderStatus&
+ setNfdVersion(const std::string& nfdVersion);
+
+ const time::system_clock::TimePoint&
+ getStartTimestamp() const
+ {
+ return m_startTimestamp;
+ }
+
+ ForwarderStatus&
+ setStartTimestamp(const time::system_clock::TimePoint& startTimestamp);
+
+ const time::system_clock::TimePoint&
+ getCurrentTimestamp() const
+ {
+ return m_currentTimestamp;
+ }
+
+ ForwarderStatus&
+ setCurrentTimestamp(const time::system_clock::TimePoint& currentTimestamp);
+
+ size_t
+ getNNameTreeEntries() const
+ {
+ return m_nNameTreeEntries;
+ }
+
+ ForwarderStatus&
+ setNNameTreeEntries(size_t nNameTreeEntries);
+
+ size_t
+ getNFibEntries() const
+ {
+ return m_nFibEntries;
+ }
+
+ ForwarderStatus&
+ setNFibEntries(size_t nFibEntries);
+
+ size_t
+ getNPitEntries() const
+ {
+ return m_nPitEntries;
+ }
+
+ ForwarderStatus&
+ setNPitEntries(size_t nPitEntries);
+
+ size_t
+ getNMeasurementsEntries() const
+ {
+ return m_nMeasurementsEntries;
+ }
+
+ ForwarderStatus&
+ setNMeasurementsEntries(size_t nMeasurementsEntries);
+
+ size_t
+ getNCsEntries() const
+ {
+ return m_nCsEntries;
+ }
+
+ ForwarderStatus&
+ setNCsEntries(size_t nCsEntries);
+
+ uint64_t
+ getNInInterests() const
+ {
+ return m_nInInterests;
+ }
+
+ ForwarderStatus&
+ setNInInterests(uint64_t nInInterests);
+
+ uint64_t
+ getNInDatas() const
+ {
+ return m_nInDatas;
+ }
+
+ ForwarderStatus&
+ setNInDatas(uint64_t nInDatas);
+
+ uint64_t
+ getNInNacks() const
+ {
+ return m_nInNacks;
+ }
+
+ ForwarderStatus&
+ setNInNacks(uint64_t nInNacks);
+
+ uint64_t
+ getNOutInterests() const
+ {
+ return m_nOutInterests;
+ }
+
+ ForwarderStatus&
+ setNOutInterests(uint64_t nOutInterests);
+
+ uint64_t
+ getNOutDatas() const
+ {
+ return m_nOutDatas;
+ }
+
+ ForwarderStatus&
+ setNOutDatas(uint64_t nOutDatas);
+
+ uint64_t
+ getNOutNacks() const
+ {
+ return m_nOutNacks;
+ }
+
+ ForwarderStatus&
+ setNOutNacks(uint64_t nOutNacks);
+
+private:
+ std::string m_nfdVersion;
+ time::system_clock::TimePoint m_startTimestamp;
+ time::system_clock::TimePoint m_currentTimestamp;
+ size_t m_nNameTreeEntries;
+ size_t m_nFibEntries;
+ size_t m_nPitEntries;
+ size_t m_nMeasurementsEntries;
+ size_t m_nCsEntries;
+ uint64_t m_nInInterests;
+ uint64_t m_nInDatas;
+ uint64_t m_nInNacks;
+ uint64_t m_nOutInterests;
+ uint64_t m_nOutDatas;
+ uint64_t m_nOutNacks;
+
+ mutable Block m_wire;
+};
+
+} // namespace nfd
+} // namespace ndn
+
+#endif // NDN_MGMT_NFD_FORWARDER_STATUS_HPP
diff --git a/src/management/nfd-rib-entry.cpp b/src/mgmt/nfd/rib-entry.cpp
similarity index 98%
rename from src/management/nfd-rib-entry.cpp
rename to src/mgmt/nfd/rib-entry.cpp
index 7c056cd..d47d316 100644
--- a/src/management/nfd-rib-entry.cpp
+++ b/src/mgmt/nfd/rib-entry.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/**
- * Copyright (c) 2013-2015 Regents of the University of California.
+ * Copyright (c) 2013-2016 Regents of the University of California.
*
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
*
@@ -19,7 +19,7 @@
* See AUTHORS.md for complete list of ndn-cxx authors and contributors.
*/
-#include "nfd-rib-entry.hpp"
+#include "rib-entry.hpp"
#include "encoding/tlv-nfd.hpp"
#include "encoding/block-helpers.hpp"
#include "util/concepts.hpp"
diff --git a/src/mgmt/nfd/rib-entry.hpp b/src/mgmt/nfd/rib-entry.hpp
new file mode 100644
index 0000000..6c1c5a2
--- /dev/null
+++ b/src/mgmt/nfd/rib-entry.hpp
@@ -0,0 +1,287 @@
+/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
+/**
+ * Copyright (c) 2013-2016 Regents of the University of California.
+ *
+ * This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
+ *
+ * ndn-cxx library is free software: you can redistribute it and/or modify it under the
+ * terms of the GNU Lesser General Public License as published by the Free Software
+ * Foundation, either version 3 of the License, or (at your option) any later version.
+ *
+ * ndn-cxx library 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 Lesser General Public License for more details.
+ *
+ * You should have received copies of the GNU General Public License and GNU Lesser
+ * General Public License along with ndn-cxx, e.g., in COPYING.md file. If not, see
+ * <http://www.gnu.org/licenses/>.
+ *
+ * See AUTHORS.md for complete list of ndn-cxx authors and contributors.
+ */
+
+#ifndef NDN_MGMT_NFD_RIB_ENTRY_HPP
+#define NDN_MGMT_NFD_RIB_ENTRY_HPP
+
+#include "rib-flags.hpp" // include this first, to ensure it compiles on its own.
+#include "../../name.hpp"
+#include "../../util/time.hpp"
+
+#include <list>
+
+namespace ndn {
+namespace nfd {
+
+/**
+ * @ingroup management
+ *
+ * @brief Data abstraction for Route
+ *
+ * A route indicates the availability of content via a certain face and
+ * provides meta-information about the face.
+ *
+ * Route := ROUTE-TYPE TLV-LENGTH
+ * FaceId
+ * Origin
+ * Cost
+ * Flags
+ * ExpirationPeriod?
+ *
+ * @sa http://redmine.named-data.net/projects/nfd/wiki/RibMgmt
+ */
+class Route : public RibFlagsTraits<Route>
+{
+public:
+ class Error : public tlv::Error
+ {
+ public:
+ explicit
+ Error(const std::string& what) : tlv::Error(what)
+ {
+ }
+ };
+
+ Route();
+
+ explicit
+ Route(const Block& block);
+
+ uint64_t
+ getFaceId() const
+ {
+ return m_faceId;
+ }
+
+ Route&
+ setFaceId(uint64_t faceId)
+ {
+ m_faceId = faceId;
+ m_wire.reset();
+ return *this;
+ }
+
+ uint64_t
+ getOrigin() const
+ {
+ return m_origin;
+ }
+
+ /** @brief set Origin
+ * @param origin a code defined in ndn::nfd::RouteOrigin
+ */
+ Route&
+ setOrigin(uint64_t origin)
+ {
+ m_origin = origin;
+ m_wire.reset();
+ return *this;
+ }
+
+ uint64_t
+ getCost() const
+ {
+ return m_cost;
+ }
+
+ Route&
+ setCost(uint64_t cost)
+ {
+ m_cost = cost;
+ m_wire.reset();
+ return *this;
+ }
+
+ uint64_t
+ getFlags() const
+ {
+ return m_flags;
+ }
+
+ /** @brief set route inheritance flags
+ * @param flags a bitwise OR'ed code from ndn::nfd::RouteFlags
+ */
+ Route&
+ setFlags(uint64_t flags)
+ {
+ m_flags = flags;
+ m_wire.reset();
+ return *this;
+ }
+
+ static const time::milliseconds INFINITE_EXPIRATION_PERIOD;
+
+ const time::milliseconds&
+ getExpirationPeriod() const
+ {
+ return m_expirationPeriod;
+ }
+
+ Route&
+ setExpirationPeriod(const time::milliseconds& expirationPeriod)
+ {
+ m_expirationPeriod = expirationPeriod;
+
+ m_hasInfiniteExpirationPeriod = m_expirationPeriod == INFINITE_EXPIRATION_PERIOD;
+
+ m_wire.reset();
+ return *this;
+ }
+
+ bool
+ hasInfiniteExpirationPeriod() const
+ {
+ return m_hasInfiniteExpirationPeriod;
+ }
+
+ template<encoding::Tag TAG>
+ size_t
+ wireEncode(EncodingImpl<TAG>& block) const;
+
+ const Block&
+ wireEncode() const;
+
+ void
+ wireDecode(const Block& wire);
+
+private:
+ uint64_t m_faceId;
+ uint64_t m_origin;
+ uint64_t m_cost;
+ uint64_t m_flags;
+ time::milliseconds m_expirationPeriod;
+ bool m_hasInfiniteExpirationPeriod;
+
+ mutable Block m_wire;
+};
+
+std::ostream&
+operator<<(std::ostream& os, const Route& route);
+
+/**
+ * @ingroup management
+ *
+ * @brief Data abstraction for RIB entry
+ *
+ * A RIB entry contains one or more routes for the name prefix
+ *
+ * RibEntry := RIB-ENTRY-TYPE TLV-LENGTH
+ * Name
+ * Route+
+ *
+ * @sa http://redmine.named-data.net/projects/nfd/wiki/RibMgmt
+ */
+class RibEntry
+{
+public:
+ class Error : public tlv::Error
+ {
+ public:
+ Error(const std::string& what) : tlv::Error(what)
+ {
+ }
+ };
+
+ typedef std::list<Route> RouteList;
+ typedef RouteList::const_iterator iterator;
+
+ RibEntry();
+
+ explicit
+ RibEntry(const Block& block);
+
+ const Name&
+ getName() const
+ {
+ return m_prefix;
+ }
+
+ RibEntry&
+ setName(const Name& prefix)
+ {
+ m_prefix = prefix;
+ m_wire.reset();
+ return *this;
+ }
+
+ const std::list<Route>&
+ getRoutes() const
+ {
+ return m_routes;
+ }
+
+ RibEntry&
+ addRoute(const Route& route)
+ {
+ m_routes.push_back(route);
+ m_wire.reset();
+ return *this;
+ }
+
+ RibEntry&
+ clearRoutes()
+ {
+ m_routes.clear();
+ return *this;
+ }
+
+ template<encoding::Tag TAG>
+ size_t
+ wireEncode(EncodingImpl<TAG>& block) const;
+
+ const Block&
+ wireEncode() const;
+
+ void
+ wireDecode(const Block& wire);
+
+ iterator
+ begin() const;
+
+ iterator
+ end() const;
+
+private:
+ Name m_prefix;
+ RouteList m_routes;
+
+ mutable Block m_wire;
+};
+
+inline RibEntry::iterator
+RibEntry::begin() const
+{
+ return m_routes.begin();
+}
+
+inline RibEntry::iterator
+RibEntry::end() const
+{
+ return m_routes.end();
+}
+
+std::ostream&
+operator<<(std::ostream& os, const RibEntry& entry);
+
+} // namespace nfd
+} // namespace ndn
+
+#endif // NDN_MGMT_NFD_RIB_ENTRY_HPP
diff --git a/src/mgmt/nfd/rib-flags.hpp b/src/mgmt/nfd/rib-flags.hpp
new file mode 100644
index 0000000..158048f
--- /dev/null
+++ b/src/mgmt/nfd/rib-flags.hpp
@@ -0,0 +1,57 @@
+/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
+/**
+ * Copyright (c) 2013-2016 Regents of the University of California.
+ *
+ * This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
+ *
+ * ndn-cxx library is free software: you can redistribute it and/or modify it under the
+ * terms of the GNU Lesser General Public License as published by the Free Software
+ * Foundation, either version 3 of the License, or (at your option) any later version.
+ *
+ * ndn-cxx library 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 Lesser General Public License for more details.
+ *
+ * You should have received copies of the GNU General Public License and GNU Lesser
+ * General Public License along with ndn-cxx, e.g., in COPYING.md file. If not, see
+ * <http://www.gnu.org/licenses/>.
+ *
+ * See AUTHORS.md for complete list of ndn-cxx authors and contributors.
+ */
+
+#ifndef NDN_MGMT_NFD_RIB_FLAGS_HPP
+#define NDN_MGMT_NFD_RIB_FLAGS_HPP
+
+#include "../../encoding/nfd-constants.hpp"
+
+namespace ndn {
+namespace nfd {
+
+/**
+ * \ingroup management
+ * \brief implements getters to each RIB flag
+ *
+ * \tparam T class containing a RibFlags field and implements
+ * `RibFlags getFlags() const` method
+ */
+template<typename T>
+class RibFlagsTraits
+{
+public:
+ bool
+ isChildInherit() const
+ {
+ return static_cast<const T*>(this)->getFlags() & ROUTE_FLAG_CHILD_INHERIT;
+ }
+
+ bool
+ isRibCapture() const
+ {
+ return static_cast<const T*>(this)->getFlags() & ROUTE_FLAG_CAPTURE;
+ }
+};
+
+} // namespace nfd
+} // namespace ndn
+
+#endif // NDN_MGMT_NFD_RIB_FLAGS_HPP
diff --git a/src/management/nfd-status-dataset.cpp b/src/mgmt/nfd/status-dataset.cpp
similarity index 97%
rename from src/management/nfd-status-dataset.cpp
rename to src/mgmt/nfd/status-dataset.cpp
index 9516e85..ca5f5df 100644
--- a/src/management/nfd-status-dataset.cpp
+++ b/src/mgmt/nfd/status-dataset.cpp
@@ -19,8 +19,8 @@
* See AUTHORS.md for complete list of ndn-cxx authors and contributors.
*/
-#include "nfd-status-dataset.hpp"
-#include "../util/concepts.hpp"
+#include "status-dataset.hpp"
+#include "../../util/concepts.hpp"
namespace ndn {
namespace nfd {
diff --git a/src/mgmt/nfd/status-dataset.hpp b/src/mgmt/nfd/status-dataset.hpp
new file mode 100644
index 0000000..9eb43d4
--- /dev/null
+++ b/src/mgmt/nfd/status-dataset.hpp
@@ -0,0 +1,252 @@
+/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
+/**
+ * Copyright (c) 2013-2016 Regents of the University of California.
+ *
+ * This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
+ *
+ * ndn-cxx library is free software: you can redistribute it and/or modify it under the
+ * terms of the GNU Lesser General Public License as published by the Free Software
+ * Foundation, either version 3 of the License, or (at your option) any later version.
+ *
+ * ndn-cxx library 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 Lesser General Public License for more details.
+ *
+ * You should have received copies of the GNU General Public License and GNU Lesser
+ * General Public License along with ndn-cxx, e.g., in COPYING.md file. If not, see
+ * <http://www.gnu.org/licenses/>.
+ *
+ * See AUTHORS.md for complete list of ndn-cxx authors and contributors.
+ */
+
+#ifndef NDN_MGMT_NFD_STATUS_DATASET_HPP
+#define NDN_MGMT_NFD_STATUS_DATASET_HPP
+
+#include "../../name.hpp"
+#include "forwarder-status.hpp"
+#include "face-status.hpp"
+#include "face-query-filter.hpp"
+#include "channel-status.hpp"
+#include "fib-entry.hpp"
+#include "strategy-choice.hpp"
+#include "rib-entry.hpp"
+
+namespace ndn {
+namespace nfd {
+
+/**
+ * \ingroup management
+ * \brief base class of NFD StatusDataset
+ * \sa http://redmine.named-data.net/projects/nfd/wiki/StatusDataset
+ */
+class StatusDataset : noncopyable
+{
+public:
+#ifdef DOXYGEN
+ /**
+ * \brief if defined, specifies constructor argument type;
+ * otherwise, constructor has no argument
+ */
+ typedef int ParamType;
+#endif
+
+ /**
+ * \brief constructs a name prefix for the dataset
+ * \param prefix top-level prefix, such as ndn:/localhost/nfd
+ * \return name prefix without version and segment components
+ */
+ Name
+ getDatasetPrefix(const Name& prefix) const;
+
+#ifdef DOXYGEN
+ /**
+ * \brief provides the result type, usually a vector
+ */
+ typedef std::vector<int> ResultType;
+#endif
+
+ /**
+ * \brief indicates reassembled payload cannot be parsed as ResultType
+ */
+ class ParseResultError : public tlv::Error
+ {
+ public:
+ explicit
+ ParseResultError(const std::string& what)
+ : tlv::Error(what)
+ {
+ }
+ };
+
+#ifdef DOXYGEN
+ /**
+ * \brief parses a result from reassembled payload
+ * \param payload reassembled payload
+ * \throw tlv::Error cannot parse payload
+ */
+ ResultType
+ parseResult(ConstBufferPtr payload) const;
+#endif
+
+protected:
+ /**
+ * \brief constructs a StatusDataset instance with given sub-prefix
+ * \param datasetName dataset name after top-level prefix, such as faces/list
+ */
+ explicit
+ StatusDataset(const PartialName& datasetName);
+
+private:
+ /**
+ * \brief appends parameters to the dataset name prefix
+ * \param[in,out] the dataset name prefix onto which parameter components can be appended
+ */
+ virtual void
+ addParameters(Name& name) const;
+
+private:
+ PartialName m_datasetName;
+};
+
+
+/**
+ * \ingroup management
+ * \brief represents a status/general dataset
+ * \sa http://redmine.named-data.net/projects/nfd/wiki/ForwarderStatus#General-Status-Dataset
+ */
+class ForwarderGeneralStatusDataset : public StatusDataset
+{
+public:
+ ForwarderGeneralStatusDataset();
+
+ typedef ForwarderStatus ResultType;
+
+ ResultType
+ parseResult(ConstBufferPtr payload) const;
+};
+
+
+/**
+ * \ingroup management
+ * \brief provides common functionality among FaceDataset and FaceQueryDataset
+ */
+class FaceDatasetBase : public StatusDataset
+{
+public:
+ typedef std::vector<FaceStatus> ResultType;
+
+ ResultType
+ parseResult(ConstBufferPtr payload) const;
+
+protected:
+ explicit
+ FaceDatasetBase(const PartialName& datasetName);
+};
+
+
+/**
+ * \ingroup management
+ * \brief represents a faces/list dataset
+ * \sa http://redmine.named-data.net/projects/nfd/wiki/FaceMgmt#Face-Dataset
+ */
+class FaceDataset : public FaceDatasetBase
+{
+public:
+ FaceDataset();
+};
+
+
+/**
+ * \ingroup management
+ * \brief represents a faces/query dataset
+ * \sa http://redmine.named-data.net/projects/nfd/wiki/FaceMgmt#Query-Operation
+ */
+class FaceQueryDataset : public FaceDatasetBase
+{
+public:
+ typedef FaceQueryFilter ParamType;
+
+ explicit
+ FaceQueryDataset(const FaceQueryFilter& filter);
+
+private:
+ virtual void
+ addParameters(Name& name) const override;
+
+private:
+ FaceQueryFilter m_filter;
+};
+
+
+/**
+ * \ingroup management
+ * \brief represents a faces/channels dataset
+ * \sa https://redmine.named-data.net/projects/nfd/wiki/FaceMgmt#Channel-Dataset
+ */
+class ChannelDataset : public StatusDataset
+{
+public:
+ ChannelDataset();
+
+ typedef std::vector<ChannelStatus> ResultType;
+
+ ResultType
+ parseResult(ConstBufferPtr payload) const;
+};
+
+
+/**
+ * \ingroup management
+ * \brief represents a fib/list dataset
+ * \sa http://redmine.named-data.net/projects/nfd/wiki/FibMgmt#FIB-Dataset
+ */
+class FibDataset : public StatusDataset
+{
+public:
+ FibDataset();
+
+ typedef std::vector<FibEntry> ResultType;
+
+ ResultType
+ parseResult(ConstBufferPtr payload) const;
+};
+
+
+/**
+ * \ingroup management
+ * \brief represents a strategy-choice/list dataset
+ * \sa http://redmine.named-data.net/projects/nfd/wiki/StrategyChoice#Strategy-Choice-Dataset
+ */
+class StrategyChoiceDataset : public StatusDataset
+{
+public:
+ StrategyChoiceDataset();
+
+ typedef std::vector<StrategyChoice> ResultType;
+
+ ResultType
+ parseResult(ConstBufferPtr payload) const;
+};
+
+
+/**
+ * \ingroup management
+ * \brief represents a rib/list dataset
+ * \sa http://redmine.named-data.net/projects/nfd/wiki/RibMgmt#RIB-Dataset
+ */
+class RibDataset : public StatusDataset
+{
+public:
+ RibDataset();
+
+ typedef std::vector<RibEntry> ResultType;
+
+ ResultType
+ parseResult(ConstBufferPtr payload) const;
+};
+
+
+} // namespace nfd
+} // namespace ndn
+
+#endif // NDN_MGMT_NFD_STATUS_DATASET_HPP
diff --git a/src/management/nfd-strategy-choice.cpp b/src/mgmt/nfd/strategy-choice.cpp
similarity index 96%
rename from src/management/nfd-strategy-choice.cpp
rename to src/mgmt/nfd/strategy-choice.cpp
index 659293c..2e294d7 100644
--- a/src/management/nfd-strategy-choice.cpp
+++ b/src/mgmt/nfd/strategy-choice.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/**
- * Copyright (c) 2013-2015 Regents of the University of California.
+ * Copyright (c) 2013-2016 Regents of the University of California.
*
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
*
@@ -19,7 +19,7 @@
* See AUTHORS.md for complete list of ndn-cxx authors and contributors.
*/
-#include "nfd-strategy-choice.hpp"
+#include "strategy-choice.hpp"
#include "encoding/tlv-nfd.hpp"
#include "encoding/block-helpers.hpp"
#include "util/concepts.hpp"
diff --git a/src/mgmt/nfd/strategy-choice.hpp b/src/mgmt/nfd/strategy-choice.hpp
new file mode 100644
index 0000000..8cdaa59
--- /dev/null
+++ b/src/mgmt/nfd/strategy-choice.hpp
@@ -0,0 +1,93 @@
+/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
+/**
+ * Copyright (c) 2013-2016 Regents of the University of California.
+ *
+ * This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
+ *
+ * ndn-cxx library is free software: you can redistribute it and/or modify it under the
+ * terms of the GNU Lesser General Public License as published by the Free Software
+ * Foundation, either version 3 of the License, or (at your option) any later version.
+ *
+ * ndn-cxx library 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 Lesser General Public License for more details.
+ *
+ * You should have received copies of the GNU General Public License and GNU Lesser
+ * General Public License along with ndn-cxx, e.g., in COPYING.md file. If not, see
+ * <http://www.gnu.org/licenses/>.
+ *
+ * See AUTHORS.md for complete list of ndn-cxx authors and contributors.
+ */
+
+#ifndef NDN_MGMT_NFD_STRATEGY_CHOICE_HPP
+#define NDN_MGMT_NFD_STRATEGY_CHOICE_HPP
+
+#include "../../encoding/block.hpp"
+#include "../../name.hpp"
+
+namespace ndn {
+namespace nfd {
+
+/**
+ * @ingroup management
+ * @brief represents NFD StrategyChoice dataset
+ * @sa http://redmine.named-data.net/projects/nfd/wiki/StrategyChoice#Strategy-Choice-Dataset
+ */
+class StrategyChoice
+{
+public:
+ class Error : public tlv::Error
+ {
+ public:
+ explicit
+ Error(const std::string& what)
+ : tlv::Error(what)
+ {
+ }
+ };
+
+ StrategyChoice();
+
+ explicit
+ StrategyChoice(const Block& payload);
+
+ template<encoding::Tag TAG>
+ size_t
+ wireEncode(EncodingImpl<TAG>& encoder) const;
+
+ const Block&
+ wireEncode() const;
+
+ void
+ wireDecode(const Block& wire);
+
+public: // getters & setters
+ const Name&
+ getName() const
+ {
+ return m_name;
+ }
+
+ StrategyChoice&
+ setName(const Name& name);
+
+ const Name&
+ getStrategy() const
+ {
+ return m_strategy;
+ }
+
+ StrategyChoice&
+ setStrategy(const Name& strategy);
+
+private:
+ Name m_name; // namespace
+ Name m_strategy; // strategy for the namespace
+
+ mutable Block m_wire;
+};
+
+} // namespace nfd
+} // namespace ndn
+
+#endif // NDN_MGMT_NFD_STRATEGY_CHOICE_HPP
diff --git a/src/util/dummy-client-face.cpp b/src/util/dummy-client-face.cpp
index 13327c6..fb454cb 100644
--- a/src/util/dummy-client-face.cpp
+++ b/src/util/dummy-client-face.cpp
@@ -20,9 +20,10 @@
*/
#include "dummy-client-face.hpp"
+#include "../lp/tags.hpp"
+#include "../mgmt/nfd/controller.hpp"
+#include "../mgmt/nfd/control-response.hpp"
#include "../transport/transport.hpp"
-#include "../management/nfd-controller.hpp"
-#include "../management/nfd-control-response.hpp"
#include <boost/asio/io_service.hpp>
diff --git a/tests/unit-tests/mgmt/dispatcher.t.cpp b/tests/unit-tests/mgmt/dispatcher.t.cpp
index d7e4efc..877ec02 100644
--- a/tests/unit-tests/mgmt/dispatcher.t.cpp
+++ b/tests/unit-tests/mgmt/dispatcher.t.cpp
@@ -20,7 +20,7 @@
*/
#include "mgmt/dispatcher.hpp"
-#include "management/nfd-control-parameters.hpp"
+#include "mgmt/nfd/control-parameters.hpp"
#include "util/dummy-client-face.hpp"
#include "boost-test.hpp"
diff --git a/tests/unit-tests/management/nfd-channel-status.t.cpp b/tests/unit-tests/mgmt/nfd/channel-status.t.cpp
similarity index 85%
rename from tests/unit-tests/management/nfd-channel-status.t.cpp
rename to tests/unit-tests/mgmt/nfd/channel-status.t.cpp
index 7fff8d4..c682f59 100644
--- a/tests/unit-tests/management/nfd-channel-status.t.cpp
+++ b/tests/unit-tests/mgmt/nfd/channel-status.t.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/**
- * Copyright (c) 2013-2015 Regents of the University of California.
+ * Copyright (c) 2013-2016 Regents of the University of California.
*
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
*
@@ -19,7 +19,7 @@
* See AUTHORS.md for complete list of ndn-cxx authors and contributors.
*/
-#include "management/nfd-channel-status.hpp"
+#include "mgmt/nfd/channel-status.hpp"
#include "boost-test.hpp"
@@ -27,7 +27,9 @@
namespace nfd {
namespace tests {
-BOOST_AUTO_TEST_SUITE(ManagementNfdChannelStatus)
+BOOST_AUTO_TEST_SUITE(Mgmt)
+BOOST_AUTO_TEST_SUITE(Nfd)
+BOOST_AUTO_TEST_SUITE(TestChannelStatus)
BOOST_AUTO_TEST_CASE(Encode)
{
@@ -56,7 +58,9 @@
BOOST_CHECK_EQUAL(status1.getLocalUri(), status2.getLocalUri());
}
-BOOST_AUTO_TEST_SUITE_END()
+BOOST_AUTO_TEST_SUITE_END() // TestChannelStatus
+BOOST_AUTO_TEST_SUITE_END() // Nfd
+BOOST_AUTO_TEST_SUITE_END() // Mgmt
} // namespace tests
} // namespace nfd
diff --git a/tests/unit-tests/management/nfd-command-options.t.cpp b/tests/unit-tests/mgmt/nfd/command-options.t.cpp
similarity index 88%
rename from tests/unit-tests/management/nfd-command-options.t.cpp
rename to tests/unit-tests/mgmt/nfd/command-options.t.cpp
index 4cccc95..470cac9 100644
--- a/tests/unit-tests/management/nfd-command-options.t.cpp
+++ b/tests/unit-tests/mgmt/nfd/command-options.t.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/**
- * Copyright (c) 2013-2015 Regents of the University of California.
+ * Copyright (c) 2013-2016 Regents of the University of California.
*
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
*
@@ -19,7 +19,7 @@
* See AUTHORS.md for complete list of ndn-cxx authors and contributors.
*/
-#include "management/nfd-command-options.hpp"
+#include "mgmt/nfd/command-options.hpp"
#include "security/signing-helpers.hpp"
#include "boost-test.hpp"
@@ -28,7 +28,9 @@
namespace nfd {
namespace tests {
-BOOST_AUTO_TEST_SUITE(ManagementNfdCommandOptions)
+BOOST_AUTO_TEST_SUITE(Mgmt)
+BOOST_AUTO_TEST_SUITE(Nfd)
+BOOST_AUTO_TEST_SUITE(TestCommandOptions)
BOOST_AUTO_TEST_CASE(Timeout)
{
@@ -68,7 +70,9 @@
BOOST_CHECK_EQUAL(co.getSigningInfo().getSignerName(), "ndn:/tmp/identity");
}
-BOOST_AUTO_TEST_SUITE_END()
+BOOST_AUTO_TEST_SUITE_END() // TestCommandOptions
+BOOST_AUTO_TEST_SUITE_END() // Nfd
+BOOST_AUTO_TEST_SUITE_END() // Mgmt
} // namespace tests
} // namespace nfd
diff --git a/tests/unit-tests/management/nfd-control-command.t.cpp b/tests/unit-tests/mgmt/nfd/control-command.t.cpp
similarity index 97%
rename from tests/unit-tests/management/nfd-control-command.t.cpp
rename to tests/unit-tests/mgmt/nfd/control-command.t.cpp
index 4601de6..d282acf 100644
--- a/tests/unit-tests/management/nfd-control-command.t.cpp
+++ b/tests/unit-tests/mgmt/nfd/control-command.t.cpp
@@ -19,7 +19,7 @@
* See AUTHORS.md for complete list of ndn-cxx authors and contributors.
*/
-#include "management/nfd-control-command.hpp"
+#include "mgmt/nfd/control-command.hpp"
#include "boost-test.hpp"
@@ -27,7 +27,9 @@
namespace nfd {
namespace tests {
-BOOST_AUTO_TEST_SUITE(ManagementNfdControlCommand)
+BOOST_AUTO_TEST_SUITE(Mgmt)
+BOOST_AUTO_TEST_SUITE(Nfd)
+BOOST_AUTO_TEST_SUITE(TestControlCommand)
BOOST_AUTO_TEST_CASE(FaceCreate)
{
@@ -370,7 +372,9 @@
BOOST_CHECK_THROW(command.validateResponse(p2), ControlCommand::ArgumentError);
}
-BOOST_AUTO_TEST_SUITE_END()
+BOOST_AUTO_TEST_SUITE_END() // TestControlCommand
+BOOST_AUTO_TEST_SUITE_END() // Nfd
+BOOST_AUTO_TEST_SUITE_END() // Mgmt
} // namespace tests
} // namespace nfd
diff --git a/tests/unit-tests/management/nfd-control-parameters.t.cpp b/tests/unit-tests/mgmt/nfd/control-parameters.t.cpp
similarity index 96%
rename from tests/unit-tests/management/nfd-control-parameters.t.cpp
rename to tests/unit-tests/mgmt/nfd/control-parameters.t.cpp
index e12d675..7ef364e 100644
--- a/tests/unit-tests/management/nfd-control-parameters.t.cpp
+++ b/tests/unit-tests/mgmt/nfd/control-parameters.t.cpp
@@ -19,7 +19,7 @@
* See AUTHORS.md for complete list of ndn-cxx authors and contributors.
*/
-#include "management/nfd-control-parameters.hpp"
+#include "mgmt/nfd/control-parameters.hpp"
#include "boost-test.hpp"
@@ -27,7 +27,9 @@
namespace nfd {
namespace tests {
-BOOST_AUTO_TEST_SUITE(ManagementNfdControlParameters)
+BOOST_AUTO_TEST_SUITE(Mgmt)
+BOOST_AUTO_TEST_SUITE(Nfd)
+BOOST_AUTO_TEST_SUITE(TestControlParameters)
BOOST_AUTO_TEST_CASE(FaceOptions)
{
@@ -265,7 +267,9 @@
BOOST_CHECK_THROW(p.unsetFlagBit(64), std::out_of_range);
}
-BOOST_AUTO_TEST_SUITE_END()
+BOOST_AUTO_TEST_SUITE_END() // TestControlParameters
+BOOST_AUTO_TEST_SUITE_END() // Nfd
+BOOST_AUTO_TEST_SUITE_END() // Mgmt
} // namespace tests
} // namespace nfd
diff --git a/tests/unit-tests/management/nfd-control-response.t.cpp b/tests/unit-tests/mgmt/nfd/control-response.t.cpp
similarity index 86%
rename from tests/unit-tests/management/nfd-control-response.t.cpp
rename to tests/unit-tests/mgmt/nfd/control-response.t.cpp
index 9ce5dcb..58fc3bc 100644
--- a/tests/unit-tests/management/nfd-control-response.t.cpp
+++ b/tests/unit-tests/mgmt/nfd/control-response.t.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/**
- * Copyright (c) 2013-2015 Regents of the University of California.
+ * Copyright (c) 2013-2016 Regents of the University of California.
*
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
*
@@ -19,7 +19,7 @@
* See AUTHORS.md for complete list of ndn-cxx authors and contributors.
*/
-#include "management/nfd-control-response.hpp"
+#include "mgmt/nfd/control-response.hpp"
#include "boost-test.hpp"
@@ -27,7 +27,9 @@
namespace nfd {
namespace tests {
-BOOST_AUTO_TEST_SUITE(ManagementNfdControlResponse)
+BOOST_AUTO_TEST_SUITE(Mgmt)
+BOOST_AUTO_TEST_SUITE(Nfd)
+BOOST_AUTO_TEST_SUITE(TestControlResponse)
const uint8_t TestControlResponse[] = {0x65, 0x17,
0x66, 0x02, 0x01, 0x94, 0x67, 0x11, 0x4e, 0x6f, 0x74,
@@ -57,7 +59,9 @@
BOOST_REQUIRE_EQUAL(controlResponse.getText(), "Nothing not found");
}
-BOOST_AUTO_TEST_SUITE_END()
+BOOST_AUTO_TEST_SUITE_END() // TestControlResponse
+BOOST_AUTO_TEST_SUITE_END() // Nfd
+BOOST_AUTO_TEST_SUITE_END() // Mgmt
} // namespace tests
} // namespace nfd
diff --git a/tests/unit-tests/management/nfd-controller-fixture.hpp b/tests/unit-tests/mgmt/nfd/controller-fixture.hpp
similarity index 89%
rename from tests/unit-tests/management/nfd-controller-fixture.hpp
rename to tests/unit-tests/mgmt/nfd/controller-fixture.hpp
index d722dda..76e7bde 100644
--- a/tests/unit-tests/management/nfd-controller-fixture.hpp
+++ b/tests/unit-tests/mgmt/nfd/controller-fixture.hpp
@@ -19,15 +19,15 @@
* See AUTHORS.md for complete list of ndn-cxx authors and contributors.
*/
-#ifndef NDN_TESTS_MANAGEMENT_NFD_CONTROLLER_FIXTURE_HPP
-#define NDN_TESTS_MANAGEMENT_NFD_CONTROLLER_FIXTURE_HPP
+#ifndef NDN_TESTS_MGMT_NFD_CONTROLLER_FIXTURE_HPP
+#define NDN_TESTS_MGMT_NFD_CONTROLLER_FIXTURE_HPP
-#include "management/nfd-controller.hpp"
-#include "../../dummy-validator.hpp"
+#include "mgmt/nfd/controller.hpp"
+#include "../../../dummy-validator.hpp"
#include "boost-test.hpp"
#include "util/dummy-client-face.hpp"
-#include "../identity-management-time-fixture.hpp"
+#include "../../identity-management-time-fixture.hpp"
namespace ndn {
namespace nfd {
@@ -92,4 +92,4 @@
} // namespace nfd
} // namespace ndn
-#endif // NDN_TESTS_MANAGEMENT_NFD_CONTROLLER_FIXTURE_HPP
+#endif // NDN_TESTS_MGMT_NFD_CONTROLLER_FIXTURE_HPP
diff --git a/tests/unit-tests/management/nfd-controller.t.cpp b/tests/unit-tests/mgmt/nfd/controller.t.cpp
similarity index 95%
rename from tests/unit-tests/management/nfd-controller.t.cpp
rename to tests/unit-tests/mgmt/nfd/controller.t.cpp
index 13031fb..4d6b8a2 100644
--- a/tests/unit-tests/management/nfd-controller.t.cpp
+++ b/tests/unit-tests/mgmt/nfd/controller.t.cpp
@@ -19,13 +19,13 @@
* See AUTHORS.md for complete list of ndn-cxx authors and contributors.
*/
-#include "management/nfd-controller.hpp"
-#include "management/nfd-control-response.hpp"
+#include "mgmt/nfd/controller.hpp"
+#include "mgmt/nfd/control-response.hpp"
#include <boost/tuple/tuple.hpp>
-#include "nfd-controller-fixture.hpp"
-#include "../make-interest-data.hpp"
+#include "controller-fixture.hpp"
+#include "../../make-interest-data.hpp"
namespace ndn {
namespace nfd {
@@ -33,7 +33,8 @@
using namespace ndn::tests;
-BOOST_AUTO_TEST_SUITE(Management)
+BOOST_AUTO_TEST_SUITE(Mgmt)
+BOOST_AUTO_TEST_SUITE(Nfd)
class CommandFixture : public ControllerFixture
{
@@ -58,7 +59,7 @@
// This test suite focuses on ControlCommand functionality of Controller.
// Individual commands are tested in nfd-control-command.t.cpp
// StatusDataset functionality is tested in nfd-status-dataset.t.cpp
-BOOST_FIXTURE_TEST_SUITE(TestNfdController, CommandFixture)
+BOOST_FIXTURE_TEST_SUITE(TestController, CommandFixture)
BOOST_AUTO_TEST_CASE(Success)
{
@@ -295,8 +296,9 @@
BOOST_CHECK_EQUAL(succeeds.size(), 0);
}
-BOOST_AUTO_TEST_SUITE_END() // TestNfdController
-BOOST_AUTO_TEST_SUITE_END() // Management
+BOOST_AUTO_TEST_SUITE_END() // TestController
+BOOST_AUTO_TEST_SUITE_END() // Nfd
+BOOST_AUTO_TEST_SUITE_END() // Mgmt
} // namespace tests
} // namespace nfd
diff --git a/tests/unit-tests/management/nfd-face-event-notification.t.cpp b/tests/unit-tests/mgmt/nfd/face-event-notification.t.cpp
similarity index 95%
rename from tests/unit-tests/management/nfd-face-event-notification.t.cpp
rename to tests/unit-tests/mgmt/nfd/face-event-notification.t.cpp
index 0fce21b..7def221 100644
--- a/tests/unit-tests/management/nfd-face-event-notification.t.cpp
+++ b/tests/unit-tests/mgmt/nfd/face-event-notification.t.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/**
- * Copyright (c) 2013-2015 Regents of the University of California.
+ * Copyright (c) 2013-2016 Regents of the University of California.
*
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
*
@@ -19,7 +19,7 @@
* See AUTHORS.md for complete list of ndn-cxx authors and contributors.
*/
-#include "management/nfd-face-event-notification.hpp"
+#include "mgmt/nfd/face-event-notification.hpp"
#include "boost-test.hpp"
@@ -27,7 +27,9 @@
namespace nfd {
namespace tests {
-BOOST_AUTO_TEST_SUITE(ManagementNfdFaceEventNotification)
+BOOST_AUTO_TEST_SUITE(Mgmt)
+BOOST_AUTO_TEST_SUITE(Nfd)
+BOOST_AUTO_TEST_SUITE(TestFaceEventNotification)
BOOST_AUTO_TEST_CASE(Traits)
{
@@ -162,7 +164,9 @@
"LinkType: multi-access)");
}
-BOOST_AUTO_TEST_SUITE_END()
+BOOST_AUTO_TEST_SUITE_END() // TestFaceEventNotification
+BOOST_AUTO_TEST_SUITE_END() // Nfd
+BOOST_AUTO_TEST_SUITE_END() // Mgmt
} // namespace tests
} // namespace nfd
diff --git a/tests/unit-tests/management/nfd-face-query-filter.t.cpp b/tests/unit-tests/mgmt/nfd/face-query-filter.t.cpp
similarity index 91%
rename from tests/unit-tests/management/nfd-face-query-filter.t.cpp
rename to tests/unit-tests/mgmt/nfd/face-query-filter.t.cpp
index 845e314..3871ce0 100644
--- a/tests/unit-tests/management/nfd-face-query-filter.t.cpp
+++ b/tests/unit-tests/mgmt/nfd/face-query-filter.t.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/**
- * Copyright (c) 2013-2015 Regents of the University of California.
+ * Copyright (c) 2013-2016 Regents of the University of California.
*
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
*
@@ -19,7 +19,7 @@
* See AUTHORS.md for complete list of ndn-cxx authors and contributors.
*/
-#include "management/nfd-face-query-filter.hpp"
+#include "mgmt/nfd/face-query-filter.hpp"
#include "boost-test.hpp"
@@ -27,7 +27,9 @@
namespace nfd {
namespace tests {
-BOOST_AUTO_TEST_SUITE(ManagementNfdFaceQueryFilter)
+BOOST_AUTO_TEST_SUITE(Mgmt)
+BOOST_AUTO_TEST_SUITE(Nfd)
+BOOST_AUTO_TEST_SUITE(TestFaceQueryFilter)
BOOST_AUTO_TEST_CASE(Encode)
{
@@ -92,7 +94,9 @@
")");
}
-BOOST_AUTO_TEST_SUITE_END()
+BOOST_AUTO_TEST_SUITE_END() // TestFaceQueryFilter
+BOOST_AUTO_TEST_SUITE_END() // Nfd
+BOOST_AUTO_TEST_SUITE_END() // Mgmt
} // namespace tests
} // namespace nfd
diff --git a/tests/unit-tests/management/nfd-face-status.t.cpp b/tests/unit-tests/mgmt/nfd/face-status.t.cpp
similarity index 93%
rename from tests/unit-tests/management/nfd-face-status.t.cpp
rename to tests/unit-tests/mgmt/nfd/face-status.t.cpp
index 8afb0cc..c8a97f3 100644
--- a/tests/unit-tests/management/nfd-face-status.t.cpp
+++ b/tests/unit-tests/mgmt/nfd/face-status.t.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/**
- * Copyright (c) 2013-2015 Regents of the University of California.
+ * Copyright (c) 2013-2016 Regents of the University of California.
*
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
*
@@ -19,7 +19,7 @@
* See AUTHORS.md for complete list of ndn-cxx authors and contributors.
*/
-#include "management/nfd-face-status.hpp"
+#include "mgmt/nfd/face-status.hpp"
#include "boost-test.hpp"
@@ -27,7 +27,9 @@
namespace nfd {
namespace tests {
-BOOST_AUTO_TEST_SUITE(ManagementNfdFaceStatus)
+BOOST_AUTO_TEST_SUITE(Mgmt)
+BOOST_AUTO_TEST_SUITE(Nfd)
+BOOST_AUTO_TEST_SUITE(TestFaceStatus)
BOOST_AUTO_TEST_CASE(Encode)
{
@@ -104,7 +106,9 @@
")");
}
-BOOST_AUTO_TEST_SUITE_END()
+BOOST_AUTO_TEST_SUITE_END() // TestFaceStatus
+BOOST_AUTO_TEST_SUITE_END() // Nfd
+BOOST_AUTO_TEST_SUITE_END() // Mgmt
} // namespace tests
} // namespace nfd
diff --git a/tests/unit-tests/management/nfd-fib-entry.t.cpp b/tests/unit-tests/mgmt/nfd/fib-entry.t.cpp
similarity index 93%
rename from tests/unit-tests/management/nfd-fib-entry.t.cpp
rename to tests/unit-tests/mgmt/nfd/fib-entry.t.cpp
index 05459f3..7723974 100644
--- a/tests/unit-tests/management/nfd-fib-entry.t.cpp
+++ b/tests/unit-tests/mgmt/nfd/fib-entry.t.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/**
- * Copyright (c) 2013-2015 Regents of the University of California.
+ * Copyright (c) 2013-2016 Regents of the University of California.
*
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
*
@@ -19,7 +19,7 @@
* See AUTHORS.md for complete list of ndn-cxx authors and contributors.
*/
-#include "management/nfd-fib-entry.hpp"
+#include "mgmt/nfd/fib-entry.hpp"
#include "boost-test.hpp"
@@ -27,7 +27,9 @@
namespace nfd {
namespace tests {
-BOOST_AUTO_TEST_SUITE(ManagementNfdFibEntry)
+BOOST_AUTO_TEST_SUITE(Mgmt)
+BOOST_AUTO_TEST_SUITE(Nfd)
+BOOST_AUTO_TEST_SUITE(TestFibEntry)
const uint8_t TestNextHopRecord[] =
{
@@ -149,7 +151,9 @@
}
}
-BOOST_AUTO_TEST_SUITE_END()
+BOOST_AUTO_TEST_SUITE_END() // TestFibEntry
+BOOST_AUTO_TEST_SUITE_END() // Nfd
+BOOST_AUTO_TEST_SUITE_END() // Mgmt
} // namespace tests
} // namespace nfd
diff --git a/tests/unit-tests/management/nfd-forwarder-status.t.cpp b/tests/unit-tests/mgmt/nfd/forwarder-status.t.cpp
similarity index 92%
rename from tests/unit-tests/management/nfd-forwarder-status.t.cpp
rename to tests/unit-tests/mgmt/nfd/forwarder-status.t.cpp
index 6adc1d9..b7aefa0f 100644
--- a/tests/unit-tests/management/nfd-forwarder-status.t.cpp
+++ b/tests/unit-tests/mgmt/nfd/forwarder-status.t.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/**
- * Copyright (c) 2013-2015 Regents of the University of California.
+ * Copyright (c) 2013-2016 Regents of the University of California.
*
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
*
@@ -19,7 +19,7 @@
* See AUTHORS.md for complete list of ndn-cxx authors and contributors.
*/
-#include "management/nfd-forwarder-status.hpp"
+#include "mgmt/nfd/forwarder-status.hpp"
#include "data.hpp"
#include "boost-test.hpp"
@@ -28,7 +28,9 @@
namespace nfd {
namespace tests {
-BOOST_AUTO_TEST_SUITE(ManagementNfdForwarderStatus)
+BOOST_AUTO_TEST_SUITE(Mgmt)
+BOOST_AUTO_TEST_SUITE(Nfd)
+BOOST_AUTO_TEST_SUITE(TestForwarderStatus)
BOOST_AUTO_TEST_CASE(Encode)
{
@@ -91,7 +93,9 @@
BOOST_CHECK_EQUAL(status1.getNOutNacks(), status2.getNOutNacks());
}
-BOOST_AUTO_TEST_SUITE_END()
+BOOST_AUTO_TEST_SUITE_END() // TestForwarderStatus
+BOOST_AUTO_TEST_SUITE_END() // Nfd
+BOOST_AUTO_TEST_SUITE_END() // Mgmt
} // namespace tests
} // namespace nfd
diff --git a/tests/unit-tests/management/nfd-rib-entry.t.cpp b/tests/unit-tests/mgmt/nfd/rib-entry.t.cpp
similarity index 96%
rename from tests/unit-tests/management/nfd-rib-entry.t.cpp
rename to tests/unit-tests/mgmt/nfd/rib-entry.t.cpp
index 4018386..415be29 100644
--- a/tests/unit-tests/management/nfd-rib-entry.t.cpp
+++ b/tests/unit-tests/mgmt/nfd/rib-entry.t.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/**
- * Copyright (c) 2013-2015 Regents of the University of California.
+ * Copyright (c) 2013-2016 Regents of the University of California.
*
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
*
@@ -19,8 +19,8 @@
* See AUTHORS.md for complete list of ndn-cxx authors and contributors.
*/
-#include "management/nfd-rib-entry.hpp"
-#include "management/nfd-control-command.hpp"
+#include "mgmt/nfd/rib-entry.hpp"
+#include "mgmt/nfd/control-command.hpp"
#include "boost-test.hpp"
@@ -28,7 +28,9 @@
namespace nfd {
namespace tests {
-BOOST_AUTO_TEST_SUITE(ManagementNfdRibEntry)
+BOOST_AUTO_TEST_SUITE(Mgmt)
+BOOST_AUTO_TEST_SUITE(Nfd)
+BOOST_AUTO_TEST_SUITE(TestRibEntry)
const uint8_t RouteData[] =
{
@@ -336,7 +338,9 @@
"}");
}
-BOOST_AUTO_TEST_SUITE_END()
+BOOST_AUTO_TEST_SUITE_END() // TestRibEntry
+BOOST_AUTO_TEST_SUITE_END() // Nfd
+BOOST_AUTO_TEST_SUITE_END() // Mgmt
} // namespace tests
} // namespace nfd
diff --git a/tests/unit-tests/management/nfd-status-dataset.t.cpp b/tests/unit-tests/mgmt/nfd/status-dataset.t.cpp
similarity index 96%
rename from tests/unit-tests/management/nfd-status-dataset.t.cpp
rename to tests/unit-tests/mgmt/nfd/status-dataset.t.cpp
index e2f62a3..aadb2c4 100644
--- a/tests/unit-tests/management/nfd-status-dataset.t.cpp
+++ b/tests/unit-tests/mgmt/nfd/status-dataset.t.cpp
@@ -19,11 +19,11 @@
* See AUTHORS.md for complete list of ndn-cxx authors and contributors.
*/
-#include "management/nfd-status-dataset.hpp"
-#include "management/nfd-controller.hpp"
+#include "mgmt/nfd/status-dataset.hpp"
+#include "mgmt/nfd/controller.hpp"
-#include "nfd-controller-fixture.hpp"
-#include "../make-interest-data.hpp"
+#include "controller-fixture.hpp"
+#include "../../make-interest-data.hpp"
namespace ndn {
namespace nfd {
@@ -31,7 +31,8 @@
using namespace ndn::tests;
-BOOST_AUTO_TEST_SUITE(Management)
+BOOST_AUTO_TEST_SUITE(Mgmt)
+BOOST_AUTO_TEST_SUITE(Nfd)
class ControllerStatusDatasetFixture : public ControllerFixture
{
@@ -102,7 +103,7 @@
}
};
-BOOST_FIXTURE_TEST_SUITE(TestNfdStatusDataset, ControllerStatusDatasetFixture)
+BOOST_FIXTURE_TEST_SUITE(TestStatusDataset, ControllerStatusDatasetFixture)
BOOST_AUTO_TEST_SUITE(Failures)
@@ -449,8 +450,9 @@
BOOST_AUTO_TEST_SUITE_END() // Datasets
-BOOST_AUTO_TEST_SUITE_END() // TestNfdStatusDataset
-BOOST_AUTO_TEST_SUITE_END() // Management
+BOOST_AUTO_TEST_SUITE_END() // TestStatusDataset
+BOOST_AUTO_TEST_SUITE_END() // Nfd
+BOOST_AUTO_TEST_SUITE_END() // Mgmt
} // namespace tests
} // namespace nfd
diff --git a/tests/unit-tests/management/nfd-strategy-choice.t.cpp b/tests/unit-tests/mgmt/nfd/strategy-choice.t.cpp
similarity index 87%
rename from tests/unit-tests/management/nfd-strategy-choice.t.cpp
rename to tests/unit-tests/mgmt/nfd/strategy-choice.t.cpp
index 38290fa..4fca737 100644
--- a/tests/unit-tests/management/nfd-strategy-choice.t.cpp
+++ b/tests/unit-tests/mgmt/nfd/strategy-choice.t.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/**
- * Copyright (c) 2013-2015 Regents of the University of California.
+ * Copyright (c) 2013-2016 Regents of the University of California.
*
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
*
@@ -19,7 +19,7 @@
* See AUTHORS.md for complete list of ndn-cxx authors and contributors.
*/
-#include "management/nfd-strategy-choice.hpp"
+#include "mgmt/nfd/strategy-choice.hpp"
#include "boost-test.hpp"
@@ -27,7 +27,9 @@
namespace nfd {
namespace tests {
-BOOST_AUTO_TEST_SUITE(ManagementNfdStrategyChoice)
+BOOST_AUTO_TEST_SUITE(Mgmt)
+BOOST_AUTO_TEST_SUITE(Nfd)
+BOOST_AUTO_TEST_SUITE(TestStrategyChoice)
BOOST_AUTO_TEST_CASE(Encode)
{
@@ -61,7 +63,9 @@
BOOST_CHECK_EQUAL(strategyChoice1.getStrategy(), strategyChoice2.getStrategy());
}
-BOOST_AUTO_TEST_SUITE_END()
+BOOST_AUTO_TEST_SUITE_END() // TestStrategyChoice
+BOOST_AUTO_TEST_SUITE_END() // Nfd
+BOOST_AUTO_TEST_SUITE_END() // Mgmt
} // namespace tests
} // namespace nfd