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, ConfParameter& confParam,
45  RoutingTable& routingTable, Lsdb& lsdb);
46 
58  void
59  expressInterest(const ndn::Name& interestNamePrefix, uint32_t seconds);
60 
69  void
70  sendHelloInterest(const ndn::Name& neighbor);
71 
86  void
87  processInterest(const ndn::Name& name, const ndn::Interest& interest);
88 
89  ndn::util::signal::Signal<HelloProtocol, Statistics::PacketType> hpIncrementSignal;
90 
91 private:
101  void
102  processInterestTimedOut(const ndn::Interest& interest);
103 
106  void
107  onContent(const ndn::Interest& interest, const ndn::Data& data);
108 
110 
118  void
119  onContentValidated(const ndn::Data& data);
120 
121 private:
124  void
125  onContentValidationFailed(const ndn::Data& data,
126  const ndn::security::v2::ValidationError& ve);
127 
137  void
138  onRegistrationFailure(const ndn::nfd::ControlResponse& response,
139  const ndn::Name& name);
140 
151  void
152  onRegistrationSuccess(const ndn::nfd::ControlParameters& commandSuccessResult,
153  const ndn::Name& neighbor, const ndn::time::milliseconds& timeout);
154 
155 public:
156  ndn::util::Signal<HelloProtocol, const ndn::Name&> onHelloDataValidated;
157 
158 private:
159  ndn::Face& m_face;
160  ndn::Scheduler m_scheduler;
161  ndn::security::v2::KeyChain& m_keyChain;
162  const ndn::security::SigningInfo& m_signingInfo;
163  ConfParameter& m_confParam;
164  RoutingTable& m_routingTable;
165  Lsdb& m_lsdb;
166  AdjacencyList& m_adjacencyList;
167 
168  static const std::string INFO_COMPONENT;
169  static const std::string NLSR_COMPONENT;
170 };
171 
172 } // namespace nlsr
173 
174 #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.
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.
HelloProtocol(ndn::Face &face, ndn::KeyChain &keyChain, ConfParameter &confParam, RoutingTable &routingTable, Lsdb &lsdb)