Junxiao Shi | 986b849 | 2014-08-20 12:07:14 -0700 | [diff] [blame] | 1 | /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ |
| 2 | /** |
Junxiao Shi | 192af1f | 2015-01-13 23:19:39 -0700 | [diff] [blame^] | 3 | * Copyright (c) 2014-2015, 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. |
Junxiao Shi | 986b849 | 2014-08-20 12:07:14 -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/>. |
| 24 | */ |
| 25 | |
| 26 | #ifndef NFD_DAEMON_FW_BEST_ROUTE_STRATEGY2_HPP |
| 27 | #define NFD_DAEMON_FW_BEST_ROUTE_STRATEGY2_HPP |
| 28 | |
| 29 | #include "strategy.hpp" |
Junxiao Shi | 192af1f | 2015-01-13 23:19:39 -0700 | [diff] [blame^] | 30 | #include "retransmission-suppression.hpp" |
Junxiao Shi | 986b849 | 2014-08-20 12:07:14 -0700 | [diff] [blame] | 31 | |
| 32 | namespace nfd { |
| 33 | namespace fw { |
| 34 | |
| 35 | /** \brief Best Route strategy version 2 |
| 36 | * |
| 37 | * This strategy forwards a new Interest to the lowest-cost nexthop (except downstream). |
| 38 | * After that, it recognizes consumer retransmission: |
| 39 | * if a similar Interest arrives from any downstream after MIN_RETRANSMISSION_INTERVAL, |
| 40 | * the strategy forwards the Interest again to the lowest-cost nexthop (except downstream) |
| 41 | * that is not previously used. If all nexthops have been used, the strategy starts over. |
| 42 | */ |
| 43 | class BestRouteStrategy2 : public Strategy |
| 44 | { |
| 45 | public: |
| 46 | BestRouteStrategy2(Forwarder& forwarder, const Name& name = STRATEGY_NAME); |
| 47 | |
| 48 | virtual void |
| 49 | afterReceiveInterest(const Face& inFace, |
| 50 | const Interest& interest, |
| 51 | shared_ptr<fib::Entry> fibEntry, |
Junxiao Shi | 1c93cae | 2014-12-09 22:52:17 -0700 | [diff] [blame] | 52 | shared_ptr<pit::Entry> pitEntry) DECL_OVERRIDE; |
Junxiao Shi | 986b849 | 2014-08-20 12:07:14 -0700 | [diff] [blame] | 53 | |
| 54 | public: |
| 55 | static const Name STRATEGY_NAME; |
Junxiao Shi | 192af1f | 2015-01-13 23:19:39 -0700 | [diff] [blame^] | 56 | |
| 57 | private: |
| 58 | RetransmissionSuppression m_retransmissionSuppression; |
Junxiao Shi | 986b849 | 2014-08-20 12:07:14 -0700 | [diff] [blame] | 59 | }; |
| 60 | |
| 61 | } // namespace fw |
| 62 | } // namespace nfd |
| 63 | |
| 64 | #endif // NFD_DAEMON_FW_BEST_ROUTE_STRATEGY2_HPP |