mavtables
0.2.1
MAVLink router and firewall.
|
#include <Reject.hpp>
Public Member Functions | |
Reject (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_ |
Rule to reject a packet.
Definition at line 35 of file Reject.hpp.
Reject::Reject | ( | std::optional< If > | condition = {} | ) |
Construct a reject rule.
A reject rule is used to reject packet/address combinations that match the condition of the rule.
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. |
Definition at line 42 of file Reject.cpp.
|
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 it will return the reject Action object, otherwise it will return the continue Action object.
Implements Rule.
Definition at line 72 of file Reject.cpp.
References Rule::condition_, Action::make_continue(), and Action::make_reject().
|
virtual |
Return a copy of the Rule polymorphically.
This allows Rule's to be copied without knowing the derived type.
Implements Rule.
Definition at line 84 of file Reject.cpp.
References Rule::condition_.
|
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 . |
Implements Rule.
Definition at line 97 of file Reject.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 . |
Implements Rule.
Definition at line 90 of file Reject.cpp.
References Rule::condition_.
|
protectedvirtual |
Print the rule to the given output stream.
os | The output stream to print to. |
Prints "reject"
or "reject <If Statement>"
if the rule's condition was set.
Implements Rule.
Definition at line 53 of file Reject.cpp.
References Rule::condition_.