29 #include "core/logger-factory.hpp" 50 : m_keyChain(keyChain)
58 m_configFile = configFile;
64 m_configSection = config;
79 FaceTable& faceTable = m_forwarder->getFaceTable();
82 m_faceSystem = make_unique<face::FaceSystem>(faceTable, m_netmon);
84 initializeManagement();
88 m_netmon->onNetworkStateChanged.connect([
this] {
93 NFD_LOG_INFO(
"Network change detected, reloading face section of the config file...");
94 this->reloadConfigFileFaceSection();
100 Nfd::initializeLogging()
103 LoggerFactory::getInstance().setConfigFile(config);
105 if (!m_configFile.empty()) {
106 config.
parse(m_configFile,
true);
107 config.
parse(m_configFile,
false);
110 config.
parse(m_configSection,
true, INTERNAL_CONFIG);
111 config.
parse(m_configSection,
false, INTERNAL_CONFIG);
121 if (sectionName ==
"rib" || sectionName ==
"log") {
131 Nfd::initializeManagement()
140 m_faceManager.reset(
new FaceManager(*m_faceSystem, *m_dispatcher, *m_authenticator));
141 m_fibManager.reset(
new FibManager(m_forwarder->getFib(), m_forwarder->getFaceTable(),
142 *m_dispatcher, *m_authenticator));
144 *m_dispatcher, *m_authenticator));
152 m_authenticator->setConfigFile(config);
153 m_faceManager->setConfigFile(config);
156 if (!m_configFile.empty()) {
157 config.
parse(m_configFile,
true);
158 config.
parse(m_configFile,
false);
161 config.
parse(m_configSection,
true, INTERNAL_CONFIG);
162 config.
parse(m_configSection,
false, INTERNAL_CONFIG);
168 Name topPrefix(
"/localhost/nfd");
169 m_forwarder->getFib().insert(topPrefix).first->addNextHop(*m_internalFace, 0);
170 m_dispatcher->addTopPrefix(topPrefix,
false);
188 m_authenticator->setConfigFile(config);
189 m_faceManager->setConfigFile(config);
191 if (!m_configFile.empty()) {
192 config.
parse(m_configFile,
false);
195 config.
parse(m_configSection,
false, INTERNAL_CONFIG);
200 Nfd::reloadConfigFileFaceSection()
204 m_faceManager->setConfigFile(config);
206 if (!m_configFile.empty()) {
207 config.
parse(m_configFile,
false);
210 config.
parse(m_configSection,
false, INTERNAL_CONFIG);
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.
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()
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)
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 an absolute name.
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