Alexander Afanasyev | caeade2 | 2012-09-04 16:31:12 -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_DYNAMIC_LIMITS_H |
| 23 | #define NDNSIM_DYNAMIC_LIMITS_H |
| 24 | |
| 25 | #include "ns3/event-id.h" |
| 26 | |
| 27 | #include "fw-stats.h" |
| 28 | |
| 29 | namespace ns3 { |
| 30 | namespace ndn { |
| 31 | namespace fw { |
| 32 | |
| 33 | /** |
| 34 | * \ingroup ndn |
| 35 | * \brief Strategy implementing per-FIB entry limits |
| 36 | */ |
| 37 | class DynamicLimits : |
| 38 | public FwStats |
| 39 | { |
| 40 | private: |
| 41 | typedef FwStats super; |
| 42 | |
| 43 | public: |
| 44 | static TypeId |
| 45 | GetTypeId (); |
| 46 | |
| 47 | /** |
| 48 | * @brief Default constructor |
| 49 | */ |
| 50 | DynamicLimits (); |
| 51 | |
| 52 | virtual void |
| 53 | OnInterest (Ptr<Face> face, |
| 54 | Ptr<const InterestHeader> header, |
| 55 | Ptr<const Packet> origPacket); |
| 56 | |
| 57 | private: |
| 58 | void |
| 59 | AnnounceLimits (); |
| 60 | |
| 61 | void |
| 62 | ApplyAnnouncedLimit (Ptr<Face> inFace, |
| 63 | Ptr<const InterestHeader> header); |
| 64 | |
| 65 | protected: |
| 66 | // from Object |
| 67 | virtual void |
| 68 | NotifyNewAggregate (); ///< @brief Even when object is aggregated to another Object |
| 69 | |
| 70 | virtual void |
| 71 | DoDispose (); |
| 72 | |
| 73 | private: |
| 74 | bool m_announceLimits; |
| 75 | |
| 76 | EventId m_announceEvent; |
| 77 | }; |
| 78 | |
| 79 | |
| 80 | } // namespace fw |
| 81 | } // namespace ndn |
| 82 | } // namespace ns3 |
| 83 | |
| 84 | #endif // NDNSIM_PER_FIB_LIMITS_H |