31 #include <ndn-cxx/lp/tags.hpp>    32 #include <ndn-cxx/mgmt/nfd/channel-status.hpp>    41   , m_faceSystem(faceSystem)
    42   , m_faceTable(faceSystem.getFaceTable())
    45   registerCommandHandler<ndn::nfd::FaceCreateCommand>(
"create",
    46     bind(&FaceManager::createFace, 
this, _2, _3, _4, _5));
    48   registerCommandHandler<ndn::nfd::FaceUpdateCommand>(
"update",
    49     bind(&FaceManager::updateFace, 
this, _2, _3, _4, _5));
    51   registerCommandHandler<ndn::nfd::FaceDestroyCommand>(
"destroy",
    52     bind(&FaceManager::destroyFace, 
this, _2, _3, _4, _5));
    62     connectFaceStateChangeSignal(face);
    65   m_faceRemoveConn = m_faceTable.
beforeRemove.connect([
this] (
const Face& face) {
    73   m_faceSystem.setConfigFile(configFile);
    77 FaceManager::createFace(
const Name& topPrefix, 
const Interest& interest,
   104     if (!localUri->isCanonical()) {
   105       NFD_LOG_TRACE(
"received non-canonical local URI: " << localUri->toString());
   112   if (factory == 
nullptr) {
   124       bind(&FaceManager::afterCreateFaceSuccess, 
this, parameters, _1, done),
   125       bind(&FaceManager::afterCreateFaceFailure, 
this, _1, _2, done));
   127   catch (
const std::runtime_error& error) {
   129     done(
ControlResponse(500, 
"Face creation failed due to internal error"));
   132   catch (
const std::logic_error& error) {
   134     done(
ControlResponse(500, 
"Face creation failed due to internal error"));
   141                                     const shared_ptr<Face>& 
face,
   145     NFD_LOG_TRACE(
"Attempted to create duplicate face of " << face->getId());
   148     done(
ControlResponse(409, 
"Face with remote URI already exists").setBody(response.wireEncode()));
   159   m_faceTable.
add(face);
   166 FaceManager::afterCreateFaceFailure(uint32_t status,
   167                                     const std::string& reason,
   176 FaceManager::updateFace(
const Name& topPrefix, 
const Interest& interest,
   184     if (incomingFaceIdTag == 
nullptr) {
   186       done(
ControlResponse(404, 
"No FaceId specified and IncomingFaceId not available"));
   189     faceId = *incomingFaceIdTag;
   192   Face* face = m_faceTable.
get(faceId);
   194   if (face == 
nullptr) {
   202   bool areParamsValid = 
true;
   207     NFD_LOG_TRACE(
"received request to enable local fields on non-local face");
   208     areParamsValid = 
false;
   216     if (!face->getTransport()->canChangePersistencyTo(persistency)) {
   217       NFD_LOG_TRACE(
"cannot change face persistency to " << persistency);
   218       areParamsValid = 
false;
   223   if (!areParamsValid) {
   232   setLinkServiceOptions(*face, parameters);
   235   response = collectFaceProperties(*face, 
false);
   241 FaceManager::destroyFace(
const Name& topPrefix, 
const Interest& interest,
   246   if (face != 
nullptr) {
   254 FaceManager::setLinkServiceOptions(
Face& face,
   258   BOOST_ASSERT(linkService != 
nullptr);
   260   auto options = linkService->getOptions();
   268   linkService->setOptions(options);
   272 FaceManager::collectFaceProperties(
const Face& face, 
bool wantUris)
   275   BOOST_ASSERT(linkService != 
nullptr);
   276   auto options = linkService->getOptions();
   280         .setFacePersistency(face.getPersistency())
   284     params.
setUri(face.getRemoteUri().toString())
   285           .setLocalUri(face.getLocalUri().toString());
   291 FaceManager::listFaces(
const Name& topPrefix, 
const Interest& interest,
   295   for (
const Face& face : m_faceTable) {
   303 FaceManager::listChannels(
const Name& topPrefix, 
const Interest& interest,
   306   std::set<const face::ProtocolFactory*> factories = m_faceSystem.listProtocolFactories();
   307   for (
const auto* factory : factories) {
   308     for (
const auto& channel : factory->getChannels()) {
   318 FaceManager::queryFaces(
const Name& topPrefix, 
const Interest& interest,
   324     faceFilter.
wireDecode(query[-1].blockFromValue());
   332   for (
const Face& face : m_faceTable) {
   333     if (!matchFilter(faceFilter, face)) {
   347       filter.
getFaceId() != 
static_cast<uint64_t
>(face.getId())) {
   352       filter.
getUriScheme() != face.getRemoteUri().getScheme() &&
   353       filter.
getUriScheme() != face.getLocalUri().getScheme()) {
   358       filter.
getRemoteUri() != face.getRemoteUri().toString()) {
   363       filter.
getLocalUri() != face.getLocalUri().toString()) {
   390   collectFaceProperties(face, status);
   393   if (expirationTime != time::steady_clock::TimePoint::max()) {
   395                                         time::duration_cast<time::milliseconds>(expirationTime - now)));
   411 template<
typename FaceTraits>
   413 FaceManager::collectFaceProperties(
const Face& face, FaceTraits& traits)
   416         .setRemoteUri(face.getRemoteUri().toString())
   417         .setLocalUri(face.getLocalUri().toString())
   418         .setFaceScope(face.getScope())
   419         .setFacePersistency(face.getPersistency())
   420         .setLinkType(face.getLinkType());
   424   if (linkService != 
nullptr) {
   425     auto linkServiceOptions = linkService->
getOptions();
   428                       linkServiceOptions.reliabilityOptions.isEnabled);
   437   collectFaceProperties(face, notification);
   439   m_postNotification(notification.
wireEncode());
   443 FaceManager::connectFaceStateChangeSignal(
const Face& face)
   445   FaceId faceId = face.getId();
   446   m_faceStateChangeConn[faceId] = face.afterStateChange.connect(
   448       const Face& face = *m_faceTable.
get(faceId);
   457         m_faceStateChangeConn.erase(faceId);
 const std::string & getUriScheme() const 
 
signal::Signal< FaceTable, Face & > afterAdd
fires after a face is added 
 
void reject(const ControlResponse &resp=ControlResponse().setCode(400))
declare the non-existence of a response 
 
void setConfigFile(ConfigFile &configFile)
Subscribe to face_system section for the config file. 
 
ControlParameters & setFaceId(uint64_t faceId)
 
const Name & getName() const 
 
size_t wireEncode(EncodingImpl< TAG > &encoder) const 
prepend FaceEventNotification to the encoder 
 
GenericLinkService is a LinkService that implements the NDNLPv2 protocol. 
 
const std::string & getLocalUri() const 
 
size_t wireEncode(EncodingImpl< TAG > &encoder) const 
 
represents parameters in a ControlCommand request or response 
 
represents a dispatcher on server side of NFD Management protocol 
 
TransportState
indicates the state of a transport 
 
static time_point now() noexcept
 
configuration file parsing utility 
 
const PacketCounter & nOutNacks
 
boost::posix_time::time_duration milliseconds(long duration)
 
void add(shared_ptr< Face > face)
add a face 
 
size_t wireEncode(EncodingImpl< TAG > &encoder) const 
prepend FaceStatus to the encoder 
 
signal::Signal< FaceTable, Face & > beforeRemove
fires before a face is removed 
 
represents a Face status change notification 
 
represents an Interest packet 
 
#define NFD_LOG_DEBUG(expression)
 
const Options & getOptions() const 
get Options used by GenericLinkService 
 
FaceEventNotification & setKind(FaceEventKind kind)
 
FaceStatus & setNOutBytes(uint64_t nOutBytes)
 
FaceStatus & setNOutInterests(uint64_t nOutInterests)
 
C & setFaceId(uint64_t faceId)
 
ControlParameters & setUri(const std::string &uri)
 
LinkType getLinkType() const 
 
FaceStatus & setExpirationPeriod(time::milliseconds expirationPeriod)
 
provides a tag type for simple types 
 
FaceStatus & setNInInterests(uint64_t nInInterests)
 
bool hasUriScheme() const 
 
FaceStatus & setNInBytes(uint64_t nInBytes)
 
#define NFD_LOG_TRACE(expression)
 
uint64_t getFaceId() const 
 
size_t wireEncode(EncodingImpl< TAG > &encoder) const 
 
#define NFD_LOG_ERROR(expression)
 
Provides support for an underlying protocol. 
 
bool hasFaceScope() const 
 
const std::string & getLocalUri() const 
 
mgmt::ControlResponse ControlResponse
 
controls whether the link reliability feature is enabled on a face 
 
FaceStatus & setNInNacks(uint64_t nInNacks)
 
FacePersistency getFacePersistency() const 
 
Copyright (c) 2011-2015 Regents of the University of California. 
 
FaceManager(FaceSystem &faceSystem, Dispatcher &dispatcher, CommandAuthenticator &authenticator)
 
bool hasFacePersistency() const 
 
bool parse(const std::string &uri)
exception-safe parsing 
 
FaceStatus & setNOutData(uint64_t nOutData)
 
void end()
end the response successfully after appending zero or more blocks 
 
std::string toString() const 
write as a string 
 
the transport is closed, and can be safely deallocated 
 
face went UP (from DOWN state) 
 
const PacketCounter & nOutData
 
const PacketCounter & nInInterests
 
bool getFlagBit(size_t bit) const 
 
represents an item in NFD Face dataset 
 
bool hasRemoteUri() const 
 
Represents an absolute name. 
 
represents the underlying protocol and address used by a Face 
 
const ByteCounter & nOutBytes
 
FacePersistency getFacePersistency() const 
 
std::function< void(const ControlResponse &resp)> CommandContinuation
a function to be called after ControlCommandHandler completes 
 
represents Face Query Filter 
 
virtual void createFace(const CreateFaceParams ¶ms, const FaceCreatedCallback &onCreated, const FaceCreationFailedCallback &onFailure)=0
Try to create face using the supplied parameters. 
 
uint64_t getFaceId() const 
 
const std::string & getRemoteUri() const 
 
bool isCanonical() const 
determine whether this FaceUri is in canonical form 
 
provides ControlCommand authorization according to NFD configuration file 
 
const ByteCounter & nInBytes
 
const std::string & getScheme() const 
get scheme (protocol) 
 
ControlParameters & setFacePersistency(FacePersistency persistency)
 
FaceStatus & setNOutNacks(uint64_t nOutNacks)
 
void append(const Block &block)
append a Block to the response 
 
bool hasFlagBit(size_t bit) const 
 
represents an item in NFD Channel dataset 
 
shared_ptr< T > getTag() const 
get a tag item 
 
FaceStatus & setNInData(uint64_t nInData)
 
ndn::mgmt::PostNotification registerNotificationStream(const std::string &verb)
 
the transport is up and can transmit packets 
 
provides a context for generating response to a StatusDataset request 
 
uint64_t FaceId
identifies a face 
 
a collection of common functions shared by all NFD managers, such as communicating with the dispatche...
 
#define NFD_LOG_INIT(name)
 
controls 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 
 
Face * get(FaceId id) const 
get face by FaceId 
 
const FaceId INVALID_FACEID
indicates an invalid FaceId 
 
const std::string & getUri() const 
 
bool hasFacePersistency() const 
 
const PacketCounter & nOutInterests
 
represents an error in TLV encoding or decoding 
 
gives access to counters provided by Face 
 
face went DOWN (from UP state) 
 
the transport is temporarily down, and is being recovered 
 
const PacketCounter & nInNacks
 
ChannelStatus & setLocalUri(const std::string localUri)
 
const PacketCounter & nInData
 
FaceScope getFaceScope() const