face-module.hpp
Go to the documentation of this file.
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2 /*
3  * Copyright (c) 2014-2018, 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_FACE_MODULE_HPP
27 #define NFD_TOOLS_NFDC_FACE_MODULE_HPP
28 
29 #include "module.hpp"
30 #include "command-parser.hpp"
31 #include "format-helpers.hpp"
32 
33 namespace nfd {
34 namespace tools {
35 namespace nfdc {
36 
37 using ndn::nfd::FaceStatus;
38 
42 class FaceModule : public Module, noncopyable
43 {
44 public:
47  static void
49 
52  static void
53  list(ExecuteContext& ctx);
54 
57  static void
58  show(ExecuteContext& ctx);
59 
62  static void
63  create(ExecuteContext& ctx);
64 
67  static void
68  destroy(ExecuteContext& ctx);
69 
70  void
71  fetchStatus(Controller& controller,
72  const std::function<void()>& onSuccess,
73  const Controller::DatasetFailCallback& onFailure,
74  const CommandOptions& options) override;
75 
76  void
77  formatStatusXml(std::ostream& os) const override;
78 
83  void
84  formatItemXml(std::ostream& os, const FaceStatus& item) const;
85 
86  void
87  formatStatusText(std::ostream& os) const override;
88 
94  static void
95  formatItemText(std::ostream& os, const FaceStatus& item, bool wantMultiLine);
96 
102  static void
103  printFaceParams(std::ostream& os, text::ItemAttributes& ia, const ControlParameters& resp);
104 
105 private:
106  std::vector<FaceStatus> m_status;
107 };
108 
109 } // namespace nfdc
110 } // namespace tools
111 } // namespace nfd
112 
113 #endif // NFD_TOOLS_NFDC_FACE_MODULE_HPP
void formatStatusText(std::ostream &os) const override
format collected status as text
context for command execution
void formatStatusXml(std::ostream &os) const override
format collected status as XML
static void printFaceParams(std::ostream &os, text::ItemAttributes &ia, const ControlParameters &resp)
print face response parameters to specified ostream
static void create(ExecuteContext &ctx)
the &#39;face create&#39; command
Copyright (c) 2014-2015, Regents of the University of California, Arizona Board of Regents...
Definition: algorithm.hpp:32
static void registerCommands(CommandParser &parser)
register &#39;face list&#39;, &#39;face show&#39;, &#39;face create&#39;, &#39;face destroy&#39; commands
Definition: face-module.cpp:34
print attributes of an item
static void show(ExecuteContext &ctx)
the &#39;face show&#39; command
void formatItemXml(std::ostream &os, const FaceStatus &item) const
format a single status item as XML
static void formatItemText(std::ostream &os, const FaceStatus &item, bool wantMultiLine)
format a single status item as text
static void list(ExecuteContext &ctx)
the &#39;face list&#39; command
Definition: face-module.cpp:72
static void destroy(ExecuteContext &ctx)
the &#39;face destroy&#39; command
void fetchStatus(Controller &controller, const std::function< void()> &onSuccess, const Controller::DatasetFailCallback &onFailure, const CommandOptions &options) override
collect status from NFD
provides access to an NFD management module
Definition: module.hpp:43
provides access to NFD face management
Definition: face-module.hpp:42