aboutsummaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorSimon THOBY <git@nightmared.fr>2022-08-26 21:51:55 +0200
committerSimon THOBY <git@nightmared.fr>2022-09-25 20:23:50 +0200
commitac59df84eb292f8e907fdae3436e589df164e826 (patch)
treea03bfb22d94ebc4b3230a2555ce276eb8e863d59 /examples
parente918159bf7478652e9da41f4a873c6e46b3733ca (diff)
add some trivial serialization/deserialization support in Rust
Diffstat (limited to 'examples')
-rw-r--r--examples/add-rules.rs9
1 files changed, 3 insertions, 6 deletions
diff --git a/examples/add-rules.rs b/examples/add-rules.rs
index 6354c8d..0f89601 100644
--- a/examples/add-rules.rs
+++ b/examples/add-rules.rs
@@ -51,10 +51,7 @@ fn main() -> Result<(), Error> {
let mut batch = Batch::new();
// Create a netfilter table operating on both IPv4 and IPv6 (ProtoFamily::Inet)
- let table = Rc::new(Table::new(
- &CString::new(TABLE_NAME).unwrap(),
- ProtoFamily::Inet,
- ));
+ let table = Rc::new(Table::new(TABLE_NAME, ProtoFamily::Inet));
// Add the table to the batch with the `MsgType::Add` type, thus instructing netfilter to add
// this table under its `ProtoFamily::Inet` ruleset.
batch.add(&Rc::clone(&table), rustables::MsgType::Add);
@@ -62,8 +59,8 @@ fn main() -> Result<(), Error> {
// Create input and output chains under the table we created above.
// Hook the chains to the input and output event hooks, with highest priority (priority zero).
// See the `Chain::set_hook` documentation for details.
- let mut out_chain = Chain::new(&CString::new(OUT_CHAIN_NAME).unwrap(), Rc::clone(&table));
- let mut in_chain = Chain::new(&CString::new(IN_CHAIN_NAME).unwrap(), Rc::clone(&table));
+ let mut out_chain = Chain::new(OUT_CHAIN_NAME, Rc::clone(&table));
+ let mut in_chain = Chain::new(IN_CHAIN_NAME, Rc::clone(&table));
out_chain.set_hook(rustables::Hook::Out, 0);
in_chain.set_hook(rustables::Hook::In, 0);