Add bif that allows searching for all matching subnets in table.

Example:

global test: set[subnet] = {
	10.0.0.0/8,
	10.1.0.0/16,
	10.2.0.0/16,
	10.2.0.2/31
}

print matching_subnets(10.2.0.2/32, test);
->
[10.2.0.2/31, 10.2.0.0/16, 10.0.0.0/8]
This commit is contained in:
Johanna Amann 2016-03-09 12:24:00 -08:00
parent 42e4072673
commit 562e5a9f63
10 changed files with 274 additions and 11 deletions

View file

@ -814,6 +814,11 @@ public:
int Size() const { return AsTable()->Length(); }
int RecursiveSize() const;
// Returns the Prefix table used inside the table (if present).
// This allows us to do more direct queries to this specialized
// type that the general Table API does not allow.
const PrefixTable* Subnets() const { return subnets; }
void Describe(ODesc* d) const override;
void InitTimer(double delay);