29 #include "core/logger-factory.hpp" 61 : m_configFile(configFile)
62 , m_keyChain(keyChain)
68 : m_configSection(config)
69 , m_keyChain(keyChain)
86 initializeManagement();
88 FaceTable& faceTable = m_forwarder->getFaceTable();
94 if (m_networkMonitor) {
95 m_networkMonitor->onNetworkStateChanged.connect([
this] {
100 NFD_LOG_INFO(
"Network change detected, reloading face section of the config file...");
101 this->reloadConfigFileFaceSection();
108 Nfd::initializeLogging()
111 LoggerFactory::getInstance().setConfigFile(config);
113 if (!m_configFile.empty()) {
114 config.
parse(m_configFile,
true);
115 config.
parse(m_configFile,
false);
118 config.
parse(m_configSection,
true, INTERNAL_CONFIG);
119 config.
parse(m_configSection,
false, INTERNAL_CONFIG);
129 if (sectionName ==
"rib" || sectionName ==
"log") {
139 Nfd::initializeManagement()
148 m_faceManager.reset(
new FaceManager(m_forwarder->getFaceTable(),
149 *m_dispatcher, *m_authenticator));
150 m_fibManager.reset(
new FibManager(m_forwarder->getFib(), m_forwarder->getFaceTable(),
151 *m_dispatcher, *m_authenticator));
153 *m_dispatcher, *m_authenticator));
161 m_authenticator->setConfigFile(config);
162 m_faceManager->setConfigFile(config);
165 if (!m_configFile.empty()) {
166 config.
parse(m_configFile,
true);
167 config.
parse(m_configFile,
false);
170 config.
parse(m_configSection,
true, INTERNAL_CONFIG);
171 config.
parse(m_configSection,
false, INTERNAL_CONFIG);
177 Name topPrefix(
"/localhost/nfd");
178 m_forwarder->getFib().insert(topPrefix).first->addNextHop(*m_internalFace, 0);
179 m_dispatcher->addTopPrefix(topPrefix,
false);
197 m_authenticator->setConfigFile(config);
198 m_faceManager->setConfigFile(config);
200 if (!m_configFile.empty()) {
201 config.
parse(m_configFile,
false);
204 config.
parse(m_configSection,
false, INTERNAL_CONFIG);
209 Nfd::reloadConfigFileFaceSection()
213 m_faceManager->setConfigFile(config);
215 if (!m_configFile.empty()) {
216 config.
parse(m_configFile,
false);
219 config.
parse(m_configSection,
false, INTERNAL_CONFIG);
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.
Network state change monitor.
represents a dispatcher on server side of NFD Management protocol
static const std::string INTERNAL_CONFIG
represents the underlying protocol and address used by a Face
void setConfigFile(ConfigFile &configFile)
configuration file parsing utility
The packet signing interface.
const FaceId FACEID_INTERNAL_FACE
identifies the InternalFace used in management
detail::SimulatorIo & getGlobalIoService()
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)
implement the Forwarder Status of NFD Management Protocol.
#define NFD_LOG_INFO(expression)
void reloadConfigFile()
Reload configuration file and apply update (if any)
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
Name abstraction to represent an absolute name.
handles 'tables' config section
#define NFD_LOG_WARN(expression)
void initialize()
Perform initialization of NFD instance After initialization, NFD instance can be started by invoking ...
static shared_ptr< CommandAuthenticator > create()
EventId schedule(const time::nanoseconds &after, const Scheduler::Event &event)
schedule an event
static void ignoreUnknownSection(const std::string &filename, const std::string §ionName, const ConfigSection §ion, bool isDryRun)
void addReserved(shared_ptr< Face > face, FaceId faceId)
add a special face with a reserved FaceId
static ndn::util::NetworkMonitor * makeNetworkMonitor()
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