35 if (outFace.
getScope() == ndn::nfd::FACE_SCOPE_LOCAL) {
47 return inFace.
getScope() != ndn::nfd::FACE_SCOPE_LOCAL;
60 if (inRecord.getLastNonce() == nonce) {
61 if (&inRecord.getFace() == &face) {
71 if (outRecord.getLastNonce() == nonce) {
72 if (&outRecord.getFace() == &face) {
87 auto now = time::steady_clock::now();
90 return outRecord.getExpiry() >= now &&
91 outRecord.getIncomingNack() == nullptr;
95 time::steady_clock::time_point
98 pit::OutRecordCollection::const_iterator lastOutgoing = std::max_element(
101 return a.getLastRenewed() < b.getLastRenewed();
103 BOOST_ASSERT(lastOutgoing != pitEntry.
out_end());
105 return lastOutgoing->getLastRenewed();
108 fib::NextHopList::const_iterator
111 const shared_ptr<pit::Entry>& pitEntry)
113 auto found = nexthops.end();
114 auto earliestRenewed = time::steady_clock::time_point::max();
116 for (
auto it = nexthops.begin(); it != nexthops.end(); ++it) {
120 auto outRecord = pitEntry->findOutRecord(it->getFace());
121 BOOST_ASSERT(outRecord != pitEntry->out_end());
122 if (outRecord->getLastRenewed() < earliestRenewed) {
124 earliestRenewed = outRecord->getLastRenewed();
133 const shared_ptr<pit::Entry>& pitEntry,
135 time::steady_clock::time_point now)
146 auto outRecord = pitEntry->findOutRecord(outFace);
147 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 noexcept
Returns whether the face is local or non-local for scope control purposes.
ndn::nfd::LinkType getLinkType() const noexcept
Returns the link type of the face (point-to-point, multi-access, ...).
FaceId getId() const noexcept
Returns the face ID.
Represents a nexthop record in a FIB entry.
Face & getFace() const noexcept
Represents an entry in the Interest table (PIT).
const OutRecordCollection & getOutRecords() const noexcept
Returns the collection of out-records.
OutRecordCollection::iterator out_begin() noexcept
OutRecordCollection::iterator out_end() noexcept
const InRecordCollection & getInRecords() const noexcept
Returns the collection of in-records.
Contains information about an Interest from an incoming face.
Contains information about an Interest toward an outgoing face.
std::vector< NextHop > NextHopList
A collection of nexthops in a FIB entry.
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.