NS-3 based Named Data Networking (NDN) simulator
ndnSIM 2.3: 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 #include "algorithm.hpp"
28 
29 namespace nfd {
30 namespace fw {
31 
32 const time::milliseconds RetxSuppressionFixed::DEFAULT_MIN_RETX_INTERVAL(100);
33 
34 RetxSuppressionFixed::RetxSuppressionFixed(const time::milliseconds& minRetxInterval)
35  : m_minRetxInterval(minRetxInterval)
36 {
37  BOOST_ASSERT(minRetxInterval > time::milliseconds::zero());
38 }
39 
41 RetxSuppressionFixed::decide(const Face& inFace, const Interest& interest,
42  pit::Entry& pitEntry) const
43 {
44  bool isNewPitEntry = !hasPendingOutRecords(pitEntry);
45  if (isNewPitEntry) {
46  return NEW;
47  }
48 
49  time::steady_clock::TimePoint lastOutgoing = this->getLastOutgoing(pitEntry);
51  time::steady_clock::Duration sinceLastOutgoing = now - lastOutgoing;
52  bool shouldSuppress = sinceLastOutgoing < m_minRetxInterval;
53  return shouldSuppress ? SUPPRESS : FORWARD;
54 }
55 
56 } // namespace fw
57 } // namespace nfd
time_point TimePoint
Definition: time.hpp:120
static const time::milliseconds DEFAULT_MIN_RETX_INTERVAL
generalization of a network interface
Definition: face.hpp:67
static time_point now() noexcept
Definition: time.cpp:79
virtual Result decide(const Face &inFace, const Interest &interest, pit::Entry &pitEntry) const override
determines whether Interest is a retransmission, and if so, whether it shall be forwarded or suppress...
Interest is retransmission and should be suppressed.
represents an Interest packet
Definition: interest.hpp:42
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
an Interest table entry
Definition: pit-entry.hpp:57
bool hasPendingOutRecords(const pit::Entry &pitEntry)
determine whether pitEntry has any pending out-records
Definition: algorithm.cpp:136
Copyright (c) 2014-2016, Regents of the University of California, Arizona Board of Regents...
Interest is retransmission and should be forwarded.
RetxSuppressionFixed(const time::milliseconds &minRetxInterval=DEFAULT_MIN_RETX_INTERVAL)