NS-3 based Named Data Networking (NDN) simulator
ndnSIM 2.5: NDN, CCN, CCNx, content centric networks
API Documentation
ndn-l3-rate-tracer.hpp
Go to the documentation of this file.
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
20 #ifndef CCNX_RATE_L3_TRACER_H
21 #define CCNX_RATE_L3_TRACER_H
22 
23 #include "ns3/ndnSIM/model/ndn-common.hpp"
24 
25 #include "ndn-l3-tracer.hpp"
26 
27 #include "ns3/nstime.h"
28 #include "ns3/event-id.h"
29 #include "ns3/node-container.h"
30 
31 #include <tuple>
32 #include <map>
33 #include <list>
34 
35 namespace ns3 {
36 namespace ndn {
37 
42 class L3RateTracer : public L3Tracer {
43 public:
52  static void
53  InstallAll(const std::string& file, Time averagingPeriod = Seconds(0.5));
54 
63  static void
64  Install(const NodeContainer& nodes, const std::string& file, Time averagingPeriod = Seconds(0.5));
65 
74  static void
75  Install(Ptr<Node> node, const std::string& file, Time averagingPeriod = Seconds(0.5));
76 
83  static void
84  Destroy();
85 
91  L3RateTracer(shared_ptr<std::ostream> os, Ptr<Node> node);
92 
98  L3RateTracer(shared_ptr<std::ostream> os, const std::string& node);
99 
103  virtual ~L3RateTracer();
104 
117  static Ptr<L3RateTracer>
118  Install(Ptr<Node> node, shared_ptr<std::ostream> outputStream,
119  Time averagingPeriod = Seconds(0.5));
120 
121  // from L3Tracer
122  virtual void
123  PrintHeader(std::ostream& os) const;
124 
125  virtual void
126  Print(std::ostream& os) const;
127 
128 protected:
129  // from L3Tracer
130  virtual void
131  OutInterests(const Interest& interest, const Face& face);
132 
133  virtual void
134  InInterests(const Interest& interest, const Face& face);
135 
136  virtual void
137  OutData(const Data& data, const Face& face);
138 
139  virtual void
140  InData(const Data& data, const Face& face);
141 
142  virtual void
143  OutNack(const lp::Nack& nack, const Face& face);
144 
145  virtual void
146  InNack(const lp::Nack& nack, const Face& face);
147 
148  virtual void
149  SatisfiedInterests(const nfd::pit::Entry&, const Face&, const Data&);
150 
151  virtual void
153 
154 private:
155  void
156  SetAveragingPeriod(const Time& period);
157 
158  void
159  PeriodicPrinter();
160 
161  void
162  Reset();
163 
164  void
165  AddInfo(const Face& face);
166 
167 private:
168  shared_ptr<std::ostream> m_os;
169  Time m_period;
170  EventId m_printEvent;
171 
172  mutable std::map<nfd::FaceId, std::tuple<Stats, Stats, Stats, Stats>> m_stats;
173  std::map<nfd::FaceId, std::string> m_faceInfos; // needed, because face may no longer exists at the time of stat printing
174 };
175 
176 } // namespace ndn
177 } // namespace ns3
178 
179 #endif // CCNX_RATE_L3_TRACER_H
virtual ~L3RateTracer()
Destructor.
Copyright (c) 2011-2015 Regents of the University of California.
static void Destroy()
Explicit request to remove all statically created tracers.
virtual void SatisfiedInterests(const nfd::pit::Entry &, const Face &, const Data &)
virtual void OutNack(const lp::Nack &nack, const Face &face)
NDN network-layer rate tracer.
Base class for network-layer (incoming/outgoing Interests and Data) tracing of NDN stack...
represents a Network Nack
Definition: nack.hpp:38
ndn Face
Definition: face-impl.hpp:42
An Interest table entry.
Definition: pit-entry.hpp:58
Copyright (c) 2011-2015 Regents of the University of California.
static void Install(const NodeContainer &nodes, const std::string &file, Time averagingPeriod=Seconds(0.5))
Helper method to install tracers on the selected simulation nodes.
virtual void Print(std::ostream &os) const
Print current trace data.
virtual void InInterests(const Interest &interest, const Face &face)
virtual void OutData(const Data &data, const Face &face)
virtual void TimedOutInterests(const nfd::pit::Entry &)
L3RateTracer(shared_ptr< std::ostream > os, Ptr< Node > node)
Trace constructor that attaches to the node using node pointer.
static void InstallAll(const std::string &file, Time averagingPeriod=Seconds(0.5))
Helper method to install tracers on all simulation nodes.
virtual void PrintHeader(std::ostream &os) const
Print head of the trace (e.g., for post-processing)
virtual void OutInterests(const Interest &interest, const Face &face)
virtual void InNack(const lp::Nack &nack, const Face &face)
virtual void InData(const Data &data, const Face &face)