NS-3 based Named Data Networking (NDN) simulator
ndnSIM 2.0: NDN, CCN, CCNx, content centric networks
API Documentation
nfd-control-command.hpp
Go to the documentation of this file.
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
22 #ifndef NDN_MANAGEMENT_NFD_CONTROL_COMMAND_HPP
23 #define NDN_MANAGEMENT_NFD_CONTROL_COMMAND_HPP
24 
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 
53  virtual void
54  validateRequest(const ControlParameters& parameters) const;
55 
58  virtual void
59  applyDefaultsToRequest(ControlParameters& parameters) const;
60 
64  virtual void
65  validateResponse(const ControlParameters& parameters) const;
66 
69  virtual void
70  applyDefaultsToResponse(ControlParameters& parameters) const;
71 
75  Name
76  getRequestName(const Name& commandPrefix, const ControlParameters& parameters) const;
77 
78 protected:
79  ControlCommand(const std::string& module, const std::string& verb);
80 
82  {
83  public:
85 
90  {
91  m_required[field] = true;
92  return *this;
93  }
94 
99  {
100  m_optional[field] = true;
101  return *this;
102  }
103 
108  void
109  validate(const ControlParameters& parameters) const;
110 
111  private:
112  std::vector<bool> m_required;
113  std::vector<bool> m_optional;
114  };
115 
116 protected:
127 
128 private:
129  name::Component m_module;
130  name::Component m_verb;
131 };
132 
133 
140 {
141 public:
143 
144  virtual void
145  validateResponse(const ControlParameters& parameters) const;
146 };
147 
148 
155 {
156 public:
158 
159  virtual void
160  validateRequest(const ControlParameters& parameters) const;
161 
162  virtual void
163  validateResponse(const ControlParameters& parameters) const;
164 };
165 
171 {
172 public:
173  virtual void
174  validateRequest(const ControlParameters& parameters) const;
175 
176  virtual void
177  validateResponse(const ControlParameters& parameters) const;
178 
179 protected:
180  explicit
181  FaceLocalControlCommand(const std::string& verb);
182 };
183 
184 
191 {
192 public:
194 };
195 
196 
203 {
204 public:
206 };
207 
208 
215 {
216 public:
218 
219  virtual void
220  applyDefaultsToRequest(ControlParameters& parameters) const;
221 
222  virtual void
223  validateResponse(const ControlParameters& parameters) const;
224 };
225 
226 
233 {
234 public:
236 
237  virtual void
238  applyDefaultsToRequest(ControlParameters& parameters) const;
239 
240  virtual void
241  validateResponse(const ControlParameters& parameters) const;
242 };
243 
244 
251 {
252 public:
254 };
255 
256 
263 {
264 public:
266 
267  virtual void
268  validateRequest(const ControlParameters& parameters) const;
269 
270  virtual void
271  validateResponse(const ControlParameters& parameters) const;
272 };
273 
274 
281 {
282 public:
284 
285  virtual void
286  applyDefaultsToRequest(ControlParameters& parameters) const;
287 
288  virtual void
289  validateResponse(const ControlParameters& parameters) const;
290 };
291 
292 
299 {
300 public:
302 
303  virtual void
304  applyDefaultsToRequest(ControlParameters& parameters) const;
305 
306  virtual void
307  validateResponse(const ControlParameters& parameters) const;
308 };
309 
310 } // namespace nfd
311 } // namespace ndn
312 
313 #endif // NDN_MANAGEMENT_NFD_CONTROL_COMMAND_HPP
represents a faces/disable-local-control command
virtual void applyDefaultsToResponse(ControlParameters &parameters) const
apply default values to missing fields in response
represents a strategy-choice/set command
Copyright (c) 2011-2015 Regents of the University of California.
represents a fib/add-nexthop command
represents parameters in a ControlCommand request or response
FieldValidator m_requestValidator
FieldValidator for request ControlParameters.
base class of NFD ControlCommand
virtual void validateResponse(const ControlParameters &parameters) const
validate response parameters
STL namespace.
virtual void validateRequest(const ControlParameters &parameters) const
validate request parameters
FieldValidator m_responseValidator
FieldValidator for response ControlParameters.
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
Copyright (c) 2011-2015 Regents of the University of California.
Definition: ndn-common.hpp:38
Name getRequestName(const Name &commandPrefix, const ControlParameters &parameters) const
construct the Name for a request Interest
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 rib/register command
Component holds a read-only name component value.
Base class for faces/[*]-local-control commands.
virtual void applyDefaultsToRequest(ControlParameters &parameters) const
apply default values to missing fields in request
represents a faces/destroy command
represents an error in ControlParameters
FieldValidator & optional(ControlParameterField field)
declare an optional field