23 #include "ns3/ndn-pit.h" 
   24 #include "ns3/ndn-pit-entry.h" 
   25 #include "ns3/ndn-interest.h" 
   26 #include "ns3/ndn-data.h" 
   27 #include "ns3/ndn-pit.h" 
   28 #include "ns3/ndn-fib.h" 
   29 #include "ns3/ndn-content-store.h" 
   30 #include "ns3/ndnSIM/utils/ndn-fw-hop-count-tag.h" 
   32 #include "ns3/assert.h" 
   35 #include "ns3/simulator.h" 
   36 #include "ns3/boolean.h" 
   37 #include "ns3/string.h" 
   39 #include <boost/ref.hpp> 
   40 #include <boost/foreach.hpp> 
   41 #include <boost/lambda/lambda.hpp> 
   42 #include <boost/lambda/bind.hpp> 
   43 #include <boost/tuple/tuple.hpp> 
   44 namespace ll = boost::lambda;
 
   46 NS_LOG_COMPONENT_DEFINE (
"ndn.fw.Nacks");
 
   52 NS_OBJECT_ENSURE_REGISTERED (Nacks);
 
   55 Nacks::GetTypeId (
void)
 
   57   static TypeId tid = TypeId (
"ns3::ndn::fw::Nacks")
 
   64     .AddTraceSource (
"OutNacks",  
"OutNacks",  MakeTraceSourceAccessor (&
Nacks::m_outNacks))
 
   65     .AddTraceSource (
"InNacks",   
"InNacks",   MakeTraceSourceAccessor (&
Nacks::m_inNacks))
 
   66     .AddTraceSource (
"DropNacks", 
"DropNacks", MakeTraceSourceAccessor (&
Nacks::m_dropNacks))
 
   68     .AddAttribute (
"EnableNACKs", 
"Enabling support of NACKs",
 
   70                    MakeBooleanAccessor (&Nacks::m_nacksEnabled),
 
   71                    MakeBooleanChecker ())
 
   78                    Ptr<Interest> interest)
 
   80   if (interest->GetNack () > 0)
 
   81     OnNack (inFace, interest);
 
   87 Nacks::OnNack (Ptr<Face> inFace,
 
   93   Ptr<pit::Entry> pitEntry = 
m_pit->Lookup (*nack);
 
  101   DidReceiveValidNack (inFace, nack->GetNack (), nack, pitEntry);
 
  106                                     Ptr<const Interest> interest,
 
  107                                     Ptr<pit::Entry> pitEntry)
 
  113       NS_LOG_DEBUG (
"Sending NACK_LOOP");
 
  114       Ptr<Interest> nack = Create<Interest> (*interest);
 
  115       nack->SetNack (Interest::NACK_LOOP);
 
  117       inFace->SendInterest (nack);
 
  124                                     Ptr<const Interest> interest,
 
  125                                     Ptr<pit::Entry> pitEntry)
 
  129       Ptr<Interest> nack = Create<Interest> (*interest);
 
  130       nack->SetNack (Interest::NACK_GIVEUP_PIT);
 
  134           NS_LOG_DEBUG (
"Send NACK for " << boost::cref (nack->GetName ()) << 
" to " << boost::cref (*incoming.
m_face));
 
  135           incoming.
m_face->SendInterest (nack);
 
  139       pitEntry->ClearOutgoing (); 
 
  146 Nacks::DidReceiveValidNack (Ptr<Face> inFace,
 
  148                             Ptr<const Interest> nack,
 
  149                             Ptr<pit::Entry> pitEntry)
 
  151   NS_LOG_DEBUG (
"nackCode: " << nackCode << 
" for [" << nack->GetName () << 
"]");
 
  155   if (nackCode == Interest::NACK_GIVEUP_PIT)
 
  157       pitEntry->RemoveIncoming (inFace);
 
  160   if (nackCode == Interest::NACK_LOOP ||
 
  161       nackCode == Interest::NACK_CONGESTION ||
 
  162       nackCode == Interest::NACK_GIVEUP_PIT)
 
  164       pitEntry->SetWaitingInVain (inFace);
 
  166       if (!pitEntry->AreAllOutgoingInVain ()) 
 
  168           NS_LOG_DEBUG (
"Not all outgoing are in vain");
 
  175       Ptr<Interest> interest = Create<Interest> (*nack);
 
  176       interest->SetNack (Interest::NORMAL_INTEREST);
 
virtual void OnInterest(Ptr< Face > face, Ptr< Interest > interest)
Actual processing of incoming Ndn interests. 
 
virtual bool DoPropagateInterest(Ptr< Face > inFace, Ptr< const Interest > interest, Ptr< pit::Entry > pitEntry)=0
Virtual method to perform Interest propagation according to the forwarding strategy logic...
 
TracedCallback< Ptr< const Interest >, Ptr< const Face > > m_outNacks
trace of outgoing NACKs 
 
virtual void DidExhaustForwardingOptions(Ptr< Face > inFace, Ptr< const Interest > interest, Ptr< pit::Entry > pitEntry)
An even that is fired when Interest cannot be forwarded. 
 
Ptr< Face > m_face
face of the incoming Interest 
 
TracedCallback< Ptr< const Interest >, Ptr< const Face > > m_dropNacks
trace of dropped NACKs 
 
virtual void DidReceiveDuplicateInterest(Ptr< Face > inFace, Ptr< const Interest > interest, Ptr< pit::Entry > pitEntry)
An event that is fired every time a duplicated Interest is received. 
 
ForwardingStrategy()
Default constructor. 
 
TracedCallback< Ptr< const Interest >, Ptr< const Face > > m_inNacks
trace of incoming NACKs 
 
Ptr< Pit > m_pit
Reference to PIT to which this forwarding strategy is associated. 
 
virtual void DidExhaustForwardingOptions(Ptr< Face > inFace, Ptr< const Interest > interest, Ptr< pit::Entry > pitEntry)
An even that is fired when Interest cannot be forwarded. 
 
virtual void OnInterest(Ptr< Face > face, Ptr< Interest > interest)
Actual processing of incoming Ndn interests. 
 
virtual void DidReceiveDuplicateInterest(Ptr< Face > inFace, Ptr< const Interest > interest, Ptr< pit::Entry > pitEntry)
An event that is fired every time a duplicated Interest is received. 
 
PIT state component for each incoming interest (not including duplicates)