NS-3 based Named Data Networking (NDN) simulator
ndnSIM 2.0: NDN, CCN, CCNx, content centric networks
API Documentation
Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Groups
Pages
fib.hpp
Go to the documentation of this file.
1
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
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
namespace
nfd {
33
34
namespace
measurements {
35
class
Entry
;
36
}
37
namespace
pit {
38
class
Entry;
39
}
40
44
class
Fib
: noncopyable
45
{
46
public
:
47
explicit
48
Fib
(
NameTree
& nameTree);
49
50
~Fib
();
51
52
size_t
53
size
()
const
;
54
55
public
:
// lookup
57
shared_ptr<fib::Entry>
58
findLongestPrefixMatch
(
const
Name
& prefix)
const
;
59
61
shared_ptr<fib::Entry>
62
findLongestPrefixMatch
(
const
pit::Entry
& pitEntry)
const
;
63
65
shared_ptr<fib::Entry>
66
findLongestPrefixMatch
(
const
measurements::Entry
& measurementsEntry)
const
;
67
68
shared_ptr<fib::Entry>
69
findExactMatch
(
const
Name
& prefix)
const
;
70
71
public
:
// mutation
76
std::pair<shared_ptr<fib::Entry>,
bool
>
77
insert
(
const
Name
& prefix);
78
79
void
80
erase
(
const
Name
& prefix);
81
82
void
83
erase
(
const
fib::Entry
& entry);
84
92
void
93
removeNextHopFromAllEntries
(shared_ptr<Face> face);
94
95
public
:
// enumeration
96
class
const_iterator
;
97
103
const_iterator
104
begin
()
const
;
105
110
const_iterator
111
end
()
const
;
112
113
class
const_iterator
:
public
std::iterator<std::forward_iterator_tag, const fib::Entry>
114
{
115
public
:
116
const_iterator
() =
default
;
117
118
explicit
119
const_iterator
(
const
NameTree::const_iterator
& it);
120
121
~const_iterator
();
122
123
const
fib::Entry
&
124
operator*
()
const
;
125
126
shared_ptr<fib::Entry>
127
operator->
()
const
;
128
129
const_iterator
&
130
operator++
();
131
132
const_iterator
133
operator++
(
int
);
134
135
bool
136
operator==
(
const
const_iterator
& other)
const
;
137
138
bool
139
operator!=
(
const
const_iterator
& other)
const
;
140
141
private
:
142
NameTree::const_iterator
m_nameTreeIterator;
143
};
144
145
private
:
146
shared_ptr<fib::Entry>
147
findLongestPrefixMatch
(shared_ptr<name_tree::Entry> nameTreeEntry)
const
;
148
149
void
150
erase
(shared_ptr<name_tree::Entry> nameTreeEntry);
151
152
private
:
153
NameTree
& m_nameTree;
154
size_t
m_nItems;
155
162
static
const
shared_ptr<fib::Entry> s_emptyEntry;
163
};
164
165
inline
size_t
166
Fib::size
()
const
167
{
168
return
m_nItems;
169
}
170
171
inline
Fib::const_iterator
172
Fib::end
()
const
173
{
174
return
const_iterator
(m_nameTree.
end
());
175
}
176
177
inline
178
Fib::const_iterator::const_iterator
(
const
NameTree::const_iterator
& it)
179
: m_nameTreeIterator(it)
180
{
181
}
182
183
inline
184
Fib::const_iterator::~const_iterator
()
185
{
186
}
187
188
inline
189
Fib::const_iterator
190
Fib::const_iterator::operator++
(
int
)
191
{
192
Fib::const_iterator
temp(*
this
);
193
++(*this);
194
return
temp;
195
}
196
197
inline
Fib::const_iterator
&
198
Fib::const_iterator::operator++
()
199
{
200
++m_nameTreeIterator;
201
return
*
this
;
202
}
203
204
inline
const
fib::Entry
&
205
Fib::const_iterator::operator*
()
const
206
{
207
return
*this->operator->();
208
}
209
210
inline
shared_ptr<fib::Entry>
211
Fib::const_iterator::operator->
()
const
212
{
213
return
m_nameTreeIterator->getFibEntry();
214
}
215
216
inline
bool
217
Fib::const_iterator::operator==
(
const
Fib::const_iterator
& other)
const
218
{
219
return
m_nameTreeIterator == other.m_nameTreeIterator;
220
}
221
222
inline
bool
223
Fib::const_iterator::operator!=
(
const
Fib::const_iterator
& other)
const
224
{
225
return
m_nameTreeIterator != other.m_nameTreeIterator;
226
}
227
228
}
// namespace nfd
229
230
#endif // NFD_DAEMON_TABLE_FIB_HPP
fib-entry.hpp
nfd::Fib::findLongestPrefixMatch
shared_ptr< fib::Entry > findLongestPrefixMatch(const Name &prefix) const
performs a longest prefix match
Definition:
fib.cpp:66
nfd::Fib::insert
std::pair< shared_ptr< fib::Entry >, bool > insert(const Name &prefix)
inserts a FIB entry for prefix If an entry for exact same prefix exists, that entry is returned...
Definition:
fib.cpp:120
nfd::fib::Entry
represents a FIB entry
Definition:
fib-entry.hpp:53
nfd::Fib
represents the FIB
Definition:
fib.hpp:44
nfd::NameTree::end
const_iterator end() const
Get an iterator referring to the past-the-end FIB entry.
Definition:
name-tree.hpp:378
nfd::Fib::begin
const_iterator begin() const
returns an iterator pointing to the first FIB entry
Definition:
fib.cpp:180
nfd::Fib::size
size_t size() const
Definition:
fib.hpp:166
nfd::Fib::const_iterator::~const_iterator
~const_iterator()
Definition:
fib.hpp:184
nfd::NameTree::const_iterator
Definition:
name-tree.hpp:251
nfd::Fib::const_iterator::const_iterator
const_iterator()=default
nfd::Fib::const_iterator::operator!=
bool operator!=(const const_iterator &other) const
Definition:
fib.hpp:223
nfd::measurements::Entry
represents a Measurements entry
Definition:
measurements-entry.hpp:47
nfd::Fib::removeNextHopFromAllEntries
void removeNextHopFromAllEntries(shared_ptr< Face > face)
removes the NextHop record for face in all entrites
Definition:
fib.cpp:159
nfd::Fib::erase
void erase(const Name &prefix)
Definition:
fib.cpp:141
nfd::Fib::const_iterator::operator++
const_iterator & operator++()
Definition:
fib.hpp:198
nfd::Fib::const_iterator::operator->
shared_ptr< fib::Entry > operator->() const
Definition:
fib.hpp:211
ns3::ndn::Name
Name
Definition:
ndn-common.cpp:25
nfd::Fib::const_iterator::operator*
const fib::Entry & operator*() const
Definition:
fib.hpp:205
nfd::pit::Entry
represents a PIT entry
Definition:
pit-entry.hpp:67
nfd::Fib::findExactMatch
shared_ptr< fib::Entry > findExactMatch(const Name &prefix) const
Definition:
fib.cpp:111
nfd::NameTree
Class Name Tree.
Definition:
name-tree.hpp:79
nfd::Fib::~Fib
~Fib()
Definition:
fib.cpp:55
nfd::Fib::const_iterator
Definition:
fib.hpp:113
nfd::Fib::const_iterator::operator==
bool operator==(const const_iterator &other) const
Definition:
fib.hpp:217
name-tree.hpp
nfd::Fib::end
const_iterator end() const
returns an iterator referring to the past-the-end FIB entry
Definition:
fib.hpp:172
nfd::Fib::Fib
Fib(NameTree &nameTree)
Definition:
fib.cpp:49
ndnSIM
NFD
daemon
table
fib.hpp
Generated on Wed Feb 18 2015 16:31:16 for ndnSIM by
1.8.7