nfd::DeadNonceList Class Reference

Represents the Dead Nonce List. More...

#include <daemon/table/dead-nonce-list.hpp>

+ Inheritance diagram for nfd::DeadNonceList:
+ Collaboration diagram for nfd::DeadNonceList:

Public Member Functions

 DeadNonceList (time::nanoseconds lifetime=DEFAULT_LIFETIME)
 Constructs the Dead Nonce List. More...
 ~DeadNonceList ()
void add (const Name &name, Interest::Nonce nonce)
 Records name+nonce. More...
time::nanoseconds getLifetime () const
bool has (const Name &name, Interest::Nonce nonce) const
 Determines if name+nonce exists. More...
size_t size () const

Static Public Attributes

static const time::nanoseconds DEFAULT_LIFETIME = 6_s
 Default entry lifetime. More...
static const time::nanoseconds MIN_LIFETIME = 1_ms
 Minimum entry lifetime. More...

Detailed Description

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.

Constructor & Destructor Documentation

◆ DeadNonceList()

nfd::DeadNonceList::DeadNonceList ( time::nanoseconds  lifetime = DEFAULT_LIFETIME)

Constructs the Dead Nonce List.

lifetimeduration 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_argumentif lifetime is less than MIN_LIFETIME

Definition at line 46 of file dead-nonce-list.cpp.

◆ ~DeadNonceList()

nfd::DeadNonceList::~DeadNonceList ( )

Definition at line 66 of file dead-nonce-list.cpp.

Member Function Documentation

◆ add()

void nfd::DeadNonceList::add ( const Name &  name,
Interest::Nonce  nonce 

Records name+nonce.

Definition at line 97 of file dead-nonce-list.cpp.

◆ getLifetime()

time::nanoseconds nfd::DeadNonceList::getLifetime ( ) const
expected lifetime

Definition at line 89 of file dead-nonce-list.hpp.

◆ has()

bool nfd::DeadNonceList::has ( const Name &  name,
Interest::Nonce  nonce 
) const

Determines if name+nonce exists.

true if name+nonce exists, false otherwise

Definition at line 90 of file dead-nonce-list.cpp.

◆ size()

size_t nfd::DeadNonceList::size ( ) const
number of stored Nonces
The return value does not contain non-Nonce entries in the index, if any.

Definition at line 84 of file dead-nonce-list.cpp.

Member Data Documentation


const time::nanoseconds nfd::DeadNonceList::DEFAULT_LIFETIME = 6_s

Default entry lifetime.

Definition at line 139 of file dead-nonce-list.hpp.


const time::nanoseconds nfd::DeadNonceList::MIN_LIFETIME = 1_ms

Minimum entry lifetime.

Definition at line 141 of file dead-nonce-list.hpp.