face-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_FACE_MANAGER_HPP
27 #define NFD_DAEMON_MGMT_FACE_MANAGER_HPP
28 
29 #include "nfd-manager-base.hpp"
30 #include "face/face-system.hpp"
31 #include <ndn-cxx/mgmt/nfd/face-status.hpp>
32 #include <ndn-cxx/mgmt/nfd/face-query-filter.hpp>
33 #include <ndn-cxx/mgmt/nfd/face-event-notification.hpp>
34 
35 namespace nfd {
36 
42 {
43 public:
44  FaceManager(FaceTable& faceTable,
45  Dispatcher& dispatcher,
46  CommandAuthenticator& authenticator);
47 
51  void
52  setConfigFile(ConfigFile& configFile);
53 
54 PUBLIC_WITH_TESTS_ELSE_PRIVATE: // ControlCommand
55  void
56  createFace(const Name& topPrefix, const Interest& interest,
57  const ControlParameters& parameters,
58  const ndn::mgmt::CommandContinuation& done);
59 
60  void
61  updateFace(const Name& topPrefix, const Interest& interest,
62  const ControlParameters& parameters,
63  const ndn::mgmt::CommandContinuation& done);
64 
65  void
66  destroyFace(const Name& topPrefix, const Interest& interest,
67  const ControlParameters& parameters,
68  const ndn::mgmt::CommandContinuation& done);
69 
73  void
74  enableLocalControl(const Name& topPrefix, const Interest& interest,
75  const ControlParameters& parameters,
76  const ndn::mgmt::CommandContinuation& done);
77 
81  void
82  disableLocalControl(const Name& topPrefix, const Interest& interest,
83  const ControlParameters& parameters,
84  const ndn::mgmt::CommandContinuation& done);
85 
86 PUBLIC_WITH_TESTS_ELSE_PRIVATE: // helpers for ControlCommand
87  void
88  afterCreateFaceSuccess(const ControlParameters& parameters,
89  const shared_ptr<Face>& newFace,
90  const ndn::mgmt::CommandContinuation& done);
91 
92  void
93  afterCreateFaceFailure(uint32_t status,
94  const std::string& reason,
95  const ndn::mgmt::CommandContinuation& done);
96 
97  Face*
98  findFaceForLocalControl(const Interest& request,
99  const ControlParameters& parameters,
100  const ndn::mgmt::CommandContinuation& done);
101 
102  static void
103  setLinkServiceOptions(Face& face,
104  const ControlParameters& parameters,
105  ControlParameters& response);
106 
107 PUBLIC_WITH_TESTS_ELSE_PRIVATE: // StatusDataset
108  void
109  listFaces(const Name& topPrefix, const Interest& interest,
110  ndn::mgmt::StatusDatasetContext& context);
111 
112  void
113  listChannels(const Name& topPrefix, const Interest& interest,
114  ndn::mgmt::StatusDatasetContext& context);
115 
116  void
117  queryFaces(const Name& topPrefix, const Interest& interest,
118  ndn::mgmt::StatusDatasetContext& context);
119 
120 private: // helpers for StatusDataset handler
121  bool
122  matchFilter(const ndn::nfd::FaceQueryFilter& filter, const Face& face);
123 
126  static ndn::nfd::FaceStatus
127  collectFaceStatus(const Face& face, const time::steady_clock::TimePoint& now);
128 
132  template<typename FaceTraits>
133  static void
134  collectFaceProperties(const Face& face, FaceTraits& traits);
135 
136 private: // NotificationStream
137  void
138  notifyFaceEvent(const Face& face, ndn::nfd::FaceEventKind kind);
139 
140  void
141  connectFaceStateChangeSignal(const Face& face);
142 
144  FaceSystem m_faceSystem;
145  FaceTable& m_faceTable;
146  std::map<FaceId, signal::ScopedConnection> m_faceStateChangeConn;
147 
148 private:
149  ndn::mgmt::PostNotification m_postNotification;
150  signal::ScopedConnection m_faceAddConn;
151  signal::ScopedConnection m_faceRemoveConn;
152 };
153 
154 } // namespace nfd
155 
156 #endif // NFD_DAEMON_MGMT_FACE_MANAGER_HPP
configuration file parsing utility
Definition: config-file.hpp:58
container of all faces
Definition: face-table.hpp:37
implement the Face Management of NFD Management Protocol.
provides ControlCommand authorization according to NFD configuration file
Copyright (c) 2014-2015, Regents of the University of California, Arizona Board of Regents...
a collection of common functions shared by all NFD managers, such as communicating with the dispatche...
void setConfigFile(ConfigFile &configFile)
Subscribe to face_system section for the config file.
#define PUBLIC_WITH_TESTS_ELSE_PRIVATE
Definition: common.hpp:40
FaceManager(FaceTable &faceTable, Dispatcher &dispatcher, CommandAuthenticator &authenticator)