Junxiao Shi | bc19b37 | 2014-03-23 16:59:25 -0700 | [diff] [blame] | 1 | /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil -*- */ |
| 2 | /** |
| 3 | * Copyright (C) 2013 Regents of the University of California. |
| 4 | * See COPYING for copyright and distribution information. |
| 5 | */ |
| 6 | |
| 7 | #ifndef NDN_MANAGEMENT_NFD_CONTROL_PARAMETERS_HPP |
| 8 | #define NDN_MANAGEMENT_NFD_CONTROL_PARAMETERS_HPP |
| 9 | |
| 10 | #include "../name.hpp" |
| 11 | #include "../encoding/tlv-nfd.hpp" |
| 12 | |
| 13 | namespace ndn { |
| 14 | namespace nfd { |
| 15 | |
| 16 | class ControlParameters; |
| 17 | typedef ControlParameters FaceManagementOptions; |
| 18 | typedef ControlParameters FibManagementOptions; |
| 19 | typedef ControlParameters StrategyChoiceOptions; |
| 20 | |
Junxiao Shi | 5ec8022 | 2014-03-25 20:08:05 -0700 | [diff] [blame^] | 21 | enum ControlParameterField { |
| 22 | CONTROL_PARAMETER_NAME, |
| 23 | CONTROL_PARAMETER_FACE_ID, |
| 24 | CONTROL_PARAMETER_URI, |
| 25 | CONTROL_PARAMETER_LOCAL_CONTROL_FEATURE, |
| 26 | CONTROL_PARAMETER_COST, |
| 27 | CONTROL_PARAMETER_STRATEGY, |
| 28 | CONTROL_PARAMETER_UBOUND |
| 29 | }; |
| 30 | |
| 31 | const std::string CONTROL_PARAMETER_FIELD[CONTROL_PARAMETER_UBOUND] = { |
| 32 | "Name", |
| 33 | "FaceId", |
| 34 | "Uri", |
| 35 | "LocalControlFeature", |
| 36 | "Cost", |
| 37 | "Strategy", |
| 38 | }; |
| 39 | |
Junxiao Shi | bc19b37 | 2014-03-23 16:59:25 -0700 | [diff] [blame] | 40 | enum LocalControlFeature { |
| 41 | LOCAL_CONTROL_FEATURE_INCOMING_FACE_ID = 1, |
| 42 | LOCAL_CONTROL_FEATURE_NEXT_HOP_FACE_ID = 2 |
| 43 | }; |
| 44 | |
| 45 | class ControlParameters { |
| 46 | public: |
| 47 | class Error : public Tlv::Error |
| 48 | { |
| 49 | public: |
| 50 | explicit |
| 51 | Error(const std::string& what) |
| 52 | : Tlv::Error(what) |
| 53 | { |
| 54 | } |
| 55 | }; |
| 56 | |
Junxiao Shi | 5ec8022 | 2014-03-25 20:08:05 -0700 | [diff] [blame^] | 57 | ControlParameters() |
| 58 | : m_hasFields(CONTROL_PARAMETER_UBOUND) |
| 59 | { |
| 60 | } |
Junxiao Shi | bc19b37 | 2014-03-23 16:59:25 -0700 | [diff] [blame] | 61 | |
| 62 | explicit |
| 63 | ControlParameters(const Block& block) |
Junxiao Shi | 5ec8022 | 2014-03-25 20:08:05 -0700 | [diff] [blame^] | 64 | : m_hasFields(CONTROL_PARAMETER_UBOUND) |
Junxiao Shi | bc19b37 | 2014-03-23 16:59:25 -0700 | [diff] [blame] | 65 | { |
| 66 | wireDecode(block); |
| 67 | } |
| 68 | |
| 69 | template<bool T> |
| 70 | size_t |
| 71 | wireEncode(EncodingImpl<T>& encoder) const; |
| 72 | |
| 73 | const Block& |
| 74 | wireEncode() const; |
| 75 | |
| 76 | void |
| 77 | wireDecode(const Block& wire); |
| 78 | |
| 79 | public: // getters & setters |
| 80 | bool |
| 81 | hasName() const |
| 82 | { |
Junxiao Shi | 5ec8022 | 2014-03-25 20:08:05 -0700 | [diff] [blame^] | 83 | return m_hasFields[CONTROL_PARAMETER_NAME]; |
Junxiao Shi | bc19b37 | 2014-03-23 16:59:25 -0700 | [diff] [blame] | 84 | } |
| 85 | |
| 86 | const Name& |
| 87 | getName() const |
| 88 | { |
Junxiao Shi | 5ec8022 | 2014-03-25 20:08:05 -0700 | [diff] [blame^] | 89 | BOOST_ASSERT(this->hasName()); |
Junxiao Shi | bc19b37 | 2014-03-23 16:59:25 -0700 | [diff] [blame] | 90 | return m_name; |
| 91 | } |
| 92 | |
| 93 | ControlParameters& |
| 94 | setName(const Name& name) |
| 95 | { |
| 96 | m_wire.reset(); |
| 97 | m_name = name; |
Junxiao Shi | 5ec8022 | 2014-03-25 20:08:05 -0700 | [diff] [blame^] | 98 | m_hasFields[CONTROL_PARAMETER_NAME] = true; |
Junxiao Shi | bc19b37 | 2014-03-23 16:59:25 -0700 | [diff] [blame] | 99 | return *this; |
| 100 | } |
| 101 | |
| 102 | ControlParameters& |
| 103 | unsetName() |
| 104 | { |
| 105 | m_wire.reset(); |
Junxiao Shi | 5ec8022 | 2014-03-25 20:08:05 -0700 | [diff] [blame^] | 106 | m_hasFields[CONTROL_PARAMETER_NAME] = false; |
Junxiao Shi | bc19b37 | 2014-03-23 16:59:25 -0700 | [diff] [blame] | 107 | return *this; |
| 108 | } |
| 109 | |
| 110 | bool |
| 111 | hasFaceId() const |
| 112 | { |
Junxiao Shi | 5ec8022 | 2014-03-25 20:08:05 -0700 | [diff] [blame^] | 113 | return m_hasFields[CONTROL_PARAMETER_FACE_ID]; |
Junxiao Shi | bc19b37 | 2014-03-23 16:59:25 -0700 | [diff] [blame] | 114 | } |
| 115 | |
| 116 | uint64_t |
| 117 | getFaceId() const |
| 118 | { |
Junxiao Shi | 5ec8022 | 2014-03-25 20:08:05 -0700 | [diff] [blame^] | 119 | BOOST_ASSERT(this->hasFaceId()); |
Junxiao Shi | bc19b37 | 2014-03-23 16:59:25 -0700 | [diff] [blame] | 120 | return m_faceId; |
| 121 | } |
| 122 | |
| 123 | ControlParameters& |
| 124 | setFaceId(uint64_t faceId) |
| 125 | { |
| 126 | m_wire.reset(); |
| 127 | m_faceId = faceId; |
Junxiao Shi | 5ec8022 | 2014-03-25 20:08:05 -0700 | [diff] [blame^] | 128 | m_hasFields[CONTROL_PARAMETER_FACE_ID] = true; |
Junxiao Shi | bc19b37 | 2014-03-23 16:59:25 -0700 | [diff] [blame] | 129 | return *this; |
| 130 | } |
| 131 | |
| 132 | ControlParameters& |
| 133 | unsetFaceId() |
| 134 | { |
| 135 | m_wire.reset(); |
Junxiao Shi | 5ec8022 | 2014-03-25 20:08:05 -0700 | [diff] [blame^] | 136 | m_hasFields[CONTROL_PARAMETER_FACE_ID] = false; |
Junxiao Shi | bc19b37 | 2014-03-23 16:59:25 -0700 | [diff] [blame] | 137 | return *this; |
| 138 | } |
| 139 | |
| 140 | bool |
| 141 | hasUri() const |
| 142 | { |
Junxiao Shi | 5ec8022 | 2014-03-25 20:08:05 -0700 | [diff] [blame^] | 143 | return m_hasFields[CONTROL_PARAMETER_URI]; |
Junxiao Shi | bc19b37 | 2014-03-23 16:59:25 -0700 | [diff] [blame] | 144 | } |
| 145 | |
| 146 | const std::string& |
| 147 | getUri() const |
| 148 | { |
Junxiao Shi | 5ec8022 | 2014-03-25 20:08:05 -0700 | [diff] [blame^] | 149 | BOOST_ASSERT(this->hasUri()); |
Junxiao Shi | bc19b37 | 2014-03-23 16:59:25 -0700 | [diff] [blame] | 150 | return m_uri; |
| 151 | } |
| 152 | |
| 153 | ControlParameters& |
| 154 | setUri(const std::string& uri) |
| 155 | { |
| 156 | m_wire.reset(); |
| 157 | m_uri = uri; |
Junxiao Shi | 5ec8022 | 2014-03-25 20:08:05 -0700 | [diff] [blame^] | 158 | m_hasFields[CONTROL_PARAMETER_URI] = true; |
Junxiao Shi | bc19b37 | 2014-03-23 16:59:25 -0700 | [diff] [blame] | 159 | return *this; |
| 160 | } |
| 161 | |
| 162 | ControlParameters& |
| 163 | unsetUri() |
| 164 | { |
| 165 | m_wire.reset(); |
Junxiao Shi | 5ec8022 | 2014-03-25 20:08:05 -0700 | [diff] [blame^] | 166 | m_hasFields[CONTROL_PARAMETER_URI] = false; |
Junxiao Shi | bc19b37 | 2014-03-23 16:59:25 -0700 | [diff] [blame] | 167 | return *this; |
| 168 | } |
| 169 | |
| 170 | bool |
| 171 | hasLocalControlFeature() const |
| 172 | { |
Junxiao Shi | 5ec8022 | 2014-03-25 20:08:05 -0700 | [diff] [blame^] | 173 | return m_hasFields[CONTROL_PARAMETER_LOCAL_CONTROL_FEATURE]; |
Junxiao Shi | bc19b37 | 2014-03-23 16:59:25 -0700 | [diff] [blame] | 174 | } |
| 175 | |
| 176 | LocalControlFeature |
| 177 | getLocalControlFeature() const |
| 178 | { |
Junxiao Shi | 5ec8022 | 2014-03-25 20:08:05 -0700 | [diff] [blame^] | 179 | BOOST_ASSERT(this->hasLocalControlFeature()); |
Junxiao Shi | bc19b37 | 2014-03-23 16:59:25 -0700 | [diff] [blame] | 180 | return m_localControlFeature; |
| 181 | } |
| 182 | |
| 183 | ControlParameters& |
| 184 | setLocalControlFeature(LocalControlFeature localControlFeature) |
| 185 | { |
| 186 | m_wire.reset(); |
| 187 | m_localControlFeature = localControlFeature; |
Junxiao Shi | 5ec8022 | 2014-03-25 20:08:05 -0700 | [diff] [blame^] | 188 | m_hasFields[CONTROL_PARAMETER_LOCAL_CONTROL_FEATURE] = true; |
Junxiao Shi | bc19b37 | 2014-03-23 16:59:25 -0700 | [diff] [blame] | 189 | return *this; |
| 190 | } |
| 191 | |
| 192 | ControlParameters& |
| 193 | unsetLocalControlFeature() |
| 194 | { |
| 195 | m_wire.reset(); |
Junxiao Shi | 5ec8022 | 2014-03-25 20:08:05 -0700 | [diff] [blame^] | 196 | m_hasFields[CONTROL_PARAMETER_LOCAL_CONTROL_FEATURE] = false; |
Junxiao Shi | bc19b37 | 2014-03-23 16:59:25 -0700 | [diff] [blame] | 197 | return *this; |
| 198 | } |
| 199 | |
| 200 | bool |
| 201 | hasCost() const |
| 202 | { |
Junxiao Shi | 5ec8022 | 2014-03-25 20:08:05 -0700 | [diff] [blame^] | 203 | return m_hasFields[CONTROL_PARAMETER_COST]; |
Junxiao Shi | bc19b37 | 2014-03-23 16:59:25 -0700 | [diff] [blame] | 204 | } |
| 205 | |
| 206 | uint64_t |
| 207 | getCost() const |
| 208 | { |
Junxiao Shi | 5ec8022 | 2014-03-25 20:08:05 -0700 | [diff] [blame^] | 209 | BOOST_ASSERT(this->hasCost()); |
Junxiao Shi | bc19b37 | 2014-03-23 16:59:25 -0700 | [diff] [blame] | 210 | return m_cost; |
| 211 | } |
| 212 | |
| 213 | ControlParameters& |
| 214 | setCost(uint64_t cost) |
| 215 | { |
| 216 | m_wire.reset(); |
| 217 | m_cost = cost; |
Junxiao Shi | 5ec8022 | 2014-03-25 20:08:05 -0700 | [diff] [blame^] | 218 | m_hasFields[CONTROL_PARAMETER_COST] = true; |
Junxiao Shi | bc19b37 | 2014-03-23 16:59:25 -0700 | [diff] [blame] | 219 | return *this; |
| 220 | } |
| 221 | |
| 222 | ControlParameters& |
| 223 | unsetCost() |
| 224 | { |
| 225 | m_wire.reset(); |
Junxiao Shi | 5ec8022 | 2014-03-25 20:08:05 -0700 | [diff] [blame^] | 226 | m_hasFields[CONTROL_PARAMETER_COST] = false; |
Junxiao Shi | bc19b37 | 2014-03-23 16:59:25 -0700 | [diff] [blame] | 227 | return *this; |
| 228 | } |
| 229 | |
| 230 | bool |
| 231 | hasStrategy() const |
| 232 | { |
Junxiao Shi | 5ec8022 | 2014-03-25 20:08:05 -0700 | [diff] [blame^] | 233 | return m_hasFields[CONTROL_PARAMETER_STRATEGY]; |
Junxiao Shi | bc19b37 | 2014-03-23 16:59:25 -0700 | [diff] [blame] | 234 | } |
| 235 | |
| 236 | const Name& |
| 237 | getStrategy() const |
| 238 | { |
Junxiao Shi | 5ec8022 | 2014-03-25 20:08:05 -0700 | [diff] [blame^] | 239 | BOOST_ASSERT(this->hasStrategy()); |
Junxiao Shi | bc19b37 | 2014-03-23 16:59:25 -0700 | [diff] [blame] | 240 | return m_strategy; |
| 241 | } |
| 242 | |
| 243 | ControlParameters& |
| 244 | setStrategy(const Name& strategy) |
| 245 | { |
| 246 | m_wire.reset(); |
| 247 | m_strategy = strategy; |
Junxiao Shi | 5ec8022 | 2014-03-25 20:08:05 -0700 | [diff] [blame^] | 248 | m_hasFields[CONTROL_PARAMETER_STRATEGY] = true; |
Junxiao Shi | bc19b37 | 2014-03-23 16:59:25 -0700 | [diff] [blame] | 249 | return *this; |
| 250 | } |
| 251 | |
| 252 | ControlParameters& |
| 253 | unsetStrategy() |
| 254 | { |
| 255 | m_wire.reset(); |
Junxiao Shi | 5ec8022 | 2014-03-25 20:08:05 -0700 | [diff] [blame^] | 256 | m_hasFields[CONTROL_PARAMETER_STRATEGY] = false; |
Junxiao Shi | bc19b37 | 2014-03-23 16:59:25 -0700 | [diff] [blame] | 257 | return *this; |
| 258 | } |
| 259 | |
Junxiao Shi | 5ec8022 | 2014-03-25 20:08:05 -0700 | [diff] [blame^] | 260 | const std::vector<bool>& |
| 261 | getPresentFields() const |
| 262 | { |
| 263 | return m_hasFields; |
| 264 | } |
| 265 | |
Junxiao Shi | bc19b37 | 2014-03-23 16:59:25 -0700 | [diff] [blame] | 266 | private: // fields |
Junxiao Shi | 5ec8022 | 2014-03-25 20:08:05 -0700 | [diff] [blame^] | 267 | std::vector<bool> m_hasFields; |
| 268 | |
Junxiao Shi | bc19b37 | 2014-03-23 16:59:25 -0700 | [diff] [blame] | 269 | Name m_name; |
| 270 | uint64_t m_faceId; |
| 271 | std::string m_uri; |
| 272 | LocalControlFeature m_localControlFeature; |
| 273 | uint64_t m_cost; |
| 274 | Name m_strategy; |
| 275 | |
Junxiao Shi | bc19b37 | 2014-03-23 16:59:25 -0700 | [diff] [blame] | 276 | private: |
| 277 | mutable Block m_wire; |
| 278 | }; |
| 279 | |
| 280 | |
Junxiao Shi | bc19b37 | 2014-03-23 16:59:25 -0700 | [diff] [blame] | 281 | template<bool T> |
| 282 | inline size_t |
| 283 | ControlParameters::wireEncode(EncodingImpl<T>& encoder) const |
| 284 | { |
| 285 | size_t totalLength = 0; |
| 286 | |
Junxiao Shi | 5ec8022 | 2014-03-25 20:08:05 -0700 | [diff] [blame^] | 287 | if (this->hasStrategy()) { |
Junxiao Shi | bc19b37 | 2014-03-23 16:59:25 -0700 | [diff] [blame] | 288 | totalLength += prependNestedBlock(encoder, tlv::nfd::Strategy, m_strategy); |
| 289 | } |
Junxiao Shi | 5ec8022 | 2014-03-25 20:08:05 -0700 | [diff] [blame^] | 290 | if (this->hasCost()) { |
Junxiao Shi | bc19b37 | 2014-03-23 16:59:25 -0700 | [diff] [blame] | 291 | totalLength += prependNonNegativeIntegerBlock(encoder, tlv::nfd::Cost, m_cost); |
| 292 | } |
Junxiao Shi | 5ec8022 | 2014-03-25 20:08:05 -0700 | [diff] [blame^] | 293 | if (this->hasLocalControlFeature()) { |
Junxiao Shi | bc19b37 | 2014-03-23 16:59:25 -0700 | [diff] [blame] | 294 | totalLength += prependNonNegativeIntegerBlock(encoder, |
| 295 | tlv::nfd::LocalControlFeature, m_localControlFeature); |
| 296 | } |
Junxiao Shi | 5ec8022 | 2014-03-25 20:08:05 -0700 | [diff] [blame^] | 297 | if (this->hasUri()) { |
Junxiao Shi | bc19b37 | 2014-03-23 16:59:25 -0700 | [diff] [blame] | 298 | size_t valLength = encoder.prependByteArray( |
| 299 | reinterpret_cast<const uint8_t*>(m_uri.c_str()), m_uri.size()); |
| 300 | totalLength += valLength; |
| 301 | totalLength += encoder.prependVarNumber(valLength); |
| 302 | totalLength += encoder.prependVarNumber(tlv::nfd::Uri); |
| 303 | } |
Junxiao Shi | 5ec8022 | 2014-03-25 20:08:05 -0700 | [diff] [blame^] | 304 | if (this->hasFaceId()) { |
Junxiao Shi | bc19b37 | 2014-03-23 16:59:25 -0700 | [diff] [blame] | 305 | totalLength += prependNonNegativeIntegerBlock(encoder, tlv::nfd::FaceId, m_faceId); |
| 306 | } |
Junxiao Shi | 5ec8022 | 2014-03-25 20:08:05 -0700 | [diff] [blame^] | 307 | if (this->hasName()) { |
Junxiao Shi | bc19b37 | 2014-03-23 16:59:25 -0700 | [diff] [blame] | 308 | totalLength += m_name.wireEncode(encoder); |
| 309 | } |
| 310 | |
| 311 | totalLength += encoder.prependVarNumber(totalLength); |
| 312 | totalLength += encoder.prependVarNumber(tlv::nfd::ControlParameters); |
| 313 | return totalLength; |
| 314 | } |
| 315 | |
| 316 | inline const Block& |
| 317 | ControlParameters::wireEncode() const |
| 318 | { |
| 319 | if (m_wire.hasWire()) |
| 320 | return m_wire; |
| 321 | |
| 322 | EncodingEstimator estimator; |
| 323 | size_t estimatedSize = wireEncode(estimator); |
| 324 | |
| 325 | EncodingBuffer buffer(estimatedSize, 0); |
| 326 | wireEncode(buffer); |
| 327 | |
| 328 | m_wire = buffer.block(); |
| 329 | return m_wire; |
| 330 | } |
| 331 | |
| 332 | inline void |
| 333 | ControlParameters::wireDecode(const Block& block) |
| 334 | { |
| 335 | if (block.type() != tlv::nfd::ControlParameters) { |
| 336 | throw Error("expecting TLV-TYPE ControlParameters"); |
| 337 | } |
| 338 | m_wire = block; |
| 339 | m_wire.parse(); |
| 340 | Block::element_const_iterator val; |
| 341 | |
| 342 | val = m_wire.find(Tlv::Name); |
Junxiao Shi | 5ec8022 | 2014-03-25 20:08:05 -0700 | [diff] [blame^] | 343 | m_hasFields[CONTROL_PARAMETER_NAME] = val != m_wire.elements_end(); |
| 344 | if (this->hasName()) { |
Junxiao Shi | bc19b37 | 2014-03-23 16:59:25 -0700 | [diff] [blame] | 345 | m_name.wireDecode(*val); |
| 346 | } |
| 347 | |
| 348 | val = m_wire.find(tlv::nfd::FaceId); |
Junxiao Shi | 5ec8022 | 2014-03-25 20:08:05 -0700 | [diff] [blame^] | 349 | m_hasFields[CONTROL_PARAMETER_FACE_ID] = val != m_wire.elements_end(); |
| 350 | if (this->hasFaceId()) { |
Junxiao Shi | bc19b37 | 2014-03-23 16:59:25 -0700 | [diff] [blame] | 351 | m_faceId = static_cast<uint64_t>(readNonNegativeInteger(*val)); |
| 352 | } |
| 353 | |
| 354 | val = m_wire.find(tlv::nfd::Uri); |
Junxiao Shi | 5ec8022 | 2014-03-25 20:08:05 -0700 | [diff] [blame^] | 355 | m_hasFields[CONTROL_PARAMETER_URI] = val != m_wire.elements_end(); |
| 356 | if (this->hasUri()) { |
Junxiao Shi | bc19b37 | 2014-03-23 16:59:25 -0700 | [diff] [blame] | 357 | m_uri.assign(reinterpret_cast<const char*>(val->value()), val->value_size()); |
| 358 | } |
| 359 | |
| 360 | val = m_wire.find(tlv::nfd::LocalControlFeature); |
Junxiao Shi | 5ec8022 | 2014-03-25 20:08:05 -0700 | [diff] [blame^] | 361 | m_hasFields[CONTROL_PARAMETER_LOCAL_CONTROL_FEATURE] = val != m_wire.elements_end(); |
| 362 | if (this->hasLocalControlFeature()) { |
Junxiao Shi | bc19b37 | 2014-03-23 16:59:25 -0700 | [diff] [blame] | 363 | m_localControlFeature = static_cast<LocalControlFeature>(readNonNegativeInteger(*val)); |
| 364 | } |
| 365 | |
| 366 | val = m_wire.find(tlv::nfd::Cost); |
Junxiao Shi | 5ec8022 | 2014-03-25 20:08:05 -0700 | [diff] [blame^] | 367 | m_hasFields[CONTROL_PARAMETER_COST] = val != m_wire.elements_end(); |
| 368 | if (this->hasCost()) { |
Junxiao Shi | bc19b37 | 2014-03-23 16:59:25 -0700 | [diff] [blame] | 369 | m_cost = static_cast<uint64_t>(readNonNegativeInteger(*val)); |
| 370 | } |
| 371 | |
| 372 | val = m_wire.find(tlv::nfd::Strategy); |
Junxiao Shi | 5ec8022 | 2014-03-25 20:08:05 -0700 | [diff] [blame^] | 373 | m_hasFields[CONTROL_PARAMETER_STRATEGY] = val != m_wire.elements_end(); |
| 374 | if (this->hasStrategy()) { |
Junxiao Shi | bc19b37 | 2014-03-23 16:59:25 -0700 | [diff] [blame] | 375 | val->parse(); |
| 376 | if (val->elements().empty()) { |
| 377 | throw Error("expecting Strategy/Name"); |
| 378 | } |
| 379 | else { |
| 380 | m_strategy.wireDecode(*val->elements_begin()); |
| 381 | } |
| 382 | } |
| 383 | } |
| 384 | |
| 385 | inline std::ostream& |
| 386 | operator<<(std::ostream& os, const ControlParameters& parameters) |
| 387 | { |
| 388 | os << "ControlParameters("; |
| 389 | |
| 390 | if (parameters.hasName()) { |
| 391 | os << "Name: " << parameters.getName() << ", "; |
| 392 | } |
| 393 | |
| 394 | if (parameters.hasFaceId()) { |
| 395 | os << "FaceId: " << parameters.getFaceId() << ", "; |
| 396 | } |
| 397 | |
| 398 | if (parameters.hasUri()) { |
| 399 | os << "Uri: " << parameters.getUri() << ", "; |
| 400 | } |
| 401 | |
| 402 | if (parameters.hasLocalControlFeature()) { |
| 403 | os << "LocalControlFeature: " << parameters.getLocalControlFeature() << ", "; |
| 404 | } |
| 405 | |
| 406 | if (parameters.hasCost()) { |
| 407 | os << "Cost: " << parameters.getCost() << ", "; |
| 408 | } |
| 409 | |
| 410 | if (parameters.hasStrategy()) { |
| 411 | os << "Strategy: " << parameters.getStrategy() << ", "; |
| 412 | } |
| 413 | |
| 414 | os << ")"; |
| 415 | return os; |
| 416 | } |
| 417 | |
| 418 | |
| 419 | } // namespace nfd |
| 420 | } // namespace ndn |
| 421 | |
| 422 | #endif // NDN_MANAGEMENT_NFD_CONTROL_PARAMETERS_HPP |