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
Copyright (c) 2011-2015 Regents of the University of California.
std::ostream & operator<<(std::ostream &os, const ContentStore &cs)
virtual void SatisfiedInterests(const nfd::pit::Entry &, const Face &, const Data &)=0
Base class for network-layer (incoming/outgoing Interests and Data) tracing of NDN stack...
virtual void OutNack(const lp::Nack &nack, const Face &)=0
represents a Network Nack
Definition: nack.hpp:40
virtual ~L3Tracer()
Destructor.
ndn Face
Definition: face-impl.hpp:42
virtual void InNack(const lp::Nack &, const Face &)=0
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.
an Interest table entry
Definition: pit-entry.hpp:57
Copyright (c) 2011-2015 Regents of the University of California.
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