NS-3 based Named Data Networking (NDN) simulator
ndnSIM 2.5: NDN, CCN, CCNx, content centric networks
API Documentation
face-manager.cpp
Go to the documentation of this file.
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2 /*
3  * Copyright (c) 2014-2018, Regents of the University of California,
4  * Arizona Board of Regents,
5  * Colorado State University,
6  * University Pierre & Marie Curie, Sorbonne University,
7  * Washington University in St. Louis,
8  * Beijing Institute of Technology,
9  * The University of Memphis.
10  *
11  * This file is part of NFD (Named Data Networking Forwarding Daemon).
12  * See AUTHORS.md for complete list of NFD authors and contributors.
13  *
14  * NFD is free software: you can redistribute it and/or modify it under the terms
15  * of the GNU General Public License as published by the Free Software Foundation,
16  * either version 3 of the License, or (at your option) any later version.
17  *
18  * NFD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
19  * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
20  * PURPOSE. See the GNU General Public License for more details.
21  *
22  * You should have received a copy of the GNU General Public License along with
23  * NFD, e.g., in COPYING.md file. If not, see <http://www.gnu.org/licenses/>.
24  */
25 
26 #include "face-manager.hpp"
27 
28 #include "core/logger.hpp"
31 #include "fw/face-table.hpp"
32 
33 #include <ndn-cxx/lp/tags.hpp>
38 
39 namespace nfd {
40 
42 
44  Dispatcher& dispatcher,
45  CommandAuthenticator& authenticator)
46  : NfdManagerBase(dispatcher, authenticator, "faces")
47  , m_faceSystem(faceSystem)
48  , m_faceTable(faceSystem.getFaceTable())
49 {
50  // register handlers for ControlCommand
51  registerCommandHandler<ndn::nfd::FaceCreateCommand>("create", bind(&FaceManager::createFace, this, _4, _5));
52  registerCommandHandler<ndn::nfd::FaceUpdateCommand>("update", bind(&FaceManager::updateFace, this, _3, _4, _5));
53  registerCommandHandler<ndn::nfd::FaceDestroyCommand>("destroy", bind(&FaceManager::destroyFace, this, _4, _5));
54 
55  // register handlers for StatusDataset
56  registerStatusDatasetHandler("list", bind(&FaceManager::listFaces, this, _3));
57  registerStatusDatasetHandler("channels", bind(&FaceManager::listChannels, this, _3));
58  registerStatusDatasetHandler("query", bind(&FaceManager::queryFaces, this, _2, _3));
59 
60  // register notification stream
61  m_postNotification = registerNotificationStream("events");
62  m_faceAddConn = m_faceTable.afterAdd.connect([this] (const Face& face) {
63  connectFaceStateChangeSignal(face);
64  notifyFaceEvent(face, ndn::nfd::FACE_EVENT_CREATED);
65  });
66  m_faceRemoveConn = m_faceTable.beforeRemove.connect([this] (const Face& face) {
67  notifyFaceEvent(face, ndn::nfd::FACE_EVENT_DESTROYED);
68  });
69 }
70 
71 void
72 FaceManager::createFace(const ControlParameters& parameters,
74 {
75  FaceUri remoteUri;
76  if (!remoteUri.parse(parameters.getUri())) {
77  NFD_LOG_TRACE("failed to parse remote URI: " << parameters.getUri());
78  done(ControlResponse(400, "Malformed command"));
79  return;
80  }
81 
82  if (!remoteUri.isCanonical()) {
83  NFD_LOG_TRACE("received non-canonical remote URI: " << remoteUri.toString());
84  done(ControlResponse(400, "Non-canonical remote URI"));
85  return;
86  }
87 
88  optional<FaceUri> localUri;
89  if (parameters.hasLocalUri()) {
90  localUri = FaceUri{};
91 
92  if (!localUri->parse(parameters.getLocalUri())) {
93  NFD_LOG_TRACE("failed to parse local URI: " << parameters.getLocalUri());
94  done(ControlResponse(400, "Malformed command"));
95  return;
96  }
97 
98  if (!localUri->isCanonical()) {
99  NFD_LOG_TRACE("received non-canonical local URI: " << localUri->toString());
100  done(ControlResponse(400, "Non-canonical local URI"));
101  return;
102  }
103  }
104 
105  face::ProtocolFactory* factory = m_faceSystem.getFactoryByScheme(remoteUri.getScheme());
106  if (factory == nullptr) {
107  NFD_LOG_TRACE("received create request for unsupported protocol: " << remoteUri.getScheme());
108  done(ControlResponse(406, "Unsupported protocol"));
109  return;
110  }
111 
112  face::FaceParams faceParams;
113  faceParams.persistency = parameters.getFacePersistency();
114  if (parameters.hasBaseCongestionMarkingInterval()) {
115  faceParams.baseCongestionMarkingInterval = parameters.getBaseCongestionMarkingInterval();
116  }
117  if (parameters.hasDefaultCongestionThreshold()) {
118  faceParams.defaultCongestionThreshold = parameters.getDefaultCongestionThreshold();
119  }
120  if (parameters.hasMtu()) {
121  faceParams.mtu = parameters.getMtu();
122  }
123  faceParams.wantLocalFields = parameters.hasFlagBit(ndn::nfd::BIT_LOCAL_FIELDS_ENABLED) &&
125  faceParams.wantLpReliability = parameters.hasFlagBit(ndn::nfd::BIT_LP_RELIABILITY_ENABLED) &&
128  faceParams.wantCongestionMarking = parameters.getFlagBit(ndn::nfd::BIT_CONGESTION_MARKING_ENABLED);
129  }
130  try {
131  factory->createFace({remoteUri, localUri, faceParams},
132  [this, parameters, done] (const auto& face) {
133  this->afterCreateFaceSuccess(face, parameters, done);
134  },
135  [done] (uint32_t status, const std::string& reason) {
136  NFD_LOG_DEBUG("Face creation failed: " << reason);
137  done(ControlResponse(status, reason));
138  });
139  }
140  catch (const std::runtime_error& error) {
141  NFD_LOG_ERROR("Face creation failed: " << error.what());
142  done(ControlResponse(500, "Face creation failed due to internal error"));
143  return;
144  }
145  catch (const std::logic_error& error) {
146  NFD_LOG_ERROR("Face creation failed: " << error.what());
147  done(ControlResponse(500, "Face creation failed due to internal error"));
148  return;
149  }
150 }
151 
152 template<typename T>
153 static void
154 copyMtu(const Face& face, T& to)
155 {
156  auto transport = face.getTransport();
157  BOOST_ASSERT(transport != nullptr);
158 
159  if (transport->getMtu() > 0) {
160  to.setMtu(std::min(static_cast<size_t>(transport->getMtu()), ndn::MAX_NDN_PACKET_SIZE));
161  }
162  else if (transport->getMtu() == face::MTU_UNLIMITED) {
163  to.setMtu(ndn::MAX_NDN_PACKET_SIZE);
164  }
165 }
166 
167 static ControlParameters
169 {
170  ControlParameters params;
171  params.setFaceId(face.getId())
172  .setFacePersistency(face.getPersistency());
173 
174  auto linkService = dynamic_cast<face::GenericLinkService*>(face.getLinkService());
175  if (linkService != nullptr) {
176  const auto& options = linkService->getOptions();
177  params.setBaseCongestionMarkingInterval(options.baseCongestionMarkingInterval)
178  .setDefaultCongestionThreshold(options.defaultCongestionThreshold)
179  .setFlagBit(ndn::nfd::BIT_LOCAL_FIELDS_ENABLED, options.allowLocalFields, false)
180  .setFlagBit(ndn::nfd::BIT_LP_RELIABILITY_ENABLED, options.reliabilityOptions.isEnabled, false)
181  .setFlagBit(ndn::nfd::BIT_CONGESTION_MARKING_ENABLED, options.allowCongestionMarking, false);
182  }
183 
184  return params;
185 }
186 
187 static ControlParameters
189 {
191  params.setUri(face.getRemoteUri().toString())
192  .setLocalUri(face.getLocalUri().toString());
193 
194  copyMtu(face, params);
195 
196  return params;
197 }
198 
199 void
200 FaceManager::afterCreateFaceSuccess(const shared_ptr<Face>& face,
201  const ControlParameters& parameters,
202  const ndn::mgmt::CommandContinuation& done)
203 {
204  if (face->getId() != face::INVALID_FACEID) { // Face already exists
205  NFD_LOG_TRACE("Attempted to create duplicate face of " << face->getId());
206  ControlParameters response = makeCreateFaceResponse(*face);
207  done(ControlResponse(409, "Face with remote URI already exists").setBody(response.wireEncode()));
208  return;
209  }
210 
211  // If scope non-local and flags set to enable local fields, request shouldn't
212  // have made it this far
213  BOOST_ASSERT(face->getScope() == ndn::nfd::FACE_SCOPE_LOCAL ||
214  !parameters.hasFlagBit(ndn::nfd::BIT_LOCAL_FIELDS_ENABLED) ||
215  (parameters.hasFlagBit(ndn::nfd::BIT_LOCAL_FIELDS_ENABLED) &&
216  !parameters.getFlagBit(ndn::nfd::BIT_LOCAL_FIELDS_ENABLED)));
217 
218  m_faceTable.add(face);
219 
220  ControlParameters response = makeCreateFaceResponse(*face);
221  done(ControlResponse(200, "OK").setBody(response.wireEncode()));
222 }
223 
224 static void
226 {
227  auto linkService = dynamic_cast<face::GenericLinkService*>(face.getLinkService());
228  if (linkService == nullptr) {
229  return;
230  }
231  auto options = linkService->getOptions();
232 
235  options.allowLocalFields = parameters.getFlagBit(ndn::nfd::BIT_LOCAL_FIELDS_ENABLED);
236  }
238  options.reliabilityOptions.isEnabled = parameters.getFlagBit(ndn::nfd::BIT_LP_RELIABILITY_ENABLED);
239  }
241  options.allowCongestionMarking = parameters.getFlagBit(ndn::nfd::BIT_CONGESTION_MARKING_ENABLED);
242  }
243  if (parameters.hasBaseCongestionMarkingInterval()) {
244  options.baseCongestionMarkingInterval = parameters.getBaseCongestionMarkingInterval();
245  }
246  if (parameters.hasDefaultCongestionThreshold()) {
247  options.defaultCongestionThreshold = parameters.getDefaultCongestionThreshold();
248  }
249 
250  linkService->setOptions(options);
251 }
252 
253 void
254 FaceManager::updateFace(const Interest& interest,
255  const ControlParameters& parameters,
256  const ndn::mgmt::CommandContinuation& done)
257 {
258  FaceId faceId = parameters.getFaceId();
259  if (faceId == 0) { // Self-update
260  auto incomingFaceIdTag = interest.getTag<lp::IncomingFaceIdTag>();
261  if (incomingFaceIdTag == nullptr) {
262  NFD_LOG_TRACE("unable to determine face for self-update");
263  done(ControlResponse(404, "No FaceId specified and IncomingFaceId not available"));
264  return;
265  }
266  faceId = *incomingFaceIdTag;
267  }
268 
269  Face* face = m_faceTable.get(faceId);
270  if (face == nullptr) {
271  NFD_LOG_TRACE("invalid face specified");
272  done(ControlResponse(404, "Specified face does not exist"));
273  return;
274  }
275 
276  // Verify validity of requested changes
277  ControlParameters response;
278  bool areParamsValid = true;
279 
280  if (parameters.hasFlagBit(ndn::nfd::BIT_LOCAL_FIELDS_ENABLED) &&
281  parameters.getFlagBit(ndn::nfd::BIT_LOCAL_FIELDS_ENABLED) &&
282  face->getScope() != ndn::nfd::FACE_SCOPE_LOCAL) {
283  NFD_LOG_TRACE("received request to enable local fields on non-local face");
284  areParamsValid = false;
285  response.setFlagBit(ndn::nfd::BIT_LOCAL_FIELDS_ENABLED,
286  parameters.getFlagBit(ndn::nfd::BIT_LOCAL_FIELDS_ENABLED));
287  }
288 
289  // check whether the requested FacePersistency change is valid if it's present
290  if (parameters.hasFacePersistency()) {
291  auto persistency = parameters.getFacePersistency();
292  if (!face->getTransport()->canChangePersistencyTo(persistency)) {
293  NFD_LOG_TRACE("cannot change face persistency to " << persistency);
294  areParamsValid = false;
295  response.setFacePersistency(persistency);
296  }
297  }
298 
299  if (!areParamsValid) {
300  done(ControlResponse(409, "Invalid properties specified").setBody(response.wireEncode()));
301  return;
302  }
303 
304  // All specified properties are valid, so make changes
305  if (parameters.hasFacePersistency()) {
306  face->setPersistency(parameters.getFacePersistency());
307  }
308  updateLinkServiceOptions(*face, parameters);
309 
310  // Prepare and send ControlResponse
311  response = makeUpdateFaceResponse(*face);
312  done(ControlResponse(200, "OK").setBody(response.wireEncode()));
313 }
314 
315 void
316 FaceManager::destroyFace(const ControlParameters& parameters,
317  const ndn::mgmt::CommandContinuation& done)
318 {
319  Face* face = m_faceTable.get(parameters.getFaceId());
320  if (face != nullptr) {
321  face->close();
322  }
323 
324  done(ControlResponse(200, "OK").setBody(parameters.wireEncode()));
325 }
326 
327 template<typename T>
328 static void
329 copyFaceProperties(const Face& face, T& to)
330 {
331  to.setFaceId(face.getId())
332  .setRemoteUri(face.getRemoteUri().toString())
333  .setLocalUri(face.getLocalUri().toString())
334  .setFaceScope(face.getScope())
335  .setFacePersistency(face.getPersistency())
336  .setLinkType(face.getLinkType());
337 
338  auto linkService = dynamic_cast<face::GenericLinkService*>(face.getLinkService());
339  if (linkService != nullptr) {
340  const auto& options = linkService->getOptions();
341  to.setFlagBit(ndn::nfd::BIT_LOCAL_FIELDS_ENABLED, options.allowLocalFields)
342  .setFlagBit(ndn::nfd::BIT_LP_RELIABILITY_ENABLED, options.reliabilityOptions.isEnabled)
343  .setFlagBit(ndn::nfd::BIT_CONGESTION_MARKING_ENABLED, options.allowCongestionMarking);
344  }
345 }
346 
349 {
350  ndn::nfd::FaceStatus status;
351  copyFaceProperties(face, status);
352 
353  auto expirationTime = face.getExpirationTime();
354  if (expirationTime != time::steady_clock::TimePoint::max()) {
355  status.setExpirationPeriod(std::max(0_ms,
356  time::duration_cast<time::milliseconds>(expirationTime - now)));
357  }
358 
359  auto linkService = dynamic_cast<face::GenericLinkService*>(face.getLinkService());
360  if (linkService != nullptr) {
361  const auto& options = linkService->getOptions();
362  status.setBaseCongestionMarkingInterval(options.baseCongestionMarkingInterval)
363  .setDefaultCongestionThreshold(options.defaultCongestionThreshold);
364  }
365 
366  copyMtu(face, status);
367 
368  const auto& counters = face.getCounters();
369  status.setNInInterests(counters.nInInterests)
370  .setNOutInterests(counters.nOutInterests)
371  .setNInData(counters.nInData)
372  .setNOutData(counters.nOutData)
373  .setNInNacks(counters.nInNacks)
374  .setNOutNacks(counters.nOutNacks)
375  .setNInBytes(counters.nInBytes)
376  .setNOutBytes(counters.nOutBytes);
377 
378  return status;
379 }
380 
381 void
382 FaceManager::listFaces(ndn::mgmt::StatusDatasetContext& context)
383 {
384  auto now = time::steady_clock::now();
385  for (const auto& face : m_faceTable) {
386  ndn::nfd::FaceStatus status = makeFaceStatus(face, now);
387  context.append(status.wireEncode());
388  }
389  context.end();
390 }
391 
392 void
393 FaceManager::listChannels(ndn::mgmt::StatusDatasetContext& context)
394 {
395  auto factories = m_faceSystem.listProtocolFactories();
396  for (const auto* factory : factories) {
397  for (const auto& channel : factory->getChannels()) {
399  entry.setLocalUri(channel->getUri().toString());
400  context.append(entry.wireEncode());
401  }
402  }
403  context.end();
404 }
405 
406 static bool
407 matchFilter(const ndn::nfd::FaceQueryFilter& filter, const Face& face)
408 {
409  if (filter.hasFaceId() &&
410  filter.getFaceId() != static_cast<uint64_t>(face.getId())) {
411  return false;
412  }
413 
414  if (filter.hasUriScheme() &&
415  filter.getUriScheme() != face.getRemoteUri().getScheme() &&
416  filter.getUriScheme() != face.getLocalUri().getScheme()) {
417  return false;
418  }
419 
420  if (filter.hasRemoteUri() &&
421  filter.getRemoteUri() != face.getRemoteUri().toString()) {
422  return false;
423  }
424 
425  if (filter.hasLocalUri() &&
426  filter.getLocalUri() != face.getLocalUri().toString()) {
427  return false;
428  }
429 
430  if (filter.hasFaceScope() &&
431  filter.getFaceScope() != face.getScope()) {
432  return false;
433  }
434 
435  if (filter.hasFacePersistency() &&
436  filter.getFacePersistency() != face.getPersistency()) {
437  return false;
438  }
439 
440  if (filter.hasLinkType() &&
441  filter.getLinkType() != face.getLinkType()) {
442  return false;
443  }
444 
445  return true;
446 }
447 
448 void
449 FaceManager::queryFaces(const Interest& interest,
451 {
452  ndn::nfd::FaceQueryFilter faceFilter;
453  try {
454  faceFilter.wireDecode(interest.getName()[-1].blockFromValue());
455  }
456  catch (const tlv::Error& e) {
457  NFD_LOG_DEBUG("Malformed query filter: " << e.what());
458  return context.reject(ControlResponse(400, "Malformed filter"));
459  }
460 
461  auto now = time::steady_clock::now();
462  for (const auto& face : m_faceTable) {
463  if (matchFilter(faceFilter, face)) {
464  ndn::nfd::FaceStatus status = makeFaceStatus(face, now);
465  context.append(status.wireEncode());
466  }
467  }
468  context.end();
469 }
470 
471 void
472 FaceManager::notifyFaceEvent(const Face& face, ndn::nfd::FaceEventKind kind)
473 {
474  ndn::nfd::FaceEventNotification notification;
475  notification.setKind(kind);
476  copyFaceProperties(face, notification);
477 
478  m_postNotification(notification.wireEncode());
479 }
480 
481 void
482 FaceManager::connectFaceStateChangeSignal(const Face& face)
483 {
484  using face::FaceState;
485 
486  FaceId faceId = face.getId();
487  m_faceStateChangeConn[faceId] = face.afterStateChange.connect(
488  [this, faceId, &face] (FaceState oldState, FaceState newState) {
489  if (newState == FaceState::UP) {
490  notifyFaceEvent(face, ndn::nfd::FACE_EVENT_UP);
491  }
492  else if (newState == FaceState::DOWN) {
493  notifyFaceEvent(face, ndn::nfd::FACE_EVENT_DOWN);
494  }
495  else if (newState == FaceState::CLOSED) {
496  // cannot use face.getId() because it may already be reset to INVALID_FACEID
497  m_faceStateChangeConn.erase(faceId);
498  }
499  });
500 }
501 
502 } // namespace nfd
signal::Signal< FaceTable, Face & > afterAdd
fires after a face is added
Definition: face-table.hpp:84
void reject(const ControlResponse &resp=ControlResponse().setCode(400))
declare the non-existence of a response
time_point TimePoint
Definition: time.hpp:225
ControlParameters & setFaceId(uint64_t faceId)
const std::string & getLocalUri() const
static void updateLinkServiceOptions(Face &face, const ControlParameters &parameters)
represents parameters in a ControlCommand request or response
time::nanoseconds getBaseCongestionMarkingInterval() const
generalization of a network interface
Definition: face.hpp:67
#define NFD_LOG_ERROR
Definition: logger.hpp:41
represents a dispatcher on server side of NFD Management protocol
Definition: dispatcher.hpp:130
const ssize_t MTU_UNLIMITED
indicates the transport has no limit on payload size
Definition: transport.hpp:96
static time_point now() noexcept
Definition: time.cpp:80
std::string toString() const
write as a string
Definition: face-uri.cpp:204
void add(shared_ptr< Face > face)
add a face
Definition: face-table.cpp:58
ProtocolFactory * getFactoryByScheme(const std::string &scheme)
Definition: face-system.cpp:80
entry point of the face system
Definition: face-system.hpp:51
signal::Signal< FaceTable, Face & > beforeRemove
fires before a face is removed
Definition: face-table.hpp:90
represents a Face status change notification
whether congestion detection and marking is enabled on a face
const std::string & getRemoteUri() const
Transport * getTransport() const
Definition: face.hpp:209
FaceEventNotification & setKind(FaceEventKind kind)
std::set< const ProtocolFactory * > listProtocolFactories() const
Definition: face-system.cpp:63
FaceUri getLocalUri() const
Definition: face.hpp:257
FaceUri getRemoteUri() const
Definition: face.hpp:263
LinkService * getLinkService() const
Definition: face.hpp:203
FaceStatus & setNOutBytes(uint64_t nOutBytes)
FaceStatus & setNOutInterests(uint64_t nOutInterests)
ControlParameters & setUri(const std::string &uri)
Face * get(FaceId id) const
get face by FaceId
Definition: face-table.cpp:45
FaceStatus & setExpirationPeriod(time::milliseconds expirationPeriod)
time::steady_clock::TimePoint getExpirationTime() const
Definition: face.hpp:299
provides a tag type for simple types
Definition: tag.hpp:58
FaceStatus & setNInInterests(uint64_t nInInterests)
FacePersistency getFacePersistency() const
FaceStatus & setNInBytes(uint64_t nInBytes)
ndn Face
Definition: face-impl.hpp:42
static ndn::nfd::FaceStatus makeFaceStatus(const Face &face, const time::steady_clock::TimePoint &now)
uint64_t getMtu() const
get MTU (measured in bytes)
size_t wireEncode(EncodingImpl< TAG > &encoder) const
prepend FaceEventNotification to the encoder
static ControlParameters makeCreateFaceResponse(const Face &face)
mgmt::ControlResponse ControlResponse
whether the link reliability feature is enabled on a face
FaceStatus & setNInNacks(uint64_t nInNacks)
ndn::nfd::LinkType getLinkType() const
Definition: face.hpp:287
Copyright (c) 2011-2015 Regents of the University of California.
Definition: ndn-common.hpp:40
FaceManager(FaceSystem &faceSystem, Dispatcher &dispatcher, CommandAuthenticator &authenticator)
ControlParameters & setBaseCongestionMarkingInterval(time::nanoseconds interval)
TransportState FaceState
indicates the state of a face
Definition: face.hpp:54
#define NFD_LOG_TRACE
Definition: logger.hpp:37
bool parse(const std::string &uri)
exception-safe parsing
Definition: face-uri.cpp:63
static void copyMtu(const Face &face, T &to)
FaceStatus & setNOutData(uint64_t nOutData)
const std::string & getLocalUri() const
void end()
end the response successfully after appending zero or more blocks
face went UP (from DOWN state)
uint64_t getDefaultCongestionThreshold() const
get default congestion threshold (measured in bytes)
FaceId getId() const
Definition: face.hpp:233
size_t wireEncode(EncodingImpl< TAG > &encoder) const
prepend FaceStatus to the encoder
Definition: face-status.cpp:53
represents an item in NFD Face dataset
Definition: face-status.hpp:36
ndn::nfd::FaceScope getScope() const
Definition: face.hpp:269
represents the underlying protocol and address used by a Face
Definition: face-uri.hpp:44
static bool matchFilter(const ndn::nfd::FaceQueryFilter &filter, const Face &face)
bool hasFlagBit(size_t bit) const
std::function< void(const ControlResponse &resp)> CommandContinuation
a function to be called after ControlCommandHandler completes
Definition: dispatcher.hpp:95
represents Face Query Filter
const std::string & getUri() const
const std::string & getScheme() const
get scheme (protocol)
Definition: face-uri.hpp:113
#define NFD_LOG_DEBUG
Definition: logger.hpp:38
FaceStatus & setBaseCongestionMarkingInterval(time::nanoseconds interval)
Provides ControlCommand authorization according to NFD configuration file.
ndn::nfd::FacePersistency getPersistency() const
Definition: face.hpp:275
FaceStatus & setNOutNacks(uint64_t nOutNacks)
ControlParameters & setDefaultCongestionThreshold(uint64_t threshold)
set default congestion threshold (measured in bytes)
void append(const Block &block)
append a Block to the response
represents an item in NFD Channel dataset
bool getFlagBit(size_t bit) const
void close()
request the face to be closed
Definition: face.hpp:305
FaceStatus & setNInData(uint64_t nInData)
ndn::mgmt::PostNotification registerNotificationStream(const std::string &verb)
const std::string & getUriScheme() const
provides a context for generating response to a StatusDataset request
FacePersistency getFacePersistency() const
uint64_t FaceId
identifies a face
Definition: face.hpp:39
bool isCanonical() const
determine whether this FaceUri is in canonical form
Definition: face-uri.cpp:636
a collection of common functions shared by all NFD managers, such as communicating with the dispatche...
#define NFD_LOG_INIT(name)
Definition: logger.hpp:31
whether local fields are enabled on a face
void wireDecode(const Block &wire)
decode FaceQueryFilter
void registerStatusDatasetHandler(const std::string &verb, const ndn::mgmt::StatusDatasetHandler &handler)
ControlParameters & setFlagBit(size_t bit, bool value, bool wantMask=true)
set a bit in Flags
const FaceId INVALID_FACEID
indicates an invalid FaceId
Definition: face.hpp:42
implement the Face Management of NFD Management Protocol.
const FaceCounters & getCounters() const
Definition: face.hpp:311
static ControlParameters makeUpdateFaceResponse(const Face &face)
static void copyFaceProperties(const Face &face, T &to)
face went DOWN (from UP state)
FaceStatus & setDefaultCongestionThreshold(uint64_t threshold)
set default congestion threshold (measured in bytes)
const size_t MAX_NDN_PACKET_SIZE
practical limit of network layer packet size
Definition: tlv.hpp:41
size_t wireEncode(EncodingImpl< TAG > &encoder) const
ChannelStatus & setLocalUri(const std::string localUri)