name-prefix-table-entry.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_ENTRY_HPP
23 #define NLSR_NAME_PREFIX_TABLE_ENTRY_HPP
24 
26 
27 #include "test-access-control.hpp"
28 
29 #include <list>
30 #include <utility>
31 
32 namespace nlsr {
33 
35 {
36 public:
38  {
39  }
40 
41  NamePrefixTableEntry(const ndn::Name& namePrefix)
42  : m_namePrefix(namePrefix)
43  , m_nexthopList()
44  {
45  }
46 
47  const ndn::Name&
48  getNamePrefix() const
49  {
50  return m_namePrefix;
51  }
52 
53  const std::list<std::shared_ptr<RoutingTablePoolEntry>>&
54  getRteList() const
55  {
56  return m_rteList;
57  }
58 
62  void
64  {
65  if (m_rteList.size() > 0) {
66  for (auto it = m_rteList.begin(); it != m_rteList.end(); ++it) {
67  (*it)->getNexthopList().reset();
68  }
69  }
70  }
71 
72  size_t
74  {
75  return m_rteList.size();
76  }
77 
78  const NexthopList&
80  {
81  return m_nexthopList;
82  }
83 
87  void
89 
93  uint64_t
94  removeRoutingTableEntry(std::shared_ptr<RoutingTablePoolEntry> rtpePtr);
95 
103  void
104  addRoutingTableEntry(std::shared_ptr<RoutingTablePoolEntry> rtpePtr);
105 
106  void
107  writeLog();
108 
109 private:
110  ndn::Name m_namePrefix;
111 
113  std::list<std::shared_ptr<RoutingTablePoolEntry>> m_rteList;
114  NexthopList m_nexthopList;
115 
116 };
117 
118 bool
120 
121 bool
122 operator==(const NamePrefixTableEntry& lhs, const ndn::Name& rhs);
123 
124 std::ostream&
125 operator<<(std::ostream& os, const NamePrefixTableEntry& entry);
126 
127 } // namespace nlsr
128 
129 #endif // NLSR_NAME_PREFIX_TABLE_ENTRY_HPP
const ndn::Name & getNamePrefix() const
const NexthopList & getNexthopList() const
void addRoutingTableEntry(std::shared_ptr< RoutingTablePoolEntry > rtpePtr)
Adds a routing entry to this NPT entry.
std::ostream & operator<<(std::ostream &os, const Adjacent &adjacent)
Definition: adjacent.cpp:99
#define PUBLIC_WITH_TESTS_ELSE_PRIVATE
bool operator==(const NamePrefixTableEntry &lhs, const NamePrefixTableEntry &rhs)
const std::list< std::shared_ptr< RoutingTablePoolEntry > > & getRteList() const
void resetRteListNextHop()
Resets the next hop lists of all routing table entries that advertise this name prefix.
uint64_t removeRoutingTableEntry(std::shared_ptr< RoutingTablePoolEntry > rtpePtr)
Removes a routing entry from this NPT entry.
Copyright (c) 2014-2019, The University of Memphis, Regents of the University of California, Arizona Board of Regents.
NamePrefixTableEntry(const ndn::Name &namePrefix)
void generateNhlfromRteList()
Collect all next-hops that are advertised by this entry&#39;s routing entries.