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