blob: fbc71f3a77ba081817688600cc4d415d4931335c [file] [log] [blame]
Zhiyi Zhang32dbb9f2017-02-16 15:15:10 -08001/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2/**
3 * Copyright (c) 2017, Regents of the University of California.
4 *
5 * This file is part of ndncert, a certificate management system based on NDN.
6 *
7 * ndncert is free software: you can redistribute it and/or modify it under the terms
8 * of the GNU General Public License as published by the Free Software Foundation, either
9 * version 3 of the License, or (at your option) any later version.
10 *
11 * ndncert is distributed in the hope that it will be useful, but WITHOUT ANY
12 * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
13 * PARTICULAR PURPOSE. See the GNU General Public License for more details.
14 *
15 * You should have received copies of the GNU General Public License along with
16 * ndncert, e.g., in COPYING.md file. If not, see <http://www.gnu.org/licenses/>.
17 *
18 * See AUTHORS.md for complete list of ndncert authors and contributors.
19 */
20
21#ifndef NDNCERT_CLIENT_CONFIG_HPP
22#define NDNCERT_CLIENT_CONFIG_HPP
23
24#include "ca-config.hpp"
25#include <boost/filesystem.hpp>
26
27namespace ndn {
28namespace ndncert {
29
30class CaItem
31{
32public:
33 Name m_caName;
34 std::string m_caInfo;
35 std::string m_probe;
36 std::list<std::string> m_supportedChallenges;
37};
38
39class ClientConfig
40{
41public:
42 class Error : public std::runtime_error
43 {
44 public:
45 using std::runtime_error::runtime_error;
46 };
47
48public:
49 void
50 load(const std::string& fileName);
51
52 void
53 addNewCaItem(const CaItem& item);
54
55 void
56 removeCaItem(const Name& caName);
57
58PUBLIC_WITH_TESTS_ELSE_PRIVATE:
59 void
60 parse();
61
62 std::list<std::string>
63 parseChallengeList(const ConfigSection& section);
64
65public:
66 std::list<CaItem> m_caItems;
67
68PUBLIC_WITH_TESTS_ELSE_PRIVATE:
69 ConfigSection m_config;
70};
71
72} // namespace ndncert
73} // namespace ndn
74
75#endif // NDNCERT_CLIENT_CONFIG_HPP