File tree Expand file tree Collapse file tree 2 files changed +14
-8
lines changed Expand file tree Collapse file tree 2 files changed +14
-8
lines changed Original file line number Diff line number Diff line change 1818 **/  
1919
2020#include  " ndn-cs-tracer.hpp" 
21+ #include  " fw/forwarder.hpp" 
22+ #include  " model/ndn-l3-protocol.hpp" 
2123#include  " ns3/node.h" 
2224#include  " ns3/packet.h" 
2325#include  " ns3/config.h" 
@@ -199,10 +201,14 @@ CsTracer::~CsTracer(){};
199201void 
200202CsTracer::Connect ()
201203{
202-   //  // @TODO Do the same with NFD content store...
203-   //  Ptr<ContentStore> cs = m_nodePtr->GetObject<ContentStore>();
204-   //  cs->TraceConnectWithoutContext("CacheHits", MakeCallback(&CsTracer::CacheHits, this));
205-   //  cs->TraceConnectWithoutContext("CacheMisses", MakeCallback(&CsTracer::CacheMisses, this));
204+   auto  l3proto = m_nodePtr->GetObject <ndn::L3Protocol>();
205+   auto  fwd = l3proto->getForwarder ();
206+ 
207+   fwd->afterCsHit .connect (
208+       [this ](Interest interest, Data data) { CacheHits (interest, data); });
209+ 
210+   fwd->afterCsMiss .connect (
211+       [this ](Interest interest) { CacheMisses (interest); });
206212
207213  Reset ();
208214}
@@ -259,13 +265,13 @@ CsTracer::Print(std::ostream& os) const
259265}
260266
261267void 
262- CsTracer::CacheHits (shared_ptr< const  Interest>, shared_ptr< const  Data> )
268+ CsTracer::CacheHits (const  Interest&,  const  Data& )
263269{
264270  m_stats.m_cacheHits ++;
265271}
266272
267273void 
268- CsTracer::CacheMisses (shared_ptr< const  Interest> )
274+ CsTracer::CacheMisses (const  Interest& )
269275{
270276  m_stats.m_cacheMisses ++;
271277}
Original file line number Diff line number Diff line change @@ -173,10 +173,10 @@ class CsTracer : public SimpleRefCount<CsTracer> {
173173  Connect ();
174174
175175  void 
176-   CacheHits (shared_ptr< const  Interest>, shared_ptr< const  Data> );
176+   CacheHits (const  Interest&,  const  Data& );
177177
178178  void 
179-   CacheMisses (shared_ptr< const  Interest> );
179+   CacheMisses (const  Interest& );
180180
181181private: 
182182  void 
 
 
   
 
     
   
   
          
    
    
     
    
      
     
     
    You can’t perform that action at this time.
  
 
    
  
    
      
        
     
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments