blob: 042d7278a34d42aa1581b20571492ebe2c47e71b [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>
Alejandro Gil Torrese0d20482016-03-06 23:56:19 -060035#include <utility>
36#include <boost/cstdint.hpp>
akmhoque53353462014-04-22 08:43:45 -050037
Nick Gordone98480b2017-05-24 11:23:03 -050038namespace nlsr {
Alexander Afanasyev411ee4b2014-08-16 23:17:03 -070039
akmhoque53353462014-04-22 08:43:45 -050040class Nlsr;
41
42class Lsdb
43{
44public:
Ashlesh Gawande3e105a02017-05-16 17:36:56 -050045 Lsdb(Nlsr& nlsr, ndn::Scheduler& scheduler);
46
47 SyncLogicHandler&
48 getSyncLogicHandler()
49 {
50 return m_sync;
51 }
akmhoque53353462014-04-22 08:43:45 -050052
akmhoque53353462014-04-22 08:43:45 -050053 bool
akmhoque31d1d4b2014-05-05 22:08:14 -050054 doesLsaExist(const ndn::Name& key, const std::string& lsType);
akmhoque53353462014-04-22 08:43:45 -050055
Nick G97e34942016-07-11 14:46:27 -050056
57 /*! \brief Builds a name LSA for this router and then installs it
58 into the LSDB.
59 */
akmhoque53353462014-04-22 08:43:45 -050060 bool
akmhoque31d1d4b2014-05-05 22:08:14 -050061 buildAndInstallOwnNameLsa();
akmhoque53353462014-04-22 08:43:45 -050062
Nick G97e34942016-07-11 14:46:27 -050063 /*! \brief Returns the name LSA with the given key.
64 \param key The name of the router that the desired LSA comes from.
65 */
akmhoqueb6450b12014-04-24 00:01:03 -050066 NameLsa*
akmhoque31d1d4b2014-05-05 22:08:14 -050067 findNameLsa(const ndn::Name& key);
akmhoque53353462014-04-22 08:43:45 -050068
Nick G97e34942016-07-11 14:46:27 -050069 /*! \brief Installs a name LSA into the LSDB
70 \param nlsa The name LSA to install into the LSDB.
71 */
akmhoque53353462014-04-22 08:43:45 -050072 bool
akmhoque31d1d4b2014-05-05 22:08:14 -050073 installNameLsa(NameLsa& nlsa);
akmhoque53353462014-04-22 08:43:45 -050074
Nick G97e34942016-07-11 14:46:27 -050075 /*! \brief Remove a name LSA from the LSDB.
76 \param key The name of the router that published the LSA to remove.
77
78 This function will remove a name LSA from the LSDB by finding an
79 LSA whose name matches key. This removal also causes the NPT to
80 remove those name prefixes if no more LSAs advertise them.
81 */
akmhoque53353462014-04-22 08:43:45 -050082 bool
akmhoque31d1d4b2014-05-05 22:08:14 -050083 removeNameLsa(const ndn::Name& key);
akmhoque53353462014-04-22 08:43:45 -050084
Nick G97e34942016-07-11 14:46:27 -050085 /*! Returns whether a seq. no. from a certain router signals a new LSA.
86 \param key The name of the originating router.
87 \param seqNo The sequence number to check.
88 */
akmhoque53353462014-04-22 08:43:45 -050089 bool
akmhoque31d1d4b2014-05-05 22:08:14 -050090 isNameLsaNew(const ndn::Name& key, uint64_t seqNo);
akmhoque53353462014-04-22 08:43:45 -050091
92 void
akmhoque2f423352014-06-03 11:49:35 -050093 writeNameLsdbLog();
akmhoque53353462014-04-22 08:43:45 -050094
Jiewen Tana0497d82015-02-02 21:59:18 -080095 const std::list<NameLsa>&
96 getNameLsdb();
97
Nick G97e34942016-07-11 14:46:27 -050098 /*! \brief Builds a cor. LSA for this router and installs it into the LSDB. */
akmhoque53353462014-04-22 08:43:45 -050099 bool
akmhoque31d1d4b2014-05-05 22:08:14 -0500100 buildAndInstallOwnCoordinateLsa();
akmhoque53353462014-04-22 08:43:45 -0500101
Nick G97e34942016-07-11 14:46:27 -0500102 /*! \brief Finds a cor. LSA in the LSDB.
103 \param key The name of the originating router that published the LSA.
104 */
akmhoqueb6450b12014-04-24 00:01:03 -0500105 CoordinateLsa*
akmhoque31d1d4b2014-05-05 22:08:14 -0500106 findCoordinateLsa(const ndn::Name& key);
akmhoque53353462014-04-22 08:43:45 -0500107
Nick G97e34942016-07-11 14:46:27 -0500108 /*! \brief Installs a cor. LSA into the LSDB.
109 \param clsa The cor. LSA to install.
110 */
akmhoque53353462014-04-22 08:43:45 -0500111 bool
akmhoque31d1d4b2014-05-05 22:08:14 -0500112 installCoordinateLsa(CoordinateLsa& clsa);
akmhoque53353462014-04-22 08:43:45 -0500113
Nick G97e34942016-07-11 14:46:27 -0500114 /*! \brief Removes a cor. LSA from the LSDB.
115 \param key The name of the router that published the LSA to remove.
116
117 Removes the coordinate LSA whose origin router name matches that
118 given by key. Additionally, ask the NPT to remove the prefix,
119 which will occur if no other LSAs point there.
120 */
akmhoque53353462014-04-22 08:43:45 -0500121 bool
akmhoque31d1d4b2014-05-05 22:08:14 -0500122 removeCoordinateLsa(const ndn::Name& key);
akmhoque53353462014-04-22 08:43:45 -0500123
Nick G97e34942016-07-11 14:46:27 -0500124 /*! \brief Returns whether a cor. LSA from a router is new or not.
125 \param key The name prefix of the originating router.
126 \param seqNo The sequence number of the candidate LSA.
127 */
akmhoque53353462014-04-22 08:43:45 -0500128 bool
akmhoque31d1d4b2014-05-05 22:08:14 -0500129 isCoordinateLsaNew(const ndn::Name& key, uint64_t seqNo);
akmhoque53353462014-04-22 08:43:45 -0500130
131 void
akmhoque2f423352014-06-03 11:49:35 -0500132 writeCorLsdbLog();
akmhoque53353462014-04-22 08:43:45 -0500133
Jiewen Tana0497d82015-02-02 21:59:18 -0800134 const std::list<CoordinateLsa>&
135 getCoordinateLsdb();
136
Nick G97e34942016-07-11 14:46:27 -0500137 //function related to Adj LSDB
138
139 /*! \brief Schedules a build of this router's LSA. */
akmhoque53353462014-04-22 08:43:45 -0500140 void
Vince Lehman50df6b72015-03-03 12:06:40 -0600141 scheduleAdjLsaBuild();
akmhoque53353462014-04-22 08:43:45 -0500142
Nick G97e34942016-07-11 14:46:27 -0500143 /*! \brief Wrapper event to build and install an adj. LSA for this router. */
akmhoque53353462014-04-22 08:43:45 -0500144 bool
akmhoque31d1d4b2014-05-05 22:08:14 -0500145 buildAndInstallOwnAdjLsa();
akmhoque53353462014-04-22 08:43:45 -0500146
Nick G97e34942016-07-11 14:46:27 -0500147 /*! \brief Removes an adj. LSA from the LSDB.
148 \param key The name of the publishing router whose LSA to remove.
149 */
akmhoque53353462014-04-22 08:43:45 -0500150 bool
akmhoque31d1d4b2014-05-05 22:08:14 -0500151 removeAdjLsa(const ndn::Name& key);
akmhoque53353462014-04-22 08:43:45 -0500152
Nick G97e34942016-07-11 14:46:27 -0500153 /*! \brief Returns whether an LSA is new.
154 \param key The name of the publishing router.
155 \param seqNo The seq. no. of the candidate LSA.
156
157 This function determines whether the LSA with the name key and
158 seq. no. seqNo would be new to this LSDB.
159 */
akmhoque53353462014-04-22 08:43:45 -0500160 bool
akmhoque31d1d4b2014-05-05 22:08:14 -0500161 isAdjLsaNew(const ndn::Name& key, uint64_t seqNo);
Jiewen Tana0497d82015-02-02 21:59:18 -0800162
Nick G97e34942016-07-11 14:46:27 -0500163 /*! \brief Installs an adj. LSA into the LSDB.
164 \param alsa The adj. LSA to add to the LSDB.
165 */
akmhoque53353462014-04-22 08:43:45 -0500166 bool
akmhoque31d1d4b2014-05-05 22:08:14 -0500167 installAdjLsa(AdjLsa& alsa);
akmhoque53353462014-04-22 08:43:45 -0500168
Nick G97e34942016-07-11 14:46:27 -0500169 /*! \brief Finds an adj. LSA in the LSDB.
170 \param key The name of the publishing router whose LSA to find.
171 */
akmhoqueb6450b12014-04-24 00:01:03 -0500172 AdjLsa*
akmhoque31d1d4b2014-05-05 22:08:14 -0500173 findAdjLsa(const ndn::Name& key);
akmhoque53353462014-04-22 08:43:45 -0500174
Jiewen Tana0497d82015-02-02 21:59:18 -0800175 const std::list<AdjLsa>&
akmhoque53353462014-04-22 08:43:45 -0500176 getAdjLsdb();
177
178 void
Vince Lehman50df6b72015-03-03 12:06:40 -0600179 setAdjLsaBuildInterval(uint32_t interval)
180 {
181 m_adjLsaBuildInterval = ndn::time::seconds(interval);
182 }
183
184 const ndn::time::seconds&
185 getAdjLsaBuildInterval() const
186 {
187 return m_adjLsaBuildInterval;
188 }
189
Ashlesh Gawande3e105a02017-05-16 17:36:56 -0500190 SequencingManager&
191 getSequencingManager()
192 {
193 return m_sequencingManager;
194 }
195
Vince Lehman50df6b72015-03-03 12:06:40 -0600196 void
akmhoque2f423352014-06-03 11:49:35 -0500197 writeAdjLsdbLog();
akmhoque53353462014-04-22 08:43:45 -0500198
akmhoque53353462014-04-22 08:43:45 -0500199 void
Nick Gordone98480b2017-05-24 11:23:03 -0500200 setLsaRefreshTime(const ndn::time::seconds& lsaRefreshTime);
akmhoque53353462014-04-22 08:43:45 -0500201
202 void
203 setThisRouterPrefix(std::string trp);
204
Muktadir R Chowdhuryaa3b0852015-08-06 13:08:56 -0500205 void
206 expressInterest(const ndn::Name& interestName, uint32_t timeoutCount,
Nick Gordone98480b2017-05-24 11:23:03 -0500207 ndn::time::steady_clock::TimePoint deadline = DEFAULT_LSA_RETRIEVAL_DEADLINE);
Muktadir R Chowdhuryaa3b0852015-08-06 13:08:56 -0500208
209 void
210 processInterest(const ndn::Name& name, const ndn::Interest& interest);
211
akmhoque53353462014-04-22 08:43:45 -0500212private:
Nick G97e34942016-07-11 14:46:27 -0500213 /* \brief Add a name LSA to the LSDB if it isn't already there.
214 \param nlsa The candidade name LSA.
215 */
akmhoque53353462014-04-22 08:43:45 -0500216 bool
217 addNameLsa(NameLsa& nlsa);
218
Nick G97e34942016-07-11 14:46:27 -0500219 /*! \brief Returns whether the LSDB contains some LSA.
220 \param key The name of the publishing router whose LSA to check for.
221 */
akmhoque53353462014-04-22 08:43:45 -0500222 bool
akmhoque31d1d4b2014-05-05 22:08:14 -0500223 doesNameLsaExist(const ndn::Name& key);
akmhoque53353462014-04-22 08:43:45 -0500224
Nick G97e34942016-07-11 14:46:27 -0500225 /*! \brief Adds a cor. LSA to the LSDB if it isn't already there.
226 \param clsa The candidate cor. LSA.
227 */
akmhoque53353462014-04-22 08:43:45 -0500228 bool
akmhoqueb6450b12014-04-24 00:01:03 -0500229 addCoordinateLsa(CoordinateLsa& clsa);
akmhoque53353462014-04-22 08:43:45 -0500230
Nick G97e34942016-07-11 14:46:27 -0500231 /*! \brief Returns whether a cor. LSA is in the LSDB.
232 \param key The name of the router that published the queried LSA.
233 */
akmhoque53353462014-04-22 08:43:45 -0500234 bool
akmhoque31d1d4b2014-05-05 22:08:14 -0500235 doesCoordinateLsaExist(const ndn::Name& key);
akmhoque53353462014-04-22 08:43:45 -0500236
Nick G97e34942016-07-11 14:46:27 -0500237 /*! \brief Attempts to construct an adj. LSA.
238
239 This function will attempt to construct an adjacency LSA. An LSA
240 can only be built when the status of all of the router's neighbors
241 is known. That is, when we are not currently trying to contact any
242 neighbor.
243 */
Vince Lehman50df6b72015-03-03 12:06:40 -0600244 void
245 buildAdjLsa();
246
Nick G97e34942016-07-11 14:46:27 -0500247 /*! \brief Adds an adj. LSA to the LSDB if it isn't already there.
248 \param alsa The candidate adj. LSA to add to the LSDB.
249 */
akmhoque53353462014-04-22 08:43:45 -0500250 bool
251 addAdjLsa(AdjLsa& alsa);
252
Nick G97e34942016-07-11 14:46:27 -0500253 /*! \brief Returns whether the LSDB contains an LSA.
254 \param key The name of a router whose LSA to check for in the LSDB.
255 */
akmhoque53353462014-04-22 08:43:45 -0500256 bool
akmhoque31d1d4b2014-05-05 22:08:14 -0500257 doesAdjLsaExist(const ndn::Name& key);
akmhoque53353462014-04-22 08:43:45 -0500258
Nick G97e34942016-07-11 14:46:27 -0500259 /*! \brief Schedules a refresh/expire event in the scheduler.
260 \param key The name of the router that published the LSA.
261 \param seqNo The seq. no. associated with the LSA.
262 \param expTime How many seconds to wait before triggering the event.
263 */
akmhoque53353462014-04-22 08:43:45 -0500264 ndn::EventId
akmhoquec7a79b22014-05-26 08:06:19 -0500265 scheduleNameLsaExpiration(const ndn::Name& key, int seqNo,
Nick Gordone98480b2017-05-24 11:23:03 -0500266 const ndn::time::seconds& expTime);
akmhoque53353462014-04-22 08:43:45 -0500267
Nick G97e34942016-07-11 14:46:27 -0500268 /*! \brief Either allow to expire, or refresh a name LSA.
269 \param lsaKey The name of the router that published the LSA.
270 \param seqNo The seq. no. of the LSA to check.
271 */
akmhoque53353462014-04-22 08:43:45 -0500272 void
Ashlesh Gawande90173ad2017-08-09 15:19:50 -0500273 expireOrRefreshNameLsa(const ndn::Name& lsaKey, uint64_t seqNo);
akmhoque53353462014-04-22 08:43:45 -0500274
Vince Lehman199e9cf2015-04-07 13:22:16 -0500275PUBLIC_WITH_TESTS_ELSE_PRIVATE:
Nick G97e34942016-07-11 14:46:27 -0500276 /*! \brief Schedules an expire/refresh event in the LSA.
277 \param key The name of the router whose LSA is in question.
278 \param seqNo The sequence number of the LSA to check.
279 \param expTime The number of seconds to wait before triggering the event.
280 */
akmhoque53353462014-04-22 08:43:45 -0500281 ndn::EventId
akmhoquec7a79b22014-05-26 08:06:19 -0500282 scheduleAdjLsaExpiration(const ndn::Name& key, int seqNo,
Nick Gordone98480b2017-05-24 11:23:03 -0500283 const ndn::time::seconds& expTime);
akmhoque53353462014-04-22 08:43:45 -0500284
Vince Lehman199e9cf2015-04-07 13:22:16 -0500285private:
Nick G97e34942016-07-11 14:46:27 -0500286
akmhoque53353462014-04-22 08:43:45 -0500287 void
Ashlesh Gawande90173ad2017-08-09 15:19:50 -0500288 expireOrRefreshAdjLsa(const ndn::Name& lsaKey, uint64_t seqNo);
akmhoque53353462014-04-22 08:43:45 -0500289
290 ndn::EventId
akmhoque31d1d4b2014-05-05 22:08:14 -0500291 scheduleCoordinateLsaExpiration(const ndn::Name& key, int seqNo,
Nick Gordone98480b2017-05-24 11:23:03 -0500292 const ndn::time::seconds& expTime);
akmhoque53353462014-04-22 08:43:45 -0500293
294 void
Ashlesh Gawande90173ad2017-08-09 15:19:50 -0500295 expireOrRefreshCoordinateLsa(const ndn::Name& lsaKey,
akmhoqueb6450b12014-04-24 00:01:03 -0500296 uint64_t seqNo);
akmhoque53353462014-04-22 08:43:45 -0500297
Nick G97e34942016-07-11 14:46:27 -0500298private:
299
akmhoque31d1d4b2014-05-05 22:08:14 -0500300 void
akmhoque69c9aa92014-07-23 15:15:05 -0500301 putLsaData(const ndn::Interest& interest, const std::string& content);
302
303 void
akmhoque31d1d4b2014-05-05 22:08:14 -0500304 processInterestForNameLsa(const ndn::Interest& interest,
305 const ndn::Name& lsaKey,
Ashlesh Gawande5bf83172014-09-19 12:38:17 -0500306 uint64_t seqNo);
akmhoque53353462014-04-22 08:43:45 -0500307
akmhoque31d1d4b2014-05-05 22:08:14 -0500308 void
309 processInterestForAdjacencyLsa(const ndn::Interest& interest,
310 const ndn::Name& lsaKey,
Ashlesh Gawande5bf83172014-09-19 12:38:17 -0500311 uint64_t seqNo);
akmhoque31d1d4b2014-05-05 22:08:14 -0500312
313 void
314 processInterestForCoordinateLsa(const ndn::Interest& interest,
315 const ndn::Name& lsaKey,
Ashlesh Gawande5bf83172014-09-19 12:38:17 -0500316 uint64_t seqNo);
akmhoque31d1d4b2014-05-05 22:08:14 -0500317 void
dmcoomes9f936662017-03-02 10:33:09 -0600318 onContentValidated(const std::shared_ptr<const ndn::Data>& data);
Yingdi Yu20e3a6e2014-05-26 23:16:10 -0700319
320 void
akmhoque31d1d4b2014-05-05 22:08:14 -0500321 processContentNameLsa(const ndn::Name& lsaKey,
Ashlesh Gawande5bf83172014-09-19 12:38:17 -0500322 uint64_t lsSeqNo, std::string& dataContent);
akmhoque31d1d4b2014-05-05 22:08:14 -0500323
324 void
325 processContentAdjacencyLsa(const ndn::Name& lsaKey,
Ashlesh Gawande5bf83172014-09-19 12:38:17 -0500326 uint64_t lsSeqNo, std::string& dataContent);
akmhoque31d1d4b2014-05-05 22:08:14 -0500327
328 void
329 processContentCoordinateLsa(const ndn::Name& lsaKey,
Ashlesh Gawande5bf83172014-09-19 12:38:17 -0500330 uint64_t lsSeqNo, std::string& dataContent);
akmhoque31d1d4b2014-05-05 22:08:14 -0500331
Ashlesh Gawande5bf83172014-09-19 12:38:17 -0500332PUBLIC_WITH_TESTS_ELSE_PRIVATE:
Nick G97e34942016-07-11 14:46:27 -0500333 /*!
334 \brief Error callback when SegmentFetcher fails to return an LSA
335
336 In all error cases, a reattempt to fetch the LSA will be made.
337
338 Segment validation can fail either because the packet does not have a
339 valid signature (fatal) or because some of the certificates in the trust chain
340 could not be fetched (non-fatal).
341
342 Currently, the library does not provide clear indication (besides a plain-text message
343 in the error callback) of the reason for the failure nor the segment that failed
344 to be validated, thus we will continue to try to fetch the LSA until the deadline
345 is reached.
Muktadir R Chowdhuryaa3b0852015-08-06 13:08:56 -0500346 */
akmhoque31d1d4b2014-05-05 22:08:14 -0500347 void
Muktadir R Chowdhuryaa3b0852015-08-06 13:08:56 -0500348 onFetchLsaError(uint32_t errorCode,
349 const std::string& msg,
350 ndn::Name& interestName,
351 uint32_t retransmitNo,
352 const ndn::time::steady_clock::TimePoint& deadline,
353 ndn::Name lsaName,
354 uint64_t seqNo);
355
Nick G97e34942016-07-11 14:46:27 -0500356 /*!
357 \brief Success callback when SegmentFetcher returns a valid LSA
358
Nick Gordonb50e51b2016-07-22 16:05:57 -0500359 \param interestName The base Interest used to fetch the LSA in the format:
Nick G97e34942016-07-11 14:46:27 -0500360 /<network>/NLSR/LSA/<site>/%C1.Router/<router>/<lsa-type>/<seqNo>
Muktadir R Chowdhuryaa3b0852015-08-06 13:08:56 -0500361 */
362 void
363 afterFetchLsa(const ndn::ConstBufferPtr& data, ndn::Name& interestName);
akmhoque31d1d4b2014-05-05 22:08:14 -0500364
Ashlesh Gawande5bf83172014-09-19 12:38:17 -0500365private:
Nick Gordone98480b2017-05-24 11:23:03 -0500366 ndn::time::system_clock::TimePoint
akmhoquec7a79b22014-05-26 08:06:19 -0500367 getLsaExpirationTimePoint();
368
Nick G97e34942016-07-11 14:46:27 -0500369 /*! \brief Cancels an event in the event scheduler. */
akmhoque31d1d4b2014-05-05 22:08:14 -0500370 void
371 cancelScheduleLsaExpiringEvent(ndn::EventId eid);
372
Jiewen Tana0497d82015-02-02 21:59:18 -0800373public:
374 static const ndn::Name::Component NAME_COMPONENT;
375
Alejandro Gil Torrese0d20482016-03-06 23:56:19 -0600376 ndn::util::signal::Signal<Lsdb, Statistics::PacketType> lsaIncrementSignal;
377
Ashlesh Gawande5bf83172014-09-19 12:38:17 -0500378private:
akmhoque31d1d4b2014-05-05 22:08:14 -0500379 Nlsr& m_nlsr;
Vince Lehman7c603292014-09-11 17:48:16 -0500380 ndn::Scheduler& m_scheduler;
Ashlesh Gawande3e105a02017-05-16 17:36:56 -0500381 SyncLogicHandler m_sync;
Vince Lehman7c603292014-09-11 17:48:16 -0500382
akmhoque53353462014-04-22 08:43:45 -0500383 std::list<NameLsa> m_nameLsdb;
384 std::list<AdjLsa> m_adjLsdb;
akmhoqueb6450b12014-04-24 00:01:03 -0500385 std::list<CoordinateLsa> m_corLsdb;
akmhoque53353462014-04-22 08:43:45 -0500386
Nick Gordone98480b2017-05-24 11:23:03 -0500387 ndn::time::seconds m_lsaRefreshTime;
akmhoque53353462014-04-22 08:43:45 -0500388 std::string m_thisRouterPrefix;
389
Ashlesh Gawande5bf83172014-09-19 12:38:17 -0500390 typedef std::map<ndn::Name, uint64_t> SequenceNumberMap;
391
392 // Maps the name of an LSA to its highest known sequence number from sync;
393 // Used to stop NLSR from trying to fetch outdated LSAs
394 SequenceNumberMap m_highestSeqNo;
395
Vince Lehman18841082014-08-19 17:15:24 -0500396 static const ndn::time::seconds GRACE_PERIOD;
Nick Gordone98480b2017-05-24 11:23:03 -0500397 static const ndn::time::steady_clock::TimePoint DEFAULT_LSA_RETRIEVAL_DEADLINE;
Vince Lehman50df6b72015-03-03 12:06:40 -0600398
399 ndn::time::seconds m_adjLsaBuildInterval;
Ashlesh Gawande3e105a02017-05-16 17:36:56 -0500400
401 SequencingManager m_sequencingManager;
Nick Gordon9eac4d92017-08-29 17:31:29 -0500402
403 ndn::util::signal::ScopedConnection m_onNewLsaConnection;
404
akmhoque53353462014-04-22 08:43:45 -0500405};
406
Nick Gordonfad8e252016-08-11 14:21:38 -0500407} // namespace nlsr
akmhoque53353462014-04-22 08:43:45 -0500408
dmcoomes9f936662017-03-02 10:33:09 -0600409#endif // NLSR_LSDB_HPP