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" |
Junxiao Shi | 0355e9f | 2015-09-02 07:24:53 -0700 | [diff] [blame] | 39 | #include "table/network-region-table.hpp" |
Alexander Afanasyev | 33b7277 | 2014-01-26 23:22:58 -0800 | [diff] [blame] | 40 | |
Alexander Afanasyev | 18bbf81 | 2014-01-29 01:40:23 -0800 | [diff] [blame] | 41 | namespace nfd { |
Alexander Afanasyev | 33b7277 | 2014-01-26 23:22:58 -0800 | [diff] [blame] | 42 | |
Junxiao Shi | 2d9bdc8 | 2014-03-02 20:55:42 -0700 | [diff] [blame] | 43 | namespace fw { |
| 44 | class Strategy; |
| 45 | } // namespace fw |
| 46 | |
| 47 | /** \brief main class of NFD |
Junxiao Shi | c041ca3 | 2014-02-25 20:01:15 -0700 | [diff] [blame] | 48 | * |
Junxiao Shi | 2d9bdc8 | 2014-03-02 20:55:42 -0700 | [diff] [blame] | 49 | * Forwarder owns all faces and tables, and implements forwarding pipelines. |
Alexander Afanasyev | 33b7277 | 2014-01-26 23:22:58 -0800 | [diff] [blame] | 50 | */ |
| 51 | class Forwarder |
| 52 | { |
| 53 | public: |
Junxiao Shi | c041ca3 | 2014-02-25 20:01:15 -0700 | [diff] [blame] | 54 | Forwarder(); |
Alexander Afanasyev | 33b7277 | 2014-01-26 23:22:58 -0800 | [diff] [blame] | 55 | |
Steve DiBenedetto | bf6a93d | 2014-03-21 14:03:02 -0600 | [diff] [blame] | 56 | VIRTUAL_WITH_TESTS |
| 57 | ~Forwarder(); |
| 58 | |
Junxiao Shi | b289cc1 | 2014-03-15 12:19:05 -0700 | [diff] [blame] | 59 | const ForwarderCounters& |
| 60 | getCounters() const; |
| 61 | |
Junxiao Shi | a4f2be8 | 2014-03-02 22:56:41 -0700 | [diff] [blame] | 62 | public: // faces |
| 63 | FaceTable& |
| 64 | getFaceTable(); |
| 65 | |
| 66 | /** \brief get existing Face |
| 67 | * |
| 68 | * shortcut to .getFaceTable().get(face) |
| 69 | */ |
| 70 | shared_ptr<Face> |
| 71 | getFace(FaceId id) const; |
| 72 | |
| 73 | /** \brief add new Face |
| 74 | * |
| 75 | * shortcut to .getFaceTable().add(face) |
| 76 | */ |
Junxiao Shi | 8c8d218 | 2014-01-30 22:33:00 -0700 | [diff] [blame] | 77 | void |
| 78 | addFace(shared_ptr<Face> face); |
Alexander Afanasyev | 33b7277 | 2014-01-26 23:22:58 -0800 | [diff] [blame] | 79 | |
Junxiao Shi | a4f2be8 | 2014-03-02 22:56:41 -0700 | [diff] [blame] | 80 | public: // forwarding entrypoints and tables |
Junxiao Shi | 0355e9f | 2015-09-02 07:24:53 -0700 | [diff] [blame] | 81 | /** \brief start incoming Interest processing |
Alexander Afanasyev | b755e9d | 2015-10-20 17:35:51 -0500 | [diff] [blame^] | 82 | * \param face face on which Interest is received |
Junxiao Shi | 0355e9f | 2015-09-02 07:24:53 -0700 | [diff] [blame] | 83 | * \param interest the incoming Interest, must be created with make_shared |
| 84 | */ |
Alexander Afanasyev | 33b7277 | 2014-01-26 23:22:58 -0800 | [diff] [blame] | 85 | void |
Junxiao Shi | 0355e9f | 2015-09-02 07:24:53 -0700 | [diff] [blame] | 86 | startProcessInterest(Face& face, const Interest& interest); |
Alexander Afanasyev | 33b7277 | 2014-01-26 23:22:58 -0800 | [diff] [blame] | 87 | |
Junxiao Shi | 0355e9f | 2015-09-02 07:24:53 -0700 | [diff] [blame] | 88 | /** \brief start incoming Data processing |
Alexander Afanasyev | b755e9d | 2015-10-20 17:35:51 -0500 | [diff] [blame^] | 89 | * \param face face on which Data is received |
Junxiao Shi | 0355e9f | 2015-09-02 07:24:53 -0700 | [diff] [blame] | 90 | * \param data the incoming Data, must be created with make_shared |
| 91 | */ |
Alexander Afanasyev | 33b7277 | 2014-01-26 23:22:58 -0800 | [diff] [blame] | 92 | void |
Junxiao Shi | 0355e9f | 2015-09-02 07:24:53 -0700 | [diff] [blame] | 93 | startProcessData(Face& face, const Data& data); |
Junxiao Shi | c041ca3 | 2014-02-25 20:01:15 -0700 | [diff] [blame] | 94 | |
Junxiao Shi | 5e5e445 | 2015-09-24 16:56:52 -0700 | [diff] [blame] | 95 | /** \brief start incoming Nack processing |
Alexander Afanasyev | b755e9d | 2015-10-20 17:35:51 -0500 | [diff] [blame^] | 96 | * \param face face on which Nack is received |
Junxiao Shi | 5e5e445 | 2015-09-24 16:56:52 -0700 | [diff] [blame] | 97 | * \param nack the incoming Nack, must be created with make_shared |
| 98 | */ |
| 99 | void |
| 100 | startProcessNack(Face& face, const lp::Nack& nack); |
| 101 | |
Junxiao Shi | ea48d8b | 2014-03-16 13:53:47 -0700 | [diff] [blame] | 102 | NameTree& |
| 103 | getNameTree(); |
| 104 | |
Junxiao Shi | 8c8d218 | 2014-01-30 22:33:00 -0700 | [diff] [blame] | 105 | Fib& |
| 106 | getFib(); |
Junxiao Shi | c041ca3 | 2014-02-25 20:01:15 -0700 | [diff] [blame] | 107 | |
Junxiao Shi | 8c8d218 | 2014-01-30 22:33:00 -0700 | [diff] [blame] | 108 | Pit& |
| 109 | getPit(); |
Junxiao Shi | c041ca3 | 2014-02-25 20:01:15 -0700 | [diff] [blame] | 110 | |
Junxiao Shi | 8c8d218 | 2014-01-30 22:33:00 -0700 | [diff] [blame] | 111 | Cs& |
| 112 | getCs(); |
Junxiao Shi | c041ca3 | 2014-02-25 20:01:15 -0700 | [diff] [blame] | 113 | |
Junxiao Shi | dbe7173 | 2014-02-21 22:23:28 -0700 | [diff] [blame] | 114 | Measurements& |
| 115 | getMeasurements(); |
Junxiao Shi | 8c8d218 | 2014-01-30 22:33:00 -0700 | [diff] [blame] | 116 | |
Junxiao Shi | bb5105f | 2014-03-03 12:06:45 -0700 | [diff] [blame] | 117 | StrategyChoice& |
| 118 | getStrategyChoice(); |
| 119 | |
Junxiao Shi | a110f26 | 2014-10-12 12:35:20 -0700 | [diff] [blame] | 120 | DeadNonceList& |
| 121 | getDeadNonceList(); |
| 122 | |
Junxiao Shi | 0355e9f | 2015-09-02 07:24:53 -0700 | [diff] [blame] | 123 | NetworkRegionTable& |
| 124 | getNetworkRegionTable(); |
| 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 | |
Junxiao Shi | 0355e9f | 2015-09-02 07:24:53 -0700 | [diff] [blame] | 132 | /** \brief Interest loop pipeline |
| 133 | */ |
| 134 | VIRTUAL_WITH_TESTS void |
| 135 | onInterestLoop(Face& inFace, const Interest& interest, |
| 136 | shared_ptr<pit::Entry> pitEntry); |
| 137 | |
mzhang4 | eab7249 | 2015-02-25 11:16:09 -0600 | [diff] [blame] | 138 | /** \brief Content Store miss pipeline |
| 139 | */ |
Junxiao Shi | 5e5e445 | 2015-09-24 16:56:52 -0700 | [diff] [blame] | 140 | VIRTUAL_WITH_TESTS void |
mzhang4 | eab7249 | 2015-02-25 11:16:09 -0600 | [diff] [blame] | 141 | onContentStoreMiss(const Face& inFace, shared_ptr<pit::Entry> pitEntry, const Interest& interest); |
| 142 | |
| 143 | /** \brief Content Store hit pipeline |
| 144 | */ |
Junxiao Shi | 5e5e445 | 2015-09-24 16:56:52 -0700 | [diff] [blame] | 145 | VIRTUAL_WITH_TESTS void |
mzhang4 | eab7249 | 2015-02-25 11:16:09 -0600 | [diff] [blame] | 146 | onContentStoreHit(const Face& inFace, shared_ptr<pit::Entry> pitEntry, |
| 147 | const Interest& interest, const Data& data); |
| 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 | 5e5e445 | 2015-09-24 16:56:52 -0700 | [diff] [blame] | 188 | /** \brief incoming Nack pipeline |
| 189 | */ |
| 190 | VIRTUAL_WITH_TESTS void |
| 191 | onIncomingNack(Face& inFace, const lp::Nack& nack); |
| 192 | |
| 193 | /** \brief outgoing Nack pipeline |
| 194 | */ |
| 195 | VIRTUAL_WITH_TESTS void |
| 196 | onOutgoingNack(shared_ptr<pit::Entry> pitEntry, const Face& outFace, const lp::NackHeader& nack); |
| 197 | |
Junxiao Shi | 8888449 | 2014-02-15 15:57:43 -0700 | [diff] [blame] | 198 | PROTECTED_WITH_TESTS_ELSE_PRIVATE: |
| 199 | VIRTUAL_WITH_TESTS void |
Junxiao Shi | d3c792f | 2014-01-30 00:46:13 -0700 | [diff] [blame] | 200 | setUnsatisfyTimer(shared_ptr<pit::Entry> pitEntry); |
Junxiao Shi | c041ca3 | 2014-02-25 20:01:15 -0700 | [diff] [blame] | 201 | |
Junxiao Shi | 8888449 | 2014-02-15 15:57:43 -0700 | [diff] [blame] | 202 | VIRTUAL_WITH_TESTS void |
Junxiao Shi | a110f26 | 2014-10-12 12:35:20 -0700 | [diff] [blame] | 203 | setStragglerTimer(shared_ptr<pit::Entry> pitEntry, bool isSatisfied, |
| 204 | const time::milliseconds& dataFreshnessPeriod = time::milliseconds(-1)); |
Junxiao Shi | c041ca3 | 2014-02-25 20:01:15 -0700 | [diff] [blame] | 205 | |
Junxiao Shi | 8888449 | 2014-02-15 15:57:43 -0700 | [diff] [blame] | 206 | VIRTUAL_WITH_TESTS void |
Junxiao Shi | d3c792f | 2014-01-30 00:46:13 -0700 | [diff] [blame] | 207 | cancelUnsatisfyAndStragglerTimer(shared_ptr<pit::Entry> pitEntry); |
Junxiao Shi | c041ca3 | 2014-02-25 20:01:15 -0700 | [diff] [blame] | 208 | |
Junxiao Shi | a110f26 | 2014-10-12 12:35:20 -0700 | [diff] [blame] | 209 | /** \brief insert Nonce to Dead Nonce List if necessary |
| 210 | * \param upstream if null, insert Nonces from all OutRecords; |
| 211 | * if not null, insert Nonce only on the OutRecord of this face |
| 212 | */ |
| 213 | VIRTUAL_WITH_TESTS void |
| 214 | insertDeadNonceList(pit::Entry& pitEntry, bool isSatisfied, |
| 215 | const time::milliseconds& dataFreshnessPeriod, |
| 216 | Face* upstream); |
| 217 | |
Junxiao Shi | f3c0781 | 2014-03-11 21:48:49 -0700 | [diff] [blame] | 218 | /// call trigger (method) on the effective strategy of pitEntry |
| 219 | #ifdef WITH_TESTS |
| 220 | virtual void |
| 221 | dispatchToStrategy(shared_ptr<pit::Entry> pitEntry, function<void(fw::Strategy*)> trigger); |
| 222 | #else |
| 223 | template<class Function> |
| 224 | void |
| 225 | dispatchToStrategy(shared_ptr<pit::Entry> pitEntry, Function trigger); |
| 226 | #endif |
Junxiao Shi | d3c792f | 2014-01-30 00:46:13 -0700 | [diff] [blame] | 227 | |
| 228 | private: |
Junxiao Shi | b289cc1 | 2014-03-15 12:19:05 -0700 | [diff] [blame] | 229 | ForwarderCounters m_counters; |
| 230 | |
Junxiao Shi | a4f2be8 | 2014-03-02 22:56:41 -0700 | [diff] [blame] | 231 | FaceTable m_faceTable; |
HangZhang | ad4afd1 | 2014-03-01 11:03:08 +0800 | [diff] [blame] | 232 | |
Junxiao Shi | bb5105f | 2014-03-03 12:06:45 -0700 | [diff] [blame] | 233 | // tables |
Junxiao Shi | 0355e9f | 2015-09-02 07:24:53 -0700 | [diff] [blame] | 234 | NameTree m_nameTree; |
| 235 | Fib m_fib; |
| 236 | Pit m_pit; |
| 237 | Cs m_cs; |
| 238 | Measurements m_measurements; |
| 239 | StrategyChoice m_strategyChoice; |
| 240 | DeadNonceList m_deadNonceList; |
| 241 | NetworkRegionTable m_networkRegionTable; |
Junxiao Shi | bb5105f | 2014-03-03 12:06:45 -0700 | [diff] [blame] | 242 | |
Junxiao Shi | f3c0781 | 2014-03-11 21:48:49 -0700 | [diff] [blame] | 243 | static const Name LOCALHOST_NAME; |
Junxiao Shi | c041ca3 | 2014-02-25 20:01:15 -0700 | [diff] [blame] | 244 | |
Junxiao Shi | d3c792f | 2014-01-30 00:46:13 -0700 | [diff] [blame] | 245 | // allow Strategy (base class) to enter pipelines |
Junxiao Shi | 8c8d218 | 2014-01-30 22:33:00 -0700 | [diff] [blame] | 246 | friend class fw::Strategy; |
Alexander Afanasyev | 33b7277 | 2014-01-26 23:22:58 -0800 | [diff] [blame] | 247 | }; |
| 248 | |
Junxiao Shi | b289cc1 | 2014-03-15 12:19:05 -0700 | [diff] [blame] | 249 | inline const ForwarderCounters& |
| 250 | Forwarder::getCounters() const |
| 251 | { |
| 252 | return m_counters; |
| 253 | } |
| 254 | |
Junxiao Shi | a4f2be8 | 2014-03-02 22:56:41 -0700 | [diff] [blame] | 255 | inline FaceTable& |
| 256 | Forwarder::getFaceTable() |
| 257 | { |
| 258 | return m_faceTable; |
| 259 | } |
| 260 | |
| 261 | inline shared_ptr<Face> |
| 262 | Forwarder::getFace(FaceId id) const |
| 263 | { |
| 264 | return m_faceTable.get(id); |
| 265 | } |
| 266 | |
| 267 | inline void |
| 268 | Forwarder::addFace(shared_ptr<Face> face) |
| 269 | { |
| 270 | m_faceTable.add(face); |
| 271 | } |
| 272 | |
Junxiao Shi | ea48d8b | 2014-03-16 13:53:47 -0700 | [diff] [blame] | 273 | inline NameTree& |
| 274 | Forwarder::getNameTree() |
| 275 | { |
| 276 | return m_nameTree; |
| 277 | } |
| 278 | |
Junxiao Shi | 8c8d218 | 2014-01-30 22:33:00 -0700 | [diff] [blame] | 279 | inline Fib& |
| 280 | Forwarder::getFib() |
| 281 | { |
| 282 | return m_fib; |
| 283 | } |
| 284 | |
| 285 | inline Pit& |
| 286 | Forwarder::getPit() |
| 287 | { |
| 288 | return m_pit; |
| 289 | } |
| 290 | |
| 291 | inline Cs& |
| 292 | Forwarder::getCs() |
| 293 | { |
| 294 | return m_cs; |
| 295 | } |
| 296 | |
Junxiao Shi | dbe7173 | 2014-02-21 22:23:28 -0700 | [diff] [blame] | 297 | inline Measurements& |
| 298 | Forwarder::getMeasurements() |
| 299 | { |
| 300 | return m_measurements; |
| 301 | } |
| 302 | |
Junxiao Shi | bb5105f | 2014-03-03 12:06:45 -0700 | [diff] [blame] | 303 | inline StrategyChoice& |
| 304 | Forwarder::getStrategyChoice() |
| 305 | { |
| 306 | return m_strategyChoice; |
| 307 | } |
Junxiao Shi | a4f2be8 | 2014-03-02 22:56:41 -0700 | [diff] [blame] | 308 | |
Junxiao Shi | a110f26 | 2014-10-12 12:35:20 -0700 | [diff] [blame] | 309 | inline DeadNonceList& |
| 310 | Forwarder::getDeadNonceList() |
| 311 | { |
| 312 | return m_deadNonceList; |
| 313 | } |
| 314 | |
Junxiao Shi | 0355e9f | 2015-09-02 07:24:53 -0700 | [diff] [blame] | 315 | inline NetworkRegionTable& |
| 316 | Forwarder::getNetworkRegionTable() |
| 317 | { |
| 318 | return m_networkRegionTable; |
| 319 | } |
| 320 | |
Junxiao Shi | f3c0781 | 2014-03-11 21:48:49 -0700 | [diff] [blame] | 321 | #ifdef WITH_TESTS |
| 322 | inline void |
| 323 | Forwarder::dispatchToStrategy(shared_ptr<pit::Entry> pitEntry, function<void(fw::Strategy*)> trigger) |
| 324 | #else |
| 325 | template<class Function> |
| 326 | inline void |
| 327 | Forwarder::dispatchToStrategy(shared_ptr<pit::Entry> pitEntry, Function trigger) |
| 328 | #endif |
| 329 | { |
| 330 | fw::Strategy& strategy = m_strategyChoice.findEffectiveStrategy(*pitEntry); |
| 331 | trigger(&strategy); |
| 332 | } |
| 333 | |
Junxiao Shi | d3c792f | 2014-01-30 00:46:13 -0700 | [diff] [blame] | 334 | } // namespace nfd |
Alexander Afanasyev | 33b7277 | 2014-01-26 23:22:58 -0800 | [diff] [blame] | 335 | |
Alexander Afanasyev | 613e2a9 | 2014-04-15 13:36:58 -0700 | [diff] [blame] | 336 | #endif // NFD_DAEMON_FW_FORWARDER_HPP |