name-prefix-table-entry.hpp
Go to the documentation of this file.
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2 /*
3  * Copyright (c) 2014-2020, The University of Memphis,
4  * Regents of the University of California,
5  * Arizona Board of Regents.
6  *
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/>.
20  */
21 
22 #ifndef NLSR_NAME_PREFIX_TABLE_ENTRY_HPP
23 #define NLSR_NAME_PREFIX_TABLE_ENTRY_HPP
24 
26 #include "test-access-control.hpp"
27 
28 #include <list>
29 #include <utility>
30 
31 namespace nlsr {
32 
34 {
35 public:
37  {
38  }
39 
40  NamePrefixTableEntry(const ndn::Name& namePrefix)
41  : m_namePrefix(namePrefix)
42  , m_nexthopList()
43  {
44  }
45 
46  const ndn::Name&
47  getNamePrefix() const
48  {
49  return m_namePrefix;
50  }
51 
52  const std::list<std::shared_ptr<RoutingTablePoolEntry>>&
53  getRteList() const
54  {
55  return m_rteList;
56  }
57 
61  void
63  {
64  if (m_rteList.size() > 0) {
65  for (auto it = m_rteList.begin(); it != m_rteList.end(); ++it) {
66  (*it)->getNexthopList().clear();
67  }
68  }
69  }
70 
71  size_t
73  {
74  return m_rteList.size();
75  }
76 
77  const NexthopList&
79  {
80  return m_nexthopList;
81  }
82 
86  void
88 
92  uint64_t
93  removeRoutingTableEntry(std::shared_ptr<RoutingTablePoolEntry> rtpePtr);
94 
102  void
103  addRoutingTableEntry(std::shared_ptr<RoutingTablePoolEntry> rtpePtr);
104 
105  void
107 
108 private:
109  ndn::Name m_namePrefix;
110 
112  std::list<std::shared_ptr<RoutingTablePoolEntry>> m_rteList;
113  NexthopList m_nexthopList;
114 };
115 
116 bool
118 
119 bool
120 operator==(const NamePrefixTableEntry& lhs, const ndn::Name& rhs);
121 
122 std::ostream&
123 operator<<(std::ostream& os, const NamePrefixTableEntry& entry);
124 
125 } // namespace nlsr
126 
127 #endif // NLSR_NAME_PREFIX_TABLE_ENTRY_HPP
uint64_t removeRoutingTableEntry(std::shared_ptr< RoutingTablePoolEntry > rtpePtr)
Removes a routing entry from this NPT entry.
void writeLog()
const std::list< std::shared_ptr< RoutingTablePoolEntry > > & getRteList() const
size_t getRteListSize()
NamePrefixTableEntry(const ndn::Name &namePrefix)
void resetRteListNextHop()
Resets the next hop lists of all routing table entries that advertise this name prefix.
const NexthopList & getNexthopList() const
void generateNhlfromRteList()
Collect all next-hops that are advertised by this entry's routing entries.
void addRoutingTableEntry(std::shared_ptr< RoutingTablePoolEntry > rtpePtr)
Adds a routing entry to this NPT entry.
NamePrefixTableEntry()
const ndn::Name & getNamePrefix() const
Copyright (c) 2014-2020, The University of Memphis, Regents of the University of California.
std::ostream & operator<<(std::ostream &os, const Adjacent &adjacent)
Definition: adjacent.cpp:176
bool operator==(const NamePrefixTableEntry &lhs, const NamePrefixTableEntry &rhs)
#define PUBLIC_WITH_TESTS_ELSE_PRIVATE