NS-3 based Named Data Networking (NDN) simulator
ndnSIM 2.3: NDN, CCN, CCNx, content centric networks
API Documentation
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 "core/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 = getStrategyName());
54 
55  static const Name&
57 
58 public: // triggers
59  void
60  afterReceiveInterest(const Face& inFace, const Interest& interest,
61  const shared_ptr<pit::Entry>& pitEntry) override;
62 
63  void
64  beforeSatisfyInterest(const shared_ptr<pit::Entry>& pitEntry,
65  const Face& inFace, const Data& data) override;
66 
67 private: // StrategyInfo
70  class PitInfo : public StrategyInfo
71  {
72  public:
73  static constexpr int
74  getTypeId()
75  {
76  return 1010;
77  }
78 
79  public:
80  scheduler::ScopedEventId rtoTimer;
81  };
82 
85  class MtInfo : public StrategyInfo
86  {
87  public:
88  static constexpr int
89  getTypeId()
90  {
91  return 1011;
92  }
93 
94  MtInfo();
95 
96  public:
97  FaceId lastNexthop;
98  RttEstimator rtt;
99  };
100 
103  std::tuple<Name, MtInfo*>
104  findPrefixMeasurements(const pit::Entry& pitEntry);
105 
109  MtInfo*
110  addPrefixMeasurements(const Data& data);
111 
114  class FaceInfo
115  {
116  public:
117  FaceInfo();
118 
119  public:
120  RttEstimator rtt;
121  };
122 
123  typedef std::unordered_map<FaceId, FaceInfo> FaceInfoTable;
124 
125  void
126  removeFaceInfo(const Face& face);
127 
128 private: // forwarding procedures
129  void
130  afterReceiveNewInterest(const Face& inFace, const Interest& interest,
131  const shared_ptr<pit::Entry>& pitEntry);
132 
133  void
134  afterReceiveRetxInterest(const Face& inFace, const Interest& interest,
135  const shared_ptr<pit::Entry>& pitEntry);
136 
140  bool
141  sendToLastNexthop(const Face& inFace, const Interest& interest,
142  const shared_ptr<pit::Entry>& pitEntry, MtInfo& mi,
143  const fib::Entry& fibEntry);
144 
145  void
146  afterRtoTimeout(weak_ptr<pit::Entry> pitWeak, FaceId inFaceId, FaceId firstOutFaceId);
147 
152  int
153  multicast(const Face& inFace, const Interest& interest,
154  const shared_ptr<pit::Entry>& pitEntry, const fib::Entry& fibEntry,
155  FaceId exceptFace = face::INVALID_FACEID);
156 
157  void
158  updateMeasurements(const Face& inFace, const Data& data,
159  const RttEstimator::Duration& rtt);
160 
161 private:
162  FaceInfoTable m_fit;
163  RetxSuppressionFixed m_retxSuppression;
164  signal::ScopedConnection m_removeFaceInfoConn;
165 };
166 
167 } // namespace fw
168 } // namespace nfd
169 
170 #endif // NFD_DAEMON_FW_ACCESS_STRATEGY_HPP
time::microseconds Duration
a retransmission suppression decision algorithm that suppresses retransmissions within a fixed durati...
represents a FIB entry
Definition: fib-entry.hpp:51
main class of NFD
Definition: forwarder.hpp:54
represents an Interest packet
Definition: interest.hpp:42
void afterReceiveInterest(const Face &inFace, const Interest &interest, const shared_ptr< pit::Entry > &pitEntry) override
trigger after Interest is received
ndn Face
Definition: face-impl.hpp:41
Copyright (c) 2011-2015 Regents of the University of California.
Definition: ndn-common.hpp:40
an Interest table entry
Definition: pit-entry.hpp:57
static const Name & getStrategyName()
disconnects a Connection automatically upon destruction
cancels an event automatically upon destruction
Definition: scheduler.hpp:59
Represents an absolute name.
Definition: name.hpp:42
represents a forwarding strategy
Definition: strategy.hpp:37
void beforeSatisfyInterest(const shared_ptr< pit::Entry > &pitEntry, const Face &inFace, const Data &data) override
trigger before PIT entry is satisfied
implements the Mean-Deviation RTT estimator
Access Router Strategy version 1.
uint64_t FaceId
identifies a face
Definition: face.hpp:39
Represents a Data packet.
Definition: data.hpp:35
AccessStrategy(Forwarder &forwarder, const Name &name=getStrategyName())
const FaceId INVALID_FACEID
indicates an invalid FaceId
Definition: face.hpp:42
contains arbitrary information forwarding strategy places on table entries