Alexander Afanasyev | 33b7277 | 2014-01-26 23:22:58 -0800 | [diff] [blame] | 1 | /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ |
| 2 | /** |
Junxiao Shi | 330136a | 2016-03-10 04:53:08 -0700 | [diff] [blame] | 3 | * Copyright (c) 2014-2016, Regents of the University of California, |
| 4 | * Arizona Board of Regents, |
| 5 | * Colorado State University, |
| 6 | * University Pierre & Marie Curie, Sorbonne University, |
| 7 | * Washington University in St. Louis, |
| 8 | * Beijing Institute of Technology, |
| 9 | * The University of Memphis. |
Alexander Afanasyev | 9bcbc7c | 2014-04-06 19:37:37 -0700 | [diff] [blame] | 10 | * |
| 11 | * This file is part of NFD (Named Data Networking Forwarding Daemon). |
| 12 | * See AUTHORS.md for complete list of NFD authors and contributors. |
| 13 | * |
| 14 | * NFD is free software: you can redistribute it and/or modify it under the terms |
| 15 | * of the GNU General Public License as published by the Free Software Foundation, |
| 16 | * either version 3 of the License, or (at your option) any later version. |
| 17 | * |
| 18 | * NFD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; |
| 19 | * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR |
| 20 | * PURPOSE. See the GNU General Public License for more details. |
| 21 | * |
| 22 | * You should have received a copy of the GNU General Public License along with |
| 23 | * NFD, e.g., in COPYING.md file. If not, see <http://www.gnu.org/licenses/>. |
Junxiao Shi | a110f26 | 2014-10-12 12:35:20 -0700 | [diff] [blame] | 24 | */ |
Alexander Afanasyev | 33b7277 | 2014-01-26 23:22:58 -0800 | [diff] [blame] | 25 | |
Alexander Afanasyev | 613e2a9 | 2014-04-15 13:36:58 -0700 | [diff] [blame] | 26 | #ifndef NFD_DAEMON_FW_FORWARDER_HPP |
| 27 | #define NFD_DAEMON_FW_FORWARDER_HPP |
Alexander Afanasyev | 33b7277 | 2014-01-26 23:22:58 -0800 | [diff] [blame] | 28 | |
Junxiao Shi | 9f5b01d | 2016-08-05 03:54:28 +0000 | [diff] [blame] | 29 | #include "core/common.hpp" |
Junxiao Shi | d3c792f | 2014-01-30 00:46:13 -0700 | [diff] [blame] | 30 | #include "core/scheduler.hpp" |
Junxiao Shi | 33152f1 | 2014-07-16 19:54:32 -0700 | [diff] [blame] | 31 | #include "forwarder-counters.hpp" |
Junxiao Shi | a4f2be8 | 2014-03-02 22:56:41 -0700 | [diff] [blame] | 32 | #include "face-table.hpp" |
Junxiao Shi | fbe8efe | 2016-08-22 16:02:30 +0000 | [diff] [blame] | 33 | #include "unsolicited-data-policy.hpp" |
Junxiao Shi | d3c792f | 2014-01-30 00:46:13 -0700 | [diff] [blame] | 34 | #include "table/fib.hpp" |
| 35 | #include "table/pit.hpp" |
| 36 | #include "table/cs.hpp" |
Junxiao Shi | dbe7173 | 2014-02-21 22:23:28 -0700 | [diff] [blame] | 37 | #include "table/measurements.hpp" |
Junxiao Shi | bb5105f | 2014-03-03 12:06:45 -0700 | [diff] [blame] | 38 | #include "table/strategy-choice.hpp" |
Junxiao Shi | a110f26 | 2014-10-12 12:35:20 -0700 | [diff] [blame] | 39 | #include "table/dead-nonce-list.hpp" |
Junxiao Shi | 0355e9f | 2015-09-02 07:24:53 -0700 | [diff] [blame] | 40 | #include "table/network-region-table.hpp" |
Alexander Afanasyev | 33b7277 | 2014-01-26 23:22:58 -0800 | [diff] [blame] | 41 | |
Spyridon Mastorakis | d2b262a | 2014-12-05 22:43:34 -0800 | [diff] [blame] | 42 | #include "ns3/ndnSIM/model/cs/ndn-content-store.hpp" |
| 43 | |
Alexander Afanasyev | 18bbf81 | 2014-01-29 01:40:23 -0800 | [diff] [blame] | 44 | namespace nfd { |
Alexander Afanasyev | 33b7277 | 2014-01-26 23:22:58 -0800 | [diff] [blame] | 45 | |
Junxiao Shi | 2d9bdc8 | 2014-03-02 20:55:42 -0700 | [diff] [blame] | 46 | namespace fw { |
| 47 | class Strategy; |
| 48 | } // namespace fw |
| 49 | |
| 50 | /** \brief main class of NFD |
Junxiao Shi | c041ca3 | 2014-02-25 20:01:15 -0700 | [diff] [blame] | 51 | * |
Junxiao Shi | 2d9bdc8 | 2014-03-02 20:55:42 -0700 | [diff] [blame] | 52 | * Forwarder owns all faces and tables, and implements forwarding pipelines. |
Alexander Afanasyev | 33b7277 | 2014-01-26 23:22:58 -0800 | [diff] [blame] | 53 | */ |
| 54 | class Forwarder |
| 55 | { |
| 56 | public: |
Junxiao Shi | c041ca3 | 2014-02-25 20:01:15 -0700 | [diff] [blame] | 57 | Forwarder(); |
Alexander Afanasyev | 33b7277 | 2014-01-26 23:22:58 -0800 | [diff] [blame] | 58 | |
Steve DiBenedetto | bf6a93d | 2014-03-21 14:03:02 -0600 | [diff] [blame] | 59 | VIRTUAL_WITH_TESTS |
| 60 | ~Forwarder(); |
| 61 | |
Junxiao Shi | b289cc1 | 2014-03-15 12:19:05 -0700 | [diff] [blame] | 62 | const ForwarderCounters& |
Junxiao Shi | b9420cf | 2016-08-13 04:38:52 +0000 | [diff] [blame] | 63 | getCounters() const |
| 64 | { |
| 65 | return m_counters; |
| 66 | } |
Junxiao Shi | b289cc1 | 2014-03-15 12:19:05 -0700 | [diff] [blame] | 67 | |
Junxiao Shi | fbe8efe | 2016-08-22 16:02:30 +0000 | [diff] [blame] | 68 | public: // faces and policies |
Junxiao Shi | a4f2be8 | 2014-03-02 22:56:41 -0700 | [diff] [blame] | 69 | FaceTable& |
Junxiao Shi | b9420cf | 2016-08-13 04:38:52 +0000 | [diff] [blame] | 70 | getFaceTable() |
| 71 | { |
| 72 | return m_faceTable; |
| 73 | } |
Junxiao Shi | a4f2be8 | 2014-03-02 22:56:41 -0700 | [diff] [blame] | 74 | |
| 75 | /** \brief get existing Face |
| 76 | * |
| 77 | * shortcut to .getFaceTable().get(face) |
| 78 | */ |
Junxiao Shi | 5b43f9a | 2016-07-19 13:15:56 +0000 | [diff] [blame] | 79 | Face* |
Junxiao Shi | b9420cf | 2016-08-13 04:38:52 +0000 | [diff] [blame] | 80 | getFace(FaceId id) const |
| 81 | { |
| 82 | return m_faceTable.get(id); |
| 83 | } |
Junxiao Shi | a4f2be8 | 2014-03-02 22:56:41 -0700 | [diff] [blame] | 84 | |
| 85 | /** \brief add new Face |
| 86 | * |
| 87 | * shortcut to .getFaceTable().add(face) |
| 88 | */ |
Junxiao Shi | 8c8d218 | 2014-01-30 22:33:00 -0700 | [diff] [blame] | 89 | void |
Junxiao Shi | b9420cf | 2016-08-13 04:38:52 +0000 | [diff] [blame] | 90 | addFace(shared_ptr<Face> face) |
| 91 | { |
| 92 | m_faceTable.add(face); |
| 93 | } |
Alexander Afanasyev | 33b7277 | 2014-01-26 23:22:58 -0800 | [diff] [blame] | 94 | |
Junxiao Shi | fbe8efe | 2016-08-22 16:02:30 +0000 | [diff] [blame] | 95 | fw::UnsolicitedDataPolicy& |
| 96 | getUnsolicitedDataPolicy() const |
| 97 | { |
| 98 | return *m_unsolicitedDataPolicy; |
| 99 | } |
| 100 | |
| 101 | void |
| 102 | setUnsolicitedDataPolicy(unique_ptr<fw::UnsolicitedDataPolicy> policy) |
| 103 | { |
| 104 | BOOST_ASSERT(policy != nullptr); |
| 105 | m_unsolicitedDataPolicy = std::move(policy); |
| 106 | } |
| 107 | |
Junxiao Shi | a4f2be8 | 2014-03-02 22:56:41 -0700 | [diff] [blame] | 108 | public: // forwarding entrypoints and tables |
Junxiao Shi | 0355e9f | 2015-09-02 07:24:53 -0700 | [diff] [blame] | 109 | /** \brief start incoming Interest processing |
Alexander Afanasyev | b755e9d | 2015-10-20 17:35:51 -0500 | [diff] [blame] | 110 | * \param face face on which Interest is received |
Junxiao Shi | 0355e9f | 2015-09-02 07:24:53 -0700 | [diff] [blame] | 111 | * \param interest the incoming Interest, must be created with make_shared |
| 112 | */ |
Alexander Afanasyev | 33b7277 | 2014-01-26 23:22:58 -0800 | [diff] [blame] | 113 | void |
Junxiao Shi | 0355e9f | 2015-09-02 07:24:53 -0700 | [diff] [blame] | 114 | startProcessInterest(Face& face, const Interest& interest); |
Alexander Afanasyev | 33b7277 | 2014-01-26 23:22:58 -0800 | [diff] [blame] | 115 | |
Junxiao Shi | 0355e9f | 2015-09-02 07:24:53 -0700 | [diff] [blame] | 116 | /** \brief start incoming Data processing |
Alexander Afanasyev | b755e9d | 2015-10-20 17:35:51 -0500 | [diff] [blame] | 117 | * \param face face on which Data is received |
Junxiao Shi | 0355e9f | 2015-09-02 07:24:53 -0700 | [diff] [blame] | 118 | * \param data the incoming Data, must be created with make_shared |
| 119 | */ |
Alexander Afanasyev | 33b7277 | 2014-01-26 23:22:58 -0800 | [diff] [blame] | 120 | void |
Junxiao Shi | 0355e9f | 2015-09-02 07:24:53 -0700 | [diff] [blame] | 121 | startProcessData(Face& face, const Data& data); |
Junxiao Shi | c041ca3 | 2014-02-25 20:01:15 -0700 | [diff] [blame] | 122 | |
Junxiao Shi | 5e5e445 | 2015-09-24 16:56:52 -0700 | [diff] [blame] | 123 | /** \brief start incoming Nack processing |
Alexander Afanasyev | b755e9d | 2015-10-20 17:35:51 -0500 | [diff] [blame] | 124 | * \param face face on which Nack is received |
Junxiao Shi | 5e5e445 | 2015-09-24 16:56:52 -0700 | [diff] [blame] | 125 | * \param nack the incoming Nack, must be created with make_shared |
| 126 | */ |
| 127 | void |
| 128 | startProcessNack(Face& face, const lp::Nack& nack); |
| 129 | |
Junxiao Shi | ea48d8b | 2014-03-16 13:53:47 -0700 | [diff] [blame] | 130 | NameTree& |
Junxiao Shi | b9420cf | 2016-08-13 04:38:52 +0000 | [diff] [blame] | 131 | getNameTree() |
| 132 | { |
| 133 | return m_nameTree; |
| 134 | } |
Junxiao Shi | ea48d8b | 2014-03-16 13:53:47 -0700 | [diff] [blame] | 135 | |
Junxiao Shi | 8c8d218 | 2014-01-30 22:33:00 -0700 | [diff] [blame] | 136 | Fib& |
Junxiao Shi | b9420cf | 2016-08-13 04:38:52 +0000 | [diff] [blame] | 137 | getFib() |
| 138 | { |
| 139 | return m_fib; |
| 140 | } |
Junxiao Shi | c041ca3 | 2014-02-25 20:01:15 -0700 | [diff] [blame] | 141 | |
Junxiao Shi | 8c8d218 | 2014-01-30 22:33:00 -0700 | [diff] [blame] | 142 | Pit& |
Junxiao Shi | b9420cf | 2016-08-13 04:38:52 +0000 | [diff] [blame] | 143 | getPit() |
| 144 | { |
| 145 | return m_pit; |
| 146 | } |
Junxiao Shi | c041ca3 | 2014-02-25 20:01:15 -0700 | [diff] [blame] | 147 | |
Junxiao Shi | 8c8d218 | 2014-01-30 22:33:00 -0700 | [diff] [blame] | 148 | Cs& |
Junxiao Shi | b9420cf | 2016-08-13 04:38:52 +0000 | [diff] [blame] | 149 | getCs() |
| 150 | { |
| 151 | return m_cs; |
| 152 | } |
Junxiao Shi | c041ca3 | 2014-02-25 20:01:15 -0700 | [diff] [blame] | 153 | |
Junxiao Shi | dbe7173 | 2014-02-21 22:23:28 -0700 | [diff] [blame] | 154 | Measurements& |
Junxiao Shi | b9420cf | 2016-08-13 04:38:52 +0000 | [diff] [blame] | 155 | getMeasurements() |
| 156 | { |
| 157 | return m_measurements; |
| 158 | } |
Junxiao Shi | 8c8d218 | 2014-01-30 22:33:00 -0700 | [diff] [blame] | 159 | |
Junxiao Shi | bb5105f | 2014-03-03 12:06:45 -0700 | [diff] [blame] | 160 | StrategyChoice& |
Junxiao Shi | b9420cf | 2016-08-13 04:38:52 +0000 | [diff] [blame] | 161 | getStrategyChoice() |
| 162 | { |
| 163 | return m_strategyChoice; |
| 164 | } |
Junxiao Shi | bb5105f | 2014-03-03 12:06:45 -0700 | [diff] [blame] | 165 | |
Junxiao Shi | a110f26 | 2014-10-12 12:35:20 -0700 | [diff] [blame] | 166 | DeadNonceList& |
Junxiao Shi | b9420cf | 2016-08-13 04:38:52 +0000 | [diff] [blame] | 167 | getDeadNonceList() |
| 168 | { |
| 169 | return m_deadNonceList; |
| 170 | } |
Junxiao Shi | a110f26 | 2014-10-12 12:35:20 -0700 | [diff] [blame] | 171 | |
Junxiao Shi | 0355e9f | 2015-09-02 07:24:53 -0700 | [diff] [blame] | 172 | NetworkRegionTable& |
Junxiao Shi | b9420cf | 2016-08-13 04:38:52 +0000 | [diff] [blame] | 173 | getNetworkRegionTable() |
| 174 | { |
| 175 | return m_networkRegionTable; |
| 176 | } |
Junxiao Shi | 0355e9f | 2015-09-02 07:24:53 -0700 | [diff] [blame] | 177 | |
Spyridon Mastorakis | d2b262a | 2014-12-05 22:43:34 -0800 | [diff] [blame] | 178 | public: // allow enabling ndnSIM content store (will be removed in the future) |
| 179 | void |
| 180 | setCsFromNdnSim(ns3::Ptr<ns3::ndn::ContentStore> cs) |
| 181 | { |
| 182 | m_csFromNdnSim = cs; |
| 183 | } |
| 184 | |
Alexander Afanasyev | 9b9669d | 2015-01-08 21:41:48 -0800 | [diff] [blame] | 185 | public: |
| 186 | /** \brief trigger before PIT entry is satisfied |
| 187 | * \sa Strategy::beforeSatisfyInterest |
| 188 | */ |
| 189 | signal::Signal<Forwarder, pit::Entry, Face, Data> beforeSatisfyInterest; |
| 190 | |
| 191 | /** \brief trigger before PIT entry expires |
| 192 | * \sa Strategy::beforeExpirePendingInterest |
| 193 | */ |
| 194 | signal::Signal<Forwarder, pit::Entry> beforeExpirePendingInterest; |
| 195 | |
Junxiao Shi | 8888449 | 2014-02-15 15:57:43 -0700 | [diff] [blame] | 196 | PUBLIC_WITH_TESTS_ELSE_PRIVATE: // pipelines |
Junxiao Shi | d3c792f | 2014-01-30 00:46:13 -0700 | [diff] [blame] | 197 | /** \brief incoming Interest pipeline |
| 198 | */ |
Junxiao Shi | 8888449 | 2014-02-15 15:57:43 -0700 | [diff] [blame] | 199 | VIRTUAL_WITH_TESTS void |
Junxiao Shi | d3c792f | 2014-01-30 00:46:13 -0700 | [diff] [blame] | 200 | onIncomingInterest(Face& inFace, const Interest& interest); |
| 201 | |
Junxiao Shi | 0355e9f | 2015-09-02 07:24:53 -0700 | [diff] [blame] | 202 | /** \brief Interest loop pipeline |
| 203 | */ |
| 204 | VIRTUAL_WITH_TESTS void |
Junxiao Shi | 330136a | 2016-03-10 04:53:08 -0700 | [diff] [blame] | 205 | onInterestLoop(Face& inFace, const Interest& interest); |
Junxiao Shi | 0355e9f | 2015-09-02 07:24:53 -0700 | [diff] [blame] | 206 | |
mzhang4 | eab7249 | 2015-02-25 11:16:09 -0600 | [diff] [blame] | 207 | /** \brief Content Store miss pipeline |
| 208 | */ |
Junxiao Shi | 5e5e445 | 2015-09-24 16:56:52 -0700 | [diff] [blame] | 209 | VIRTUAL_WITH_TESTS void |
Junxiao Shi | c5f651f | 2016-11-17 22:58:12 +0000 | [diff] [blame] | 210 | onContentStoreMiss(const Face& inFace, const shared_ptr<pit::Entry>& pitEntry, const Interest& interest); |
mzhang4 | eab7249 | 2015-02-25 11:16:09 -0600 | [diff] [blame] | 211 | |
| 212 | /** \brief Content Store hit pipeline |
| 213 | */ |
Junxiao Shi | 5e5e445 | 2015-09-24 16:56:52 -0700 | [diff] [blame] | 214 | VIRTUAL_WITH_TESTS void |
Junxiao Shi | b9420cf | 2016-08-13 04:38:52 +0000 | [diff] [blame] | 215 | onContentStoreHit(const Face& inFace, const shared_ptr<pit::Entry>& pitEntry, |
mzhang4 | eab7249 | 2015-02-25 11:16:09 -0600 | [diff] [blame] | 216 | const Interest& interest, const Data& data); |
| 217 | |
Junxiao Shi | d3c792f | 2014-01-30 00:46:13 -0700 | [diff] [blame] | 218 | /** \brief outgoing Interest pipeline |
| 219 | */ |
Junxiao Shi | 8888449 | 2014-02-15 15:57:43 -0700 | [diff] [blame] | 220 | VIRTUAL_WITH_TESTS void |
Junxiao Shi | c5f651f | 2016-11-17 22:58:12 +0000 | [diff] [blame] | 221 | onOutgoingInterest(const shared_ptr<pit::Entry>& pitEntry, Face& outFace, const Interest& interest); |
Junxiao Shi | c041ca3 | 2014-02-25 20:01:15 -0700 | [diff] [blame] | 222 | |
Junxiao Shi | 09498f0 | 2014-02-26 19:41:08 -0700 | [diff] [blame] | 223 | /** \brief Interest reject pipeline |
Junxiao Shi | d3c792f | 2014-01-30 00:46:13 -0700 | [diff] [blame] | 224 | */ |
Junxiao Shi | 8888449 | 2014-02-15 15:57:43 -0700 | [diff] [blame] | 225 | VIRTUAL_WITH_TESTS void |
Junxiao Shi | b9420cf | 2016-08-13 04:38:52 +0000 | [diff] [blame] | 226 | onInterestReject(const shared_ptr<pit::Entry>& pitEntry); |
Junxiao Shi | c041ca3 | 2014-02-25 20:01:15 -0700 | [diff] [blame] | 227 | |
Junxiao Shi | d3c792f | 2014-01-30 00:46:13 -0700 | [diff] [blame] | 228 | /** \brief Interest unsatisfied pipeline |
| 229 | */ |
Junxiao Shi | 8888449 | 2014-02-15 15:57:43 -0700 | [diff] [blame] | 230 | VIRTUAL_WITH_TESTS void |
Junxiao Shi | b9420cf | 2016-08-13 04:38:52 +0000 | [diff] [blame] | 231 | onInterestUnsatisfied(const shared_ptr<pit::Entry>& pitEntry); |
Junxiao Shi | c041ca3 | 2014-02-25 20:01:15 -0700 | [diff] [blame] | 232 | |
Junxiao Shi | a110f26 | 2014-10-12 12:35:20 -0700 | [diff] [blame] | 233 | /** \brief Interest finalize pipeline |
| 234 | * \param isSatisfied whether the Interest has been satisfied |
| 235 | * \param dataFreshnessPeriod FreshnessPeriod of satisfying Data |
| 236 | */ |
| 237 | VIRTUAL_WITH_TESTS void |
Junxiao Shi | b9420cf | 2016-08-13 04:38:52 +0000 | [diff] [blame] | 238 | onInterestFinalize(const shared_ptr<pit::Entry>& pitEntry, bool isSatisfied, |
| 239 | time::milliseconds dataFreshnessPeriod = time::milliseconds(-1)); |
Junxiao Shi | a110f26 | 2014-10-12 12:35:20 -0700 | [diff] [blame] | 240 | |
Junxiao Shi | d3c792f | 2014-01-30 00:46:13 -0700 | [diff] [blame] | 241 | /** \brief incoming Data pipeline |
| 242 | */ |
Junxiao Shi | 8888449 | 2014-02-15 15:57:43 -0700 | [diff] [blame] | 243 | VIRTUAL_WITH_TESTS void |
Junxiao Shi | d3c792f | 2014-01-30 00:46:13 -0700 | [diff] [blame] | 244 | onIncomingData(Face& inFace, const Data& data); |
Junxiao Shi | c041ca3 | 2014-02-25 20:01:15 -0700 | [diff] [blame] | 245 | |
Junxiao Shi | d3c792f | 2014-01-30 00:46:13 -0700 | [diff] [blame] | 246 | /** \brief Data unsolicited pipeline |
| 247 | */ |
Junxiao Shi | 8888449 | 2014-02-15 15:57:43 -0700 | [diff] [blame] | 248 | VIRTUAL_WITH_TESTS void |
Junxiao Shi | d3c792f | 2014-01-30 00:46:13 -0700 | [diff] [blame] | 249 | onDataUnsolicited(Face& inFace, const Data& data); |
Junxiao Shi | c041ca3 | 2014-02-25 20:01:15 -0700 | [diff] [blame] | 250 | |
Junxiao Shi | d3c792f | 2014-01-30 00:46:13 -0700 | [diff] [blame] | 251 | /** \brief outgoing Data pipeline |
| 252 | */ |
Junxiao Shi | 8888449 | 2014-02-15 15:57:43 -0700 | [diff] [blame] | 253 | VIRTUAL_WITH_TESTS void |
Junxiao Shi | d3c792f | 2014-01-30 00:46:13 -0700 | [diff] [blame] | 254 | onOutgoingData(const Data& data, Face& outFace); |
| 255 | |
Junxiao Shi | 5e5e445 | 2015-09-24 16:56:52 -0700 | [diff] [blame] | 256 | /** \brief incoming Nack pipeline |
| 257 | */ |
| 258 | VIRTUAL_WITH_TESTS void |
| 259 | onIncomingNack(Face& inFace, const lp::Nack& nack); |
| 260 | |
| 261 | /** \brief outgoing Nack pipeline |
| 262 | */ |
| 263 | VIRTUAL_WITH_TESTS void |
Junxiao Shi | b9420cf | 2016-08-13 04:38:52 +0000 | [diff] [blame] | 264 | onOutgoingNack(const shared_ptr<pit::Entry>& pitEntry, const Face& outFace, const lp::NackHeader& nack); |
Junxiao Shi | 5e5e445 | 2015-09-24 16:56:52 -0700 | [diff] [blame] | 265 | |
Junxiao Shi | 8888449 | 2014-02-15 15:57:43 -0700 | [diff] [blame] | 266 | PROTECTED_WITH_TESTS_ELSE_PRIVATE: |
| 267 | VIRTUAL_WITH_TESTS void |
Junxiao Shi | b9420cf | 2016-08-13 04:38:52 +0000 | [diff] [blame] | 268 | setUnsatisfyTimer(const shared_ptr<pit::Entry>& pitEntry); |
Junxiao Shi | c041ca3 | 2014-02-25 20:01:15 -0700 | [diff] [blame] | 269 | |
Junxiao Shi | 8888449 | 2014-02-15 15:57:43 -0700 | [diff] [blame] | 270 | VIRTUAL_WITH_TESTS void |
Junxiao Shi | b9420cf | 2016-08-13 04:38:52 +0000 | [diff] [blame] | 271 | setStragglerTimer(const shared_ptr<pit::Entry>& pitEntry, bool isSatisfied, |
| 272 | time::milliseconds dataFreshnessPeriod = time::milliseconds(-1)); |
Junxiao Shi | c041ca3 | 2014-02-25 20:01:15 -0700 | [diff] [blame] | 273 | |
Junxiao Shi | 8888449 | 2014-02-15 15:57:43 -0700 | [diff] [blame] | 274 | VIRTUAL_WITH_TESTS void |
Junxiao Shi | b9420cf | 2016-08-13 04:38:52 +0000 | [diff] [blame] | 275 | cancelUnsatisfyAndStragglerTimer(pit::Entry& pitEntry); |
Junxiao Shi | c041ca3 | 2014-02-25 20:01:15 -0700 | [diff] [blame] | 276 | |
Junxiao Shi | a110f26 | 2014-10-12 12:35:20 -0700 | [diff] [blame] | 277 | /** \brief insert Nonce to Dead Nonce List if necessary |
Junxiao Shi | 4846f37 | 2016-04-05 13:39:30 -0700 | [diff] [blame] | 278 | * \param upstream if null, insert Nonces from all out-records; |
| 279 | * if not null, insert Nonce only on the out-records of this face |
Junxiao Shi | a110f26 | 2014-10-12 12:35:20 -0700 | [diff] [blame] | 280 | */ |
| 281 | VIRTUAL_WITH_TESTS void |
| 282 | insertDeadNonceList(pit::Entry& pitEntry, bool isSatisfied, |
Junxiao Shi | b9420cf | 2016-08-13 04:38:52 +0000 | [diff] [blame] | 283 | time::milliseconds dataFreshnessPeriod, Face* upstream); |
Junxiao Shi | a110f26 | 2014-10-12 12:35:20 -0700 | [diff] [blame] | 284 | |
Junxiao Shi | b9420cf | 2016-08-13 04:38:52 +0000 | [diff] [blame] | 285 | /** \brief call trigger (method) on the effective strategy of pitEntry |
| 286 | */ |
Junxiao Shi | f3c0781 | 2014-03-11 21:48:49 -0700 | [diff] [blame] | 287 | #ifdef WITH_TESTS |
| 288 | virtual void |
Junxiao Shi | b9420cf | 2016-08-13 04:38:52 +0000 | [diff] [blame] | 289 | dispatchToStrategy(pit::Entry& pitEntry, function<void(fw::Strategy&)> trigger) |
Junxiao Shi | f3c0781 | 2014-03-11 21:48:49 -0700 | [diff] [blame] | 290 | #else |
| 291 | template<class Function> |
| 292 | void |
Junxiao Shi | b9420cf | 2016-08-13 04:38:52 +0000 | [diff] [blame] | 293 | dispatchToStrategy(pit::Entry& pitEntry, Function trigger) |
Junxiao Shi | f3c0781 | 2014-03-11 21:48:49 -0700 | [diff] [blame] | 294 | #endif |
Junxiao Shi | b9420cf | 2016-08-13 04:38:52 +0000 | [diff] [blame] | 295 | { |
| 296 | trigger(m_strategyChoice.findEffectiveStrategy(pitEntry)); |
| 297 | } |
Junxiao Shi | d3c792f | 2014-01-30 00:46:13 -0700 | [diff] [blame] | 298 | |
| 299 | private: |
Junxiao Shi | b289cc1 | 2014-03-15 12:19:05 -0700 | [diff] [blame] | 300 | ForwarderCounters m_counters; |
| 301 | |
Junxiao Shi | a4f2be8 | 2014-03-02 22:56:41 -0700 | [diff] [blame] | 302 | FaceTable m_faceTable; |
Junxiao Shi | fbe8efe | 2016-08-22 16:02:30 +0000 | [diff] [blame] | 303 | unique_ptr<fw::UnsolicitedDataPolicy> m_unsolicitedDataPolicy; |
HangZhang | ad4afd1 | 2014-03-01 11:03:08 +0800 | [diff] [blame] | 304 | |
Junxiao Shi | 0355e9f | 2015-09-02 07:24:53 -0700 | [diff] [blame] | 305 | NameTree m_nameTree; |
| 306 | Fib m_fib; |
| 307 | Pit m_pit; |
| 308 | Cs m_cs; |
| 309 | Measurements m_measurements; |
| 310 | StrategyChoice m_strategyChoice; |
| 311 | DeadNonceList m_deadNonceList; |
| 312 | NetworkRegionTable m_networkRegionTable; |
Alexander Afanasyev | 9b9669d | 2015-01-08 21:41:48 -0800 | [diff] [blame] | 313 | shared_ptr<Face> m_csFace; |
Junxiao Shi | bb5105f | 2014-03-03 12:06:45 -0700 | [diff] [blame] | 314 | |
Spyridon Mastorakis | d2b262a | 2014-12-05 22:43:34 -0800 | [diff] [blame] | 315 | ns3::Ptr<ns3::ndn::ContentStore> m_csFromNdnSim; |
| 316 | |
Junxiao Shi | d3c792f | 2014-01-30 00:46:13 -0700 | [diff] [blame] | 317 | // allow Strategy (base class) to enter pipelines |
Junxiao Shi | 8c8d218 | 2014-01-30 22:33:00 -0700 | [diff] [blame] | 318 | friend class fw::Strategy; |
Alexander Afanasyev | 33b7277 | 2014-01-26 23:22:58 -0800 | [diff] [blame] | 319 | }; |
| 320 | |
Junxiao Shi | d3c792f | 2014-01-30 00:46:13 -0700 | [diff] [blame] | 321 | } // namespace nfd |
Alexander Afanasyev | 33b7277 | 2014-01-26 23:22:58 -0800 | [diff] [blame] | 322 | |
Alexander Afanasyev | 613e2a9 | 2014-04-15 13:36:58 -0700 | [diff] [blame] | 323 | #endif // NFD_DAEMON_FW_FORWARDER_HPP |