32 const Name Entry::LOCALHOST_NAME(
"ndn:/localhost");
33 const Name Entry::LOCALHOP_NAME(
"ndn:/localhop");
36 : m_interest(interest.shared_from_this())
43 return m_interest->getName();
49 return std::any_of(m_inRecords.begin(), m_inRecords.end(),
50 [] (
const InRecord& inRecord) {
return inRecord.getFace()->isLocal(); });
58 bool hasUnexpiredOutRecord = std::any_of(m_outRecords.begin(), m_outRecords.end(),
59 [&face, &now] (
const OutRecord& outRecord) {
60 return outRecord.getFace().get() == &face && outRecord.getExpiry() >= now;
62 if (hasUnexpiredOutRecord) {
66 bool hasUnexpiredOtherInRecord = std::any_of(m_inRecords.begin(), m_inRecords.end(),
67 [&face, &now] (
const InRecord& inRecord) {
68 return inRecord.getFace().get() != &face && inRecord.getExpiry() >= now;
70 if (!hasUnexpiredOtherInRecord) {
81 bool isViolatingLocalhost = !face.
isLocal() &&
83 if (isViolatingLocalhost) {
88 bool isViolatingLocalhop = !face.
isLocal() &&
91 if (isViolatingLocalhop) {
105 for (
const InRecord& inRecord : m_inRecords) {
106 if (inRecord.getLastNonce() == nonce) {
107 if (inRecord.getFace().get() == &face) {
116 for (
const OutRecord& outRecord : m_outRecords) {
117 if (outRecord.getLastNonce() == nonce) {
118 if (outRecord.getFace().get() == &face) {
133 auto it = std::find_if(m_inRecords.begin(), m_inRecords.end(),
134 [&face] (
const InRecord& inRecord) {
return inRecord.getFace() == face; });
135 if (it == m_inRecords.end()) {
136 m_inRecords.emplace_front(face);
137 it = m_inRecords.begin();
140 it->update(interest);
144 InRecordCollection::const_iterator
147 return std::find_if(m_inRecords.begin(), m_inRecords.end(),
148 [&face] (
const InRecord& inRecord) {
return inRecord.getFace().get() == &face; });
160 auto it = std::find_if(m_outRecords.begin(), m_outRecords.end(),
161 [&face] (
const OutRecord& outRecord) {
return outRecord.getFace() == face; });
162 if (it == m_outRecords.end()) {
163 m_outRecords.emplace_front(face);
164 it = m_outRecords.begin();
167 it->update(interest);
171 OutRecordCollection::const_iterator
174 return std::find_if(m_outRecords.begin(), m_outRecords.end(),
175 [&face] (
const OutRecord& outRecord) {
return outRecord.getFace().get() == &face; });
181 auto it = std::find_if(m_outRecords.begin(), m_outRecords.end(),
182 [&face] (
const OutRecord& outRecord) {
return outRecord.getFace().get() == &face; });
183 if (it != m_outRecords.end()) {
184 m_outRecords.erase(it);
193 return std::any_of(m_outRecords.begin(), m_outRecords.end(),
194 [&now] (
const OutRecord& outRecord) {
return outRecord.getExpiry() >= now; });
InRecordCollection::const_iterator getInRecord(const Face &face) const
get the InRecord for face
OutRecordCollection::const_iterator getOutRecord(const Face &face) const
get the OutRecord for face
static time_point now() noexcept
contains information about an Interest from an incoming face
bool canForwardTo(const Face &face) const
decides whether Interest can be forwarded to face
int findNonce(uint32_t nonce, const Face &face) const
finds where a duplicate Nonce appears
InRecordCollection::iterator insertOrUpdateInRecord(shared_ptr< Face > face, const Interest &interest)
inserts a InRecord for face, and updates it with interest
represents an Interest packet
bool hasLocalInRecord() const
determines whether any InRecord is a local Face
Table::const_iterator iterator
bool violatesScope(const Face &face) const
decides whether forwarding Interest to face would violate scope
Copyright (c) 2011-2015 Regents of the University of California.
const Name & getName() const
void deleteOutRecord(const Face &face)
deletes one OutRecord for face if exists
Entry(const Interest &interest)
Name abstraction to represent an absolute name.
void deleteInRecords()
deletes all InRecords
contains information about an Interest toward an outgoing face
bool isPrefixOf(const Name &name) const
Check if the N components of this name are the same as the first N components of the given name...
OutRecordCollection::iterator insertOrUpdateOutRecord(shared_ptr< Face > face, const Interest &interest)
inserts a OutRecord for face, and updates it with interest
bool hasUnexpiredOutRecords() const
bool isLocal() const
Get whether face is connected to a local app.