22 #ifndef NDNSIM_PER_OUT_FACE_LIMITS_H 
   23 #define NDNSIM_PER_OUT_FACE_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>
 
   78     ObjectFactory factory (m_limitType);
 
   79     Ptr<Limits> limits = factory.template Create<Limits> ();
 
   80     face->AggregateObject (limits);
 
   82     super::AddFace (face);
 
   90                       Ptr<const Interest> interest,
 
   91                       Ptr<pit::Entry> pitEntry);
 
   96                               Ptr<pit::Entry> pitEntry);
 
  102   std::string m_limitType;
 
  105 template<
class Parent>
 
  108 template<
class Parent>
 
  112   return super::GetLogName ()+
".PerOutFaceLimits";
 
  115 template<
class Parent>
 
  119   static TypeId tid = TypeId ((super::GetTypeId ().GetName ()+
"::PerOutFaceLimits").c_str ())
 
  120     .SetGroupName (
"Ndn")
 
  121     .template SetParent <super> ()
 
  122     .
template AddConstructor <PerOutFaceLimits> ()
 
  124     .AddAttribute (
"Limit", 
"Limit type to be used (e.g., ns3::ndn::Limits::Window or ns3::ndn::Limits::Rate)",
 
  125                    StringValue (
"ns3::ndn::Limits::Window"),
 
  127                    MakeStringChecker ())    
 
  132 template<
class Parent>
 
  136                                               Ptr<const Interest> interest,
 
  137                                               Ptr<pit::Entry> pitEntry)
 
  139   NS_LOG_FUNCTION (
this << pitEntry->GetPrefix ());
 
  141   Ptr<Limits> faceLimits = outFace->template GetObject<Limits> ();
 
  142   if (faceLimits->IsBelowLimit ())
 
  144       if (super::CanSendOutInterest (inFace, outFace, interest, pitEntry))
 
  146           faceLimits->BorrowLimit ();
 
  154 template<
class Parent>
 
  158   NS_LOG_FUNCTION (
this << pitEntry->GetPrefix ());
 
  160   for (pit::Entry::out_container::iterator face = pitEntry->GetOutgoing ().begin ();
 
  161        face != pitEntry->GetOutgoing ().end ();
 
  164       Ptr<Limits> faceLimits = face->m_face->GetObject<
Limits> ();
 
  165       for (uint32_t i = 0; i <= face->m_retxCount; i++)
 
  169   super::WillEraseTimedOutPendingInterest (pitEntry);
 
  173 template<
class Parent>
 
  176                                                       Ptr<pit::Entry> pitEntry)
 
  178   NS_LOG_FUNCTION (
this << pitEntry->GetPrefix ());
 
  180   for (pit::Entry::out_container::iterator face = pitEntry->GetOutgoing ().begin ();
 
  181        face != pitEntry->GetOutgoing ().end ();
 
  184       Ptr<Limits> faceLimits = face->m_face->GetObject<
Limits> ();
 
  185       for (uint32_t i = 0; i <= face->m_retxCount; i++)
 
  189   super::WillSatisfyPendingInterest (inFace, pitEntry);
 
  196 #endif // NDNSIM_PER_OUT_FACE_LIMITS_H 
PerOutFaceLimits()
Default constructor. 
 
Abstract class to manage Interest limits. 
 
virtual void WillEraseTimedOutPendingInterest(Ptr< pit::Entry > pitEntry)
Event fired just before PIT entry is removed by timeout. 
 
Strategy implementing per-outgoing face limits. 
 
virtual void AddFace(Ptr< Face > face)
Event fired every time face is added to NDN stack. 
 
static TypeId GetTypeId()
Get TypeId of the class. 
 
virtual void ReturnLimit()=0
"Return" limit 
 
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 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.