* NetmaskGroup related
* function `newNMG()`: returns a NetmaskGroup
* member `addMask(mask)`: adds `mask` to the NetmaskGroup. Prefix with `!` to exclude this mask from matching.
+ * member `addMask(table)`: adds the keys of `table` to the NetmaskGroup. `table` should be a table whose keys
+ are `ComboAddress` objects and values are integers, as returned by `exceed*` functions
* member `match(ComboAddress)`: checks if ComboAddress is matched by this NetmaskGroup
* member `clear()`: clears the NetmaskGroup
* member `size()`: returns number of netmasks in this NetmaskGroup
g_lua.writeFunction("newNMG", []() { return NetmaskGroup(); });
g_lua.registerFunction<void(NetmaskGroup::*)(const std::string&mask)>("addMask", [](NetmaskGroup&nmg, const std::string& mask)
- {
- nmg.addMask(mask);
- });
+ {
+ nmg.addMask(mask);
+ });
+ g_lua.registerFunction<void(NetmaskGroup::*)(const std::map<ComboAddress,int>& map)>("addMasks", [](NetmaskGroup&nmg, const std::map<ComboAddress,int>& map)
+ {
+ for (const auto& entry : map) {
+ nmg.addMask(Netmask(entry.first));
+ }
+ });
g_lua.registerFunction("match", (bool (NetmaskGroup::*)(const ComboAddress&) const)&NetmaskGroup::match);
g_lua.registerFunction("size", &NetmaskGroup::size);