|
| BestRouteStrategy (Forwarder &forwarder, const Name &name=getStrategyName()) |
|
virtual void | afterContentStoreHit (const shared_ptr< pit::Entry > &pitEntry, const Face &inFace, const Data &data) |
| trigger after a Data is matched in CS More...
|
|
virtual void | afterReceiveData (const shared_ptr< pit::Entry > &pitEntry, const Face &inFace, const Data &data) |
| trigger after Data is received More...
|
|
void | afterReceiveInterest (const Face &inFace, const Interest &interest, const shared_ptr< pit::Entry > &pitEntry) override |
| trigger after Interest is received More...
|
|
virtual void | afterReceiveNack (const Face &inFace, const lp::Nack &nack, const shared_ptr< pit::Entry > &pitEntry) |
| trigger after Nack is received More...
|
|
virtual void | beforeSatisfyInterest (const shared_ptr< pit::Entry > &pitEntry, const Face &inFace, const Data &data) |
| trigger before PIT entry is satisfied More...
|
|
const Name & | getInstanceName () const |
|
virtual void | onDroppedInterest (const Face &outFace, const Interest &interest) |
| trigger after Interest dropped for exceeding allowed retransmissions More...
|
|
|
Face * | getFace (FaceId id) const |
|
const FaceTable & | getFaceTable () const |
|
MeasurementsAccessor & | getMeasurements () |
|
const fib::Entry & | lookupFib (const pit::Entry &pitEntry) const |
| performs a FIB lookup, considering Link object if present More...
|
|
void | rejectPendingInterest (const shared_ptr< pit::Entry > &pitEntry) |
| schedule the PIT entry for immediate deletion More...
|
|
void | sendData (const shared_ptr< pit::Entry > &pitEntry, const Data &data, const Face &outFace) |
| send data to outFace More...
|
|
void | sendDataToAll (const shared_ptr< pit::Entry > &pitEntry, const Face &inFace, const Data &data) |
| send data to all matched and qualified faces More...
|
|
void | sendInterest (const shared_ptr< pit::Entry > &pitEntry, Face &outFace, const Interest &interest) |
| send Interest to outFace More...
|
|
void | sendNack (const shared_ptr< pit::Entry > &pitEntry, const Face &outFace, const lp::NackHeader &header) |
| send Nack to outFace More...
|
|
void | sendNacks (const shared_ptr< pit::Entry > &pitEntry, const lp::NackHeader &header, std::initializer_list< const Face * > exceptFaces=std::initializer_list< const Face * >()) |
| send Nack to every face that has an in-record, except those in exceptFaces More...
|
|
void | setExpiryTimer (const shared_ptr< pit::Entry > &pitEntry, time::milliseconds duration) |
| Schedule the PIT entry to be erased after duration . More...
|
|
void | setInstanceName (const Name &name) |
| set strategy instance name More...
|
|
Best Route strategy version 1.
This strategy forwards a new Interest to the lowest-cost nexthop that is not same as the downstream, and does not violate scope. Subsequent similar Interests or consumer retransmissions are suppressed until after InterestLifetime expiry.
- Note
- This strategy is superceded by Best Route strategy version 2, which allows consumer retransmissions. This version is kept for comparison purposes and is not recommended for general usage.
Definition at line 56 of file best-route-strategy.hpp.
void nfd::fw::Strategy::afterReceiveData |
( |
const shared_ptr< pit::Entry > & |
pitEntry, |
|
|
const Face & |
inFace, |
|
|
const Data & |
data |
|
) |
| |
|
virtualinherited |
trigger after Data is received
This trigger is invoked when an incoming Data satisfies exactly one PIT entry, and gives the strategy full control over Data forwarding.
When this trigger is invoked:
- The Data has been verified to satisfy the PIT entry.
- The PIT entry expiry timer is set to now
Within this function:
- A strategy should return Data to downstream nodes via
sendData
or sendDataToAll
.
- A strategy can modify the Data as long as it still satisfies the PIT entry, such as adding or removing congestion marks.
- A strategy can delay Data forwarding by prolonging the PIT entry lifetime via
setExpiryTimer
, and forward Data before the PIT entry is erased.
- A strategy can collect measurements about the upstream.
- A strategy can collect responses from additional upstream nodes by prolonging the PIT entry lifetime via
setExpiryTimer
every time a Data is received. Note that only one Data should be returned to each downstream node.
In the base class this method invokes beforeSatisfyInterest
trigger and then returns the Data to downstream faces via sendDataToAll
.
Definition at line 171 of file strategy.cpp.
void nfd::fw::BestRouteStrategyBase::afterReceiveInterest |
( |
const Face & |
inFace, |
|
|
const Interest & |
interest, |
|
|
const shared_ptr< pit::Entry > & |
pitEntry |
|
) |
| |
|
overridevirtualinherited |
trigger after Interest is received
The Interest:
- does not violate Scope
- is not looped
- cannot be satisfied by ContentStore
- is under a namespace managed by this strategy
The PIT entry is set to expire after InterestLifetime has elapsed at each downstream.
The strategy should decide whether and where to forward this Interest.
- If the strategy decides to forward this Interest, invoke
sendInterest
for each upstream, either now or shortly after via a scheduler event, but before PIT entry expires. Optionally, the strategy can invoke setExpiryTimer
to adjust how long it would wait for a response.
- If the strategy has already forwarded this Interest previously and decides to continue waiting, do nothing. Optionally, the strategy can invoke
setExpiryTimer
to adjust how long it would wait for a response.
- If the strategy concludes that this Interest cannot be satisfied, invoke
rejectPendingInterest
to erase the PIT entry.
- Warning
- The strategy must not retain shared_ptr<pit::Entry>, otherwise undefined behavior may occur. However, the strategy is allowed to store weak_ptr<pit::Entry>.
Implements nfd::fw::Strategy.
Definition at line 38 of file best-route-strategy.cpp.
void nfd::fw::Strategy::afterReceiveNack |
( |
const Face & |
inFace, |
|
|
const lp::Nack & |
nack, |
|
|
const shared_ptr< pit::Entry > & |
pitEntry |
|
) |
| |
|
virtualinherited |
trigger after Nack is received
This trigger is invoked when an incoming Nack is received in response to an forwarded Interest. The Nack has been confirmed to be a response to the last Interest forwarded to that upstream, i.e. the PIT out-record exists and has a matching Nonce. The NackHeader has been recorded in the PIT out-record.
If the PIT entry is not yet satisfied, its expiry timer remains unchanged. Otherwise, the PIT entry normally would expire immediately after this function returns.
If the strategy wishes to collect responses from additional upstream nodes, it should invoke setExpiryTimer
within this function to retain the PIT entry. If a Nack arrives from another upstream during the extended PIT entry lifetime, this trigger will be invoked again. At that time, this function must invoke setExpiryTimer
again to continue collecting more responses.
In the base class this method does nothing.
- Warning
- The strategy must not retain shared_ptr<pit::Entry>, otherwise undefined behavior may occur. However, the strategy is allowed to store weak_ptr<pit::Entry>.
Reimplemented in nfd::fw::BestRouteStrategy2, nfd::fw::asf::AsfStrategy, and nfd::fw::MulticastStrategy.
Definition at line 183 of file strategy.cpp.
void nfd::fw::Strategy::beforeSatisfyInterest |
( |
const shared_ptr< pit::Entry > & |
pitEntry, |
|
|
const Face & |
inFace, |
|
|
const Data & |
data |
|
) |
| |
|
virtualinherited |
trigger before PIT entry is satisfied
This trigger is invoked when an incoming Data satisfies more than one PIT entry. The strategy can collect measurements information, but cannot manipulate Data forwarding. When an incoming Data satisfies only one PIT entry, afterReceiveData
is invoked instead and given full control over Data forwarding. If a strategy does not override afterReceiveData
, the default implementation invokes beforeSatisfyInterest
.
Normally, PIT entries would be erased after receiving the first matching Data. If the strategy wishes to collect responses from additional upstream nodes, it should invoke setExpiryTimer
within this function to prolong the PIT entry lifetime. If a Data arrives from another upstream during the extended PIT entry lifetime, this trigger will be invoked again. At that time, this function must invoke setExpiryTimer
again to continue collecting more responses.
In this base class this method does nothing.
- Warning
- The strategy must not retain shared_ptr<pit::Entry>, otherwise undefined behavior may occur. However, the strategy is allowed to store weak_ptr<pit::Entry>.
Reimplemented in nfd::fw::AccessStrategy, nfd::fw::asf::AsfStrategy, and nfd::fw::NccStrategy.
Definition at line 153 of file strategy.cpp.
Name nfd::fw::Strategy::makeInstanceName |
( |
const Name & |
input, |
|
|
const Name & |
strategyName |
|
) |
| |
|
staticprotectedinherited |
construct a strategy instance name
- Parameters
-
input | strategy instance name, may contain version and parameters |
strategyName | strategy name with version but without parameters; typically this should be getStrategyName() |
If input
contains a version component, return input
unchanged. Otherwise, return input
plus the version component taken from strategyName
. This allows a strategy instance to be constructed with an unversioned name, but its final instance name should contain the version.
Definition at line 133 of file strategy.cpp.