NS-3 based Named Data Networking (NDN) simulator
ndnSIM 2.3: NDN, CCN, CCNx, content centric networks
API Documentation
ncc-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_NCC_STRATEGY_HPP
27 #define NFD_DAEMON_FW_NCC_STRATEGY_HPP
28 
29 #include "strategy.hpp"
30 
31 namespace nfd {
32 namespace fw {
33 
36 class NccStrategy : public Strategy
37 {
38 public:
39  explicit
40  NccStrategy(Forwarder& forwarder, const Name& name = STRATEGY_NAME);
41 
42  virtual void
43  afterReceiveInterest(const Face& inFace, const Interest& interest,
44  const shared_ptr<pit::Entry>& pitEntry) override;
45 
46  virtual void
47  beforeSatisfyInterest(const shared_ptr<pit::Entry>& pitEntry,
48  const Face& inFace, const Data& data) override;
49 
53  {
54  public:
55  static constexpr int
57  {
58  return 1000;
59  }
60 
62 
63  void
64  inheritFrom(const MeasurementsEntryInfo& other);
65 
66  shared_ptr<Face>
67  getBestFace();
68 
69  void
70  updateBestFace(const Face& face);
71 
72  void
74 
75  private:
76  void
77  adjustPredictDown();
78 
79  void
80  ageBestFace();
81 
82  public:
83  weak_ptr<Face> bestFace;
84  weak_ptr<Face> previousFace;
85  time::microseconds prediction;
86 
87  static const time::microseconds INITIAL_PREDICTION;
88  static const time::microseconds MIN_PREDICTION;
89  static const int ADJUST_PREDICT_DOWN_SHIFT = 7;
90  static const time::microseconds MAX_PREDICTION;
91  static const int ADJUST_PREDICT_UP_SHIFT = 3;
92  };
93 
95  class PitEntryInfo : public StrategyInfo
96  {
97  public:
98  static constexpr int
100  {
101  return 1001;
102  }
103 
104  virtual
105  ~PitEntryInfo() override;
106 
107  public:
113  time::microseconds maxInterval;
114  };
115 
116 protected:
119 
121  getMeasurementsEntryInfo(const shared_ptr<pit::Entry>& entry);
122 
124  void
125  doPropagate(FaceId inFaceId, weak_ptr<pit::Entry> pitEntryWeak);
126 
128  void
129  timeoutOnBestFace(weak_ptr<pit::Entry> pitEntryWeak);
130 
131 public:
132  static const Name STRATEGY_NAME;
133 
134 protected:
135  static const time::microseconds DEFER_FIRST_WITHOUT_BEST_FACE;
136  static const time::microseconds DEFER_RANGE_WITHOUT_BEST_FACE;
137  static const int UPDATE_MEASUREMENTS_N_LEVELS = 2;
138  static const time::nanoseconds MEASUREMENTS_LIFETIME;
139 };
140 
141 } // namespace fw
142 } // namespace nfd
143 
144 #endif // NFD_DAEMON_FW_NCC_STRATEGY_HPP
static const time::microseconds DEFER_FIRST_WITHOUT_BEST_FACE
a forwarding strategy similar to CCNx 0.7.2
static const Name STRATEGY_NAME
StrategyInfo on measurements::Entry.
void doPropagate(FaceId inFaceId, weak_ptr< pit::Entry > pitEntryWeak)
propagate to another upstream
static const int UPDATE_MEASUREMENTS_N_LEVELS
generalization of a network interface
Definition: face.hpp:67
static const time::microseconds DEFER_RANGE_WITHOUT_BEST_FACE
time::microseconds maxInterval
maximum interval between forwarding to two nexthops except best and previous
main class of NFD
Definition: forwarder.hpp:54
represents an Interest packet
Definition: interest.hpp:42
NccStrategy(Forwarder &forwarder, const Name &name=STRATEGY_NAME)
virtual void afterReceiveInterest(const Face &inFace, const Interest &interest, const shared_ptr< pit::Entry > &pitEntry) override
trigger after Interest is received
static const time::microseconds MIN_PREDICTION
represents a Measurements entry
std::shared_ptr< ns3::EventId > EventId
Definition: scheduler.hpp:39
static constexpr int getTypeId()
Copyright (c) 2011-2015 Regents of the University of California.
Definition: ndn-common.hpp:40
void inheritFrom(const MeasurementsEntryInfo &other)
void timeoutOnBestFace(weak_ptr< pit::Entry > pitEntryWeak)
best face did not reply within prediction
static const time::nanoseconds MEASUREMENTS_LIFETIME
Name abstraction to represent an absolute name.
Definition: name.hpp:46
scheduler::EventId propagateTimer
timer for propagating to another face
scheduler::EventId bestFaceTimeout
timer that expires when best face does not respond within predicted time
StrategyInfo on pit::Entry.
represents a forwarding strategy
Definition: strategy.hpp:38
MeasurementsEntryInfo & getMeasurementsEntryInfo(measurements::Entry *entry)
static const time::microseconds INITIAL_PREDICTION
uint64_t FaceId
identifies a face
Definition: face.hpp:39
represents a Data packet
Definition: data.hpp:37
virtual void beforeSatisfyInterest(const shared_ptr< pit::Entry > &pitEntry, const Face &inFace, const Data &data) override
trigger before PIT entry is satisfied
#define PUBLIC_WITH_TESTS_ELSE_PROTECTED
Definition: common.hpp:39
static const time::microseconds MAX_PREDICTION
contains arbitrary information forwarding strategy places on table entries