Loading...
Searching...
No Matches
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-2025, 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
27#include "nexthop.hpp"
28
29#include <list>
30#include <utility>
31
32namespace nlsr {
33
35{
36public:
40
41 NamePrefixTableEntry(const ndn::Name& namePrefix, uint64_t routeFlags)
42 : m_namePrefix(namePrefix)
43 , m_flags(routeFlags)
44 , m_nexthopList()
45 {
46 }
47
48 const ndn::Name&
50 {
51 return m_namePrefix;
52 }
53
54 const std::list<std::shared_ptr<RoutingTablePoolEntry>>&
55 getRteList() const
56 {
57 return m_rteList;
58 }
59
63 void
65 {
66 if (m_rteList.size() > 0) {
67 for (auto it = m_rteList.begin(); it != m_rteList.end(); ++it) {
68 (*it)->getNexthopList().clear();
69 }
70 }
71 }
72
73 size_t
75 {
76 return m_rteList.size();
77 }
78
79 const NexthopList&
81 {
82 return m_nexthopList;
83 }
84
87 {
88 return m_nexthopList;
89 }
90
91 void
92 setFlags(uint64_t flags)
93 {
94 m_flags = flags;
95 }
96
97 uint64_t
98 getFlags() const
99 {
100 return m_flags;
101 }
102
106 void
108
112 uint64_t
113 removeRoutingTableEntry(std::shared_ptr<RoutingTablePoolEntry> rtpePtr);
114
122 void
123 addRoutingTableEntry(std::shared_ptr<RoutingTablePoolEntry> rtpePtr);
124
125 void
127
128private:
129 ndn::Name m_namePrefix;
130 uint64_t m_flags;
131
133 std::list<std::shared_ptr<RoutingTablePoolEntry>> m_rteList;
134 NexthopList m_nexthopList;
135};
136
137bool
139
140bool
141operator==(const NamePrefixTableEntry& lhs, const ndn::Name& rhs);
142
143std::ostream&
144operator<<(std::ostream& os, const NamePrefixTableEntry& entry);
145
146} // namespace nlsr
147
148#endif // NLSR_NAME_PREFIX_TABLE_ENTRY_HPP
void setFlags(uint64_t flags)
uint64_t getFlags() const
uint64_t removeRoutingTableEntry(std::shared_ptr< RoutingTablePoolEntry > rtpePtr)
Removes a routing entry from this NPT entry.
void writeLog()
size_t getRteListSize()
const ndn::Name & getNamePrefix() const
const NexthopList & getNexthopList() const
void resetRteListNextHop()
Resets the next hop lists of all routing table entries that advertise this name prefix.
void generateNhlfromRteList()
Collect all next-hops that are advertised by this entry's routing entries.
NamePrefixTableEntry(const ndn::Name &namePrefix, uint64_t routeFlags)
void addRoutingTableEntry(std::shared_ptr< RoutingTablePoolEntry > rtpePtr)
Adds a routing entry to this NPT entry.
NamePrefixTableEntry()
NexthopList & getNexthopListForModification()
const std::list< std::shared_ptr< RoutingTablePoolEntry > > & getRteList() 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