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::configureLogging()
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->addOrUpdateNextHop(*m_internalFace, 0, 0);
173 m_dispatcher->addTopPrefix(topPrefix,
false);
187 m_authenticator->setConfigFile(config);
188 m_faceSystem->setConfigFile(config);
190 if (!m_configFile.empty()) {
191 config.
parse(m_configFile,
false);
199 Nfd::reloadConfigFileFaceSection()
203 m_faceSystem->setConfigFile(config);
205 if (!m_configFile.empty()) {
206 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 absolute or relative path to configFile.
The interface of signing key management.
void setConfigFile(ConfigFile &config)
static const std::string INTERNAL_CONFIG
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)
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.
void addReserved(shared_ptr< Face > face, FaceId faceId)
add a special face with a reserved FaceId
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