34 if (outFace.
getScope() == ndn::nfd::FACE_SCOPE_LOCAL) {
46 return inFace.
getScope() != ndn::nfd::FACE_SCOPE_LOCAL;
59 if (inRecord.getLastNonce() == nonce) {
60 if (&inRecord.getFace() == &face) {
70 if (outRecord.getLastNonce() == nonce) {
71 if (&outRecord.getFace() == &face) {
86 auto now = time::steady_clock::now();
89 return outRecord.getExpiry() >= now &&
90 outRecord.getIncomingNack() == nullptr;
94 time::steady_clock::time_point
97 pit::OutRecordCollection::const_iterator lastOutgoing = std::max_element(
100 return a.getLastRenewed() < b.getLastRenewed();
102 BOOST_ASSERT(lastOutgoing != pitEntry.
out_end());
104 return lastOutgoing->getLastRenewed();
107 fib::NextHopList::const_iterator
110 const shared_ptr<pit::Entry>& pitEntry)
112 auto found = nexthops.end();
113 auto earliestRenewed = time::steady_clock::time_point::max();
115 for (
auto it = nexthops.begin(); it != nexthops.end(); ++it) {
119 auto outRecord = pitEntry->getOutRecord(it->getFace());
120 BOOST_ASSERT(outRecord != pitEntry->out_end());
121 if (outRecord->getLastRenewed() < earliestRenewed) {
123 earliestRenewed = outRecord->getLastRenewed();
132 const shared_ptr<pit::Entry>& pitEntry,
134 time::steady_clock::time_point now)
145 auto outRecord = pitEntry->getOutRecord(outFace);
146 if (outRecord != pitEntry->out_end() && outRecord->getExpiry() > now) {
This file contains common algorithms used by forwarding strategies.
Generalization of a network interface.
ndn::nfd::FaceScope getScope() const
Returns whether the face is local or non-local for scope control purposes.
FaceId getId() const noexcept
Returns the face ID.
ndn::nfd::LinkType getLinkType() const
Returns the link type of the face (point-to-point, multi-access, ...).
Represents a nexthop record in a FIB entry.
Represents an entry in the Interest table (PIT).
OutRecordCollection::iterator out_end()
const InRecordCollection & getInRecords() const
OutRecordCollection::iterator out_begin()
const OutRecordCollection & getOutRecords() const
Contains information about an Interest from an incoming face.
Contains information about an Interest toward an outgoing face.
std::vector< NextHop > NextHopList
bool isNextHopEligible(const Face &inFace, const Interest &interest, const fib::NextHop &nexthop, const shared_ptr< pit::Entry > &pitEntry, bool wantUnused, time::steady_clock::time_point now)
Determines whether a NextHop is eligible, i.e., not the same inFace.
fib::NextHopList::const_iterator findEligibleNextHopWithEarliestOutRecord(const Face &inFace, const Interest &interest, const fib::NextHopList &nexthops, const shared_ptr< pit::Entry > &pitEntry)
Pick an eligible NextHop with earliest out-record.
@ DUPLICATE_NONCE_OUT_SAME
out-record of same face
@ DUPLICATE_NONCE_NONE
no duplicate Nonce is found
@ DUPLICATE_NONCE_IN_SAME
in-record of same face
@ DUPLICATE_NONCE_OUT_OTHER
out-record of other face
@ DUPLICATE_NONCE_IN_OTHER
in-record of other face
int findDuplicateNonce(const pit::Entry &pitEntry, Interest::Nonce nonce, const Face &face)
Determine whether pitEntry has duplicate Nonce nonce.
bool hasPendingOutRecords(const pit::Entry &pitEntry)
Determine whether pitEntry has any pending out-records.
time::steady_clock::time_point getLastOutgoing(const pit::Entry &pitEntry)
bool wouldViolateScope(const Face &inFace, const Interest &interest, const Face &outFace)
Determine whether forwarding the Interest in pitEntry to outFace would violate scope.
const Name LOCALHOST
The localhost scope ndn:/localhost.
const Name LOCALHOP
The localhop scope ndn:/localhop.