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 | a110f26 | 2014-10-12 12:35:20 -0700 | [diff] [blame] | 3 | * Copyright (c) 2014, 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 | |
| 29 | #include "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 | d3c792f | 2014-01-30 00:46:13 -0700 | [diff] [blame] | 33 | #include "table/fib.hpp" |
| 34 | #include "table/pit.hpp" |
| 35 | #include "table/cs.hpp" |
Junxiao Shi | dbe7173 | 2014-02-21 22:23:28 -0700 | [diff] [blame] | 36 | #include "table/measurements.hpp" |
Junxiao Shi | bb5105f | 2014-03-03 12:06:45 -0700 | [diff] [blame] | 37 | #include "table/strategy-choice.hpp" |
Junxiao Shi | a110f26 | 2014-10-12 12:35:20 -0700 | [diff] [blame] | 38 | #include "table/dead-nonce-list.hpp" |
Alexander Afanasyev | 33b7277 | 2014-01-26 23:22:58 -0800 | [diff] [blame] | 39 | |
Spyridon Mastorakis | 9d9c9ae | 2014-12-05 22:43:34 -0800 | [diff] [blame] | 40 | #include "ns3/ndnSIM/model/cs/ndn-content-store.hpp" |
| 41 | |
Alexander Afanasyev | 18bbf81 | 2014-01-29 01:40:23 -0800 | [diff] [blame] | 42 | namespace nfd { |
Alexander Afanasyev | 33b7277 | 2014-01-26 23:22:58 -0800 | [diff] [blame] | 43 | |
Junxiao Shi | 2d9bdc8 | 2014-03-02 20:55:42 -0700 | [diff] [blame] | 44 | namespace fw { |
| 45 | class Strategy; |
| 46 | } // namespace fw |
| 47 | |
Alexander Afanasyev | 4401615 | 2015-01-08 21:41:48 -0800 | [diff] [blame^] | 48 | class NullFace; |
| 49 | |
Junxiao Shi | 2d9bdc8 | 2014-03-02 20:55:42 -0700 | [diff] [blame] | 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& |
| 63 | getCounters() const; |
| 64 | |
Junxiao Shi | a4f2be8 | 2014-03-02 22:56:41 -0700 | [diff] [blame] | 65 | public: // faces |
| 66 | FaceTable& |
| 67 | getFaceTable(); |
| 68 | |
| 69 | /** \brief get existing Face |
| 70 | * |
| 71 | * shortcut to .getFaceTable().get(face) |
| 72 | */ |
| 73 | shared_ptr<Face> |
| 74 | getFace(FaceId id) const; |
| 75 | |
| 76 | /** \brief add new Face |
| 77 | * |
| 78 | * shortcut to .getFaceTable().add(face) |
| 79 | */ |
Junxiao Shi | 8c8d218 | 2014-01-30 22:33:00 -0700 | [diff] [blame] | 80 | void |
| 81 | addFace(shared_ptr<Face> face); |
Alexander Afanasyev | 33b7277 | 2014-01-26 23:22:58 -0800 | [diff] [blame] | 82 | |
Junxiao Shi | a4f2be8 | 2014-03-02 22:56:41 -0700 | [diff] [blame] | 83 | public: // forwarding entrypoints and tables |
Alexander Afanasyev | 33b7277 | 2014-01-26 23:22:58 -0800 | [diff] [blame] | 84 | void |
Junxiao Shi | 8c8d218 | 2014-01-30 22:33:00 -0700 | [diff] [blame] | 85 | onInterest(Face& face, const Interest& interest); |
Alexander Afanasyev | 33b7277 | 2014-01-26 23:22:58 -0800 | [diff] [blame] | 86 | |
| 87 | void |
Junxiao Shi | 8c8d218 | 2014-01-30 22:33:00 -0700 | [diff] [blame] | 88 | onData(Face& face, const Data& data); |
Junxiao Shi | c041ca3 | 2014-02-25 20:01:15 -0700 | [diff] [blame] | 89 | |
Junxiao Shi | ea48d8b | 2014-03-16 13:53:47 -0700 | [diff] [blame] | 90 | NameTree& |
| 91 | getNameTree(); |
| 92 | |
Junxiao Shi | 8c8d218 | 2014-01-30 22:33:00 -0700 | [diff] [blame] | 93 | Fib& |
| 94 | getFib(); |
Junxiao Shi | c041ca3 | 2014-02-25 20:01:15 -0700 | [diff] [blame] | 95 | |
Junxiao Shi | 8c8d218 | 2014-01-30 22:33:00 -0700 | [diff] [blame] | 96 | Pit& |
| 97 | getPit(); |
Junxiao Shi | c041ca3 | 2014-02-25 20:01:15 -0700 | [diff] [blame] | 98 | |
Junxiao Shi | 8c8d218 | 2014-01-30 22:33:00 -0700 | [diff] [blame] | 99 | Cs& |
| 100 | getCs(); |
Junxiao Shi | c041ca3 | 2014-02-25 20:01:15 -0700 | [diff] [blame] | 101 | |
Junxiao Shi | dbe7173 | 2014-02-21 22:23:28 -0700 | [diff] [blame] | 102 | Measurements& |
| 103 | getMeasurements(); |
Junxiao Shi | 8c8d218 | 2014-01-30 22:33:00 -0700 | [diff] [blame] | 104 | |
Junxiao Shi | bb5105f | 2014-03-03 12:06:45 -0700 | [diff] [blame] | 105 | StrategyChoice& |
| 106 | getStrategyChoice(); |
| 107 | |
Junxiao Shi | a110f26 | 2014-10-12 12:35:20 -0700 | [diff] [blame] | 108 | DeadNonceList& |
| 109 | getDeadNonceList(); |
| 110 | |
Spyridon Mastorakis | 9d9c9ae | 2014-12-05 22:43:34 -0800 | [diff] [blame] | 111 | public: // allow enabling ndnSIM content store (will be removed in the future) |
| 112 | void |
| 113 | setCsFromNdnSim(ns3::Ptr<ns3::ndn::ContentStore> cs); |
| 114 | |
Alexander Afanasyev | 4401615 | 2015-01-08 21:41:48 -0800 | [diff] [blame^] | 115 | public: |
| 116 | /** \brief trigger before PIT entry is satisfied |
| 117 | * \sa Strategy::beforeSatisfyInterest |
| 118 | */ |
| 119 | signal::Signal<Forwarder, pit::Entry, Face, Data> beforeSatisfyInterest; |
| 120 | |
| 121 | /** \brief trigger before PIT entry expires |
| 122 | * \sa Strategy::beforeExpirePendingInterest |
| 123 | */ |
| 124 | signal::Signal<Forwarder, pit::Entry> beforeExpirePendingInterest; |
| 125 | |
Junxiao Shi | 8888449 | 2014-02-15 15:57:43 -0700 | [diff] [blame] | 126 | PUBLIC_WITH_TESTS_ELSE_PRIVATE: // pipelines |
Junxiao Shi | d3c792f | 2014-01-30 00:46:13 -0700 | [diff] [blame] | 127 | /** \brief incoming Interest pipeline |
| 128 | */ |
Junxiao Shi | 8888449 | 2014-02-15 15:57:43 -0700 | [diff] [blame] | 129 | VIRTUAL_WITH_TESTS void |
Junxiao Shi | d3c792f | 2014-01-30 00:46:13 -0700 | [diff] [blame] | 130 | onIncomingInterest(Face& inFace, const Interest& interest); |
| 131 | |
mzhang4 | eab7249 | 2015-02-25 11:16:09 -0600 | [diff] [blame] | 132 | /** \brief Content Store miss pipeline |
| 133 | */ |
| 134 | void |
| 135 | onContentStoreMiss(const Face& inFace, shared_ptr<pit::Entry> pitEntry, const Interest& interest); |
| 136 | |
| 137 | /** \brief Content Store hit pipeline |
| 138 | */ |
| 139 | void |
| 140 | onContentStoreHit(const Face& inFace, shared_ptr<pit::Entry> pitEntry, |
| 141 | const Interest& interest, const Data& data); |
| 142 | |
Junxiao Shi | d3c792f | 2014-01-30 00:46:13 -0700 | [diff] [blame] | 143 | /** \brief Interest loop pipeline |
| 144 | */ |
Junxiao Shi | 8888449 | 2014-02-15 15:57:43 -0700 | [diff] [blame] | 145 | VIRTUAL_WITH_TESTS void |
Junxiao Shi | d3c792f | 2014-01-30 00:46:13 -0700 | [diff] [blame] | 146 | onInterestLoop(Face& inFace, const Interest& interest, |
| 147 | shared_ptr<pit::Entry> pitEntry); |
Junxiao Shi | c041ca3 | 2014-02-25 20:01:15 -0700 | [diff] [blame] | 148 | |
Junxiao Shi | d3c792f | 2014-01-30 00:46:13 -0700 | [diff] [blame] | 149 | /** \brief outgoing Interest pipeline |
| 150 | */ |
Junxiao Shi | 8888449 | 2014-02-15 15:57:43 -0700 | [diff] [blame] | 151 | VIRTUAL_WITH_TESTS void |
Junxiao Shi | d938a6b | 2014-05-11 23:40:29 -0700 | [diff] [blame] | 152 | onOutgoingInterest(shared_ptr<pit::Entry> pitEntry, Face& outFace, |
| 153 | bool wantNewNonce = false); |
Junxiao Shi | c041ca3 | 2014-02-25 20:01:15 -0700 | [diff] [blame] | 154 | |
Junxiao Shi | 09498f0 | 2014-02-26 19:41:08 -0700 | [diff] [blame] | 155 | /** \brief Interest reject pipeline |
Junxiao Shi | d3c792f | 2014-01-30 00:46:13 -0700 | [diff] [blame] | 156 | */ |
Junxiao Shi | 8888449 | 2014-02-15 15:57:43 -0700 | [diff] [blame] | 157 | VIRTUAL_WITH_TESTS void |
Junxiao Shi | 09498f0 | 2014-02-26 19:41:08 -0700 | [diff] [blame] | 158 | onInterestReject(shared_ptr<pit::Entry> pitEntry); |
Junxiao Shi | c041ca3 | 2014-02-25 20:01:15 -0700 | [diff] [blame] | 159 | |
Junxiao Shi | d3c792f | 2014-01-30 00:46:13 -0700 | [diff] [blame] | 160 | /** \brief Interest unsatisfied pipeline |
| 161 | */ |
Junxiao Shi | 8888449 | 2014-02-15 15:57:43 -0700 | [diff] [blame] | 162 | VIRTUAL_WITH_TESTS void |
Junxiao Shi | d3c792f | 2014-01-30 00:46:13 -0700 | [diff] [blame] | 163 | onInterestUnsatisfied(shared_ptr<pit::Entry> pitEntry); |
Junxiao Shi | c041ca3 | 2014-02-25 20:01:15 -0700 | [diff] [blame] | 164 | |
Junxiao Shi | a110f26 | 2014-10-12 12:35:20 -0700 | [diff] [blame] | 165 | /** \brief Interest finalize pipeline |
| 166 | * \param isSatisfied whether the Interest has been satisfied |
| 167 | * \param dataFreshnessPeriod FreshnessPeriod of satisfying Data |
| 168 | */ |
| 169 | VIRTUAL_WITH_TESTS void |
| 170 | onInterestFinalize(shared_ptr<pit::Entry> pitEntry, bool isSatisfied, |
| 171 | const time::milliseconds& dataFreshnessPeriod = time::milliseconds(-1)); |
| 172 | |
Junxiao Shi | d3c792f | 2014-01-30 00:46:13 -0700 | [diff] [blame] | 173 | /** \brief incoming Data pipeline |
| 174 | */ |
Junxiao Shi | 8888449 | 2014-02-15 15:57:43 -0700 | [diff] [blame] | 175 | VIRTUAL_WITH_TESTS void |
Junxiao Shi | d3c792f | 2014-01-30 00:46:13 -0700 | [diff] [blame] | 176 | onIncomingData(Face& inFace, const Data& data); |
Junxiao Shi | c041ca3 | 2014-02-25 20:01:15 -0700 | [diff] [blame] | 177 | |
Junxiao Shi | d3c792f | 2014-01-30 00:46:13 -0700 | [diff] [blame] | 178 | /** \brief Data unsolicited pipeline |
| 179 | */ |
Junxiao Shi | 8888449 | 2014-02-15 15:57:43 -0700 | [diff] [blame] | 180 | VIRTUAL_WITH_TESTS void |
Junxiao Shi | d3c792f | 2014-01-30 00:46:13 -0700 | [diff] [blame] | 181 | onDataUnsolicited(Face& inFace, const Data& data); |
Junxiao Shi | c041ca3 | 2014-02-25 20:01:15 -0700 | [diff] [blame] | 182 | |
Junxiao Shi | d3c792f | 2014-01-30 00:46:13 -0700 | [diff] [blame] | 183 | /** \brief outgoing Data pipeline |
| 184 | */ |
Junxiao Shi | 8888449 | 2014-02-15 15:57:43 -0700 | [diff] [blame] | 185 | VIRTUAL_WITH_TESTS void |
Junxiao Shi | d3c792f | 2014-01-30 00:46:13 -0700 | [diff] [blame] | 186 | onOutgoingData(const Data& data, Face& outFace); |
| 187 | |
Junxiao Shi | 8888449 | 2014-02-15 15:57:43 -0700 | [diff] [blame] | 188 | PROTECTED_WITH_TESTS_ELSE_PRIVATE: |
| 189 | VIRTUAL_WITH_TESTS void |
Junxiao Shi | d3c792f | 2014-01-30 00:46:13 -0700 | [diff] [blame] | 190 | setUnsatisfyTimer(shared_ptr<pit::Entry> pitEntry); |
Junxiao Shi | c041ca3 | 2014-02-25 20:01:15 -0700 | [diff] [blame] | 191 | |
Junxiao Shi | 8888449 | 2014-02-15 15:57:43 -0700 | [diff] [blame] | 192 | VIRTUAL_WITH_TESTS void |
Junxiao Shi | a110f26 | 2014-10-12 12:35:20 -0700 | [diff] [blame] | 193 | setStragglerTimer(shared_ptr<pit::Entry> pitEntry, bool isSatisfied, |
| 194 | const time::milliseconds& dataFreshnessPeriod = time::milliseconds(-1)); |
Junxiao Shi | c041ca3 | 2014-02-25 20:01:15 -0700 | [diff] [blame] | 195 | |
Junxiao Shi | 8888449 | 2014-02-15 15:57:43 -0700 | [diff] [blame] | 196 | VIRTUAL_WITH_TESTS void |
Junxiao Shi | d3c792f | 2014-01-30 00:46:13 -0700 | [diff] [blame] | 197 | cancelUnsatisfyAndStragglerTimer(shared_ptr<pit::Entry> pitEntry); |
Junxiao Shi | c041ca3 | 2014-02-25 20:01:15 -0700 | [diff] [blame] | 198 | |
Junxiao Shi | a110f26 | 2014-10-12 12:35:20 -0700 | [diff] [blame] | 199 | /** \brief insert Nonce to Dead Nonce List if necessary |
| 200 | * \param upstream if null, insert Nonces from all OutRecords; |
| 201 | * if not null, insert Nonce only on the OutRecord of this face |
| 202 | */ |
| 203 | VIRTUAL_WITH_TESTS void |
| 204 | insertDeadNonceList(pit::Entry& pitEntry, bool isSatisfied, |
| 205 | const time::milliseconds& dataFreshnessPeriod, |
| 206 | Face* upstream); |
| 207 | |
Junxiao Shi | f3c0781 | 2014-03-11 21:48:49 -0700 | [diff] [blame] | 208 | /// call trigger (method) on the effective strategy of pitEntry |
| 209 | #ifdef WITH_TESTS |
| 210 | virtual void |
| 211 | dispatchToStrategy(shared_ptr<pit::Entry> pitEntry, function<void(fw::Strategy*)> trigger); |
| 212 | #else |
| 213 | template<class Function> |
| 214 | void |
| 215 | dispatchToStrategy(shared_ptr<pit::Entry> pitEntry, Function trigger); |
| 216 | #endif |
Junxiao Shi | d3c792f | 2014-01-30 00:46:13 -0700 | [diff] [blame] | 217 | |
| 218 | private: |
Junxiao Shi | b289cc1 | 2014-03-15 12:19:05 -0700 | [diff] [blame] | 219 | ForwarderCounters m_counters; |
| 220 | |
Junxiao Shi | a4f2be8 | 2014-03-02 22:56:41 -0700 | [diff] [blame] | 221 | FaceTable m_faceTable; |
HangZhang | ad4afd1 | 2014-03-01 11:03:08 +0800 | [diff] [blame] | 222 | |
Junxiao Shi | bb5105f | 2014-03-03 12:06:45 -0700 | [diff] [blame] | 223 | // tables |
| 224 | NameTree m_nameTree; |
| 225 | Fib m_fib; |
| 226 | Pit m_pit; |
| 227 | Cs m_cs; |
| 228 | Measurements m_measurements; |
| 229 | StrategyChoice m_strategyChoice; |
Junxiao Shi | a110f26 | 2014-10-12 12:35:20 -0700 | [diff] [blame] | 230 | DeadNonceList m_deadNonceList; |
Alexander Afanasyev | 4401615 | 2015-01-08 21:41:48 -0800 | [diff] [blame^] | 231 | shared_ptr<NullFace> m_csFace; |
Junxiao Shi | bb5105f | 2014-03-03 12:06:45 -0700 | [diff] [blame] | 232 | |
Spyridon Mastorakis | 9d9c9ae | 2014-12-05 22:43:34 -0800 | [diff] [blame] | 233 | ns3::Ptr<ns3::ndn::ContentStore> m_csFromNdnSim; |
| 234 | |
Junxiao Shi | f3c0781 | 2014-03-11 21:48:49 -0700 | [diff] [blame] | 235 | static const Name LOCALHOST_NAME; |
Junxiao Shi | c041ca3 | 2014-02-25 20:01:15 -0700 | [diff] [blame] | 236 | |
Junxiao Shi | d3c792f | 2014-01-30 00:46:13 -0700 | [diff] [blame] | 237 | // allow Strategy (base class) to enter pipelines |
Junxiao Shi | 8c8d218 | 2014-01-30 22:33:00 -0700 | [diff] [blame] | 238 | friend class fw::Strategy; |
Alexander Afanasyev | 33b7277 | 2014-01-26 23:22:58 -0800 | [diff] [blame] | 239 | }; |
| 240 | |
Junxiao Shi | b289cc1 | 2014-03-15 12:19:05 -0700 | [diff] [blame] | 241 | inline const ForwarderCounters& |
| 242 | Forwarder::getCounters() const |
| 243 | { |
| 244 | return m_counters; |
| 245 | } |
| 246 | |
Junxiao Shi | a4f2be8 | 2014-03-02 22:56:41 -0700 | [diff] [blame] | 247 | inline FaceTable& |
| 248 | Forwarder::getFaceTable() |
| 249 | { |
| 250 | return m_faceTable; |
| 251 | } |
| 252 | |
| 253 | inline shared_ptr<Face> |
| 254 | Forwarder::getFace(FaceId id) const |
| 255 | { |
| 256 | return m_faceTable.get(id); |
| 257 | } |
| 258 | |
| 259 | inline void |
| 260 | Forwarder::addFace(shared_ptr<Face> face) |
| 261 | { |
| 262 | m_faceTable.add(face); |
| 263 | } |
| 264 | |
| 265 | inline void |
Junxiao Shi | a4f2be8 | 2014-03-02 22:56:41 -0700 | [diff] [blame] | 266 | Forwarder::onInterest(Face& face, const Interest& interest) |
| 267 | { |
| 268 | this->onIncomingInterest(face, interest); |
| 269 | } |
| 270 | |
| 271 | inline void |
| 272 | Forwarder::onData(Face& face, const Data& data) |
| 273 | { |
| 274 | this->onIncomingData(face, data); |
| 275 | } |
| 276 | |
Junxiao Shi | ea48d8b | 2014-03-16 13:53:47 -0700 | [diff] [blame] | 277 | inline NameTree& |
| 278 | Forwarder::getNameTree() |
| 279 | { |
| 280 | return m_nameTree; |
| 281 | } |
| 282 | |
Junxiao Shi | 8c8d218 | 2014-01-30 22:33:00 -0700 | [diff] [blame] | 283 | inline Fib& |
| 284 | Forwarder::getFib() |
| 285 | { |
| 286 | return m_fib; |
| 287 | } |
| 288 | |
| 289 | inline Pit& |
| 290 | Forwarder::getPit() |
| 291 | { |
| 292 | return m_pit; |
| 293 | } |
| 294 | |
| 295 | inline Cs& |
| 296 | Forwarder::getCs() |
| 297 | { |
| 298 | return m_cs; |
| 299 | } |
| 300 | |
Junxiao Shi | dbe7173 | 2014-02-21 22:23:28 -0700 | [diff] [blame] | 301 | inline Measurements& |
| 302 | Forwarder::getMeasurements() |
| 303 | { |
| 304 | return m_measurements; |
| 305 | } |
| 306 | |
Junxiao Shi | bb5105f | 2014-03-03 12:06:45 -0700 | [diff] [blame] | 307 | inline StrategyChoice& |
| 308 | Forwarder::getStrategyChoice() |
| 309 | { |
| 310 | return m_strategyChoice; |
| 311 | } |
Junxiao Shi | a4f2be8 | 2014-03-02 22:56:41 -0700 | [diff] [blame] | 312 | |
Junxiao Shi | a110f26 | 2014-10-12 12:35:20 -0700 | [diff] [blame] | 313 | inline DeadNonceList& |
| 314 | Forwarder::getDeadNonceList() |
| 315 | { |
| 316 | return m_deadNonceList; |
| 317 | } |
| 318 | |
Spyridon Mastorakis | 9d9c9ae | 2014-12-05 22:43:34 -0800 | [diff] [blame] | 319 | inline void |
| 320 | Forwarder::setCsFromNdnSim(ns3::Ptr<ns3::ndn::ContentStore> cs) |
| 321 | { |
| 322 | m_csFromNdnSim = cs; |
| 323 | } |
| 324 | |
Junxiao Shi | f3c0781 | 2014-03-11 21:48:49 -0700 | [diff] [blame] | 325 | #ifdef WITH_TESTS |
| 326 | inline void |
| 327 | Forwarder::dispatchToStrategy(shared_ptr<pit::Entry> pitEntry, function<void(fw::Strategy*)> trigger) |
| 328 | #else |
| 329 | template<class Function> |
| 330 | inline void |
| 331 | Forwarder::dispatchToStrategy(shared_ptr<pit::Entry> pitEntry, Function trigger) |
| 332 | #endif |
| 333 | { |
| 334 | fw::Strategy& strategy = m_strategyChoice.findEffectiveStrategy(*pitEntry); |
| 335 | trigger(&strategy); |
| 336 | } |
| 337 | |
Junxiao Shi | d3c792f | 2014-01-30 00:46:13 -0700 | [diff] [blame] | 338 | } // namespace nfd |
Alexander Afanasyev | 33b7277 | 2014-01-26 23:22:58 -0800 | [diff] [blame] | 339 | |
Alexander Afanasyev | 613e2a9 | 2014-04-15 13:36:58 -0700 | [diff] [blame] | 340 | #endif // NFD_DAEMON_FW_FORWARDER_HPP |