38 : m_nameTree(nameTree)
43 std::pair<shared_ptr<Entry>,
bool>
44 Pit::findOrInsert(
const Interest& interest,
bool allowInsert)
48 bool isEndWithDigest = name.
size() > 0 && name[-1].isImplicitSha256Digest();
49 const Name& nteName = isEndWithDigest ? name.
getPrefix(-1) : name;
54 nte = &m_nameTree.
lookup(nteName);
59 return {
nullptr,
true};
64 size_t nteNameLen = nteName.
size();
65 const std::vector<shared_ptr<Entry>>& pitEntries = nte->
getPitEntries();
66 auto it = std::find_if(pitEntries.begin(), pitEntries.end(),
67 [&interest, nteNameLen] (
const shared_ptr<Entry>& entry) {
70 return entry->canMatch(interest, nteNameLen);
72 if (it != pitEntries.end()) {
78 return {
nullptr,
true};
81 auto entry = make_shared<Entry>(interest);
94 for (
const shared_ptr<Entry>& pitEntry : nte.getPitEntries()) {
95 if (pitEntry->getInterest().matchesData(data))
96 matches.emplace_back(pitEntry);
107 BOOST_ASSERT(nte !=
nullptr);
119 BOOST_ASSERT(entry !=
nullptr);
void insertPitEntry(shared_ptr< pit::Entry > pitEntry)
PartialName getPrefix(ssize_t nComponents) const
Extract a prefix (PartialName) of the name, containing first nComponents components.
void erase(Entry *entry)
deletes an entry
generalization of a network interface
void deleteInOutRecords(Entry *entry, const Face &face)
deletes in-record and out-record for face
const std::vector< shared_ptr< pit::Entry > > & getPitEntries() const
const Name & getName() const
Get name of the Data packet.
Entry * findExactMatch(const Name &name) const
exact match lookup
void erasePitEntry(pit::Entry *pitEntry)
represents an Interest packet
DataMatchResult findAllDataMatches(const Data &data) const
performs a Data match
Range findAllMatches(const Name &name, const EntrySelector &entrySelector=AnyEntry()) const
all-prefixes match lookup
Copyright (c) 2011-2015 Regents of the University of California.
Entry & lookup(const Name &name)
find or insert an entry with specified name
void deleteOutRecord(const Face &face)
delete the out-record for face if it exists
Name abstraction to represent an absolute name.
Range fullEnumerate(const EntrySelector &entrySelector=AnyEntry()) const
enumerate all entries
void deleteInRecord(const Face &face)
delete the in-record for face if it exists
size_t size() const
Get the number of components.
static bool nteHasPitEntries(const name_tree::Entry &nte)
size_t eraseIfEmpty(Entry *entry, bool canEraseAncestors=true)
delete the entry if it is empty
a common index structure for FIB, PIT, StrategyChoice, and Measurements
bool hasPitEntries() const
Entry * getEntry(const ENTRY &tableEntry) const
const_iterator begin() const
std::vector< shared_ptr< Entry > > DataMatchResult
an entry in the name tree
const Name & getName() const