aboutsummaryrefslogtreecommitdiff
path: root/src/table.rs
diff options
context:
space:
mode:
authorSimon THOBY <git@nightmared.fr>2023-01-08 22:24:40 +0100
committerSimon THOBY <git@nightmared.fr>2023-01-08 22:28:42 +0100
commitdc3c2ffab697b5d8fce7c69f76528fcfdf2edf38 (patch)
treeaf2dcb95c21a009933492ea80d71b25bdb0e24f6 /src/table.rs
parent1d68fa40916295465be142b340f1a6381ea079a1 (diff)
rewrite the examples
Diffstat (limited to 'src/table.rs')
-rw-r--r--src/table.rs8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/table.rs b/src/table.rs
index 63bf669..81a26ef 100644
--- a/src/table.rs
+++ b/src/table.rs
@@ -8,7 +8,7 @@ use crate::sys::{
NFTA_TABLE_FLAGS, NFTA_TABLE_NAME, NFTA_TABLE_USERDATA, NFT_MSG_DELTABLE, NFT_MSG_GETTABLE,
NFT_MSG_NEWTABLE,
};
-use crate::ProtocolFamily;
+use crate::{Batch, ProtocolFamily};
/// Abstraction of a `nftnl_table`, the top level container in netfilter. A table has a protocol
/// family and contains [`Chain`]s that in turn hold the rules.
@@ -32,6 +32,12 @@ impl Table {
res.family = family;
res
}
+
+ /// Appends this rule to `batch`
+ pub fn add_to_batch(self, batch: &mut Batch) -> Self {
+ batch.add(&self, crate::MsgType::Add);
+ self
+ }
}
impl NfNetlinkObject for Table {