28 #include "core/version.hpp" 35 : m_forwarder(forwarder)
36 , m_dispatcher(dispatcher)
37 , m_startTimestamp(time::system_clock::now())
39 m_dispatcher.addStatusDataset(
"status/general", ndn::mgmt::makeAcceptAllAuthorization(),
40 bind(&ForwarderStatusManager::listGeneralStatus,
this, _1, _2, _3));
43 ndn::nfd::ForwarderStatus
44 ForwarderStatusManager::collectGeneralStatus()
46 ndn::nfd::ForwarderStatus status;
48 status.setNfdVersion(NFD_VERSION_BUILD_STRING);
49 status.setStartTimestamp(m_startTimestamp);
50 status.setCurrentTimestamp(time::system_clock::now());
52 status.setNNameTreeEntries(m_forwarder.
getNameTree().size());
53 status.setNFibEntries(m_forwarder.
getFib().size());
54 status.setNPitEntries(m_forwarder.
getPit().size());
56 status.setNCsEntries(m_forwarder.
getCs().size());
70 ForwarderStatusManager::listGeneralStatus(
const Name& topPrefix,
const Interest& interest,
71 ndn::mgmt::StatusDatasetContext& context)
75 auto status = this->collectGeneralStatus();
76 const Block& wire = status.wireEncode();
78 for (
const auto& subblock : wire.elements()) {
79 context.append(subblock);
static const time::milliseconds STATUS_FRESHNESS(5000)
PacketCounter nInInterests
PacketCounter nOutInterests
ForwarderStatusManager(Forwarder &forwarder, Dispatcher &dispatcher)
Copyright (c) 2014-2015, Regents of the University of California, Arizona Board of Regents...
counters provided by Forwarder
const ForwarderCounters & getCounters() const
Measurements & getMeasurements()