access-strategy.hpp
Go to the documentation of this file.
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
26 #ifndef NFD_DAEMON_FW_ACCESS_STRATEGY_HPP
27 #define NFD_DAEMON_FW_ACCESS_STRATEGY_HPP
28 
29 #include "strategy.hpp"
30 #include "rtt-estimator.hpp"
32 #include <unordered_set>
33 #include <unordered_map>
34 
35 namespace nfd {
36 namespace fw {
37 
49 class AccessStrategy : public Strategy
50 {
51 public:
52  explicit
53  AccessStrategy(Forwarder& forwarder, const Name& name = STRATEGY_NAME);
54 
55 public: // triggers
56  virtual void
57  afterReceiveInterest(const Face& inFace, const Interest& interest,
58  const shared_ptr<pit::Entry>& pitEntry) override;
59 
60  virtual void
61  beforeSatisfyInterest(const shared_ptr<pit::Entry>& pitEntry,
62  const Face& inFace, const Data& data) override;
63 
64 private: // StrategyInfo
67  class PitInfo : public StrategyInfo
68  {
69  public:
70  static constexpr int
71  getTypeId()
72  {
73  return 1010;
74  }
75 
76  public:
77  scheduler::ScopedEventId rtoTimer;
78  };
79 
82  class MtInfo : public StrategyInfo
83  {
84  public:
85  static constexpr int
86  getTypeId()
87  {
88  return 1011;
89  }
90 
91  MtInfo();
92 
93  public:
94  FaceId lastNexthop;
95  RttEstimator rtt;
96  };
97 
100  std::tuple<Name, MtInfo*>
101  findPrefixMeasurements(const pit::Entry& pitEntry);
102 
106  MtInfo*
107  addPrefixMeasurements(const Data& data);
108 
111  class FaceInfo
112  {
113  public:
114  FaceInfo();
115 
116  public:
117  RttEstimator rtt;
118  };
119 
120  typedef std::unordered_map<FaceId, FaceInfo> FaceInfoTable;
121 
122  void
123  removeFaceInfo(const Face& face);
124 
125 private: // forwarding procedures
126  void
127  afterReceiveNewInterest(const Face& inFace, const Interest& interest,
128  const shared_ptr<pit::Entry>& pitEntry);
129 
130  void
131  afterReceiveRetxInterest(const Face& inFace, const Interest& interest,
132  const shared_ptr<pit::Entry>& pitEntry);
133 
137  bool
138  sendToLastNexthop(const Face& inFace, const shared_ptr<pit::Entry>& pitEntry, MtInfo& mi,
139  const fib::Entry& fibEntry);
140 
141  void
142  afterRtoTimeout(weak_ptr<pit::Entry> pitWeak, FaceId inFace, FaceId firstOutFace);
143 
147  void
148  multicast(const shared_ptr<pit::Entry>& pitEntry, const fib::Entry& fibEntry,
149  std::unordered_set<FaceId> exceptFaces = std::unordered_set<FaceId>());
150 
151  void
152  updateMeasurements(const Face& inFace, const Data& data,
153  const RttEstimator::Duration& rtt);
154 
155 public:
156  static const Name STRATEGY_NAME;
157 
158 private:
159  FaceInfoTable m_fit;
160  RetxSuppressionFixed m_retxSuppression;
161  signal::ScopedConnection m_removeFaceInfoConn;
162 };
163 
164 } // namespace fw
165 } // namespace nfd
166 
167 #endif // NFD_DAEMON_FW_ACCESS_STRATEGY_HPP
main class of NFD
Definition: forwarder.hpp:52
time::microseconds Duration
represents a FIB entry
Definition: fib-entry.hpp:51
implements the Mean-Deviation RTT estimator
a retransmission suppression decision algorithm that suppresses retransmissions within a fixed durati...
virtual void beforeSatisfyInterest(const shared_ptr< pit::Entry > &pitEntry, const Face &inFace, const Data &data) override
trigger before PIT entry is satisfied
cancels an event automatically upon destruction
Definition: scheduler.hpp:54
an Interest table entry
Definition: pit-entry.hpp:57
AccessStrategy(Forwarder &forwarder, const Name &name=STRATEGY_NAME)
Access Router Strategy version 1.
Copyright (c) 2014-2015, Regents of the University of California, Arizona Board of Regents...
Definition: algorithm.hpp:32
contains arbitrary information forwarding strategy places on table entries
virtual void afterReceiveInterest(const Face &inFace, const Interest &interest, const shared_ptr< pit::Entry > &pitEntry) override
trigger after Interest is received
represents a forwarding strategy
Definition: strategy.hpp:38
uint64_t FaceId
identifies a face
Definition: face.hpp:39
static const Name STRATEGY_NAME