Trait dfw::iptables::IPTables [−][src]
pub trait IPTables { fn get_policy(&self, table: &str, chain: &str) -> Result<String>; fn set_policy(&self, table: &str, chain: &str, policy: &str) -> Result<bool>; fn execute(&self, table: &str, command: &str) -> Result<Output>; fn exists(&self, table: &str, chain: &str, rule: &str) -> Result<bool>; fn chain_exists(&self, table: &str, chain: &str) -> Result<bool>; fn insert(
&self,
table: &str,
chain: &str,
rule: &str,
position: i32
) -> Result<bool>; fn insert_unique(
&self,
table: &str,
chain: &str,
rule: &str,
position: i32
) -> Result<bool>; fn replace(
&self,
table: &str,
chain: &str,
rule: &str,
position: i32
) -> Result<bool>; fn append(&self, table: &str, chain: &str, rule: &str) -> Result<bool>; fn append_unique(
&self,
table: &str,
chain: &str,
rule: &str
) -> Result<bool>; fn append_replace(
&self,
table: &str,
chain: &str,
rule: &str
) -> Result<bool>; fn delete(&self, table: &str, chain: &str, rule: &str) -> Result<bool>; fn delete_all(&self, table: &str, chain: &str, rule: &str) -> Result<bool>; fn list(&self, table: &str, chain: &str) -> Result<Vec<String>>; fn list_table(&self, table: &str) -> Result<Vec<String>>; fn list_chains(&self, table: &str) -> Result<Vec<String>>; fn new_chain(&self, table: &str, chain: &str) -> Result<bool>; fn flush_chain(&self, table: &str, chain: &str) -> Result<bool>; fn rename_chain(
&self,
table: &str,
old_chain: &str,
new_chain: &str
) -> Result<bool>; fn delete_chain(&self, table: &str, chain: &str) -> Result<bool>; fn flush_table(&self, table: &str) -> Result<bool>; fn commit(&self) -> Result<bool>; }
Compatibility trait to generalize the API used by rust-iptables
.
Required Methods
fn get_policy(&self, table: &str, chain: &str) -> Result<String>
Get the default policy for a table/chain.
fn set_policy(&self, table: &str, chain: &str, policy: &str) -> Result<bool>
Set the default policy for a table/chain.
fn execute(&self, table: &str, command: &str) -> Result<Output>
Executes a given command
on the chain.
Returns the command output if successful.
fn exists(&self, table: &str, chain: &str, rule: &str) -> Result<bool>
Checks for the existence of the rule
in the table/chain.
Returns true if the rule exists.
fn chain_exists(&self, table: &str, chain: &str) -> Result<bool>
Checks for the existence of the chain
in the table.
Returns true if the chain exists.
fn insert(
&self,
table: &str,
chain: &str,
rule: &str,
position: i32
) -> Result<bool>
&self,
table: &str,
chain: &str,
rule: &str,
position: i32
) -> Result<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
) -> Result<bool>
&self,
table: &str,
chain: &str,
rule: &str,
position: i32
) -> Result<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
) -> Result<bool>
&self,
table: &str,
chain: &str,
rule: &str,
position: i32
) -> Result<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) -> Result<bool>
Appends rule
to the table/chain.
Returns true
if the rule is appended.
fn append_unique(&self, table: &str, chain: &str, rule: &str) -> Result<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) -> Result<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) -> Result<bool>
Deletes rule
from the table/chain.
Returns true
if the rule is deleted.
fn delete_all(&self, table: &str, chain: &str, rule: &str) -> Result<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) -> Result<Vec<String>>
Lists rules in the table/chain.
fn list_table(&self, table: &str) -> Result<Vec<String>>
Lists rules in the table.
fn list_chains(&self, table: &str) -> Result<Vec<String>>
Lists the name of each chain in the table.
fn new_chain(&self, table: &str, chain: &str) -> Result<bool>
Creates a new user-defined chain.
Returns true
if the chain is created.
fn flush_chain(&self, table: &str, chain: &str) -> Result<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
) -> Result<bool>
&self,
table: &str,
old_chain: &str,
new_chain: &str
) -> Result<bool>
Renames a chain in the table.
Returns true
if the chain is renamed.
fn delete_chain(&self, table: &str, chain: &str) -> Result<bool>
Deletes a user-defined chain in the table.
Returns true
if the chain is deleted.
fn flush_table(&self, table: &str) -> Result<bool>
Flushes all chains in a table.
Returns true
if the chains are flushed.
fn commit(&self) -> Result<bool>
Commit the changes queued. Only has an effect on some implementations
Implementations on Foreign Types
impl IPTables for IPTables
[src]
impl IPTables for IPTables
fn get_policy(&self, table: &str, chain: &str) -> Result<String>
[src]
fn get_policy(&self, table: &str, chain: &str) -> Result<String>
fn set_policy(&self, table: &str, chain: &str, policy: &str) -> Result<bool>
[src]
fn set_policy(&self, table: &str, chain: &str, policy: &str) -> Result<bool>
fn execute(&self, table: &str, command: &str) -> Result<Output>
[src]
fn execute(&self, table: &str, command: &str) -> Result<Output>
fn exists(&self, table: &str, chain: &str, rule: &str) -> Result<bool>
[src]
fn exists(&self, table: &str, chain: &str, rule: &str) -> Result<bool>
fn chain_exists(&self, table: &str, chain: &str) -> Result<bool>
[src]
fn chain_exists(&self, table: &str, chain: &str) -> Result<bool>
fn insert(
&self,
table: &str,
chain: &str,
rule: &str,
position: i32
) -> Result<bool>
[src]
fn insert(
&self,
table: &str,
chain: &str,
rule: &str,
position: i32
) -> Result<bool>
fn insert_unique(
&self,
table: &str,
chain: &str,
rule: &str,
position: i32
) -> Result<bool>
[src]
fn insert_unique(
&self,
table: &str,
chain: &str,
rule: &str,
position: i32
) -> Result<bool>
fn replace(
&self,
table: &str,
chain: &str,
rule: &str,
position: i32
) -> Result<bool>
[src]
fn replace(
&self,
table: &str,
chain: &str,
rule: &str,
position: i32
) -> Result<bool>
fn append(&self, table: &str, chain: &str, rule: &str) -> Result<bool>
[src]
fn append(&self, table: &str, chain: &str, rule: &str) -> Result<bool>
fn append_unique(&self, table: &str, chain: &str, rule: &str) -> Result<bool>
[src]
fn append_unique(&self, table: &str, chain: &str, rule: &str) -> Result<bool>
fn append_replace(&self, table: &str, chain: &str, rule: &str) -> Result<bool>
[src]
fn append_replace(&self, table: &str, chain: &str, rule: &str) -> Result<bool>
fn delete(&self, table: &str, chain: &str, rule: &str) -> Result<bool>
[src]
fn delete(&self, table: &str, chain: &str, rule: &str) -> Result<bool>
fn delete_all(&self, table: &str, chain: &str, rule: &str) -> Result<bool>
[src]
fn delete_all(&self, table: &str, chain: &str, rule: &str) -> Result<bool>
fn list(&self, table: &str, chain: &str) -> Result<Vec<String>>
[src]
fn list(&self, table: &str, chain: &str) -> Result<Vec<String>>
fn list_table(&self, table: &str) -> Result<Vec<String>>
[src]
fn list_table(&self, table: &str) -> Result<Vec<String>>
fn list_chains(&self, table: &str) -> Result<Vec<String>>
[src]
fn list_chains(&self, table: &str) -> Result<Vec<String>>
fn new_chain(&self, table: &str, chain: &str) -> Result<bool>
[src]
fn new_chain(&self, table: &str, chain: &str) -> Result<bool>
fn flush_chain(&self, table: &str, chain: &str) -> Result<bool>
[src]
fn flush_chain(&self, table: &str, chain: &str) -> Result<bool>
fn rename_chain(
&self,
table: &str,
old_chain: &str,
new_chain: &str
) -> Result<bool>
[src]
fn rename_chain(
&self,
table: &str,
old_chain: &str,
new_chain: &str
) -> Result<bool>
fn delete_chain(&self, table: &str, chain: &str) -> Result<bool>
[src]
fn delete_chain(&self, table: &str, chain: &str) -> Result<bool>
fn flush_table(&self, table: &str) -> Result<bool>
[src]
fn flush_table(&self, table: &str) -> Result<bool>
fn commit(&self) -> Result<bool>
[src]
fn commit(&self) -> Result<bool>
Implementors
impl IPTables for IPTablesRestore
impl IPTables for IPTablesDummy
impl IPTables for IPTablesLogger