NS-3 based Named Data Networking (NDN) simulator
ndnSIM 2.5: NDN, CCN, CCNx, content centric networks
API Documentation
ndn-l3-tracer.hpp
Go to the documentation of this file.
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
20 #ifndef NDN_L3_TRACER_H
21 #define NDN_L3_TRACER_H
22 
23 #include "ns3/ndnSIM/model/ndn-common.hpp"
24 #include "ns3/ndnSIM/NFD/daemon/table/pit-entry.hpp"
25 
26 #include "ns3/ptr.h"
27 #include "ns3/simple-ref-count.h"
28 
29 namespace ns3 {
30 
31 class Node;
32 class Packet;
33 
34 namespace ndn {
35 
40 class L3Tracer : public SimpleRefCount<L3Tracer> {
41 public:
46  L3Tracer(Ptr<Node> node);
47 
52  L3Tracer(const std::string& node);
53 
57  virtual ~L3Tracer();
58 
64  virtual void
65  PrintHeader(std::ostream& os) const = 0;
66 
72  virtual void
73  Print(std::ostream& os) const = 0;
74 
75 protected:
76  void
77  Connect();
78 
79  virtual void
80  OutInterests(const Interest&, const Face&) = 0;
81 
82  virtual void
83  InInterests(const Interest&, const Face&) = 0;
84 
85  virtual void
86  OutData(const Data&, const Face&) = 0;
87 
88  virtual void
89  InData(const Data&, const Face&) = 0;
90 
91  virtual void
92  OutNack(const lp::Nack& nack, const Face&) = 0;
93 
94  virtual void
95  InNack(const lp::Nack&, const Face&) = 0;
96 
97  virtual void
98  SatisfiedInterests(const nfd::pit::Entry&, const Face&, const Data&) = 0;
99 
100  virtual void
102 
103 protected:
104  std::string m_node;
105  Ptr<Node> m_nodePtr;
106 
107  struct Stats {
108  inline void
110  {
111  m_inInterests = 0;
112  m_outInterests = 0;
113  m_inData = 0;
114  m_outData = 0;
115  m_inNack = 0;
116  m_outNack = 0;
119 
122  }
123 
126  double m_inData;
127  double m_outData;
128  double m_inNack;
129  double m_outNack;
134  };
135 };
136 
140 inline std::ostream&
141 operator<<(std::ostream& os, const L3Tracer& tracer)
142 {
143  os << "# ";
144  tracer.PrintHeader(os);
145  os << "\n";
146  tracer.Print(os);
147  return os;
148 }
149 
150 } // namespace ndn
151 } // namespace ns3
152 
153 #endif // NDN_L3_TRACER_H
ns3::ndn::operator<<
std::ostream & operator<<(std::ostream &os, const AbstractFib &fib)
Definition: abstract-fib.cpp:175
ns3::ndn::L3Tracer::Stats::m_outSatisfiedInterests
double m_outSatisfiedInterests
Definition: ndn-l3-tracer.hpp:132
ns3::ndn::L3Tracer::Stats::m_outData
double m_outData
Definition: ndn-l3-tracer.hpp:127
ndn::tlv::Interest
@ Interest
Definition: tlv.hpp:65
ns3
Copyright (c) 2011-2015 Regents of the University of California.
Definition: ndn-app-link-service.cpp:32
ns3::ndn::L3Tracer::OutData
virtual void OutData(const Data &, const Face &)=0
ns3::ndn::L3Tracer::InInterests
virtual void InInterests(const Interest &, const Face &)=0
ns3::ndn::L3Tracer::m_nodePtr
Ptr< Node > m_nodePtr
Definition: ndn-l3-tracer.hpp:105
ns3::ndn::L3Tracer::PrintHeader
virtual void PrintHeader(std::ostream &os) const =0
Print head of the trace (e.g., for post-processing)
ns3::ndn::L3Tracer::InData
virtual void InData(const Data &, const Face &)=0
ns3::ndn::L3Tracer::OutInterests
virtual void OutInterests(const Interest &, const Face &)=0
ns3::ndn::L3Tracer
Base class for network-layer (incoming/outgoing Interests and Data) tracing of NDN stack.
Definition: ndn-l3-tracer.hpp:40
ns3::ndn::L3Tracer::TimedOutInterests
virtual void TimedOutInterests(const nfd::pit::Entry &)=0
ns3::ndn::L3Tracer::Stats::m_satisfiedInterests
double m_satisfiedInterests
Definition: ndn-l3-tracer.hpp:130
ns3::ndn::L3Tracer::Stats::Reset
void Reset()
Definition: ndn-l3-tracer.hpp:109
ns3::ndn::L3Tracer::Stats::m_outInterests
double m_outInterests
Definition: ndn-l3-tracer.hpp:125
nfd::pit::Entry
An Interest table entry.
Definition: pit-entry.hpp:59
ns3::ndn::L3Tracer::m_node
std::string m_node
Definition: ndn-l3-tracer.hpp:104
ns3::ndn::L3Tracer::Connect
void Connect()
Definition: ndn-l3-tracer.cpp:56
ns3::ndn::L3Tracer::Stats::m_inInterests
double m_inInterests
Definition: ndn-l3-tracer.hpp:124
ns3::ndn::L3Tracer::Stats
Definition: ndn-l3-tracer.hpp:107
Face
ndn Face
Definition: face-impl.hpp:41
ndn::tlv::Data
@ Data
Definition: tlv.hpp:66
ns3::ndn::L3Tracer::Stats::m_inData
double m_inData
Definition: ndn-l3-tracer.hpp:126
ns3::ndn::L3Tracer::SatisfiedInterests
virtual void SatisfiedInterests(const nfd::pit::Entry &, const Face &, const Data &)=0
ndn::lp::Nack
represents a Network Nack
Definition: nack.hpp:39
ns3::ndn::L3Tracer::InNack
virtual void InNack(const lp::Nack &, const Face &)=0
ns3::ndn::L3Tracer::Stats::m_outNack
double m_outNack
Definition: ndn-l3-tracer.hpp:129
ns3::ndn::L3Tracer::Stats::m_timedOutInterests
double m_timedOutInterests
Definition: ndn-l3-tracer.hpp:131
ns3::ndn::L3Tracer::OutNack
virtual void OutNack(const lp::Nack &nack, const Face &)=0
ns3::ndn::L3Tracer::Print
virtual void Print(std::ostream &os) const =0
Print current trace data.
ns3::ndn::L3Tracer::L3Tracer
L3Tracer(Ptr< Node > node)
Trace constructor that attaches to the node using node pointer.
Definition: ndn-l3-tracer.cpp:34
ns3::ndn::L3Tracer::Stats::m_outTimedOutInterests
double m_outTimedOutInterests
Definition: ndn-l3-tracer.hpp:133
ndn
Copyright (c) 2011-2015 Regents of the University of California.
Definition: ndn-strategy-choice-helper.hpp:34
ns3::ndn::L3Tracer::Stats::m_inNack
double m_inNack
Definition: ndn-l3-tracer.hpp:128
ns3::ndn::L3Tracer::~L3Tracer
virtual ~L3Tracer()
Destructor.
Definition: ndn-l3-tracer.cpp:53