48 std::shared_ptr<Chain> chain, std::optional<If> condition)
49 :
Rule(
std::move(condition)), chain_(
std::move(chain))
51 if (chain_ ==
nullptr)
53 throw std::invalid_argument(
"Given chain pointer is null.");
76 std::shared_ptr<Chain> chain,
int priority,
77 std::optional<If> condition)
78 :
Rule(
std::move(condition)), chain_(
std::move(chain)), priority_(priority)
80 if (chain_ ==
nullptr)
82 throw std::invalid_argument(
"Given chain pointer is null.");
95 os <<
"goto " << chain_->name();
99 os <<
" with priority " << priority_.value();
125 auto result = chain_->action(packet, address);
131 result.priority(priority_.value());
151 return std::make_unique<GoTo>(chain_, priority_.value(),
condition_);
154 return std::make_unique<GoTo>(chain_,
condition_);
164 return typeid(*this) ==
typeid(other) &&
165 chain_ == static_cast<const GoTo &>(other).chain_ &&
166 priority_ ==
static_cast<const GoTo &
>(other).priority_ &&
167 condition_ == static_cast<const GoTo &>(other).condition_;
177 return typeid(*this) !=
typeid(other) ||
178 chain_ != static_cast<const GoTo &>(other).chain_ ||
179 priority_ !=
static_cast<const GoTo &
>(other).priority_ ||
180 condition_ != static_cast<const GoTo &>(other).condition_;
Continue evaluating rules.
virtual bool operator==(const Rule &other) const
virtual Action action(const Packet &packet, const MAVAddress &address) const
static Action make_continue()
virtual std::unique_ptr< Rule > clone() const
static Action make_default()
virtual std::ostream & print_(std::ostream &os) const
std::optional< If > condition_
GoTo(std::shared_ptr< Chain > chain, std::optional< If > condition={})
virtual bool operator!=(const Rule &other) const