blob: 1a6e47ff4323fc026b067c039cc55912674cdca3 [file] [log] [blame]
Junxiao Shid3c792f2014-01-30 00:46:13 -07001/* -*- 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
10#include "forwarder.hpp"
11
12namespace nfd {
13
14/** \class Strategy
15 * \brief represents a forwarding strategy
16 */
17class Strategy
18{
19public:
20 explicit
21 Strategy(Forwarder& fw);
22
23 virtual
24 ~Strategy();
25
26 virtual void
27 afterReceiveInterest(const Face& inFace,
28 const Interest& interest,
29 shared_ptr<fib::Entry> fibEntry,
30 shared_ptr<pit::Entry> pitEntry,
31 pit::InRecordCollection::iterator pitInRecord
32 ) =0;
33
34 //virtual void
35 //beforeExpirePendingInterest() =0;
36
37 //virtual void
38 //afterAddFibEntry() =0;
39
40 //virtual void
41 //afterUpdateFibEntry() =0;
42
43 //virtual void
44 //beforeRemoveFibEntry() =0;
45
46protected: // actions
47 /// send Interest to outFace
48 void
49 sendInterest(shared_ptr<pit::Entry> pitEntry,
50 shared_ptr<Face> outFace);
51
52 /** \brief decide that a pending Interest cannot be forwarded
53 * This shall not be called if the pending Interest has been
54 * forwarded earlier, and does not need to be resent now.
55 */
56 void
57 rebuffPendingInterest(shared_ptr<pit::Entry> pitEntry);
58
59private:
60 Forwarder& m_fw;
61};
62
63} // namespace nfd
64
65#endif // NFD_FW_STRATEGY_HPP