blob: ea13b8297301a068a64186f54dbacdb966339f02 [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
Junxiao Shi5ec80222014-03-25 20:08:05 -070022enum ControlParameterField {
23 CONTROL_PARAMETER_NAME,
24 CONTROL_PARAMETER_FACE_ID,
25 CONTROL_PARAMETER_URI,
26 CONTROL_PARAMETER_LOCAL_CONTROL_FEATURE,
Junxiao Shi5f6c74f2014-04-18 16:29:44 -070027 CONTROL_PARAMETER_ORIGIN,
Junxiao Shi5ec80222014-03-25 20:08:05 -070028 CONTROL_PARAMETER_COST,
Junxiao Shi5f6c74f2014-04-18 16:29:44 -070029 CONTROL_PARAMETER_FLAGS,
Junxiao Shi5ec80222014-03-25 20:08:05 -070030 CONTROL_PARAMETER_STRATEGY,
Junxiao Shi5f6c74f2014-04-18 16:29:44 -070031 CONTROL_PARAMETER_EXPIRATION_PERIOD,
Junxiao Shi5ec80222014-03-25 20:08:05 -070032 CONTROL_PARAMETER_UBOUND
33};
34
35const std::string CONTROL_PARAMETER_FIELD[CONTROL_PARAMETER_UBOUND] = {
36 "Name",
37 "FaceId",
38 "Uri",
39 "LocalControlFeature",
Junxiao Shi5f6c74f2014-04-18 16:29:44 -070040 "Origin",
Junxiao Shi5ec80222014-03-25 20:08:05 -070041 "Cost",
Junxiao Shi5f6c74f2014-04-18 16:29:44 -070042 "Flags",
Junxiao Shi5ec80222014-03-25 20:08:05 -070043 "Strategy",
Junxiao Shi5f6c74f2014-04-18 16:29:44 -070044 "ExpirationPeriod",
Junxiao Shi5ec80222014-03-25 20:08:05 -070045};
46
Junxiao Shibc19b372014-03-23 16:59:25 -070047enum LocalControlFeature {
48 LOCAL_CONTROL_FEATURE_INCOMING_FACE_ID = 1,
49 LOCAL_CONTROL_FEATURE_NEXT_HOP_FACE_ID = 2
50};
51
Junxiao Shi7b6b79d2014-03-26 20:59:35 -070052/** \brief represents parameters in a ControlCommand request or response
53 * \sa http://redmine.named-data.net/projects/nfd/wiki/ControlCommand
54 */
55class ControlParameters
56{
Junxiao Shibc19b372014-03-23 16:59:25 -070057public:
58 class Error : public Tlv::Error
59 {
60 public:
61 explicit
62 Error(const std::string& what)
63 : Tlv::Error(what)
64 {
65 }
66 };
67
Junxiao Shi5ec80222014-03-25 20:08:05 -070068 ControlParameters()
69 : m_hasFields(CONTROL_PARAMETER_UBOUND)
70 {
71 }
Junxiao Shibc19b372014-03-23 16:59:25 -070072
73 explicit
74 ControlParameters(const Block& block)
Junxiao Shi5ec80222014-03-25 20:08:05 -070075 : m_hasFields(CONTROL_PARAMETER_UBOUND)
Junxiao Shibc19b372014-03-23 16:59:25 -070076 {
77 wireDecode(block);
78 }
79
80 template<bool T>
81 size_t
82 wireEncode(EncodingImpl<T>& encoder) const;
83
84 const Block&
85 wireEncode() const;
86
87 void
88 wireDecode(const Block& wire);
89
90public: // getters & setters
Junxiao Shi5f6c74f2014-04-18 16:29:44 -070091
Junxiao Shibc19b372014-03-23 16:59:25 -070092 bool
93 hasName() const
94 {
Junxiao Shi5ec80222014-03-25 20:08:05 -070095 return m_hasFields[CONTROL_PARAMETER_NAME];
Junxiao Shibc19b372014-03-23 16:59:25 -070096 }
97
98 const Name&
99 getName() const
100 {
Junxiao Shi5ec80222014-03-25 20:08:05 -0700101 BOOST_ASSERT(this->hasName());
Junxiao Shibc19b372014-03-23 16:59:25 -0700102 return m_name;
103 }
104
105 ControlParameters&
106 setName(const Name& name)
107 {
108 m_wire.reset();
109 m_name = name;
Junxiao Shi5ec80222014-03-25 20:08:05 -0700110 m_hasFields[CONTROL_PARAMETER_NAME] = true;
Junxiao Shibc19b372014-03-23 16:59:25 -0700111 return *this;
112 }
113
114 ControlParameters&
115 unsetName()
116 {
117 m_wire.reset();
Junxiao Shi5ec80222014-03-25 20:08:05 -0700118 m_hasFields[CONTROL_PARAMETER_NAME] = false;
Junxiao Shibc19b372014-03-23 16:59:25 -0700119 return *this;
120 }
121
122 bool
123 hasFaceId() const
124 {
Junxiao Shi5ec80222014-03-25 20:08:05 -0700125 return m_hasFields[CONTROL_PARAMETER_FACE_ID];
Junxiao Shibc19b372014-03-23 16:59:25 -0700126 }
127
128 uint64_t
129 getFaceId() const
130 {
Junxiao Shi5ec80222014-03-25 20:08:05 -0700131 BOOST_ASSERT(this->hasFaceId());
Junxiao Shibc19b372014-03-23 16:59:25 -0700132 return m_faceId;
133 }
134
135 ControlParameters&
136 setFaceId(uint64_t faceId)
137 {
138 m_wire.reset();
139 m_faceId = faceId;
Junxiao Shi5ec80222014-03-25 20:08:05 -0700140 m_hasFields[CONTROL_PARAMETER_FACE_ID] = true;
Junxiao Shibc19b372014-03-23 16:59:25 -0700141 return *this;
142 }
143
144 ControlParameters&
145 unsetFaceId()
146 {
147 m_wire.reset();
Junxiao Shi5ec80222014-03-25 20:08:05 -0700148 m_hasFields[CONTROL_PARAMETER_FACE_ID] = false;
Junxiao Shibc19b372014-03-23 16:59:25 -0700149 return *this;
150 }
151
152 bool
153 hasUri() const
154 {
Junxiao Shi5ec80222014-03-25 20:08:05 -0700155 return m_hasFields[CONTROL_PARAMETER_URI];
Junxiao Shibc19b372014-03-23 16:59:25 -0700156 }
157
158 const std::string&
159 getUri() const
160 {
Junxiao Shi5ec80222014-03-25 20:08:05 -0700161 BOOST_ASSERT(this->hasUri());
Junxiao Shibc19b372014-03-23 16:59:25 -0700162 return m_uri;
163 }
164
165 ControlParameters&
166 setUri(const std::string& uri)
167 {
168 m_wire.reset();
169 m_uri = uri;
Junxiao Shi5ec80222014-03-25 20:08:05 -0700170 m_hasFields[CONTROL_PARAMETER_URI] = true;
Junxiao Shibc19b372014-03-23 16:59:25 -0700171 return *this;
172 }
173
174 ControlParameters&
175 unsetUri()
176 {
177 m_wire.reset();
Junxiao Shi5ec80222014-03-25 20:08:05 -0700178 m_hasFields[CONTROL_PARAMETER_URI] = false;
Junxiao Shibc19b372014-03-23 16:59:25 -0700179 return *this;
180 }
181
182 bool
183 hasLocalControlFeature() const
184 {
Junxiao Shi5ec80222014-03-25 20:08:05 -0700185 return m_hasFields[CONTROL_PARAMETER_LOCAL_CONTROL_FEATURE];
Junxiao Shibc19b372014-03-23 16:59:25 -0700186 }
187
188 LocalControlFeature
189 getLocalControlFeature() const
190 {
Junxiao Shi5ec80222014-03-25 20:08:05 -0700191 BOOST_ASSERT(this->hasLocalControlFeature());
Junxiao Shibc19b372014-03-23 16:59:25 -0700192 return m_localControlFeature;
193 }
194
195 ControlParameters&
196 setLocalControlFeature(LocalControlFeature localControlFeature)
197 {
198 m_wire.reset();
199 m_localControlFeature = localControlFeature;
Junxiao Shi5ec80222014-03-25 20:08:05 -0700200 m_hasFields[CONTROL_PARAMETER_LOCAL_CONTROL_FEATURE] = true;
Junxiao Shibc19b372014-03-23 16:59:25 -0700201 return *this;
202 }
203
204 ControlParameters&
205 unsetLocalControlFeature()
206 {
207 m_wire.reset();
Junxiao Shi5ec80222014-03-25 20:08:05 -0700208 m_hasFields[CONTROL_PARAMETER_LOCAL_CONTROL_FEATURE] = false;
Junxiao Shibc19b372014-03-23 16:59:25 -0700209 return *this;
210 }
211
212 bool
Junxiao Shi5f6c74f2014-04-18 16:29:44 -0700213 hasOrigin() const
214 {
215 return m_hasFields[CONTROL_PARAMETER_ORIGIN];
216 }
217
218 uint64_t
219 getOrigin() const
220 {
221 BOOST_ASSERT(this->hasOrigin());
222 return m_origin;
223 }
224
225 ControlParameters&
226 setOrigin(uint64_t origin)
227 {
228 m_wire.reset();
229 m_origin = origin;
230 m_hasFields[CONTROL_PARAMETER_ORIGIN] = true;
231 return *this;
232 }
233
234 ControlParameters&
235 unsetOrigin()
236 {
237 m_wire.reset();
238 m_hasFields[CONTROL_PARAMETER_ORIGIN] = false;
239 return *this;
240 }
241
242 bool
Junxiao Shibc19b372014-03-23 16:59:25 -0700243 hasCost() const
244 {
Junxiao Shi5ec80222014-03-25 20:08:05 -0700245 return m_hasFields[CONTROL_PARAMETER_COST];
Junxiao Shibc19b372014-03-23 16:59:25 -0700246 }
247
248 uint64_t
249 getCost() const
250 {
Junxiao Shi5ec80222014-03-25 20:08:05 -0700251 BOOST_ASSERT(this->hasCost());
Junxiao Shibc19b372014-03-23 16:59:25 -0700252 return m_cost;
253 }
254
255 ControlParameters&
256 setCost(uint64_t cost)
257 {
258 m_wire.reset();
259 m_cost = cost;
Junxiao Shi5ec80222014-03-25 20:08:05 -0700260 m_hasFields[CONTROL_PARAMETER_COST] = true;
Junxiao Shibc19b372014-03-23 16:59:25 -0700261 return *this;
262 }
263
264 ControlParameters&
265 unsetCost()
266 {
267 m_wire.reset();
Junxiao Shi5ec80222014-03-25 20:08:05 -0700268 m_hasFields[CONTROL_PARAMETER_COST] = false;
Junxiao Shibc19b372014-03-23 16:59:25 -0700269 return *this;
270 }
271
272 bool
Junxiao Shi5f6c74f2014-04-18 16:29:44 -0700273 hasFlags() const
274 {
275 return m_hasFields[CONTROL_PARAMETER_FLAGS];
276 }
277
278 uint64_t
279 getFlags() const
280 {
281 BOOST_ASSERT(this->hasFlags());
282 return m_flags;
283 }
284
285 ControlParameters&
286 setFlags(uint64_t flags)
287 {
288 m_wire.reset();
289 m_flags = flags;
290 m_hasFields[CONTROL_PARAMETER_FLAGS] = true;
291 return *this;
292 }
293
294 ControlParameters&
295 unsetFlags()
296 {
297 m_wire.reset();
298 m_hasFields[CONTROL_PARAMETER_FLAGS] = false;
299 return *this;
300 }
301
302 bool
Junxiao Shibc19b372014-03-23 16:59:25 -0700303 hasStrategy() const
304 {
Junxiao Shi5ec80222014-03-25 20:08:05 -0700305 return m_hasFields[CONTROL_PARAMETER_STRATEGY];
Junxiao Shibc19b372014-03-23 16:59:25 -0700306 }
307
308 const Name&
309 getStrategy() const
310 {
Junxiao Shi5ec80222014-03-25 20:08:05 -0700311 BOOST_ASSERT(this->hasStrategy());
Junxiao Shibc19b372014-03-23 16:59:25 -0700312 return m_strategy;
313 }
314
315 ControlParameters&
316 setStrategy(const Name& strategy)
317 {
318 m_wire.reset();
319 m_strategy = strategy;
Junxiao Shi5ec80222014-03-25 20:08:05 -0700320 m_hasFields[CONTROL_PARAMETER_STRATEGY] = true;
Junxiao Shibc19b372014-03-23 16:59:25 -0700321 return *this;
322 }
323
324 ControlParameters&
325 unsetStrategy()
326 {
327 m_wire.reset();
Junxiao Shi5ec80222014-03-25 20:08:05 -0700328 m_hasFields[CONTROL_PARAMETER_STRATEGY] = false;
Junxiao Shibc19b372014-03-23 16:59:25 -0700329 return *this;
330 }
331
Junxiao Shi5f6c74f2014-04-18 16:29:44 -0700332 bool
333 hasExpirationPeriod() const
334 {
335 return m_hasFields[CONTROL_PARAMETER_EXPIRATION_PERIOD];
336 }
337
338 const time::milliseconds&
339 getExpirationPeriod() const
340 {
341 BOOST_ASSERT(this->hasExpirationPeriod());
342 return m_expirationPeriod;
343 }
344
345 ControlParameters&
346 setExpirationPeriod(const time::milliseconds& expirationPeriod)
347 {
348 m_wire.reset();
349 m_expirationPeriod = expirationPeriod;
350 m_hasFields[CONTROL_PARAMETER_EXPIRATION_PERIOD] = true;
351 return *this;
352 }
353
354 ControlParameters&
355 unsetExpirationPeriod()
356 {
357 m_wire.reset();
358 m_hasFields[CONTROL_PARAMETER_EXPIRATION_PERIOD] = false;
359 return *this;
360 }
361
Junxiao Shi5ec80222014-03-25 20:08:05 -0700362 const std::vector<bool>&
363 getPresentFields() const
364 {
365 return m_hasFields;
366 }
367
Junxiao Shibc19b372014-03-23 16:59:25 -0700368private: // fields
Junxiao Shi5ec80222014-03-25 20:08:05 -0700369 std::vector<bool> m_hasFields;
370
Junxiao Shibc19b372014-03-23 16:59:25 -0700371 Name m_name;
372 uint64_t m_faceId;
373 std::string m_uri;
374 LocalControlFeature m_localControlFeature;
Junxiao Shi5f6c74f2014-04-18 16:29:44 -0700375 uint64_t m_origin;
Junxiao Shibc19b372014-03-23 16:59:25 -0700376 uint64_t m_cost;
Junxiao Shi5f6c74f2014-04-18 16:29:44 -0700377 uint64_t m_flags;
Junxiao Shibc19b372014-03-23 16:59:25 -0700378 Name m_strategy;
Junxiao Shi5f6c74f2014-04-18 16:29:44 -0700379 time::milliseconds m_expirationPeriod;
Junxiao Shibc19b372014-03-23 16:59:25 -0700380
Junxiao Shibc19b372014-03-23 16:59:25 -0700381private:
382 mutable Block m_wire;
383};
384
385
Junxiao Shibc19b372014-03-23 16:59:25 -0700386template<bool T>
387inline size_t
388ControlParameters::wireEncode(EncodingImpl<T>& encoder) const
389{
390 size_t totalLength = 0;
391
Junxiao Shi5f6c74f2014-04-18 16:29:44 -0700392 if (this->hasExpirationPeriod()) {
393 totalLength += prependNonNegativeIntegerBlock(encoder,
394 tlv::nfd::ExpirationPeriod, m_expirationPeriod.count());
395 }
Junxiao Shi5ec80222014-03-25 20:08:05 -0700396 if (this->hasStrategy()) {
Junxiao Shibc19b372014-03-23 16:59:25 -0700397 totalLength += prependNestedBlock(encoder, tlv::nfd::Strategy, m_strategy);
398 }
Junxiao Shi5f6c74f2014-04-18 16:29:44 -0700399 if (this->hasFlags()) {
400 totalLength += prependNonNegativeIntegerBlock(encoder, tlv::nfd::Flags, m_flags);
401 }
Junxiao Shi5ec80222014-03-25 20:08:05 -0700402 if (this->hasCost()) {
Junxiao Shibc19b372014-03-23 16:59:25 -0700403 totalLength += prependNonNegativeIntegerBlock(encoder, tlv::nfd::Cost, m_cost);
404 }
Junxiao Shi5f6c74f2014-04-18 16:29:44 -0700405 if (this->hasOrigin()) {
406 totalLength += prependNonNegativeIntegerBlock(encoder, tlv::nfd::Origin, m_origin);
407 }
Junxiao Shi5ec80222014-03-25 20:08:05 -0700408 if (this->hasLocalControlFeature()) {
Junxiao Shibc19b372014-03-23 16:59:25 -0700409 totalLength += prependNonNegativeIntegerBlock(encoder,
410 tlv::nfd::LocalControlFeature, m_localControlFeature);
411 }
Junxiao Shi5ec80222014-03-25 20:08:05 -0700412 if (this->hasUri()) {
Junxiao Shibc19b372014-03-23 16:59:25 -0700413 size_t valLength = encoder.prependByteArray(
414 reinterpret_cast<const uint8_t*>(m_uri.c_str()), m_uri.size());
415 totalLength += valLength;
416 totalLength += encoder.prependVarNumber(valLength);
417 totalLength += encoder.prependVarNumber(tlv::nfd::Uri);
418 }
Junxiao Shi5ec80222014-03-25 20:08:05 -0700419 if (this->hasFaceId()) {
Junxiao Shibc19b372014-03-23 16:59:25 -0700420 totalLength += prependNonNegativeIntegerBlock(encoder, tlv::nfd::FaceId, m_faceId);
421 }
Junxiao Shi5ec80222014-03-25 20:08:05 -0700422 if (this->hasName()) {
Junxiao Shibc19b372014-03-23 16:59:25 -0700423 totalLength += m_name.wireEncode(encoder);
424 }
425
426 totalLength += encoder.prependVarNumber(totalLength);
427 totalLength += encoder.prependVarNumber(tlv::nfd::ControlParameters);
428 return totalLength;
429}
430
431inline const Block&
432ControlParameters::wireEncode() const
433{
434 if (m_wire.hasWire())
435 return m_wire;
436
437 EncodingEstimator estimator;
438 size_t estimatedSize = wireEncode(estimator);
439
440 EncodingBuffer buffer(estimatedSize, 0);
441 wireEncode(buffer);
442
443 m_wire = buffer.block();
444 return m_wire;
445}
446
447inline void
448ControlParameters::wireDecode(const Block& block)
449{
450 if (block.type() != tlv::nfd::ControlParameters) {
451 throw Error("expecting TLV-TYPE ControlParameters");
452 }
453 m_wire = block;
454 m_wire.parse();
455 Block::element_const_iterator val;
456
457 val = m_wire.find(Tlv::Name);
Junxiao Shi5ec80222014-03-25 20:08:05 -0700458 m_hasFields[CONTROL_PARAMETER_NAME] = val != m_wire.elements_end();
459 if (this->hasName()) {
Junxiao Shibc19b372014-03-23 16:59:25 -0700460 m_name.wireDecode(*val);
461 }
462
463 val = m_wire.find(tlv::nfd::FaceId);
Junxiao Shi5ec80222014-03-25 20:08:05 -0700464 m_hasFields[CONTROL_PARAMETER_FACE_ID] = val != m_wire.elements_end();
465 if (this->hasFaceId()) {
Junxiao Shibc19b372014-03-23 16:59:25 -0700466 m_faceId = static_cast<uint64_t>(readNonNegativeInteger(*val));
467 }
468
469 val = m_wire.find(tlv::nfd::Uri);
Junxiao Shi5ec80222014-03-25 20:08:05 -0700470 m_hasFields[CONTROL_PARAMETER_URI] = val != m_wire.elements_end();
471 if (this->hasUri()) {
Junxiao Shibc19b372014-03-23 16:59:25 -0700472 m_uri.assign(reinterpret_cast<const char*>(val->value()), val->value_size());
473 }
474
475 val = m_wire.find(tlv::nfd::LocalControlFeature);
Junxiao Shi5ec80222014-03-25 20:08:05 -0700476 m_hasFields[CONTROL_PARAMETER_LOCAL_CONTROL_FEATURE] = val != m_wire.elements_end();
477 if (this->hasLocalControlFeature()) {
Junxiao Shibc19b372014-03-23 16:59:25 -0700478 m_localControlFeature = static_cast<LocalControlFeature>(readNonNegativeInteger(*val));
479 }
480
Junxiao Shi5f6c74f2014-04-18 16:29:44 -0700481 val = m_wire.find(tlv::nfd::Origin);
482 m_hasFields[CONTROL_PARAMETER_ORIGIN] = val != m_wire.elements_end();
483 if (this->hasOrigin()) {
484 m_origin = static_cast<uint64_t>(readNonNegativeInteger(*val));
485 }
486
Junxiao Shibc19b372014-03-23 16:59:25 -0700487 val = m_wire.find(tlv::nfd::Cost);
Junxiao Shi5ec80222014-03-25 20:08:05 -0700488 m_hasFields[CONTROL_PARAMETER_COST] = val != m_wire.elements_end();
489 if (this->hasCost()) {
Junxiao Shibc19b372014-03-23 16:59:25 -0700490 m_cost = static_cast<uint64_t>(readNonNegativeInteger(*val));
491 }
492
Junxiao Shi5f6c74f2014-04-18 16:29:44 -0700493 val = m_wire.find(tlv::nfd::Flags);
494 m_hasFields[CONTROL_PARAMETER_FLAGS] = val != m_wire.elements_end();
495 if (this->hasFlags()) {
496 m_flags = static_cast<uint64_t>(readNonNegativeInteger(*val));
497 }
498
Junxiao Shibc19b372014-03-23 16:59:25 -0700499 val = m_wire.find(tlv::nfd::Strategy);
Junxiao Shi5ec80222014-03-25 20:08:05 -0700500 m_hasFields[CONTROL_PARAMETER_STRATEGY] = val != m_wire.elements_end();
501 if (this->hasStrategy()) {
Junxiao Shibc19b372014-03-23 16:59:25 -0700502 val->parse();
503 if (val->elements().empty()) {
504 throw Error("expecting Strategy/Name");
505 }
506 else {
507 m_strategy.wireDecode(*val->elements_begin());
508 }
509 }
Junxiao Shi5f6c74f2014-04-18 16:29:44 -0700510
511 val = m_wire.find(tlv::nfd::ExpirationPeriod);
512 m_hasFields[CONTROL_PARAMETER_EXPIRATION_PERIOD] = val != m_wire.elements_end();
513 if (this->hasExpirationPeriod()) {
514 m_expirationPeriod = time::milliseconds(readNonNegativeInteger(*val));
515 }
Junxiao Shibc19b372014-03-23 16:59:25 -0700516}
517
518inline std::ostream&
519operator<<(std::ostream& os, const ControlParameters& parameters)
520{
521 os << "ControlParameters(";
522
523 if (parameters.hasName()) {
524 os << "Name: " << parameters.getName() << ", ";
525 }
526
527 if (parameters.hasFaceId()) {
528 os << "FaceId: " << parameters.getFaceId() << ", ";
529 }
530
531 if (parameters.hasUri()) {
532 os << "Uri: " << parameters.getUri() << ", ";
533 }
534
535 if (parameters.hasLocalControlFeature()) {
536 os << "LocalControlFeature: " << parameters.getLocalControlFeature() << ", ";
537 }
538
Junxiao Shi5f6c74f2014-04-18 16:29:44 -0700539 if (parameters.hasOrigin()) {
540 os << "Origin: " << parameters.getOrigin() << ", ";
541 }
542
Junxiao Shibc19b372014-03-23 16:59:25 -0700543 if (parameters.hasCost()) {
544 os << "Cost: " << parameters.getCost() << ", ";
545 }
546
Junxiao Shi5f6c74f2014-04-18 16:29:44 -0700547 if (parameters.hasFlags()) {
548 os << "Flags: " << parameters.getFlags() << ", ";
549 }
550
Junxiao Shibc19b372014-03-23 16:59:25 -0700551 if (parameters.hasStrategy()) {
552 os << "Strategy: " << parameters.getStrategy() << ", ";
553 }
554
Junxiao Shi5f6c74f2014-04-18 16:29:44 -0700555 if (parameters.hasExpirationPeriod()) {
556 os << "ExpirationPeriod: " << parameters.getExpirationPeriod() << ", ";
557 }
558
Junxiao Shibc19b372014-03-23 16:59:25 -0700559 os << ")";
560 return os;
561}
562
563
564} // namespace nfd
565} // namespace ndn
566
567#endif // NDN_MANAGEMENT_NFD_CONTROL_PARAMETERS_HPP