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-2023, 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 "conf-parameter.hpp"
26 #include "lsdb.hpp"
27 #include "route/routing-table.hpp"
28 #include "statistics.hpp"
29 #include "test-access-control.hpp"
30 
31 #include <ndn-cxx/face.hpp>
32 #include <ndn-cxx/security/validation-error.hpp>
33 #include <ndn-cxx/util/scheduler.hpp>
34 #include <ndn-cxx/util/signal.hpp>
35 
36 namespace nlsr {
37 
39 {
40 public:
41  HelloProtocol(ndn::Face& face, ndn::KeyChain& keyChain, ConfParameter& confParam,
42  RoutingTable& routingTable, Lsdb& lsdb);
43 
55  void
56  expressInterest(const ndn::Name& interestNamePrefix, uint32_t seconds);
57 
66  void
67  sendHelloInterest(const ndn::Name& neighbor);
68 
83  void
84  processInterest(const ndn::Name& name, const ndn::Interest& interest);
85 
86  ndn::signal::Signal<HelloProtocol, Statistics::PacketType> hpIncrementSignal;
87 
88 private:
98  void
99  processInterestTimedOut(const ndn::Interest& interest);
100 
103  void
104  onContent(const ndn::Interest& interest, const ndn::Data& data);
105 
107 
115  void
116  onContentValidated(const ndn::Data& data);
117 
118 private:
121  void
122  onContentValidationFailed(const ndn::Data& data,
123  const ndn::security::ValidationError& ve);
124 
125 public:
126  static inline const std::string INFO_COMPONENT{"INFO"};
127  static inline const std::string NLSR_COMPONENT{"nlsr"};
128 
129  ndn::signal::Signal<HelloProtocol, const ndn::Name&> onInitialHelloDataValidated;
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 
142 } // namespace nlsr
143 
144 #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::signal::Signal< HelloProtocol, Statistics::PacketType > hpIncrementSignal
static const std::string INFO_COMPONENT
static const std::string NLSR_COMPONENT
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.
ndn::signal::Signal< HelloProtocol, const ndn::Name & > onInitialHelloDataValidated
Copyright (c) 2014-2020, The University of Memphis, Regents of the University of California.
#define PUBLIC_WITH_TESTS_ELSE_PRIVATE