Junxiao Shi | d3c792f | 2014-01-30 00:46:13 -0700 | [diff] [blame] | 1 | /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ |
| 2 | /** |
| 3 | * Copyright (C) 2014 Named Data Networking Project |
| 4 | * See COPYING for copyright and distribution information. |
| 5 | */ |
| 6 | |
| 7 | #ifndef NFD_FW_STRATEGY_HPP |
| 8 | #define NFD_FW_STRATEGY_HPP |
| 9 | |
Junxiao Shi | 8c8d218 | 2014-01-30 22:33:00 -0700 | [diff] [blame^] | 10 | #include "face/face.hpp" |
Junxiao Shi | d3c792f | 2014-01-30 00:46:13 -0700 | [diff] [blame] | 11 | |
| 12 | namespace nfd { |
| 13 | |
Junxiao Shi | 8c8d218 | 2014-01-30 22:33:00 -0700 | [diff] [blame^] | 14 | class Forwarder; |
| 15 | namespace fib { |
| 16 | class Entry; |
| 17 | } |
| 18 | namespace pit { |
| 19 | class Entry; |
| 20 | } |
| 21 | |
| 22 | namespace fw { |
| 23 | |
Junxiao Shi | d3c792f | 2014-01-30 00:46:13 -0700 | [diff] [blame] | 24 | /** \class Strategy |
| 25 | * \brief represents a forwarding strategy |
| 26 | */ |
| 27 | class Strategy |
| 28 | { |
| 29 | public: |
| 30 | explicit |
Junxiao Shi | 8c8d218 | 2014-01-30 22:33:00 -0700 | [diff] [blame^] | 31 | Strategy(Forwarder& forwarder); |
Junxiao Shi | d3c792f | 2014-01-30 00:46:13 -0700 | [diff] [blame] | 32 | |
| 33 | virtual |
| 34 | ~Strategy(); |
| 35 | |
| 36 | virtual void |
| 37 | afterReceiveInterest(const Face& inFace, |
| 38 | const Interest& interest, |
| 39 | shared_ptr<fib::Entry> fibEntry, |
Junxiao Shi | 8c8d218 | 2014-01-30 22:33:00 -0700 | [diff] [blame^] | 40 | shared_ptr<pit::Entry> pitEntry) =0; |
Junxiao Shi | d3c792f | 2014-01-30 00:46:13 -0700 | [diff] [blame] | 41 | |
| 42 | //virtual void |
| 43 | //beforeExpirePendingInterest() =0; |
| 44 | |
| 45 | //virtual void |
| 46 | //afterAddFibEntry() =0; |
| 47 | |
| 48 | //virtual void |
| 49 | //afterUpdateFibEntry() =0; |
| 50 | |
| 51 | //virtual void |
| 52 | //beforeRemoveFibEntry() =0; |
| 53 | |
| 54 | protected: // actions |
| 55 | /// send Interest to outFace |
| 56 | void |
| 57 | sendInterest(shared_ptr<pit::Entry> pitEntry, |
| 58 | shared_ptr<Face> outFace); |
| 59 | |
| 60 | /** \brief decide that a pending Interest cannot be forwarded |
| 61 | * This shall not be called if the pending Interest has been |
| 62 | * forwarded earlier, and does not need to be resent now. |
| 63 | */ |
| 64 | void |
| 65 | rebuffPendingInterest(shared_ptr<pit::Entry> pitEntry); |
| 66 | |
| 67 | private: |
Junxiao Shi | 8c8d218 | 2014-01-30 22:33:00 -0700 | [diff] [blame^] | 68 | Forwarder& m_forwarder; |
Junxiao Shi | d3c792f | 2014-01-30 00:46:13 -0700 | [diff] [blame] | 69 | }; |
| 70 | |
Junxiao Shi | 8c8d218 | 2014-01-30 22:33:00 -0700 | [diff] [blame^] | 71 | } // namespace fw |
Junxiao Shi | d3c792f | 2014-01-30 00:46:13 -0700 | [diff] [blame] | 72 | } // namespace nfd |
| 73 | |
| 74 | #endif // NFD_FW_STRATEGY_HPP |