Struct iptables::IPTables
[−]
[src]
pub struct IPTables { pub cmd: &'static str, pub has_check: bool, pub has_wait: bool, }
Contains the iptables command and shows if it supports -w and -C options.
Use new
method to create a new instance of this struct.
Fields
cmd: &'static str
The utility command which must be 'iptables' or 'ip6tables'.
has_check: bool
Indicates if iptables has -C (--check) option
has_wait: bool
Indicates if iptables has -w (--wait) option
Methods
impl IPTables
[src]
fn exists(&self, table: &str, chain: &str, rule: &str) -> IPTResult<bool>
Checks for the existence of the rule
in the table/chain.
Returns true if the rule exists.
fn insert(&self,
table: &str,
chain: &str,
rule: &str,
position: i32)
-> IPTResult<bool>
table: &str,
chain: &str,
rule: &str,
position: i32)
-> IPTResult<bool>
Inserts rule
in the position
to the table/chain.
Returns true
if the rule is inserted.
fn insert_unique(&self,
table: &str,
chain: &str,
rule: &str,
position: i32)
-> IPTResult<bool>
table: &str,
chain: &str,
rule: &str,
position: i32)
-> IPTResult<bool>
Inserts rule
in the position
to the table/chain if it does not exist.
Returns true
if the rule is inserted.
fn replace(&self,
table: &str,
chain: &str,
rule: &str,
position: i32)
-> IPTResult<bool>
table: &str,
chain: &str,
rule: &str,
position: i32)
-> IPTResult<bool>
Replaces rule
in the position
to the table/chain.
Returns true
if the rule is replaced.
fn append(&self, table: &str, chain: &str, rule: &str) -> IPTResult<bool>
Appends rule
to the table/chain.
Returns true
if the rule is appended.
fn append_unique(&self, table: &str, chain: &str, rule: &str) -> IPTResult<bool>
Appends rule
to the table/chain if it does not exist.
Returns true
if the rule is appended.
fn append_replace(&self,
table: &str,
chain: &str,
rule: &str)
-> IPTResult<bool>
table: &str,
chain: &str,
rule: &str)
-> IPTResult<bool>
Appends or replaces rule
to the table/chain if it does not exist.
Returns true
if the rule is appended or replaced.
fn delete(&self, table: &str, chain: &str, rule: &str) -> IPTResult<bool>
Deletes rule
from the table/chain.
Returns true
if the rule is deleted.
fn delete_all(&self, table: &str, chain: &str, rule: &str) -> IPTResult<bool>
Deletes all repetition of the rule
from the table/chain.
Returns true
if the rules are deleted.
fn list(&self, table: &str, chain: &str) -> IPTResult<Vec<String>>
Lists rules in the table/chain.
fn list_table(&self, table: &str) -> IPTResult<Vec<String>>
Lists rules in the table.
fn list_chains(&self, table: &str) -> IPTResult<Vec<String>>
Lists the name of each chain in the table.
fn new_chain(&self, table: &str, chain: &str) -> IPTResult<bool>
Creates a new user-defined chain.
Returns true
if the chain is created.
fn flush_chain(&self, table: &str, chain: &str) -> IPTResult<bool>
Flushes (deletes all rules) a chain.
Returns true
if the chain is flushed.
fn rename_chain(&self,
table: &str,
old_chain: &str,
new_chain: &str)
-> IPTResult<bool>
table: &str,
old_chain: &str,
new_chain: &str)
-> IPTResult<bool>
Renames a chain in the table.
Returns true
if the chain is renamed.
fn delete_chain(&self, table: &str, chain: &str) -> IPTResult<bool>
Deletes a user-defined chain in the table.
Returns true
if the chain is deleted.
fn flush_table(&self, table: &str) -> IPTResult<bool>
Flushes all chains in a table.
Returns true
if the chains are flushed.