29 #include "core/logger-factory.hpp" 43 #include <ndn-cxx/mgmt/dispatcher.hpp> 64 : m_configFile(configFile)
65 , m_keyChain(keyChain)
71 : m_configSection(config)
72 , m_keyChain(keyChain)
91 initializeManagement();
93 FaceTable& faceTable = m_forwarder->getFaceTable();
99 if (m_networkMonitor) {
100 m_networkMonitor->onNetworkStateChanged.connect([
this] {
105 NFD_LOG_INFO(
"Network change detected, reloading face section of the config file...");
106 this->reloadConfigFileFaceSection();
113 Nfd::initializeLogging()
116 LoggerFactory::getInstance().setConfigFile(config);
118 if (!m_configFile.empty()) {
119 config.
parse(m_configFile,
true);
120 config.
parse(m_configFile,
false);
123 config.
parse(m_configSection,
true, INTERNAL_CONFIG);
124 config.
parse(m_configSection,
false, INTERNAL_CONFIG);
135 if (sectionName ==
"rib" || sectionName ==
"log") {
145 Nfd::initializeManagement()
153 m_fibManager.reset(
new FibManager(m_forwarder->getFib(),
158 m_faceManager.reset(
new FaceManager(m_forwarder->getFaceTable(),
172 m_forwarder->getPit(),
173 m_forwarder->getFib(),
174 m_forwarder->getStrategyChoice(),
175 m_forwarder->getMeasurements(),
176 m_forwarder->getNetworkRegionTable());
179 m_validator->setConfigFile(config);
181 m_faceManager->setConfigFile(config);
184 if (!m_configFile.empty()) {
185 config.
parse(m_configFile,
true);
186 config.
parse(m_configFile,
false);
189 config.
parse(m_configSection,
true, INTERNAL_CONFIG);
190 config.
parse(m_configSection,
false, INTERNAL_CONFIG);
193 tablesConfig.ensureTablesAreConfigured();
196 Name topPrefix(
"/localhost/nfd");
197 auto entry = m_forwarder->getFib().insert(topPrefix).first;
198 entry->addNextHop(m_internalFace, 0);
199 m_dispatcher->addTopPrefix(topPrefix,
false);
215 m_forwarder->getPit(),
216 m_forwarder->getFib(),
217 m_forwarder->getStrategyChoice(),
218 m_forwarder->getMeasurements(),
219 m_forwarder->getNetworkRegionTable());
223 m_validator->setConfigFile(config);
224 m_faceManager->setConfigFile(config);
226 if (!m_configFile.empty()) {
227 config.
parse(m_configFile,
false);
230 config.
parse(m_configSection,
false, INTERNAL_CONFIG);
235 Nfd::reloadConfigFileFaceSection()
239 m_faceManager->setConfigFile(config);
241 if (!m_configFile.empty()) {
242 config.
parse(m_configFile,
false);
245 config.
parse(m_configSection,
false, INTERNAL_CONFIG);
shared_ptr< Face > makeNullFace(const FaceUri &uri)
std::tuple< shared_ptr< Face >, shared_ptr< ndn::Face > > makeInternalFace(ndn::KeyChain &clientKeyChain)
make a pair of forwarder-side face and client-side face that are connected with each other ...
Nfd(const std::string &configFile, ndn::KeyChain &keyChain)
Create NFD instance using absolute or relative path to configFile.
Network state change monitor.
represents a dispatcher on server side of NFD Management protocol
static const std::string INTERNAL_CONFIG
represents the underlying protocol and address used by a Face
void setConfigFile(ConfigFile &configFile)
The packet signing interface.
const FaceId FACEID_INTERNAL_FACE
identifies the InternalFace used in management
detail::SimulatorIo & getGlobalIoService()
static void ignoreRibAndLogSections(const std::string &filename, const std::string §ionName, const ConfigSection §ion, bool isDryRun)
implement the Forwarder Status of NFD Management Protocol.
#define NFD_LOG_WARN(expression)
#define NFD_LOG_INFO(expression)
void reloadConfigFile()
Reload configuration file and apply update (if any)
static void throwErrorOnUnknownSection(const std::string &filename, const std::string §ionName, const ConfigSection §ion, bool isDryRun)
Copyright (c) 2011-2015 Regents of the University of California.
boost::property_tree::ptree ConfigSection
Name abstraction to represent an absolute name.
shared_ptr< Face > getFace(FaceId id) const
get existing Face
Provides parsing for tables configuration file section.
void initialize()
Perform initialization of NFD instance After initialization, NFD instance can be started by invoking ...
#define NFD_LOG_INIT(name)
EventId schedule(const time::nanoseconds &after, const Scheduler::Event &event)
schedule an event
static void ignoreUnknownSection(const std::string &filename, const std::string §ionName, const ConfigSection §ion, bool isDryRun)
void addReserved(shared_ptr< Face > face, FaceId faceId)
add a special Face with a reserved FaceId
static ndn::util::NetworkMonitor * makeNetworkMonitor()
const FaceId FACEID_NULL
identifies the NullFace that drops every packet
void parse(const std::string &filename, bool isDryRun)
void setConfigFile(ConfigFile &configFile)
const FaceId FACEID_CONTENT_STORE
identifies a packet comes from the ContentStore