30 #include "core/logger-factory.hpp" 51 : m_keyChain(keyChain)
59 m_configFile = configFile;
65 m_configSection = config;
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()
140 m_forwarderStatusManager.reset(
new ForwarderStatusManager(*m_forwarder, *m_dispatcher));
141 m_faceManager.reset(
new FaceManager(*m_faceSystem, *m_dispatcher, *m_authenticator));
142 m_fibManager.reset(
new FibManager(m_forwarder->getFib(), m_forwarder->getFaceTable(),
143 *m_dispatcher, *m_authenticator));
144 m_csManager.reset(
new CsManager(m_forwarder->getCs(), m_forwarder->getCounters(),
145 *m_dispatcher, *m_authenticator));
147 *m_dispatcher, *m_authenticator));
152 TablesConfigSection tablesConfig(*m_forwarder);
153 tablesConfig.setConfigFile(config);
155 m_authenticator->setConfigFile(config);
156 m_faceManager->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);
191 m_authenticator->setConfigFile(config);
192 m_faceManager->setConfigFile(config);
194 if (!m_configFile.empty()) {
195 config.
parse(m_configFile,
false);
203 Nfd::reloadConfigFileFaceSection()
207 m_faceManager->setConfigFile(config);
209 if (!m_configFile.empty()) {
210 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.
represents a dispatcher on server side of NFD Management protocol
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
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