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 #include "conf-parameter.hpp"
28 #include "lsdb.hpp"
29 #include "route/routing-table.hpp"
30 
31 #include <ndn-cxx/util/signal.hpp>
32 #include <ndn-cxx/face.hpp>
33 #include <ndn-cxx/mgmt/nfd/control-parameters.hpp>
34 #include <ndn-cxx/mgmt/nfd/control-response.hpp>
35 #include <ndn-cxx/util/scheduler.hpp>
36 #include <ndn-cxx/security/v2/validation-error.hpp>
37 #include <ndn-cxx/security/validator-config.hpp>
38 
39 namespace nlsr {
40 
42 {
43 public:
44  HelloProtocol(ndn::Face& face, ndn::KeyChain& keyChain,
45  ndn::security::SigningInfo& signingInfo,
46  ConfParameter& confParam, RoutingTable& routingTable, Lsdb& lsdb);
47 
57  void
58  scheduleInterest(uint32_t seconds);
59 
71  void
72  expressInterest(const ndn::Name& interestNamePrefix, uint32_t seconds);
73 
84  void
86 
101  void
102  processInterest(const ndn::Name& name, const ndn::Interest& interest);
103 
104  ndn::util::signal::Signal<HelloProtocol, Statistics::PacketType> hpIncrementSignal;
105 
106 private:
116  void
117  processInterestTimedOut(const ndn::Interest& interest);
118 
121  void
122  onContent(const ndn::Interest& interest, const ndn::Data& data);
123 
125 
133  void
134  onContentValidated(const ndn::Data& data);
135 
136 private:
139  void
140  onContentValidationFailed(const ndn::Data& data,
141  const ndn::security::v2::ValidationError& ve);
142 
152  void
153  onRegistrationFailure(const ndn::nfd::ControlResponse& response,
154  const ndn::Name& name);
155 
166  void
167  onRegistrationSuccess(const ndn::nfd::ControlParameters& commandSuccessResult,
168  const ndn::Name& neighbor, const ndn::time::milliseconds& timeout);
169 
173  void
174  registerPrefixes(const ndn::Name& adjName, const std::string& faceUri,
175  double linkCost, const ndn::time::milliseconds& timeout);
176 private:
177  ndn::Face& m_face;
178  ndn::Scheduler m_scheduler;
179  ndn::security::v2::KeyChain& m_keyChain;
180  ndn::security::SigningInfo& m_signingInfo;
181  ConfParameter& m_confParam;
182  RoutingTable& m_routingTable;
183  Lsdb& m_lsdb;
184 
185  static const std::string INFO_COMPONENT;
186  static const std::string NLSR_COMPONENT;
187 };
188 
189 } // namespace nlsr
190 
191 #endif // NLSR_HELLO_PROTOCOL_HPP
A class to house all the configuration parameters for NLSR.
#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.
HelloProtocol(ndn::Face &face, ndn::KeyChain &keyChain, ndn::security::SigningInfo &signingInfo, ConfParameter &confParam, RoutingTable &routingTable, Lsdb &lsdb)
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.
Copyright (c) 2014-2018, The University of Memphis, Regents of the University of California, Arizona Board of Regents.
void sendScheduledInterest()
Sends Hello Interests to all neighbors.