name-prefix-table.hpp
Go to the documentation of this file.
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
22 #ifndef NLSR_NAME_PREFIX_TABLE_HPP
23 #define NLSR_NAME_PREFIX_TABLE_HPP
24 
27 #include "signals.hpp"
28 #include "test-access-control.hpp"
29 #include "route/fib.hpp"
30 
31 #include <list>
32 #include <unordered_map>
33 
34 namespace nlsr {
35 
37 {
38 public:
39  using RoutingTableEntryPool =
40  std::unordered_map<ndn::Name, std::shared_ptr<RoutingTablePoolEntry>>;
41  using NptEntryList = std::list<std::shared_ptr<NamePrefixTableEntry>>;
42  using const_iterator = NptEntryList::const_iterator;
43 
44  NamePrefixTable(Fib& fib, RoutingTable& routingTable,
45  std::unique_ptr<AfterRoutingChange>& afterRoutingChangeSignal);
46 
48 
62  void
63  addEntry(const ndn::Name& name, const ndn::Name& destRouter);
64 
76  void
77  removeEntry(const ndn::Name& name, const ndn::Name& destRouter);
78 
87  void
88  updateWithNewRoute(const std::list<RoutingTableEntry>& entries);
89 
99  std::shared_ptr<RoutingTablePoolEntry>
101 
110  void
111  deleteRtpeFromPool(std::shared_ptr<RoutingTablePoolEntry> rtpePtr);
112 
113  void
114  writeLog();
115 
117  begin() const;
118 
120  end() const;
121 
123  RoutingTableEntryPool m_rtpool;
124 
125  NptEntryList m_table;
126 
127 private:
128  Fib& m_fib;
129  RoutingTable& m_routingTable;
130  ndn::util::signal::Connection m_afterRoutingChangeConnection;
131 };
132 
135 {
136  return m_table.begin();
137 }
138 
141 {
142  return m_table.end();
143 }
144 
145 std::ostream&
146 operator<<(std::ostream& os, const NamePrefixTable& table);
147 
148 } // namespace nlsr
149 
150 #endif // NLSR_NAME_PREFIX_TABLE_HPP
std::ostream & operator<<(std::ostream &os, const Adjacent &adjacent)
Definition: adjacent.cpp:84
#define PUBLIC_WITH_TESTS_ELSE_PRIVATE
NamePrefixTable(Fib &fib, RoutingTable &routingTable, std::unique_ptr< AfterRoutingChange > &afterRoutingChangeSignal)
std::shared_ptr< RoutingTablePoolEntry > addRtpeToPool(RoutingTablePoolEntry &rtpe)
Adds a pool entry to the pool.
void deleteRtpeFromPool(std::shared_ptr< RoutingTablePoolEntry > rtpePtr)
Removes a pool entry from the pool.
void updateWithNewRoute(const std::list< RoutingTableEntry > &entries)
Updates all routing information in the NPT.
Maps names to lists of next hops, and exports this information to NFD.
Definition: fib.hpp:53
void removeEntry(const ndn::Name &name, const ndn::Name &destRouter)
Removes a destination from a name prefix table entry.
NptEntryList::const_iterator const_iterator
const_iterator end() const
Copyright (c) 2014-2018, The University of Memphis, Regents of the University of California, Arizona Board of Regents.
const_iterator begin() const
std::list< std::shared_ptr< NamePrefixTableEntry >> NptEntryList
std::unordered_map< ndn::Name, std::shared_ptr< RoutingTablePoolEntry >> RoutingTableEntryPool
void addEntry(const ndn::Name &name, const ndn::Name &destRouter)
Adds a destination to the specified name prefix.