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
retx-suppression-exponential.cpp
Go to the documentation of this file.
1
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
26
#include "
retx-suppression-exponential.hpp
"
27
28
namespace
nfd
{
29
namespace
fw {
30
31
const
RetxSuppressionExponential::Duration
RetxSuppressionExponential::DEFAULT_INITIAL_INTERVAL
=
32
time::milliseconds(1);
33
const
float
RetxSuppressionExponential::DEFAULT_MULTIPLIER
= 2.0;
34
const
RetxSuppressionExponential::Duration
RetxSuppressionExponential::DEFAULT_MAX_INTERVAL
=
35
time::milliseconds(250);
36
37
class
RetxSuppressionExponential::PitInfo
:
public
StrategyInfo
38
{
39
public
:
40
static
constexpr
int
41
getTypeId
()
42
{
43
return
1020;
44
}
45
46
explicit
47
PitInfo
(
const
Duration
& initialInterval)
48
:
suppressionInterval
(initialInterval)
49
{
50
}
51
52
public
:
56
Duration
suppressionInterval
;
57
};
58
59
RetxSuppressionExponential::RetxSuppressionExponential
(
const
Duration
& initialInterval,
60
float
multiplier,
61
const
Duration
& maxInterval)
62
: m_initialInterval(initialInterval)
63
, m_multiplier(multiplier)
64
, m_maxInterval(maxInterval)
65
{
66
BOOST_ASSERT(initialInterval > time::milliseconds::zero());
67
BOOST_ASSERT(multiplier >= 1.0);
68
BOOST_ASSERT(maxInterval >= initialInterval);
69
}
70
71
RetxSuppression::Result
72
RetxSuppressionExponential::decide
(
const
Face
& inFace,
const
Interest
& interest,
73
pit::Entry
& pitEntry)
const
74
{
75
bool
isNewPitEntry = !pitEntry.
hasUnexpiredOutRecords
();
76
if
(isNewPitEntry) {
77
return
NEW
;
78
}
79
80
time::steady_clock::TimePoint
lastOutgoing = this->
getLastOutgoing
(pitEntry);
81
time::steady_clock::TimePoint
now =
time::steady_clock::now
();
82
time::steady_clock::Duration
sinceLastOutgoing = now - lastOutgoing;
83
84
shared_ptr<PitInfo> pi = pitEntry.
getOrCreateStrategyInfo
<
PitInfo
>(m_initialInterval);
85
bool
shouldSuppress = sinceLastOutgoing < pi->
suppressionInterval
;
86
87
if
(shouldSuppress) {
88
return
SUPPRESS
;
89
}
90
91
pi->suppressionInterval = std::min(m_maxInterval,
92
time::duration_cast<Duration>(pi->suppressionInterval * m_multiplier));
93
return
FORWARD
;
94
}
95
96
}
// namespace fw
97
}
// namespace nfd
ndn::time::steady_clock::TimePoint
time_point TimePoint
Definition:
time.hpp:108
nfd::fw::RetxSuppressionExponential::DEFAULT_INITIAL_INTERVAL
static const Duration DEFAULT_INITIAL_INTERVAL
Definition:
retx-suppression-exponential.hpp:62
retx-suppression-exponential.hpp
ndn::time::steady_clock::now
static time_point now() noexcept
Definition:
time.cpp:79
nfd::fw::RetxSuppressionExponential::PitInfo::suppressionInterval
Duration suppressionInterval
if last transmission occurred within suppressionInterval, retransmission will be suppressed ...
Definition:
retx-suppression-exponential.cpp:56
nfd::fw::RetxSuppression::SUPPRESS
Interest is retransmission and should be suppressed.
Definition:
retx-suppression.hpp:50
nfd::fw::RetxSuppression::getLastOutgoing
time::steady_clock::TimePoint getLastOutgoing(const pit::Entry &pitEntry) const
Definition:
retx-suppression.cpp:32
ndn::Interest
represents an Interest packet
Definition:
interest.hpp:45
nfd::fw::RetxSuppressionExponential::DEFAULT_MULTIPLIER
static const float DEFAULT_MULTIPLIER
Definition:
retx-suppression-exponential.hpp:66
nfd::Face
represents a face
Definition:
face.hpp:57
nfd::fw::RetxSuppression::NEW
Interest is new (not a retransmission)
Definition:
retx-suppression.hpp:42
nfd::fw::RetxSuppressionExponential::DEFAULT_MAX_INTERVAL
static const Duration DEFAULT_MAX_INTERVAL
Definition:
retx-suppression-exponential.hpp:67
nfd
Copyright (c) 2011-2015 Regents of the University of California.
Definition:
ndn-common.hpp:38
nfd::pit::Entry
represents a PIT entry
Definition:
pit-entry.hpp:67
nfd::StrategyInfoHost::getOrCreateStrategyInfo
shared_ptr< T > getOrCreateStrategyInfo(A &&...args)
get or create a StrategyInfo item
Definition:
strategy-info-host.hpp:104
nfd::fw::RetxSuppressionExponential::PitInfo::PitInfo
PitInfo(const Duration &initialInterval)
Definition:
retx-suppression-exponential.cpp:47
nfd::fw::RetxSuppressionExponential::RetxSuppressionExponential
RetxSuppressionExponential(const Duration &initialInterval=DEFAULT_INITIAL_INTERVAL, float multiplier=DEFAULT_MULTIPLIER, const Duration &maxInterval=DEFAULT_MAX_INTERVAL)
Definition:
retx-suppression-exponential.cpp:59
nfd::fw::RetxSuppressionExponential::decide
virtual Result decide(const Face &inFace, const Interest &interest, pit::Entry &pitEntry) const 1
determines whether Interest is a retransmission, and if so, whether it shall be forwarded or suppress...
Definition:
retx-suppression-exponential.cpp:72
nfd::fw::RetxSuppressionExponential::Duration
time::microseconds Duration
time granularity
Definition:
retx-suppression-exponential.hpp:45
nfd::fw::RetxSuppression::FORWARD
Interest is retransmission and should be forwarded.
Definition:
retx-suppression.hpp:46
nfd::fw::RetxSuppressionExponential::PitInfo
Definition:
retx-suppression-exponential.cpp:37
ndn::time::steady_clock::Duration
duration Duration
Definition:
time.hpp:109
nfd::pit::Entry::hasUnexpiredOutRecords
bool hasUnexpiredOutRecords() const
Definition:
pit-entry.cpp:189
nfd::fw::RetxSuppressionExponential::PitInfo::getTypeId
static constexpr int getTypeId()
Definition:
retx-suppression-exponential.cpp:41
nfd::fw::RetxSuppression::Result
Result
Definition:
retx-suppression.hpp:39
nfd::fw::StrategyInfo
contains arbitrary information forwarding strategy places on table entries
Definition:
strategy-info.hpp:36
ndnSIM
NFD
daemon
fw
retx-suppression-exponential.cpp
Generated on Tue Feb 23 2016 22:18:44 for ndnSIM by
1.8.11