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
47 Name name(DATASET_PREFIX);
49 name.appendSegment(0);
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>();
67 status->setStartTimestamp(m_startTimestamp);
68 status->setCurrentTimestamp(time::system_clock::now());
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
size_t size() const
Get the number of occupied entries in the Name Tree.
const ForwarderCounters & getCounters() const
size_t size() const
returns current size of Content Store measured in packets
Measurements & getMeasurements()
#define NFD_VERSION_BUILD_STRING
NFD version string, including git commit information, if NFD is build from specific git commit...