management: FaceUpdateCommand
Change-Id: I5e3955ef3e15dff2e662786816cea7cb8e1a9bb8
refs: #3232
diff --git a/src/management/nfd-control-command.cpp b/src/management/nfd-control-command.cpp
index 7863ad4..307810d 100644
--- a/src/management/nfd-control-command.cpp
+++ b/src/management/nfd-control-command.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).
*
@@ -121,6 +121,34 @@
}
}
+FaceUpdateCommand::FaceUpdateCommand()
+ : ControlCommand("faces", "update")
+{
+ m_requestValidator
+ .required(CONTROL_PARAMETER_FACE_ID)
+ .optional(CONTROL_PARAMETER_FACE_PERSISTENCY);
+ m_responseValidator
+ .required(CONTROL_PARAMETER_FACE_ID)
+ .optional(CONTROL_PARAMETER_FACE_PERSISTENCY);
+ m_responseValidator = m_requestValidator;
+}
+
+void
+FaceUpdateCommand::validateRequest(const ControlParameters& parameters) const
+{
+ this->ControlCommand::validateRequest(parameters);
+
+ if (parameters.getFaceId() == 0) {
+ BOOST_THROW_EXCEPTION(ArgumentError("FaceId must not be zero"));
+ }
+}
+
+void
+FaceUpdateCommand::validateResponse(const ControlParameters& parameters) const
+{
+ this->validateRequest(parameters);
+}
+
FaceDestroyCommand::FaceDestroyCommand()
: ControlCommand("faces", "destroy")
{