NS-3 based Named Data Networking (NDN) simulator
ndnSIM 2.5: NDN, CCN, CCNx, content centric networks
API Documentation
measurements.hpp
Go to the documentation of this file.
1
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2
/*
3
* Copyright (c) 2014-2018, 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_MEASUREMENTS_HPP
27
#define NFD_DAEMON_TABLE_MEASUREMENTS_HPP
28
29
#include "
measurements-entry.hpp
"
30
#include "
name-tree.hpp
"
31
32
namespace
nfd
{
33
34
namespace
fib {
35
class
Entry;
36
}
// namespace fib
37
38
namespace
pit {
39
class
Entry;
40
}
// namespace pit
41
42
namespace
measurements {
43
46
typedef
std::function<bool(
const
Entry
&)>
EntryPredicate
;
47
50
class
AnyEntry
51
{
52
public
:
53
bool
54
operator()
(
const
Entry
& entry)
const
55
{
56
return
true
;
57
}
58
};
59
62
template
<
typename
T>
63
class
EntryWithStrategyInfo
64
{
65
public
:
66
bool
67
operator()
(
const
Entry
& entry)
const
68
{
69
return
entry.
getStrategyInfo
<T>() !=
nullptr
;
70
}
71
};
72
79
class
Measurements
: noncopyable
80
{
81
public
:
82
explicit
83
Measurements
(
NameTree
& nameTree);
84
87
static
constexpr
size_t
88
getMaxDepth
()
89
{
90
return
NameTree::getMaxDepth
();
91
}
92
98
Entry
&
99
get
(
const
Name
&
name
);
100
103
Entry
&
104
get
(
const
fib::Entry
& fibEntry);
105
109
Entry
&
110
get
(
const
pit::Entry
& pitEntry);
111
116
Entry
*
117
getParent
(
const
Entry
& child);
118
121
Entry
*
122
findLongestPrefixMatch
(
const
Name
&
name
,
123
const
EntryPredicate
& pred =
AnyEntry
())
const
;
124
127
Entry
*
128
findLongestPrefixMatch
(
const
pit::Entry
& pitEntry,
129
const
EntryPredicate
& pred =
AnyEntry
())
const
;
130
133
Entry
*
134
findExactMatch
(
const
Name
&
name
)
const
;
135
136
static
time::nanoseconds
137
getInitialLifetime
();
138
143
void
144
extendLifetime
(
Entry
& entry,
const
time::nanoseconds& lifetime);
145
146
size_t
147
size
()
const
;
148
149
private
:
150
void
151
cleanup(
Entry
& entry);
152
153
Entry
&
154
get
(
name_tree::Entry
& nte);
155
158
template
<
typename
K>
159
Entry
*
160
findLongestPrefixMatchImpl(
const
K& key,
const
EntryPredicate
& pred)
const
;
161
162
private
:
163
NameTree
& m_nameTree;
164
size_t
m_nItems;
165
};
166
167
inline
time::nanoseconds
168
Measurements::getInitialLifetime
()
169
{
170
return
4_s;
171
}
172
173
inline
size_t
174
Measurements::size
()
const
175
{
176
return
m_nItems;
177
}
178
179
}
// namespace measurements
180
181
using
measurements::Measurements
;
182
183
}
// namespace nfd
184
185
#endif // NFD_DAEMON_TABLE_MEASUREMENTS_HPP
nfd::measurements::Measurements::findExactMatch
Entry * findExactMatch(const Name &name) const
perform an exact match
Definition:
measurements.cpp:120
nfd::measurements::Measurements::Measurements
Measurements(NameTree &nameTree)
Definition:
measurements.cpp:34
nfd::fib::Entry
represents a FIB entry
Definition:
fib-entry.hpp:51
nfd::measurements::EntryPredicate
std::function< bool(const Entry &)> EntryPredicate
a predicate that accepts or rejects an entry
Definition:
measurements.hpp:46
nfd::measurements::Measurements::findLongestPrefixMatch
Entry * findLongestPrefixMatch(const Name &name, const EntryPredicate &pred=AnyEntry()) const
perform a longest prefix match for name
Definition:
measurements.cpp:108
nfd::measurements::Entry
represents a Measurements entry
Definition:
measurements-entry.hpp:42
nfd::measurements::Measurements::size
size_t size() const
Definition:
measurements.hpp:174
nfd::measurements::Measurements::getParent
Entry * getParent(const Entry &child)
find or insert a parent entry
Definition:
measurements.cpp:80
nfd::measurements::EntryWithStrategyInfo::operator()
bool operator()(const Entry &entry) const
Definition:
measurements.hpp:67
nfd::measurements::AnyEntry::operator()
bool operator()(const Entry &entry) const
Definition:
measurements.hpp:54
nfd
Copyright (c) 2011-2015 Regents of the University of California.
Definition:
ndn-common.hpp:40
nfd::pit::Entry
an Interest table entry
Definition:
pit-entry.hpp:59
nfd::measurements::Measurements::extendLifetime
void extendLifetime(Entry &entry, const time::nanoseconds &lifetime)
extend lifetime of an entry
Definition:
measurements.cpp:127
nfd::measurements::EntryWithStrategyInfo
an EntryPredicate that accepts an entry if it has StrategyInfo of type T
Definition:
measurements.hpp:63
nfd::measurements::Measurements::getMaxDepth
static constexpr size_t getMaxDepth()
maximum depth of a Measurements entry
Definition:
measurements.hpp:88
nfd::measurements::Measurements
the Measurements table
Definition:
measurements.hpp:79
measurements-entry.hpp
nfd::measurements::AnyEntry
an EntryPredicate that accepts any entry
Definition:
measurements.hpp:50
ndn::Name
Represents an absolute name.
Definition:
name.hpp:43
nfd::name_tree::NameTree
a common index structure for FIB, PIT, StrategyChoice, and Measurements
Definition:
name-tree.hpp:38
name-tree.hpp
nfd::measurements::Measurements::get
Entry & get(const Name &name)
find or insert an entry by name
Definition:
measurements.cpp:59
nfd::measurements::Measurements::getInitialLifetime
static time::nanoseconds getInitialLifetime()
Definition:
measurements.hpp:168
ndn::name
Definition:
name-component-types.hpp:33
nfd::name_tree::Entry
an entry in the name tree
Definition:
name-tree-entry.hpp:41
nfd::StrategyInfoHost::getStrategyInfo
T * getStrategyInfo() const
get a StrategyInfo item
Definition:
strategy-info-host.hpp:44
nfd::name_tree::NameTree::getMaxDepth
static constexpr size_t getMaxDepth()
maximum depth of the name tree
Definition:
name-tree.hpp:53
ndnSIM
NFD
daemon
table
measurements.hpp
Generated on Sun Feb 24 2019 22:16:07 for ndnSIM by
1.8.15