legacy-nfdc.hpp
Go to the documentation of this file.
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
26 #ifndef NFD_TOOLS_NFDC_LEGACY_NFDC_HPP
27 #define NFD_TOOLS_NFDC_LEGACY_NFDC_HPP
28 
29 #include "execute-command.hpp"
30 #include <ndn-cxx/mgmt/nfd/controller.hpp>
31 
32 namespace nfd {
33 namespace tools {
34 namespace nfdc {
35 
36 class LegacyNfdc : noncopyable
37 {
38 public:
39  static const time::milliseconds DEFAULT_EXPIRATION_PERIOD;
40  static const uint64_t DEFAULT_COST;
41 
42  class Error : public std::runtime_error
43  {
44  public:
45  explicit
46  Error(const std::string& what)
47  : std::runtime_error(what)
48  {
49  }
50  };
51 
52  LegacyNfdc(Face& face, KeyChain& keyChain);
53 
54  bool
55  dispatch(const std::string& cmd);
56 
66  void
67  fibAddNextHop();
68 
78  void
80 
87  void
89 
96  void
98 
108  void
109  faceCreate();
110 
118  void
119  faceDestroy();
120 
128  void
130 
138  void
140 
141 private:
142  void
143  onSuccess(const ndn::nfd::ControlParameters& commandSuccessResult,
144  const std::string& message);
145 
146  void
147  onError(const ndn::nfd::ControlResponse& response, const std::string& message);
148 
149  void
150  onCanonizeFailure(const std::string& reason);
151 
152  void
153  startFaceCreate(const ndn::util::FaceUri& canonicalUri);
154 
155  void
156  onObtainFaceIdFailure(const std::string& message);
157 
158 public:
159  std::vector<std::string> m_commandLineArguments; // positional arguments
160  uint64_t m_flags;
161  uint64_t m_cost;
162  uint64_t m_faceId;
163  uint64_t m_origin;
164  time::milliseconds m_expires;
165  std::string m_name;
166  ndn::nfd::FacePersistency m_facePersistency;
167 
168 private:
169  Face& m_face;
170  ndn::nfd::Controller m_controller;
171 };
172 
173 void
175 
176 int
178 
179 } // namespace nfdc
180 } // namespace tools
181 } // namespace nfd
182 
183 #endif // NFD_TOOLS_NFDC_LEGACY_NFDC_HPP
void ribUnregisterPrefix()
Unregisters name from the given faceId/faceUri.
void strategyChoiceSet()
Sets the strategy for a namespace.
context for command execution
bool dispatch(const std::string &cmd)
Definition: legacy-nfdc.cpp:53
static const uint64_t DEFAULT_COST
Definition: legacy-nfdc.hpp:40
ndn::nfd::FacePersistency m_facePersistency
STL namespace.
void strategyChoiceUnset()
Unset the strategy for a namespace.
void fibAddNextHop()
Adds a nexthop to a FIB entry.
void ribRegisterPrefix()
Registers name to the given faceId or faceUri.
void fibRemoveNextHop()
Removes a nexthop from an existing FIB entry.
LegacyNfdc(Face &face, KeyChain &keyChain)
Definition: legacy-nfdc.cpp:41
Copyright (c) 2014-2015, Regents of the University of California, Arizona Board of Regents...
Definition: algorithm.hpp:32
std::vector< std::string > m_commandLineArguments
Error(const std::string &what)
Definition: legacy-nfdc.hpp:46
int legacyNfdcMain(ExecuteContext &ctx)
void faceCreate()
Creates new face.
time::milliseconds m_expires
void faceDestroy()
Destroys face.
static const time::milliseconds DEFAULT_EXPIRATION_PERIOD
Definition: legacy-nfdc.hpp:39