represents the Dead Nonce list More...
#include <dead-nonce-list.hpp>
Public Member Functions | |
DeadNonceList (const time::nanoseconds &lifetime=DEFAULT_LIFETIME) | |
constructs the Dead Nonce List More... | |
~DeadNonceList () | |
bool | has (const Name &name, uint32_t nonce) const |
determines if name+nonce exists More... | |
void | add (const Name &name, uint32_t nonce) |
records name+nonce More... | |
size_t | size () const |
const time::nanoseconds & | getLifetime () const |
Static Public Attributes | |
static const time::nanoseconds | DEFAULT_LIFETIME = time::seconds(6) |
default entry lifetime More... | |
static const time::nanoseconds | MIN_LIFETIME = time::milliseconds(1) |
minimum entry lifetime More... | |
represents the Dead Nonce list
The Dead Nonce List is a global table that supplements PIT for loop detection. When a Nonce is erased (dead) from PIT entry, the Nonce and the Interest Name is added to Dead Nonce List, and kept for a duration in which most loops are expected to have occured.
To reduce memory usage, the Interest Name and Nonce are stored as a 64-bit hash. There could be false positives (non-looping Interest could be considered looping), but the probability is small, and the error is recoverable when consumer retransmits with a different Nonce.
To reduce memory usage, entries do not have associated timestamps. Instead, lifetime of entries is controlled by dynamically adjusting the capacity of the container. At fixed intervals, the MARK, an entry with a special value, is inserted into the container. The number of MARKs stored in the container reflects the lifetime of entries, because MARKs are inserted at fixed intervals.
Definition at line 54 of file dead-nonce-list.hpp.
|
explicit |
constructs the Dead Nonce List
lifetime | duration of the expected lifetime of each nonce, must be no less than MIN_LIFETIME. This should be set to the duration in which most loops would have occured. A loop cannot be detected if delay of the cycle is greater than lifetime. |
std::invalid_argument | if lifetime is less than MIN_LIFETIME |
Definition at line 45 of file dead-nonce-list.cpp.
References MIN_LIFETIME, and nfd::scheduler::schedule().
nfd::DeadNonceList::~DeadNonceList | ( | ) |
Definition at line 66 of file dead-nonce-list.cpp.
References nfd::scheduler::cancel(), DEFAULT_LIFETIME, and MIN_LIFETIME.
bool nfd::DeadNonceList::has | ( | const Name & | name, |
uint32_t | nonce | ||
) | const |
determines if name+nonce exists
Definition at line 90 of file dead-nonce-list.cpp.
Referenced by nfd::Forwarder::Forwarder().
void nfd::DeadNonceList::add | ( | const Name & | name, |
uint32_t | nonce | ||
) |
records name+nonce
Definition at line 97 of file dead-nonce-list.cpp.
References CityHash64WithSeed(), NFD_LOG_TRACE, nfd::scheduler::schedule(), ndn::Block::size(), ndn::Block::wire(), and ndn::Name::wireEncode().
Referenced by nfd::insertNonceToDnl().
size_t nfd::DeadNonceList::size | ( | ) | const |
Definition at line 84 of file dead-nonce-list.cpp.
|
inline |
Definition at line 215 of file dead-nonce-list.hpp.
Referenced by nfd::insertNonceToDnl().
|
static |
default entry lifetime
Definition at line 136 of file dead-nonce-list.hpp.
Referenced by ~DeadNonceList().
|
static |
minimum entry lifetime
Definition at line 139 of file dead-nonce-list.hpp.
Referenced by DeadNonceList(), and ~DeadNonceList().