blob: 298c9eed5883be2f19cd196f5b16afc266ac2e39 [file] [log] [blame]
Alexander Afanasyevea9b3e62012-08-13 19:02:54 -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_PER_FIB_LIMITS_H
23#define NDNSIM_PER_FIB_LIMITS_H
24
25#include "ns3/event-id.h"
26
27#include "fw-stats.h"
Alexander Afanasyev5db92172012-08-21 16:52:07 -070028#include "../../utils/ndn-pit-queue.h"
Alexander Afanasyevea9b3e62012-08-13 19:02:54 -070029
30namespace ns3 {
31namespace ndn {
32namespace fw {
33
34/**
35 * \ingroup ndn
36 * \brief Strategy implementing per-FIB entry limits
37 */
38class PerFibLimits :
39 public FwStats
40{
Alexander Afanasyev31cb4692012-08-17 13:08:20 -070041private:
42 typedef FwStats super;
43
Alexander Afanasyevea9b3e62012-08-13 19:02:54 -070044public:
45 static TypeId
46 GetTypeId ();
47
48 /**
49 * @brief Default constructor
50 */
51 PerFibLimits ();
52
53 virtual void
54 WillEraseTimedOutPendingInterest (Ptr<pit::Entry> pitEntry);
55
Alexander Afanasyev5db92172012-08-21 16:52:07 -070056 virtual void
57 RemoveFace (Ptr<Face> face);
58
Alexander Afanasyevea9b3e62012-08-13 19:02:54 -070059protected:
60 virtual bool
Alexander Afanasyev5db92172012-08-21 16:52:07 -070061 TrySendOutInterest (Ptr<Face> inFace,
62 Ptr<Face> outFace,
63 Ptr<const InterestHeader> header,
64 Ptr<const Packet> origPacket,
65 Ptr<pit::Entry> pitEntry);
Alexander Afanasyevea9b3e62012-08-13 19:02:54 -070066
67 virtual void
Alexander Afanasyev31cb4692012-08-17 13:08:20 -070068 WillSatisfyPendingInterest (Ptr<Face> inFace,
Alexander Afanasyevea9b3e62012-08-13 19:02:54 -070069 Ptr<pit::Entry> pitEntry);
70
Alexander Afanasyev08b7d9e2012-08-23 10:53:46 -070071 virtual void
72 DidReceiveValidNack (Ptr<Face> inFace,
73 uint32_t nackCode,
74 Ptr<pit::Entry> pitEntry);
75
Alexander Afanasyev5db92172012-08-21 16:52:07 -070076private:
77 void
78 ProcessFromQueue ();
79
Alexander Afanasyevea9b3e62012-08-13 19:02:54 -070080 // from Object
81 void
82 DoDispose ();
Alexander Afanasyev5db92172012-08-21 16:52:07 -070083
Alexander Afanasyevea9b3e62012-08-13 19:02:54 -070084private:
Alexander Afanasyev5db92172012-08-21 16:52:07 -070085 typedef std::map< Ptr<Face>, PitQueue > PitQueueMap;
86 PitQueueMap m_pitQueues; // per-outgoing face pit queue
Alexander Afanasyevea9b3e62012-08-13 19:02:54 -070087};
88
89
90} // namespace fw
91} // namespace ndn
92} // namespace ns3
93
94#endif // NDNSIM_PER_FIB_LIMITS_H