blob: 454ac14fcbefb62dc4e5f14d609283758a32d211 [file] [log] [blame]
Alexander Afanasyev7e71c752012-01-25 21:40:39 -08001/* -*- 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 IPV4_RATE_L3_TRACER_H
22#define IPV4_RATE_L3_TRACER_H
23
24#include "ipv4-l3-tracer.h"
25
26#include "ns3/nstime.h"
27#include "ns3/event-id.h"
28
29#include <boost/tuple/tuple.hpp>
30#include <map>
31
32namespace ns3 {
33
34/**
35 * @ingroup ccnx
36 * @brief CCNx network-layer rate tracer
37 */
38class Ipv4RateL3Tracer : public Ipv4L3Tracer
39{
40public:
41 /**
42 * @brief Network layer tracer constructor
43 */
44 Ipv4RateL3Tracer (std::ostream &os, Ptr<Node> node);
45 virtual ~Ipv4RateL3Tracer ();
46
47 void
48 SetAveragingPeriod (const Time &period);
49
50 virtual void
51 PrintHeader (std::ostream &os) const;
52
53 virtual void
54 Print (std::ostream &os) const;
55
56 virtual void
57 Rx (std::string context,
58 Ptr<const Packet>, Ptr<Ipv4>, uint32_t);
59
60 virtual void
61 Tx (std::string context,
62 Ptr<const Packet>, Ptr<Ipv4>, uint32_t);
63
64 virtual void
65 Drop (std::string context,
66 const Ipv4Header &, Ptr<const Packet>, Ipv4L3Protocol::DropReason, Ptr<Ipv4>, uint32_t);
67
68private:
69 void
70 PeriodicPrinter ();
71
72 void
73 Reset ();
74
75private:
76 std::ostream& m_os;
77 Time m_period;
78 EventId m_printEvent;
79
80 mutable std::map<uint32_t, boost::tuple<Stats, Stats, Stats, Stats> > m_stats;
81};
82
83} // namespace ns3
84
85#endif // IPV4_RATE_L3_TRACER_H