22 #ifndef NDNSIM_PER_FIB_LIMITS_H 
   23 #define NDNSIM_PER_FIB_LIMITS_H 
   25 #include "ns3/event-id.h" 
   27 #include "ns3/ndn-pit.h" 
   28 #include "ns3/ndn-pit-entry.h" 
   29 #include "ns3/simulator.h" 
   30 #include "ns3/string.h" 
   32 #include "ns3/ndn-forwarding-strategy.h" 
   34 #include "ns3/ndn-limits.h" 
   44 template<
class Parent>
 
   75     super::AddFace (face);
 
   77     if (face->GetObject<
Limits> () == 0)
 
   79         NS_FATAL_ERROR (
"At least per-face limits should be enabled");
 
   88     ObjectFactory factory;
 
   89     factory.SetTypeId (fibEntry->m_faces.begin ()->GetFace ()->GetObject<
Limits> ()->GetInstanceTypeId ());
 
   91     Ptr<Limits> limits = factory.template Create<Limits> ();
 
   92     fibEntry->AggregateObject (limits);
 
   94     super::DidAddFibEntry (fibEntry);
 
  102                       Ptr<const Interest> interest,
 
  103                       Ptr<pit::Entry> pitEntry);
 
  108                               Ptr<pit::Entry> pitEntry);
 
  114   std::string m_limitType;
 
  117 template<
class Parent>
 
  120 template<
class Parent>
 
  124   return super::GetLogName ()+
".PerFibLimits";
 
  127 template<
class Parent>
 
  131   static TypeId tid = TypeId ((super::GetTypeId ().GetName ()+
"::PerFibLimits").c_str ())
 
  132     .SetGroupName (
"Ndn")
 
  133     .template SetParent <super> ()
 
  134     .
template AddConstructor <PerFibLimits> ()
 
  139 template<
class Parent>
 
  143                                           Ptr<const Interest> interest,
 
  144                                           Ptr<pit::Entry> pitEntry)
 
  146   NS_LOG_FUNCTION (
this << pitEntry->GetPrefix ());
 
  148   Ptr<Limits> fibLimits = pitEntry->GetFibEntry ()->template GetObject<Limits> ();
 
  151   if (fibLimits->IsBelowLimit ())
 
  153       if (super::CanSendOutInterest (inFace, outFace, interest, pitEntry))
 
  155           fibLimits->BorrowLimit ();
 
  163 template<
class Parent>
 
  167   NS_LOG_FUNCTION (
this << pitEntry->GetPrefix ());
 
  169   Ptr<Limits> fibLimits = pitEntry->GetFibEntry ()->template GetObject<Limits> ();
 
  171   for (pit::Entry::out_container::iterator face = pitEntry->GetOutgoing ().begin ();
 
  172        face != pitEntry->GetOutgoing ().end ();
 
  175       for (uint32_t i = 0; i <= face->m_retxCount; i++)
 
  176         fibLimits->ReturnLimit ();
 
  179   super::WillEraseTimedOutPendingInterest (pitEntry);
 
  183 template<
class Parent>
 
  186                                                   Ptr<pit::Entry> pitEntry)
 
  188   NS_LOG_FUNCTION (
this << pitEntry->GetPrefix ());
 
  190   Ptr<Limits> fibLimits = pitEntry->GetFibEntry ()->template GetObject<Limits> ();
 
  192   for (pit::Entry::out_container::iterator face = pitEntry->GetOutgoing ().begin ();
 
  193        face != pitEntry->GetOutgoing ().end ();
 
  196       for (uint32_t i = 0; i <= face->m_retxCount; i++)
 
  197         fibLimits->ReturnLimit ();
 
  200   super::WillSatisfyPendingInterest (inFace, pitEntry);
 
  207 #endif // NDNSIM_PER_FIB_LIMITS_H 
Abstract class to manage Interest limits. 
 
virtual void WillEraseTimedOutPendingInterest(Ptr< pit::Entry > pitEntry)
Event fired just before PIT entry is removed by timeout. 
 
virtual void AddFace(Ptr< Face > face)
Event fired every time face is added to NDN stack. 
 
PerFibLimits()
Default constructor. 
 
Strategy implementing per-FIB entry limits. 
 
virtual void WillSatisfyPendingInterest(Ptr< Face > inFace, Ptr< pit::Entry > pitEntry)
Even fired just before Interest will be satisfied. 
 
static std::string GetLogName()
Helper function to retrieve logging name for the forwarding strategy. 
 
static LogComponent g_log
Logging variable. 
 
virtual bool CanSendOutInterest(Ptr< Face > inFace, Ptr< Face > outFace, Ptr< const Interest > interest, Ptr< pit::Entry > pitEntry)
Method to check whether Interest can be send out on the particular face or not. 
 
virtual void DidAddFibEntry(Ptr< fib::Entry > fibEntry)
Event fired every time a FIB entry is added to FIB.