51 : m_keyChain(keyChain)
61 m_configFile = configFile;
67 m_configSection = config;
80 m_faceTable = make_unique<FaceTable>();
84 m_faceSystem = make_unique<face::FaceSystem>(*m_faceTable, m_netmon);
85 m_forwarder = make_unique<Forwarder>(*m_faceTable);
87 initializeManagement();
91 m_netmon->onNetworkStateChanged.connect([
this] {
94 m_reloadConfigEvent =
getScheduler().schedule(5_s, [
this] {
95 NFD_LOG_INFO(
"Network change detected, reloading face section of the config file...");
96 reloadConfigFileFaceSection();
102 Nfd::configureLogging()
107 if (!m_configFile.empty()) {
108 config.
parse(m_configFile,
true);
109 config.
parse(m_configFile,
false);
123 if (sectionName ==
"rib" || sectionName ==
"log") {
133 Nfd::initializeManagement()
138 m_dispatcher = make_unique<ndn::mgmt::Dispatcher>(*m_internalClientFace, m_keyChain);
141 m_forwarderStatusManager = make_unique<ForwarderStatusManager>(*m_forwarder, *m_dispatcher);
142 m_faceManager = make_unique<FaceManager>(*m_faceSystem, *m_dispatcher, *m_authenticator);
143 m_fibManager = make_unique<FibManager>(m_forwarder->getFib(), *m_faceTable,
144 *m_dispatcher, *m_authenticator);
145 m_csManager = make_unique<CsManager>(m_forwarder->getCs(), m_forwarder->getCounters(),
146 *m_dispatcher, *m_authenticator);
147 m_strategyChoiceManager = make_unique<StrategyChoiceManager>(m_forwarder->getStrategyChoice(),
148 *m_dispatcher, *m_authenticator);
153 m_forwarder->setConfigFile(config);
158 m_authenticator->setConfigFile(config);
159 m_faceSystem->setConfigFile(config);
162 if (!m_configFile.empty()) {
163 config.parse(m_configFile,
true);
164 config.parse(m_configFile,
false);
174 Name topPrefix(
"/localhost/nfd");
175 fib::Entry* entry = m_forwarder->getFib().insert(topPrefix).first;
176 m_forwarder->getFib().addOrUpdateNextHop(*entry, *m_internalFace, 0);
177 m_dispatcher->addTopPrefix(topPrefix,
false);
188 m_forwarder->setConfigFile(config);
193 m_authenticator->setConfigFile(config);
194 m_faceSystem->setConfigFile(config);
196 if (!m_configFile.empty()) {
197 config.
parse(m_configFile,
false);
205 Nfd::reloadConfigFileFaceSection()
209 m_faceSystem->setConfigFile(config);
211 if (!m_configFile.empty()) {
212 config.
parse(m_configFile,
false);
Copyright (c) 2011-2015 Regents of the University of California.
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 ...
void setConfigFile(ConfigFile &config)
Nfd(const std::string &configFile, ndn::KeyChain &keyChain)
Create NFD instance using an absolute or relative path to a configuration file.
#define NFD_LOG_INIT(name)
void setConfigFile(ConfigFile &config)
configuration file parsing utility
const FaceId FACEID_INTERNAL_FACE
identifies the InternalFace used in management
detail::SimulatorIo & getGlobalIoService()
Returns the global io_service instance for the calling thread.
void ensureConfigured()
apply default configuration, if tables section was omitted in configuration file
static void ignoreRibAndLogSections(const std::string &filename, const std::string §ionName, const ConfigSection §ion, bool isDryRun)
Scheduler & getScheduler()
Returns the global Scheduler instance for the calling thread.
const std::string INTERNAL_CONFIG("internal://nfd.conf")
void reloadConfigFile()
Reload configuration file and apply updates (if any).
Class representing the NFD instance.
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
a config file section
Represents an absolute name.
represents the underlying protocol and address used by a Face
static void setAutoCheckParametersDigest(bool b)
handles 'tables' config section
void initialize()
Perform initialization of NFD instance.
static shared_ptr< CommandAuthenticator > create()
static void ignoreUnknownSection(const std::string &filename, const std::string §ionName, const ConfigSection §ion, bool isDryRun)
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