NS-3 based Named Data Networking (NDN) simulator
ndnSIM 2.0: NDN, CCN, CCNx, content centric networks
API Documentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
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/model/ndn-face.hpp"
25 
26 #include "ns3/ptr.h"
27 #include "ns3/simple-ref-count.h"
28 
29 namespace nfd {
30 namespace pit {
31 class Entry;
32 } // namespace pit
33 } // namespace nfd
34 
35 namespace ns3 {
36 
37 class Node;
38 class Packet;
39 
40 namespace ndn {
41 
46 class L3Tracer : public SimpleRefCount<L3Tracer> {
47 public:
52  L3Tracer(Ptr<Node> node);
53 
58  L3Tracer(const std::string& node);
59 
63  virtual ~L3Tracer();
64 
70  virtual void
71  PrintHeader(std::ostream& os) const = 0;
72 
78  virtual void
79  Print(std::ostream& os) const = 0;
80 
81 protected:
82  void
83  Connect();
84 
85  virtual void
86  OutInterests(const Interest&, const Face&) = 0;
87 
88  virtual void
89  InInterests(const Interest&, const Face&) = 0;
90 
91  virtual void
92  OutData(const Data&, const Face&) = 0;
93 
94  virtual void
95  InData(const Data&, 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;
117 
120  }
121 
124  double m_inData;
125  double m_outData;
130  };
131 };
132 
136 inline std::ostream&
137 operator<<(std::ostream& os, const L3Tracer& tracer)
138 {
139  os << "# ";
140  tracer.PrintHeader(os);
141  os << "\n";
142  tracer.Print(os);
143  return os;
144 }
145 
146 } // namespace ndn
147 } // namespace ns3
148 
149 #endif // NDN_L3_TRACER_H
std::ostream & operator<<(std::ostream &os, const ContentStore &cs)
virtual void SatisfiedInterests(const nfd::pit::Entry &, const Face &, const Data &)=0
represents a face
Definition: face.hpp:59
Base class for network-layer (incoming/outgoing Interests and Data) tracing of NDN stack...
virtual ~L3Tracer()
Destructor.
virtual void Print(std::ostream &os) const =0
Print current trace data.
L3Tracer(Ptr< Node > node)
Trace constructor that attaches to the node using node pointer.
represents a PIT entry
Definition: pit-entry.hpp:67
virtual void OutData(const Data &, const Face &)=0
virtual void InInterests(const Interest &, const Face &)=0
virtual void InData(const Data &, const Face &)=0
virtual void PrintHeader(std::ostream &os) const =0
Print head of the trace (e.g., for post-processing)
virtual void TimedOutInterests(const nfd::pit::Entry &)=0
virtual void OutInterests(const Interest &, const Face &)=0