mavtables
0.2.1
MAVLink router and firewall.
|
#include <Action.hpp>
Public Types | |
enum | Option { ACCEPT, REJECT, CONTINUE, DEFAULT } |
Public Member Functions | |
Action (const Action &other)=default | |
Action (Action &&other)=default | |
Action::Option | action () const |
void | priority (int priority) |
int | priority () const |
Action & | operator= (const Action &other)=default |
Action & | operator= (Action &&other)=default |
Static Public Member Functions | |
static Action | make_accept (std::optional< int > priority={}) |
static Action | make_reject () |
static Action | make_continue () |
static Action | make_default () |
Related Functions | |
(Note that these are not member functions.) | |
bool | operator== (const Action &lhs, const Action &rhs) |
bool | operator!= (const Action &lhs, const Action &rhs) |
std::ostream & | operator<< (std::ostream &os, const Action &action) |
An action that is to be taken with a packet.
This is used as a return value to determine what to do with a packet.
Definition at line 30 of file Action.hpp.
enum Action::Option |
Possible actions.
Enumerator | |
---|---|
ACCEPT | The packet has been accepted, possibly with priority. |
REJECT | The packet has been rejected. |
CONTINUE | Continue evaluating rules. |
DEFAULT | Use the default rule. |
Definition at line 35 of file Action.hpp.
|
default |
Action::Option Action::action | ( | ) | const |
Return the action that has been chosen.
Definition at line 45 of file Action.cpp.
|
static |
Make a new action result with the Action::ACCEPT action.
An accept action indicates that the packet/address combination this action is the response to should be accepted without any further processing.
priority | The priority to accept the packet with. The default is to not apply a priority. |
Definition at line 100 of file Action.cpp.
References ACCEPT, Action(), and priority().
|
static |
Make a new action result with the Action::CONTINUE action.
A continue action indicates that filtering of the packet/address combination this action is the response should continue with the next Rule.
Definition at line 126 of file Action.cpp.
References Action(), and CONTINUE.
|
static |
Make a new action result with the Action::DEFAULT action.
A default action indicates that the default action (defined in Filter) should be taken for the packet/address combination this action is the response to.
Definition at line 140 of file Action.cpp.
References Action(), and DEFAULT.
|
static |
Make a new action result with the Action::REJECT action.
A reject action indicates that the packet/address combination this action is the response to should be rejected without any further processing.
Definition at line 113 of file Action.cpp.
References Action(), and REJECT.
Assignment operator.
other | Action to copy from. |
Assignment operator (by move semantics).
other | Action to move from. |
void Action::priority | ( | int | priority | ) |
Set the priority of the action.
This only has an effect if the action is Action::ACCEPT and the priority has never been set before.
The default priority is 0. A higher priority will result in the packet being prioritized over other packets while a lower (negative) priority will de-prioritize the packet.
priority | The priority to apply to the accept action. |
Definition at line 62 of file Action.cpp.
References ACCEPT, and priority().
int Action::priority | ( | ) | const |
Return the priority if it exists.
Definition at line 80 of file Action.cpp.
Inequality comparison.
lhs | The left hand side action. |
rhs | The right hand side action. |
true | if lhs is not the same as rhs. |
false | if lhs is the same as rhs. |
Definition at line 168 of file Action.cpp.
References action(), and priority().
|
related |
Print the action to the given output stream.
Some examples are:
accept
accept with priority 3
reject
continue
default
os | The output stream to print to. |
action | The action result to print. |
Definition at line 188 of file Action.cpp.
References ACCEPT, action(), CONTINUE, DEFAULT, priority(), and REJECT.
Equality comparison.
lhs | The left hand side action. |
rhs | The right hand side action. |
true | if lhs is the same as rhs. |
false | if lhs is not the same as rhs. |
Definition at line 154 of file Action.cpp.
References action(), and priority().