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 
59  void
60  expressInterest(const ndn::Name& interestNamePrefix, uint32_t seconds);
61 
70  void
71  sendHelloInterest(const ndn::Name& neighbor);
72 
87  void
88  processInterest(const ndn::Name& name, const ndn::Interest& interest);
89 
90  ndn::util::signal::Signal<HelloProtocol, Statistics::PacketType> hpIncrementSignal;
91 
92 private:
102  void
103  processInterestTimedOut(const ndn::Interest& interest);
104 
107  void
108  onContent(const ndn::Interest& interest, const ndn::Data& data);
109 
111 
119  void
120  onContentValidated(const ndn::Data& data);
121 
122 private:
125  void
126  onContentValidationFailed(const ndn::Data& data,
127  const ndn::security::v2::ValidationError& ve);
128 
138  void
139  onRegistrationFailure(const ndn::nfd::ControlResponse& response,
140  const ndn::Name& name);
141 
152  void
153  onRegistrationSuccess(const ndn::nfd::ControlParameters& commandSuccessResult,
154  const ndn::Name& neighbor, const ndn::time::milliseconds& timeout);
155 
156 public:
157  ndn::util::Signal<HelloProtocol, const ndn::Name&> onHelloDataValidated;
158 
159 private:
160  ndn::Face& m_face;
161  ndn::Scheduler m_scheduler;
162  ndn::security::v2::KeyChain& m_keyChain;
163  ndn::security::SigningInfo& m_signingInfo;
164  ConfParameter& m_confParam;
165  RoutingTable& m_routingTable;
166  Lsdb& m_lsdb;
167  AdjacencyList& m_adjacencyList;
168 
169  static const std::string INFO_COMPONENT;
170  static const std::string NLSR_COMPONENT;
171 };
172 
173 } // namespace nlsr
174 
175 #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)
ndn::util::Signal< HelloProtocol, const ndn::Name & > onHelloDataValidated
void processInterest(const ndn::Name &name, const ndn::Interest &interest)
Processes a Hello Interest from a neighbor.
void sendHelloInterest(const ndn::Name &neighbor)
Sends Hello Interests to all neighbors.
Copyright (c) 2014-2019, The University of Memphis, Regents of the University of California, Arizona Board of Regents.