50 : m_keyChain(keyChain)
55 Nfd::Nfd(
const std::string& configFile, ndn::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()
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()
136 m_dispatcher.reset(
new ndn::mgmt::Dispatcher(*m_internalClientFace, m_keyChain));
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) 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 ...
implement the Forwarder Status of NFD Management Protocol.
configuration file parsing utility
static const std::string INTERNAL_CONFIG
void setConfigFile(ConfigFile &config)
void setConfigFile(ConfigFile &configFile)
static LoggerFactory & getInstance()
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)
implement the Face Management of NFD Management Protocol.
void addReserved(shared_ptr< Face > face, FaceId faceId)
add a special face with a reserved FaceId
void reloadConfigFile()
Reload configuration file and apply update (if any)
implement the FIB Management of NFD Management Protocol.
#define NFD_LOG_INFO(expression)
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)
boost::property_tree::ptree ConfigSection
a config file section
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)
implement the Strategy Choice Management of NFD Management Protocol.
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()