status-report.hpp
Go to the documentation of this file.
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2 /*
3  * Copyright (c) 2014-2021, 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_TOOLS_NFDC_STATUS_REPORT_HPP
27 #define NFD_TOOLS_NFDC_STATUS_REPORT_HPP
28 
29 #include "module.hpp"
30 
31 #include <ndn-cxx/face.hpp>
32 #include <ndn-cxx/security/key-chain.hpp>
33 #include <ndn-cxx/security/validator.hpp>
34 
35 namespace nfd {
36 namespace tools {
37 namespace nfdc {
38 
39 using ndn::Face;
40 using ndn::KeyChain;
41 using ndn::security::Validator;
42 
43 enum class ReportFormat {
44  XML = 1,
45  TEXT = 2
46 };
47 
49 parseReportFormat(const std::string& s);
50 
51 std::ostream&
52 operator<<(std::ostream& os, ReportFormat fmt);
53 
56 class StatusReport : noncopyable
57 {
58 public:
59 #ifdef NFD_WITH_TESTS
60  virtual
61  ~StatusReport() = default;
62 #endif
63 
71  uint32_t
72  collect(Face& face, KeyChain& keyChain, Validator& validator, const CommandOptions& options);
73 
77  void
78  formatXml(std::ostream& os) const;
79 
83  void
84  formatText(std::ostream& os) const;
85 
86 private:
88  processEvents(Face& face);
89 
90 public:
93  std::vector<unique_ptr<Module>> sections;
94 };
95 
96 } // namespace nfdc
97 } // namespace tools
98 } // namespace nfd
99 
100 #endif // NFD_TOOLS_NFDC_STATUS_REPORT_HPP
collects and prints NFD status report
void formatText(std::ostream &os) const
print a text report
void formatXml(std::ostream &os) const
print an XML report
uint32_t collect(Face &face, KeyChain &keyChain, Validator &validator, const CommandOptions &options)
collect status via chosen sections
std::vector< unique_ptr< Module > > sections
modules through which status is collected
#define NFD_VIRTUAL_WITH_TESTS
Definition: common.hpp:39
std::ostream & operator<<(std::ostream &os, ArgValueType vt)
ReportFormat parseReportFormat(const std::string &s)
Copyright (c) 2014-2015, Regents of the University of California, Arizona Board of Regents,...
Definition: algorithm.hpp:32