mgmt: Fix issue with readvertisement commands always returning error code
NFD RIB commands in NLSR were previously always returning 406 errors due
to not having correct default return values for optional post-processing.
This does not appear to impede functionality but does cause incorrect
behavior on the NFD side and is blocking other changes.
Also fixes an issue where NLSR was not sending correctly formatted responses
back to commands from NFD which was raising errors.
Refs #5358
Change-Id: Iffe6a2416a6d7eafa44e17c821bf903c12ecb104
diff --git a/src/update/command-processor.hpp b/src/update/command-processor.hpp
index d0245fd..1d25ec0 100644
--- a/src/update/command-processor.hpp
+++ b/src/update/command-processor.hpp
@@ -65,28 +65,33 @@
withdrawAndRemovePrefix(const ndn::mgmt::ControlParametersBase& parameters,
const ndn::mgmt::CommandContinuation& done);
- /*! \brief Save an advertised prefix to the nlsr configuration file.
- * \return bool from the overridden function while nullopt here
+ /*! \brief Processing after advertise command delegated to subclass.
+ * This is always treated as successful if not implemented.
+ * \return tuple {bool indicating success/failure, message string}.
*/
- virtual std::optional<bool>
+ virtual std::tuple<bool, std::string>
afterAdvertise(const ndn::Name& prefix)
{
- return std::nullopt;
+ return {true, "OK"};
}
- /*! \brief Save an advertised prefix to the nlsr configuration file.
- * \return bool from the overridden function while nullopt here
+ /*! \brief Processing after withdraw command delegated to subclass.
+ * This is always treated as successful if not implemented.
+ * \return tuple {bool indicating success/failure, message string}.
*/
- virtual std::optional<bool>
+ virtual std::tuple<bool, std::string>
afterWithdraw(const ndn::Name& prefix)
{
- return std::nullopt;
+ return {true, "OK"};
}
protected:
ndn::mgmt::Dispatcher& m_dispatcher;
NamePrefixList& m_namePrefixList;
Lsdb& m_lsdb;
+
+private:
+ const uint64_t m_defaultResponseFaceId = 1;
};
} // namespace nlsr::update