execute-command.hpp
Go to the documentation of this file.
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
26 #ifndef NFD_TOOLS_NFDC_EXECUTE_COMMAND_HPP
27 #define NFD_TOOLS_NFDC_EXECUTE_COMMAND_HPP
28 
29 #include "command-arguments.hpp"
30 #include <ndn-cxx/face.hpp>
31 #include <ndn-cxx/mgmt/nfd/command-options.hpp>
32 #include <ndn-cxx/mgmt/nfd/controller.hpp>
33 #include <ndn-cxx/mgmt/nfd/control-command.hpp>
34 #include <ndn-cxx/mgmt/nfd/control-parameters.hpp>
35 #include <ndn-cxx/mgmt/nfd/control-response.hpp>
36 #include <ndn-cxx/mgmt/nfd/status-dataset.hpp>
37 #include <ndn-cxx/security/key-chain.hpp>
38 
39 namespace nfd {
40 namespace tools {
41 namespace nfdc {
42 
43 using ndn::Face;
44 using ndn::KeyChain;
45 using ndn::nfd::ControlParameters;
46 using ndn::nfd::ControlResponse;
47 using ndn::nfd::Controller;
48 
52 {
53 public:
56  time::nanoseconds
57  getTimeout() const;
58 
59  ndn::nfd::CommandOptions
60  makeCommandOptions() const;
61 
65  Controller::CommandFailCallback
66  makeCommandFailureHandler(const std::string& commandName);
67 
71  Controller::DatasetFailCallback
72  makeDatasetFailureHandler(const std::string& datasetName);
73 
74 public:
75  const std::string& noun;
76  const std::string& verb;
78 
79  int exitCode;
80  std::ostream& out;
81  std::ostream& err;
82 
83  Face& face;
84  KeyChain& keyChain;
86  Controller& controller;
87 };
88 
91 using ExecuteCommand = std::function<void(ExecuteContext& ctx)>;
92 
93 } // namespace nfdc
94 } // namespace tools
95 } // namespace nfd
96 
97 #endif // NFD_TOOLS_NFDC_EXECUTE_COMMAND_HPP
const CommandArguments & args
ndn::nfd::CommandOptions makeCommandOptions() const
Controller::CommandFailCallback makeCommandFailureHandler(const std::string &commandName)
std::ostream & out
output stream
context for command execution
time::nanoseconds getTimeout() const
Controller::DatasetFailCallback makeDatasetFailureHandler(const std::string &datasetName)
Copyright (c) 2014-2015, Regents of the University of California, Arizona Board of Regents...
Definition: algorithm.hpp:32
contains named command arguments
std::ostream & err
error stream
std::function< void(ExecuteContext &ctx)> ExecuteCommand
a function to execute a command