support for indexing "table[pattern] of T" with strings to get multi-matches

This commit is contained in:
Vern Paxson 2023-11-01 11:23:48 +01:00 committed by Arne Welzel
parent a5a79d3f3a
commit 699549eb45
8 changed files with 228 additions and 2 deletions

View file

@ -718,6 +718,8 @@ protected:
TableVal* table;
};
class TablePatternMatcher;
class TableVal final : public Val, public notifier::detail::Modifiable {
public:
explicit TableVal(TableTypePtr t, detail::AttributesPtr attrs = nullptr);
@ -863,6 +865,11 @@ public:
// Causes an internal error if called for any other kind of table.
TableValPtr LookupSubnetValues(const SubNetVal* s);
// For a table[pattern], return a vector of all yields matching
// the given string.
// Causes an internal error if called for any other kind of table.
VectorValPtr LookupPattern(const StringVal* s);
// Sets the timestamp for the given index to network time.
// Returns false if index does not exist.
bool UpdateTimestamp(Val* index);
@ -1032,6 +1039,7 @@ protected:
TableValTimer* timer;
RobustDictIterator<TableEntryVal>* expire_iterator;
detail::PrefixTable* subnets;
TablePatternMatcher* pattern_matcher = nullptr;
ValPtr def_val;
detail::ExprPtr change_func;
std::string broker_store;