51 : m_keyChain(keyChain)
56 Nfd::Nfd(
const std::string& configFile, ndn::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);
111 config.
parse(m_configSection,
true, INTERNAL_CONFIG);
112 config.
parse(m_configSection,
false, INTERNAL_CONFIG);
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);
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);
164 config.parse(m_configSection,
true, INTERNAL_CONFIG);
165 config.parse(m_configSection,
false, INTERNAL_CONFIG);
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);
194 config.
parse(m_configSection,
false, INTERNAL_CONFIG);
199 Nfd::reloadConfigFileFaceSection()
203 m_faceSystem->setConfigFile(config);
205 if (!m_configFile.empty()) {
206 config.
parse(m_configFile,
false);
209 config.
parse(m_configSection,
false, INTERNAL_CONFIG);
Copyright (c) 2014-2017, Regents of the University of California, Arizona Board of Regents...
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)
configuration file parsing utility
void setConfigFile(ConfigFile &config)
static const std::string INTERNAL_CONFIG
const FaceId FACEID_INTERNAL_FACE
identifies the InternalFace used in management
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)
boost::property_tree::ptree ConfigSection
a config file section
Copyright (c) 2014-2015, Regents of the University of California, Arizona Board of Regents...
void ensureConfigured()
apply default configuration, if tables section was omitted in configuration file
void parse(const std::string &filename, bool isDryRun)
Nfd(const std::string &configFile, ndn::KeyChain &keyChain)
Create NFD instance using absolute or relative path to configFile.
void setConfigFile(ConfigFile &configFile)
static shared_ptr< CommandAuthenticator > create()
void initialize()
Perform initialization of NFD instance After initialization, NFD instance can be started by invoking ...
static void throwErrorOnUnknownSection(const std::string &filename, const std::string §ionName, const ConfigSection §ion, bool isDryRun)
handles 'tables' config section
#define NFD_LOG_INIT(name)
EventId schedule(time::nanoseconds after, const EventCallback &event)
Schedule an event.
Class representing NFD instance This class can be used to initialize all components of NFD...
const FaceId FACEID_NULL
identifies the NullFace that drops every packet
const FaceId FACEID_CONTENT_STORE
identifies a packet comes from the ContentStore
static void ignoreUnknownSection(const std::string &filename, const std::string §ionName, const ConfigSection §ion, bool isDryRun)
boost::asio::io_service & getGlobalIoService()