NS-3 based Named Data Networking (NDN) simulator
ndnSIM 2.0: NDN, CCN, CCNx, content centric networks
API Documentation
retx-suppression-fixed.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 
31 const time::milliseconds RetxSuppressionFixed::DEFAULT_MIN_RETX_INTERVAL(100);
32 
33 RetxSuppressionFixed::RetxSuppressionFixed(const time::milliseconds& minRetxInterval)
34  : m_minRetxInterval(minRetxInterval)
35 {
36  BOOST_ASSERT(minRetxInterval > time::milliseconds::zero());
37 }
38 
40 RetxSuppressionFixed::decide(const Face& inFace, const Interest& interest,
41  pit::Entry& pitEntry) const
42 {
43  bool isNewPitEntry = !pitEntry.hasUnexpiredOutRecords();
44  if (isNewPitEntry) {
45  return NEW;
46  }
47 
48  time::steady_clock::TimePoint lastOutgoing = this->getLastOutgoing(pitEntry);
50  time::steady_clock::Duration sinceLastOutgoing = now - lastOutgoing;
51  bool shouldSuppress = sinceLastOutgoing < m_minRetxInterval;
52  return shouldSuppress ? SUPPRESS : FORWARD;
53 }
54 
55 } // namespace fw
56 } // namespace nfd
time_point TimePoint
Definition: time.hpp:108
static const time::milliseconds DEFAULT_MIN_RETX_INTERVAL
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...
static time_point now() noexcept
Definition: time.cpp:79
Interest is retransmission and should be suppressed.
time::steady_clock::TimePoint getLastOutgoing(const pit::Entry &pitEntry) const
represents an Interest packet
Definition: interest.hpp:45
represents a face
Definition: face.hpp:57
Interest is new (not a retransmission)
Copyright (c) 2011-2015 Regents of the University of California.
Definition: ndn-common.hpp:38
represents a PIT entry
Definition: pit-entry.hpp:67
Interest is retransmission and should be forwarded.
RetxSuppressionFixed(const time::milliseconds &minRetxInterval=DEFAULT_MIN_RETX_INTERVAL)
bool hasUnexpiredOutRecords() const
Definition: pit-entry.cpp:189