NS-3 based Named Data Networking (NDN) simulator
ndnSIM 2.0: 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; -*- */
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
nfd::Fib::const_iterator::operator*
const fib::Entry & operator*() const
Definition:
fib.hpp:205
fib-entry.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::Entry
represents a FIB entry
Definition:
fib-entry.hpp:53
nfd::Fib::const_iterator::operator!=
bool operator!=(const const_iterator &other) const
Definition:
fib.hpp:223
nfd::Fib
represents the FIB
Definition:
fib.hpp:44
nfd::Fib::const_iterator::~const_iterator
~const_iterator()
Definition:
fib.hpp:184
nfd::NameTree::const_iterator
Definition:
name-tree.hpp:270
nfd::Fib::const_iterator::const_iterator
const_iterator()=default
nfd::measurements::Entry
represents a Measurements entry
Definition:
measurements-entry.hpp:48
nfd::cs::iterator
Table::const_iterator iterator
Definition:
cs-internal.hpp:41
nfd::Fib::const_iterator::operator->
shared_ptr< fib::Entry > operator->() const
Definition:
fib.hpp:211
nfd::Fib::const_iterator::operator++
const_iterator & operator++()
Definition:
fib.hpp:198
nfd
Copyright (c) 2011-2015 Regents of the University of California.
Definition:
ndn-common.hpp:40
nfd::pit::Entry
represents a PIT entry
Definition:
pit-entry.hpp:69
nfd::NameTree
Class Name Tree.
Definition:
name-tree.hpp:79
face
ndn::Name
Name abstraction to represent an absolute name.
Definition:
name.hpp:46
nfd::Fib::const_iterator
Definition:
fib.hpp:113
nfd::Fib::size
size_t size() const
Definition:
fib.hpp:166
ns3::ndn::operator!=
bool operator!=(const GlobalRouter::Incidency &a, const GlobalRouter::Incidency &b)
Definition:
ndn-global-router.hpp:139
nfd::Fib::const_iterator::operator==
bool operator==(const const_iterator &other) const
Definition:
fib.hpp:217
name-tree.hpp
ns3::ndn::operator==
bool operator==(const GlobalRouter::Incidency &a, const GlobalRouter::Incidency &b)
Definition:
ndn-global-router.hpp:132
ndnSIM
NFD
daemon
table
fib.hpp
Generated on Sat Nov 12 2016 16:02:54 for ndnSIM by
1.8.12