mavtables
0.2.1
MAVLink router and firewall.
|
#include <Rule.hpp>
Public Member Functions | |
Rule (std::optional< If > condition={}) | |
virtual | ~Rule () |
virtual Action | action (const Packet &packet, const MAVAddress &address) const =0 |
virtual std::unique_ptr< Rule > | clone () const =0 |
virtual bool | operator== (const Rule &other) const =0 |
virtual bool | operator!= (const Rule &other) const =0 |
Protected Member Functions | |
virtual std::ostream & | print_ (std::ostream &os) const =0 |
Protected Attributes | |
std::optional< If > | condition_ |
Friends | |
std::ostream & | operator<< (std::ostream &os, const Rule &action) |
Base class of all rules, used in filter Chain's.
Rule's are used to determine an Action to take with a packet based on its type, source address, and destination address. They are very much like the rules found in a typical software defined firewalls.
Rule::Rule | ( | std::optional< If > | condition = {} | ) |
|
pure 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. |
Implemented in GoTo, Call, Accept, and Reject.
|
pure virtual |
|
pure virtual |
|
pure virtual |
|
protectedpure virtual |
|
friend |
Print the given rule to the given output stream.
Some examples are:
accept
accept with priority 3
reject if ENCAPSULATED_DATA
call gcs_in if from 192.168
goto autopilot_out
os | The output stream to print to. |
rule | The rule (or any child of Rule) to print. |