blob: 2d9f1fc4001fdf2e072901cde7af635ef2f6fc77 [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
57 WillSatisfyPendingInterest (const Ptr<CcnxFace> &incomingFace,
58 Ptr<CcnxPitEntry> pitEntry);
59
60 virtual void
61 DidSendOutInterest (const Ptr<CcnxFace> &outgoingFace,
62 Ptr<CcnxInterestHeader> header,
63 Ptr<CcnxPitEntry> pitEntry);
64
65 virtual void
66 WillErasePendingInterest (Ptr<CcnxPitEntry> pitEntry);
Alexander Afanasyeve55d1e32012-07-19 15:33:05 -070067
68 // from Object
69 void
70 DoDispose ();
71
72private:
73 void
74 RefreshStats ();
75
76 void
77 ScheduleRefreshingIfNecessary ();
78
Alexander Afanasyevf249a192012-07-18 16:52:51 -070079private:
80 ::ndnSIM::StatsTree m_stats;
Alexander Afanasyeve55d1e32012-07-19 15:33:05 -070081 EventId m_statsRefreshEvent;
Alexander Afanasyevf249a192012-07-18 16:52:51 -070082
83 typedef BestRoute super;
84};
85
86} // namespace ndnSIM
87} // namespace ns3
88
89#endif // NDNSIM_FW_STATS_H