NS-3 based Named Data Networking (NDN) simulator
ndnSIM 2.5: NDN, CCN, CCNx, content centric networks
API Documentation
nfd.hpp
Go to the documentation of this file.
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2 /*
3  * Copyright (c) 2014-2018, Regents of the University of California,
4  * Arizona Board of Regents,
5  * Colorado State University,
6  * University Pierre & Marie Curie, Sorbonne University,
7  * Washington University in St. Louis,
8  * Beijing Institute of Technology,
9  * The University of Memphis.
10  *
11  * This file is part of NFD (Named Data Networking Forwarding Daemon).
12  * See AUTHORS.md for complete list of NFD authors and contributors.
13  *
14  * NFD is free software: you can redistribute it and/or modify it under the terms
15  * of the GNU General Public License as published by the Free Software Foundation,
16  * either version 3 of the License, or (at your option) any later version.
17  *
18  * NFD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
19  * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
20  * PURPOSE. See the GNU General Public License for more details.
21  *
22  * You should have received a copy of the GNU General Public License along with
23  * NFD, e.g., in COPYING.md file. If not, see <http://www.gnu.org/licenses/>.
24  */
25 
26 #ifndef NFD_DAEMON_NFD_HPP
27 #define NFD_DAEMON_NFD_HPP
28 
29 #include "core/config-file.hpp"
30 #include "core/scheduler.hpp"
31 
32 #include <ndn-cxx/net/network-monitor.hpp>
33 #include <ndn-cxx/security/key-chain.hpp>
34 
35 namespace ndn {
36 class Face;
37 namespace mgmt {
38 class Dispatcher;
39 } // namespace mgmt
40 } // namespace ndn
41 
42 namespace nfd {
43 
44 class Forwarder;
46 
47 // forward-declare management modules, in the order as defined in management protocol
48 class ForwarderStatusManager;
49 class FaceManager;
50 class FibManager;
51 class CsManager;
53 
54 namespace face {
55 class Face;
56 class FaceSystem;
57 } // namespace face
58 
63 class Nfd : noncopyable
64 {
65 public:
69  Nfd(const std::string& configFile, ndn::KeyChain& keyChain);
70 
78  Nfd(const ConfigSection& config, ndn::KeyChain& keyChain);
79 
83  ~Nfd();
84 
89  void
90  initialize();
91 
95  void
97 
98 private:
99  explicit
100  Nfd(ndn::KeyChain& keyChain);
101 
102  void
103  initializeLogging();
104 
105  void
106  initializeManagement();
107 
108  void
109  reloadConfigFileFaceSection();
110 
111 private:
112  std::string m_configFile;
113  ConfigSection m_configSection;
114 
115  unique_ptr<Forwarder> m_forwarder;
116  unique_ptr<face::FaceSystem> m_faceSystem;
117 
118  ndn::KeyChain& m_keyChain;
119  shared_ptr<face::Face> m_internalFace;
120  shared_ptr<ndn::Face> m_internalClientFace;
121  unique_ptr<ndn::mgmt::Dispatcher> m_dispatcher;
122  shared_ptr<CommandAuthenticator> m_authenticator;
123  unique_ptr<ForwarderStatusManager> m_forwarderStatusManager;
124  unique_ptr<FaceManager> m_faceManager;
125  unique_ptr<FibManager> m_fibManager;
126  unique_ptr<CsManager> m_csManager;
127  unique_ptr<StrategyChoiceManager> m_strategyChoiceManager;
128 
129  shared_ptr<ndn::net::NetworkMonitor> m_netmon;
130  scheduler::ScopedEventId m_reloadConfigEvent;
131 };
132 
133 } // namespace nfd
134 
135 #endif // NFD_DAEMON_NFD_HPP
Copyright (c) 2011-2015 Regents of the University of California.
Nfd(const std::string &configFile, ndn::KeyChain &keyChain)
Create NFD instance using absolute or relative path to configFile.
Definition: nfd.cpp:56
The interface of signing key management.
Definition: key-chain.hpp:46
represents a dispatcher on server side of NFD Management protocol
Definition: dispatcher.hpp:130
FibManager
Definition: fib-manager.cpp:36
ndn Face
Definition: face-impl.hpp:42
void reloadConfigFile()
Reload configuration file and apply update (if any)
Definition: nfd.cpp:177
Class representing NFD instance This class can be used to initialize all components of NFD...
Definition: nfd.hpp:63
Copyright (c) 2011-2015 Regents of the University of California.
Definition: ndn-common.hpp:40
Cancels an event automatically upon destruction.
Definition: scheduler.hpp:60
boost::property_tree::ptree ConfigSection
a config file section
Forwarder
Definition: forwarder.cpp:38
void initialize()
Perform initialization of NFD instance After initialization, NFD instance can be started by invoking ...
Definition: nfd.cpp:74
~Nfd()
Destructor.