34 BOOST_ASSERT(m_iPitEntry < m_ntIt->getPitEntries().size());
36 if (++m_iPitEntry >= m_ntIt->getPitEntries().size()) {
45 : m_nameTree(nameTree)
49 std::pair<shared_ptr<Entry>,
bool>
50 Pit::findOrInsert(
const Interest& interest,
bool allowInsert)
53 const Name& name = interest.getName();
54 bool hasDigest = name.size() > 0 && name[-1].isImplicitSha256Digest();
55 size_t nteDepth = name.size() -
static_cast<size_t>(hasDigest);
61 nte = &m_nameTree.
lookup(name, nteDepth);
66 return {
nullptr,
true};
72 auto it = std::find_if(pitEntries.begin(), pitEntries.end(),
73 [&interest, nteDepth] (
const shared_ptr<Entry>& entry) {
75 return entry->canMatch(interest, nteDepth);
77 if (it != pitEntries.end()) {
83 return {
nullptr,
true};
86 auto entry = make_shared<Entry>(interest);
104 for (
const auto& nte : ntMatches) {
106 if (pitEntry->getInterest().matchesData(data))
107 matches.emplace_back(pitEntry);
118 BOOST_ASSERT(nte !=
nullptr);
130 BOOST_ASSERT(entry !=
nullptr);
133 if (in != entry->
in_end()) {
Generalization of a network interface.
An entry in the name tree.
bool hasPitEntries() const
void insertPitEntry(shared_ptr< pit::Entry > pitEntry)
void erasePitEntry(pit::Entry *pitEntry)
const std::vector< shared_ptr< pit::Entry > > & getPitEntries() const
A common index structure for FIB, PIT, StrategyChoice, and Measurements.
Range findAllMatches(const Name &name, const EntrySelector &entrySelector=AnyEntry()) const
All-prefixes match lookup.
size_t eraseIfEmpty(Entry *entry, bool canEraseAncestors=true)
Delete the entry if it is empty.
Range fullEnumerate(const EntrySelector &entrySelector=AnyEntry()) const
Enumerate all entries.
static constexpr size_t getMaxDepth()
Maximum depth of the name tree.
Entry & lookup(const Name &name, size_t prefixLen)
Find or insert an entry by name.
Entry * getEntry(const EntryT &tableEntry) const
Entry * findExactMatch(const Name &name, size_t prefixLen=std::numeric_limits< size_t >::max()) const
Exact match lookup.
Represents an entry in the Interest table (PIT).
void deleteInRecord(InRecordCollection::const_iterator pos)
Removes the in-record at position pos.
InRecordCollection::iterator in_end() noexcept
InRecordCollection::iterator findInRecord(const Face &face) noexcept
Get the in-record for face.
void deleteOutRecord(const Face &face)
Delete the out-record for face if it exists.
const_iterator begin() const
DataMatchResult findAllDataMatches(const Data &data) const
Performs a Data match.
void deleteInOutRecords(Entry *entry, const Face &face)
Deletes in-records and out-records for face.
void erase(Entry *entry)
Deletes an entry.
std::vector< shared_ptr< Entry > > DataMatchResult
An unordered iterable of all PIT entries matching a Data packet.
static bool nteHasPitEntries(const name_tree::Entry &nte)