blob: ee2eb2cc7e490fa29b3ddf7368ac26acf074d4d9 [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
Alexander Afanasyevcaeade22012-09-04 16:31:12 -070027#include "dynamic-limits.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 :
Alexander Afanasyevcaeade22012-09-04 16:31:12 -070039 public DynamicLimits
Alexander Afanasyevea9b3e62012-08-13 19:02:54 -070040{
Alexander Afanasyev31cb4692012-08-17 13:08:20 -070041private:
Alexander Afanasyevcaeade22012-09-04 16:31:12 -070042 typedef DynamicLimits super;
Alexander Afanasyev31cb4692012-08-17 13:08:20 -070043
Alexander Afanasyevea9b3e62012-08-13 19:02:54 -070044public:
45 static TypeId
46 GetTypeId ();
47
48 /**
49 * @brief Default constructor
50 */
51 PerFibLimits ();
Alexander Afanasyevb1ec2492012-08-28 17:33:33 -070052
53 virtual void
Alexander Afanasyevea9b3e62012-08-13 19:02:54 -070054 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
Alexander Afanasyevb1ec2492012-08-28 17:33:33 -070081 virtual void
82 NotifyNewAggregate (); ///< @brief Even when object is aggregated to another Object
83
84 virtual void
Alexander Afanasyevea9b3e62012-08-13 19:02:54 -070085 DoDispose ();
Alexander Afanasyev5db92172012-08-21 16:52:07 -070086
Alexander Afanasyevea9b3e62012-08-13 19:02:54 -070087private:
Alexander Afanasyev5db92172012-08-21 16:52:07 -070088 typedef std::map< Ptr<Face>, PitQueue > PitQueueMap;
89 PitQueueMap m_pitQueues; // per-outgoing face pit queue
Alexander Afanasyevb1ec2492012-08-28 17:33:33 -070090
Alexander Afanasyev0f83f902012-09-03 13:30:12 -070091 bool m_queueDropNotifications;
Alexander Afanasyevcaeade22012-09-04 16:31:12 -070092 bool m_weightedRoundRobin;
Alexander Afanasyevc7719612012-08-30 17:42:20 -070093
Alexander Afanasyevb1ec2492012-08-28 17:33:33 -070094 EventId m_announceEvent;
Alexander Afanasyevea9b3e62012-08-13 19:02:54 -070095};
96
97
98} // namespace fw
99} // namespace ndn
100} // namespace ns3
101
102#endif // NDNSIM_PER_FIB_LIMITS_H