41 for (
auto &
rule : other.rules_)
60 std::string
name, std::vector<std::unique_ptr<Rule>> &&rules)
61 : name_(
std::move(
name)), rules_(
std::move(rules))
63 if (name_.find_first_of(
"\t\n ") != std::string::npos)
65 throw std::invalid_argument(
"Chain names cannot contain whitespace.");
97 for (
auto const &
rule : rules_)
118 rules_.push_back(std::move(
rule));
143 for (
auto &
rule : other.rules_)
148 recursion_data_ = other.recursion_data_;
172 if (lhs.rules_.size() != rhs.rules_.size())
178 for (
size_t i = 0; i < lhs.rules_.size(); ++i)
180 if (*(lhs.rules_[i]) != *(rhs.rules_[i]))
202 return !(lhs == rhs);
227 os <<
"chain " << chain.
name() <<
" {" << std::endl;
229 for (
auto const &
rule : chain.rules_)
231 os <<
" " << *
rule <<
";" << std::endl;
const std::string & name() const
Continue evaluating rules.
std::string name(unsigned long id)
virtual std::unique_ptr< Rule > clone() const =0
Chain & operator=(const Chain &other)
static Action make_continue()
std::ostream & operator<<(std::ostream &os, const Action &action)
TEST_VIRTUAL Action action(const Packet &packet, const MAVAddress &address)
bool operator==(const Action &lhs, const Action &rhs)
bool operator!=(const Action &lhs, const Action &rhs)
void append(std::unique_ptr< Rule > rule)
Chain(const Chain &other)
virtual Action action(const Packet &packet, const MAVAddress &address) const =0