blob: de9bf98b970c730097e53bf05f7a9c5312cbbc67 [file] [log] [blame]
Junxiao Shibc19b372014-03-23 16:59:25 -07001/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil -*- */
2/**
Alexander Afanasyevdfa52c42014-04-24 21:10:11 -07003 * Copyright (c) 2013-2014, Regents of the University of California.
4 * All rights reserved.
5 *
6 * This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
7 * See AUTHORS.md for complete list of ndn-cxx authors and contributors.
8 *
9 * This file licensed under New BSD License. See COPYING for detailed information about
10 * ndn-cxx library copyright, permissions, and redistribution restrictions.
Junxiao Shibc19b372014-03-23 16:59:25 -070011 */
12
13#ifndef NDN_MANAGEMENT_NFD_CONTROL_PARAMETERS_HPP
14#define NDN_MANAGEMENT_NFD_CONTROL_PARAMETERS_HPP
15
16#include "../name.hpp"
17#include "../encoding/tlv-nfd.hpp"
18
19namespace ndn {
20namespace nfd {
21
Alexander Afanasyev4671bf72014-05-19 09:01:37 -040022/**
23 * \ingroup management
24 */
Junxiao Shi5ec80222014-03-25 20:08:05 -070025enum ControlParameterField {
26 CONTROL_PARAMETER_NAME,
27 CONTROL_PARAMETER_FACE_ID,
28 CONTROL_PARAMETER_URI,
29 CONTROL_PARAMETER_LOCAL_CONTROL_FEATURE,
Junxiao Shi5f6c74f2014-04-18 16:29:44 -070030 CONTROL_PARAMETER_ORIGIN,
Junxiao Shi5ec80222014-03-25 20:08:05 -070031 CONTROL_PARAMETER_COST,
Junxiao Shi5f6c74f2014-04-18 16:29:44 -070032 CONTROL_PARAMETER_FLAGS,
Junxiao Shi5ec80222014-03-25 20:08:05 -070033 CONTROL_PARAMETER_STRATEGY,
Junxiao Shi5f6c74f2014-04-18 16:29:44 -070034 CONTROL_PARAMETER_EXPIRATION_PERIOD,
Junxiao Shi5ec80222014-03-25 20:08:05 -070035 CONTROL_PARAMETER_UBOUND
36};
37
38const std::string CONTROL_PARAMETER_FIELD[CONTROL_PARAMETER_UBOUND] = {
39 "Name",
40 "FaceId",
41 "Uri",
42 "LocalControlFeature",
Junxiao Shi5f6c74f2014-04-18 16:29:44 -070043 "Origin",
Junxiao Shi5ec80222014-03-25 20:08:05 -070044 "Cost",
Junxiao Shi5f6c74f2014-04-18 16:29:44 -070045 "Flags",
Junxiao Shi5ec80222014-03-25 20:08:05 -070046 "Strategy",
Junxiao Shi5f6c74f2014-04-18 16:29:44 -070047 "ExpirationPeriod",
Junxiao Shi5ec80222014-03-25 20:08:05 -070048};
49
Alexander Afanasyev4671bf72014-05-19 09:01:37 -040050/**
51 * \ingroup management
52 */
Junxiao Shibc19b372014-03-23 16:59:25 -070053enum LocalControlFeature {
54 LOCAL_CONTROL_FEATURE_INCOMING_FACE_ID = 1,
55 LOCAL_CONTROL_FEATURE_NEXT_HOP_FACE_ID = 2
56};
57
Alexander Afanasyev4671bf72014-05-19 09:01:37 -040058/**
59 * \ingroup management
60 * \brief represents parameters in a ControlCommand request or response
61 * \sa http://redmine.named-data.net/projects/nfd/wiki/ControlCommand
Junxiao Shi7b6b79d2014-03-26 20:59:35 -070062 */
63class ControlParameters
64{
Junxiao Shibc19b372014-03-23 16:59:25 -070065public:
66 class Error : public Tlv::Error
67 {
68 public:
69 explicit
70 Error(const std::string& what)
71 : Tlv::Error(what)
72 {
73 }
74 };
75
Junxiao Shi5ec80222014-03-25 20:08:05 -070076 ControlParameters()
77 : m_hasFields(CONTROL_PARAMETER_UBOUND)
78 {
79 }
Junxiao Shibc19b372014-03-23 16:59:25 -070080
81 explicit
82 ControlParameters(const Block& block)
Junxiao Shi5ec80222014-03-25 20:08:05 -070083 : m_hasFields(CONTROL_PARAMETER_UBOUND)
Junxiao Shibc19b372014-03-23 16:59:25 -070084 {
85 wireDecode(block);
86 }
87
88 template<bool T>
89 size_t
90 wireEncode(EncodingImpl<T>& encoder) const;
91
92 const Block&
93 wireEncode() const;
94
95 void
96 wireDecode(const Block& wire);
97
98public: // getters & setters
Junxiao Shi5f6c74f2014-04-18 16:29:44 -070099
Junxiao Shibc19b372014-03-23 16:59:25 -0700100 bool
101 hasName() const
102 {
Junxiao Shi5ec80222014-03-25 20:08:05 -0700103 return m_hasFields[CONTROL_PARAMETER_NAME];
Junxiao Shibc19b372014-03-23 16:59:25 -0700104 }
105
106 const Name&
107 getName() const
108 {
Junxiao Shi5ec80222014-03-25 20:08:05 -0700109 BOOST_ASSERT(this->hasName());
Junxiao Shibc19b372014-03-23 16:59:25 -0700110 return m_name;
111 }
112
113 ControlParameters&
114 setName(const Name& name)
115 {
116 m_wire.reset();
117 m_name = name;
Junxiao Shi5ec80222014-03-25 20:08:05 -0700118 m_hasFields[CONTROL_PARAMETER_NAME] = true;
Junxiao Shibc19b372014-03-23 16:59:25 -0700119 return *this;
120 }
121
122 ControlParameters&
123 unsetName()
124 {
125 m_wire.reset();
Junxiao Shi5ec80222014-03-25 20:08:05 -0700126 m_hasFields[CONTROL_PARAMETER_NAME] = false;
Junxiao Shibc19b372014-03-23 16:59:25 -0700127 return *this;
128 }
129
130 bool
131 hasFaceId() const
132 {
Junxiao Shi5ec80222014-03-25 20:08:05 -0700133 return m_hasFields[CONTROL_PARAMETER_FACE_ID];
Junxiao Shibc19b372014-03-23 16:59:25 -0700134 }
135
136 uint64_t
137 getFaceId() const
138 {
Junxiao Shi5ec80222014-03-25 20:08:05 -0700139 BOOST_ASSERT(this->hasFaceId());
Junxiao Shibc19b372014-03-23 16:59:25 -0700140 return m_faceId;
141 }
142
143 ControlParameters&
144 setFaceId(uint64_t faceId)
145 {
146 m_wire.reset();
147 m_faceId = faceId;
Junxiao Shi5ec80222014-03-25 20:08:05 -0700148 m_hasFields[CONTROL_PARAMETER_FACE_ID] = true;
Junxiao Shibc19b372014-03-23 16:59:25 -0700149 return *this;
150 }
151
152 ControlParameters&
153 unsetFaceId()
154 {
155 m_wire.reset();
Junxiao Shi5ec80222014-03-25 20:08:05 -0700156 m_hasFields[CONTROL_PARAMETER_FACE_ID] = false;
Junxiao Shibc19b372014-03-23 16:59:25 -0700157 return *this;
158 }
159
160 bool
161 hasUri() const
162 {
Junxiao Shi5ec80222014-03-25 20:08:05 -0700163 return m_hasFields[CONTROL_PARAMETER_URI];
Junxiao Shibc19b372014-03-23 16:59:25 -0700164 }
165
166 const std::string&
167 getUri() const
168 {
Junxiao Shi5ec80222014-03-25 20:08:05 -0700169 BOOST_ASSERT(this->hasUri());
Junxiao Shibc19b372014-03-23 16:59:25 -0700170 return m_uri;
171 }
172
173 ControlParameters&
174 setUri(const std::string& uri)
175 {
176 m_wire.reset();
177 m_uri = uri;
Junxiao Shi5ec80222014-03-25 20:08:05 -0700178 m_hasFields[CONTROL_PARAMETER_URI] = true;
Junxiao Shibc19b372014-03-23 16:59:25 -0700179 return *this;
180 }
181
182 ControlParameters&
183 unsetUri()
184 {
185 m_wire.reset();
Junxiao Shi5ec80222014-03-25 20:08:05 -0700186 m_hasFields[CONTROL_PARAMETER_URI] = false;
Junxiao Shibc19b372014-03-23 16:59:25 -0700187 return *this;
188 }
189
190 bool
191 hasLocalControlFeature() const
192 {
Junxiao Shi5ec80222014-03-25 20:08:05 -0700193 return m_hasFields[CONTROL_PARAMETER_LOCAL_CONTROL_FEATURE];
Junxiao Shibc19b372014-03-23 16:59:25 -0700194 }
195
196 LocalControlFeature
197 getLocalControlFeature() const
198 {
Junxiao Shi5ec80222014-03-25 20:08:05 -0700199 BOOST_ASSERT(this->hasLocalControlFeature());
Junxiao Shibc19b372014-03-23 16:59:25 -0700200 return m_localControlFeature;
201 }
202
203 ControlParameters&
204 setLocalControlFeature(LocalControlFeature localControlFeature)
205 {
206 m_wire.reset();
207 m_localControlFeature = localControlFeature;
Junxiao Shi5ec80222014-03-25 20:08:05 -0700208 m_hasFields[CONTROL_PARAMETER_LOCAL_CONTROL_FEATURE] = true;
Junxiao Shibc19b372014-03-23 16:59:25 -0700209 return *this;
210 }
211
212 ControlParameters&
213 unsetLocalControlFeature()
214 {
215 m_wire.reset();
Junxiao Shi5ec80222014-03-25 20:08:05 -0700216 m_hasFields[CONTROL_PARAMETER_LOCAL_CONTROL_FEATURE] = false;
Junxiao Shibc19b372014-03-23 16:59:25 -0700217 return *this;
218 }
219
220 bool
Junxiao Shi5f6c74f2014-04-18 16:29:44 -0700221 hasOrigin() const
222 {
223 return m_hasFields[CONTROL_PARAMETER_ORIGIN];
224 }
225
226 uint64_t
227 getOrigin() const
228 {
229 BOOST_ASSERT(this->hasOrigin());
230 return m_origin;
231 }
232
233 ControlParameters&
234 setOrigin(uint64_t origin)
235 {
236 m_wire.reset();
237 m_origin = origin;
238 m_hasFields[CONTROL_PARAMETER_ORIGIN] = true;
239 return *this;
240 }
241
242 ControlParameters&
243 unsetOrigin()
244 {
245 m_wire.reset();
246 m_hasFields[CONTROL_PARAMETER_ORIGIN] = false;
247 return *this;
248 }
249
250 bool
Junxiao Shibc19b372014-03-23 16:59:25 -0700251 hasCost() const
252 {
Junxiao Shi5ec80222014-03-25 20:08:05 -0700253 return m_hasFields[CONTROL_PARAMETER_COST];
Junxiao Shibc19b372014-03-23 16:59:25 -0700254 }
255
256 uint64_t
257 getCost() const
258 {
Junxiao Shi5ec80222014-03-25 20:08:05 -0700259 BOOST_ASSERT(this->hasCost());
Junxiao Shibc19b372014-03-23 16:59:25 -0700260 return m_cost;
261 }
262
263 ControlParameters&
264 setCost(uint64_t cost)
265 {
266 m_wire.reset();
267 m_cost = cost;
Junxiao Shi5ec80222014-03-25 20:08:05 -0700268 m_hasFields[CONTROL_PARAMETER_COST] = true;
Junxiao Shibc19b372014-03-23 16:59:25 -0700269 return *this;
270 }
271
272 ControlParameters&
273 unsetCost()
274 {
275 m_wire.reset();
Junxiao Shi5ec80222014-03-25 20:08:05 -0700276 m_hasFields[CONTROL_PARAMETER_COST] = false;
Junxiao Shibc19b372014-03-23 16:59:25 -0700277 return *this;
278 }
279
280 bool
Junxiao Shi5f6c74f2014-04-18 16:29:44 -0700281 hasFlags() const
282 {
283 return m_hasFields[CONTROL_PARAMETER_FLAGS];
284 }
285
286 uint64_t
287 getFlags() const
288 {
289 BOOST_ASSERT(this->hasFlags());
290 return m_flags;
291 }
292
293 ControlParameters&
294 setFlags(uint64_t flags)
295 {
296 m_wire.reset();
297 m_flags = flags;
298 m_hasFields[CONTROL_PARAMETER_FLAGS] = true;
299 return *this;
300 }
301
302 ControlParameters&
303 unsetFlags()
304 {
305 m_wire.reset();
306 m_hasFields[CONTROL_PARAMETER_FLAGS] = false;
307 return *this;
308 }
309
310 bool
Junxiao Shibc19b372014-03-23 16:59:25 -0700311 hasStrategy() const
312 {
Junxiao Shi5ec80222014-03-25 20:08:05 -0700313 return m_hasFields[CONTROL_PARAMETER_STRATEGY];
Junxiao Shibc19b372014-03-23 16:59:25 -0700314 }
315
316 const Name&
317 getStrategy() const
318 {
Junxiao Shi5ec80222014-03-25 20:08:05 -0700319 BOOST_ASSERT(this->hasStrategy());
Junxiao Shibc19b372014-03-23 16:59:25 -0700320 return m_strategy;
321 }
322
323 ControlParameters&
324 setStrategy(const Name& strategy)
325 {
326 m_wire.reset();
327 m_strategy = strategy;
Junxiao Shi5ec80222014-03-25 20:08:05 -0700328 m_hasFields[CONTROL_PARAMETER_STRATEGY] = true;
Junxiao Shibc19b372014-03-23 16:59:25 -0700329 return *this;
330 }
331
332 ControlParameters&
333 unsetStrategy()
334 {
335 m_wire.reset();
Junxiao Shi5ec80222014-03-25 20:08:05 -0700336 m_hasFields[CONTROL_PARAMETER_STRATEGY] = false;
Junxiao Shibc19b372014-03-23 16:59:25 -0700337 return *this;
338 }
339
Junxiao Shi5f6c74f2014-04-18 16:29:44 -0700340 bool
341 hasExpirationPeriod() const
342 {
343 return m_hasFields[CONTROL_PARAMETER_EXPIRATION_PERIOD];
344 }
345
346 const time::milliseconds&
347 getExpirationPeriod() const
348 {
349 BOOST_ASSERT(this->hasExpirationPeriod());
350 return m_expirationPeriod;
351 }
352
353 ControlParameters&
354 setExpirationPeriod(const time::milliseconds& expirationPeriod)
355 {
356 m_wire.reset();
357 m_expirationPeriod = expirationPeriod;
358 m_hasFields[CONTROL_PARAMETER_EXPIRATION_PERIOD] = true;
359 return *this;
360 }
361
362 ControlParameters&
363 unsetExpirationPeriod()
364 {
365 m_wire.reset();
366 m_hasFields[CONTROL_PARAMETER_EXPIRATION_PERIOD] = false;
367 return *this;
368 }
369
Junxiao Shi5ec80222014-03-25 20:08:05 -0700370 const std::vector<bool>&
371 getPresentFields() const
372 {
373 return m_hasFields;
374 }
375
Junxiao Shibc19b372014-03-23 16:59:25 -0700376private: // fields
Junxiao Shi5ec80222014-03-25 20:08:05 -0700377 std::vector<bool> m_hasFields;
378
Junxiao Shibc19b372014-03-23 16:59:25 -0700379 Name m_name;
380 uint64_t m_faceId;
381 std::string m_uri;
382 LocalControlFeature m_localControlFeature;
Junxiao Shi5f6c74f2014-04-18 16:29:44 -0700383 uint64_t m_origin;
Junxiao Shibc19b372014-03-23 16:59:25 -0700384 uint64_t m_cost;
Junxiao Shi5f6c74f2014-04-18 16:29:44 -0700385 uint64_t m_flags;
Junxiao Shibc19b372014-03-23 16:59:25 -0700386 Name m_strategy;
Junxiao Shi5f6c74f2014-04-18 16:29:44 -0700387 time::milliseconds m_expirationPeriod;
Junxiao Shibc19b372014-03-23 16:59:25 -0700388
Junxiao Shibc19b372014-03-23 16:59:25 -0700389private:
390 mutable Block m_wire;
391};
392
393
Junxiao Shibc19b372014-03-23 16:59:25 -0700394template<bool T>
395inline size_t
396ControlParameters::wireEncode(EncodingImpl<T>& encoder) const
397{
398 size_t totalLength = 0;
399
Junxiao Shi5f6c74f2014-04-18 16:29:44 -0700400 if (this->hasExpirationPeriod()) {
401 totalLength += prependNonNegativeIntegerBlock(encoder,
402 tlv::nfd::ExpirationPeriod, m_expirationPeriod.count());
403 }
Junxiao Shi5ec80222014-03-25 20:08:05 -0700404 if (this->hasStrategy()) {
Junxiao Shibc19b372014-03-23 16:59:25 -0700405 totalLength += prependNestedBlock(encoder, tlv::nfd::Strategy, m_strategy);
406 }
Junxiao Shi5f6c74f2014-04-18 16:29:44 -0700407 if (this->hasFlags()) {
408 totalLength += prependNonNegativeIntegerBlock(encoder, tlv::nfd::Flags, m_flags);
409 }
Junxiao Shi5ec80222014-03-25 20:08:05 -0700410 if (this->hasCost()) {
Junxiao Shibc19b372014-03-23 16:59:25 -0700411 totalLength += prependNonNegativeIntegerBlock(encoder, tlv::nfd::Cost, m_cost);
412 }
Junxiao Shi5f6c74f2014-04-18 16:29:44 -0700413 if (this->hasOrigin()) {
414 totalLength += prependNonNegativeIntegerBlock(encoder, tlv::nfd::Origin, m_origin);
415 }
Junxiao Shi5ec80222014-03-25 20:08:05 -0700416 if (this->hasLocalControlFeature()) {
Junxiao Shibc19b372014-03-23 16:59:25 -0700417 totalLength += prependNonNegativeIntegerBlock(encoder,
418 tlv::nfd::LocalControlFeature, m_localControlFeature);
419 }
Junxiao Shi5ec80222014-03-25 20:08:05 -0700420 if (this->hasUri()) {
Junxiao Shibc19b372014-03-23 16:59:25 -0700421 size_t valLength = encoder.prependByteArray(
422 reinterpret_cast<const uint8_t*>(m_uri.c_str()), m_uri.size());
423 totalLength += valLength;
424 totalLength += encoder.prependVarNumber(valLength);
425 totalLength += encoder.prependVarNumber(tlv::nfd::Uri);
426 }
Junxiao Shi5ec80222014-03-25 20:08:05 -0700427 if (this->hasFaceId()) {
Junxiao Shibc19b372014-03-23 16:59:25 -0700428 totalLength += prependNonNegativeIntegerBlock(encoder, tlv::nfd::FaceId, m_faceId);
429 }
Junxiao Shi5ec80222014-03-25 20:08:05 -0700430 if (this->hasName()) {
Junxiao Shibc19b372014-03-23 16:59:25 -0700431 totalLength += m_name.wireEncode(encoder);
432 }
433
434 totalLength += encoder.prependVarNumber(totalLength);
435 totalLength += encoder.prependVarNumber(tlv::nfd::ControlParameters);
436 return totalLength;
437}
438
439inline const Block&
440ControlParameters::wireEncode() const
441{
442 if (m_wire.hasWire())
443 return m_wire;
444
445 EncodingEstimator estimator;
446 size_t estimatedSize = wireEncode(estimator);
447
448 EncodingBuffer buffer(estimatedSize, 0);
449 wireEncode(buffer);
450
451 m_wire = buffer.block();
452 return m_wire;
453}
454
455inline void
456ControlParameters::wireDecode(const Block& block)
457{
458 if (block.type() != tlv::nfd::ControlParameters) {
459 throw Error("expecting TLV-TYPE ControlParameters");
460 }
461 m_wire = block;
462 m_wire.parse();
463 Block::element_const_iterator val;
464
465 val = m_wire.find(Tlv::Name);
Junxiao Shi5ec80222014-03-25 20:08:05 -0700466 m_hasFields[CONTROL_PARAMETER_NAME] = val != m_wire.elements_end();
467 if (this->hasName()) {
Junxiao Shibc19b372014-03-23 16:59:25 -0700468 m_name.wireDecode(*val);
469 }
470
471 val = m_wire.find(tlv::nfd::FaceId);
Junxiao Shi5ec80222014-03-25 20:08:05 -0700472 m_hasFields[CONTROL_PARAMETER_FACE_ID] = val != m_wire.elements_end();
473 if (this->hasFaceId()) {
Junxiao Shibc19b372014-03-23 16:59:25 -0700474 m_faceId = static_cast<uint64_t>(readNonNegativeInteger(*val));
475 }
476
477 val = m_wire.find(tlv::nfd::Uri);
Junxiao Shi5ec80222014-03-25 20:08:05 -0700478 m_hasFields[CONTROL_PARAMETER_URI] = val != m_wire.elements_end();
479 if (this->hasUri()) {
Junxiao Shibc19b372014-03-23 16:59:25 -0700480 m_uri.assign(reinterpret_cast<const char*>(val->value()), val->value_size());
481 }
482
483 val = m_wire.find(tlv::nfd::LocalControlFeature);
Junxiao Shi5ec80222014-03-25 20:08:05 -0700484 m_hasFields[CONTROL_PARAMETER_LOCAL_CONTROL_FEATURE] = val != m_wire.elements_end();
485 if (this->hasLocalControlFeature()) {
Junxiao Shibc19b372014-03-23 16:59:25 -0700486 m_localControlFeature = static_cast<LocalControlFeature>(readNonNegativeInteger(*val));
487 }
488
Junxiao Shi5f6c74f2014-04-18 16:29:44 -0700489 val = m_wire.find(tlv::nfd::Origin);
490 m_hasFields[CONTROL_PARAMETER_ORIGIN] = val != m_wire.elements_end();
491 if (this->hasOrigin()) {
492 m_origin = static_cast<uint64_t>(readNonNegativeInteger(*val));
493 }
494
Junxiao Shibc19b372014-03-23 16:59:25 -0700495 val = m_wire.find(tlv::nfd::Cost);
Junxiao Shi5ec80222014-03-25 20:08:05 -0700496 m_hasFields[CONTROL_PARAMETER_COST] = val != m_wire.elements_end();
497 if (this->hasCost()) {
Junxiao Shibc19b372014-03-23 16:59:25 -0700498 m_cost = static_cast<uint64_t>(readNonNegativeInteger(*val));
499 }
500
Junxiao Shi5f6c74f2014-04-18 16:29:44 -0700501 val = m_wire.find(tlv::nfd::Flags);
502 m_hasFields[CONTROL_PARAMETER_FLAGS] = val != m_wire.elements_end();
503 if (this->hasFlags()) {
504 m_flags = static_cast<uint64_t>(readNonNegativeInteger(*val));
505 }
506
Junxiao Shibc19b372014-03-23 16:59:25 -0700507 val = m_wire.find(tlv::nfd::Strategy);
Junxiao Shi5ec80222014-03-25 20:08:05 -0700508 m_hasFields[CONTROL_PARAMETER_STRATEGY] = val != m_wire.elements_end();
509 if (this->hasStrategy()) {
Junxiao Shibc19b372014-03-23 16:59:25 -0700510 val->parse();
511 if (val->elements().empty()) {
512 throw Error("expecting Strategy/Name");
513 }
514 else {
515 m_strategy.wireDecode(*val->elements_begin());
516 }
517 }
Junxiao Shi5f6c74f2014-04-18 16:29:44 -0700518
519 val = m_wire.find(tlv::nfd::ExpirationPeriod);
520 m_hasFields[CONTROL_PARAMETER_EXPIRATION_PERIOD] = val != m_wire.elements_end();
521 if (this->hasExpirationPeriod()) {
522 m_expirationPeriod = time::milliseconds(readNonNegativeInteger(*val));
523 }
Junxiao Shibc19b372014-03-23 16:59:25 -0700524}
525
526inline std::ostream&
527operator<<(std::ostream& os, const ControlParameters& parameters)
528{
529 os << "ControlParameters(";
530
531 if (parameters.hasName()) {
532 os << "Name: " << parameters.getName() << ", ";
533 }
534
535 if (parameters.hasFaceId()) {
536 os << "FaceId: " << parameters.getFaceId() << ", ";
537 }
538
539 if (parameters.hasUri()) {
540 os << "Uri: " << parameters.getUri() << ", ";
541 }
542
543 if (parameters.hasLocalControlFeature()) {
544 os << "LocalControlFeature: " << parameters.getLocalControlFeature() << ", ";
545 }
546
Junxiao Shi5f6c74f2014-04-18 16:29:44 -0700547 if (parameters.hasOrigin()) {
548 os << "Origin: " << parameters.getOrigin() << ", ";
549 }
550
Junxiao Shibc19b372014-03-23 16:59:25 -0700551 if (parameters.hasCost()) {
552 os << "Cost: " << parameters.getCost() << ", ";
553 }
554
Junxiao Shi5f6c74f2014-04-18 16:29:44 -0700555 if (parameters.hasFlags()) {
556 os << "Flags: " << parameters.getFlags() << ", ";
557 }
558
Junxiao Shibc19b372014-03-23 16:59:25 -0700559 if (parameters.hasStrategy()) {
560 os << "Strategy: " << parameters.getStrategy() << ", ";
561 }
562
Junxiao Shi5f6c74f2014-04-18 16:29:44 -0700563 if (parameters.hasExpirationPeriod()) {
564 os << "ExpirationPeriod: " << parameters.getExpirationPeriod() << ", ";
565 }
566
Junxiao Shibc19b372014-03-23 16:59:25 -0700567 os << ")";
568 return os;
569}
570
571
572} // namespace nfd
573} // namespace ndn
574
575#endif // NDN_MANAGEMENT_NFD_CONTROL_PARAMETERS_HPP