NS-3 based Named Data Networking (NDN) simulator
ndnSIM 2.0: NDN, CCN, CCNx, content centric networks
API Documentation
fib-manager.hpp
Go to the documentation of this file.
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
26 #ifndef NFD_DAEMON_MGMT_FIB_MANAGER_HPP
27 #define NFD_DAEMON_MGMT_FIB_MANAGER_HPP
28 
29 #include "common.hpp"
30 #include "mgmt/manager-base.hpp"
32 
33 namespace nfd {
34 
35 class Face;
36 class Forwarder;
37 class Fib;
38 
39 const std::string FIB_PRIVILEGE = "fib"; // config file privilege name
40 
41 class FibManager : public ManagerBase
42 {
43 public:
44 
45  FibManager(Fib& fib,
46  function<shared_ptr<Face>(FaceId)> getFace,
47  shared_ptr<InternalFace> face,
48  ndn::KeyChain& keyChain);
49 
50  virtual
51  ~FibManager();
52 
53  void
54  onFibRequest(const Interest& request);
55 
56 private:
57 
58  void
59  onValidatedFibRequest(const shared_ptr<const Interest>& request);
60 
61  void
62  addNextHop(ControlParameters& parameters,
63  ControlResponse& response);
64 
65  void
66  removeNextHop(ControlParameters& parameters,
67  ControlResponse& response);
68 
69  void
70  listEntries(const Interest& request);
71 
72 private:
73 
74  Fib& m_managedFib;
75  function<shared_ptr<Face>(FaceId)> m_getFace;
76  FibEnumerationPublisher m_fibEnumerationPublisher;
77 
78  typedef function<void(FibManager*,
80  ControlResponse&)> SignedVerbProcessor;
81 
82  typedef std::map<Name::Component, SignedVerbProcessor> SignedVerbDispatchTable;
83 
84  typedef std::pair<Name::Component, SignedVerbProcessor> SignedVerbAndProcessor;
85 
86  typedef function<void(FibManager*, const Interest&)> UnsignedVerbProcessor;
87 
88  typedef std::map<Name::Component, UnsignedVerbProcessor> UnsignedVerbDispatchTable;
89  typedef std::pair<Name::Component, UnsignedVerbProcessor> UnsignedVerbAndProcessor;
90 
91 
92  const SignedVerbDispatchTable m_signedVerbDispatch;
93  const UnsignedVerbDispatchTable m_unsignedVerbDispatch;
94 
95  static const Name COMMAND_PREFIX; // /localhost/nfd/fib
96 
97  // number of components in an invalid, but not malformed, unsigned command.
98  // (/localhost/nfd/fib + verb + parameters) = 5
99  static const size_t COMMAND_UNSIGNED_NCOMPS;
100 
101  // number of components in a valid signed Interest.
102  // UNSIGNED_NCOMPS + 4 command Interest components = 9
103  static const size_t COMMAND_SIGNED_NCOMPS;
104 
105  static const SignedVerbAndProcessor SIGNED_COMMAND_VERBS[];
106  static const UnsignedVerbAndProcessor UNSIGNED_COMMAND_VERBS[];
107 
108  static const Name LIST_COMMAND_PREFIX;
109  static const size_t LIST_COMMAND_NCOMPS;
110 };
111 
112 } // namespace nfd
113 
114 #endif // NFD_DAEMON_MGMT_FIB_MANAGER_HPP
represents parameters in a ControlCommand request or response
represents the FIB
Definition: fib.hpp:44
represents an Interest packet
Definition: interest.hpp:45
virtual ~FibManager()
Definition: fib-manager.cpp:97
FibManager(Fib &fib, function< shared_ptr< Face >(FaceId)> getFace, shared_ptr< InternalFace > face, ndn::KeyChain &keyChain)
Definition: fib-manager.cpp:78
const std::string FIB_PRIVILEGE
Definition: fib-manager.hpp:39
ndn::mgmt::ControlResponse ControlResponse
Copyright (c) 2011-2015 Regents of the University of California.
Definition: ndn-common.hpp:38
identifies a face
Name abstraction to represent an absolute name.
Definition: name.hpp:46
ndn cxx Face
Copyright (c) 2013-2015 Regents of the University of California.
Definition: face.cpp:25
Forwarder
Definition: forwarder.cpp:38
void onFibRequest(const Interest &request)
int FaceId
Definition: face.hpp:40