30 #include "core/logger-factory.hpp" 51 : m_keyChain(keyChain)
59 m_configFile = configFile;
65 m_configSection = config;
78 m_forwarder = make_unique<Forwarder>();
80 FaceTable& faceTable = m_forwarder->getFaceTable();
83 m_faceSystem = make_unique<face::FaceSystem>(faceTable, m_netmon);
85 initializeManagement();
89 m_netmon->onNetworkStateChanged.connect([
this] {
94 NFD_LOG_INFO(
"Network change detected, reloading face section of the config file...");
95 this->reloadConfigFileFaceSection();
101 Nfd::initializeLogging()
104 LoggerFactory::getInstance().setConfigFile(config);
106 if (!m_configFile.empty()) {
107 config.parse(m_configFile,
true);
108 config.parse(m_configFile,
false);
122 if (sectionName ==
"rib" || sectionName ==
"log") {
132 Nfd::initializeManagement()
137 m_dispatcher = make_unique<ndn::mgmt::Dispatcher>(*m_internalClientFace, m_keyChain);
140 m_forwarderStatusManager = make_unique<ForwarderStatusManager>(*m_forwarder, *m_dispatcher);
141 m_faceManager = make_unique<FaceManager>(*m_faceSystem, *m_dispatcher, *m_authenticator);
142 m_fibManager = make_unique<FibManager>(m_forwarder->getFib(), m_forwarder->getFaceTable(),
143 *m_dispatcher, *m_authenticator);
144 m_csManager = make_unique<CsManager>(m_forwarder->getCs(), m_forwarder->getCounters(),
145 *m_dispatcher, *m_authenticator);
146 m_strategyChoiceManager = make_unique<StrategyChoiceManager>(m_forwarder->getStrategyChoice(),
147 *m_dispatcher, *m_authenticator);
152 TablesConfigSection tablesConfig(*m_forwarder);
153 tablesConfig.setConfigFile(config);
155 m_authenticator->setConfigFile(config);
156 m_faceSystem->setConfigFile(config);
159 if (!m_configFile.empty()) {
160 config.parse(m_configFile,
true);
161 config.parse(m_configFile,
false);
168 tablesConfig.ensureConfigured();
171 Name topPrefix(
"/localhost/nfd");
172 m_forwarder->getFib().insert(topPrefix).first->addNextHop(*m_internalFace, 0);
173 m_dispatcher->addTopPrefix(topPrefix,
false);
190 m_authenticator->setConfigFile(config);
191 m_faceSystem->setConfigFile(config);
193 if (!m_configFile.empty()) {
194 config.
parse(m_configFile,
false);
202 Nfd::reloadConfigFileFaceSection()
206 m_faceSystem->setConfigFile(config);
208 if (!m_configFile.empty()) {
209 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 ...
Nfd(const std::string &configFile, ndn::KeyChain &keyChain)
Create NFD instance using absolute or relative path to configFile.
The interface of signing key management.
static const std::string INTERNAL_CONFIG
void setConfigFile(ConfigFile &configFile)
configuration file parsing utility
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)
#define NFD_LOG_INFO(expression)
void reloadConfigFile()
Reload configuration file and apply update (if any)
Class representing NFD instance This class can be used to initialize all components of NFD...
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 the underlying protocol and address used by a Face
handles 'tables' config section
void initialize()
Perform initialization of NFD instance After initialization, NFD instance can be started by invoking ...
static shared_ptr< CommandAuthenticator > create()
static void ignoreUnknownSection(const std::string &filename, const std::string §ionName, const ConfigSection §ion, bool isDryRun)
EventId schedule(time::nanoseconds after, const EventCallback &event)
Schedule an event.
const FaceId FACEID_NULL
identifies the NullFace that drops every packet
void parse(const std::string &filename, bool isDryRun)
#define NFD_LOG_INIT(name)
void setConfigFile(ConfigFile &configFile)
const FaceId FACEID_CONTENT_STORE
identifies a packet comes from the ContentStore