Junxiao Shi | 7091165 | 2014-08-12 10:14:24 -0700 | [diff] [blame] | 1 | /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ |
| 2 | /** |
Davide Pesavento | f8503d2 | 2017-02-17 01:19:10 -0500 | [diff] [blame] | 3 | * Copyright (c) 2013-2017 Regents of the University of California. |
Junxiao Shi | 7091165 | 2014-08-12 10:14:24 -0700 | [diff] [blame] | 4 | * |
| 5 | * This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions). |
| 6 | * |
| 7 | * ndn-cxx library is free software: you can redistribute it and/or modify it under the |
| 8 | * terms of the GNU Lesser General Public License as published by the Free Software |
| 9 | * Foundation, either version 3 of the License, or (at your option) any later version. |
| 10 | * |
| 11 | * ndn-cxx library is distributed in the hope that it will be useful, but WITHOUT ANY |
| 12 | * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A |
| 13 | * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. |
| 14 | * |
| 15 | * You should have received copies of the GNU General Public License and GNU Lesser |
| 16 | * General Public License along with ndn-cxx, e.g., in COPYING.md file. If not, see |
| 17 | * <http://www.gnu.org/licenses/>. |
| 18 | * |
| 19 | * See AUTHORS.md for complete list of ndn-cxx authors and contributors. |
| 20 | */ |
| 21 | |
Junxiao Shi | 7357ef2 | 2016-09-07 02:39:37 +0000 | [diff] [blame] | 22 | #include "control-command.hpp" |
| 23 | #include "command-options.hpp" // only used in deprecated functions |
Junxiao Shi | 7091165 | 2014-08-12 10:14:24 -0700 | [diff] [blame] | 24 | |
| 25 | namespace ndn { |
| 26 | namespace nfd { |
| 27 | |
| 28 | ControlCommand::ControlCommand(const std::string& module, const std::string& verb) |
Junxiao Shi | 5de006b | 2014-10-26 20:20:52 -0700 | [diff] [blame] | 29 | : m_module(module) |
| 30 | , m_verb(verb) |
Junxiao Shi | 7091165 | 2014-08-12 10:14:24 -0700 | [diff] [blame] | 31 | { |
Junxiao Shi | 7091165 | 2014-08-12 10:14:24 -0700 | [diff] [blame] | 32 | } |
| 33 | |
Davide Pesavento | aeeb3fc | 2016-08-14 03:40:02 +0200 | [diff] [blame] | 34 | ControlCommand::~ControlCommand() = default; |
| 35 | |
Junxiao Shi | 7091165 | 2014-08-12 10:14:24 -0700 | [diff] [blame] | 36 | void |
| 37 | ControlCommand::validateRequest(const ControlParameters& parameters) const |
| 38 | { |
| 39 | m_requestValidator.validate(parameters); |
| 40 | } |
| 41 | |
| 42 | void |
| 43 | ControlCommand::applyDefaultsToRequest(ControlParameters& parameters) const |
| 44 | { |
| 45 | } |
| 46 | |
| 47 | void |
| 48 | ControlCommand::validateResponse(const ControlParameters& parameters) const |
| 49 | { |
| 50 | m_responseValidator.validate(parameters); |
| 51 | } |
| 52 | |
| 53 | void |
| 54 | ControlCommand::applyDefaultsToResponse(ControlParameters& parameters) const |
| 55 | { |
| 56 | } |
| 57 | |
| 58 | Name |
Junxiao Shi | 5de006b | 2014-10-26 20:20:52 -0700 | [diff] [blame] | 59 | ControlCommand::getRequestName(const Name& commandPrefix, |
| 60 | const ControlParameters& parameters) const |
Junxiao Shi | 7091165 | 2014-08-12 10:14:24 -0700 | [diff] [blame] | 61 | { |
| 62 | this->validateRequest(parameters); |
| 63 | |
Junxiao Shi | 5de006b | 2014-10-26 20:20:52 -0700 | [diff] [blame] | 64 | Name name = commandPrefix; |
| 65 | name.append(m_module).append(m_verb); |
Junxiao Shi | 7091165 | 2014-08-12 10:14:24 -0700 | [diff] [blame] | 66 | name.append(parameters.wireEncode()); |
| 67 | return name; |
| 68 | } |
| 69 | |
Junxiao Shi | 7091165 | 2014-08-12 10:14:24 -0700 | [diff] [blame] | 70 | ControlCommand::FieldValidator::FieldValidator() |
| 71 | : m_required(CONTROL_PARAMETER_UBOUND) |
| 72 | , m_optional(CONTROL_PARAMETER_UBOUND) |
| 73 | { |
| 74 | } |
| 75 | |
| 76 | void |
| 77 | ControlCommand::FieldValidator::validate(const ControlParameters& parameters) const |
| 78 | { |
| 79 | const std::vector<bool>& presentFields = parameters.getPresentFields(); |
| 80 | |
| 81 | for (size_t i = 0; i < CONTROL_PARAMETER_UBOUND; ++i) { |
| 82 | bool isPresent = presentFields[i]; |
| 83 | if (m_required[i]) { |
| 84 | if (!isPresent) { |
Davide Pesavento | f8503d2 | 2017-02-17 01:19:10 -0500 | [diff] [blame] | 85 | BOOST_THROW_EXCEPTION(ArgumentError(CONTROL_PARAMETER_FIELD[i] + " is required but missing")); |
Junxiao Shi | 7091165 | 2014-08-12 10:14:24 -0700 | [diff] [blame] | 86 | } |
| 87 | } |
| 88 | else if (isPresent && !m_optional[i]) { |
Davide Pesavento | f8503d2 | 2017-02-17 01:19:10 -0500 | [diff] [blame] | 89 | BOOST_THROW_EXCEPTION(ArgumentError(CONTROL_PARAMETER_FIELD[i] + " is forbidden but present")); |
Junxiao Shi | 7091165 | 2014-08-12 10:14:24 -0700 | [diff] [blame] | 90 | } |
| 91 | } |
| 92 | } |
| 93 | |
| 94 | FaceCreateCommand::FaceCreateCommand() |
| 95 | : ControlCommand("faces", "create") |
| 96 | { |
| 97 | m_requestValidator |
Yukai Tu | d93c5fc | 2015-08-25 11:37:16 +0800 | [diff] [blame] | 98 | .required(CONTROL_PARAMETER_URI) |
Teng Liang | f4908b1 | 2017-03-29 15:24:03 -0700 | [diff] [blame] | 99 | .optional(CONTROL_PARAMETER_LOCAL_URI) |
Eric Newberry | da916d6 | 2016-08-11 23:04:34 -0700 | [diff] [blame] | 100 | .optional(CONTROL_PARAMETER_FACE_PERSISTENCY) |
| 101 | .optional(CONTROL_PARAMETER_FLAGS) |
| 102 | .optional(CONTROL_PARAMETER_MASK); |
Junxiao Shi | 7091165 | 2014-08-12 10:14:24 -0700 | [diff] [blame] | 103 | m_responseValidator |
Yukai Tu | d93c5fc | 2015-08-25 11:37:16 +0800 | [diff] [blame] | 104 | .required(CONTROL_PARAMETER_FACE_ID) |
Eric Newberry | da916d6 | 2016-08-11 23:04:34 -0700 | [diff] [blame] | 105 | .required(CONTROL_PARAMETER_FACE_PERSISTENCY) |
| 106 | .optional(CONTROL_PARAMETER_FLAGS) |
Junxiao Shi | 144c7e3 | 2017-04-20 01:04:06 +0000 | [diff] [blame^] | 107 | .optional(CONTROL_PARAMETER_URI) |
| 108 | .optional(CONTROL_PARAMETER_LOCAL_URI); |
Yukai Tu | d93c5fc | 2015-08-25 11:37:16 +0800 | [diff] [blame] | 109 | } |
| 110 | |
| 111 | void |
| 112 | FaceCreateCommand::applyDefaultsToRequest(ControlParameters& parameters) const |
| 113 | { |
| 114 | if (!parameters.hasFacePersistency()) { |
| 115 | parameters.setFacePersistency(FacePersistency::FACE_PERSISTENCY_PERSISTENT); |
| 116 | } |
Junxiao Shi | 7091165 | 2014-08-12 10:14:24 -0700 | [diff] [blame] | 117 | } |
| 118 | |
| 119 | void |
Eric Newberry | da916d6 | 2016-08-11 23:04:34 -0700 | [diff] [blame] | 120 | FaceCreateCommand::validateRequest(const ControlParameters& parameters) const |
| 121 | { |
| 122 | this->ControlCommand::validateRequest(parameters); |
| 123 | |
| 124 | if (parameters.hasFlags() != parameters.hasMask()) { |
| 125 | BOOST_THROW_EXCEPTION(ArgumentError("Flags must be accompanied by Mask")); |
| 126 | } |
| 127 | } |
| 128 | |
| 129 | void |
Junxiao Shi | 7091165 | 2014-08-12 10:14:24 -0700 | [diff] [blame] | 130 | FaceCreateCommand::validateResponse(const ControlParameters& parameters) const |
| 131 | { |
| 132 | this->ControlCommand::validateResponse(parameters); |
| 133 | |
Davide Pesavento | f8503d2 | 2017-02-17 01:19:10 -0500 | [diff] [blame] | 134 | if (parameters.getFaceId() == INVALID_FACE_ID) { |
| 135 | BOOST_THROW_EXCEPTION(ArgumentError("FaceId must be valid")); |
Junxiao Shi | 7091165 | 2014-08-12 10:14:24 -0700 | [diff] [blame] | 136 | } |
| 137 | } |
| 138 | |
Yanbiao Li | cbdacb2 | 2016-08-02 16:02:35 +0800 | [diff] [blame] | 139 | FaceUpdateCommand::FaceUpdateCommand() |
| 140 | : ControlCommand("faces", "update") |
| 141 | { |
| 142 | m_requestValidator |
Eric Newberry | da916d6 | 2016-08-11 23:04:34 -0700 | [diff] [blame] | 143 | .optional(CONTROL_PARAMETER_FACE_ID) |
| 144 | .optional(CONTROL_PARAMETER_FACE_PERSISTENCY) |
| 145 | .optional(CONTROL_PARAMETER_FLAGS) |
| 146 | .optional(CONTROL_PARAMETER_MASK); |
Yanbiao Li | cbdacb2 | 2016-08-02 16:02:35 +0800 | [diff] [blame] | 147 | m_responseValidator |
Eric Newberry | 138ef2c | 2016-08-15 20:29:03 -0700 | [diff] [blame] | 148 | .required(CONTROL_PARAMETER_FACE_ID) |
| 149 | .required(CONTROL_PARAMETER_FACE_PERSISTENCY) |
| 150 | .required(CONTROL_PARAMETER_FLAGS); |
Eric Newberry | da916d6 | 2016-08-11 23:04:34 -0700 | [diff] [blame] | 151 | } |
| 152 | |
| 153 | void |
| 154 | FaceUpdateCommand::applyDefaultsToRequest(ControlParameters& parameters) const |
| 155 | { |
Eric Newberry | 138ef2c | 2016-08-15 20:29:03 -0700 | [diff] [blame] | 156 | if (!parameters.hasFaceId()) { |
| 157 | parameters.setFaceId(0); |
| 158 | } |
Yanbiao Li | cbdacb2 | 2016-08-02 16:02:35 +0800 | [diff] [blame] | 159 | } |
| 160 | |
| 161 | void |
| 162 | FaceUpdateCommand::validateRequest(const ControlParameters& parameters) const |
| 163 | { |
| 164 | this->ControlCommand::validateRequest(parameters); |
| 165 | |
Eric Newberry | da916d6 | 2016-08-11 23:04:34 -0700 | [diff] [blame] | 166 | if (parameters.hasFlags() != parameters.hasMask()) { |
| 167 | BOOST_THROW_EXCEPTION(ArgumentError("Flags must be accompanied by Mask")); |
Yanbiao Li | cbdacb2 | 2016-08-02 16:02:35 +0800 | [diff] [blame] | 168 | } |
| 169 | } |
| 170 | |
| 171 | void |
| 172 | FaceUpdateCommand::validateResponse(const ControlParameters& parameters) const |
| 173 | { |
Eric Newberry | 138ef2c | 2016-08-15 20:29:03 -0700 | [diff] [blame] | 174 | this->ControlCommand::validateResponse(parameters); |
| 175 | |
Davide Pesavento | f8503d2 | 2017-02-17 01:19:10 -0500 | [diff] [blame] | 176 | if (parameters.getFaceId() == INVALID_FACE_ID) { |
| 177 | BOOST_THROW_EXCEPTION(ArgumentError("FaceId must be valid")); |
Eric Newberry | 138ef2c | 2016-08-15 20:29:03 -0700 | [diff] [blame] | 178 | } |
Yanbiao Li | cbdacb2 | 2016-08-02 16:02:35 +0800 | [diff] [blame] | 179 | } |
| 180 | |
Junxiao Shi | 7091165 | 2014-08-12 10:14:24 -0700 | [diff] [blame] | 181 | FaceDestroyCommand::FaceDestroyCommand() |
| 182 | : ControlCommand("faces", "destroy") |
| 183 | { |
| 184 | m_requestValidator |
| 185 | .required(CONTROL_PARAMETER_FACE_ID); |
| 186 | m_responseValidator = m_requestValidator; |
| 187 | } |
| 188 | |
| 189 | void |
| 190 | FaceDestroyCommand::validateRequest(const ControlParameters& parameters) const |
| 191 | { |
| 192 | this->ControlCommand::validateRequest(parameters); |
| 193 | |
Davide Pesavento | f8503d2 | 2017-02-17 01:19:10 -0500 | [diff] [blame] | 194 | if (parameters.getFaceId() == INVALID_FACE_ID) { |
| 195 | BOOST_THROW_EXCEPTION(ArgumentError("FaceId must be valid")); |
Junxiao Shi | 7091165 | 2014-08-12 10:14:24 -0700 | [diff] [blame] | 196 | } |
| 197 | } |
| 198 | |
| 199 | void |
| 200 | FaceDestroyCommand::validateResponse(const ControlParameters& parameters) const |
| 201 | { |
| 202 | this->validateRequest(parameters); |
| 203 | } |
| 204 | |
| 205 | FaceLocalControlCommand::FaceLocalControlCommand(const std::string& verb) |
| 206 | : ControlCommand("faces", verb) |
| 207 | { |
| 208 | m_requestValidator |
| 209 | .required(CONTROL_PARAMETER_LOCAL_CONTROL_FEATURE); |
| 210 | m_responseValidator = m_requestValidator; |
| 211 | } |
| 212 | |
| 213 | void |
| 214 | FaceLocalControlCommand::validateRequest(const ControlParameters& parameters) const |
| 215 | { |
| 216 | this->ControlCommand::validateRequest(parameters); |
| 217 | |
| 218 | switch (parameters.getLocalControlFeature()) { |
| 219 | case LOCAL_CONTROL_FEATURE_INCOMING_FACE_ID: |
| 220 | case LOCAL_CONTROL_FEATURE_NEXT_HOP_FACE_ID: |
| 221 | break; |
| 222 | default: |
Spyridon Mastorakis | 0d2ed2e | 2015-07-27 19:09:12 -0700 | [diff] [blame] | 223 | BOOST_THROW_EXCEPTION(ArgumentError("LocalControlFeature is invalid")); |
Junxiao Shi | 7091165 | 2014-08-12 10:14:24 -0700 | [diff] [blame] | 224 | } |
| 225 | } |
| 226 | |
| 227 | void |
| 228 | FaceLocalControlCommand::validateResponse(const ControlParameters& parameters) const |
| 229 | { |
| 230 | this->validateRequest(parameters); |
| 231 | } |
| 232 | |
| 233 | FaceEnableLocalControlCommand::FaceEnableLocalControlCommand() |
| 234 | : FaceLocalControlCommand("enable-local-control") |
| 235 | { |
| 236 | } |
| 237 | |
| 238 | FaceDisableLocalControlCommand::FaceDisableLocalControlCommand() |
| 239 | : FaceLocalControlCommand("disable-local-control") |
| 240 | { |
| 241 | } |
| 242 | |
| 243 | FibAddNextHopCommand::FibAddNextHopCommand() |
| 244 | : ControlCommand("fib", "add-nexthop") |
| 245 | { |
| 246 | m_requestValidator |
| 247 | .required(CONTROL_PARAMETER_NAME) |
| 248 | .optional(CONTROL_PARAMETER_FACE_ID) |
| 249 | .optional(CONTROL_PARAMETER_COST); |
| 250 | m_responseValidator |
| 251 | .required(CONTROL_PARAMETER_NAME) |
| 252 | .required(CONTROL_PARAMETER_FACE_ID) |
| 253 | .required(CONTROL_PARAMETER_COST); |
| 254 | } |
| 255 | |
| 256 | void |
| 257 | FibAddNextHopCommand::applyDefaultsToRequest(ControlParameters& parameters) const |
| 258 | { |
| 259 | if (!parameters.hasFaceId()) { |
| 260 | parameters.setFaceId(0); |
| 261 | } |
| 262 | if (!parameters.hasCost()) { |
| 263 | parameters.setCost(0); |
| 264 | } |
| 265 | } |
| 266 | |
| 267 | void |
| 268 | FibAddNextHopCommand::validateResponse(const ControlParameters& parameters) const |
| 269 | { |
| 270 | this->ControlCommand::validateResponse(parameters); |
| 271 | |
Davide Pesavento | f8503d2 | 2017-02-17 01:19:10 -0500 | [diff] [blame] | 272 | if (parameters.getFaceId() == INVALID_FACE_ID) { |
| 273 | BOOST_THROW_EXCEPTION(ArgumentError("FaceId must be valid")); |
Junxiao Shi | 7091165 | 2014-08-12 10:14:24 -0700 | [diff] [blame] | 274 | } |
| 275 | } |
| 276 | |
| 277 | FibRemoveNextHopCommand::FibRemoveNextHopCommand() |
| 278 | : ControlCommand("fib", "remove-nexthop") |
| 279 | { |
| 280 | m_requestValidator |
| 281 | .required(CONTROL_PARAMETER_NAME) |
| 282 | .optional(CONTROL_PARAMETER_FACE_ID); |
| 283 | m_responseValidator |
| 284 | .required(CONTROL_PARAMETER_NAME) |
| 285 | .required(CONTROL_PARAMETER_FACE_ID); |
| 286 | } |
| 287 | |
| 288 | void |
| 289 | FibRemoveNextHopCommand::applyDefaultsToRequest(ControlParameters& parameters) const |
| 290 | { |
| 291 | if (!parameters.hasFaceId()) { |
| 292 | parameters.setFaceId(0); |
| 293 | } |
| 294 | } |
| 295 | |
| 296 | void |
| 297 | FibRemoveNextHopCommand::validateResponse(const ControlParameters& parameters) const |
| 298 | { |
| 299 | this->ControlCommand::validateResponse(parameters); |
| 300 | |
Davide Pesavento | f8503d2 | 2017-02-17 01:19:10 -0500 | [diff] [blame] | 301 | if (parameters.getFaceId() == INVALID_FACE_ID) { |
| 302 | BOOST_THROW_EXCEPTION(ArgumentError("FaceId must be valid")); |
Junxiao Shi | 7091165 | 2014-08-12 10:14:24 -0700 | [diff] [blame] | 303 | } |
| 304 | } |
| 305 | |
| 306 | StrategyChoiceSetCommand::StrategyChoiceSetCommand() |
| 307 | : ControlCommand("strategy-choice", "set") |
| 308 | { |
| 309 | m_requestValidator |
| 310 | .required(CONTROL_PARAMETER_NAME) |
| 311 | .required(CONTROL_PARAMETER_STRATEGY); |
| 312 | m_responseValidator = m_requestValidator; |
| 313 | } |
| 314 | |
| 315 | StrategyChoiceUnsetCommand::StrategyChoiceUnsetCommand() |
| 316 | : ControlCommand("strategy-choice", "unset") |
| 317 | { |
| 318 | m_requestValidator |
| 319 | .required(CONTROL_PARAMETER_NAME); |
| 320 | m_responseValidator = m_requestValidator; |
| 321 | } |
| 322 | |
| 323 | void |
| 324 | StrategyChoiceUnsetCommand::validateRequest(const ControlParameters& parameters) const |
| 325 | { |
| 326 | this->ControlCommand::validateRequest(parameters); |
| 327 | |
| 328 | if (parameters.getName().size() == 0) { |
Spyridon Mastorakis | 0d2ed2e | 2015-07-27 19:09:12 -0700 | [diff] [blame] | 329 | BOOST_THROW_EXCEPTION(ArgumentError("Name must not be ndn:/")); |
Junxiao Shi | 7091165 | 2014-08-12 10:14:24 -0700 | [diff] [blame] | 330 | } |
| 331 | } |
| 332 | |
| 333 | void |
| 334 | StrategyChoiceUnsetCommand::validateResponse(const ControlParameters& parameters) const |
| 335 | { |
| 336 | this->validateRequest(parameters); |
| 337 | } |
| 338 | |
| 339 | RibRegisterCommand::RibRegisterCommand() |
| 340 | : ControlCommand("rib", "register") |
| 341 | { |
| 342 | m_requestValidator |
| 343 | .required(CONTROL_PARAMETER_NAME) |
| 344 | .optional(CONTROL_PARAMETER_FACE_ID) |
| 345 | .optional(CONTROL_PARAMETER_ORIGIN) |
| 346 | .optional(CONTROL_PARAMETER_COST) |
| 347 | .optional(CONTROL_PARAMETER_FLAGS) |
| 348 | .optional(CONTROL_PARAMETER_EXPIRATION_PERIOD); |
| 349 | m_responseValidator |
| 350 | .required(CONTROL_PARAMETER_NAME) |
| 351 | .required(CONTROL_PARAMETER_FACE_ID) |
| 352 | .required(CONTROL_PARAMETER_ORIGIN) |
| 353 | .required(CONTROL_PARAMETER_COST) |
| 354 | .required(CONTROL_PARAMETER_FLAGS) |
| 355 | .optional(CONTROL_PARAMETER_EXPIRATION_PERIOD); |
| 356 | } |
| 357 | |
| 358 | void |
| 359 | RibRegisterCommand::applyDefaultsToRequest(ControlParameters& parameters) const |
| 360 | { |
| 361 | if (!parameters.hasFaceId()) { |
| 362 | parameters.setFaceId(0); |
| 363 | } |
| 364 | if (!parameters.hasOrigin()) { |
| 365 | parameters.setOrigin(ROUTE_ORIGIN_APP); |
| 366 | } |
| 367 | if (!parameters.hasCost()) { |
| 368 | parameters.setCost(0); |
| 369 | } |
| 370 | if (!parameters.hasFlags()) { |
| 371 | parameters.setFlags(ROUTE_FLAG_CHILD_INHERIT); |
| 372 | } |
| 373 | } |
| 374 | |
| 375 | void |
| 376 | RibRegisterCommand::validateResponse(const ControlParameters& parameters) const |
| 377 | { |
| 378 | this->ControlCommand::validateResponse(parameters); |
| 379 | |
Davide Pesavento | f8503d2 | 2017-02-17 01:19:10 -0500 | [diff] [blame] | 380 | if (parameters.getFaceId() == INVALID_FACE_ID) { |
| 381 | BOOST_THROW_EXCEPTION(ArgumentError("FaceId must be valid")); |
Junxiao Shi | 7091165 | 2014-08-12 10:14:24 -0700 | [diff] [blame] | 382 | } |
| 383 | } |
| 384 | |
| 385 | RibUnregisterCommand::RibUnregisterCommand() |
| 386 | : ControlCommand("rib", "unregister") |
| 387 | { |
| 388 | m_requestValidator |
| 389 | .required(CONTROL_PARAMETER_NAME) |
| 390 | .optional(CONTROL_PARAMETER_FACE_ID) |
| 391 | .optional(CONTROL_PARAMETER_ORIGIN); |
| 392 | m_responseValidator |
| 393 | .required(CONTROL_PARAMETER_NAME) |
| 394 | .required(CONTROL_PARAMETER_FACE_ID) |
| 395 | .required(CONTROL_PARAMETER_ORIGIN); |
| 396 | } |
| 397 | |
| 398 | void |
| 399 | RibUnregisterCommand::applyDefaultsToRequest(ControlParameters& parameters) const |
| 400 | { |
| 401 | if (!parameters.hasFaceId()) { |
| 402 | parameters.setFaceId(0); |
| 403 | } |
| 404 | if (!parameters.hasOrigin()) { |
| 405 | parameters.setOrigin(ROUTE_ORIGIN_APP); |
| 406 | } |
| 407 | } |
| 408 | |
| 409 | void |
| 410 | RibUnregisterCommand::validateResponse(const ControlParameters& parameters) const |
| 411 | { |
| 412 | this->ControlCommand::validateResponse(parameters); |
| 413 | |
Davide Pesavento | f8503d2 | 2017-02-17 01:19:10 -0500 | [diff] [blame] | 414 | if (parameters.getFaceId() == INVALID_FACE_ID) { |
| 415 | BOOST_THROW_EXCEPTION(ArgumentError("FaceId must be valid")); |
Junxiao Shi | 7091165 | 2014-08-12 10:14:24 -0700 | [diff] [blame] | 416 | } |
| 417 | } |
| 418 | |
| 419 | } // namespace nfd |
| 420 | } // namespace ndn |