pub struct FirewallEngine {
pub filter: FirewallTable,
pub nat: FirewallTable,
pub mangle: FirewallTable,
pub rule_engine: RuleEngine,
pub total_packets: u64,
pub dropped_packets: u64,
}Expand description
The main firewall engine that manages tables and processes packets
Fields§
§filter: FirewallTableFilter table
nat: FirewallTableNAT table
mangle: FirewallTableMangle table
rule_engine: RuleEngineRule engine for evaluating individual rules
total_packets: u64Packet counter
dropped_packets: u64Dropped packet counter
Implementations§
Source§impl FirewallEngine
impl FirewallEngine
Sourcepub fn add_rule(&mut self, rule: FirewallRule) -> u64
pub fn add_rule(&mut self, rule: FirewallRule) -> u64
Add a rule to the rule engine and return its ID
Sourcepub fn add_to_filter_chain(&mut self, chain_name: &str, rule_id: u64) -> bool
pub fn add_to_filter_chain(&mut self, chain_name: &str, rule_id: u64) -> bool
Add a rule ID to a specific chain in the filter table
Sourcepub fn add_to_nat_chain(&mut self, chain_name: &str, rule_id: u64) -> bool
pub fn add_to_nat_chain(&mut self, chain_name: &str, rule_id: u64) -> bool
Add a rule ID to a specific chain in the NAT table
Sourcepub fn set_filter_policy(
&mut self,
chain_name: &str,
policy: ChainPolicy,
) -> bool
pub fn set_filter_policy( &mut self, chain_name: &str, policy: ChainPolicy, ) -> bool
Set the policy for a chain in the filter table
Sourcepub fn process_packet(
&mut self,
hook: HookPoint,
metadata: &PacketMetadata,
) -> Verdict
pub fn process_packet( &mut self, hook: HookPoint, metadata: &PacketMetadata, ) -> Verdict
Process a packet through chains at a specific hook point
Evaluates mangle first, then filter (or nat for PreRouting/PostRouting). Returns the final verdict.