hello-protocol.hpp
Go to the documentation of this file.
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
22 #ifndef NLSR_HELLO_PROTOCOL_HPP
23 #define NLSR_HELLO_PROTOCOL_HPP
24 
25 #include "statistics.hpp"
26 #include "test-access-control.hpp"
27 
28 #include <ndn-cxx/util/signal.hpp>
29 #include <ndn-cxx/face.hpp>
30 #include <ndn-cxx/mgmt/nfd/control-parameters.hpp>
31 #include <ndn-cxx/mgmt/nfd/control-response.hpp>
32 #include <ndn-cxx/util/scheduler.hpp>
33 #include <ndn-cxx/security/v2/validation-error.hpp>
34 
35 namespace nlsr {
36 
37 class Nlsr;
38 
40 {
41 public:
42  HelloProtocol(Nlsr& nlsr, ndn::Scheduler& scheduler);
43 
53  void
54  scheduleInterest(uint32_t seconds);
55 
67  void
68  expressInterest(const ndn::Name& interestNamePrefix, uint32_t seconds);
69 
82  void
83  sendScheduledInterest(uint32_t seconds);
84 
99  void
100  processInterest(const ndn::Name& name, const ndn::Interest& interest);
101 
102  ndn::util::signal::Signal<HelloProtocol, Statistics::PacketType> hpIncrementSignal;
103 
104 private:
114  void
115  processInterestTimedOut(const ndn::Interest& interest);
116 
119  void
120  onContent(const ndn::Interest& interest, const ndn::Data& data);
121 
123 
131  void
132  onContentValidated(const ndn::Data& data);
133 
134 private:
137  void
138  onContentValidationFailed(const ndn::Data& data,
139  const ndn::security::v2::ValidationError& ve);
140 
150  void
151  onRegistrationFailure(const ndn::nfd::ControlResponse& response,
152  const ndn::Name& name);
153 
164  void
165  onRegistrationSuccess(const ndn::nfd::ControlParameters& commandSuccessResult,
166  const ndn::Name& neighbor, const ndn::time::milliseconds& timeout);
167 
171  void
172  registerPrefixes(const ndn::Name& adjName, const std::string& faceUri,
173  double linkCost, const ndn::time::milliseconds& timeout);
174 private:
175  Nlsr& m_nlsr;
176  ndn::Scheduler& m_scheduler;
177 
178  static const std::string INFO_COMPONENT;
179  static const std::string NLSR_COMPONENT;
180 };
181 
182 } // namespace nlsr
183 
184 #endif // NLSR_HELLO_PROTOCOL_HPP
#define PUBLIC_WITH_TESTS_ELSE_PRIVATE
ndn::util::signal::Signal< HelloProtocol, Statistics::PacketType > hpIncrementSignal
void expressInterest(const ndn::Name &interestNamePrefix, uint32_t seconds)
Sends a Hello Interest packet.
void scheduleInterest(uint32_t seconds)
Schedules a Hello Interest event.
void processInterest(const ndn::Name &name, const ndn::Interest &interest)
Processes a Hello Interest from a neighbor.
void sendScheduledInterest(uint32_t seconds)
Sends Hello Interests to all neighbors.
HelloProtocol(Nlsr &nlsr, ndn::Scheduler &scheduler)
Copyright (c) 2014-2017, The University of Memphis, Regents of the University of California, Arizona Board of Regents.