available-commands.cpp
Go to the documentation of this file.
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
26 #include "available-commands.hpp"
27 #include "help.hpp"
28 #include "status.hpp"
29 #include "legacy-status.hpp"
30 #include "legacy-nfdc.hpp"
31 
32 namespace nfd {
33 namespace tools {
34 namespace nfdc {
35 
36 void
38 {
39  registerHelpCommand(parser);
40  registerStatusCommands(parser);
42 
43  struct LegacyNfdcCommandDefinition
44  {
45  std::string subcommand;
46  std::string title;
47  };
48  const std::vector<LegacyNfdcCommandDefinition> legacyNfdcSubcommands{
49  {"register", "register a prefix"},
50  {"unregister", "unregister a prefix"},
51  {"create", "create a face"},
52  {"destroy", "destroy a face"},
53  {"set-strategy", "set strategy choice on namespace"},
54  {"unset-strategy", "unset strategy choice on namespace"},
55  {"add-nexthop", "add FIB nexthop"},
56  {"remove-nexthop", "remove FIB nexthop"}
57  };
58  for (const LegacyNfdcCommandDefinition& lncd : legacyNfdcSubcommands) {
59  CommandDefinition def(lncd.subcommand, "");
60  def.setTitle(lncd.title);
62  parser.addCommand(def, &legacyNfdcMain);
63  }
64 }
65 
66 } // namespace nfdc
67 } // namespace tools
68 } // namespace nfd
void registerStatusCommands(CommandParser &parser)
registers status commands
Definition: status.cpp:121
declares semantics of a command
CommandDefinition & setTitle(const std::string &title)
set one-line description
Copyright (c) 2014-2015, Regents of the University of California, Arizona Board of Regents...
CommandDefinition & addArg(const std::string &name, ArgValueType valueType, Required isRequired=Required::NO, Positional allowPositional=Positional::NO, const std::string &metavar="")
declare an argument
void registerHelpCommand(CommandParser &parser)
registers 'help' command
Definition: help.cpp:92
int legacyNfdcMain(ExecuteContext &ctx)
argument is required
CommandParser & addCommand(const CommandDefinition &def, const ExecuteCommand &execute, std::underlying_type< AvailableIn >::type modes=AVAILABLE_IN_ALL)
add an available command
argument is optional
void registerCommands(CommandParser &parser)
void registerLegacyStatusCommand(CommandParser &parser)
registers 'legacy-nfd-status' command