blob: a422ccc33fe3773a58377c197283f1e92ee08c5b [file] [log] [blame]
Alexander Afanasyevf249a192012-07-18 16:52:51 -07001/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
2/*
3 * Copyright (c) 2011 University of California, Los Angeles
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
22#ifndef NDNSIM_FW_STATS_H
23#define NDNSIM_FW_STATS_H
24
Alexander Afanasyeve55d1e32012-07-19 15:33:05 -070025#include "ns3/event-id.h"
26
Alexander Afanasyevf249a192012-07-18 16:52:51 -070027#include "best-route.h"
28#include "../../utils/stats-tree.h"
29
30namespace ns3 {
31namespace ndnSIM {
32
33/**
34 * \ingroup ccnx
Alexander Afanasyeve55d1e32012-07-19 15:33:05 -070035 * \brief Strategy based on best route and adding statistics gathering capabilities
Alexander Afanasyevf249a192012-07-18 16:52:51 -070036 */
37class FwStats :
38 public BestRoute
39{
40public:
41 static TypeId
42 GetTypeId (void);
43
44 /**
45 * @brief Default constructor
46 */
47 FwStats ();
48
49protected:
50 virtual void
51 DidCreatePitEntry (const Ptr<CcnxFace> &incomingFace,
52 Ptr<CcnxInterestHeader> header,
53 const Ptr<const Packet> &packet,
54 Ptr<CcnxPitEntry> pitEntry);
55
56 virtual void
Alexander Afanasyev77495a92012-07-20 15:38:29 -070057 FailedToCreatePitEntry (const Ptr<CcnxFace> &incomingFace,
58 Ptr<CcnxInterestHeader> header,
59 const Ptr<const Packet> &packet);
60
61 virtual void
Alexander Afanasyevf249a192012-07-18 16:52:51 -070062 WillSatisfyPendingInterest (const Ptr<CcnxFace> &incomingFace,
63 Ptr<CcnxPitEntry> pitEntry);
64
65 virtual void
66 DidSendOutInterest (const Ptr<CcnxFace> &outgoingFace,
67 Ptr<CcnxInterestHeader> header,
68 Ptr<CcnxPitEntry> pitEntry);
69
70 virtual void
71 WillErasePendingInterest (Ptr<CcnxPitEntry> pitEntry);
Alexander Afanasyeve55d1e32012-07-19 15:33:05 -070072
73 // from Object
74 void
75 DoDispose ();
76
77private:
78 void
79 RefreshStats ();
80
81 void
82 ScheduleRefreshingIfNecessary ();
83
Alexander Afanasyevf249a192012-07-18 16:52:51 -070084private:
85 ::ndnSIM::StatsTree m_stats;
Alexander Afanasyeve55d1e32012-07-19 15:33:05 -070086 EventId m_statsRefreshEvent;
Alexander Afanasyev77495a92012-07-20 15:38:29 -070087
88 TracedCallback< Ptr<CcnxForwardingStrategy>,
89 const ::ndnSIM::StatsTree & > m_statsTrace;
Alexander Afanasyevf249a192012-07-18 16:52:51 -070090
91 typedef BestRoute super;
92};
93
94} // namespace ndnSIM
95} // namespace ns3
96
97#endif // NDNSIM_FW_STATS_H