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 |
| 54 | WillEraseTimedOutPendingInterest (Ptr<pit::Entry> pitEntry); |
| 55 | |
Alexander Afanasyev | 5db9217 | 2012-08-21 16:52:07 -0700 | [diff] [blame] | 56 | virtual void |
| 57 | RemoveFace (Ptr<Face> face); |
| 58 | |
Alexander Afanasyev | ea9b3e6 | 2012-08-13 19:02:54 -0700 | [diff] [blame] | 59 | protected: |
| 60 | virtual bool |
Alexander Afanasyev | 5db9217 | 2012-08-21 16:52:07 -0700 | [diff] [blame] | 61 | TrySendOutInterest (Ptr<Face> inFace, |
| 62 | Ptr<Face> outFace, |
| 63 | Ptr<const InterestHeader> header, |
| 64 | Ptr<const Packet> origPacket, |
| 65 | Ptr<pit::Entry> pitEntry); |
Alexander Afanasyev | ea9b3e6 | 2012-08-13 19:02:54 -0700 | [diff] [blame] | 66 | |
| 67 | virtual void |
Alexander Afanasyev | 31cb469 | 2012-08-17 13:08:20 -0700 | [diff] [blame] | 68 | WillSatisfyPendingInterest (Ptr<Face> inFace, |
Alexander Afanasyev | ea9b3e6 | 2012-08-13 19:02:54 -0700 | [diff] [blame] | 69 | Ptr<pit::Entry> pitEntry); |
| 70 | |
Alexander Afanasyev | 08b7d9e | 2012-08-23 10:53:46 -0700 | [diff] [blame] | 71 | virtual void |
| 72 | DidReceiveValidNack (Ptr<Face> inFace, |
| 73 | uint32_t nackCode, |
| 74 | Ptr<pit::Entry> pitEntry); |
| 75 | |
Alexander Afanasyev | 5db9217 | 2012-08-21 16:52:07 -0700 | [diff] [blame] | 76 | private: |
| 77 | void |
| 78 | ProcessFromQueue (); |
| 79 | |
Alexander Afanasyev | ea9b3e6 | 2012-08-13 19:02:54 -0700 | [diff] [blame] | 80 | // from Object |
| 81 | void |
| 82 | DoDispose (); |
Alexander Afanasyev | 5db9217 | 2012-08-21 16:52:07 -0700 | [diff] [blame] | 83 | |
Alexander Afanasyev | ea9b3e6 | 2012-08-13 19:02:54 -0700 | [diff] [blame] | 84 | private: |
Alexander Afanasyev | 5db9217 | 2012-08-21 16:52:07 -0700 | [diff] [blame] | 85 | typedef std::map< Ptr<Face>, PitQueue > PitQueueMap; |
| 86 | PitQueueMap m_pitQueues; // per-outgoing face pit queue |
Alexander Afanasyev | ea9b3e6 | 2012-08-13 19:02:54 -0700 | [diff] [blame] | 87 | }; |
| 88 | |
| 89 | |
| 90 | } // namespace fw |
| 91 | } // namespace ndn |
| 92 | } // namespace ns3 |
| 93 | |
| 94 | #endif // NDNSIM_PER_FIB_LIMITS_H |