mavtables
0.2.1
MAVLink router and firewall.
|
#include <Call.hpp>
Public Member Functions | |
Call (std::shared_ptr< Chain > chain, std::optional< If > condition={}) | |
Call (std::shared_ptr< Chain > chain, int priority, std::optional< If > condition={}) | |
virtual Action | action (const Packet &packet, const MAVAddress &address) const |
virtual std::unique_ptr< Rule > | clone () const |
virtual bool | operator== (const Rule &other) const |
virtual bool | operator!= (const Rule &other) const |
Protected Member Functions | |
virtual std::ostream & | print_ (std::ostream &os) const |
Protected Attributes | |
std::optional< If > | condition_ |
Delegate decision on a packet to another Chain.
Rule to delegate the decision on what to do with a packet to a filter Chain. If this chain cannot make a determination (continue action returned), Rule evaluation should resume after this rule.
Construct a call rule given a chain to delegate to, without a priority.
A call rule is used to delegate the decision on whether to accept or reject a packet/address combination to another filter Chain. If this called chain does not make a decision then rule evaluation should continue in the calling chain.
chain | The chain to delegate decisions of whether to accept or reject a packet/address combination to. nullptr is not valid. |
condition | The condition used to determine the rule matches a particular packet/address combination given to the action method. The default is {} which indicates the rule matches any packet/address combination. |
std::invalid_argument | if the given chain pointer is null. |
Construct a call rule given a chain to delegate to, with a priority.
A call rule is used to delegate the decision on whether to accept or reject a packet/address combination to another filter Chain.
chain | The chain to delegate decisions of whether to accept or reject a packet/address combination to. nullptr is not valid. |
priority | The priority to accept packets with. A higher number is more important and will be routed first. |
condition | The condition used to determine the rule matches a particular packet/address combination given to the action method. The default is {} which indicates the rule matches any packet/address combination. |
std::invalid_argument | if the given pointer is null. |
|
virtual |
Decide what to do with a Packet.
Determine what action to take with the given packet
sent to the given address
. The possible actions are documented in the Action class. The continue object is always returned if the condition was set and does not match the packet/address combination.
packet | The packet to determine whether to allow or not. |
address | The address the packet will be sent out on if the action dictates it. |
If the condition has not been set or it matches the given packet/address combination then the choice of Action will be delegated to the contained Chain.
If the result from the chain is an accept Action object and no priority has been set on it but this Rule has a priority then the priority will be set.
Implements Rule.
Definition at line 121 of file Call.cpp.
References Rule::condition_, and Action::make_continue().
|
virtual |
|
virtual |
Inequality comparison.
Compares the type of the Rule and the condition (If) if set.
other | The other rule to compare this to. |
true | if this rule is not the same as other . |
false | if this rule is the same as other . |
Compares the chain and priority (if set) associated with the rule as well.
Implements Rule.
Definition at line 170 of file Call.cpp.
References Rule::condition_.
|
virtual |
Equality comparison.
Compares the type of the Rule and the condition (If) if set.
other | The other rule to compare this to. |
true | if this rule is the same as other . |
false | if this rule is not the same as other . |
Compares the chain and priority (if set) associated with the rule as well.
Implements Rule.
Definition at line 157 of file Call.cpp.
References Rule::condition_.
|
protectedvirtual |
Print the rule to the given output stream.
os | The output stream to print to. |
Prints "call <Chain Name> <If Statement>"
or "call <Chain Name> with
priority <If Statement> with priority <priority>"
if the priority is given.
Implements Rule.
Definition at line 93 of file Call.cpp.
References Rule::condition_.