blob: 8d011558af9749d1546813ef875c3797ee31e1f4 [file] [log] [blame]
akmhoque3d06e792014-05-27 16:23:20 -05001/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2/**
Nick Gordonc6a85222017-01-03 16:54:34 -06003 * Copyright (c) 2014-2017, The University of Memphis,
Vince Lehmanc2e51f62015-01-20 15:03:11 -06004 * Regents of the University of California,
5 * Arizona Board of Regents.
akmhoque3d06e792014-05-27 16:23:20 -05006 *
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/>.
akmhoque3d06e792014-05-27 16:23:20 -050020 **/
Ashlesh Gawande5bf83172014-09-19 12:38:17 -050021
akmhoque53353462014-04-22 08:43:45 -050022#ifndef NLSR_LSDB_HPP
23#define NLSR_LSDB_HPP
24
Vince Lehman50df6b72015-03-03 12:06:40 -060025#include "conf-parameter.hpp"
akmhoque53353462014-04-22 08:43:45 -050026#include "lsa.hpp"
Ashlesh Gawande3e105a02017-05-16 17:36:56 -050027#include "sequencing-manager.hpp"
Ashlesh Gawande5bf83172014-09-19 12:38:17 -050028#include "test-access-control.hpp"
Ashlesh Gawande3e105a02017-05-16 17:36:56 -050029#include "communication/sync-logic-handler.hpp"
Alejandro Gil Torrese0d20482016-03-06 23:56:19 -060030#include "statistics.hpp"
31
32#include <ndn-cxx/security/key-chain.hpp>
33#include <ndn-cxx/util/signal.hpp>
34#include <ndn-cxx/util/time.hpp>
35
36#include <utility>
37#include <boost/cstdint.hpp>
akmhoque53353462014-04-22 08:43:45 -050038
Ashlesh Gawande90173ad2017-08-09 15:19:50 -050039#include <utility>
40#include <boost/cstdint.hpp>
41
42#include <ndn-cxx/security/key-chain.hpp>
43#include <ndn-cxx/util/time.hpp>
44
Nick Gordone98480b2017-05-24 11:23:03 -050045#include <utility>
46#include <boost/cstdint.hpp>
47#include <ndn-cxx/security/key-chain.hpp>
48#include <ndn-cxx/util/time.hpp>
Alexander Afanasyev411ee4b2014-08-16 23:17:03 -070049
Nick Gordone98480b2017-05-24 11:23:03 -050050namespace nlsr {
Alexander Afanasyev411ee4b2014-08-16 23:17:03 -070051
akmhoque53353462014-04-22 08:43:45 -050052class Nlsr;
53
54class Lsdb
55{
56public:
Ashlesh Gawande3e105a02017-05-16 17:36:56 -050057 Lsdb(Nlsr& nlsr, ndn::Scheduler& scheduler);
58
59 SyncLogicHandler&
60 getSyncLogicHandler()
61 {
62 return m_sync;
63 }
akmhoque53353462014-04-22 08:43:45 -050064
akmhoque53353462014-04-22 08:43:45 -050065 bool
akmhoque31d1d4b2014-05-05 22:08:14 -050066 doesLsaExist(const ndn::Name& key, const std::string& lsType);
akmhoque53353462014-04-22 08:43:45 -050067
Nick G97e34942016-07-11 14:46:27 -050068
69 /*! \brief Builds a name LSA for this router and then installs it
70 into the LSDB.
71 */
akmhoque53353462014-04-22 08:43:45 -050072 bool
akmhoque31d1d4b2014-05-05 22:08:14 -050073 buildAndInstallOwnNameLsa();
akmhoque53353462014-04-22 08:43:45 -050074
Nick G97e34942016-07-11 14:46:27 -050075 /*! \brief Returns the name LSA with the given key.
76 \param key The name of the router that the desired LSA comes from.
77 */
akmhoqueb6450b12014-04-24 00:01:03 -050078 NameLsa*
akmhoque31d1d4b2014-05-05 22:08:14 -050079 findNameLsa(const ndn::Name& key);
akmhoque53353462014-04-22 08:43:45 -050080
Nick G97e34942016-07-11 14:46:27 -050081 /*! \brief Installs a name LSA into the LSDB
82 \param nlsa The name LSA to install into the LSDB.
83 */
akmhoque53353462014-04-22 08:43:45 -050084 bool
akmhoque31d1d4b2014-05-05 22:08:14 -050085 installNameLsa(NameLsa& nlsa);
akmhoque53353462014-04-22 08:43:45 -050086
Nick G97e34942016-07-11 14:46:27 -050087 /*! \brief Remove a name LSA from the LSDB.
88 \param key The name of the router that published the LSA to remove.
89
90 This function will remove a name LSA from the LSDB by finding an
91 LSA whose name matches key. This removal also causes the NPT to
92 remove those name prefixes if no more LSAs advertise them.
93 */
akmhoque53353462014-04-22 08:43:45 -050094 bool
akmhoque31d1d4b2014-05-05 22:08:14 -050095 removeNameLsa(const ndn::Name& key);
akmhoque53353462014-04-22 08:43:45 -050096
Nick G97e34942016-07-11 14:46:27 -050097 /*! Returns whether a seq. no. from a certain router signals a new LSA.
98 \param key The name of the originating router.
99 \param seqNo The sequence number to check.
100 */
akmhoque53353462014-04-22 08:43:45 -0500101 bool
akmhoque31d1d4b2014-05-05 22:08:14 -0500102 isNameLsaNew(const ndn::Name& key, uint64_t seqNo);
akmhoque53353462014-04-22 08:43:45 -0500103
104 void
akmhoque2f423352014-06-03 11:49:35 -0500105 writeNameLsdbLog();
akmhoque53353462014-04-22 08:43:45 -0500106
Jiewen Tana0497d82015-02-02 21:59:18 -0800107 const std::list<NameLsa>&
108 getNameLsdb();
109
Nick G97e34942016-07-11 14:46:27 -0500110 /*! \brief Builds a cor. LSA for this router and installs it into the LSDB. */
akmhoque53353462014-04-22 08:43:45 -0500111 bool
akmhoque31d1d4b2014-05-05 22:08:14 -0500112 buildAndInstallOwnCoordinateLsa();
akmhoque53353462014-04-22 08:43:45 -0500113
Nick G97e34942016-07-11 14:46:27 -0500114 /*! \brief Finds a cor. LSA in the LSDB.
115 \param key The name of the originating router that published the LSA.
116 */
akmhoqueb6450b12014-04-24 00:01:03 -0500117 CoordinateLsa*
akmhoque31d1d4b2014-05-05 22:08:14 -0500118 findCoordinateLsa(const ndn::Name& key);
akmhoque53353462014-04-22 08:43:45 -0500119
Nick G97e34942016-07-11 14:46:27 -0500120 /*! \brief Installs a cor. LSA into the LSDB.
121 \param clsa The cor. LSA to install.
122 */
akmhoque53353462014-04-22 08:43:45 -0500123 bool
akmhoque31d1d4b2014-05-05 22:08:14 -0500124 installCoordinateLsa(CoordinateLsa& clsa);
akmhoque53353462014-04-22 08:43:45 -0500125
Nick G97e34942016-07-11 14:46:27 -0500126 /*! \brief Removes a cor. LSA from the LSDB.
127 \param key The name of the router that published the LSA to remove.
128
129 Removes the coordinate LSA whose origin router name matches that
130 given by key. Additionally, ask the NPT to remove the prefix,
131 which will occur if no other LSAs point there.
132 */
akmhoque53353462014-04-22 08:43:45 -0500133 bool
akmhoque31d1d4b2014-05-05 22:08:14 -0500134 removeCoordinateLsa(const ndn::Name& key);
akmhoque53353462014-04-22 08:43:45 -0500135
Nick G97e34942016-07-11 14:46:27 -0500136 /*! \brief Returns whether a cor. LSA from a router is new or not.
137 \param key The name prefix of the originating router.
138 \param seqNo The sequence number of the candidate LSA.
139 */
akmhoque53353462014-04-22 08:43:45 -0500140 bool
akmhoque31d1d4b2014-05-05 22:08:14 -0500141 isCoordinateLsaNew(const ndn::Name& key, uint64_t seqNo);
akmhoque53353462014-04-22 08:43:45 -0500142
143 void
akmhoque2f423352014-06-03 11:49:35 -0500144 writeCorLsdbLog();
akmhoque53353462014-04-22 08:43:45 -0500145
Jiewen Tana0497d82015-02-02 21:59:18 -0800146 const std::list<CoordinateLsa>&
147 getCoordinateLsdb();
148
Nick G97e34942016-07-11 14:46:27 -0500149 //function related to Adj LSDB
150
151 /*! \brief Schedules a build of this router's LSA. */
akmhoque53353462014-04-22 08:43:45 -0500152 void
Vince Lehman50df6b72015-03-03 12:06:40 -0600153 scheduleAdjLsaBuild();
akmhoque53353462014-04-22 08:43:45 -0500154
Nick G97e34942016-07-11 14:46:27 -0500155 /*! \brief Wrapper event to build and install an adj. LSA for this router. */
akmhoque53353462014-04-22 08:43:45 -0500156 bool
akmhoque31d1d4b2014-05-05 22:08:14 -0500157 buildAndInstallOwnAdjLsa();
akmhoque53353462014-04-22 08:43:45 -0500158
Nick G97e34942016-07-11 14:46:27 -0500159 /*! \brief Removes an adj. LSA from the LSDB.
160 \param key The name of the publishing router whose LSA to remove.
161 */
akmhoque53353462014-04-22 08:43:45 -0500162 bool
akmhoque31d1d4b2014-05-05 22:08:14 -0500163 removeAdjLsa(const ndn::Name& key);
akmhoque53353462014-04-22 08:43:45 -0500164
Nick G97e34942016-07-11 14:46:27 -0500165 /*! \brief Returns whether an LSA is new.
166 \param key The name of the publishing router.
167 \param seqNo The seq. no. of the candidate LSA.
168
169 This function determines whether the LSA with the name key and
170 seq. no. seqNo would be new to this LSDB.
171 */
akmhoque53353462014-04-22 08:43:45 -0500172 bool
akmhoque31d1d4b2014-05-05 22:08:14 -0500173 isAdjLsaNew(const ndn::Name& key, uint64_t seqNo);
Jiewen Tana0497d82015-02-02 21:59:18 -0800174
Nick G97e34942016-07-11 14:46:27 -0500175 /*! \brief Installs an adj. LSA into the LSDB.
176 \param alsa The adj. LSA to add to the LSDB.
177 */
akmhoque53353462014-04-22 08:43:45 -0500178 bool
akmhoque31d1d4b2014-05-05 22:08:14 -0500179 installAdjLsa(AdjLsa& alsa);
akmhoque53353462014-04-22 08:43:45 -0500180
Nick G97e34942016-07-11 14:46:27 -0500181 /*! \brief Finds an adj. LSA in the LSDB.
182 \param key The name of the publishing router whose LSA to find.
183 */
akmhoqueb6450b12014-04-24 00:01:03 -0500184 AdjLsa*
akmhoque31d1d4b2014-05-05 22:08:14 -0500185 findAdjLsa(const ndn::Name& key);
akmhoque53353462014-04-22 08:43:45 -0500186
Jiewen Tana0497d82015-02-02 21:59:18 -0800187 const std::list<AdjLsa>&
akmhoque53353462014-04-22 08:43:45 -0500188 getAdjLsdb();
189
190 void
Vince Lehman50df6b72015-03-03 12:06:40 -0600191 setAdjLsaBuildInterval(uint32_t interval)
192 {
193 m_adjLsaBuildInterval = ndn::time::seconds(interval);
194 }
195
196 const ndn::time::seconds&
197 getAdjLsaBuildInterval() const
198 {
199 return m_adjLsaBuildInterval;
200 }
201
Ashlesh Gawande3e105a02017-05-16 17:36:56 -0500202 SequencingManager&
203 getSequencingManager()
204 {
205 return m_sequencingManager;
206 }
207
Vince Lehman50df6b72015-03-03 12:06:40 -0600208 void
akmhoque2f423352014-06-03 11:49:35 -0500209 writeAdjLsdbLog();
akmhoque53353462014-04-22 08:43:45 -0500210
akmhoque53353462014-04-22 08:43:45 -0500211 void
Nick Gordone98480b2017-05-24 11:23:03 -0500212 setLsaRefreshTime(const ndn::time::seconds& lsaRefreshTime);
akmhoque53353462014-04-22 08:43:45 -0500213
214 void
215 setThisRouterPrefix(std::string trp);
216
Muktadir R Chowdhuryaa3b0852015-08-06 13:08:56 -0500217 void
218 expressInterest(const ndn::Name& interestName, uint32_t timeoutCount,
Nick Gordone98480b2017-05-24 11:23:03 -0500219 ndn::time::steady_clock::TimePoint deadline = DEFAULT_LSA_RETRIEVAL_DEADLINE);
Muktadir R Chowdhuryaa3b0852015-08-06 13:08:56 -0500220
221 void
222 processInterest(const ndn::Name& name, const ndn::Interest& interest);
223
akmhoque53353462014-04-22 08:43:45 -0500224private:
Nick G97e34942016-07-11 14:46:27 -0500225 /* \brief Add a name LSA to the LSDB if it isn't already there.
226 \param nlsa The candidade name LSA.
227 */
akmhoque53353462014-04-22 08:43:45 -0500228 bool
229 addNameLsa(NameLsa& nlsa);
230
Nick G97e34942016-07-11 14:46:27 -0500231 /*! \brief Returns whether the LSDB contains some LSA.
232 \param key The name of the publishing router whose LSA to check for.
233 */
akmhoque53353462014-04-22 08:43:45 -0500234 bool
akmhoque31d1d4b2014-05-05 22:08:14 -0500235 doesNameLsaExist(const ndn::Name& key);
akmhoque53353462014-04-22 08:43:45 -0500236
Nick G97e34942016-07-11 14:46:27 -0500237 /*! \brief Adds a cor. LSA to the LSDB if it isn't already there.
238 \param clsa The candidate cor. LSA.
239 */
akmhoque53353462014-04-22 08:43:45 -0500240 bool
akmhoqueb6450b12014-04-24 00:01:03 -0500241 addCoordinateLsa(CoordinateLsa& clsa);
akmhoque53353462014-04-22 08:43:45 -0500242
Nick G97e34942016-07-11 14:46:27 -0500243 /*! \brief Returns whether a cor. LSA is in the LSDB.
244 \param key The name of the router that published the queried LSA.
245 */
akmhoque53353462014-04-22 08:43:45 -0500246 bool
akmhoque31d1d4b2014-05-05 22:08:14 -0500247 doesCoordinateLsaExist(const ndn::Name& key);
akmhoque53353462014-04-22 08:43:45 -0500248
Nick G97e34942016-07-11 14:46:27 -0500249 /*! \brief Attempts to construct an adj. LSA.
250
251 This function will attempt to construct an adjacency LSA. An LSA
252 can only be built when the status of all of the router's neighbors
253 is known. That is, when we are not currently trying to contact any
254 neighbor.
255 */
Vince Lehman50df6b72015-03-03 12:06:40 -0600256 void
257 buildAdjLsa();
258
Nick G97e34942016-07-11 14:46:27 -0500259 /*! \brief Adds an adj. LSA to the LSDB if it isn't already there.
260 \param alsa The candidate adj. LSA to add to the LSDB.
261 */
akmhoque53353462014-04-22 08:43:45 -0500262 bool
263 addAdjLsa(AdjLsa& alsa);
264
Nick G97e34942016-07-11 14:46:27 -0500265 /*! \brief Returns whether the LSDB contains an LSA.
266 \param key The name of a router whose LSA to check for in the LSDB.
267 */
akmhoque53353462014-04-22 08:43:45 -0500268 bool
akmhoque31d1d4b2014-05-05 22:08:14 -0500269 doesAdjLsaExist(const ndn::Name& key);
akmhoque53353462014-04-22 08:43:45 -0500270
Nick G97e34942016-07-11 14:46:27 -0500271 /*! \brief Schedules a refresh/expire event in the scheduler.
272 \param key The name of the router that published the LSA.
273 \param seqNo The seq. no. associated with the LSA.
274 \param expTime How many seconds to wait before triggering the event.
275 */
akmhoque53353462014-04-22 08:43:45 -0500276 ndn::EventId
akmhoquec7a79b22014-05-26 08:06:19 -0500277 scheduleNameLsaExpiration(const ndn::Name& key, int seqNo,
Nick Gordone98480b2017-05-24 11:23:03 -0500278 const ndn::time::seconds& expTime);
akmhoque53353462014-04-22 08:43:45 -0500279
Nick G97e34942016-07-11 14:46:27 -0500280 /*! \brief Either allow to expire, or refresh a name LSA.
281 \param lsaKey The name of the router that published the LSA.
282 \param seqNo The seq. no. of the LSA to check.
283 */
akmhoque53353462014-04-22 08:43:45 -0500284 void
Ashlesh Gawande90173ad2017-08-09 15:19:50 -0500285 expireOrRefreshNameLsa(const ndn::Name& lsaKey, uint64_t seqNo);
akmhoque53353462014-04-22 08:43:45 -0500286
Vince Lehman199e9cf2015-04-07 13:22:16 -0500287PUBLIC_WITH_TESTS_ELSE_PRIVATE:
Nick G97e34942016-07-11 14:46:27 -0500288 /*! \brief Schedules an expire/refresh event in the LSA.
289 \param key The name of the router whose LSA is in question.
290 \param seqNo The sequence number of the LSA to check.
291 \param expTime The number of seconds to wait before triggering the event.
292 */
akmhoque53353462014-04-22 08:43:45 -0500293 ndn::EventId
akmhoquec7a79b22014-05-26 08:06:19 -0500294 scheduleAdjLsaExpiration(const ndn::Name& key, int seqNo,
Nick Gordone98480b2017-05-24 11:23:03 -0500295 const ndn::time::seconds& expTime);
akmhoque53353462014-04-22 08:43:45 -0500296
Vince Lehman199e9cf2015-04-07 13:22:16 -0500297private:
Nick G97e34942016-07-11 14:46:27 -0500298
akmhoque53353462014-04-22 08:43:45 -0500299 void
Ashlesh Gawande90173ad2017-08-09 15:19:50 -0500300 expireOrRefreshAdjLsa(const ndn::Name& lsaKey, uint64_t seqNo);
akmhoque53353462014-04-22 08:43:45 -0500301
302 ndn::EventId
akmhoque31d1d4b2014-05-05 22:08:14 -0500303 scheduleCoordinateLsaExpiration(const ndn::Name& key, int seqNo,
Nick Gordone98480b2017-05-24 11:23:03 -0500304 const ndn::time::seconds& expTime);
akmhoque53353462014-04-22 08:43:45 -0500305
306 void
Ashlesh Gawande90173ad2017-08-09 15:19:50 -0500307 expireOrRefreshCoordinateLsa(const ndn::Name& lsaKey,
akmhoqueb6450b12014-04-24 00:01:03 -0500308 uint64_t seqNo);
akmhoque53353462014-04-22 08:43:45 -0500309
Nick G97e34942016-07-11 14:46:27 -0500310private:
311
akmhoque31d1d4b2014-05-05 22:08:14 -0500312 void
akmhoque69c9aa92014-07-23 15:15:05 -0500313 putLsaData(const ndn::Interest& interest, const std::string& content);
314
315 void
akmhoque31d1d4b2014-05-05 22:08:14 -0500316 processInterestForNameLsa(const ndn::Interest& interest,
317 const ndn::Name& lsaKey,
Ashlesh Gawande5bf83172014-09-19 12:38:17 -0500318 uint64_t seqNo);
akmhoque53353462014-04-22 08:43:45 -0500319
akmhoque31d1d4b2014-05-05 22:08:14 -0500320 void
321 processInterestForAdjacencyLsa(const ndn::Interest& interest,
322 const ndn::Name& lsaKey,
Ashlesh Gawande5bf83172014-09-19 12:38:17 -0500323 uint64_t seqNo);
akmhoque31d1d4b2014-05-05 22:08:14 -0500324
325 void
326 processInterestForCoordinateLsa(const ndn::Interest& interest,
327 const ndn::Name& lsaKey,
Ashlesh Gawande5bf83172014-09-19 12:38:17 -0500328 uint64_t seqNo);
akmhoque31d1d4b2014-05-05 22:08:14 -0500329 void
dmcoomes9f936662017-03-02 10:33:09 -0600330 onContentValidated(const std::shared_ptr<const ndn::Data>& data);
Yingdi Yu20e3a6e2014-05-26 23:16:10 -0700331
332 void
akmhoque31d1d4b2014-05-05 22:08:14 -0500333 processContentNameLsa(const ndn::Name& lsaKey,
Ashlesh Gawande5bf83172014-09-19 12:38:17 -0500334 uint64_t lsSeqNo, std::string& dataContent);
akmhoque31d1d4b2014-05-05 22:08:14 -0500335
336 void
337 processContentAdjacencyLsa(const ndn::Name& lsaKey,
Ashlesh Gawande5bf83172014-09-19 12:38:17 -0500338 uint64_t lsSeqNo, std::string& dataContent);
akmhoque31d1d4b2014-05-05 22:08:14 -0500339
340 void
341 processContentCoordinateLsa(const ndn::Name& lsaKey,
Ashlesh Gawande5bf83172014-09-19 12:38:17 -0500342 uint64_t lsSeqNo, std::string& dataContent);
akmhoque31d1d4b2014-05-05 22:08:14 -0500343
Ashlesh Gawande5bf83172014-09-19 12:38:17 -0500344PUBLIC_WITH_TESTS_ELSE_PRIVATE:
Nick G97e34942016-07-11 14:46:27 -0500345 /*!
346 \brief Error callback when SegmentFetcher fails to return an LSA
347
348 In all error cases, a reattempt to fetch the LSA will be made.
349
350 Segment validation can fail either because the packet does not have a
351 valid signature (fatal) or because some of the certificates in the trust chain
352 could not be fetched (non-fatal).
353
354 Currently, the library does not provide clear indication (besides a plain-text message
355 in the error callback) of the reason for the failure nor the segment that failed
356 to be validated, thus we will continue to try to fetch the LSA until the deadline
357 is reached.
Muktadir R Chowdhuryaa3b0852015-08-06 13:08:56 -0500358 */
akmhoque31d1d4b2014-05-05 22:08:14 -0500359 void
Muktadir R Chowdhuryaa3b0852015-08-06 13:08:56 -0500360 onFetchLsaError(uint32_t errorCode,
361 const std::string& msg,
362 ndn::Name& interestName,
363 uint32_t retransmitNo,
364 const ndn::time::steady_clock::TimePoint& deadline,
365 ndn::Name lsaName,
366 uint64_t seqNo);
367
Nick G97e34942016-07-11 14:46:27 -0500368 /*!
369 \brief Success callback when SegmentFetcher returns a valid LSA
370
Nick Gordonb50e51b2016-07-22 16:05:57 -0500371 \param interestName The base Interest used to fetch the LSA in the format:
Nick G97e34942016-07-11 14:46:27 -0500372 /<network>/NLSR/LSA/<site>/%C1.Router/<router>/<lsa-type>/<seqNo>
Muktadir R Chowdhuryaa3b0852015-08-06 13:08:56 -0500373 */
374 void
375 afterFetchLsa(const ndn::ConstBufferPtr& data, ndn::Name& interestName);
akmhoque31d1d4b2014-05-05 22:08:14 -0500376
Ashlesh Gawande5bf83172014-09-19 12:38:17 -0500377private:
Nick Gordone98480b2017-05-24 11:23:03 -0500378 ndn::time::system_clock::TimePoint
akmhoquec7a79b22014-05-26 08:06:19 -0500379 getLsaExpirationTimePoint();
380
Nick G97e34942016-07-11 14:46:27 -0500381 /*! \brief Cancels an event in the event scheduler. */
akmhoque31d1d4b2014-05-05 22:08:14 -0500382 void
383 cancelScheduleLsaExpiringEvent(ndn::EventId eid);
384
Jiewen Tana0497d82015-02-02 21:59:18 -0800385public:
386 static const ndn::Name::Component NAME_COMPONENT;
387
Alejandro Gil Torrese0d20482016-03-06 23:56:19 -0600388 ndn::util::signal::Signal<Lsdb, Statistics::PacketType> lsaIncrementSignal;
389
Ashlesh Gawande5bf83172014-09-19 12:38:17 -0500390private:
akmhoque31d1d4b2014-05-05 22:08:14 -0500391 Nlsr& m_nlsr;
Vince Lehman7c603292014-09-11 17:48:16 -0500392 ndn::Scheduler& m_scheduler;
Ashlesh Gawande3e105a02017-05-16 17:36:56 -0500393 SyncLogicHandler m_sync;
Vince Lehman7c603292014-09-11 17:48:16 -0500394
akmhoque53353462014-04-22 08:43:45 -0500395 std::list<NameLsa> m_nameLsdb;
396 std::list<AdjLsa> m_adjLsdb;
akmhoqueb6450b12014-04-24 00:01:03 -0500397 std::list<CoordinateLsa> m_corLsdb;
akmhoque53353462014-04-22 08:43:45 -0500398
Nick Gordone98480b2017-05-24 11:23:03 -0500399 ndn::time::seconds m_lsaRefreshTime;
akmhoque53353462014-04-22 08:43:45 -0500400 std::string m_thisRouterPrefix;
401
Ashlesh Gawande5bf83172014-09-19 12:38:17 -0500402 typedef std::map<ndn::Name, uint64_t> SequenceNumberMap;
403
404 // Maps the name of an LSA to its highest known sequence number from sync;
405 // Used to stop NLSR from trying to fetch outdated LSAs
406 SequenceNumberMap m_highestSeqNo;
407
Vince Lehman18841082014-08-19 17:15:24 -0500408 static const ndn::time::seconds GRACE_PERIOD;
Nick Gordone98480b2017-05-24 11:23:03 -0500409 static const ndn::time::steady_clock::TimePoint DEFAULT_LSA_RETRIEVAL_DEADLINE;
Vince Lehman50df6b72015-03-03 12:06:40 -0600410
411 ndn::time::seconds m_adjLsaBuildInterval;
Ashlesh Gawande3e105a02017-05-16 17:36:56 -0500412
413 SequencingManager m_sequencingManager;
akmhoque53353462014-04-22 08:43:45 -0500414};
415
Nick Gordonfad8e252016-08-11 14:21:38 -0500416} // namespace nlsr
akmhoque53353462014-04-22 08:43:45 -0500417
dmcoomes9f936662017-03-02 10:33:09 -0600418#endif // NLSR_LSDB_HPP