NS-3 based Named Data Networking (NDN) simulator
ndnSIM: NDN, CCN, CCNx, content centric networks
API Documentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Groups Pages
ndn-l3-aggregate-tracer.h
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil -*- */
2 /*
3  * Copyright (c) 2011 UCLA
4  *
5  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License version 2 as
7  * published by the Free Software Foundation;
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program; if not, write to the Free Software
16  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17  *
18  * Author: Alexander Afanasyev <alexander.afanasyev@ucla.edu>
19  */
20 
21 #ifndef NDN_L3_AGGREGATE_TRACER_H
22 #define NDN_L3_AGGREGATE_TRACER_H
23 
24 #include "ndn-l3-tracer.h"
25 
26 #include <ns3/nstime.h>
27 #include <ns3/event-id.h>
28 #include <ns3/node-container.h>
29 
30 #include <boost/tuple/tuple.hpp>
31 #include <boost/shared_ptr.hpp>
32 #include <map>
33 #include <list>
34 
35 namespace ns3 {
36 namespace ndn {
37 
43 {
44 public:
55  static void
56  InstallAll (const std::string &file, Time averagingPeriod = Seconds (0.5));
57 
69  static void
70  Install (const NodeContainer &nodes, const std::string &file, Time averagingPeriod = Seconds (0.5));
71 
83  static void
84  Install (Ptr<Node> node, const std::string &file, Time averagingPeriod = Seconds (0.5));
85 
92  static void
93  Destroy ();
94 
100  L3AggregateTracer (boost::shared_ptr<std::ostream> os, Ptr<Node> node);
101 
107  L3AggregateTracer (boost::shared_ptr<std::ostream> os, const std::string &nodeName);
108 
112  virtual ~L3AggregateTracer ();
113 
124  static Ptr<L3AggregateTracer>
125  Install (Ptr<Node> node, boost::shared_ptr<std::ostream> outputStream, Time averagingPeriod = Seconds (0.5));
126 
127 protected:
128  // from L3Tracer
129  virtual void
130  PrintHeader (std::ostream &os) const;
131 
132  virtual void
133  Print (std::ostream &os) const;
134 
135  virtual void
136  OutInterests (Ptr<const Interest>, Ptr<const Face>);
137 
138  virtual void
139  InInterests (Ptr<const Interest>, Ptr<const Face>);
140 
141  virtual void
142  DropInterests (Ptr<const Interest>, Ptr<const Face>);
143 
144  virtual void
145  OutNacks (Ptr<const Interest>, Ptr<const Face>);
146 
147  virtual void
148  InNacks (Ptr<const Interest>, Ptr<const Face>);
149 
150  virtual void
151  DropNacks (Ptr<const Interest>, Ptr<const Face>);
152 
153  virtual void
154  OutData (Ptr<const Data>, bool fromCache, Ptr<const Face>);
155 
156  virtual void
157  InData (Ptr<const Data>, Ptr<const Face>);
158 
159  virtual void
160  DropData (Ptr<const Data>, Ptr<const Face>);
161 
162 
163  virtual void
164  SatisfiedInterests (Ptr<const pit::Entry>);
165 
166  virtual void
167  TimedOutInterests (Ptr<const pit::Entry>);
168 
169 protected:
170  void
171  SetAveragingPeriod (const Time &period);
172 
173  void
174  Reset ();
175 
176  void
177  PeriodicPrinter ();
178 
179 protected:
180  boost::shared_ptr<std::ostream> m_os;
181 
182  Time m_period;
183  EventId m_printEvent;
184 
185  mutable std::map<Ptr<const Face>, boost::tuple<Stats, Stats> > m_stats;
186 };
187 
188 } // namespace ndn
189 } // namespace ns3
190 
191 #endif // NDN_L3_AGGREGATE_TRACER_H
virtual void PrintHeader(std::ostream &os) const
Print head of the trace (e.g., for post-processing)
L3AggregateTracer(boost::shared_ptr< std::ostream > os, Ptr< Node > node)
Trace constructor that attaches to the node using node pointer.
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.
static void InstallAll(const std::string &file, Time averagingPeriod=Seconds(0.5))
Helper method to install tracers on all simulation nodes.
Base class for network-layer (incoming/outgoing Interests and Data) tracing of NDN stack...
Definition: ndn-l3-tracer.h:52
virtual ~L3AggregateTracer()
Destructor.
virtual void Print(std::ostream &os) const
Print current trace data.
static void Destroy()
Explicit request to remove all statically created tracers.
NDN network-layer tracer for aggregate packet counts.