NS-3 based Named Data Networking (NDN) simulator
ndnSIM 2.5: NDN, CCN, CCNx, content centric networks
API Documentation
retx-suppression-exponential.cpp
Go to the documentation of this file.
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2 /*
3  * Copyright (c) 2014-2017, 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 
27 
28 namespace nfd {
29 namespace fw {
30 
32  time::milliseconds(1);
35  time::milliseconds(250);
36 
38 {
39 public:
40  static constexpr int
42  {
43  return 1020;
44  }
45 
46  explicit
47  PitInfo(const Duration& initialInterval)
48  : suppressionInterval(initialInterval)
49  {
50  }
51 
52 public:
57 };
58 
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 
73 {
74  bool isNewPitEntry = !hasPendingOutRecords(pitEntry);
75  if (isNewPitEntry) {
77  }
78 
79  time::steady_clock::TimePoint lastOutgoing = getLastOutgoing(pitEntry);
81  time::steady_clock::Duration sinceLastOutgoing = now - lastOutgoing;
82 
83  PitInfo* pi = pitEntry.insertStrategyInfo<PitInfo>(m_initialInterval).first;
84  bool shouldSuppress = sinceLastOutgoing < pi->suppressionInterval;
85 
86  if (shouldSuppress) {
88  }
89 
90  pi->suppressionInterval = std::min(m_maxInterval,
91  time::duration_cast<Duration>(pi->suppressionInterval * m_multiplier));
92 
94 }
95 
98 {
99  // NEW if outRecord for the face does not exist
100  auto outRecord = pitEntry.getOutRecord(outFace);
101  if (outRecord == pitEntry.out_end()) {
103  }
104 
105  time::steady_clock::TimePoint lastOutgoing = outRecord->getLastRenewed();
107  time::steady_clock::Duration sinceLastOutgoing = now - lastOutgoing;
108 
109  // insertStrategyInfo does not insert m_initialInterval again if it already exists
110  PitInfo* pi = outRecord->insertStrategyInfo<PitInfo>(m_initialInterval).first;
111  bool shouldSuppress = sinceLastOutgoing < pi->suppressionInterval;
112 
113  if (shouldSuppress) {
115  }
116 
118 }
119 
120 void
122 {
123  PitInfo* pi = outRecord.insertStrategyInfo<PitInfo>(m_initialInterval).first;
124  pi->suppressionInterval = std::min(m_maxInterval,
125  time::duration_cast<Duration>(pi->suppressionInterval * m_multiplier));
126 }
127 
128 } // namespace fw
129 } // namespace nfd
time_point TimePoint
Definition: time.hpp:226
Interest is retransmission and should be forwarded.
OutRecordCollection::iterator getOutRecord(const Face &face)
get the out-record for face
Definition: pit-entry.cpp:90
generalization of a network interface
Definition: face.hpp:67
static time_point now() noexcept
Definition: time.cpp:80
Duration suppressionInterval
if last transmission occurred within suppressionInterval, retransmission will be suppressed ...
OutRecordCollection::iterator out_end()
Definition: pit-entry.hpp:189
RetxSuppressionResult decidePerUpstream(pit::Entry &pitEntry, Face &outFace)
determines whether Interest is a retransmission per upstream and if so, whether it shall be forwarded...
Interest is retransmission and should be suppressed.
Copyright (c) 2011-2015 Regents of the University of California.
Definition: ndn-common.hpp:40
an Interest table entry
Definition: pit-entry.hpp:57
void incrementIntervalForOutRecord(pit::OutRecord &outRecord)
Increment the suppression interval for out record.
Interest is new (not a retransmission)
RetxSuppressionExponential(const Duration &initialInterval=DEFAULT_INITIAL_INTERVAL, float multiplier=DEFAULT_MULTIPLIER, const Duration &maxInterval=DEFAULT_MAX_INTERVAL)
bool hasPendingOutRecords(const pit::Entry &pitEntry)
determine whether pitEntry has any pending out-records
Definition: algorithm.cpp:113
std::pair< T *, bool > insertStrategyInfo(A &&... args)
insert a StrategyInfo item
time::steady_clock::TimePoint getLastOutgoing(const pit::Entry &pitEntry)
Definition: algorithm.cpp:124
time::microseconds Duration
time granularity
contains information about an Interest toward an outgoing face
RetxSuppressionResult decidePerPitEntry(pit::Entry &pitEntry)
determines whether Interest is a retransmission per pit entry and if so, whether it shall be forwarde...
contains arbitrary information forwarding strategy places on table entries