mavtables  0.2.1
MAVLink router and firewall.
Public Member Functions | Friends | List of all members
Filter Class Reference

#include <Filter.hpp>

Collaboration diagram for Filter:
Collaboration graph

Public Member Functions

 Filter (const Filter &other)=default
 
 Filter (Filter &&other)=default
 
 Filter (Chain default_chain, bool accept_by_default=false)
 
TEST_VIRTUAL ~Filter ()=default
 
TEST_VIRTUAL std::pair< bool, int > will_accept (const Packet &packet, const MAVAddress &address)
 
Filteroperator= (const Filter &other)=default
 
Filteroperator= (Filter &&other)=default
 

Friends

bool operator== (const Filter &lhs, const Filter &rhs)
 
bool operator!= (const Filter &lhs, const Filter &rhs)
 

Detailed Description

The filter used to determine whether to accept or reject a packet.

See also
Chain
Rule
If

Definition at line 38 of file Filter.hpp.

Constructor & Destructor Documentation

◆ Filter() [1/3]

Filter::Filter ( const Filter other)
default

Copy constructor.

Parameters
otherFilter to copy from.

◆ Filter() [2/3]

Filter::Filter ( Filter &&  other)
default

Move constructor.

Parameters
otherFilter to move from.

◆ Filter() [3/3]

Filter::Filter ( Chain  default_chain,
bool  accept_by_default = false 
)

Construct a new packet filter.

Parameters
default_chainThe Chain that all filtering begins with.
accept_by_defaultWhether to accept (true) or reject (false) packets that don't match any rules in the default chain or any chains called by the default chain. The default value is false and thus to reject unmatched packets.

Definition at line 36 of file Filter.cpp.

◆ ~Filter()

TEST_VIRTUAL Filter::~Filter ( )
default

Member Function Documentation

◆ operator=() [1/2]

Filter& Filter::operator= ( const Filter other)
default

Assignment operator.

Parameters
otherFilter to copy from.

◆ operator=() [2/2]

Filter& Filter::operator= ( Filter &&  other)
default

Assignment operator (by move semantics).

Parameters
otherFilter to move from.

◆ will_accept()

std::pair< bool, int > Filter::will_accept ( const Packet packet,
const MAVAddress address 
)

Determine whether to accept or reject a packet/address combination.

Parameters
packetThe packet to determine whether to allow or not.
addressThe address the packet will be sent out on if the action allows it.
Returns
A pair (tuple) with the first value being whether to accept the packet or not and the second being the priority to use when sending the packet. The second value is only defined if the first value is true (accept).

Definition at line 53 of file Filter.cpp.

References Action::ACCEPT, Chain::action(), Action::action(), Action::CONTINUE, Action::DEFAULT, Action::priority(), and Action::REJECT.

Here is the call graph for this function:

Friends And Related Function Documentation

◆ operator!=

bool operator!= ( const Filter lhs,
const Filter rhs 
)
friend

Inequality comparison.

The default chain and default action are compared.

Parameters
lhsThe left hand side packet filter.
rhsThe right hand side packet filter.
Return values
trueif lhs is not the same as rhs.
falseif lhs is the same as rhs.

Definition at line 102 of file Filter.cpp.

◆ operator==

bool operator== ( const Filter lhs,
const Filter rhs 
)
friend

Equality comparison.

The default chain and default action are compared.

Parameters
lhsThe left hand side packet filter.
rhsThe right hand side packet filter.
Return values
trueif lhs is the same as rhs.
falseif lhs is not the same as rhs.

Definition at line 85 of file Filter.cpp.


The documentation for this class was generated from the following files: