conf-file-processor.hpp
Go to the documentation of this file.
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2 /*
3  * Copyright (c) 2014-2020, The University of Memphis,
4  * Regents of the University of California,
5  * Arizona Board of Regents.
6  *
7  * This file is part of NLSR (Named-data Link State Routing).
8  * See AUTHORS.md for complete list of NLSR authors and contributors.
9  *
10  * NLSR is free software: you can redistribute it and/or modify it under the terms
11  * of the GNU General Public License as published by the Free Software Foundation,
12  * either version 3 of the License, or (at your option) any later version.
13  *
14  * NLSR is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
15  * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
16  * PURPOSE. See the GNU General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License along with
19  * NLSR, e.g., in COPYING.md file. If not, see <http://www.gnu.org/licenses/>.
20  */
21 
22 #ifndef NLSR_CONF_FILE_PROCESSOR_HPP
23 #define NLSR_CONF_FILE_PROCESSOR_HPP
24 
25 #include "common.hpp"
26 #include "conf-parameter.hpp"
27 
28 #include <boost/algorithm/string.hpp>
29 #include <boost/property_tree/info_parser.hpp>
30 #include <boost/filesystem.hpp>
31 
32 namespace nlsr {
33 
34 namespace bf = boost::filesystem;
35 using ConfigSection = boost::property_tree::ptree;
36 
46 {
47 public:
48  ConfFileProcessor(ConfParameter& confParam);
49 
57  bool
59 
60 private:
71  bool
72  load(std::istream& input);
73 
76  bool
77  processSection(const std::string& sectionName, const ConfigSection& section);
78 
81  bool
82  processConfSectionGeneral(const ConfigSection& section);
83 
91  bool
92  processConfSectionNeighbors(const ConfigSection& section);
93 
96  bool
97  processConfSectionHyperbolic(const ConfigSection& section);
98 
101  bool
102  processConfSectionFib(const ConfigSection& section);
103 
106  bool
107  processConfSectionAdvertising(const ConfigSection& section);
108 
115  bool
116  processConfSectionSecurity(const ConfigSection& section);
117 
118 private:
120  std::string m_confFileName;
122  ConfParameter& m_confParam;
124  boost::asio::io_service m_io;
125 };
126 
127 } // namespace nlsr
128 #endif // NLSR_CONF_FILE_PROCESSOR_HPP
A class containing methods to parse an NLSR configuration file.
ConfFileProcessor(ConfParameter &confParam)
bool processConfFile()
Load and parse the configuration file, then populate NLSR.
A class to house all the configuration parameters for NLSR.
Copyright (c) 2014-2020, The University of Memphis, Regents of the University of California,...
boost::property_tree::ptree ConfigSection