lsa-segment-storage.hpp
Go to the documentation of this file.
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
22 #ifndef NLSR_LSA_SEGMENT_STORAGE_HPP
23 #define NLSR_LSA_SEGMENT_STORAGE_HPP
24 
25 #include "test-access-control.hpp"
26 
27 #include <ndn-cxx/util/segment-fetcher.hpp>
28 #include <ndn-cxx/util/signal.hpp>
29 #include <ndn-cxx/util/time.hpp>
30 
31 #include <vector>
32 #include <tuple>
33 
34 namespace nlsr {
35 
37 {
38 public:
39  LsaSegmentStorage(ndn::Scheduler& scheduler);
40 
44  void
45  connectToFetcher(ndn::util::SegmentFetcher& fetcher);
46 
50  const ndn::Data*
51  getLsaSegment(const ndn::Interest& interest);
52 
56  void
57  afterFetcherSignalEmitted(const ndn::Data& lsaSegment);
58 
59 private:
65  void
66  deleteOldLsas(const ndn::Name& newLsaName);
67 
70  void
71  scheduleLsaSegmentDeletion(const ndn::Name& segmentKey, ndn::time::seconds expirationTime);
72 
73 
74 private:
75  ndn::Scheduler& m_scheduler;
76 
77  // Key: /<router-prefix>/<LS type>/<sequence no.>/<segment no.>
78  // Value: corresponding LSA data packet
79  // Data name: /<router-prefix>/<LS type>/<sequence no.>/<version no.>/<segment no.>
80  std::unordered_map<ndn::Name, ndn::Data> m_lsaSegments;
81 };
82 
83 } // namespace nlsr
84 
85 #endif // NLSR_LSA_SEGMENT_STORAGE_HPP
#define PUBLIC_WITH_TESTS_ELSE_PRIVATE
void connectToFetcher(ndn::util::SegmentFetcher &fetcher)
Get connected to the signal emitted by SegmentFetcher.
const ndn::Data * getLsaSegment(const ndn::Interest &interest)
Returns an LSA segment for an interest from LsaSegmentStorage.
Copyright (c) 2014-2018, The University of Memphis, Regents of the University of California, Arizona Board of Regents.
LsaSegmentStorage(ndn::Scheduler &scheduler)