NS-3 based Named Data Networking (NDN) simulator
ndnSIM 2.3: NDN, CCN, CCNx, content centric networks
API Documentation
control-command.hpp
Go to the documentation of this file.
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
22 #ifndef NDN_MGMT_NFD_CONTROL_COMMAND_HPP
23 #define NDN_MGMT_NFD_CONTROL_COMMAND_HPP
24 
25 #include "control-parameters.hpp"
26 
27 namespace ndn {
28 namespace nfd {
29 
35 class ControlCommand : noncopyable
36 {
37 public:
40  class ArgumentError : public std::invalid_argument
41  {
42  public:
43  explicit
44  ArgumentError(const std::string& what)
45  : std::invalid_argument(what)
46  {
47  }
48  };
49 
50  virtual
52 
56  virtual void
57  validateRequest(const ControlParameters& parameters) const;
58 
61  virtual void
62  applyDefaultsToRequest(ControlParameters& parameters) const;
63 
67  virtual void
68  validateResponse(const ControlParameters& parameters) const;
69 
72  virtual void
73  applyDefaultsToResponse(ControlParameters& parameters) const;
74 
78  Name
79  getRequestName(const Name& commandPrefix, const ControlParameters& parameters) const;
80 
81 protected:
82  ControlCommand(const std::string& module, const std::string& verb);
83 
85  {
86  public:
88 
93  {
94  m_required[field] = true;
95  return *this;
96  }
97 
102  {
103  m_optional[field] = true;
104  return *this;
105  }
106 
111  void
112  validate(const ControlParameters& parameters) const;
113 
114  private:
115  std::vector<bool> m_required;
116  std::vector<bool> m_optional;
117  };
118 
119 protected:
130 
131 private:
132  name::Component m_module;
133  name::Component m_verb;
134 };
135 
136 
143 {
144 public:
146 
147  virtual void
148  applyDefaultsToRequest(ControlParameters& parameters) const override;
149 
150  virtual void
151  validateRequest(const ControlParameters& parameters) const override;
152 
153  virtual void
154  validateResponse(const ControlParameters& parameters) const override;
155 };
156 
157 
164 {
165 public:
167 
168  virtual void
169  applyDefaultsToRequest(ControlParameters& parameters) const override;
170 
171  virtual void
172  validateRequest(const ControlParameters& parameters) const override;
173 
178  virtual void
179  validateResponse(const ControlParameters& parameters) const override;
180 };
181 
182 
189 {
190 public:
192 
193  virtual void
194  validateRequest(const ControlParameters& parameters) const override;
195 
196  virtual void
197  validateResponse(const ControlParameters& parameters) const override;
198 };
199 
200 
206 {
207 public:
208  virtual void
209  validateRequest(const ControlParameters& parameters) const override;
210 
211  virtual void
212  validateResponse(const ControlParameters& parameters) const override;
213 
214 protected:
215  explicit
216  FaceLocalControlCommand(const std::string& verb);
217 };
218 
219 
226 {
227 public:
229 };
230 
231 
238 {
239 public:
241 };
242 
243 
250 {
251 public:
253 
254  virtual void
255  applyDefaultsToRequest(ControlParameters& parameters) const override;
256 
257  virtual void
258  validateResponse(const ControlParameters& parameters) const override;
259 };
260 
261 
268 {
269 public:
271 
272  virtual void
273  applyDefaultsToRequest(ControlParameters& parameters) const override;
274 
275  virtual void
276  validateResponse(const ControlParameters& parameters) const override;
277 };
278 
279 
286 {
287 public:
289 };
290 
291 
298 {
299 public:
301 
302  virtual void
303  validateRequest(const ControlParameters& parameters) const override;
304 
305  virtual void
306  validateResponse(const ControlParameters& parameters) const override;
307 };
308 
309 
316 {
317 public:
319 
320  virtual void
321  applyDefaultsToRequest(ControlParameters& parameters) const override;
322 
323  virtual void
324  validateResponse(const ControlParameters& parameters) const override;
325 };
326 
327 
334 {
335 public:
337 
338  virtual void
339  applyDefaultsToRequest(ControlParameters& parameters) const override;
340 
341  virtual void
342  validateResponse(const ControlParameters& parameters) const override;
343 };
344 
345 } // namespace nfd
346 } // namespace ndn
347 
348 #endif // NDN_MGMT_NFD_CONTROL_COMMAND_HPP
represents a faces/disable-local-control command
represents a strategy-choice/set command
virtual void applyDefaultsToResponse(ControlParameters &parameters) const
apply default values to missing fields in response
Copyright (c) 2011-2015 Regents of the University of California.
represents a fib/add-nexthop command
represents parameters in a ControlCommand request or response
virtual void validateResponse(const ControlParameters &parameters) const
validate response parameters
FieldValidator m_requestValidator
FieldValidator for request ControlParameters.
base class of NFD ControlCommand
STL namespace.
FieldValidator m_responseValidator
FieldValidator for response ControlParameters.
virtual void validateRequest(const ControlParameters &parameters) const
validate request parameters
virtual void applyDefaultsToRequest(ControlParameters &parameters) const
apply default values to missing fields in request
represents a strategy-choice/set command
represents a fib/remove-nexthop command
ControlCommand(const std::string &module, const std::string &verb)
represents a faces/create command
represents a faces/enable-local-control command
Name getRequestName(const Name &commandPrefix, const ControlParameters &parameters) const
construct the Name for a request Interest
Copyright (c) 2011-2015 Regents of the University of California.
Definition: ndn-common.hpp:40
FieldValidator & required(ControlParameterField field)
declare a required field
Name abstraction to represent an absolute name.
Definition: name.hpp:46
represents a rib/unregister command
represents a faces/update command
represents a rib/register command
Component holds a read-only name component value.
Base class for faces/[*]-local-control commands.
represents a faces/destroy command
represents an error in ControlParameters
FieldValidator & optional(ControlParameterField field)
declare an optional field