35 m_lastNonce = interest.getNonce();
36 m_lastRenewed = time::steady_clock::now();
38 auto lifetime = interest.getInterestLifetime();
40 lifetime = std::min<time::milliseconds>(lifetime, 10_days);
41 m_expiry = m_lastRenewed + lifetime;
48 m_interest = interest.shared_from_this();
54 if (nack.getInterest().getNonce() != this->getLastNonce()) {
58 m_incomingNack = make_unique<lp::NackHeader>(nack.getHeader());
63 : m_interest(interest.shared_from_this())
70 BOOST_ASSERT(m_interest->getName().compare(0, nEqualNameComps,
71 interest.getName(), 0, nEqualNameComps) == 0);
73 return m_interest->getName().compare(nEqualNameComps, Name::npos,
74 interest.getName(), nEqualNameComps) == 0 &&
75 m_interest->getCanBePrefix() == interest.getCanBePrefix() &&
76 m_interest->getMustBeFresh() == interest.getMustBeFresh();
80 InRecordCollection::iterator
83 return std::find_if(m_inRecords.begin(), m_inRecords.end(),
84 [&face] (
const InRecord& inRecord) { return &inRecord.getFace() == &face; });
87 InRecordCollection::iterator
90 BOOST_ASSERT(this->
canMatch(interest));
93 if (it == m_inRecords.end()) {
94 m_inRecords.emplace_front(face);
95 it = m_inRecords.begin();
102 OutRecordCollection::iterator
105 return std::find_if(m_outRecords.begin(), m_outRecords.end(),
106 [&face] (
const OutRecord& outRecord) { return &outRecord.getFace() == &face; });
109 OutRecordCollection::iterator
112 BOOST_ASSERT(this->
canMatch(interest));
115 if (it == m_outRecords.end()) {
116 m_outRecords.emplace_front(face);
117 it = m_outRecords.begin();
120 it->update(interest);
127 auto it = std::find_if(m_outRecords.begin(), m_outRecords.end(),
128 [&face] (
const OutRecord& outRecord) { return &outRecord.getFace() == &face; });
129 if (it != m_outRecords.end()) {
130 m_outRecords.erase(it);
Generalization of a network interface.
bool canMatch(const Interest &interest, size_t nEqualNameComps=0) const
Entry(const Interest &interest)
OutRecordCollection::iterator findOutRecord(const Face &face) noexcept
Get the out-record for face.
OutRecordCollection::iterator insertOrUpdateOutRecord(Face &face, const Interest &interest)
Insert or update an out-record.
InRecordCollection::iterator findInRecord(const Face &face) noexcept
Get the in-record for face.
InRecordCollection::iterator insertOrUpdateInRecord(Face &face, const Interest &interest)
Insert or update an in-record.
void deleteOutRecord(const Face &face)
Delete the out-record for face if it exists.
void update(const Interest &interest)
Updates lastNonce, lastRenewed, expiry fields.
Contains information about an Interest from an incoming face.
void update(const Interest &interest)
Contains information about an Interest toward an outgoing face.
bool setIncomingNack(const lp::Nack &nack)
Sets a Nack received from getFace().