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-2020, 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 "common/logger.hpp"
31 #include "fw/face-table.hpp"
32 
33 #include <ndn-cxx/lp/tags.hpp>
34 #include <ndn-cxx/mgmt/nfd/channel-status.hpp>
35 #include <ndn-cxx/mgmt/nfd/face-event-notification.hpp>
36 #include <ndn-cxx/mgmt/nfd/face-query-filter.hpp>
37 #include <ndn-cxx/mgmt/nfd/face-status.hpp>
38 
39 namespace nfd {
40 
41 NFD_LOG_INIT(FaceManager);
42 
44  Dispatcher& dispatcher, CommandAuthenticator& authenticator)
45  : ManagerBase("faces", dispatcher, authenticator)
46  , m_faceSystem(faceSystem)
47  , m_faceTable(faceSystem.getFaceTable())
48 {
49  // register handlers for ControlCommand
50  registerCommandHandler<ndn::nfd::FaceCreateCommand>("create", bind(&FaceManager::createFace, this, _4, _5));
51  registerCommandHandler<ndn::nfd::FaceUpdateCommand>("update", bind(&FaceManager::updateFace, this, _3, _4, _5));
52  registerCommandHandler<ndn::nfd::FaceDestroyCommand>("destroy", bind(&FaceManager::destroyFace, this, _4, _5));
53 
54  // register handlers for StatusDataset
55  registerStatusDatasetHandler("list", bind(&FaceManager::listFaces, this, _3));
56  registerStatusDatasetHandler("channels", bind(&FaceManager::listChannels, this, _3));
57  registerStatusDatasetHandler("query", bind(&FaceManager::queryFaces, this, _2, _3));
58 
59  // register notification stream
60  m_postNotification = registerNotificationStream("events");
61  m_faceAddConn = m_faceTable.afterAdd.connect([this] (const Face& face) {
62  connectFaceStateChangeSignal(face);
63  notifyFaceEvent(face, ndn::nfd::FACE_EVENT_CREATED);
64  });
65  m_faceRemoveConn = m_faceTable.beforeRemove.connect([this] (const Face& face) {
66  notifyFaceEvent(face, ndn::nfd::FACE_EVENT_DESTROYED);
67  });
68 }
69 
70 void
71 FaceManager::createFace(const ControlParameters& parameters,
72  const ndn::mgmt::CommandContinuation& done)
73 {
74  FaceUri remoteUri;
75  if (!remoteUri.parse(parameters.getUri())) {
76  NFD_LOG_TRACE("failed to parse remote URI: " << parameters.getUri());
77  done(ControlResponse(400, "Malformed command"));
78  return;
79  }
80 
81  if (!remoteUri.isCanonical()) {
82  NFD_LOG_TRACE("received non-canonical remote URI: " << remoteUri.toString());
83  done(ControlResponse(400, "Non-canonical remote URI"));
84  return;
85  }
86 
87  optional<FaceUri> localUri;
88  if (parameters.hasLocalUri()) {
89  localUri = FaceUri{};
90 
91  if (!localUri->parse(parameters.getLocalUri())) {
92  NFD_LOG_TRACE("failed to parse local URI: " << parameters.getLocalUri());
93  done(ControlResponse(400, "Malformed command"));
94  return;
95  }
96 
97  if (!localUri->isCanonical()) {
98  NFD_LOG_TRACE("received non-canonical local URI: " << localUri->toString());
99  done(ControlResponse(400, "Non-canonical local URI"));
100  return;
101  }
102  }
103 
104  face::ProtocolFactory* factory = m_faceSystem.getFactoryByScheme(remoteUri.getScheme());
105  if (factory == nullptr) {
106  NFD_LOG_TRACE("received create request for unsupported protocol: " << remoteUri.getScheme());
107  done(ControlResponse(406, "Unsupported protocol"));
108  return;
109  }
110 
111  face::FaceParams faceParams;
112  faceParams.persistency = parameters.getFacePersistency();
113  if (parameters.hasBaseCongestionMarkingInterval()) {
114  faceParams.baseCongestionMarkingInterval = parameters.getBaseCongestionMarkingInterval();
115  }
116  if (parameters.hasDefaultCongestionThreshold()) {
117  faceParams.defaultCongestionThreshold = parameters.getDefaultCongestionThreshold();
118  }
119  if (parameters.hasMtu()) {
120  // The face system limits MTUs to ssize_t, but the management protocol uses uint64_t
121  faceParams.mtu = std::min<uint64_t>(std::numeric_limits<ssize_t>::max(), parameters.getMtu());
122  }
123  faceParams.wantLocalFields = parameters.hasFlagBit(ndn::nfd::BIT_LOCAL_FIELDS_ENABLED) &&
124  parameters.getFlagBit(ndn::nfd::BIT_LOCAL_FIELDS_ENABLED);
125  faceParams.wantLpReliability = parameters.hasFlagBit(ndn::nfd::BIT_LP_RELIABILITY_ENABLED) &&
126  parameters.getFlagBit(ndn::nfd::BIT_LP_RELIABILITY_ENABLED);
127  if (parameters.hasFlagBit(ndn::nfd::BIT_CONGESTION_MARKING_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  if (face.getMtu() >= 0) {
157  to.setMtu(std::min<size_t>(face.getMtu(), ndn::MAX_NDN_PACKET_SIZE));
158  }
159  else if (face.getMtu() == face::MTU_UNLIMITED) {
160  to.setMtu(ndn::MAX_NDN_PACKET_SIZE);
161  }
162 }
163 
164 static ControlParameters
166 {
167  ControlParameters params;
168  params.setFaceId(face.getId())
169  .setFacePersistency(face.getPersistency());
170  copyMtu(face, params);
171 
172  auto linkService = dynamic_cast<face::GenericLinkService*>(face.getLinkService());
173  if (linkService != nullptr) {
174  const auto& options = linkService->getOptions();
175  params.setBaseCongestionMarkingInterval(options.baseCongestionMarkingInterval)
176  .setDefaultCongestionThreshold(options.defaultCongestionThreshold)
177  .setFlagBit(ndn::nfd::BIT_LOCAL_FIELDS_ENABLED, options.allowLocalFields, false)
178  .setFlagBit(ndn::nfd::BIT_LP_RELIABILITY_ENABLED, options.reliabilityOptions.isEnabled, false)
179  .setFlagBit(ndn::nfd::BIT_CONGESTION_MARKING_ENABLED, options.allowCongestionMarking, false);
180  }
181 
182  return params;
183 }
184 
185 static ControlParameters
187 {
188  ControlParameters params = makeUpdateFaceResponse(face);
189  params.setUri(face.getRemoteUri().toString())
190  .setLocalUri(face.getLocalUri().toString());
191 
192  return params;
193 }
194 
195 void
196 FaceManager::afterCreateFaceSuccess(const shared_ptr<Face>& face,
197  const ControlParameters& parameters,
198  const ndn::mgmt::CommandContinuation& done)
199 {
200  if (face->getId() != face::INVALID_FACEID) { // Face already exists
201  NFD_LOG_TRACE("Attempted to create duplicate face of " << face->getId());
202  ControlParameters response = makeCreateFaceResponse(*face);
203  done(ControlResponse(409, "Face with remote URI already exists").setBody(response.wireEncode()));
204  return;
205  }
206 
207  // If scope non-local and flags set to enable local fields, request shouldn't
208  // have made it this far
209  BOOST_ASSERT(face->getScope() == ndn::nfd::FACE_SCOPE_LOCAL ||
210  !parameters.hasFlagBit(ndn::nfd::BIT_LOCAL_FIELDS_ENABLED) ||
211  (parameters.hasFlagBit(ndn::nfd::BIT_LOCAL_FIELDS_ENABLED) &&
212  !parameters.getFlagBit(ndn::nfd::BIT_LOCAL_FIELDS_ENABLED)));
213 
214  m_faceTable.add(face);
215 
216  ControlParameters response = makeCreateFaceResponse(*face);
217  done(ControlResponse(200, "OK").setBody(response.wireEncode()));
218 }
219 
220 static void
221 updateLinkServiceOptions(Face& face, const ControlParameters& parameters)
222 {
223  auto linkService = dynamic_cast<face::GenericLinkService*>(face.getLinkService());
224  if (linkService == nullptr) {
225  return;
226  }
227  auto options = linkService->getOptions();
228 
229  if (parameters.hasFlagBit(ndn::nfd::BIT_LOCAL_FIELDS_ENABLED) &&
230  face.getScope() == ndn::nfd::FACE_SCOPE_LOCAL) {
231  options.allowLocalFields = parameters.getFlagBit(ndn::nfd::BIT_LOCAL_FIELDS_ENABLED);
232  }
233  if (parameters.hasFlagBit(ndn::nfd::BIT_LP_RELIABILITY_ENABLED)) {
234  options.reliabilityOptions.isEnabled = parameters.getFlagBit(ndn::nfd::BIT_LP_RELIABILITY_ENABLED);
235  }
236  if (parameters.hasFlagBit(ndn::nfd::BIT_CONGESTION_MARKING_ENABLED)) {
237  options.allowCongestionMarking = parameters.getFlagBit(ndn::nfd::BIT_CONGESTION_MARKING_ENABLED);
238  }
239  if (parameters.hasBaseCongestionMarkingInterval()) {
240  options.baseCongestionMarkingInterval = parameters.getBaseCongestionMarkingInterval();
241  }
242  if (parameters.hasDefaultCongestionThreshold()) {
243  options.defaultCongestionThreshold = parameters.getDefaultCongestionThreshold();
244  }
245 
246  if (parameters.hasMtu()) {
247  // The face system limits MTUs to ssize_t, but the management protocol uses uint64_t
248  options.overrideMtu = std::min<uint64_t>(std::numeric_limits<ssize_t>::max(), parameters.getMtu());
249  }
250 
251  linkService->setOptions(options);
252 }
253 
254 void
255 FaceManager::updateFace(const Interest& interest,
256  const ControlParameters& parameters,
257  const ndn::mgmt::CommandContinuation& done)
258 {
259  FaceId faceId = parameters.getFaceId();
260  if (faceId == 0) { // Self-update
261  auto incomingFaceIdTag = interest.getTag<lp::IncomingFaceIdTag>();
262  if (incomingFaceIdTag == nullptr) {
263  NFD_LOG_TRACE("unable to determine face for self-update");
264  done(ControlResponse(404, "No FaceId specified and IncomingFaceId not available"));
265  return;
266  }
267  faceId = *incomingFaceIdTag;
268  }
269 
270  Face* face = m_faceTable.get(faceId);
271  if (face == nullptr) {
272  NFD_LOG_TRACE("invalid face specified");
273  done(ControlResponse(404, "Specified face does not exist"));
274  return;
275  }
276 
277  // Verify validity of requested changes
278  ControlParameters response;
279  bool areParamsValid = true;
280 
281  if (parameters.hasFlagBit(ndn::nfd::BIT_LOCAL_FIELDS_ENABLED) &&
282  parameters.getFlagBit(ndn::nfd::BIT_LOCAL_FIELDS_ENABLED) &&
283  face->getScope() != ndn::nfd::FACE_SCOPE_LOCAL) {
284  NFD_LOG_TRACE("received request to enable local fields on non-local face");
285  areParamsValid = false;
286  response.setFlagBit(ndn::nfd::BIT_LOCAL_FIELDS_ENABLED,
287  parameters.getFlagBit(ndn::nfd::BIT_LOCAL_FIELDS_ENABLED));
288  }
289 
290  // check whether the requested FacePersistency change is valid if it's present
291  if (parameters.hasFacePersistency()) {
292  auto persistency = parameters.getFacePersistency();
293  if (!face->getTransport()->canChangePersistencyTo(persistency)) {
294  NFD_LOG_TRACE("cannot change face persistency to " << persistency);
295  areParamsValid = false;
296  response.setFacePersistency(persistency);
297  }
298  }
299 
300  // check whether the requested MTU override is valid (if it's present)
301  if (parameters.hasMtu()) {
302  auto mtu = parameters.getMtu();
303  // The face system limits MTUs to ssize_t, but the management protocol uses uint64_t
304  auto actualMtu = std::min<uint64_t>(std::numeric_limits<ssize_t>::max(), mtu);
305  auto linkService = dynamic_cast<face::GenericLinkService*>(face->getLinkService());
306  if (linkService == nullptr || !linkService->canOverrideMtuTo(actualMtu)) {
307  NFD_LOG_TRACE("cannot override face MTU to " << mtu);
308  areParamsValid = false;
309  response.setMtu(mtu);
310  }
311  }
312 
313  if (!areParamsValid) {
314  done(ControlResponse(409, "Invalid properties specified").setBody(response.wireEncode()));
315  return;
316  }
317 
318  // All specified properties are valid, so make changes
319  if (parameters.hasFacePersistency()) {
320  face->setPersistency(parameters.getFacePersistency());
321  }
322  updateLinkServiceOptions(*face, parameters);
323 
324  // Prepare and send ControlResponse
325  response = makeUpdateFaceResponse(*face);
326  done(ControlResponse(200, "OK").setBody(response.wireEncode()));
327 }
328 
329 void
330 FaceManager::destroyFace(const ControlParameters& parameters,
331  const ndn::mgmt::CommandContinuation& done)
332 {
333  Face* face = m_faceTable.get(parameters.getFaceId());
334  if (face != nullptr) {
335  face->close();
336  }
337 
338  done(ControlResponse(200, "OK").setBody(parameters.wireEncode()));
339 }
340 
341 template<typename T>
342 static void
343 copyFaceProperties(const Face& face, T& to)
344 {
345  to.setFaceId(face.getId())
346  .setRemoteUri(face.getRemoteUri().toString())
347  .setLocalUri(face.getLocalUri().toString())
348  .setFaceScope(face.getScope())
349  .setFacePersistency(face.getPersistency())
350  .setLinkType(face.getLinkType());
351 
352  auto linkService = dynamic_cast<face::GenericLinkService*>(face.getLinkService());
353  if (linkService != nullptr) {
354  const auto& options = linkService->getOptions();
355  to.setFlagBit(ndn::nfd::BIT_LOCAL_FIELDS_ENABLED, options.allowLocalFields)
356  .setFlagBit(ndn::nfd::BIT_LP_RELIABILITY_ENABLED, options.reliabilityOptions.isEnabled)
357  .setFlagBit(ndn::nfd::BIT_CONGESTION_MARKING_ENABLED, options.allowCongestionMarking);
358  }
359 }
360 
361 static ndn::nfd::FaceStatus
362 makeFaceStatus(const Face& face, const time::steady_clock::TimePoint& now)
363 {
364  ndn::nfd::FaceStatus status;
365  copyFaceProperties(face, status);
366 
367  auto expirationTime = face.getExpirationTime();
368  if (expirationTime != time::steady_clock::TimePoint::max()) {
369  status.setExpirationPeriod(std::max(0_ms,
370  time::duration_cast<time::milliseconds>(expirationTime - now)));
371  }
372 
373  auto linkService = dynamic_cast<face::GenericLinkService*>(face.getLinkService());
374  if (linkService != nullptr) {
375  const auto& options = linkService->getOptions();
376  status.setBaseCongestionMarkingInterval(options.baseCongestionMarkingInterval)
377  .setDefaultCongestionThreshold(options.defaultCongestionThreshold);
378  }
379 
380  copyMtu(face, status);
381 
382  const auto& counters = face.getCounters();
383  status.setNInInterests(counters.nInInterests)
384  .setNOutInterests(counters.nOutInterests)
385  .setNInData(counters.nInData)
386  .setNOutData(counters.nOutData)
387  .setNInNacks(counters.nInNacks)
388  .setNOutNacks(counters.nOutNacks)
389  .setNInBytes(counters.nInBytes)
390  .setNOutBytes(counters.nOutBytes);
391 
392  return status;
393 }
394 
395 void
396 FaceManager::listFaces(ndn::mgmt::StatusDatasetContext& context)
397 {
398  auto now = time::steady_clock::now();
399  for (const auto& face : m_faceTable) {
400  ndn::nfd::FaceStatus status = makeFaceStatus(face, now);
401  context.append(status.wireEncode());
402  }
403  context.end();
404 }
405 
406 void
407 FaceManager::listChannels(ndn::mgmt::StatusDatasetContext& context)
408 {
409  auto factories = m_faceSystem.listProtocolFactories();
410  for (const auto* factory : factories) {
411  for (const auto& channel : factory->getChannels()) {
412  ndn::nfd::ChannelStatus entry;
413  entry.setLocalUri(channel->getUri().toString());
414  context.append(entry.wireEncode());
415  }
416  }
417  context.end();
418 }
419 
420 static bool
421 matchFilter(const ndn::nfd::FaceQueryFilter& filter, const Face& face)
422 {
423  if (filter.hasFaceId() &&
424  filter.getFaceId() != static_cast<uint64_t>(face.getId())) {
425  return false;
426  }
427 
428  if (filter.hasUriScheme() &&
429  filter.getUriScheme() != face.getRemoteUri().getScheme() &&
430  filter.getUriScheme() != face.getLocalUri().getScheme()) {
431  return false;
432  }
433 
434  if (filter.hasRemoteUri() &&
435  filter.getRemoteUri() != face.getRemoteUri().toString()) {
436  return false;
437  }
438 
439  if (filter.hasLocalUri() &&
440  filter.getLocalUri() != face.getLocalUri().toString()) {
441  return false;
442  }
443 
444  if (filter.hasFaceScope() &&
445  filter.getFaceScope() != face.getScope()) {
446  return false;
447  }
448 
449  if (filter.hasFacePersistency() &&
450  filter.getFacePersistency() != face.getPersistency()) {
451  return false;
452  }
453 
454  if (filter.hasLinkType() &&
455  filter.getLinkType() != face.getLinkType()) {
456  return false;
457  }
458 
459  return true;
460 }
461 
462 void
463 FaceManager::queryFaces(const Interest& interest,
464  ndn::mgmt::StatusDatasetContext& context)
465 {
466  ndn::nfd::FaceQueryFilter faceFilter;
467  try {
468  faceFilter.wireDecode(interest.getName()[-1].blockFromValue());
469  }
470  catch (const tlv::Error& e) {
471  NFD_LOG_DEBUG("Malformed query filter: " << e.what());
472  return context.reject(ControlResponse(400, "Malformed filter"));
473  }
474 
475  auto now = time::steady_clock::now();
476  for (const auto& face : m_faceTable) {
477  if (matchFilter(faceFilter, face)) {
478  ndn::nfd::FaceStatus status = makeFaceStatus(face, now);
479  context.append(status.wireEncode());
480  }
481  }
482  context.end();
483 }
484 
485 void
486 FaceManager::notifyFaceEvent(const Face& face, ndn::nfd::FaceEventKind kind)
487 {
488  ndn::nfd::FaceEventNotification notification;
489  notification.setKind(kind);
490  copyFaceProperties(face, notification);
491 
492  m_postNotification(notification.wireEncode());
493 }
494 
495 void
496 FaceManager::connectFaceStateChangeSignal(const Face& face)
497 {
498  using face::FaceState;
499 
500  FaceId faceId = face.getId();
501  m_faceStateChangeConn[faceId] = face.afterStateChange.connect(
502  [this, faceId, &face] (FaceState oldState, FaceState newState) {
503  if (newState == FaceState::UP) {
504  notifyFaceEvent(face, ndn::nfd::FACE_EVENT_UP);
505  }
506  else if (newState == FaceState::DOWN) {
507  notifyFaceEvent(face, ndn::nfd::FACE_EVENT_DOWN);
508  }
509  else if (newState == FaceState::CLOSED) {
510  // cannot use face.getId() because it may already be reset to INVALID_FACEID
511  m_faceStateChangeConn.erase(faceId);
512  }
513  });
514 }
515 
516 } // namespace nfd
FaceUri getRemoteUri() const
Definition: face.hpp:257
void registerStatusDatasetHandler(const std::string &verb, const ndn::mgmt::StatusDatasetHandler &handler)
const FaceCounters & getCounters() const
Definition: face.hpp:305
static void updateLinkServiceOptions(Face &face, const ControlParameters &parameters)
const ssize_t MTU_UNLIMITED
indicates the transport has no limit on payload size
Definition: transport.hpp:91
void setPersistency(ndn::nfd::FacePersistency persistency)
changes face persistency setting
Definition: face.hpp:275
#define NFD_LOG_ERROR
Definition: logger.hpp:41
ProtocolFactory * getFactoryByScheme(const std::string &scheme)
Definition: face-system.cpp:82
#define NFD_LOG_TRACE
Definition: logger.hpp:37
bool canChangePersistencyTo(ndn::nfd::FacePersistency newPersistency) const
check whether the face persistency can be changed to newPersistency
Definition: transport.cpp:142
boost::logic::tribool wantCongestionMarking
Definition: face-common.hpp:86
optional< uint64_t > defaultCongestionThreshold
Definition: face-common.hpp:82
ndn::nfd::FacePersistency getPersistency() const
Definition: face.hpp:269
Face * get(FaceId id) const
get face by FaceId
Definition: face-table.cpp:45
signal::Signal< FaceTable, Face > afterAdd
Fires immediately after a face is added.
Definition: face-table.hpp:85
ndn::nfd::LinkType getLinkType() const
Definition: face.hpp:281
ndn::nfd::FaceScope getScope() const
Definition: face.hpp:263
FaceManager(FaceSystem &faceSystem, Dispatcher &dispatcher, CommandAuthenticator &authenticator)
std::set< const ProtocolFactory * > listProtocolFactories() const
Definition: face-system.cpp:65
Parameters used to set Transport properties or LinkService options on a newly created face...
Definition: face-common.hpp:78
void close()
Request that the face be closed.
Definition: face.hpp:215
Transport * getTransport() const
Definition: face.hpp:209
Provides ControlCommand authorization according to NFD configuration file.
A collection of common functions shared by all NFD managers, such as communicating with the dispatche...
static ndn::nfd::FaceStatus makeFaceStatus(const Face &face, const time::steady_clock::TimePoint &now)
void createFace(const CreateFaceRequest &req, const FaceCreatedCallback &onCreated, const FaceCreationFailedCallback &onFailure)
Create a unicast face.
optional< time::nanoseconds > baseCongestionMarkingInterval
Definition: face-common.hpp:81
static ControlParameters makeCreateFaceResponse(const Face &face)
signal::Signal< FaceTable, Face > beforeRemove
Fires immediately before a face is removed.
Definition: face-table.hpp:91
void add(shared_ptr< Face > face)
add a face
Definition: face-table.cpp:58
Copyright (c) 2014-2015, Regents of the University of California, Arizona Board of Regents...
Definition: algorithm.hpp:32
TransportState FaceState
indicates the state of a face
Definition: face.hpp:37
static void copyMtu(const Face &face, T &to)
FaceUri getLocalUri() const
Definition: face.hpp:251
ndn::mgmt::PostNotification registerNotificationStream(const std::string &verb)
optional< ssize_t > mtu
Definition: face-common.hpp:83
generalization of a network interface
Definition: face.hpp:54
static bool matchFilter(const ndn::nfd::FaceQueryFilter &filter, const Face &face)
LinkService * getLinkService() const
Definition: face.hpp:203
FaceId getId() const
Definition: face.hpp:239
ndn::nfd::FacePersistency persistency
Definition: face-common.hpp:80
Provides support for an underlying protocol.
#define NFD_LOG_DEBUG
Definition: logger.hpp:38
#define NFD_LOG_INIT(name)
Definition: logger.hpp:31
entry point of the face system
Definition: face-system.hpp:51
signal::Signal< Transport, FaceState, FaceState > & afterStateChange
signals after face state changed
Definition: face.hpp:165
uint64_t FaceId
Identifies a face.
Definition: face-common.hpp:44
ssize_t getMtu() const
Returns face effective MTU.
Definition: face.hpp:287
const FaceId INVALID_FACEID
indicates an invalid FaceId
Definition: face-common.hpp:47
static ControlParameters makeUpdateFaceResponse(const Face &face)
static void copyFaceProperties(const Face &face, T &to)
time::steady_clock::TimePoint getExpirationTime() const
Definition: face.hpp:299