management: Controller validates ControlCommand response
refs #3653
Change-Id: I70fd96075357840928bc813e64030b3e513f698a
diff --git a/src/management/nfd-controller.cpp b/src/management/nfd-controller.cpp
index 5fc755d..72299f0 100644
--- a/src/management/nfd-controller.cpp
+++ b/src/management/nfd-controller.cpp
@@ -72,8 +72,22 @@
const CommandSucceedCallback& onSuccess,
const CommandFailCallback& onFailure)
{
- /// \todo verify Data signature
+ m_validator.validate(data,
+ [=] (const shared_ptr<const Data>& data) {
+ this->processValidatedCommandResponse(*data, command, onSuccess, onFailure);
+ },
+ [=] (const shared_ptr<const Data>&, const std::string& msg) {
+ onFailure(ERROR_VALIDATION, msg);
+ }
+ );
+}
+void
+Controller::processValidatedCommandResponse(const Data& data,
+ const shared_ptr<ControlCommand>& command,
+ const CommandSucceedCallback& onSuccess,
+ const CommandFailCallback& onFailure)
+{
ControlResponse response;
try {
response.wireDecode(data.getContent().blockFromValue());