management: delete deprecated Controller functions
This commit delete to the following deprecated items:
* Controller::start overloads, except the overload taking CommandOptions
* Controller::Sign typedef
* Controller::getDefaultCommandTimeout
* ControlCommand::getPrefix
* ControlCommand::getRequestName(ControlParameters)
* Controller::Controller(Face&)
refs #2138
Change-Id: I1b632e24e83dd6044730596923ed979f3f8af365
diff --git a/src/management/nfd-control-command.cpp b/src/management/nfd-control-command.cpp
index d92245c..3c87d3f 100644
--- a/src/management/nfd-control-command.cpp
+++ b/src/management/nfd-control-command.cpp
@@ -65,24 +65,6 @@
return name;
}
-const Name&
-ControlCommand::getPrefix() const
-{
- // m_prefix is needed because we can't return a local variable as a reference,
- // and changing the "const Name&" return type to "Name" may cause incompatibility
- if (m_prefix.empty()) {
- m_prefix.append(CommandOptions::DEFAULT_PREFIX);
- m_prefix.append(m_module).append(m_verb);
- }
- return m_prefix;
-}
-
-Name
-ControlCommand::getRequestName(const ControlParameters& parameters) const
-{
- return this->getRequestName(CommandOptions::DEFAULT_PREFIX, parameters);
-}
-
ControlCommand::FieldValidator::FieldValidator()
: m_required(CONTROL_PARAMETER_UBOUND)
, m_optional(CONTROL_PARAMETER_UBOUND)
diff --git a/src/management/nfd-control-command.hpp b/src/management/nfd-control-command.hpp
index 9c1d2ea..a7b8bc6 100644
--- a/src/management/nfd-control-command.hpp
+++ b/src/management/nfd-control-command.hpp
@@ -75,22 +75,6 @@
Name
getRequestName(const Name& commandPrefix, const ControlParameters& parameters) const;
-public: // deprecated
- /** \return Name prefix of this ControlCommand
- * \deprecated use getRequestName
- */
- DEPRECATED(
- const Name&
- getPrefix() const);
-
- /** \brief construct the Name for a request Interest
- * \throw ArgumentError if parameters are invalid
- * \deprecated use the two-argument overload
- */
- DEPRECATED(
- Name
- getRequestName(const ControlParameters& parameters) const);
-
protected:
ControlCommand(const std::string& module, const std::string& verb);
@@ -144,10 +128,6 @@
private:
name::Component m_module;
name::Component m_verb;
-
- /** \deprecated kept to support getPrefix
- */
- mutable Name m_prefix;
};
diff --git a/src/management/nfd-controller.cpp b/src/management/nfd-controller.cpp
index 90cd454..c5d06d4 100644
--- a/src/management/nfd-controller.cpp
+++ b/src/management/nfd-controller.cpp
@@ -29,13 +29,6 @@
const uint32_t Controller::ERROR_SERVER = 500;
const uint32_t Controller::ERROR_LBOUND = 400;
-Controller::Controller(Face& face)
- : m_face(face)
- , m_internalKeyChain(make_shared<KeyChain>())
- , m_keyChain(*m_internalKeyChain)
-{
-}
-
Controller::Controller(Face& face, KeyChain& keyChain)
: m_face(face)
, m_keyChain(keyChain)
@@ -75,27 +68,6 @@
}
void
-Controller::startCommand(const shared_ptr<ControlCommand>& command,
- const ControlParameters& parameters,
- const CommandSucceedCallback& onSuccess,
- const CommandFailCallback& onFailure,
- const Sign& sign,
- const time::milliseconds& timeout)
-{
- BOOST_ASSERT(timeout > time::milliseconds::zero());
-
- Name requestName = command->getRequestName(CommandOptions::DEFAULT_PREFIX, parameters);
- Interest interest(requestName);
- interest.setInterestLifetime(timeout);
- sign(interest);
-
- m_face.expressInterest(interest,
- bind(&Controller::processCommandResponse, this, _2,
- command, onSuccess, onFailure),
- bind(onFailure, ERROR_TIMEOUT, "request timed out"));
-}
-
-void
Controller::processCommandResponse(const Data& data,
const shared_ptr<ControlCommand>& command,
const CommandSucceedCallback& onSuccess,
@@ -143,6 +115,5 @@
onSuccess(parameters);
}
-
} // namespace nfd
} // namespace ndn
diff --git a/src/management/nfd-controller.hpp b/src/management/nfd-controller.hpp
index a7d1290..48bf041 100644
--- a/src/management/nfd-controller.hpp
+++ b/src/management/nfd-controller.hpp
@@ -49,19 +49,6 @@
*/
typedef function<void(uint32_t/*code*/,const std::string&/*reason*/)> CommandFailCallback;
- /** \brief a function to sign the request Interest
- * \deprecated arbitrary signing function is no longer supported
- */
- typedef function<void(Interest&)> Sign;
-
- /** \brief construct a Controller that uses face for transport,
- * and has an internal default KeyChain to sign commands
- * \deprecated use two-parameter overload
- */
- DEPRECATED(
- explicit
- Controller(Face& face));
-
/** \brief construct a Controller that uses face for transport,
* and uses the passed KeyChain to sign commands
*/
@@ -80,62 +67,6 @@
this->startCommand(command, parameters, onSuccess, onFailure, options);
}
- /** \brief start command execution
- * \deprecated use the overload taking CommandOptions
- */
- DEPRECATED(
- template<typename Command>
- void
- start(const ControlParameters& parameters,
- const CommandSucceedCallback& onSuccess,
- const CommandFailCallback& onFailure,
- const time::milliseconds& timeout));
-
- /** \brief start command execution
- * \param certificate the certificate used to sign request Interests.
- * If IdentityCertificate() is passed, the default signing certificate will be used.
- *
- * \note IdentityCertificate() creates a certificate with an empty name, which is an
- * invalid certificate. A valid IdentityCertificate has at least 4 name components,
- * as it follows `<...>/KEY/<...>/<key-id>/ID-CERT/<version>` naming model.
- *
- * \deprecated use the overload taking CommandOptions
- */
- DEPRECATED(
- template<typename Command>
- void
- start(const ControlParameters& parameters,
- const CommandSucceedCallback& onSuccess,
- const CommandFailCallback& onFailure,
- const IdentityCertificate& certificate,
- const time::milliseconds& timeout = CommandOptions::DEFAULT_TIMEOUT));
-
- /** \brief start command execution
- * \param identity the identity used to sign request Interests
- * \deprecated use the overload taking CommandOptions
- */
- DEPRECATED(
- template<typename Command>
- void
- start(const ControlParameters& parameters,
- const CommandSucceedCallback& onSuccess,
- const CommandFailCallback& onFailure,
- const Name& identity,
- const time::milliseconds& timeout = CommandOptions::DEFAULT_TIMEOUT));
-
- /** \brief start command execution
- * \param sign a function to sign request Interests
- * \deprecated arbitrary signing function is no longer supported
- */
- DEPRECATED(
- template<typename Command>
- void
- start(const ControlParameters& parameters,
- const CommandSucceedCallback& onSuccess,
- const CommandFailCallback& onFailure,
- const Sign& sign,
- const time::milliseconds& timeout = CommandOptions::DEFAULT_TIMEOUT));
-
private:
void
startCommand(const shared_ptr<ControlCommand>& command,
@@ -144,16 +75,6 @@
const CommandFailCallback& onFailure,
const CommandOptions& options);
- /** \deprecated This is to support arbitrary signing function.
- */
- void
- startCommand(const shared_ptr<ControlCommand>& command,
- const ControlParameters& parameters,
- const CommandSucceedCallback& onSuccess,
- const CommandFailCallback& onFailure,
- const Sign& sign,
- const time::milliseconds& timeout);
-
void
processCommandResponse(const Data& data,
const shared_ptr<ControlCommand>& command,
@@ -161,13 +82,6 @@
const CommandFailCallback& onFailure);
public:
- /** \deprecated use CommandOptions::DEFAULT_TIMEOUT
- */
- DEPRECATED(
- static time::milliseconds
- getDefaultCommandTimeout());
-
-public:
/** \brief error code for timeout
* \note comes from http://msdn.microsoft.com/en-us/library/windows/desktop/ms740668.aspx
*/
@@ -183,84 +97,9 @@
protected:
Face& m_face;
-
- /** \deprecated
- */
- shared_ptr<KeyChain> m_internalKeyChain;
-
KeyChain& m_keyChain;
};
-
-// deprecated methods
-
-template<typename Command>
-inline void
-Controller::start(const ControlParameters& parameters,
- const CommandSucceedCallback& onSuccess,
- const CommandFailCallback& onFailure,
- const time::milliseconds& timeout)
-{
- CommandOptions options;
- options.setTimeout(timeout);
-
- this->start<Command>(parameters, onSuccess, onFailure, options);
-}
-
-template<typename Command>
-inline void
-Controller::start(const ControlParameters& parameters,
- const CommandSucceedCallback& onSuccess,
- const CommandFailCallback& onFailure,
- const IdentityCertificate& certificate,
- const time::milliseconds& timeout)
-{
- CommandOptions options;
- if (certificate.getName().empty()) {
- options.setSigningDefault();
- }
- else {
- options.setSigningCertificate(certificate);
- }
- options.setTimeout(timeout);
-
- this->start<Command>(parameters, onSuccess, onFailure, options);
-}
-
-template<typename Command>
-inline void
-Controller::start(const ControlParameters& parameters,
- const CommandSucceedCallback& onSuccess,
- const CommandFailCallback& onFailure,
- const Name& identity,
- const time::milliseconds& timeout)
-{
- CommandOptions options;
- options.setSigningIdentity(identity);
- options.setTimeout(timeout);
-
- this->start<Command>(parameters, onSuccess, onFailure, options);
-}
-
-template<typename Command>
-inline void
-Controller::start(const ControlParameters& parameters,
- const CommandSucceedCallback& onSuccess,
- const CommandFailCallback& onFailure,
- const Sign& sign,
- const time::milliseconds& timeout)
-{
- shared_ptr<ControlCommand> command = make_shared<Command>();
- this->startCommand(command, parameters, onSuccess, onFailure, sign, timeout);
-}
-
-inline time::milliseconds
-Controller::getDefaultCommandTimeout()
-{
- return CommandOptions::DEFAULT_TIMEOUT;
-}
-
-
} // namespace nfd
} // namespace ndn