28 #include "version.hpp" 32 const Name StatusServer::DATASET_PREFIX =
"ndn:/localhost/nfd/status";
33 const time::milliseconds StatusServer::RESPONSE_FRESHNESS = time::milliseconds(5000);
37 , m_forwarder(forwarder)
38 , m_startTimestamp(
time::system_clock::now())
39 , m_keyChain(keyChain)
41 m_face->setInterestFilter(DATASET_PREFIX, bind(&StatusServer::onInterest,
this, _2));
45 StatusServer::onInterest(
const Interest& interest)
const 51 shared_ptr<Data> data = make_shared<Data>(name);
52 data->setFreshnessPeriod(RESPONSE_FRESHNESS);
54 shared_ptr<ndn::nfd::ForwarderStatus> status = this->collectStatus();
55 data->setContent(status->wireEncode());
57 m_keyChain.sign(*data);
61 shared_ptr<ndn::nfd::ForwarderStatus>
62 StatusServer::collectStatus()
const 64 shared_ptr<ndn::nfd::ForwarderStatus> status = make_shared<ndn::nfd::ForwarderStatus>();
66 status->setNfdVersion(NFD_VERSION_BUILD_STRING);
67 status->setStartTimestamp(m_startTimestamp);
71 status->setNFibEntries(m_forwarder.
getFib().
size());
72 status->setNPitEntries(m_forwarder.
getPit().
size());
74 status->setNCsEntries(m_forwarder.
getCs().size());
StatusServer(shared_ptr< AppFace > face, Forwarder &forwarder, ndn::KeyChain &keyChain)
void copyTo(R &recipient) const
copy current obseverations to a struct
represents an Interest packet
static time_point now() noexcept
size_t size() const
Get the number of occupied entries in the Name Tree.
const ForwarderCounters & getCounters() const
Copyright (c) 2011-2015 Regents of the University of California.
Name & appendSegment(uint64_t segmentNo)
Append segment number (sequential) using NDN naming conventions.
Measurements & getMeasurements()
Name abstraction to represent an absolute name.
Name & appendVersion(uint64_t version)
Append version using NDN naming conventions.