blob: f9cac452a3c7cf2062b926a959de7c9adc4b5d89 [file] [log] [blame]
Alexander Afanasyev31c781e2015-02-09 17:39:59 -08001/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2/**
3 * Copyright (c) 2014-2015, 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 "common.hpp"
30#include "core/config-file.hpp"
31
32#include <ndn-cxx/security/key-chain.hpp>
33
34namespace nfd {
35
36class Forwarder;
37class InternalFace;
38class FibManager;
39class FaceManager;
40class StrategyChoiceManager;
41class StatusServer;
42
43/**
44 * \brief Class representing NFD instance
45 * This class can be used to initialize all components of NFD
46 */
47class Nfd : noncopyable
48{
49public:
50 /**
51 * \brief Create NFD instance using absolute or relative path to \p configFile
52 */
53 Nfd(const std::string& configFile, ndn::KeyChain& keyChain);
54
55 /**
56 * \brief Create NFD instance using a parsed ConfigSection \p config
57 * This version of the constructor is more appropriate for integrated environments,
58 * such as NS-3 or android.
59 * \note When using this version of the constructor, error messages will include
60 * "internal://nfd.conf" when referring to configuration errors.
61 */
62 Nfd(const ConfigSection& config, ndn::KeyChain& keyChain);
63
64 /**
65 * \brief Perform initialization of NFD instance
66 * After initialization, NFD instance can be started by invoking run on globalIoService
67 */
68 void
69 initialize();
70
71 /**
72 * \brief Reload configuration file and apply update (if any)
73 */
74 void
75 reloadConfigFile();
76
77private:
78 void
79 initializeLogging();
80
81 void
82 initializeManagement();
83
84private:
85 std::string m_configFile;
86 ConfigSection m_configSection;
87
88 shared_ptr<Forwarder> m_forwarder;
89
90 shared_ptr<InternalFace> m_internalFace;
91 shared_ptr<FibManager> m_fibManager;
92 shared_ptr<FaceManager> m_faceManager;
93 shared_ptr<StrategyChoiceManager> m_strategyChoiceManager;
94 shared_ptr<StatusServer> m_statusServer;
95
96 ndn::KeyChain& m_keyChain;
97};
98
99} // namespace nfd
100
101#endif // NFD_DAEMON_NFD_HPP