management: nfd::FaceLocalControlCommand validates LocalControlFeature value
refs #1397
Change-Id: I30c8bfc71daebed52ea03d9a5c4b345d192b7784
diff --git a/src/management/nfd-control-command.hpp b/src/management/nfd-control-command.hpp
index 168daec..c1cb438 100644
--- a/src/management/nfd-control-command.hpp
+++ b/src/management/nfd-control-command.hpp
@@ -226,6 +226,27 @@
class FaceLocalControlCommand : public ControlCommand
{
+public:
+ virtual void
+ validateRequest(const ControlParameters& parameters) const
+ {
+ this->ControlCommand::validateRequest(parameters);
+
+ switch (parameters.getLocalControlFeature()) {
+ case LOCAL_CONTROL_FEATURE_INCOMING_FACE_ID:
+ case LOCAL_CONTROL_FEATURE_NEXT_HOP_FACE_ID:
+ break;
+ default:
+ throw ArgumentError("LocalControlFeature is invalid");
+ }
+ }
+
+ virtual void
+ validateResponse(const ControlParameters& parameters) const
+ {
+ this->validateRequest(parameters);
+ }
+
protected:
explicit
FaceLocalControlCommand(const std::string& verb)