NS-3 based Named Data Networking (NDN) simulator
ndnSIM 2.0: 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; -*- */
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 
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);
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
time_point TimePoint
Definition: time.hpp:108
static time_point now() noexcept
Definition: time.cpp:79
Duration suppressionInterval
if last transmission occurred within suppressionInterval, retransmission will be suppressed ...
Interest is retransmission and should be suppressed.
represents an Interest packet
Definition: interest.hpp:45
Interest is new (not a retransmission)
time::steady_clock::TimePoint getLastOutgoing(const pit::Entry &pitEntry) const
Copyright (c) 2011-2015 Regents of the University of California.
Definition: ndn-common.hpp:40
represents a PIT entry
Definition: pit-entry.hpp:69
bool hasUnexpiredOutRecords() const
Definition: pit-entry.cpp:199
RetxSuppressionExponential(const Duration &initialInterval=DEFAULT_INITIAL_INTERVAL, float multiplier=DEFAULT_MULTIPLIER, const Duration &maxInterval=DEFAULT_MAX_INTERVAL)
shared_ptr< T > getOrCreateStrategyInfo(A &&... args)
get or create a StrategyInfo item
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...
time::microseconds Duration
time granularity
Interest is retransmission and should be forwarded.
contains arbitrary information forwarding strategy places on table entries