Alexander Afanasyev | d9fecdd | 2012-06-08 16:22:24 -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 | * |
Alexander Afanasyev | 9a98970 | 2012-06-29 17:44:00 -0700 | [diff] [blame] | 18 | * Author: Alexander Afanasyev <alexander.afanasyev@ucla.edu> |
| 19 | * Ilya Moiseenko <iliamo@cs.ucla.edu> |
Alexander Afanasyev | d9fecdd | 2012-06-08 16:22:24 -0700 | [diff] [blame] | 20 | */ |
| 21 | |
Alexander Afanasyev | 480e456 | 2012-06-29 17:46:47 -0700 | [diff] [blame] | 22 | #ifndef CCNX_CONTENT_STORE_POLICIES_H |
| 23 | #define CCNX_CONTENT_STORE_POLICIES_H |
Alexander Afanasyev | d9fecdd | 2012-06-08 16:22:24 -0700 | [diff] [blame] | 24 | |
Alexander Afanasyev | 9e96e36 | 2012-07-02 23:04:39 -0700 | [diff] [blame] | 25 | // #include "ns3/ccnx.h" |
Alexander Afanasyev | d9fecdd | 2012-06-08 16:22:24 -0700 | [diff] [blame] | 26 | |
Alexander Afanasyev | 9e96e36 | 2012-07-02 23:04:39 -0700 | [diff] [blame] | 27 | #include "ccnx-content-store-impl.h" |
Alexander Afanasyev | d9fecdd | 2012-06-08 16:22:24 -0700 | [diff] [blame] | 28 | |
Alexander Afanasyev | e3d126f | 2012-07-16 17:07:31 -0700 | [diff] [blame] | 29 | #include "../../utils/trie.h" |
| 30 | #include "../../utils/trie-with-policy.h" |
Alexander Afanasyev | 9a98970 | 2012-06-29 17:44:00 -0700 | [diff] [blame] | 31 | |
Alexander Afanasyev | e3d126f | 2012-07-16 17:07:31 -0700 | [diff] [blame] | 32 | #include "../../utils/lru-policy.h" |
| 33 | #include "../../utils/random-policy.h" |
| 34 | #include "../../utils/fifo-policy.h" |
Alexander Afanasyev | b0c4389 | 2012-06-13 00:52:58 -0700 | [diff] [blame] | 35 | |
Alexander Afanasyev | d9fecdd | 2012-06-08 16:22:24 -0700 | [diff] [blame] | 36 | namespace ns3 |
| 37 | { |
Alexander Afanasyev | d9fecdd | 2012-06-08 16:22:24 -0700 | [diff] [blame] | 38 | |
| 39 | /** |
| 40 | * \ingroup ccnx |
Alexander Afanasyev | 9a98970 | 2012-06-29 17:44:00 -0700 | [diff] [blame] | 41 | * \brief Content Store with LRU replacement policy |
Alexander Afanasyev | d9fecdd | 2012-06-08 16:22:24 -0700 | [diff] [blame] | 42 | */ |
Alexander Afanasyev | 9a98970 | 2012-06-29 17:44:00 -0700 | [diff] [blame] | 43 | class CcnxContentStoreLru : |
| 44 | public CcnxContentStoreImpl< |
Alexander Afanasyev | 30cb117 | 2012-07-06 10:47:39 -0700 | [diff] [blame] | 45 | ndnSIM::trie_with_policy<CcnxNameComponents, |
| 46 | ndnSIM::smart_pointer_payload_traits<CcnxContentStoreEntry>, |
| 47 | ndnSIM::lru_policy_traits > |
Alexander Afanasyev | 9a98970 | 2012-06-29 17:44:00 -0700 | [diff] [blame] | 48 | > |
Alexander Afanasyev | d9fecdd | 2012-06-08 16:22:24 -0700 | [diff] [blame] | 49 | { |
| 50 | public: |
| 51 | /** |
| 52 | * \brief Interface ID |
| 53 | * |
| 54 | * \return interface ID |
| 55 | */ |
| 56 | static TypeId GetTypeId (); |
| 57 | |
| 58 | /** |
| 59 | * Default constructor |
| 60 | */ |
| 61 | CcnxContentStoreLru (); |
| 62 | virtual ~CcnxContentStoreLru (); |
| 63 | |
Alexander Afanasyev | 9a98970 | 2012-06-29 17:44:00 -0700 | [diff] [blame] | 64 | private: |
Alexander Afanasyev | d9fecdd | 2012-06-08 16:22:24 -0700 | [diff] [blame] | 65 | void |
| 66 | SetMaxSize (uint32_t maxSize); |
| 67 | |
Alexander Afanasyev | d9fecdd | 2012-06-08 16:22:24 -0700 | [diff] [blame] | 68 | uint32_t |
| 69 | GetMaxSize () const; |
Alexander Afanasyev | 9a98970 | 2012-06-29 17:44:00 -0700 | [diff] [blame] | 70 | }; |
Alexander Afanasyev | d9fecdd | 2012-06-08 16:22:24 -0700 | [diff] [blame] | 71 | |
Alexander Afanasyev | 9a98970 | 2012-06-29 17:44:00 -0700 | [diff] [blame] | 72 | |
| 73 | /** |
| 74 | * \ingroup ccnx |
| 75 | * \brief Content Store with RANDOM replacement policy |
| 76 | */ |
| 77 | class CcnxContentStoreRandom : |
| 78 | public CcnxContentStoreImpl< |
Alexander Afanasyev | 30cb117 | 2012-07-06 10:47:39 -0700 | [diff] [blame] | 79 | ndnSIM::trie_with_policy<CcnxNameComponents, |
| 80 | ndnSIM::smart_pointer_payload_traits<CcnxContentStoreEntry>, |
| 81 | ndnSIM::random_policy_traits > |
Alexander Afanasyev | 9a98970 | 2012-06-29 17:44:00 -0700 | [diff] [blame] | 82 | > |
| 83 | { |
| 84 | public: |
| 85 | /** |
| 86 | * \brief Interface ID |
| 87 | * |
| 88 | * \return interface ID |
| 89 | */ |
| 90 | static TypeId GetTypeId (); |
Alexander Afanasyev | d9fecdd | 2012-06-08 16:22:24 -0700 | [diff] [blame] | 91 | |
| 92 | /** |
Alexander Afanasyev | 9a98970 | 2012-06-29 17:44:00 -0700 | [diff] [blame] | 93 | * Default constructor |
Alexander Afanasyev | d9fecdd | 2012-06-08 16:22:24 -0700 | [diff] [blame] | 94 | */ |
Alexander Afanasyev | 9a98970 | 2012-06-29 17:44:00 -0700 | [diff] [blame] | 95 | CcnxContentStoreRandom (); |
| 96 | virtual ~CcnxContentStoreRandom (); |
| 97 | |
| 98 | private: |
| 99 | void |
| 100 | SetMaxSize (uint32_t maxSize); |
| 101 | |
| 102 | uint32_t |
| 103 | GetMaxSize () const; |
Alexander Afanasyev | d9fecdd | 2012-06-08 16:22:24 -0700 | [diff] [blame] | 104 | }; |
| 105 | |
Alexander Afanasyev | 9a98970 | 2012-06-29 17:44:00 -0700 | [diff] [blame] | 106 | /** |
| 107 | * \ingroup ccnx |
| 108 | * \brief Content Store with FIFO replacement policy |
| 109 | */ |
| 110 | class CcnxContentStoreFifo : |
| 111 | public CcnxContentStoreImpl< |
Alexander Afanasyev | 30cb117 | 2012-07-06 10:47:39 -0700 | [diff] [blame] | 112 | ndnSIM::trie_with_policy<CcnxNameComponents, |
| 113 | ndnSIM::smart_pointer_payload_traits<CcnxContentStoreEntry>, |
| 114 | ndnSIM::fifo_policy_traits > |
Alexander Afanasyev | 9a98970 | 2012-06-29 17:44:00 -0700 | [diff] [blame] | 115 | > |
| 116 | { |
| 117 | public: |
| 118 | /** |
| 119 | * \brief Interface ID |
| 120 | * |
| 121 | * \return interface ID |
| 122 | */ |
| 123 | static TypeId GetTypeId (); |
| 124 | |
| 125 | /** |
| 126 | * Default constructor |
| 127 | */ |
| 128 | CcnxContentStoreFifo (); |
| 129 | virtual ~CcnxContentStoreFifo (); |
| 130 | |
| 131 | private: |
| 132 | void |
| 133 | SetMaxSize (uint32_t maxSize); |
| 134 | |
| 135 | uint32_t |
| 136 | GetMaxSize () const; |
| 137 | }; |
| 138 | |
| 139 | |
Alexander Afanasyev | d9fecdd | 2012-06-08 16:22:24 -0700 | [diff] [blame] | 140 | } //namespace ns3 |
| 141 | |
Alexander Afanasyev | 480e456 | 2012-06-29 17:46:47 -0700 | [diff] [blame] | 142 | #endif // CCNX_CONTENT_STORE_POLICIES_H |