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
dead-nonce-list.hpp
Go to the documentation of this file.
1
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
26
#ifndef NFD_DAEMON_TABLE_DEAD_NONCE_LIST_HPP
27
#define NFD_DAEMON_TABLE_DEAD_NONCE_LIST_HPP
28
29
#include "
common.hpp
"
30
#include <boost/multi_index_container.hpp>
31
#include <boost/multi_index/sequenced_index.hpp>
32
#include <boost/multi_index/hashed_index.hpp>
33
#include "
core/scheduler.hpp
"
34
35
namespace
nfd {
36
54
class
DeadNonceList
: noncopyable
55
{
56
public
:
64
explicit
65
DeadNonceList
(
const
time::nanoseconds& lifetime =
DEFAULT_LIFETIME
);
66
67
~DeadNonceList
();
68
72
bool
73
has
(
const
Name
& name, uint32_t nonce)
const
;
74
77
void
78
add
(
const
Name
& name, uint32_t nonce);
79
83
size_t
84
size
()
const
;
85
88
const
time::nanoseconds&
89
getLifetime
()
const
;
90
91
private
:
// Entry and Index
92
typedef
uint64_t Entry;
93
94
static
Entry
95
makeEntry(
const
Name
& name, uint32_t nonce);
96
97
typedef
boost::multi_index_container<
98
Entry,
99
boost::multi_index::indexed_by<
100
boost::multi_index::sequenced<>,
101
boost::multi_index::hashed_non_unique<
102
boost::multi_index::identity<Entry>
103
>
104
>
105
> Index;
106
107
typedef
Index::nth_index<0>::type Queue;
108
typedef
Index::nth_index<1>::type Hashtable;
109
110
private
:
// actual lifetime estimation and capacity control
113
size_t
114
countMarks()
const
;
115
118
void
119
mark();
120
126
void
127
adjustCapacity();
128
131
void
132
evictEntries();
133
134
public
:
136
static
const
time::nanoseconds
DEFAULT_LIFETIME
;
137
139
static
const
time::nanoseconds
MIN_LIFETIME
;
140
141
private
:
142
time::nanoseconds m_lifetime;
143
Index m_index;
144
Queue& m_queue;
145
Hashtable& m_ht;
146
147
PUBLIC_WITH_TESTS_ELSE_PRIVATE
:
// actual lifetime estimation and capacity control
148
149
// ---- current capacity and hard limits
150
158
size_t
m_capacity;
159
160
static
const
size_t
INITIAL_CAPACITY;
161
166
static
const
size_t
MIN_CAPACITY;
167
172
static
const
size_t
MAX_CAPACITY;
173
174
// ---- actual entry lifetime estimation
175
182
static
const
Entry MARK;
183
186
static
const
size_t
EXPECTED_MARK_COUNT;
187
193
std::multiset<size_t> m_actualMarkCounts;
194
195
time::nanoseconds m_markInterval;
196
197
scheduler::EventId
m_markEvent;
198
199
// ---- capacity adjustments
200
201
static
const
double
CAPACITY_UP;
202
203
static
const
double
CAPACITY_DOWN;
204
205
time::nanoseconds m_adjustCapacityInterval;
206
207
scheduler::EventId
m_adjustCapacityEvent;
208
211
static
const
size_t
EVICT_LIMIT;
212
};
213
214
inline
const
time::nanoseconds&
215
DeadNonceList::getLifetime
()
const
216
{
217
return
m_lifetime;
218
}
219
220
}
// namespace nfd
221
222
#endif // NFD_DAEMON_TABLE_DEAD_NONCE_LIST_HPP
nfd::DeadNonceList
represents the Dead Nonce list
Definition:
dead-nonce-list.hpp:54
nfd::DeadNonceList::has
bool has(const Name &name, uint32_t nonce) const
determines if name+nonce exists
Definition:
dead-nonce-list.cpp:90
nfd::DeadNonceList::MIN_LIFETIME
static const time::nanoseconds MIN_LIFETIME
minimum entry lifetime
Definition:
dead-nonce-list.hpp:139
nfd::DeadNonceList::~DeadNonceList
~DeadNonceList()
Definition:
dead-nonce-list.cpp:66
nfd::scheduler::EventId
std::shared_ptr< ns3::EventId > EventId
Definition:
scheduler.hpp:39
nfd::DeadNonceList::add
void add(const Name &name, uint32_t nonce)
records name+nonce
Definition:
dead-nonce-list.cpp:97
common.hpp
scheduler.hpp
ns3::ndn::Name
Name
Definition:
ndn-common.cpp:25
nfd::DeadNonceList::getLifetime
const time::nanoseconds & getLifetime() const
Definition:
dead-nonce-list.hpp:215
nfd::DeadNonceList::DEFAULT_LIFETIME
static const time::nanoseconds DEFAULT_LIFETIME
default entry lifetime
Definition:
dead-nonce-list.hpp:136
nfd::DeadNonceList::DeadNonceList
DeadNonceList(const time::nanoseconds &lifetime=DEFAULT_LIFETIME)
constructs the Dead Nonce List
Definition:
dead-nonce-list.cpp:45
PUBLIC_WITH_TESTS_ELSE_PRIVATE
#define PUBLIC_WITH_TESTS_ELSE_PRIVATE
Definition:
common.hpp:39
nfd::DeadNonceList::size
size_t size() const
Definition:
dead-nonce-list.cpp:84
ndnSIM
NFD
daemon
table
dead-nonce-list.hpp
Generated on Wed Feb 18 2015 16:31:16 for ndnSIM by
1.8.7