Alexander Afanasyev | ea9b3e6 | 2012-08-13 19:02:54 -0700 | [diff] [blame] | 1 | /* -*- 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 Afanasyev | 5db9217 | 2012-08-21 16:52:07 -0700 | [diff] [blame] | 28 | #include "../../utils/ndn-pit-queue.h" |
Alexander Afanasyev | ea9b3e6 | 2012-08-13 19:02:54 -0700 | [diff] [blame] | 29 | |
| 30 | namespace ns3 { |
| 31 | namespace ndn { |
| 32 | namespace fw { |
| 33 | |
| 34 | /** |
| 35 | * \ingroup ndn |
| 36 | * \brief Strategy implementing per-FIB entry limits |
| 37 | */ |
| 38 | class PerFibLimits : |
| 39 | public FwStats |
| 40 | { |
Alexander Afanasyev | 31cb469 | 2012-08-17 13:08:20 -0700 | [diff] [blame] | 41 | private: |
| 42 | typedef FwStats super; |
| 43 | |
Alexander Afanasyev | ea9b3e6 | 2012-08-13 19:02:54 -0700 | [diff] [blame] | 44 | public: |
| 45 | static TypeId |
| 46 | GetTypeId (); |
| 47 | |
| 48 | /** |
| 49 | * @brief Default constructor |
| 50 | */ |
| 51 | PerFibLimits (); |
| 52 | |
| 53 | virtual void |
Alexander Afanasyev | b1ec249 | 2012-08-28 17:33:33 -0700 | [diff] [blame] | 54 | OnInterest (Ptr<Face> face, |
| 55 | Ptr<const InterestHeader> header, |
| 56 | Ptr<const Packet> origPacket); |
| 57 | |
| 58 | virtual void |
Alexander Afanasyev | ea9b3e6 | 2012-08-13 19:02:54 -0700 | [diff] [blame] | 59 | WillEraseTimedOutPendingInterest (Ptr<pit::Entry> pitEntry); |
| 60 | |
Alexander Afanasyev | 5db9217 | 2012-08-21 16:52:07 -0700 | [diff] [blame] | 61 | virtual void |
| 62 | RemoveFace (Ptr<Face> face); |
| 63 | |
Alexander Afanasyev | ea9b3e6 | 2012-08-13 19:02:54 -0700 | [diff] [blame] | 64 | protected: |
| 65 | virtual bool |
Alexander Afanasyev | 5db9217 | 2012-08-21 16:52:07 -0700 | [diff] [blame] | 66 | TrySendOutInterest (Ptr<Face> inFace, |
| 67 | Ptr<Face> outFace, |
| 68 | Ptr<const InterestHeader> header, |
| 69 | Ptr<const Packet> origPacket, |
| 70 | Ptr<pit::Entry> pitEntry); |
Alexander Afanasyev | ea9b3e6 | 2012-08-13 19:02:54 -0700 | [diff] [blame] | 71 | |
| 72 | virtual void |
Alexander Afanasyev | 31cb469 | 2012-08-17 13:08:20 -0700 | [diff] [blame] | 73 | WillSatisfyPendingInterest (Ptr<Face> inFace, |
Alexander Afanasyev | ea9b3e6 | 2012-08-13 19:02:54 -0700 | [diff] [blame] | 74 | Ptr<pit::Entry> pitEntry); |
| 75 | |
Alexander Afanasyev | 08b7d9e | 2012-08-23 10:53:46 -0700 | [diff] [blame] | 76 | virtual void |
| 77 | DidReceiveValidNack (Ptr<Face> inFace, |
| 78 | uint32_t nackCode, |
| 79 | Ptr<pit::Entry> pitEntry); |
| 80 | |
Alexander Afanasyev | 5db9217 | 2012-08-21 16:52:07 -0700 | [diff] [blame] | 81 | private: |
| 82 | void |
| 83 | ProcessFromQueue (); |
Alexander Afanasyev | b1ec249 | 2012-08-28 17:33:33 -0700 | [diff] [blame] | 84 | |
| 85 | void |
| 86 | AnnounceLimits (); |
| 87 | |
| 88 | void |
| 89 | ApplyAnnouncedLimit (Ptr<Face> inFace, |
| 90 | Ptr<const InterestHeader> header); |
Alexander Afanasyev | 5db9217 | 2012-08-21 16:52:07 -0700 | [diff] [blame] | 91 | |
Alexander Afanasyev | ea9b3e6 | 2012-08-13 19:02:54 -0700 | [diff] [blame] | 92 | // from Object |
Alexander Afanasyev | b1ec249 | 2012-08-28 17:33:33 -0700 | [diff] [blame] | 93 | virtual void |
| 94 | NotifyNewAggregate (); ///< @brief Even when object is aggregated to another Object |
| 95 | |
| 96 | virtual void |
Alexander Afanasyev | ea9b3e6 | 2012-08-13 19:02:54 -0700 | [diff] [blame] | 97 | DoDispose (); |
Alexander Afanasyev | 5db9217 | 2012-08-21 16:52:07 -0700 | [diff] [blame] | 98 | |
Alexander Afanasyev | ea9b3e6 | 2012-08-13 19:02:54 -0700 | [diff] [blame] | 99 | private: |
Alexander Afanasyev | 5db9217 | 2012-08-21 16:52:07 -0700 | [diff] [blame] | 100 | typedef std::map< Ptr<Face>, PitQueue > PitQueueMap; |
| 101 | PitQueueMap m_pitQueues; // per-outgoing face pit queue |
Alexander Afanasyev | b1ec249 | 2012-08-28 17:33:33 -0700 | [diff] [blame] | 102 | |
Alexander Afanasyev | c771961 | 2012-08-30 17:42:20 -0700 | [diff] [blame] | 103 | bool m_announceLimits; |
Alexander Afanasyev | 0f83f90 | 2012-09-03 13:30:12 -0700 | [diff] [blame] | 104 | bool m_queueDropNotifications; |
Alexander Afanasyev | c771961 | 2012-08-30 17:42:20 -0700 | [diff] [blame] | 105 | |
Alexander Afanasyev | b1ec249 | 2012-08-28 17:33:33 -0700 | [diff] [blame] | 106 | EventId m_announceEvent; |
Alexander Afanasyev | ea9b3e6 | 2012-08-13 19:02:54 -0700 | [diff] [blame] | 107 | }; |
| 108 | |
| 109 | |
| 110 | } // namespace fw |
| 111 | } // namespace ndn |
| 112 | } // namespace ns3 |
| 113 | |
| 114 | #endif // NDNSIM_PER_FIB_LIMITS_H |