Junxiao Shi | d3c792f | 2014-01-30 00:46:13 -0700 | [diff] [blame] | 1 | /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ |
| 2 | /** |
Junxiao Shi | 8d84314 | 2016-07-11 22:42:42 +0000 | [diff] [blame] | 3 | * Copyright (c) 2014-2016, Regents of the University of California, |
Junxiao Shi | faf3eb0 | 2015-02-16 10:50:36 -0700 | [diff] [blame] | 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 | 82e7f58 | 2014-09-07 15:15:40 -0700 | [diff] [blame] | 24 | */ |
Junxiao Shi | d3c792f | 2014-01-30 00:46:13 -0700 | [diff] [blame] | 25 | |
Alexander Afanasyev | 613e2a9 | 2014-04-15 13:36:58 -0700 | [diff] [blame] | 26 | #ifndef NFD_DAEMON_FW_STRATEGY_HPP |
| 27 | #define NFD_DAEMON_FW_STRATEGY_HPP |
Junxiao Shi | d3c792f | 2014-01-30 00:46:13 -0700 | [diff] [blame] | 28 | |
Junxiao Shi | 2d9bdc8 | 2014-03-02 20:55:42 -0700 | [diff] [blame] | 29 | #include "forwarder.hpp" |
Junxiao Shi | dbe7173 | 2014-02-21 22:23:28 -0700 | [diff] [blame] | 30 | #include "table/measurements-accessor.hpp" |
Junxiao Shi | d3c792f | 2014-01-30 00:46:13 -0700 | [diff] [blame] | 31 | |
| 32 | namespace nfd { |
Junxiao Shi | 8c8d218 | 2014-01-30 22:33:00 -0700 | [diff] [blame] | 33 | namespace fw { |
| 34 | |
Junxiao Shi | bb5105f | 2014-03-03 12:06:45 -0700 | [diff] [blame] | 35 | /** \brief represents a forwarding strategy |
Junxiao Shi | d3c792f | 2014-01-30 00:46:13 -0700 | [diff] [blame] | 36 | */ |
Junxiao Shi | c34d167 | 2016-12-09 15:57:59 +0000 | [diff] [blame] | 37 | class Strategy : noncopyable |
Junxiao Shi | d3c792f | 2014-01-30 00:46:13 -0700 | [diff] [blame] | 38 | { |
Junxiao Shi | c34d167 | 2016-12-09 15:57:59 +0000 | [diff] [blame] | 39 | public: // registry |
| 40 | /** \brief register a strategy type |
| 41 | * \tparam S subclass of Strategy |
| 42 | * \param strategyName versioned strategy name |
| 43 | * \note It is permitted to register the same strategy type under multiple names, |
| 44 | * which is useful in tests and for creating aliases. |
| 45 | */ |
| 46 | template<typename S> |
| 47 | static void |
Junxiao Shi | 037f4ab | 2016-12-13 04:27:06 +0000 | [diff] [blame^] | 48 | registerType(const Name& strategyName = S::getStrategyName()) |
Junxiao Shi | c34d167 | 2016-12-09 15:57:59 +0000 | [diff] [blame] | 49 | { |
| 50 | Registry& registry = getRegistry(); |
| 51 | BOOST_ASSERT(registry.count(strategyName) == 0); |
| 52 | registry[strategyName] = &make_unique<S, Forwarder&, const Name&>; |
| 53 | } |
| 54 | |
| 55 | /** \return whether a strategy instance can be created from \p strategyName |
| 56 | * \param strategyName strategy name, may contain version |
| 57 | * \todo #3868 may contain parameters |
| 58 | * \note This function finds a strategy type using same rules as \p create , |
| 59 | * but does not attempt to construct an instance. |
| 60 | */ |
| 61 | static bool |
| 62 | canCreate(const Name& strategyName); |
| 63 | |
| 64 | /** \return a strategy instance created from \p strategyName, |
| 65 | * \retval nullptr if !canCreate(strategyName) |
| 66 | * \todo #3868 throw std::invalid_argument strategy type constructor |
| 67 | * does not accept specified version or parameters |
| 68 | */ |
| 69 | static unique_ptr<Strategy> |
| 70 | create(const Name& strategyName, Forwarder& forwarder); |
| 71 | |
| 72 | /** \return registered versioned strategy names |
| 73 | */ |
| 74 | static std::set<Name> |
| 75 | listRegistered(); |
| 76 | |
| 77 | public: // constructor, destructor, strategy name |
Junxiao Shi | e93d6a3 | 2014-09-07 16:13:22 -0700 | [diff] [blame] | 78 | /** \brief construct a strategy instance |
| 79 | * \param forwarder a reference to the Forwarder, used to enable actions and accessors. |
| 80 | * Strategy subclasses should pass this reference, |
| 81 | * and should not keep a reference themselves. |
| 82 | * \param name the strategy Name. |
| 83 | * It's recommended to include a version number as the last component. |
Junxiao Shi | 037f4ab | 2016-12-13 04:27:06 +0000 | [diff] [blame^] | 84 | * \todo #3868 name contains version and parameters as instantiated. |
Junxiao Shi | e93d6a3 | 2014-09-07 16:13:22 -0700 | [diff] [blame] | 85 | */ |
Junxiao Shi | bb5105f | 2014-03-03 12:06:45 -0700 | [diff] [blame] | 86 | Strategy(Forwarder& forwarder, const Name& name); |
Junxiao Shi | dbe7173 | 2014-02-21 22:23:28 -0700 | [diff] [blame] | 87 | |
Junxiao Shi | d3c792f | 2014-01-30 00:46:13 -0700 | [diff] [blame] | 88 | virtual |
| 89 | ~Strategy(); |
Junxiao Shi | dbe7173 | 2014-02-21 22:23:28 -0700 | [diff] [blame] | 90 | |
Junxiao Shi | 037f4ab | 2016-12-13 04:27:06 +0000 | [diff] [blame^] | 91 | #ifdef DOXYGEN |
| 92 | /** \return a name that represents the strategy program |
| 93 | * \todo #3868 This name contains version as given in code, |
| 94 | * which may differ from instantiated version. |
| 95 | */ |
| 96 | static const Name& |
| 97 | getStrategyName(); |
| 98 | #endif |
| 99 | |
| 100 | /** \return a name that represents the strategy program |
| 101 | * \todo #3868 This name contains version and parameters as instantiated. |
Junxiao Shi | b9420cf | 2016-08-13 04:38:52 +0000 | [diff] [blame] | 102 | */ |
Junxiao Shi | bb5105f | 2014-03-03 12:06:45 -0700 | [diff] [blame] | 103 | const Name& |
Junxiao Shi | b9420cf | 2016-08-13 04:38:52 +0000 | [diff] [blame] | 104 | getName() const |
| 105 | { |
| 106 | return m_name; |
| 107 | } |
Junxiao Shi | bb5105f | 2014-03-03 12:06:45 -0700 | [diff] [blame] | 108 | |
Junxiao Shi | 679e927 | 2014-02-15 20:10:21 -0700 | [diff] [blame] | 109 | public: // triggers |
| 110 | /** \brief trigger after Interest is received |
| 111 | * |
| 112 | * The Interest: |
| 113 | * - does not violate Scope |
| 114 | * - is not looped |
| 115 | * - cannot be satisfied by ContentStore |
| 116 | * - is under a namespace managed by this strategy |
| 117 | * |
| 118 | * The strategy should decide whether and where to forward this Interest. |
| 119 | * - If the strategy decides to forward this Interest, |
| 120 | * invoke this->sendInterest one or more times, either now or shortly after |
| 121 | * - If strategy concludes that this Interest cannot be forwarded, |
Junxiao Shi | 09498f0 | 2014-02-26 19:41:08 -0700 | [diff] [blame] | 122 | * invoke this->rejectPendingInterest so that PIT entry will be deleted shortly |
Junxiao Shi | 82e7f58 | 2014-09-07 15:15:40 -0700 | [diff] [blame] | 123 | * |
Junxiao Shi | 15e98b0 | 2016-08-12 11:21:44 +0000 | [diff] [blame] | 124 | * \warning The strategy must not retain shared_ptr<pit::Entry>, otherwise undefined behavior |
| 125 | * may occur. However, the strategy is allowed to store weak_ptr<pit::Entry>. |
Junxiao Shi | 679e927 | 2014-02-15 20:10:21 -0700 | [diff] [blame] | 126 | */ |
Junxiao Shi | d3c792f | 2014-01-30 00:46:13 -0700 | [diff] [blame] | 127 | virtual void |
Junxiao Shi | 8d84314 | 2016-07-11 22:42:42 +0000 | [diff] [blame] | 128 | afterReceiveInterest(const Face& inFace, const Interest& interest, |
Junxiao Shi | 15e98b0 | 2016-08-12 11:21:44 +0000 | [diff] [blame] | 129 | const shared_ptr<pit::Entry>& pitEntry) = 0; |
Junxiao Shi | dbe7173 | 2014-02-21 22:23:28 -0700 | [diff] [blame] | 130 | |
Junxiao Shi | 22be22c | 2014-02-16 22:53:48 -0700 | [diff] [blame] | 131 | /** \brief trigger before PIT entry is satisfied |
| 132 | * |
Junxiao Shi | 82e7f58 | 2014-09-07 15:15:40 -0700 | [diff] [blame] | 133 | * This trigger is invoked when an incoming Data satisfies the PIT entry. |
| 134 | * It can be invoked even if the PIT entry has already been satisfied. |
| 135 | * |
Junxiao Shi | 22be22c | 2014-02-16 22:53:48 -0700 | [diff] [blame] | 136 | * In this base class this method does nothing. |
Junxiao Shi | 82e7f58 | 2014-09-07 15:15:40 -0700 | [diff] [blame] | 137 | * |
Junxiao Shi | 15e98b0 | 2016-08-12 11:21:44 +0000 | [diff] [blame] | 138 | * \warning The strategy must not retain shared_ptr<pit::Entry>, otherwise undefined behavior |
| 139 | * may occur. However, the strategy is allowed to store weak_ptr<pit::Entry>. |
Junxiao Shi | 22be22c | 2014-02-16 22:53:48 -0700 | [diff] [blame] | 140 | */ |
| 141 | virtual void |
Junxiao Shi | 15e98b0 | 2016-08-12 11:21:44 +0000 | [diff] [blame] | 142 | beforeSatisfyInterest(const shared_ptr<pit::Entry>& pitEntry, |
Junxiao Shi | 82e7f58 | 2014-09-07 15:15:40 -0700 | [diff] [blame] | 143 | const Face& inFace, const Data& data); |
Junxiao Shi | dbe7173 | 2014-02-21 22:23:28 -0700 | [diff] [blame] | 144 | |
Junxiao Shi | 679e927 | 2014-02-15 20:10:21 -0700 | [diff] [blame] | 145 | /** \brief trigger before PIT entry expires |
| 146 | * |
| 147 | * PIT entry expires when InterestLifetime has elapsed for all InRecords, |
| 148 | * and it is not satisfied by an incoming Data. |
| 149 | * |
| 150 | * This trigger is not invoked for PIT entry already satisfied. |
| 151 | * |
| 152 | * In this base class this method does nothing. |
Junxiao Shi | 82e7f58 | 2014-09-07 15:15:40 -0700 | [diff] [blame] | 153 | * |
Junxiao Shi | 15e98b0 | 2016-08-12 11:21:44 +0000 | [diff] [blame] | 154 | * \warning The strategy must not retain shared_ptr<pit::Entry>, otherwise undefined behavior |
| 155 | * may occur. However, the strategy is allowed to store weak_ptr<pit::Entry>, |
| 156 | * although this isn't useful here because PIT entry would be deleted shortly after. |
Junxiao Shi | 679e927 | 2014-02-15 20:10:21 -0700 | [diff] [blame] | 157 | */ |
| 158 | virtual void |
Junxiao Shi | 15e98b0 | 2016-08-12 11:21:44 +0000 | [diff] [blame] | 159 | beforeExpirePendingInterest(const shared_ptr<pit::Entry>& pitEntry); |
Junxiao Shi | dbe7173 | 2014-02-21 22:23:28 -0700 | [diff] [blame] | 160 | |
Junxiao Shi | 5e5e445 | 2015-09-24 16:56:52 -0700 | [diff] [blame] | 161 | /** \brief trigger after Nack is received |
| 162 | * |
| 163 | * This trigger is invoked when an incoming Nack is received in response to |
| 164 | * an forwarded Interest. |
| 165 | * The Nack has been confirmed to be a response to the last Interest forwarded |
| 166 | * to that upstream, i.e. the PIT out-record exists and has a matching Nonce. |
| 167 | * The NackHeader has been recorded in the PIT out-record. |
| 168 | * |
| 169 | * In this base class this method does nothing. |
| 170 | * |
Junxiao Shi | 15e98b0 | 2016-08-12 11:21:44 +0000 | [diff] [blame] | 171 | * \warning The strategy must not retain shared_ptr<pit::Entry>, otherwise undefined behavior |
| 172 | * may occur. However, the strategy is allowed to store weak_ptr<pit::Entry>. |
Junxiao Shi | 5e5e445 | 2015-09-24 16:56:52 -0700 | [diff] [blame] | 173 | */ |
| 174 | virtual void |
| 175 | afterReceiveNack(const Face& inFace, const lp::Nack& nack, |
Junxiao Shi | 15e98b0 | 2016-08-12 11:21:44 +0000 | [diff] [blame] | 176 | const shared_ptr<pit::Entry>& pitEntry); |
Junxiao Shi | 5e5e445 | 2015-09-24 16:56:52 -0700 | [diff] [blame] | 177 | |
Junxiao Shi | d3c792f | 2014-01-30 00:46:13 -0700 | [diff] [blame] | 178 | protected: // actions |
Junxiao Shi | 5e5e445 | 2015-09-24 16:56:52 -0700 | [diff] [blame] | 179 | /** \brief send Interest to outFace |
Alexander Afanasyev | b755e9d | 2015-10-20 17:35:51 -0500 | [diff] [blame] | 180 | * \param pitEntry PIT entry |
| 181 | * \param outFace face through which to send out the Interest |
Junxiao Shi | c5f651f | 2016-11-17 22:58:12 +0000 | [diff] [blame] | 182 | * \param interest the Interest packet |
Junxiao Shi | 5e5e445 | 2015-09-24 16:56:52 -0700 | [diff] [blame] | 183 | */ |
Junxiao Shi | 727ed29 | 2014-02-19 23:26:45 -0700 | [diff] [blame] | 184 | VIRTUAL_WITH_TESTS void |
Junxiao Shi | b9420cf | 2016-08-13 04:38:52 +0000 | [diff] [blame] | 185 | sendInterest(const shared_ptr<pit::Entry>& pitEntry, Face& outFace, |
Junxiao Shi | c5f651f | 2016-11-17 22:58:12 +0000 | [diff] [blame] | 186 | const Interest& interest) |
Junxiao Shi | b9420cf | 2016-08-13 04:38:52 +0000 | [diff] [blame] | 187 | { |
Junxiao Shi | c5f651f | 2016-11-17 22:58:12 +0000 | [diff] [blame] | 188 | m_forwarder.onOutgoingInterest(pitEntry, outFace, interest); |
Junxiao Shi | b9420cf | 2016-08-13 04:38:52 +0000 | [diff] [blame] | 189 | } |
Junxiao Shi | dbe7173 | 2014-02-21 22:23:28 -0700 | [diff] [blame] | 190 | |
Junxiao Shi | d3c792f | 2014-01-30 00:46:13 -0700 | [diff] [blame] | 191 | /** \brief decide that a pending Interest cannot be forwarded |
Alexander Afanasyev | b755e9d | 2015-10-20 17:35:51 -0500 | [diff] [blame] | 192 | * \param pitEntry PIT entry |
Junxiao Shi | 679e927 | 2014-02-15 20:10:21 -0700 | [diff] [blame] | 193 | * |
Junxiao Shi | d3c792f | 2014-01-30 00:46:13 -0700 | [diff] [blame] | 194 | * This shall not be called if the pending Interest has been |
| 195 | * forwarded earlier, and does not need to be resent now. |
| 196 | */ |
Junxiao Shi | 727ed29 | 2014-02-19 23:26:45 -0700 | [diff] [blame] | 197 | VIRTUAL_WITH_TESTS void |
Junxiao Shi | b9420cf | 2016-08-13 04:38:52 +0000 | [diff] [blame] | 198 | rejectPendingInterest(const shared_ptr<pit::Entry>& pitEntry) |
| 199 | { |
| 200 | m_forwarder.onInterestReject(pitEntry); |
| 201 | } |
Junxiao Shi | dbe7173 | 2014-02-21 22:23:28 -0700 | [diff] [blame] | 202 | |
Junxiao Shi | 5e5e445 | 2015-09-24 16:56:52 -0700 | [diff] [blame] | 203 | /** \brief send Nack to outFace |
Alexander Afanasyev | b755e9d | 2015-10-20 17:35:51 -0500 | [diff] [blame] | 204 | * \param pitEntry PIT entry |
| 205 | * \param outFace face through which to send out the Nack |
| 206 | * \param header Nack header |
Junxiao Shi | 5e5e445 | 2015-09-24 16:56:52 -0700 | [diff] [blame] | 207 | * |
| 208 | * The outFace must have a PIT in-record, otherwise this method has no effect. |
| 209 | */ |
| 210 | VIRTUAL_WITH_TESTS void |
Junxiao Shi | b9420cf | 2016-08-13 04:38:52 +0000 | [diff] [blame] | 211 | sendNack(const shared_ptr<pit::Entry>& pitEntry, const Face& outFace, |
| 212 | const lp::NackHeader& header) |
| 213 | { |
| 214 | m_forwarder.onOutgoingNack(pitEntry, outFace, header); |
| 215 | } |
Junxiao Shi | 5e5e445 | 2015-09-24 16:56:52 -0700 | [diff] [blame] | 216 | |
| 217 | /** \brief send Nack to every face that has an in-record, |
| 218 | * except those in \p exceptFaces |
Alexander Afanasyev | b755e9d | 2015-10-20 17:35:51 -0500 | [diff] [blame] | 219 | * \param pitEntry PIT entry |
| 220 | * \param header NACK header |
| 221 | * \param exceptFaces list of faces that should be excluded from sending Nacks |
Junxiao Shi | 5e5e445 | 2015-09-24 16:56:52 -0700 | [diff] [blame] | 222 | * \note This is not an action, but a helper that invokes the sendNack action. |
| 223 | */ |
| 224 | void |
Junxiao Shi | b9420cf | 2016-08-13 04:38:52 +0000 | [diff] [blame] | 225 | sendNacks(const shared_ptr<pit::Entry>& pitEntry, const lp::NackHeader& header, |
Junxiao Shi | 5e5e445 | 2015-09-24 16:56:52 -0700 | [diff] [blame] | 226 | std::initializer_list<const Face*> exceptFaces = std::initializer_list<const Face*>()); |
| 227 | |
Junxiao Shi | dbe7173 | 2014-02-21 22:23:28 -0700 | [diff] [blame] | 228 | protected: // accessors |
Junxiao Shi | cf0f3ce | 2016-09-02 13:01:59 +0000 | [diff] [blame] | 229 | /** \brief performs a FIB lookup, considering Link object if present |
| 230 | */ |
Junxiao Shi | 8d84314 | 2016-07-11 22:42:42 +0000 | [diff] [blame] | 231 | const fib::Entry& |
Junxiao Shi | cf0f3ce | 2016-09-02 13:01:59 +0000 | [diff] [blame] | 232 | lookupFib(const pit::Entry& pitEntry) const; |
Junxiao Shi | 8d84314 | 2016-07-11 22:42:42 +0000 | [diff] [blame] | 233 | |
Junxiao Shi | dbe7173 | 2014-02-21 22:23:28 -0700 | [diff] [blame] | 234 | MeasurementsAccessor& |
Junxiao Shi | b9420cf | 2016-08-13 04:38:52 +0000 | [diff] [blame] | 235 | getMeasurements() |
| 236 | { |
| 237 | return m_measurements; |
| 238 | } |
Junxiao Shi | dbe7173 | 2014-02-21 22:23:28 -0700 | [diff] [blame] | 239 | |
Junxiao Shi | 5b43f9a | 2016-07-19 13:15:56 +0000 | [diff] [blame] | 240 | Face* |
Junxiao Shi | b9420cf | 2016-08-13 04:38:52 +0000 | [diff] [blame] | 241 | getFace(FaceId id) const |
| 242 | { |
| 243 | return m_forwarder.getFace(id); |
| 244 | } |
Junxiao Shi | 2d9bdc8 | 2014-03-02 20:55:42 -0700 | [diff] [blame] | 245 | |
Junxiao Shi | 49e11e7 | 2014-12-14 19:46:05 -0700 | [diff] [blame] | 246 | const FaceTable& |
Junxiao Shi | b9420cf | 2016-08-13 04:38:52 +0000 | [diff] [blame] | 247 | getFaceTable() const |
| 248 | { |
| 249 | return m_forwarder.getFaceTable(); |
| 250 | } |
Junxiao Shi | 49e11e7 | 2014-12-14 19:46:05 -0700 | [diff] [blame] | 251 | |
| 252 | protected: // accessors |
Junxiao Shi | ae04d34 | 2016-07-19 13:20:22 +0000 | [diff] [blame] | 253 | signal::Signal<FaceTable, Face&>& afterAddFace; |
| 254 | signal::Signal<FaceTable, Face&>& beforeRemoveFace; |
Junxiao Shi | 49e11e7 | 2014-12-14 19:46:05 -0700 | [diff] [blame] | 255 | |
Junxiao Shi | c34d167 | 2016-12-09 15:57:59 +0000 | [diff] [blame] | 256 | private: // registry |
| 257 | typedef std::function<unique_ptr<Strategy>(Forwarder& forwarder, const Name& strategyName)> CreateFunc; |
| 258 | typedef std::map<Name, CreateFunc> Registry; // indexed by strategy name |
| 259 | |
| 260 | static Registry& |
| 261 | getRegistry(); |
| 262 | |
| 263 | static Registry::const_iterator |
| 264 | find(const Name& strategyName); |
| 265 | |
| 266 | private: // instance fields |
Junxiao Shi | bb5105f | 2014-03-03 12:06:45 -0700 | [diff] [blame] | 267 | Name m_name; |
| 268 | |
Junxiao Shi | 679e927 | 2014-02-15 20:10:21 -0700 | [diff] [blame] | 269 | /** \brief reference to the forwarder |
| 270 | * |
| 271 | * Triggers can access forwarder indirectly via actions. |
| 272 | */ |
Junxiao Shi | 8c8d218 | 2014-01-30 22:33:00 -0700 | [diff] [blame] | 273 | Forwarder& m_forwarder; |
Junxiao Shi | dbe7173 | 2014-02-21 22:23:28 -0700 | [diff] [blame] | 274 | |
| 275 | MeasurementsAccessor m_measurements; |
Junxiao Shi | d3c792f | 2014-01-30 00:46:13 -0700 | [diff] [blame] | 276 | }; |
| 277 | |
Junxiao Shi | 8c8d218 | 2014-01-30 22:33:00 -0700 | [diff] [blame] | 278 | } // namespace fw |
Junxiao Shi | d3c792f | 2014-01-30 00:46:13 -0700 | [diff] [blame] | 279 | } // namespace nfd |
| 280 | |
Junxiao Shi | c34d167 | 2016-12-09 15:57:59 +0000 | [diff] [blame] | 281 | /** \brief registers a strategy |
| 282 | * |
| 283 | * This macro should appear once in .cpp of each strategy. |
| 284 | */ |
| 285 | #define NFD_REGISTER_STRATEGY(S) \ |
| 286 | static class NfdAuto ## S ## StrategyRegistrationClass \ |
| 287 | { \ |
| 288 | public: \ |
| 289 | NfdAuto ## S ## StrategyRegistrationClass() \ |
| 290 | { \ |
| 291 | ::nfd::fw::Strategy::registerType<S>(); \ |
| 292 | } \ |
| 293 | } g_nfdAuto ## S ## StrategyRegistrationVariable |
| 294 | |
Alexander Afanasyev | 613e2a9 | 2014-04-15 13:36:58 -0700 | [diff] [blame] | 295 | #endif // NFD_DAEMON_FW_STRATEGY_HPP |