NS-3 based Named Data Networking (NDN) simulator
ndnSIM 2.5: NDN, CCN, CCNx, content centric networks
API Documentation
fib.hpp
Go to the documentation of this file.
1
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2
/*
3
* Copyright (c) 2014-2019, Regents of the University of California,
4
* Arizona Board of Regents,
5
* Colorado State University,
6
* University Pierre & Marie Curie, Sorbonne University,
7
* Washington University in St. Louis,
8
* Beijing Institute of Technology,
9
* The University of Memphis.
10
*
11
* This file is part of NFD (Named Data Networking Forwarding Daemon).
12
* See AUTHORS.md for complete list of NFD authors and contributors.
13
*
14
* NFD is free software: you can redistribute it and/or modify it under the terms
15
* of the GNU General Public License as published by the Free Software Foundation,
16
* either version 3 of the License, or (at your option) any later version.
17
*
18
* NFD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
19
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
20
* PURPOSE. See the GNU General Public License for more details.
21
*
22
* You should have received a copy of the GNU General Public License along with
23
* NFD, e.g., in COPYING.md file. If not, see <http://www.gnu.org/licenses/>.
24
*/
25
26
#ifndef NFD_DAEMON_TABLE_FIB_HPP
27
#define NFD_DAEMON_TABLE_FIB_HPP
28
29
#include "
fib-entry.hpp
"
30
#include "
name-tree.hpp
"
31
32
#include <boost/range/adaptor/transformed.hpp>
33
34
namespace
nfd
{
35
36
namespace
measurements {
37
class
Entry
;
38
}
// namespace measurements
39
namespace
pit {
40
class
Entry;
41
}
// namespace pit
42
43
namespace
fib {
44
47
class
Fib
: noncopyable
48
{
49
public
:
50
explicit
51
Fib
(
NameTree
& nameTree);
52
53
size_t
54
size
()
const
55
{
56
return
m_nItems;
57
}
58
59
public
:
// lookup
62
const
Entry
&
63
findLongestPrefixMatch
(
const
Name
& prefix)
const
;
64
69
const
Entry
&
70
findLongestPrefixMatch
(
const
pit::Entry
& pitEntry)
const
;
71
76
const
Entry
&
77
findLongestPrefixMatch
(
const
measurements::Entry
& measurementsEntry)
const
;
78
81
Entry
*
82
findExactMatch
(
const
Name
& prefix);
83
84
public
:
// mutation
87
static
constexpr
size_t
88
getMaxDepth
()
89
{
90
return
NameTree::getMaxDepth
();
91
}
92
97
std::pair<Entry*, bool>
98
insert
(
const
Name
& prefix);
99
100
void
101
erase
(
const
Name
& prefix);
102
103
void
104
erase
(
const
Entry
& entry);
105
110
void
111
addOrUpdateNextHop
(
Entry
& entry,
Face
& face, uint64_t cost);
112
113
enum class
RemoveNextHopResult
{
114
NO_SUCH_NEXTHOP
,
115
NEXTHOP_REMOVED
,
116
FIB_ENTRY_REMOVED
117
};
118
121
RemoveNextHopResult
122
removeNextHop
(
Entry
& entry,
const
Face
& face);
123
124
public
:
// enumeration
125
typedef
boost::transformed_range<name_tree::GetTableEntry<Entry>,
const
name_tree::Range
>
Range
;
126
typedef
boost::range_iterator<Range>::type
const_iterator
;
127
133
const_iterator
134
begin
()
const
135
{
136
return
this->getRange().begin();
137
}
138
142
const_iterator
143
end
()
const
144
{
145
return
this->getRange().end();
146
}
147
148
public
:
// signal
151
signal::Signal<Fib, Name, NextHop>
afterNewNextHop
;
152
153
private
:
156
template
<
typename
K>
157
const
Entry
&
158
findLongestPrefixMatchImpl(
const
K& key)
const
;
159
160
void
161
erase
(
name_tree::Entry
* nte,
bool
canDeleteNte =
true
);
162
163
Range
164
getRange()
const
;
165
166
private
:
167
NameTree
& m_nameTree;
168
size_t
m_nItems = 0;
169
175
static
const
unique_ptr<Entry> s_emptyEntry;
176
};
177
178
}
// namespace fib
179
180
using
fib::Fib
;
181
182
}
// namespace nfd
183
184
#endif // NFD_DAEMON_TABLE_FIB_HPP
name-tree.hpp
nfd::name_tree::Entry
An entry in the name tree.
Definition:
name-tree-entry.hpp:42
nfd::fib::Fib::end
const_iterator end() const
Definition:
fib.hpp:143
nfd::fib::Fib::findLongestPrefixMatch
const Entry & findLongestPrefixMatch(const Name &prefix) const
Performs a longest prefix match.
Definition:
fib.cpp:62
nfd::fib::Fib::getMaxDepth
static constexpr size_t getMaxDepth()
Maximum number of components in a FIB entry prefix.
Definition:
fib.hpp:88
nfd::fib::Fib::erase
void erase(const Name &prefix)
Definition:
fib.cpp:116
nfd::name_tree::NameTree
A common index structure for FIB, PIT, StrategyChoice, and Measurements.
Definition:
name-tree.hpp:37
nfd::fib::Fib::Range
boost::transformed_range< name_tree::GetTableEntry< Entry >, const name_tree::Range > Range
Definition:
fib.hpp:125
nfd::name_tree::Range
boost::iterator_range< Iterator > Range
a Forward Range of name tree entries
Definition:
name-tree-iterator.hpp:212
nfd::fib::Fib::addOrUpdateNextHop
void addOrUpdateNextHop(Entry &entry, Face &face, uint64_t cost)
Add a NextHop record.
Definition:
fib.cpp:136
nfd::fib::Fib::insert
std::pair< Entry *, bool > insert(const Name &prefix)
Find or insert a FIB entry.
Definition:
fib.cpp:90
nfd::fib::Fib::RemoveNextHopResult::NO_SUCH_NEXTHOP
@ NO_SUCH_NEXTHOP
the nexthop is not found
ndn::util::signal::Signal
provides a lightweight signal / event system
Definition:
signal.hpp:52
ndn::Name
Represents an absolute name.
Definition:
name.hpp:44
nfd
Copyright (c) 2011-2015 Regents of the University of California.
Definition:
ndn-common.hpp:40
nfd::fib::Fib::RemoveNextHopResult
RemoveNextHopResult
Definition:
fib.hpp:113
nfd::fib::Fib::findExactMatch
Entry * findExactMatch(const Name &prefix)
Performs an exact match lookup.
Definition:
fib.cpp:80
nfd::face::Face
generalization of a network interface
Definition:
face.hpp:53
nfd::fib::Fib::RemoveNextHopResult::NEXTHOP_REMOVED
@ NEXTHOP_REMOVED
the nexthop is removed and the fib entry stays
nfd::pit::Entry
An Interest table entry.
Definition:
pit-entry.hpp:59
nfd::fib::Entry
represents a FIB entry
Definition:
fib-entry.hpp:54
nfd::fib::Fib::RemoveNextHopResult::FIB_ENTRY_REMOVED
@ FIB_ENTRY_REMOVED
the nexthop is removed and the fib entry is removed
nfd::name_tree::NameTree::getMaxDepth
static constexpr size_t getMaxDepth()
Maximum depth of the name tree.
Definition:
name-tree.hpp:51
nfd::measurements::Entry
Represents a Measurements entry.
Definition:
measurements-entry.hpp:42
nfd::fib::Fib::afterNewNextHop
signal::Signal< Fib, Name, NextHop > afterNewNextHop
signals on Fib entry nexthop creation
Definition:
fib.hpp:151
nfd::fib::Fib::removeNextHop
RemoveNextHopResult removeNextHop(Entry &entry, const Face &face)
Remove the NextHop record for face from entry.
Definition:
fib.cpp:147
nfd::fib::Fib
Represents the Forwarding Information Base (FIB)
Definition:
fib.hpp:48
nfd::fib::Fib::size
size_t size() const
Definition:
fib.hpp:54
fib-entry.hpp
nfd::fib::Fib::const_iterator
boost::range_iterator< Range >::type const_iterator
Definition:
fib.hpp:126
nfd::fib::Fib::Fib
Fib(NameTree &nameTree)
Definition:
fib.cpp:45
nfd::fib::Fib::begin
const_iterator begin() const
Definition:
fib.hpp:134
ndnSIM
NFD
daemon
table
fib.hpp
Generated on Mon Jun 1 2020 22:32:16 for ndnSIM by
1.8.18