hello-protocol.hpp
Go to the documentation of this file.
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2 /*
3  * Copyright (c) 2014-2020, The University of Memphis,
4  * Regents of the University of California,
5  * Arizona Board of Regents.
6  *
7  * This file is part of NLSR (Named-data Link State Routing).
8  * See AUTHORS.md for complete list of NLSR authors and contributors.
9  *
10  * NLSR is free software: you can redistribute it and/or modify it under the terms
11  * of the GNU General Public License as published by the Free Software Foundation,
12  * either version 3 of the License, or (at your option) any later version.
13  *
14  * NLSR is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
15  * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
16  * PURPOSE. See the GNU General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License along with
19  * NLSR, e.g., in COPYING.md file. If not, see <http://www.gnu.org/licenses/>.
20  */
21 
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/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::ValidationError& ve);
127 
128 public:
129  ndn::util::Signal<HelloProtocol, const ndn::Name&> onHelloDataValidated;
130 
131 private:
132  ndn::Face& m_face;
133  ndn::Scheduler m_scheduler;
134  ndn::security::KeyChain& m_keyChain;
135  const ndn::security::SigningInfo& m_signingInfo;
136  ConfParameter& m_confParam;
137  RoutingTable& m_routingTable;
138  Lsdb& m_lsdb;
139  AdjacencyList& m_adjacencyList;
140 
141  static const std::string INFO_COMPONENT;
142  static const std::string NLSR_COMPONENT;
143 };
144 
145 } // namespace nlsr
146 
147 #endif // NLSR_HELLO_PROTOCOL_HPP
A class to house all the configuration parameters for NLSR.
HelloProtocol(ndn::Face &face, ndn::KeyChain &keyChain, ConfParameter &confParam, RoutingTable &routingTable, Lsdb &lsdb)
void sendHelloInterest(const ndn::Name &neighbor)
Sends Hello Interests to all neighbors.
ndn::util::signal::Signal< HelloProtocol, Statistics::PacketType > hpIncrementSignal
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 expressInterest(const ndn::Name &interestNamePrefix, uint32_t seconds)
Sends a Hello Interest packet.
Copyright (c) 2014-2020, The University of Memphis, Regents of the University of California,...
#define PUBLIC_WITH_TESTS_ELSE_PRIVATE