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(),
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) {
83 if (isViolatingLocalhost) {
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; });
154 auto it = std::find_if(m_inRecords.begin(), m_inRecords.end(),
155 [&face] (
const InRecord& inRecord) {
return inRecord.getFace().get() == &face; });
156 if (it != m_inRecords.end()) {
157 m_inRecords.erase(it);
170 auto it = std::find_if(m_outRecords.begin(), m_outRecords.end(),
171 [&face] (
const OutRecord& outRecord) {
return outRecord.getFace() == face; });
172 if (it == m_outRecords.end()) {
173 m_outRecords.emplace_front(face);
174 it = m_outRecords.begin();
177 it->update(interest);
184 return std::find_if(m_outRecords.begin(), m_outRecords.end(),
185 [&face] (
const OutRecord& outRecord) {
return outRecord.getFace().get() == &face; });
191 auto it = std::find_if(m_outRecords.begin(), m_outRecords.end(),
192 [&face] (
const OutRecord& outRecord) {
return outRecord.getFace().get() == &face; });
193 if (it != m_outRecords.end()) {
194 m_outRecords.erase(it);
203 return std::any_of(m_outRecords.begin(), m_outRecords.end(),
204 [&now] (
const OutRecord& outRecord) {
return outRecord.getExpiry() >= now; });
OutRecordCollection::iterator getOutRecord(const Face &face)
get the OutRecord for face
static time_point now() noexcept
contains information about an Interest from an incoming face
bool violatesScope(const Face &face) const
decides whether forwarding Interest to face would violate scope
InRecordCollection::iterator insertOrUpdateInRecord(shared_ptr< Face > face, const Interest &interest)
inserts a InRecord for face, and updates it with interest
represents an Interest packet
const Name & getName() const
Table::const_iterator iterator
Copyright (c) 2011-2015 Regents of the University of California.
bool hasUnexpiredOutRecords() const
void deleteOutRecord(const Face &face)
deletes one OutRecord for face if exists
Entry(const Interest &interest)
Name abstraction to represent an absolute name.
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...
void deleteInRecord(const Face &face)
deletes one InRecord for face if exists
bool canForwardTo(const Face &face) const
decides whether Interest can be forwarded to face
void deleteInRecords()
deletes all InRecords
contains information about an Interest toward an outgoing face
OutRecordCollection::iterator insertOrUpdateOutRecord(shared_ptr< Face > face, const Interest &interest)
inserts a OutRecord for face, and updates it with interest
InRecordCollection::const_iterator getInRecord(const Face &face) const
get the InRecord for face
bool hasLocalInRecord() const
determines whether any InRecord is a local Face
int findNonce(uint32_t nonce, const Face &face) const
finds where a duplicate Nonce appears