blob: bb0b9d839085a8621b1fc9dbcc00a0bf2a27beda [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
akmhoque53353462014-04-22 08:43:45 -050045namespace nlsr {
Alexander Afanasyev411ee4b2014-08-16 23:17:03 -070046
47using namespace ndn::time;
48
akmhoque53353462014-04-22 08:43:45 -050049class Nlsr;
50
51class Lsdb
52{
53public:
Ashlesh Gawande3e105a02017-05-16 17:36:56 -050054 Lsdb(Nlsr& nlsr, ndn::Scheduler& scheduler);
55
56 SyncLogicHandler&
57 getSyncLogicHandler()
58 {
59 return m_sync;
60 }
akmhoque53353462014-04-22 08:43:45 -050061
akmhoque53353462014-04-22 08:43:45 -050062 bool
akmhoque31d1d4b2014-05-05 22:08:14 -050063 doesLsaExist(const ndn::Name& key, const std::string& lsType);
akmhoque53353462014-04-22 08:43:45 -050064
Nick G97e34942016-07-11 14:46:27 -050065
66 /*! \brief Builds a name LSA for this router and then installs it
67 into the LSDB.
68 */
akmhoque53353462014-04-22 08:43:45 -050069 bool
akmhoque31d1d4b2014-05-05 22:08:14 -050070 buildAndInstallOwnNameLsa();
akmhoque53353462014-04-22 08:43:45 -050071
Nick G97e34942016-07-11 14:46:27 -050072 /*! \brief Returns the name LSA with the given key.
73 \param key The name of the router that the desired LSA comes from.
74 */
akmhoqueb6450b12014-04-24 00:01:03 -050075 NameLsa*
akmhoque31d1d4b2014-05-05 22:08:14 -050076 findNameLsa(const ndn::Name& key);
akmhoque53353462014-04-22 08:43:45 -050077
Nick G97e34942016-07-11 14:46:27 -050078 /*! \brief Installs a name LSA into the LSDB
79 \param nlsa The name LSA to install into the LSDB.
80 */
akmhoque53353462014-04-22 08:43:45 -050081 bool
akmhoque31d1d4b2014-05-05 22:08:14 -050082 installNameLsa(NameLsa& nlsa);
akmhoque53353462014-04-22 08:43:45 -050083
Nick G97e34942016-07-11 14:46:27 -050084 /*! \brief Remove a name LSA from the LSDB.
85 \param key The name of the router that published the LSA to remove.
86
87 This function will remove a name LSA from the LSDB by finding an
88 LSA whose name matches key. This removal also causes the NPT to
89 remove those name prefixes if no more LSAs advertise them.
90 */
akmhoque53353462014-04-22 08:43:45 -050091 bool
akmhoque31d1d4b2014-05-05 22:08:14 -050092 removeNameLsa(const ndn::Name& key);
akmhoque53353462014-04-22 08:43:45 -050093
Nick G97e34942016-07-11 14:46:27 -050094 /*! Returns whether a seq. no. from a certain router signals a new LSA.
95 \param key The name of the originating router.
96 \param seqNo The sequence number to check.
97 */
akmhoque53353462014-04-22 08:43:45 -050098 bool
akmhoque31d1d4b2014-05-05 22:08:14 -050099 isNameLsaNew(const ndn::Name& key, uint64_t seqNo);
akmhoque53353462014-04-22 08:43:45 -0500100
101 void
akmhoque2f423352014-06-03 11:49:35 -0500102 writeNameLsdbLog();
akmhoque53353462014-04-22 08:43:45 -0500103
Jiewen Tana0497d82015-02-02 21:59:18 -0800104 const std::list<NameLsa>&
105 getNameLsdb();
106
Nick G97e34942016-07-11 14:46:27 -0500107 /*! \brief Builds a cor. LSA for this router and installs it into the LSDB. */
akmhoque53353462014-04-22 08:43:45 -0500108 bool
akmhoque31d1d4b2014-05-05 22:08:14 -0500109 buildAndInstallOwnCoordinateLsa();
akmhoque53353462014-04-22 08:43:45 -0500110
Nick G97e34942016-07-11 14:46:27 -0500111 /*! \brief Finds a cor. LSA in the LSDB.
112 \param key The name of the originating router that published the LSA.
113 */
akmhoqueb6450b12014-04-24 00:01:03 -0500114 CoordinateLsa*
akmhoque31d1d4b2014-05-05 22:08:14 -0500115 findCoordinateLsa(const ndn::Name& key);
akmhoque53353462014-04-22 08:43:45 -0500116
Nick G97e34942016-07-11 14:46:27 -0500117 /*! \brief Installs a cor. LSA into the LSDB.
118 \param clsa The cor. LSA to install.
119 */
akmhoque53353462014-04-22 08:43:45 -0500120 bool
akmhoque31d1d4b2014-05-05 22:08:14 -0500121 installCoordinateLsa(CoordinateLsa& clsa);
akmhoque53353462014-04-22 08:43:45 -0500122
Nick G97e34942016-07-11 14:46:27 -0500123 /*! \brief Removes a cor. LSA from the LSDB.
124 \param key The name of the router that published the LSA to remove.
125
126 Removes the coordinate LSA whose origin router name matches that
127 given by key. Additionally, ask the NPT to remove the prefix,
128 which will occur if no other LSAs point there.
129 */
akmhoque53353462014-04-22 08:43:45 -0500130 bool
akmhoque31d1d4b2014-05-05 22:08:14 -0500131 removeCoordinateLsa(const ndn::Name& key);
akmhoque53353462014-04-22 08:43:45 -0500132
Nick G97e34942016-07-11 14:46:27 -0500133 /*! \brief Returns whether a cor. LSA from a router is new or not.
134 \param key The name prefix of the originating router.
135 \param seqNo The sequence number of the candidate LSA.
136 */
akmhoque53353462014-04-22 08:43:45 -0500137 bool
akmhoque31d1d4b2014-05-05 22:08:14 -0500138 isCoordinateLsaNew(const ndn::Name& key, uint64_t seqNo);
akmhoque53353462014-04-22 08:43:45 -0500139
140 void
akmhoque2f423352014-06-03 11:49:35 -0500141 writeCorLsdbLog();
akmhoque53353462014-04-22 08:43:45 -0500142
Jiewen Tana0497d82015-02-02 21:59:18 -0800143 const std::list<CoordinateLsa>&
144 getCoordinateLsdb();
145
Nick G97e34942016-07-11 14:46:27 -0500146 //function related to Adj LSDB
147
148 /*! \brief Schedules a build of this router's LSA. */
akmhoque53353462014-04-22 08:43:45 -0500149 void
Vince Lehman50df6b72015-03-03 12:06:40 -0600150 scheduleAdjLsaBuild();
akmhoque53353462014-04-22 08:43:45 -0500151
Nick G97e34942016-07-11 14:46:27 -0500152 /*! \brief Wrapper event to build and install an adj. LSA for this router. */
akmhoque53353462014-04-22 08:43:45 -0500153 bool
akmhoque31d1d4b2014-05-05 22:08:14 -0500154 buildAndInstallOwnAdjLsa();
akmhoque53353462014-04-22 08:43:45 -0500155
Nick G97e34942016-07-11 14:46:27 -0500156 /*! \brief Removes an adj. LSA from the LSDB.
157 \param key The name of the publishing router whose LSA to remove.
158 */
akmhoque53353462014-04-22 08:43:45 -0500159 bool
akmhoque31d1d4b2014-05-05 22:08:14 -0500160 removeAdjLsa(const ndn::Name& key);
akmhoque53353462014-04-22 08:43:45 -0500161
Nick G97e34942016-07-11 14:46:27 -0500162 /*! \brief Returns whether an LSA is new.
163 \param key The name of the publishing router.
164 \param seqNo The seq. no. of the candidate LSA.
165
166 This function determines whether the LSA with the name key and
167 seq. no. seqNo would be new to this LSDB.
168 */
akmhoque53353462014-04-22 08:43:45 -0500169 bool
akmhoque31d1d4b2014-05-05 22:08:14 -0500170 isAdjLsaNew(const ndn::Name& key, uint64_t seqNo);
Jiewen Tana0497d82015-02-02 21:59:18 -0800171
Nick G97e34942016-07-11 14:46:27 -0500172 /*! \brief Installs an adj. LSA into the LSDB.
173 \param alsa The adj. LSA to add to the LSDB.
174 */
akmhoque53353462014-04-22 08:43:45 -0500175 bool
akmhoque31d1d4b2014-05-05 22:08:14 -0500176 installAdjLsa(AdjLsa& alsa);
akmhoque53353462014-04-22 08:43:45 -0500177
Nick G97e34942016-07-11 14:46:27 -0500178 /*! \brief Finds an adj. LSA in the LSDB.
179 \param key The name of the publishing router whose LSA to find.
180 */
akmhoqueb6450b12014-04-24 00:01:03 -0500181 AdjLsa*
akmhoque31d1d4b2014-05-05 22:08:14 -0500182 findAdjLsa(const ndn::Name& key);
akmhoque53353462014-04-22 08:43:45 -0500183
Jiewen Tana0497d82015-02-02 21:59:18 -0800184 const std::list<AdjLsa>&
akmhoque53353462014-04-22 08:43:45 -0500185 getAdjLsdb();
186
187 void
Vince Lehman50df6b72015-03-03 12:06:40 -0600188 setAdjLsaBuildInterval(uint32_t interval)
189 {
190 m_adjLsaBuildInterval = ndn::time::seconds(interval);
191 }
192
193 const ndn::time::seconds&
194 getAdjLsaBuildInterval() const
195 {
196 return m_adjLsaBuildInterval;
197 }
198
Ashlesh Gawande3e105a02017-05-16 17:36:56 -0500199 SequencingManager&
200 getSequencingManager()
201 {
202 return m_sequencingManager;
203 }
204
Vince Lehman50df6b72015-03-03 12:06:40 -0600205 void
akmhoque2f423352014-06-03 11:49:35 -0500206 writeAdjLsdbLog();
akmhoque53353462014-04-22 08:43:45 -0500207
akmhoque53353462014-04-22 08:43:45 -0500208 void
Alexander Afanasyev411ee4b2014-08-16 23:17:03 -0700209 setLsaRefreshTime(const seconds& lsaRefreshTime);
akmhoque53353462014-04-22 08:43:45 -0500210
211 void
212 setThisRouterPrefix(std::string trp);
213
Muktadir R Chowdhuryaa3b0852015-08-06 13:08:56 -0500214 void
215 expressInterest(const ndn::Name& interestName, uint32_t timeoutCount,
216 steady_clock::TimePoint deadline = DEFAULT_LSA_RETRIEVAL_DEADLINE);
217
218 void
219 processInterest(const ndn::Name& name, const ndn::Interest& interest);
220
akmhoque53353462014-04-22 08:43:45 -0500221private:
Nick G97e34942016-07-11 14:46:27 -0500222 /* \brief Add a name LSA to the LSDB if it isn't already there.
223 \param nlsa The candidade name LSA.
224 */
akmhoque53353462014-04-22 08:43:45 -0500225 bool
226 addNameLsa(NameLsa& nlsa);
227
Nick G97e34942016-07-11 14:46:27 -0500228 /*! \brief Returns whether the LSDB contains some LSA.
229 \param key The name of the publishing router whose LSA to check for.
230 */
akmhoque53353462014-04-22 08:43:45 -0500231 bool
akmhoque31d1d4b2014-05-05 22:08:14 -0500232 doesNameLsaExist(const ndn::Name& key);
akmhoque53353462014-04-22 08:43:45 -0500233
Nick G97e34942016-07-11 14:46:27 -0500234 /*! \brief Adds a cor. LSA to the LSDB if it isn't already there.
235 \param clsa The candidate cor. LSA.
236 */
akmhoque53353462014-04-22 08:43:45 -0500237 bool
akmhoqueb6450b12014-04-24 00:01:03 -0500238 addCoordinateLsa(CoordinateLsa& clsa);
akmhoque53353462014-04-22 08:43:45 -0500239
Nick G97e34942016-07-11 14:46:27 -0500240 /*! \brief Returns whether a cor. LSA is in the LSDB.
241 \param key The name of the router that published the queried LSA.
242 */
akmhoque53353462014-04-22 08:43:45 -0500243 bool
akmhoque31d1d4b2014-05-05 22:08:14 -0500244 doesCoordinateLsaExist(const ndn::Name& key);
akmhoque53353462014-04-22 08:43:45 -0500245
Nick G97e34942016-07-11 14:46:27 -0500246 /*! \brief Attempts to construct an adj. LSA.
247
248 This function will attempt to construct an adjacency LSA. An LSA
249 can only be built when the status of all of the router's neighbors
250 is known. That is, when we are not currently trying to contact any
251 neighbor.
252 */
Vince Lehman50df6b72015-03-03 12:06:40 -0600253 void
254 buildAdjLsa();
255
Nick G97e34942016-07-11 14:46:27 -0500256 /*! \brief Adds an adj. LSA to the LSDB if it isn't already there.
257 \param alsa The candidate adj. LSA to add to the LSDB.
258 */
akmhoque53353462014-04-22 08:43:45 -0500259 bool
260 addAdjLsa(AdjLsa& alsa);
261
Nick G97e34942016-07-11 14:46:27 -0500262 /*! \brief Returns whether the LSDB contains an LSA.
263 \param key The name of a router whose LSA to check for in the LSDB.
264 */
akmhoque53353462014-04-22 08:43:45 -0500265 bool
akmhoque31d1d4b2014-05-05 22:08:14 -0500266 doesAdjLsaExist(const ndn::Name& key);
akmhoque53353462014-04-22 08:43:45 -0500267
Nick G97e34942016-07-11 14:46:27 -0500268 /*! \brief Schedules a refresh/expire event in the scheduler.
269 \param key The name of the router that published the LSA.
270 \param seqNo The seq. no. associated with the LSA.
271 \param expTime How many seconds to wait before triggering the event.
272 */
akmhoque53353462014-04-22 08:43:45 -0500273 ndn::EventId
akmhoquec7a79b22014-05-26 08:06:19 -0500274 scheduleNameLsaExpiration(const ndn::Name& key, int seqNo,
Alexander Afanasyev411ee4b2014-08-16 23:17:03 -0700275 const seconds& expTime);
akmhoque53353462014-04-22 08:43:45 -0500276
Nick G97e34942016-07-11 14:46:27 -0500277 /*! \brief Either allow to expire, or refresh a name LSA.
278 \param lsaKey The name of the router that published the LSA.
279 \param seqNo The seq. no. of the LSA to check.
280 */
akmhoque53353462014-04-22 08:43:45 -0500281 void
Ashlesh Gawande90173ad2017-08-09 15:19:50 -0500282 expireOrRefreshNameLsa(const ndn::Name& lsaKey, uint64_t seqNo);
akmhoque53353462014-04-22 08:43:45 -0500283
Vince Lehman199e9cf2015-04-07 13:22:16 -0500284PUBLIC_WITH_TESTS_ELSE_PRIVATE:
Nick G97e34942016-07-11 14:46:27 -0500285 /*! \brief Schedules an expire/refresh event in the LSA.
286 \param key The name of the router whose LSA is in question.
287 \param seqNo The sequence number of the LSA to check.
288 \param expTime The number of seconds to wait before triggering the event.
289 */
akmhoque53353462014-04-22 08:43:45 -0500290 ndn::EventId
akmhoquec7a79b22014-05-26 08:06:19 -0500291 scheduleAdjLsaExpiration(const ndn::Name& key, int seqNo,
Alexander Afanasyev411ee4b2014-08-16 23:17:03 -0700292 const seconds& expTime);
akmhoque53353462014-04-22 08:43:45 -0500293
Vince Lehman199e9cf2015-04-07 13:22:16 -0500294private:
Nick G97e34942016-07-11 14:46:27 -0500295
akmhoque53353462014-04-22 08:43:45 -0500296 void
Ashlesh Gawande90173ad2017-08-09 15:19:50 -0500297 expireOrRefreshAdjLsa(const ndn::Name& lsaKey, uint64_t seqNo);
akmhoque53353462014-04-22 08:43:45 -0500298
299 ndn::EventId
akmhoque31d1d4b2014-05-05 22:08:14 -0500300 scheduleCoordinateLsaExpiration(const ndn::Name& key, int seqNo,
Alexander Afanasyev411ee4b2014-08-16 23:17:03 -0700301 const seconds& expTime);
akmhoque53353462014-04-22 08:43:45 -0500302
303 void
Ashlesh Gawande90173ad2017-08-09 15:19:50 -0500304 expireOrRefreshCoordinateLsa(const ndn::Name& lsaKey,
akmhoqueb6450b12014-04-24 00:01:03 -0500305 uint64_t seqNo);
akmhoque53353462014-04-22 08:43:45 -0500306
Nick G97e34942016-07-11 14:46:27 -0500307private:
308
akmhoque31d1d4b2014-05-05 22:08:14 -0500309 void
akmhoque69c9aa92014-07-23 15:15:05 -0500310 putLsaData(const ndn::Interest& interest, const std::string& content);
311
312 void
akmhoque31d1d4b2014-05-05 22:08:14 -0500313 processInterestForNameLsa(const ndn::Interest& interest,
314 const ndn::Name& lsaKey,
Ashlesh Gawande5bf83172014-09-19 12:38:17 -0500315 uint64_t seqNo);
akmhoque53353462014-04-22 08:43:45 -0500316
akmhoque31d1d4b2014-05-05 22:08:14 -0500317 void
318 processInterestForAdjacencyLsa(const ndn::Interest& interest,
319 const ndn::Name& lsaKey,
Ashlesh Gawande5bf83172014-09-19 12:38:17 -0500320 uint64_t seqNo);
akmhoque31d1d4b2014-05-05 22:08:14 -0500321
322 void
323 processInterestForCoordinateLsa(const ndn::Interest& interest,
324 const ndn::Name& lsaKey,
Ashlesh Gawande5bf83172014-09-19 12:38:17 -0500325 uint64_t seqNo);
akmhoque31d1d4b2014-05-05 22:08:14 -0500326 void
dmcoomes9f936662017-03-02 10:33:09 -0600327 onContentValidated(const std::shared_ptr<const ndn::Data>& data);
Yingdi Yu20e3a6e2014-05-26 23:16:10 -0700328
329 void
akmhoque31d1d4b2014-05-05 22:08:14 -0500330 processContentNameLsa(const ndn::Name& lsaKey,
Ashlesh Gawande5bf83172014-09-19 12:38:17 -0500331 uint64_t lsSeqNo, std::string& dataContent);
akmhoque31d1d4b2014-05-05 22:08:14 -0500332
333 void
334 processContentAdjacencyLsa(const ndn::Name& lsaKey,
Ashlesh Gawande5bf83172014-09-19 12:38:17 -0500335 uint64_t lsSeqNo, std::string& dataContent);
akmhoque31d1d4b2014-05-05 22:08:14 -0500336
337 void
338 processContentCoordinateLsa(const ndn::Name& lsaKey,
Ashlesh Gawande5bf83172014-09-19 12:38:17 -0500339 uint64_t lsSeqNo, std::string& dataContent);
akmhoque31d1d4b2014-05-05 22:08:14 -0500340
Ashlesh Gawande5bf83172014-09-19 12:38:17 -0500341PUBLIC_WITH_TESTS_ELSE_PRIVATE:
Nick G97e34942016-07-11 14:46:27 -0500342 /*!
343 \brief Error callback when SegmentFetcher fails to return an LSA
344
345 In all error cases, a reattempt to fetch the LSA will be made.
346
347 Segment validation can fail either because the packet does not have a
348 valid signature (fatal) or because some of the certificates in the trust chain
349 could not be fetched (non-fatal).
350
351 Currently, the library does not provide clear indication (besides a plain-text message
352 in the error callback) of the reason for the failure nor the segment that failed
353 to be validated, thus we will continue to try to fetch the LSA until the deadline
354 is reached.
Muktadir R Chowdhuryaa3b0852015-08-06 13:08:56 -0500355 */
akmhoque31d1d4b2014-05-05 22:08:14 -0500356 void
Muktadir R Chowdhuryaa3b0852015-08-06 13:08:56 -0500357 onFetchLsaError(uint32_t errorCode,
358 const std::string& msg,
359 ndn::Name& interestName,
360 uint32_t retransmitNo,
361 const ndn::time::steady_clock::TimePoint& deadline,
362 ndn::Name lsaName,
363 uint64_t seqNo);
364
Nick G97e34942016-07-11 14:46:27 -0500365 /*!
366 \brief Success callback when SegmentFetcher returns a valid LSA
367
Nick Gordonb50e51b2016-07-22 16:05:57 -0500368 \param interestName The base Interest used to fetch the LSA in the format:
Nick G97e34942016-07-11 14:46:27 -0500369 /<network>/NLSR/LSA/<site>/%C1.Router/<router>/<lsa-type>/<seqNo>
Muktadir R Chowdhuryaa3b0852015-08-06 13:08:56 -0500370 */
371 void
372 afterFetchLsa(const ndn::ConstBufferPtr& data, ndn::Name& interestName);
akmhoque31d1d4b2014-05-05 22:08:14 -0500373
Ashlesh Gawande5bf83172014-09-19 12:38:17 -0500374private:
Alexander Afanasyev411ee4b2014-08-16 23:17:03 -0700375 system_clock::TimePoint
akmhoquec7a79b22014-05-26 08:06:19 -0500376 getLsaExpirationTimePoint();
377
Nick G97e34942016-07-11 14:46:27 -0500378 /*! \brief Cancels an event in the event scheduler. */
akmhoque31d1d4b2014-05-05 22:08:14 -0500379 void
380 cancelScheduleLsaExpiringEvent(ndn::EventId eid);
381
Jiewen Tana0497d82015-02-02 21:59:18 -0800382public:
383 static const ndn::Name::Component NAME_COMPONENT;
384
Alejandro Gil Torrese0d20482016-03-06 23:56:19 -0600385 ndn::util::signal::Signal<Lsdb, Statistics::PacketType> lsaIncrementSignal;
386
Ashlesh Gawande5bf83172014-09-19 12:38:17 -0500387private:
akmhoque31d1d4b2014-05-05 22:08:14 -0500388 Nlsr& m_nlsr;
Vince Lehman7c603292014-09-11 17:48:16 -0500389 ndn::Scheduler& m_scheduler;
Ashlesh Gawande3e105a02017-05-16 17:36:56 -0500390 SyncLogicHandler m_sync;
Vince Lehman7c603292014-09-11 17:48:16 -0500391
akmhoque53353462014-04-22 08:43:45 -0500392 std::list<NameLsa> m_nameLsdb;
393 std::list<AdjLsa> m_adjLsdb;
akmhoqueb6450b12014-04-24 00:01:03 -0500394 std::list<CoordinateLsa> m_corLsdb;
akmhoque53353462014-04-22 08:43:45 -0500395
Alexander Afanasyev411ee4b2014-08-16 23:17:03 -0700396 seconds m_lsaRefreshTime;
akmhoque53353462014-04-22 08:43:45 -0500397 std::string m_thisRouterPrefix;
398
Ashlesh Gawande5bf83172014-09-19 12:38:17 -0500399 typedef std::map<ndn::Name, uint64_t> SequenceNumberMap;
400
401 // Maps the name of an LSA to its highest known sequence number from sync;
402 // Used to stop NLSR from trying to fetch outdated LSAs
403 SequenceNumberMap m_highestSeqNo;
404
Vince Lehman18841082014-08-19 17:15:24 -0500405 static const ndn::time::seconds GRACE_PERIOD;
Ashlesh Gawande5bf83172014-09-19 12:38:17 -0500406 static const steady_clock::TimePoint DEFAULT_LSA_RETRIEVAL_DEADLINE;
Vince Lehman50df6b72015-03-03 12:06:40 -0600407
408 ndn::time::seconds m_adjLsaBuildInterval;
Ashlesh Gawande3e105a02017-05-16 17:36:56 -0500409
410 SequencingManager m_sequencingManager;
akmhoque53353462014-04-22 08:43:45 -0500411};
412
Nick Gordonfad8e252016-08-11 14:21:38 -0500413} // namespace nlsr
akmhoque53353462014-04-22 08:43:45 -0500414
dmcoomes9f936662017-03-02 10:33:09 -0600415#endif // NLSR_LSDB_HPP