38 : m_nameTree(nameTree)
42 std::pair<shared_ptr<Entry>,
bool>
43 Pit::findOrInsert(
const Interest& interest,
bool allowInsert)
46 const Name& name = interest.getName();
47 bool hasDigest = name.size() > 0 && name[-1].isImplicitSha256Digest();
48 size_t nteDepth = name.size() -
static_cast<int>(hasDigest);
54 nte = &m_nameTree.
lookup(name, nteDepth);
59 return {
nullptr,
true};
65 auto it = std::find_if(pitEntries.begin(), pitEntries.end(),
66 [&interest, nteDepth] (
const shared_ptr<Entry>& entry) {
68 return entry->canMatch(interest, nteDepth);
70 if (it != pitEntries.end()) {
76 return {
nullptr,
true};
79 auto entry = make_shared<Entry>(interest);
91 for (
const auto& nte : ntMatches) {
92 for (
const auto& pitEntry : nte.getPitEntries()) {
93 if (pitEntry->getInterest().matchesData(data))
94 matches.emplace_back(pitEntry);
105 BOOST_ASSERT(nte !=
nullptr);
117 BOOST_ASSERT(entry !=
nullptr);
void deleteInRecord(const Face &face)
delete the in-record for face if it exists
A common index structure for FIB, PIT, StrategyChoice, and Measurements.
size_t eraseIfEmpty(Entry *entry, bool canEraseAncestors=true)
Delete the entry if it is empty.
void erasePitEntry(pit::Entry *pitEntry)
void deleteOutRecord(const Face &face)
delete the out-record for face if it exists
static constexpr size_t getMaxDepth()
Maximum depth of the name tree.
const std::vector< shared_ptr< pit::Entry > > & getPitEntries() const
Entry * getEntry(const EntryT &tableEntry) const
Range fullEnumerate(const EntrySelector &entrySelector=AnyEntry()) const
Enumerate all entries.
DataMatchResult findAllDataMatches(const Data &data) const
Performs a Data match.
Entry * findExactMatch(const Name &name, size_t prefixLen=std::numeric_limits< size_t >::max()) const
Exact match lookup.
Entry & lookup(const Name &name, size_t prefixLen)
Find or insert an entry by name.
Copyright (c) 2014-2015, Regents of the University of California, Arizona Board of Regents...
void deleteInOutRecords(Entry *entry, const Face &face)
Deletes in-records and out-records for face.
generalization of a network interface
An entry in the name tree.
static bool nteHasPitEntries(const name_tree::Entry &nte)
const_iterator begin() const
Range findAllMatches(const Name &name, const EntrySelector &entrySelector=AnyEntry()) const
All-prefixes match lookup.
An unordered iterable of all PIT entries matching Data.
void erase(Entry *entry)
Deletes an entry.
void insertPitEntry(shared_ptr< pit::Entry > pitEntry)
bool hasPitEntries() const