blob: ce21c135e9e3af77accc7369c9eb5282a517784e [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
Junxiao Shi8c8d2182014-01-30 22:33:00 -070010#include "face/face.hpp"
Junxiao Shid3c792f2014-01-30 00:46:13 -070011
12namespace nfd {
13
Junxiao Shi8c8d2182014-01-30 22:33:00 -070014class Forwarder;
15namespace fib {
16class Entry;
17}
18namespace pit {
19class Entry;
20}
21
22namespace fw {
23
Junxiao Shid3c792f2014-01-30 00:46:13 -070024/** \class Strategy
25 * \brief represents a forwarding strategy
26 */
27class Strategy
28{
29public:
30 explicit
Junxiao Shi8c8d2182014-01-30 22:33:00 -070031 Strategy(Forwarder& forwarder);
Junxiao Shid3c792f2014-01-30 00:46:13 -070032
33 virtual
34 ~Strategy();
35
36 virtual void
37 afterReceiveInterest(const Face& inFace,
38 const Interest& interest,
39 shared_ptr<fib::Entry> fibEntry,
Junxiao Shi8c8d2182014-01-30 22:33:00 -070040 shared_ptr<pit::Entry> pitEntry) =0;
Junxiao Shid3c792f2014-01-30 00:46:13 -070041
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
54protected: // 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
67private:
Junxiao Shi8c8d2182014-01-30 22:33:00 -070068 Forwarder& m_forwarder;
Junxiao Shid3c792f2014-01-30 00:46:13 -070069};
70
Junxiao Shi8c8d2182014-01-30 22:33:00 -070071} // namespace fw
Junxiao Shid3c792f2014-01-30 00:46:13 -070072} // namespace nfd
73
74#endif // NFD_FW_STRATEGY_HPP