blob: 45742427c8fbd0ad53b7742c167a53c68f9586d5 [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
Nick Gordon8f23b5d2017-08-31 17:53:07 -050054 isLsaNew(const ndn::Name& routerName, const std::string& lsaType, const uint64_t& sequenceNumber);
akmhoque53353462014-04-22 08:43:45 -050055
Nick Gordon8f23b5d2017-08-31 17:53:07 -050056 bool
57 doesLsaExist(const ndn::Name& key, const std::string& lsType);
Nick G97e34942016-07-11 14:46:27 -050058
59 /*! \brief Builds a name LSA for this router and then installs it
60 into the LSDB.
61 */
akmhoque53353462014-04-22 08:43:45 -050062 bool
akmhoque31d1d4b2014-05-05 22:08:14 -050063 buildAndInstallOwnNameLsa();
akmhoque53353462014-04-22 08:43:45 -050064
Nick G97e34942016-07-11 14:46:27 -050065 /*! \brief Returns the name LSA with the given key.
66 \param key The name of the router that the desired LSA comes from.
67 */
akmhoqueb6450b12014-04-24 00:01:03 -050068 NameLsa*
akmhoque31d1d4b2014-05-05 22:08:14 -050069 findNameLsa(const ndn::Name& key);
akmhoque53353462014-04-22 08:43:45 -050070
Nick G97e34942016-07-11 14:46:27 -050071 /*! \brief Installs a name LSA into the LSDB
72 \param nlsa The name LSA to install into the LSDB.
73 */
akmhoque53353462014-04-22 08:43:45 -050074 bool
akmhoque31d1d4b2014-05-05 22:08:14 -050075 installNameLsa(NameLsa& nlsa);
akmhoque53353462014-04-22 08:43:45 -050076
Nick G97e34942016-07-11 14:46:27 -050077 /*! \brief Remove a name LSA from the LSDB.
78 \param key The name of the router that published the LSA to remove.
79
80 This function will remove a name LSA from the LSDB by finding an
81 LSA whose name matches key. This removal also causes the NPT to
82 remove those name prefixes if no more LSAs advertise them.
83 */
akmhoque53353462014-04-22 08:43:45 -050084 bool
akmhoque31d1d4b2014-05-05 22:08:14 -050085 removeNameLsa(const ndn::Name& key);
akmhoque53353462014-04-22 08:43:45 -050086
Nick G97e34942016-07-11 14:46:27 -050087 /*! Returns whether a seq. no. from a certain router signals a new LSA.
88 \param key The name of the originating router.
89 \param seqNo The sequence number to check.
90 */
akmhoque53353462014-04-22 08:43:45 -050091 bool
akmhoque31d1d4b2014-05-05 22:08:14 -050092 isNameLsaNew(const ndn::Name& key, uint64_t seqNo);
akmhoque53353462014-04-22 08:43:45 -050093
94 void
akmhoque2f423352014-06-03 11:49:35 -050095 writeNameLsdbLog();
akmhoque53353462014-04-22 08:43:45 -050096
Jiewen Tana0497d82015-02-02 21:59:18 -080097 const std::list<NameLsa>&
98 getNameLsdb();
99
Nick G97e34942016-07-11 14:46:27 -0500100 /*! \brief Builds a cor. LSA for this router and installs it into the LSDB. */
akmhoque53353462014-04-22 08:43:45 -0500101 bool
akmhoque31d1d4b2014-05-05 22:08:14 -0500102 buildAndInstallOwnCoordinateLsa();
akmhoque53353462014-04-22 08:43:45 -0500103
Nick G97e34942016-07-11 14:46:27 -0500104 /*! \brief Finds a cor. LSA in the LSDB.
105 \param key The name of the originating router that published the LSA.
106 */
akmhoqueb6450b12014-04-24 00:01:03 -0500107 CoordinateLsa*
akmhoque31d1d4b2014-05-05 22:08:14 -0500108 findCoordinateLsa(const ndn::Name& key);
akmhoque53353462014-04-22 08:43:45 -0500109
Nick G97e34942016-07-11 14:46:27 -0500110 /*! \brief Installs a cor. LSA into the LSDB.
111 \param clsa The cor. LSA to install.
112 */
akmhoque53353462014-04-22 08:43:45 -0500113 bool
akmhoque31d1d4b2014-05-05 22:08:14 -0500114 installCoordinateLsa(CoordinateLsa& clsa);
akmhoque53353462014-04-22 08:43:45 -0500115
Nick G97e34942016-07-11 14:46:27 -0500116 /*! \brief Removes a cor. LSA from the LSDB.
117 \param key The name of the router that published the LSA to remove.
118
119 Removes the coordinate LSA whose origin router name matches that
120 given by key. Additionally, ask the NPT to remove the prefix,
121 which will occur if no other LSAs point there.
122 */
akmhoque53353462014-04-22 08:43:45 -0500123 bool
akmhoque31d1d4b2014-05-05 22:08:14 -0500124 removeCoordinateLsa(const ndn::Name& key);
akmhoque53353462014-04-22 08:43:45 -0500125
Nick G97e34942016-07-11 14:46:27 -0500126 /*! \brief Returns whether a cor. LSA from a router is new or not.
127 \param key The name prefix of the originating router.
128 \param seqNo The sequence number of the candidate LSA.
129 */
akmhoque53353462014-04-22 08:43:45 -0500130 bool
akmhoque31d1d4b2014-05-05 22:08:14 -0500131 isCoordinateLsaNew(const ndn::Name& key, uint64_t seqNo);
akmhoque53353462014-04-22 08:43:45 -0500132
133 void
akmhoque2f423352014-06-03 11:49:35 -0500134 writeCorLsdbLog();
akmhoque53353462014-04-22 08:43:45 -0500135
Jiewen Tana0497d82015-02-02 21:59:18 -0800136 const std::list<CoordinateLsa>&
137 getCoordinateLsdb();
138
Nick G97e34942016-07-11 14:46:27 -0500139 //function related to Adj LSDB
140
141 /*! \brief Schedules a build of this router's LSA. */
akmhoque53353462014-04-22 08:43:45 -0500142 void
Vince Lehman50df6b72015-03-03 12:06:40 -0600143 scheduleAdjLsaBuild();
akmhoque53353462014-04-22 08:43:45 -0500144
Nick G97e34942016-07-11 14:46:27 -0500145 /*! \brief Wrapper event to build and install an adj. LSA for this router. */
akmhoque53353462014-04-22 08:43:45 -0500146 bool
akmhoque31d1d4b2014-05-05 22:08:14 -0500147 buildAndInstallOwnAdjLsa();
akmhoque53353462014-04-22 08:43:45 -0500148
Nick G97e34942016-07-11 14:46:27 -0500149 /*! \brief Removes an adj. LSA from the LSDB.
150 \param key The name of the publishing router whose LSA to remove.
151 */
akmhoque53353462014-04-22 08:43:45 -0500152 bool
akmhoque31d1d4b2014-05-05 22:08:14 -0500153 removeAdjLsa(const ndn::Name& key);
akmhoque53353462014-04-22 08:43:45 -0500154
Nick G97e34942016-07-11 14:46:27 -0500155 /*! \brief Returns whether an LSA is new.
156 \param key The name of the publishing router.
157 \param seqNo The seq. no. of the candidate LSA.
158
159 This function determines whether the LSA with the name key and
160 seq. no. seqNo would be new to this LSDB.
161 */
akmhoque53353462014-04-22 08:43:45 -0500162 bool
akmhoque31d1d4b2014-05-05 22:08:14 -0500163 isAdjLsaNew(const ndn::Name& key, uint64_t seqNo);
Jiewen Tana0497d82015-02-02 21:59:18 -0800164
Nick G97e34942016-07-11 14:46:27 -0500165 /*! \brief Installs an adj. LSA into the LSDB.
166 \param alsa The adj. LSA to add to the LSDB.
167 */
akmhoque53353462014-04-22 08:43:45 -0500168 bool
akmhoque31d1d4b2014-05-05 22:08:14 -0500169 installAdjLsa(AdjLsa& alsa);
akmhoque53353462014-04-22 08:43:45 -0500170
Nick G97e34942016-07-11 14:46:27 -0500171 /*! \brief Finds an adj. LSA in the LSDB.
172 \param key The name of the publishing router whose LSA to find.
173 */
akmhoqueb6450b12014-04-24 00:01:03 -0500174 AdjLsa*
akmhoque31d1d4b2014-05-05 22:08:14 -0500175 findAdjLsa(const ndn::Name& key);
akmhoque53353462014-04-22 08:43:45 -0500176
Jiewen Tana0497d82015-02-02 21:59:18 -0800177 const std::list<AdjLsa>&
akmhoque53353462014-04-22 08:43:45 -0500178 getAdjLsdb();
179
180 void
Vince Lehman50df6b72015-03-03 12:06:40 -0600181 setAdjLsaBuildInterval(uint32_t interval)
182 {
183 m_adjLsaBuildInterval = ndn::time::seconds(interval);
184 }
185
186 const ndn::time::seconds&
187 getAdjLsaBuildInterval() const
188 {
189 return m_adjLsaBuildInterval;
190 }
191
Ashlesh Gawande3e105a02017-05-16 17:36:56 -0500192 SequencingManager&
193 getSequencingManager()
194 {
195 return m_sequencingManager;
196 }
197
Vince Lehman50df6b72015-03-03 12:06:40 -0600198 void
akmhoque2f423352014-06-03 11:49:35 -0500199 writeAdjLsdbLog();
akmhoque53353462014-04-22 08:43:45 -0500200
akmhoque53353462014-04-22 08:43:45 -0500201 void
Nick Gordone98480b2017-05-24 11:23:03 -0500202 setLsaRefreshTime(const ndn::time::seconds& lsaRefreshTime);
akmhoque53353462014-04-22 08:43:45 -0500203
204 void
205 setThisRouterPrefix(std::string trp);
206
Muktadir R Chowdhuryaa3b0852015-08-06 13:08:56 -0500207 void
208 expressInterest(const ndn::Name& interestName, uint32_t timeoutCount,
Nick Gordone98480b2017-05-24 11:23:03 -0500209 ndn::time::steady_clock::TimePoint deadline = DEFAULT_LSA_RETRIEVAL_DEADLINE);
Muktadir R Chowdhuryaa3b0852015-08-06 13:08:56 -0500210
211 void
212 processInterest(const ndn::Name& name, const ndn::Interest& interest);
213
akmhoque53353462014-04-22 08:43:45 -0500214private:
Nick G97e34942016-07-11 14:46:27 -0500215 /* \brief Add a name LSA to the LSDB if it isn't already there.
216 \param nlsa The candidade name LSA.
217 */
akmhoque53353462014-04-22 08:43:45 -0500218 bool
219 addNameLsa(NameLsa& nlsa);
220
Nick G97e34942016-07-11 14:46:27 -0500221 /*! \brief Returns whether the LSDB contains some LSA.
222 \param key The name of the publishing router whose LSA to check for.
223 */
akmhoque53353462014-04-22 08:43:45 -0500224 bool
akmhoque31d1d4b2014-05-05 22:08:14 -0500225 doesNameLsaExist(const ndn::Name& key);
akmhoque53353462014-04-22 08:43:45 -0500226
Nick G97e34942016-07-11 14:46:27 -0500227 /*! \brief Adds a cor. LSA to the LSDB if it isn't already there.
228 \param clsa The candidate cor. LSA.
229 */
akmhoque53353462014-04-22 08:43:45 -0500230 bool
akmhoqueb6450b12014-04-24 00:01:03 -0500231 addCoordinateLsa(CoordinateLsa& clsa);
akmhoque53353462014-04-22 08:43:45 -0500232
Nick G97e34942016-07-11 14:46:27 -0500233 /*! \brief Returns whether a cor. LSA is in the LSDB.
234 \param key The name of the router that published the queried LSA.
235 */
akmhoque53353462014-04-22 08:43:45 -0500236 bool
akmhoque31d1d4b2014-05-05 22:08:14 -0500237 doesCoordinateLsaExist(const ndn::Name& key);
akmhoque53353462014-04-22 08:43:45 -0500238
Nick G97e34942016-07-11 14:46:27 -0500239 /*! \brief Attempts to construct an adj. LSA.
240
241 This function will attempt to construct an adjacency LSA. An LSA
242 can only be built when the status of all of the router's neighbors
243 is known. That is, when we are not currently trying to contact any
244 neighbor.
245 */
Vince Lehman50df6b72015-03-03 12:06:40 -0600246 void
247 buildAdjLsa();
248
Nick G97e34942016-07-11 14:46:27 -0500249 /*! \brief Adds an adj. LSA to the LSDB if it isn't already there.
250 \param alsa The candidate adj. LSA to add to the LSDB.
251 */
akmhoque53353462014-04-22 08:43:45 -0500252 bool
253 addAdjLsa(AdjLsa& alsa);
254
Nick G97e34942016-07-11 14:46:27 -0500255 /*! \brief Returns whether the LSDB contains an LSA.
256 \param key The name of a router whose LSA to check for in the LSDB.
257 */
akmhoque53353462014-04-22 08:43:45 -0500258 bool
akmhoque31d1d4b2014-05-05 22:08:14 -0500259 doesAdjLsaExist(const ndn::Name& key);
akmhoque53353462014-04-22 08:43:45 -0500260
Nick G97e34942016-07-11 14:46:27 -0500261 /*! \brief Schedules a refresh/expire event in the scheduler.
262 \param key The name of the router that published the LSA.
263 \param seqNo The seq. no. associated with the LSA.
264 \param expTime How many seconds to wait before triggering the event.
265 */
akmhoque53353462014-04-22 08:43:45 -0500266 ndn::EventId
akmhoquec7a79b22014-05-26 08:06:19 -0500267 scheduleNameLsaExpiration(const ndn::Name& key, int seqNo,
Nick Gordone98480b2017-05-24 11:23:03 -0500268 const ndn::time::seconds& expTime);
akmhoque53353462014-04-22 08:43:45 -0500269
Nick G97e34942016-07-11 14:46:27 -0500270 /*! \brief Either allow to expire, or refresh a name LSA.
271 \param lsaKey The name of the router that published the LSA.
272 \param seqNo The seq. no. of the LSA to check.
273 */
akmhoque53353462014-04-22 08:43:45 -0500274 void
Ashlesh Gawande90173ad2017-08-09 15:19:50 -0500275 expireOrRefreshNameLsa(const ndn::Name& lsaKey, uint64_t seqNo);
akmhoque53353462014-04-22 08:43:45 -0500276
Vince Lehman199e9cf2015-04-07 13:22:16 -0500277PUBLIC_WITH_TESTS_ELSE_PRIVATE:
Nick G97e34942016-07-11 14:46:27 -0500278 /*! \brief Schedules an expire/refresh event in the LSA.
279 \param key The name of the router whose LSA is in question.
280 \param seqNo The sequence number of the LSA to check.
281 \param expTime The number of seconds to wait before triggering the event.
282 */
akmhoque53353462014-04-22 08:43:45 -0500283 ndn::EventId
akmhoquec7a79b22014-05-26 08:06:19 -0500284 scheduleAdjLsaExpiration(const ndn::Name& key, int seqNo,
Nick Gordone98480b2017-05-24 11:23:03 -0500285 const ndn::time::seconds& expTime);
akmhoque53353462014-04-22 08:43:45 -0500286
Vince Lehman199e9cf2015-04-07 13:22:16 -0500287private:
Nick G97e34942016-07-11 14:46:27 -0500288
akmhoque53353462014-04-22 08:43:45 -0500289 void
Ashlesh Gawande90173ad2017-08-09 15:19:50 -0500290 expireOrRefreshAdjLsa(const ndn::Name& lsaKey, uint64_t seqNo);
akmhoque53353462014-04-22 08:43:45 -0500291
292 ndn::EventId
akmhoque31d1d4b2014-05-05 22:08:14 -0500293 scheduleCoordinateLsaExpiration(const ndn::Name& key, int seqNo,
Nick Gordone98480b2017-05-24 11:23:03 -0500294 const ndn::time::seconds& expTime);
akmhoque53353462014-04-22 08:43:45 -0500295
296 void
Ashlesh Gawande90173ad2017-08-09 15:19:50 -0500297 expireOrRefreshCoordinateLsa(const ndn::Name& lsaKey,
akmhoqueb6450b12014-04-24 00:01:03 -0500298 uint64_t seqNo);
akmhoque53353462014-04-22 08:43:45 -0500299
Nick G97e34942016-07-11 14:46:27 -0500300private:
301
akmhoque31d1d4b2014-05-05 22:08:14 -0500302 void
akmhoque69c9aa92014-07-23 15:15:05 -0500303 putLsaData(const ndn::Interest& interest, const std::string& content);
304
305 void
akmhoque31d1d4b2014-05-05 22:08:14 -0500306 processInterestForNameLsa(const ndn::Interest& interest,
307 const ndn::Name& lsaKey,
Ashlesh Gawande5bf83172014-09-19 12:38:17 -0500308 uint64_t seqNo);
akmhoque53353462014-04-22 08:43:45 -0500309
akmhoque31d1d4b2014-05-05 22:08:14 -0500310 void
311 processInterestForAdjacencyLsa(const ndn::Interest& interest,
312 const ndn::Name& lsaKey,
Ashlesh Gawande5bf83172014-09-19 12:38:17 -0500313 uint64_t seqNo);
akmhoque31d1d4b2014-05-05 22:08:14 -0500314
315 void
316 processInterestForCoordinateLsa(const ndn::Interest& interest,
317 const ndn::Name& lsaKey,
Ashlesh Gawande5bf83172014-09-19 12:38:17 -0500318 uint64_t seqNo);
akmhoque31d1d4b2014-05-05 22:08:14 -0500319 void
dmcoomes9f936662017-03-02 10:33:09 -0600320 onContentValidated(const std::shared_ptr<const ndn::Data>& data);
Yingdi Yu20e3a6e2014-05-26 23:16:10 -0700321
322 void
akmhoque31d1d4b2014-05-05 22:08:14 -0500323 processContentNameLsa(const ndn::Name& lsaKey,
Ashlesh Gawande5bf83172014-09-19 12:38:17 -0500324 uint64_t lsSeqNo, std::string& dataContent);
akmhoque31d1d4b2014-05-05 22:08:14 -0500325
326 void
327 processContentAdjacencyLsa(const ndn::Name& lsaKey,
Ashlesh Gawande5bf83172014-09-19 12:38:17 -0500328 uint64_t lsSeqNo, std::string& dataContent);
akmhoque31d1d4b2014-05-05 22:08:14 -0500329
330 void
331 processContentCoordinateLsa(const ndn::Name& lsaKey,
Ashlesh Gawande5bf83172014-09-19 12:38:17 -0500332 uint64_t lsSeqNo, std::string& dataContent);
akmhoque31d1d4b2014-05-05 22:08:14 -0500333
Ashlesh Gawande5bf83172014-09-19 12:38:17 -0500334PUBLIC_WITH_TESTS_ELSE_PRIVATE:
Nick G97e34942016-07-11 14:46:27 -0500335 /*!
336 \brief Error callback when SegmentFetcher fails to return an LSA
337
338 In all error cases, a reattempt to fetch the LSA will be made.
339
340 Segment validation can fail either because the packet does not have a
341 valid signature (fatal) or because some of the certificates in the trust chain
342 could not be fetched (non-fatal).
343
344 Currently, the library does not provide clear indication (besides a plain-text message
345 in the error callback) of the reason for the failure nor the segment that failed
346 to be validated, thus we will continue to try to fetch the LSA until the deadline
347 is reached.
Muktadir R Chowdhuryaa3b0852015-08-06 13:08:56 -0500348 */
akmhoque31d1d4b2014-05-05 22:08:14 -0500349 void
Muktadir R Chowdhuryaa3b0852015-08-06 13:08:56 -0500350 onFetchLsaError(uint32_t errorCode,
351 const std::string& msg,
352 ndn::Name& interestName,
353 uint32_t retransmitNo,
354 const ndn::time::steady_clock::TimePoint& deadline,
355 ndn::Name lsaName,
356 uint64_t seqNo);
357
Nick G97e34942016-07-11 14:46:27 -0500358 /*!
359 \brief Success callback when SegmentFetcher returns a valid LSA
360
Nick Gordonb50e51b2016-07-22 16:05:57 -0500361 \param interestName The base Interest used to fetch the LSA in the format:
Nick G97e34942016-07-11 14:46:27 -0500362 /<network>/NLSR/LSA/<site>/%C1.Router/<router>/<lsa-type>/<seqNo>
Muktadir R Chowdhuryaa3b0852015-08-06 13:08:56 -0500363 */
364 void
365 afterFetchLsa(const ndn::ConstBufferPtr& data, ndn::Name& interestName);
akmhoque31d1d4b2014-05-05 22:08:14 -0500366
Ashlesh Gawande5bf83172014-09-19 12:38:17 -0500367private:
Nick Gordone98480b2017-05-24 11:23:03 -0500368 ndn::time::system_clock::TimePoint
akmhoquec7a79b22014-05-26 08:06:19 -0500369 getLsaExpirationTimePoint();
370
Nick G97e34942016-07-11 14:46:27 -0500371 /*! \brief Cancels an event in the event scheduler. */
akmhoque31d1d4b2014-05-05 22:08:14 -0500372 void
373 cancelScheduleLsaExpiringEvent(ndn::EventId eid);
374
Jiewen Tana0497d82015-02-02 21:59:18 -0800375public:
376 static const ndn::Name::Component NAME_COMPONENT;
377
Alejandro Gil Torrese0d20482016-03-06 23:56:19 -0600378 ndn::util::signal::Signal<Lsdb, Statistics::PacketType> lsaIncrementSignal;
379
Ashlesh Gawande5bf83172014-09-19 12:38:17 -0500380private:
akmhoque31d1d4b2014-05-05 22:08:14 -0500381 Nlsr& m_nlsr;
Vince Lehman7c603292014-09-11 17:48:16 -0500382 ndn::Scheduler& m_scheduler;
Ashlesh Gawande3e105a02017-05-16 17:36:56 -0500383 SyncLogicHandler m_sync;
Vince Lehman7c603292014-09-11 17:48:16 -0500384
akmhoque53353462014-04-22 08:43:45 -0500385 std::list<NameLsa> m_nameLsdb;
386 std::list<AdjLsa> m_adjLsdb;
akmhoqueb6450b12014-04-24 00:01:03 -0500387 std::list<CoordinateLsa> m_corLsdb;
akmhoque53353462014-04-22 08:43:45 -0500388
Nick Gordone98480b2017-05-24 11:23:03 -0500389 ndn::time::seconds m_lsaRefreshTime;
akmhoque53353462014-04-22 08:43:45 -0500390 std::string m_thisRouterPrefix;
391
Ashlesh Gawande5bf83172014-09-19 12:38:17 -0500392 typedef std::map<ndn::Name, uint64_t> SequenceNumberMap;
393
394 // Maps the name of an LSA to its highest known sequence number from sync;
395 // Used to stop NLSR from trying to fetch outdated LSAs
396 SequenceNumberMap m_highestSeqNo;
397
Vince Lehman18841082014-08-19 17:15:24 -0500398 static const ndn::time::seconds GRACE_PERIOD;
Nick Gordone98480b2017-05-24 11:23:03 -0500399 static const ndn::time::steady_clock::TimePoint DEFAULT_LSA_RETRIEVAL_DEADLINE;
Vince Lehman50df6b72015-03-03 12:06:40 -0600400
401 ndn::time::seconds m_adjLsaBuildInterval;
Ashlesh Gawande3e105a02017-05-16 17:36:56 -0500402
403 SequencingManager m_sequencingManager;
Nick Gordon9eac4d92017-08-29 17:31:29 -0500404
405 ndn::util::signal::ScopedConnection m_onNewLsaConnection;
406
akmhoque53353462014-04-22 08:43:45 -0500407};
408
Nick Gordonfad8e252016-08-11 14:21:38 -0500409} // namespace nlsr
akmhoque53353462014-04-22 08:43:45 -0500410
dmcoomes9f936662017-03-02 10:33:09 -0600411#endif // NLSR_LSDB_HPP