blob: cc715b0fc981767d55d07c1e5c66c992bc8b0414 [file] [log] [blame]
akmhoque3d06e792014-05-27 16:23:20 -05001/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2/**
3 * Copyright (c) 2014 University of Memphis,
4 * Regents of the University of California
5 *
6 * This file is part of NLSR (Named-data Link State Routing).
7 * See AUTHORS.md for complete list of NLSR authors and contributors.
8 *
9 * NLSR is free software: you can redistribute it and/or modify it under the terms
10 * of the GNU General Public License as published by the Free Software Foundation,
11 * either version 3 of the License, or (at your option) any later version.
12 *
13 * NLSR is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
14 * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
15 * PURPOSE. See the GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License along with
18 * NLSR, e.g., in COPYING.md file. If not, see <http://www.gnu.org/licenses/>.
19 *
20 * \author A K M Mahmudul Hoque <ahoque1@memphis.edu>
21 * \author Minsheng Zhang <mzhang4@memphis.edu>
22 *
23 **/
akmhoque157b0a42014-05-13 00:26:37 -050024#ifndef CONF_PROCESSOR_HPP
25#define CONF_PROCESSOR_HPP
akmhoque53353462014-04-22 08:43:45 -050026
akmhoque157b0a42014-05-13 00:26:37 -050027#include <boost/smart_ptr/shared_ptr.hpp>
28#include <boost/property_tree/ptree.hpp>
akmhoquefdbddb12014-05-02 18:35:19 -050029#include <boost/cstdint.hpp>
akmhoque157b0a42014-05-13 00:26:37 -050030
akmhoque53353462014-04-22 08:43:45 -050031#include "nlsr.hpp"
32
33namespace nlsr {
akmhoqueb6450b12014-04-24 00:01:03 -050034
akmhoque53353462014-04-22 08:43:45 -050035class ConfFileProcessor
36{
37public:
akmhoquefdbddb12014-05-02 18:35:19 -050038 ConfFileProcessor(Nlsr& nlsr, const std::string& cfile)
akmhoqueb6450b12014-04-24 00:01:03 -050039 : m_confFileName(cfile)
40 , m_nlsr(nlsr)
akmhoque53353462014-04-22 08:43:45 -050041 {
42 }
43
akmhoque157b0a42014-05-13 00:26:37 -050044 bool
45 processConfFile();
akmhoque53353462014-04-22 08:43:45 -050046
47private:
akmhoque157b0a42014-05-13 00:26:37 -050048 bool
49 load(std::istream& input);
akmhoque53353462014-04-22 08:43:45 -050050
akmhoque157b0a42014-05-13 00:26:37 -050051 bool
52 processSection(const std::string& section,
53 boost::property_tree::ptree SectionAttributeTree);
akmhoque53353462014-04-22 08:43:45 -050054
akmhoque157b0a42014-05-13 00:26:37 -050055 bool
56 processConfSectionGeneral(boost::property_tree::ptree SectionAttributeTree);
akmhoque53353462014-04-22 08:43:45 -050057
akmhoque157b0a42014-05-13 00:26:37 -050058 bool
59 processConfSectionNeighbors(boost::property_tree::ptree SectionAttributeTree);
akmhoque53353462014-04-22 08:43:45 -050060
akmhoque157b0a42014-05-13 00:26:37 -050061 bool
62 processConfSectionHyperbolic(boost::property_tree::ptree SectionAttributeTree);
akmhoque53353462014-04-22 08:43:45 -050063
akmhoque157b0a42014-05-13 00:26:37 -050064 bool
65 processConfSectionFib(boost::property_tree::ptree SectionAttributeTree);
akmhoque53353462014-04-22 08:43:45 -050066
akmhoque157b0a42014-05-13 00:26:37 -050067 bool
68 processConfSectionAdvertising(boost::property_tree::ptree SectionAttributeTree);
akmhoque53353462014-04-22 08:43:45 -050069
Yingdi Yu20e3a6e2014-05-26 23:16:10 -070070 bool
71 processConfSectionSecurity(boost::property_tree::ptree SectionAttributeTree);
72
akmhoque53353462014-04-22 08:43:45 -050073private:
Yingdi Yu20e3a6e2014-05-26 23:16:10 -070074 typedef boost::property_tree::ptree ConfigSection;
75
akmhoquefdbddb12014-05-02 18:35:19 -050076 std::string m_confFileName;
akmhoqueb6450b12014-04-24 00:01:03 -050077 Nlsr& m_nlsr;
akmhoque53353462014-04-22 08:43:45 -050078};
79
80} //namespace nlsr
akmhoque157b0a42014-05-13 00:26:37 -050081#endif //CONF_PROCESSOR_HPP