blob: 3f70bbd610954fdc2baf752aea8e139eca62eb5d [file] [log] [blame]
Alexander Afanasyev2b57aeb2018-06-15 18:32:28 -04001/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2/**
3 * Copyright (c) 2014-2018, Regents of the University of California
4 *
5 * NAC library is free software: you can redistribute it and/or modify it under the
6 * terms of the GNU Lesser General Public License as published by the Free Software
7 * Foundation, either version 3 of the License, or (at your option) any later version.
8 *
9 * NAC library is distributed in the hope that it will be useful, but WITHOUT ANY
10 * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
11 * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
12 *
13 * You should have received copies of the GNU General Public License and GNU Lesser
14 * General Public License along with ndn-cxx, e.g., in COPYING.md file. If not, see
15 * <http://www.gnu.org/licenses/>.
16 *
17 * See AUTHORS.md for complete list of NAC library authors and contributors.
18 */
19
20#ifndef NAC_TOOLS_NDN_NAC_NDN_NAC_HPP
21#define NAC_TOOLS_NDN_NAC_NDN_NAC_HPP
22
23#include "common.hpp"
24
25#include <fstream>
26#include <iostream>
27#include <string>
28
29#include <boost/asio.hpp>
30#include <boost/exception/all.hpp>
31#include <boost/program_options/options_description.hpp>
32#include <boost/program_options/parsers.hpp>
33#include <boost/program_options/variables_map.hpp>
34
35#include <ndn-cxx/util/dummy-client-face.hpp>
36#include <ndn-cxx/util/io.hpp>
37
38namespace ndn {
39namespace nac {
40
41int
42nac_dump_kek(int argc, char** argv);
43
44int
45nac_add_member(int argc, char** argv);
46
47inline security::v2::Certificate
48loadCertificate(const std::string& fileName)
49{
50 shared_ptr<security::v2::Certificate> cert;
51 if (fileName == "-")
52 cert = io::load<security::v2::Certificate>(std::cin);
53 else
54 cert = io::load<security::v2::Certificate>(fileName);
55
56 if (cert == nullptr) {
57 BOOST_THROW_EXCEPTION(std::runtime_error("Cannot load certificate from " + fileName));
58 }
59 return *cert;
60}
61
62} // namespace nac
63} // namespace ndn
64
65#endif // NAC_TOOLS_NDN_NAC_NDN_NAC_HPP