Crates.io | libnftables1-sys |
lib.rs | libnftables1-sys |
version | 0.1.1 |
source | src |
created_at | 2023-02-25 10:55:22.157851 |
updated_at | 2024-10-16 20:26:30.194306 |
description | FFI bindings for libnftables1. |
homepage | https://git.sr.ht/~upto/seqknock/ |
repository | https://git.sr.ht/~upto/seqknock/tree/master/item/libnftables-sys |
max_upload_size | |
id | 794284 |
size | 26,430 |
Stolen with pride from https://github.com/chifflier/libnftables-sys and updated for libnftables1.
The libnftables-sys
crate provides declarations and linkage for the
libnftables
C library.
The libnftables-sys
crate provides minimal abstractions over the native
libnftables
library functions.
In order to use the libnftables-sys
crate, you must have the libnftables
library installed.
Add libnftables-sys
as a dependency in Cargo.toml
:
[dependencies]
libnftables-sys = "0.1"
Import the libnftables_sys
crate and use the functions as they're defined in
the native libnftables
library. You can also use the Nftables
struct, a very
thin layer on top of the native functions.
extern crate libnftables_sys;
use libnftables_sys::*;
fn main() {
let mut nft = Nftables::new();
let cmd = CStr::from_bytes_with_nul(b"list ruleset\0").unwrap();
let (rc,output,error) = nft.run_cmd(cmd.as_ptr());
}
See the examples directory for complete examples.
This crate has the same license as libnftables, which is GPL version 2 only.