From 244b28e9dc93231e8e098192d54558e5d06066a2 Mon Sep 17 00:00:00 2001 From: Michael Yang Date: Mon, 3 Jun 2024 06:09:41 +1000 Subject: [PATCH] feat(nftnl-sys): update libnftnl all the way to 1.2.6 Fix bash script bindgen options and version comment. Add version features to `nftnl-sys` and `nftnl`. Add `/lib/` to .gitignore to keep libnftnl directories. --- .gitignore | 2 +- nftnl-sys/Cargo.toml | 24 +- nftnl-sys/build.rs | 30 +- nftnl-sys/generate_bindings.sh | 31 +- nftnl-sys/libnftnl.h | 3 + nftnl-sys/src/lib.rs | 44 +- nftnl-sys/src/nftnl_1_1_3.rs | 1383 +++++++++++++++++++++++++++++ nftnl-sys/src/nftnl_1_1_4.rs | 1393 +++++++++++++++++++++++++++++ nftnl-sys/src/nftnl_1_1_5.rs | 1404 ++++++++++++++++++++++++++++++ nftnl-sys/src/nftnl_1_1_6.rs | 1426 ++++++++++++++++++++++++++++++ nftnl-sys/src/nftnl_1_1_7.rs | 1427 ++++++++++++++++++++++++++++++ nftnl-sys/src/nftnl_1_1_8.rs | 1446 +++++++++++++++++++++++++++++++ nftnl-sys/src/nftnl_1_1_9.rs | 1474 +++++++++++++++++++++++++++++++ nftnl-sys/src/nftnl_1_2_0.rs | 1476 +++++++++++++++++++++++++++++++ nftnl-sys/src/nftnl_1_2_1.rs | 1489 +++++++++++++++++++++++++++++++ nftnl-sys/src/nftnl_1_2_2.rs | 1489 +++++++++++++++++++++++++++++++ nftnl-sys/src/nftnl_1_2_3.rs | 1489 +++++++++++++++++++++++++++++++ nftnl-sys/src/nftnl_1_2_4.rs | 1489 +++++++++++++++++++++++++++++++ nftnl-sys/src/nftnl_1_2_5.rs | 1494 ++++++++++++++++++++++++++++++++ nftnl-sys/src/nftnl_1_2_6.rs | 1494 ++++++++++++++++++++++++++++++++ nftnl/Cargo.toml | 14 + 21 files changed, 20495 insertions(+), 26 deletions(-) create mode 100644 nftnl-sys/src/nftnl_1_1_3.rs create mode 100644 nftnl-sys/src/nftnl_1_1_4.rs create mode 100644 nftnl-sys/src/nftnl_1_1_5.rs create mode 100644 nftnl-sys/src/nftnl_1_1_6.rs create mode 100644 nftnl-sys/src/nftnl_1_1_7.rs create mode 100644 nftnl-sys/src/nftnl_1_1_8.rs create mode 100644 nftnl-sys/src/nftnl_1_1_9.rs create mode 100644 nftnl-sys/src/nftnl_1_2_0.rs create mode 100644 nftnl-sys/src/nftnl_1_2_1.rs create mode 100644 nftnl-sys/src/nftnl_1_2_2.rs create mode 100644 nftnl-sys/src/nftnl_1_2_3.rs create mode 100644 nftnl-sys/src/nftnl_1_2_4.rs create mode 100644 nftnl-sys/src/nftnl_1_2_5.rs create mode 100644 nftnl-sys/src/nftnl_1_2_6.rs diff --git a/.gitignore b/.gitignore index 143b1ca..46139af 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,4 @@ - +/lib/ /target/ **/*.rs.bk Cargo.lock diff --git a/nftnl-sys/Cargo.toml b/nftnl-sys/Cargo.toml index 8543dfd..301cfc5 100644 --- a/nftnl-sys/Cargo.toml +++ b/nftnl-sys/Cargo.toml @@ -13,11 +13,25 @@ edition = "2018" [features] nftnl-1-0-7 = [] -nftnl-1-0-8 = ["nftnl-1-0-7"] -nftnl-1-0-9 = ["nftnl-1-0-8"] -nftnl-1-1-0 = ["nftnl-1-0-9"] -nftnl-1-1-1 = ["nftnl-1-1-0"] -nftnl-1-1-2 = ["nftnl-1-1-1"] +nftnl-1-0-8 = [] +nftnl-1-0-9 = [] +nftnl-1-1-0 = [] +nftnl-1-1-1 = [] +nftnl-1-1-2 = [] +nftnl-1-1-3 = [] +nftnl-1-1-4 = [] +nftnl-1-1-5 = [] +nftnl-1-1-6 = [] +nftnl-1-1-7 = [] +nftnl-1-1-8 = [] +nftnl-1-1-9 = [] +nftnl-1-2-0 = [] +nftnl-1-2-1 = [] +nftnl-1-2-2 = [] +nftnl-1-2-3 = [] +nftnl-1-2-4 = [] +nftnl-1-2-5 = [] +nftnl-1-2-6 = [] [dependencies] cfg-if = "1.0" diff --git a/nftnl-sys/build.rs b/nftnl-sys/build.rs index 6b24498..c1f15e9 100644 --- a/nftnl-sys/build.rs +++ b/nftnl-sys/build.rs @@ -3,7 +3,35 @@ extern crate pkg_config; use std::{env, path::PathBuf}; cfg_if::cfg_if! { - if #[cfg(feature = "nftnl-1-1-2")] { + if #[cfg(feature = "nftnl-1-2-6")] { + const MIN_VERSION: &str = "1.2.6"; + } else if #[cfg(feature = "nftnl-1-2-5")] { + const MIN_VERSION: &str = "1.2.5"; + } else if #[cfg(feature = "nftnl-1-2-4")] { + const MIN_VERSION: &str = "1.2.4"; + } else if #[cfg(feature = "nftnl-1-2-3")] { + const MIN_VERSION: &str = "1.2.3"; + } else if #[cfg(feature = "nftnl-1-2-2")] { + const MIN_VERSION: &str = "1.2.2"; + } else if #[cfg(feature = "nftnl-1-2-1")] { + const MIN_VERSION: &str = "1.2.1"; + } else if #[cfg(feature = "nftnl-1-2-0")] { + const MIN_VERSION: &str = "1.2.0"; + } else if #[cfg(feature = "nftnl-1-1-9")] { + const MIN_VERSION: &str = "1.1.9"; + } else if #[cfg(feature = "nftnl-1-1-8")] { + const MIN_VERSION: &str = "1.1.8"; + } else if #[cfg(feature = "nftnl-1-1-7")] { + const MIN_VERSION: &str = "1.1.7"; + } else if #[cfg(feature = "nftnl-1-1-6")] { + const MIN_VERSION: &str = "1.1.6"; + } else if #[cfg(feature = "nftnl-1-1-5")] { + const MIN_VERSION: &str = "1.1.5"; + } else if #[cfg(feature = "nftnl-1-1-4")] { + const MIN_VERSION: &str = "1.1.4"; + } else if #[cfg(feature = "nftnl-1-1-3")] { + const MIN_VERSION: &str = "1.1.3"; + } else if #[cfg(feature = "nftnl-1-1-2")] { const MIN_VERSION: &str = "1.1.2"; } else if #[cfg(feature = "nftnl-1-1-1")] { const MIN_VERSION: &str = "1.1.1"; diff --git a/nftnl-sys/generate_bindings.sh b/nftnl-sys/generate_bindings.sh index dc1455c..54f4ef8 100755 --- a/nftnl-sys/generate_bindings.sh +++ b/nftnl-sys/generate_bindings.sh @@ -15,26 +15,25 @@ bindgen \ --no-doc-comments \ --use-core \ --no-prepend-enum-name \ - --whitelist-function '^nftnl_.+$' \ - --whitelist-type '^nftnl_.+$' \ - --whitelist-var '^nftnl_.+$' \ - --whitelist-var '^NFTNL_.+$' \ - --blacklist-type '(FILE|iovec)' \ - --blacklist-type '^_IO_.+$' \ - --blacklist-type '^__.+$' \ - --blacklist-type 'nlmsghdr' \ - --raw-line 'use libc::{c_char, c_int, c_void, iovec, nlmsghdr, FILE};' \ + --allowlist-function '^nftnl_.+$' \ + --allowlist-type '^nftnl_.+$' \ + --allowlist-var '^nftnl_.+$' \ + --allowlist-var '^NFTNL_.+$' \ + --blocklist-type '(FILE|iovec)' \ + --blocklist-type '^_IO_.+$' \ + --blocklist-type '^__.+$' \ + --blocklist-type 'nlmsghdr' \ + --raw-line 'use libc::{c_char, c_int, c_uint, c_void, iovec, nlmsghdr, FILE};' \ --raw-line 'use core::option::Option;' \ --ctypes-prefix 'libc' \ -o $BINDING_PATH \ - libnftnl.h --\ - -I$LIBNFTNL_PATH/include + libnftnl.h -- -I$LIBNFTNL_PATH/include # Tidy up and correct things I could not manage to configure bindgen to do for me -sed -i 's/libc::\(c_[a-z]*\)/\1/g' $BINDING_PATH +sed -i 's/libc::\(c_[a-z]*\)/\1/g' $BINDING_PATH sed -i 's/::core::option::Option/Option/g' $BINDING_PATH sed -i 's/_bindgen_ty_[0-9]\+/u32/g' $BINDING_PATH -sed -i 's/pub type u32 = u32;//g' $BINDING_PATH +sed -i 's/pub type u32 = c_uint;//g' $BINDING_PATH sed -i '/#\[derive(Debug, Copy, Clone)\]/d' $BINDING_PATH # Change struct bodies to (c_void); @@ -45,10 +44,9 @@ sed -i -e '/^pub struct .* {$/ { s/ {\n *_unused: \[u8; 0\],\n}/(c_void);\n/ }' "$BINDING_PATH" - # Remove all }\nextern "C" { to condense code a bit # Search regex: }\nextern "C" { -# Replace string: +# Replace string: sed -i -e '/^extern "C" {$/ { :loop n @@ -62,7 +60,4 @@ sed -i -e '/^extern "C" {$/ { } }' "$BINDING_PATH" -# Add bindgen version to comment at start of file -sed -i "1s/bindgen/$(bindgen --version)/" $BINDING_PATH - rustfmt $BINDING_PATH diff --git a/nftnl-sys/libnftnl.h b/nftnl-sys/libnftnl.h index e6eb221..180abdf 100644 --- a/nftnl-sys/libnftnl.h +++ b/nftnl-sys/libnftnl.h @@ -1,3 +1,6 @@ +// for missing `iovec` +#include + #include #include #include diff --git a/nftnl-sys/src/lib.rs b/nftnl-sys/src/lib.rs index eeb6734..3d3a473 100644 --- a/nftnl-sys/src/lib.rs +++ b/nftnl-sys/src/lib.rs @@ -45,7 +45,49 @@ pub use libc; cfg_if::cfg_if! { - if #[cfg(feature = "nftnl-1-1-2")] { + if #[cfg(feature = "nftnl-1-2-6")] { + mod nftnl_1_2_6; + pub use self::nftnl_1_2_6::*; + } else if #[cfg(feature = "nftnl-1-2-5")] { + mod nftnl_1_2_5; + pub use self::nftnl_1_2_5::*; + } else if #[cfg(feature = "nftnl-1-2-4")] { + mod nftnl_1_2_4; + pub use self::nftnl_1_2_4::*; + } else if #[cfg(feature = "nftnl-1-2-3")] { + mod nftnl_1_2_3; + pub use self::nftnl_1_2_3::*; + } else if #[cfg(feature = "nftnl-1-2-2")] { + mod nftnl_1_2_2; + pub use self::nftnl_1_2_2::*; + } else if #[cfg(feature = "nftnl-1-2-1")] { + mod nftnl_1_2_1; + pub use self::nftnl_1_2_1::*; + } else if #[cfg(feature = "nftnl-1-2-0")] { + mod nftnl_1_2_0; + pub use self::nftnl_1_2_0::*; + } else if #[cfg(feature = "nftnl-1-1-9")] { + mod nftnl_1_1_9; + pub use self::nftnl_1_1_9::*; + } else if #[cfg(feature = "nftnl-1-1-8")] { + mod nftnl_1_1_8; + pub use self::nftnl_1_1_8::*; + } else if #[cfg(feature = "nftnl-1-1-7")] { + mod nftnl_1_1_7; + pub use self::nftnl_1_1_7::*; + } else if #[cfg(feature = "nftnl-1-1-6")] { + mod nftnl_1_1_6; + pub use self::nftnl_1_1_6::*; + } else if #[cfg(feature = "nftnl-1-1-5")] { + mod nftnl_1_1_5; + pub use self::nftnl_1_1_5::*; + } else if #[cfg(feature = "nftnl-1-1-4")] { + mod nftnl_1_1_4; + pub use self::nftnl_1_1_4::*; + } else if #[cfg(feature = "nftnl-1-1-3")] { + mod nftnl_1_1_3; + pub use self::nftnl_1_1_3::*; + } else if #[cfg(feature = "nftnl-1-1-2")] { mod nftnl_1_1_2; pub use self::nftnl_1_1_2::*; } else if #[cfg(feature = "nftnl-1-1-1")] { diff --git a/nftnl-sys/src/nftnl_1_1_3.rs b/nftnl-sys/src/nftnl_1_1_3.rs new file mode 100644 index 0000000..696eb4d --- /dev/null +++ b/nftnl-sys/src/nftnl_1_1_3.rs @@ -0,0 +1,1383 @@ +/* automatically generated by rust-bindgen 0.69.4 */ + +use core::option::Option; +use libc::{c_char, c_int, c_uint, c_void, iovec, nlmsghdr, FILE}; + +pub const NFTNL_UDATA_COMMENT_MAXLEN: u32 = 128; +#[repr(C)] +pub struct nftnl_batch(c_void); + +extern "C" { + pub fn nftnl_batch_alloc(pg_size: u32, pg_overrun_size: u32) -> *mut nftnl_batch; + + pub fn nftnl_batch_update(batch: *mut nftnl_batch) -> c_int; + + pub fn nftnl_batch_free(batch: *mut nftnl_batch); + + pub fn nftnl_batch_buffer(batch: *mut nftnl_batch) -> *mut c_void; + + pub fn nftnl_batch_buffer_len(batch: *mut nftnl_batch) -> u32; + + pub fn nftnl_batch_iovec_len(batch: *mut nftnl_batch) -> c_int; + + pub fn nftnl_batch_iovec(batch: *mut nftnl_batch, iov: *mut iovec, iovlen: u32); +} +pub const NFTNL_PARSE_EBADINPUT: u32 = 0; +pub const NFTNL_PARSE_EMISSINGNODE: u32 = 1; +pub const NFTNL_PARSE_EBADTYPE: u32 = 2; +pub const NFTNL_PARSE_EOPNOTSUPP: u32 = 3; + +pub const NFTNL_OUTPUT_DEFAULT: nftnl_output_type = 0; +pub const NFTNL_OUTPUT_XML: nftnl_output_type = 1; +pub const NFTNL_OUTPUT_JSON: nftnl_output_type = 2; +pub type nftnl_output_type = c_uint; +pub const NFTNL_OF_EVENT_NEW: nftnl_output_flags = 1; +pub const NFTNL_OF_EVENT_DEL: nftnl_output_flags = 2; +pub const NFTNL_OF_EVENT_ANY: nftnl_output_flags = 3; +pub type nftnl_output_flags = c_uint; +pub const NFTNL_CMD_UNSPEC: nftnl_cmd_type = 0; +pub const NFTNL_CMD_ADD: nftnl_cmd_type = 1; +pub const NFTNL_CMD_INSERT: nftnl_cmd_type = 2; +pub const NFTNL_CMD_DELETE: nftnl_cmd_type = 3; +pub const NFTNL_CMD_REPLACE: nftnl_cmd_type = 4; +pub const NFTNL_CMD_FLUSH: nftnl_cmd_type = 5; +pub const NFTNL_CMD_MAX: nftnl_cmd_type = 6; +pub type nftnl_cmd_type = c_uint; +pub const NFTNL_PARSE_NONE: nftnl_parse_type = 0; +pub const NFTNL_PARSE_XML: nftnl_parse_type = 1; +pub const NFTNL_PARSE_JSON: nftnl_parse_type = 2; +pub const NFTNL_PARSE_MAX: nftnl_parse_type = 3; +pub type nftnl_parse_type = c_uint; +#[repr(C)] +pub struct nftnl_parse_err(c_void); + +extern "C" { + pub fn nftnl_nlmsg_build_hdr( + buf: *mut c_char, + type_: u16, + family: u16, + flags: u16, + seq: u32, + ) -> *mut nlmsghdr; + + pub fn nftnl_parse_err_alloc() -> *mut nftnl_parse_err; + + pub fn nftnl_parse_err_free(arg1: *mut nftnl_parse_err); + + pub fn nftnl_parse_perror(str_: *const c_char, err: *mut nftnl_parse_err) -> c_int; + + pub fn nftnl_batch_is_supported() -> c_int; + + pub fn nftnl_batch_begin(buf: *mut c_char, seq: u32) -> *mut nlmsghdr; + + pub fn nftnl_batch_end(buf: *mut c_char, seq: u32) -> *mut nlmsghdr; +} +#[repr(C)] +pub struct nftnl_chain(c_void); + +#[repr(C)] +pub struct nftnl_rule(c_void); + +extern "C" { + pub fn nftnl_chain_alloc() -> *mut nftnl_chain; + + pub fn nftnl_chain_free(arg1: *const nftnl_chain); +} +pub const NFTNL_CHAIN_NAME: nftnl_chain_attr = 0; +pub const NFTNL_CHAIN_FAMILY: nftnl_chain_attr = 1; +pub const NFTNL_CHAIN_TABLE: nftnl_chain_attr = 2; +pub const NFTNL_CHAIN_HOOKNUM: nftnl_chain_attr = 3; +pub const NFTNL_CHAIN_PRIO: nftnl_chain_attr = 4; +pub const NFTNL_CHAIN_POLICY: nftnl_chain_attr = 5; +pub const NFTNL_CHAIN_USE: nftnl_chain_attr = 6; +pub const NFTNL_CHAIN_BYTES: nftnl_chain_attr = 7; +pub const NFTNL_CHAIN_PACKETS: nftnl_chain_attr = 8; +pub const NFTNL_CHAIN_HANDLE: nftnl_chain_attr = 9; +pub const NFTNL_CHAIN_TYPE: nftnl_chain_attr = 10; +pub const NFTNL_CHAIN_DEV: nftnl_chain_attr = 11; +pub const __NFTNL_CHAIN_MAX: nftnl_chain_attr = 12; +pub type nftnl_chain_attr = c_uint; +extern "C" { + pub fn nftnl_chain_is_set(c: *const nftnl_chain, attr: u16) -> bool; + + pub fn nftnl_chain_unset(c: *mut nftnl_chain, attr: u16); + + pub fn nftnl_chain_set(t: *mut nftnl_chain, attr: u16, data: *const c_void); + + pub fn nftnl_chain_set_data( + t: *mut nftnl_chain, + attr: u16, + data: *const c_void, + data_len: u32, + ) -> c_int; + + pub fn nftnl_chain_set_u8(t: *mut nftnl_chain, attr: u16, data: u8); + + pub fn nftnl_chain_set_u32(t: *mut nftnl_chain, attr: u16, data: u32); + + pub fn nftnl_chain_set_s32(t: *mut nftnl_chain, attr: u16, data: i32); + + pub fn nftnl_chain_set_u64(t: *mut nftnl_chain, attr: u16, data: u64); + + pub fn nftnl_chain_set_str(t: *mut nftnl_chain, attr: u16, str_: *const c_char) -> c_int; + + pub fn nftnl_chain_get(c: *const nftnl_chain, attr: u16) -> *const c_void; + + pub fn nftnl_chain_get_data( + c: *const nftnl_chain, + attr: u16, + data_len: *mut u32, + ) -> *const c_void; + + pub fn nftnl_chain_get_str(c: *const nftnl_chain, attr: u16) -> *const c_char; + + pub fn nftnl_chain_get_u8(c: *const nftnl_chain, attr: u16) -> u8; + + pub fn nftnl_chain_get_u32(c: *const nftnl_chain, attr: u16) -> u32; + + pub fn nftnl_chain_get_s32(c: *const nftnl_chain, attr: u16) -> i32; + + pub fn nftnl_chain_get_u64(c: *const nftnl_chain, attr: u16) -> u64; + + pub fn nftnl_chain_rule_add(rule: *mut nftnl_rule, c: *mut nftnl_chain); + + pub fn nftnl_chain_rule_del(rule: *mut nftnl_rule); + + pub fn nftnl_chain_rule_add_tail(rule: *mut nftnl_rule, c: *mut nftnl_chain); + + pub fn nftnl_chain_rule_insert_at(rule: *mut nftnl_rule, pos: *mut nftnl_rule); + + pub fn nftnl_chain_rule_append_at(rule: *mut nftnl_rule, pos: *mut nftnl_rule); + + pub fn nftnl_chain_nlmsg_build_payload(nlh: *mut nlmsghdr, t: *const nftnl_chain); + + pub fn nftnl_chain_parse( + c: *mut nftnl_chain, + type_: nftnl_parse_type, + data: *const c_char, + err: *mut nftnl_parse_err, + ) -> c_int; + + pub fn nftnl_chain_parse_file( + c: *mut nftnl_chain, + type_: nftnl_parse_type, + fp: *mut FILE, + err: *mut nftnl_parse_err, + ) -> c_int; + + pub fn nftnl_chain_snprintf( + buf: *mut c_char, + size: usize, + t: *const nftnl_chain, + type_: u32, + flags: u32, + ) -> c_int; + + pub fn nftnl_chain_fprintf( + fp: *mut FILE, + c: *const nftnl_chain, + type_: u32, + flags: u32, + ) -> c_int; + + pub fn nftnl_chain_nlmsg_parse(nlh: *const nlmsghdr, t: *mut nftnl_chain) -> c_int; + + pub fn nftnl_rule_foreach( + c: *mut nftnl_chain, + cb: Option c_int>, + data: *mut c_void, + ) -> c_int; + + pub fn nftnl_rule_lookup_byindex(c: *mut nftnl_chain, index: u32) -> *mut nftnl_rule; +} +#[repr(C)] +pub struct nftnl_rule_iter(c_void); + +extern "C" { + pub fn nftnl_rule_iter_create(c: *const nftnl_chain) -> *mut nftnl_rule_iter; + + pub fn nftnl_rule_iter_next(iter: *mut nftnl_rule_iter) -> *mut nftnl_rule; + + pub fn nftnl_rule_iter_destroy(iter: *mut nftnl_rule_iter); +} +#[repr(C)] +pub struct nftnl_chain_list(c_void); + +extern "C" { + pub fn nftnl_chain_list_alloc() -> *mut nftnl_chain_list; + + pub fn nftnl_chain_list_free(list: *mut nftnl_chain_list); + + pub fn nftnl_chain_list_is_empty(list: *const nftnl_chain_list) -> c_int; + + pub fn nftnl_chain_list_foreach( + chain_list: *mut nftnl_chain_list, + cb: Option c_int>, + data: *mut c_void, + ) -> c_int; + + pub fn nftnl_chain_list_lookup_byname( + chain_list: *mut nftnl_chain_list, + chain: *const c_char, + ) -> *mut nftnl_chain; + + pub fn nftnl_chain_list_add(r: *mut nftnl_chain, list: *mut nftnl_chain_list); + + pub fn nftnl_chain_list_add_tail(r: *mut nftnl_chain, list: *mut nftnl_chain_list); + + pub fn nftnl_chain_list_del(c: *mut nftnl_chain); +} +#[repr(C)] +pub struct nftnl_chain_list_iter(c_void); + +extern "C" { + pub fn nftnl_chain_list_iter_create(l: *const nftnl_chain_list) -> *mut nftnl_chain_list_iter; + + pub fn nftnl_chain_list_iter_next(iter: *mut nftnl_chain_list_iter) -> *mut nftnl_chain; + + pub fn nftnl_chain_list_iter_destroy(iter: *mut nftnl_chain_list_iter); +} +#[repr(C)] +pub struct nftnl_expr(c_void); + +pub const NFTNL_EXPR_NAME: u32 = 0; +pub const NFTNL_EXPR_BASE: u32 = 1; + +extern "C" { + pub fn nftnl_expr_alloc(name: *const c_char) -> *mut nftnl_expr; + + pub fn nftnl_expr_free(expr: *const nftnl_expr); + + pub fn nftnl_expr_is_set(expr: *const nftnl_expr, type_: u16) -> bool; + + pub fn nftnl_expr_set( + expr: *mut nftnl_expr, + type_: u16, + data: *const c_void, + data_len: u32, + ) -> c_int; + + pub fn nftnl_expr_set_u8(expr: *mut nftnl_expr, type_: u16, data: u8); + + pub fn nftnl_expr_set_u16(expr: *mut nftnl_expr, type_: u16, data: u16); + + pub fn nftnl_expr_set_u32(expr: *mut nftnl_expr, type_: u16, data: u32); + + pub fn nftnl_expr_set_u64(expr: *mut nftnl_expr, type_: u16, data: u64); + + pub fn nftnl_expr_set_str(expr: *mut nftnl_expr, type_: u16, str_: *const c_char) -> c_int; + + pub fn nftnl_expr_get(expr: *const nftnl_expr, type_: u16, data_len: *mut u32) + -> *const c_void; + + pub fn nftnl_expr_get_u8(expr: *const nftnl_expr, type_: u16) -> u8; + + pub fn nftnl_expr_get_u16(expr: *const nftnl_expr, type_: u16) -> u16; + + pub fn nftnl_expr_get_u32(expr: *const nftnl_expr, type_: u16) -> u32; + + pub fn nftnl_expr_get_u64(expr: *const nftnl_expr, type_: u16) -> u64; + + pub fn nftnl_expr_get_str(expr: *const nftnl_expr, type_: u16) -> *const c_char; + + pub fn nftnl_expr_snprintf( + buf: *mut c_char, + buflen: usize, + expr: *const nftnl_expr, + type_: u32, + flags: u32, + ) -> c_int; + + pub fn nftnl_expr_fprintf( + fp: *mut FILE, + expr: *const nftnl_expr, + type_: u32, + flags: u32, + ) -> c_int; +} +pub const NFTNL_EXPR_PAYLOAD_DREG: u32 = 1; +pub const NFTNL_EXPR_PAYLOAD_BASE: u32 = 2; +pub const NFTNL_EXPR_PAYLOAD_OFFSET: u32 = 3; +pub const NFTNL_EXPR_PAYLOAD_LEN: u32 = 4; +pub const NFTNL_EXPR_PAYLOAD_SREG: u32 = 5; +pub const NFTNL_EXPR_PAYLOAD_CSUM_TYPE: u32 = 6; +pub const NFTNL_EXPR_PAYLOAD_CSUM_OFFSET: u32 = 7; +pub const NFTNL_EXPR_PAYLOAD_FLAGS: u32 = 8; + +pub const NFTNL_EXPR_NG_DREG: u32 = 1; +pub const NFTNL_EXPR_NG_MODULUS: u32 = 2; +pub const NFTNL_EXPR_NG_TYPE: u32 = 3; +pub const NFTNL_EXPR_NG_OFFSET: u32 = 4; +pub const NFTNL_EXPR_NG_SET_NAME: u32 = 5; +pub const NFTNL_EXPR_NG_SET_ID: u32 = 6; + +pub const NFTNL_EXPR_META_KEY: u32 = 1; +pub const NFTNL_EXPR_META_DREG: u32 = 2; +pub const NFTNL_EXPR_META_SREG: u32 = 3; + +pub const NFTNL_EXPR_RT_KEY: u32 = 1; +pub const NFTNL_EXPR_RT_DREG: u32 = 2; + +pub const NFTNL_EXPR_SOCKET_KEY: u32 = 1; +pub const NFTNL_EXPR_SOCKET_DREG: u32 = 2; + +pub const NFTNL_EXPR_TUNNEL_KEY: u32 = 1; +pub const NFTNL_EXPR_TUNNEL_DREG: u32 = 2; + +pub const NFTNL_EXPR_CMP_SREG: u32 = 1; +pub const NFTNL_EXPR_CMP_OP: u32 = 2; +pub const NFTNL_EXPR_CMP_DATA: u32 = 3; + +pub const NFTNL_EXPR_RANGE_SREG: u32 = 1; +pub const NFTNL_EXPR_RANGE_OP: u32 = 2; +pub const NFTNL_EXPR_RANGE_FROM_DATA: u32 = 3; +pub const NFTNL_EXPR_RANGE_TO_DATA: u32 = 4; + +pub const NFTNL_EXPR_IMM_DREG: u32 = 1; +pub const NFTNL_EXPR_IMM_DATA: u32 = 2; +pub const NFTNL_EXPR_IMM_VERDICT: u32 = 3; +pub const NFTNL_EXPR_IMM_CHAIN: u32 = 4; + +pub const NFTNL_EXPR_CTR_PACKETS: u32 = 1; +pub const NFTNL_EXPR_CTR_BYTES: u32 = 2; + +pub const NFTNL_EXPR_CONNLIMIT_COUNT: u32 = 1; +pub const NFTNL_EXPR_CONNLIMIT_FLAGS: u32 = 2; + +pub const NFTNL_EXPR_BITWISE_SREG: u32 = 1; +pub const NFTNL_EXPR_BITWISE_DREG: u32 = 2; +pub const NFTNL_EXPR_BITWISE_LEN: u32 = 3; +pub const NFTNL_EXPR_BITWISE_MASK: u32 = 4; +pub const NFTNL_EXPR_BITWISE_XOR: u32 = 5; + +pub const NFTNL_EXPR_TG_NAME: u32 = 1; +pub const NFTNL_EXPR_TG_REV: u32 = 2; +pub const NFTNL_EXPR_TG_INFO: u32 = 3; + +pub const NFTNL_EXPR_MT_NAME: u32 = 1; +pub const NFTNL_EXPR_MT_REV: u32 = 2; +pub const NFTNL_EXPR_MT_INFO: u32 = 3; + +pub const NFTNL_EXPR_NAT_TYPE: u32 = 1; +pub const NFTNL_EXPR_NAT_FAMILY: u32 = 2; +pub const NFTNL_EXPR_NAT_REG_ADDR_MIN: u32 = 3; +pub const NFTNL_EXPR_NAT_REG_ADDR_MAX: u32 = 4; +pub const NFTNL_EXPR_NAT_REG_PROTO_MIN: u32 = 5; +pub const NFTNL_EXPR_NAT_REG_PROTO_MAX: u32 = 6; +pub const NFTNL_EXPR_NAT_FLAGS: u32 = 7; + +pub const NFTNL_EXPR_TPROXY_FAMILY: u32 = 1; +pub const NFTNL_EXPR_TPROXY_REG_ADDR: u32 = 2; +pub const NFTNL_EXPR_TPROXY_REG_PORT: u32 = 3; + +pub const NFTNL_EXPR_LOOKUP_SREG: u32 = 1; +pub const NFTNL_EXPR_LOOKUP_DREG: u32 = 2; +pub const NFTNL_EXPR_LOOKUP_SET: u32 = 3; +pub const NFTNL_EXPR_LOOKUP_SET_ID: u32 = 4; +pub const NFTNL_EXPR_LOOKUP_FLAGS: u32 = 5; + +pub const NFTNL_EXPR_DYNSET_SREG_KEY: u32 = 1; +pub const NFTNL_EXPR_DYNSET_SREG_DATA: u32 = 2; +pub const NFTNL_EXPR_DYNSET_OP: u32 = 3; +pub const NFTNL_EXPR_DYNSET_TIMEOUT: u32 = 4; +pub const NFTNL_EXPR_DYNSET_SET_NAME: u32 = 5; +pub const NFTNL_EXPR_DYNSET_SET_ID: u32 = 6; +pub const NFTNL_EXPR_DYNSET_EXPR: u32 = 7; + +pub const NFTNL_EXPR_LOG_PREFIX: u32 = 1; +pub const NFTNL_EXPR_LOG_GROUP: u32 = 2; +pub const NFTNL_EXPR_LOG_SNAPLEN: u32 = 3; +pub const NFTNL_EXPR_LOG_QTHRESHOLD: u32 = 4; +pub const NFTNL_EXPR_LOG_LEVEL: u32 = 5; +pub const NFTNL_EXPR_LOG_FLAGS: u32 = 6; + +pub const NFTNL_EXPR_EXTHDR_DREG: u32 = 1; +pub const NFTNL_EXPR_EXTHDR_TYPE: u32 = 2; +pub const NFTNL_EXPR_EXTHDR_OFFSET: u32 = 3; +pub const NFTNL_EXPR_EXTHDR_LEN: u32 = 4; +pub const NFTNL_EXPR_EXTHDR_FLAGS: u32 = 5; +pub const NFTNL_EXPR_EXTHDR_OP: u32 = 6; +pub const NFTNL_EXPR_EXTHDR_SREG: u32 = 7; + +pub const NFTNL_EXPR_CT_DREG: u32 = 1; +pub const NFTNL_EXPR_CT_KEY: u32 = 2; +pub const NFTNL_EXPR_CT_DIR: u32 = 3; +pub const NFTNL_EXPR_CT_SREG: u32 = 4; + +pub const NFTNL_EXPR_BYTEORDER_DREG: u32 = 1; +pub const NFTNL_EXPR_BYTEORDER_SREG: u32 = 2; +pub const NFTNL_EXPR_BYTEORDER_OP: u32 = 3; +pub const NFTNL_EXPR_BYTEORDER_LEN: u32 = 4; +pub const NFTNL_EXPR_BYTEORDER_SIZE: u32 = 5; + +pub const NFTNL_EXPR_LIMIT_RATE: u32 = 1; +pub const NFTNL_EXPR_LIMIT_UNIT: u32 = 2; +pub const NFTNL_EXPR_LIMIT_BURST: u32 = 3; +pub const NFTNL_EXPR_LIMIT_TYPE: u32 = 4; +pub const NFTNL_EXPR_LIMIT_FLAGS: u32 = 5; + +pub const NFTNL_EXPR_REJECT_TYPE: u32 = 1; +pub const NFTNL_EXPR_REJECT_CODE: u32 = 2; + +pub const NFTNL_EXPR_QUEUE_NUM: u32 = 1; +pub const NFTNL_EXPR_QUEUE_TOTAL: u32 = 2; +pub const NFTNL_EXPR_QUEUE_FLAGS: u32 = 3; +pub const NFTNL_EXPR_QUEUE_SREG_QNUM: u32 = 4; + +pub const NFTNL_EXPR_QUOTA_BYTES: u32 = 1; +pub const NFTNL_EXPR_QUOTA_FLAGS: u32 = 2; +pub const NFTNL_EXPR_QUOTA_CONSUMED: u32 = 3; + +pub const NFTNL_EXPR_MASQ_FLAGS: u32 = 1; +pub const NFTNL_EXPR_MASQ_REG_PROTO_MIN: u32 = 2; +pub const NFTNL_EXPR_MASQ_REG_PROTO_MAX: u32 = 3; + +pub const NFTNL_EXPR_REDIR_REG_PROTO_MIN: u32 = 1; +pub const NFTNL_EXPR_REDIR_REG_PROTO_MAX: u32 = 2; +pub const NFTNL_EXPR_REDIR_FLAGS: u32 = 3; + +pub const NFTNL_EXPR_DUP_SREG_ADDR: u32 = 1; +pub const NFTNL_EXPR_DUP_SREG_DEV: u32 = 2; + +pub const NFTNL_EXPR_FLOW_TABLE_NAME: u32 = 1; + +pub const NFTNL_EXPR_FWD_SREG_DEV: u32 = 1; +pub const NFTNL_EXPR_FWD_SREG_ADDR: u32 = 2; +pub const NFTNL_EXPR_FWD_NFPROTO: u32 = 3; + +pub const NFTNL_EXPR_HASH_SREG: u32 = 1; +pub const NFTNL_EXPR_HASH_DREG: u32 = 2; +pub const NFTNL_EXPR_HASH_LEN: u32 = 3; +pub const NFTNL_EXPR_HASH_MODULUS: u32 = 4; +pub const NFTNL_EXPR_HASH_SEED: u32 = 5; +pub const NFTNL_EXPR_HASH_OFFSET: u32 = 6; +pub const NFTNL_EXPR_HASH_TYPE: u32 = 7; +pub const NFTNL_EXPR_HASH_SET_NAME: u32 = 8; +pub const NFTNL_EXPR_HASH_SET_ID: u32 = 9; + +pub const NFTNL_EXPR_FIB_DREG: u32 = 1; +pub const NFTNL_EXPR_FIB_RESULT: u32 = 2; +pub const NFTNL_EXPR_FIB_FLAGS: u32 = 3; + +pub const NFTNL_EXPR_OBJREF_IMM_TYPE: u32 = 1; +pub const NFTNL_EXPR_OBJREF_IMM_NAME: u32 = 2; +pub const NFTNL_EXPR_OBJREF_SET_SREG: u32 = 3; +pub const NFTNL_EXPR_OBJREF_SET_NAME: u32 = 4; +pub const NFTNL_EXPR_OBJREF_SET_ID: u32 = 5; + +pub const NFTNL_EXPR_OSF_DREG: u32 = 1; +pub const NFTNL_EXPR_OSF_TTL: u32 = 2; +pub const NFTNL_EXPR_OSF_FLAGS: u32 = 3; + +pub const NFTNL_EXPR_XFRM_DREG: u32 = 1; +pub const NFTNL_EXPR_XFRM_SREG: u32 = 2; +pub const NFTNL_EXPR_XFRM_KEY: u32 = 3; +pub const NFTNL_EXPR_XFRM_DIR: u32 = 4; +pub const NFTNL_EXPR_XFRM_SPNUM: u32 = 5; + +#[repr(C)] +pub struct nftnl_gen(c_void); + +extern "C" { + pub fn nftnl_gen_alloc() -> *mut nftnl_gen; + + pub fn nftnl_gen_free(arg1: *const nftnl_gen); +} +pub const NFTNL_GEN_ID: u32 = 0; +pub const __NFTNL_GEN_MAX: u32 = 1; + +extern "C" { + pub fn nftnl_gen_is_set(gen: *const nftnl_gen, attr: u16) -> bool; + + pub fn nftnl_gen_unset(gen: *mut nftnl_gen, attr: u16); + + pub fn nftnl_gen_set(gen: *mut nftnl_gen, attr: u16, data: *const c_void) -> c_int; + + pub fn nftnl_gen_set_data( + gen: *mut nftnl_gen, + attr: u16, + data: *const c_void, + data_len: u32, + ) -> c_int; + + pub fn nftnl_gen_get(gen: *const nftnl_gen, attr: u16) -> *const c_void; + + pub fn nftnl_gen_get_data( + gen: *const nftnl_gen, + attr: u16, + data_len: *mut u32, + ) -> *const c_void; + + pub fn nftnl_gen_set_u32(gen: *mut nftnl_gen, attr: u16, data: u32); + + pub fn nftnl_gen_get_u32(gen: *const nftnl_gen, attr: u16) -> u32; + + pub fn nftnl_gen_nlmsg_parse(nlh: *const nlmsghdr, gen: *mut nftnl_gen) -> c_int; + + pub fn nftnl_gen_snprintf( + buf: *mut c_char, + size: usize, + gen: *const nftnl_gen, + type_: u32, + flags: u32, + ) -> c_int; + + pub fn nftnl_gen_fprintf(fp: *mut FILE, gen: *const nftnl_gen, type_: u32, flags: u32) + -> c_int; +} +pub const NFTNL_OBJ_TABLE: u32 = 0; +pub const NFTNL_OBJ_NAME: u32 = 1; +pub const NFTNL_OBJ_TYPE: u32 = 2; +pub const NFTNL_OBJ_FAMILY: u32 = 3; +pub const NFTNL_OBJ_USE: u32 = 4; +pub const NFTNL_OBJ_HANDLE: u32 = 5; +pub const NFTNL_OBJ_BASE: u32 = 16; +pub const __NFTNL_OBJ_MAX: u32 = 17; + +pub const NFTNL_OBJ_CTR_PKTS: u32 = 16; +pub const NFTNL_OBJ_CTR_BYTES: u32 = 17; + +pub const NFTNL_OBJ_QUOTA_BYTES: u32 = 16; +pub const NFTNL_OBJ_QUOTA_CONSUMED: u32 = 17; +pub const NFTNL_OBJ_QUOTA_FLAGS: u32 = 18; + +pub const NFTNL_OBJ_CT_HELPER_NAME: u32 = 16; +pub const NFTNL_OBJ_CT_HELPER_L3PROTO: u32 = 17; +pub const NFTNL_OBJ_CT_HELPER_L4PROTO: u32 = 18; + +pub const NFTNL_CTTIMEOUT_TCP_SYN_SENT: nftnl_cttimeout_array_tcp = 0; +pub const NFTNL_CTTIMEOUT_TCP_SYN_RECV: nftnl_cttimeout_array_tcp = 1; +pub const NFTNL_CTTIMEOUT_TCP_ESTABLISHED: nftnl_cttimeout_array_tcp = 2; +pub const NFTNL_CTTIMEOUT_TCP_FIN_WAIT: nftnl_cttimeout_array_tcp = 3; +pub const NFTNL_CTTIMEOUT_TCP_CLOSE_WAIT: nftnl_cttimeout_array_tcp = 4; +pub const NFTNL_CTTIMEOUT_TCP_LAST_ACK: nftnl_cttimeout_array_tcp = 5; +pub const NFTNL_CTTIMEOUT_TCP_TIME_WAIT: nftnl_cttimeout_array_tcp = 6; +pub const NFTNL_CTTIMEOUT_TCP_CLOSE: nftnl_cttimeout_array_tcp = 7; +pub const NFTNL_CTTIMEOUT_TCP_SYN_SENT2: nftnl_cttimeout_array_tcp = 8; +pub const NFTNL_CTTIMEOUT_TCP_RETRANS: nftnl_cttimeout_array_tcp = 9; +pub const NFTNL_CTTIMEOUT_TCP_UNACK: nftnl_cttimeout_array_tcp = 10; +pub const NFTNL_CTTIMEOUT_TCP_MAX: nftnl_cttimeout_array_tcp = 11; +pub type nftnl_cttimeout_array_tcp = c_uint; +pub const NFTNL_CTTIMEOUT_UDP_UNREPLIED: nftnl_cttimeout_array_udp = 0; +pub const NFTNL_CTTIMEOUT_UDP_REPLIED: nftnl_cttimeout_array_udp = 1; +pub const NFTNL_CTTIMEOUT_UDP_MAX: nftnl_cttimeout_array_udp = 2; +pub type nftnl_cttimeout_array_udp = c_uint; +pub const NFTNL_OBJ_CT_TIMEOUT_L3PROTO: u32 = 16; +pub const NFTNL_OBJ_CT_TIMEOUT_L4PROTO: u32 = 17; +pub const NFTNL_OBJ_CT_TIMEOUT_ARRAY: u32 = 18; + +pub const NFTNL_OBJ_LIMIT_RATE: u32 = 16; +pub const NFTNL_OBJ_LIMIT_UNIT: u32 = 17; +pub const NFTNL_OBJ_LIMIT_BURST: u32 = 18; +pub const NFTNL_OBJ_LIMIT_TYPE: u32 = 19; +pub const NFTNL_OBJ_LIMIT_FLAGS: u32 = 20; + +pub const NFTNL_OBJ_TUNNEL_ID: u32 = 16; +pub const NFTNL_OBJ_TUNNEL_IPV4_SRC: u32 = 17; +pub const NFTNL_OBJ_TUNNEL_IPV4_DST: u32 = 18; +pub const NFTNL_OBJ_TUNNEL_IPV6_SRC: u32 = 19; +pub const NFTNL_OBJ_TUNNEL_IPV6_DST: u32 = 20; +pub const NFTNL_OBJ_TUNNEL_IPV6_FLOWLABEL: u32 = 21; +pub const NFTNL_OBJ_TUNNEL_SPORT: u32 = 22; +pub const NFTNL_OBJ_TUNNEL_DPORT: u32 = 23; +pub const NFTNL_OBJ_TUNNEL_FLAGS: u32 = 24; +pub const NFTNL_OBJ_TUNNEL_TOS: u32 = 25; +pub const NFTNL_OBJ_TUNNEL_TTL: u32 = 26; +pub const NFTNL_OBJ_TUNNEL_VXLAN_GBP: u32 = 27; +pub const NFTNL_OBJ_TUNNEL_ERSPAN_VERSION: u32 = 28; +pub const NFTNL_OBJ_TUNNEL_ERSPAN_V1_INDEX: u32 = 29; +pub const NFTNL_OBJ_TUNNEL_ERSPAN_V2_HWID: u32 = 30; +pub const NFTNL_OBJ_TUNNEL_ERSPAN_V2_DIR: u32 = 31; + +pub const NFTNL_OBJ_SECMARK_CTX: u32 = 16; + +#[repr(C)] +pub struct nftnl_obj(c_void); + +extern "C" { + pub fn nftnl_obj_alloc() -> *mut nftnl_obj; + + pub fn nftnl_obj_free(ne: *const nftnl_obj); + + pub fn nftnl_obj_is_set(ne: *const nftnl_obj, attr: u16) -> bool; + + pub fn nftnl_obj_unset(ne: *mut nftnl_obj, attr: u16); + + pub fn nftnl_obj_set_data(ne: *mut nftnl_obj, attr: u16, data: *const c_void, data_len: u32); + + pub fn nftnl_obj_set(ne: *mut nftnl_obj, attr: u16, data: *const c_void); + + pub fn nftnl_obj_set_u8(ne: *mut nftnl_obj, attr: u16, val: u8); + + pub fn nftnl_obj_set_u16(ne: *mut nftnl_obj, attr: u16, val: u16); + + pub fn nftnl_obj_set_u32(ne: *mut nftnl_obj, attr: u16, val: u32); + + pub fn nftnl_obj_set_u64(obj: *mut nftnl_obj, attr: u16, val: u64); + + pub fn nftnl_obj_set_str(ne: *mut nftnl_obj, attr: u16, str_: *const c_char); + + pub fn nftnl_obj_get_data(ne: *mut nftnl_obj, attr: u16, data_len: *mut u32) -> *const c_void; + + pub fn nftnl_obj_get(ne: *mut nftnl_obj, attr: u16) -> *const c_void; + + pub fn nftnl_obj_get_u8(ne: *mut nftnl_obj, attr: u16) -> u8; + + pub fn nftnl_obj_get_u16(obj: *mut nftnl_obj, attr: u16) -> u16; + + pub fn nftnl_obj_get_u32(ne: *mut nftnl_obj, attr: u16) -> u32; + + pub fn nftnl_obj_get_u64(obj: *mut nftnl_obj, attr: u16) -> u64; + + pub fn nftnl_obj_get_str(ne: *mut nftnl_obj, attr: u16) -> *const c_char; + + pub fn nftnl_obj_nlmsg_build_payload(nlh: *mut nlmsghdr, ne: *const nftnl_obj); + + pub fn nftnl_obj_nlmsg_parse(nlh: *const nlmsghdr, ne: *mut nftnl_obj) -> c_int; + + pub fn nftnl_obj_parse( + ne: *mut nftnl_obj, + type_: nftnl_parse_type, + data: *const c_char, + err: *mut nftnl_parse_err, + ) -> c_int; + + pub fn nftnl_obj_parse_file( + ne: *mut nftnl_obj, + type_: nftnl_parse_type, + fp: *mut FILE, + err: *mut nftnl_parse_err, + ) -> c_int; + + pub fn nftnl_obj_snprintf( + buf: *mut c_char, + size: usize, + ne: *const nftnl_obj, + type_: u32, + flags: u32, + ) -> c_int; + + pub fn nftnl_obj_fprintf(fp: *mut FILE, ne: *const nftnl_obj, type_: u32, flags: u32) -> c_int; +} +#[repr(C)] +pub struct nftnl_obj_list(c_void); + +extern "C" { + pub fn nftnl_obj_list_alloc() -> *mut nftnl_obj_list; + + pub fn nftnl_obj_list_free(list: *mut nftnl_obj_list); + + pub fn nftnl_obj_list_is_empty(list: *mut nftnl_obj_list) -> c_int; + + pub fn nftnl_obj_list_add(r: *mut nftnl_obj, list: *mut nftnl_obj_list); + + pub fn nftnl_obj_list_add_tail(r: *mut nftnl_obj, list: *mut nftnl_obj_list); + + pub fn nftnl_obj_list_del(t: *mut nftnl_obj); + + pub fn nftnl_obj_list_foreach( + table_list: *mut nftnl_obj_list, + cb: Option c_int>, + data: *mut c_void, + ) -> c_int; +} +#[repr(C)] +pub struct nftnl_obj_list_iter(c_void); + +extern "C" { + pub fn nftnl_obj_list_iter_create(l: *mut nftnl_obj_list) -> *mut nftnl_obj_list_iter; + + pub fn nftnl_obj_list_iter_next(iter: *mut nftnl_obj_list_iter) -> *mut nftnl_obj; + + pub fn nftnl_obj_list_iter_destroy(iter: *mut nftnl_obj_list_iter); + + pub fn nftnl_rule_alloc() -> *mut nftnl_rule; + + pub fn nftnl_rule_free(arg1: *const nftnl_rule); +} +pub const NFTNL_RULE_FAMILY: nftnl_rule_attr = 0; +pub const NFTNL_RULE_TABLE: nftnl_rule_attr = 1; +pub const NFTNL_RULE_CHAIN: nftnl_rule_attr = 2; +pub const NFTNL_RULE_HANDLE: nftnl_rule_attr = 3; +pub const NFTNL_RULE_COMPAT_PROTO: nftnl_rule_attr = 4; +pub const NFTNL_RULE_COMPAT_FLAGS: nftnl_rule_attr = 5; +pub const NFTNL_RULE_POSITION: nftnl_rule_attr = 6; +pub const NFTNL_RULE_USERDATA: nftnl_rule_attr = 7; +pub const NFTNL_RULE_ID: nftnl_rule_attr = 8; +pub const NFTNL_RULE_POSITION_ID: nftnl_rule_attr = 9; +pub const __NFTNL_RULE_MAX: nftnl_rule_attr = 10; +pub type nftnl_rule_attr = c_uint; +extern "C" { + pub fn nftnl_rule_unset(r: *mut nftnl_rule, attr: u16); + + pub fn nftnl_rule_is_set(r: *const nftnl_rule, attr: u16) -> bool; + + pub fn nftnl_rule_set(r: *mut nftnl_rule, attr: u16, data: *const c_void) -> c_int; + + pub fn nftnl_rule_set_data( + r: *mut nftnl_rule, + attr: u16, + data: *const c_void, + data_len: u32, + ) -> c_int; + + pub fn nftnl_rule_set_u32(r: *mut nftnl_rule, attr: u16, val: u32); + + pub fn nftnl_rule_set_u64(r: *mut nftnl_rule, attr: u16, val: u64); + + pub fn nftnl_rule_set_str(r: *mut nftnl_rule, attr: u16, str_: *const c_char) -> c_int; + + pub fn nftnl_rule_get(r: *const nftnl_rule, attr: u16) -> *const c_void; + + pub fn nftnl_rule_get_data( + r: *const nftnl_rule, + attr: u16, + data_len: *mut u32, + ) -> *const c_void; + + pub fn nftnl_rule_get_str(r: *const nftnl_rule, attr: u16) -> *const c_char; + + pub fn nftnl_rule_get_u8(r: *const nftnl_rule, attr: u16) -> u8; + + pub fn nftnl_rule_get_u32(r: *const nftnl_rule, attr: u16) -> u32; + + pub fn nftnl_rule_get_u64(r: *const nftnl_rule, attr: u16) -> u64; + + pub fn nftnl_rule_add_expr(r: *mut nftnl_rule, expr: *mut nftnl_expr); + + pub fn nftnl_rule_nlmsg_build_payload(nlh: *mut nlmsghdr, t: *mut nftnl_rule); + + pub fn nftnl_rule_parse( + r: *mut nftnl_rule, + type_: nftnl_parse_type, + data: *const c_char, + err: *mut nftnl_parse_err, + ) -> c_int; + + pub fn nftnl_rule_parse_file( + r: *mut nftnl_rule, + type_: nftnl_parse_type, + fp: *mut FILE, + err: *mut nftnl_parse_err, + ) -> c_int; + + pub fn nftnl_rule_snprintf( + buf: *mut c_char, + size: usize, + t: *const nftnl_rule, + type_: u32, + flags: u32, + ) -> c_int; + + pub fn nftnl_rule_fprintf(fp: *mut FILE, r: *const nftnl_rule, type_: u32, flags: u32) + -> c_int; + + pub fn nftnl_rule_nlmsg_parse(nlh: *const nlmsghdr, t: *mut nftnl_rule) -> c_int; + + pub fn nftnl_expr_foreach( + r: *mut nftnl_rule, + cb: Option c_int>, + data: *mut c_void, + ) -> c_int; +} +#[repr(C)] +pub struct nftnl_expr_iter(c_void); + +extern "C" { + pub fn nftnl_expr_iter_create(r: *const nftnl_rule) -> *mut nftnl_expr_iter; + + pub fn nftnl_expr_iter_next(iter: *mut nftnl_expr_iter) -> *mut nftnl_expr; + + pub fn nftnl_expr_iter_destroy(iter: *mut nftnl_expr_iter); +} +#[repr(C)] +pub struct nftnl_rule_list(c_void); + +extern "C" { + pub fn nftnl_rule_list_alloc() -> *mut nftnl_rule_list; + + pub fn nftnl_rule_list_free(list: *mut nftnl_rule_list); + + pub fn nftnl_rule_list_is_empty(list: *const nftnl_rule_list) -> c_int; + + pub fn nftnl_rule_list_add(r: *mut nftnl_rule, list: *mut nftnl_rule_list); + + pub fn nftnl_rule_list_add_tail(r: *mut nftnl_rule, list: *mut nftnl_rule_list); + + pub fn nftnl_rule_list_insert_at(r: *mut nftnl_rule, pos: *mut nftnl_rule); + + pub fn nftnl_rule_list_del(r: *mut nftnl_rule); + + pub fn nftnl_rule_list_foreach( + rule_list: *mut nftnl_rule_list, + cb: Option c_int>, + data: *mut c_void, + ) -> c_int; +} +#[repr(C)] +pub struct nftnl_rule_list_iter(c_void); + +extern "C" { + pub fn nftnl_rule_list_iter_create(l: *const nftnl_rule_list) -> *mut nftnl_rule_list_iter; + + pub fn nftnl_rule_list_iter_cur(iter: *mut nftnl_rule_list_iter) -> *mut nftnl_rule; + + pub fn nftnl_rule_list_iter_next(iter: *mut nftnl_rule_list_iter) -> *mut nftnl_rule; + + pub fn nftnl_rule_list_iter_destroy(iter: *const nftnl_rule_list_iter); +} +#[repr(C)] +pub struct nftnl_ruleset(c_void); + +extern "C" { + pub fn nftnl_ruleset_alloc() -> *mut nftnl_ruleset; + + pub fn nftnl_ruleset_free(r: *const nftnl_ruleset); +} +pub const NFTNL_RULESET_TABLELIST: u32 = 0; +pub const NFTNL_RULESET_CHAINLIST: u32 = 1; +pub const NFTNL_RULESET_SETLIST: u32 = 2; +pub const NFTNL_RULESET_RULELIST: u32 = 3; + +pub const NFTNL_RULESET_UNSPEC: nftnl_ruleset_type = 0; +pub const NFTNL_RULESET_RULESET: nftnl_ruleset_type = 1; +pub const NFTNL_RULESET_TABLE: nftnl_ruleset_type = 2; +pub const NFTNL_RULESET_CHAIN: nftnl_ruleset_type = 3; +pub const NFTNL_RULESET_RULE: nftnl_ruleset_type = 4; +pub const NFTNL_RULESET_SET: nftnl_ruleset_type = 5; +pub const NFTNL_RULESET_SET_ELEMS: nftnl_ruleset_type = 6; +pub type nftnl_ruleset_type = c_uint; +extern "C" { + pub fn nftnl_ruleset_is_set(r: *const nftnl_ruleset, attr: u16) -> bool; + + pub fn nftnl_ruleset_unset(r: *mut nftnl_ruleset, attr: u16); + + pub fn nftnl_ruleset_set(r: *mut nftnl_ruleset, attr: u16, data: *mut c_void); + + pub fn nftnl_ruleset_get(r: *const nftnl_ruleset, attr: u16) -> *mut c_void; +} +pub const NFTNL_RULESET_CTX_CMD: u32 = 0; +pub const NFTNL_RULESET_CTX_TYPE: u32 = 1; +pub const NFTNL_RULESET_CTX_TABLE: u32 = 2; +pub const NFTNL_RULESET_CTX_CHAIN: u32 = 3; +pub const NFTNL_RULESET_CTX_RULE: u32 = 4; +pub const NFTNL_RULESET_CTX_SET: u32 = 5; +pub const NFTNL_RULESET_CTX_DATA: u32 = 6; + +#[repr(C)] +pub struct nftnl_parse_ctx(c_void); + +extern "C" { + pub fn nftnl_ruleset_ctx_free(ctx: *const nftnl_parse_ctx); + + pub fn nftnl_ruleset_ctx_is_set(ctx: *const nftnl_parse_ctx, attr: u16) -> bool; + + pub fn nftnl_ruleset_ctx_get(ctx: *const nftnl_parse_ctx, attr: u16) -> *mut c_void; + + pub fn nftnl_ruleset_ctx_get_u32(ctx: *const nftnl_parse_ctx, attr: u16) -> u32; + + pub fn nftnl_ruleset_parse_file_cb( + type_: nftnl_parse_type, + fp: *mut FILE, + err: *mut nftnl_parse_err, + data: *mut c_void, + cb: Option c_int>, + ) -> c_int; + + pub fn nftnl_ruleset_parse_buffer_cb( + type_: nftnl_parse_type, + buffer: *const c_char, + err: *mut nftnl_parse_err, + data: *mut c_void, + cb: Option c_int>, + ) -> c_int; + + pub fn nftnl_ruleset_parse( + rs: *mut nftnl_ruleset, + type_: nftnl_parse_type, + data: *const c_char, + err: *mut nftnl_parse_err, + ) -> c_int; + + pub fn nftnl_ruleset_parse_file( + rs: *mut nftnl_ruleset, + type_: nftnl_parse_type, + fp: *mut FILE, + err: *mut nftnl_parse_err, + ) -> c_int; + + pub fn nftnl_ruleset_snprintf( + buf: *mut c_char, + size: usize, + rs: *const nftnl_ruleset, + type_: u32, + flags: u32, + ) -> c_int; + + pub fn nftnl_ruleset_fprintf( + fp: *mut FILE, + rs: *const nftnl_ruleset, + type_: u32, + flags: u32, + ) -> c_int; +} +pub const NFTNL_SET_TABLE: nftnl_set_attr = 0; +pub const NFTNL_SET_NAME: nftnl_set_attr = 1; +pub const NFTNL_SET_FLAGS: nftnl_set_attr = 2; +pub const NFTNL_SET_KEY_TYPE: nftnl_set_attr = 3; +pub const NFTNL_SET_KEY_LEN: nftnl_set_attr = 4; +pub const NFTNL_SET_DATA_TYPE: nftnl_set_attr = 5; +pub const NFTNL_SET_DATA_LEN: nftnl_set_attr = 6; +pub const NFTNL_SET_FAMILY: nftnl_set_attr = 7; +pub const NFTNL_SET_ID: nftnl_set_attr = 8; +pub const NFTNL_SET_POLICY: nftnl_set_attr = 9; +pub const NFTNL_SET_DESC_SIZE: nftnl_set_attr = 10; +pub const NFTNL_SET_TIMEOUT: nftnl_set_attr = 11; +pub const NFTNL_SET_GC_INTERVAL: nftnl_set_attr = 12; +pub const NFTNL_SET_USERDATA: nftnl_set_attr = 13; +pub const NFTNL_SET_OBJ_TYPE: nftnl_set_attr = 14; +pub const NFTNL_SET_HANDLE: nftnl_set_attr = 15; +pub const __NFTNL_SET_MAX: nftnl_set_attr = 16; +pub type nftnl_set_attr = c_uint; +#[repr(C)] +pub struct nftnl_set(c_void); + +extern "C" { + pub fn nftnl_set_alloc() -> *mut nftnl_set; + + pub fn nftnl_set_free(s: *const nftnl_set); + + pub fn nftnl_set_clone(set: *const nftnl_set) -> *mut nftnl_set; + + pub fn nftnl_set_is_set(s: *const nftnl_set, attr: u16) -> bool; + + pub fn nftnl_set_unset(s: *mut nftnl_set, attr: u16); + + pub fn nftnl_set_set(s: *mut nftnl_set, attr: u16, data: *const c_void) -> c_int; + + pub fn nftnl_set_set_data( + s: *mut nftnl_set, + attr: u16, + data: *const c_void, + data_len: u32, + ) -> c_int; + + pub fn nftnl_set_set_u32(s: *mut nftnl_set, attr: u16, val: u32); + + pub fn nftnl_set_set_u64(s: *mut nftnl_set, attr: u16, val: u64); + + pub fn nftnl_set_set_str(s: *mut nftnl_set, attr: u16, str_: *const c_char) -> c_int; + + pub fn nftnl_set_get(s: *const nftnl_set, attr: u16) -> *const c_void; + + pub fn nftnl_set_get_data(s: *const nftnl_set, attr: u16, data_len: *mut u32) -> *const c_void; + + pub fn nftnl_set_get_str(s: *const nftnl_set, attr: u16) -> *const c_char; + + pub fn nftnl_set_get_u32(s: *const nftnl_set, attr: u16) -> u32; + + pub fn nftnl_set_get_u64(s: *const nftnl_set, attr: u16) -> u64; + + pub fn nftnl_set_nlmsg_build_payload(nlh: *mut nlmsghdr, s: *mut nftnl_set); + + pub fn nftnl_set_nlmsg_parse(nlh: *const nlmsghdr, s: *mut nftnl_set) -> c_int; + + pub fn nftnl_set_elems_nlmsg_parse(nlh: *const nlmsghdr, s: *mut nftnl_set) -> c_int; + + pub fn nftnl_set_snprintf( + buf: *mut c_char, + size: usize, + s: *const nftnl_set, + type_: u32, + flags: u32, + ) -> c_int; + + pub fn nftnl_set_fprintf(fp: *mut FILE, s: *const nftnl_set, type_: u32, flags: u32) -> c_int; +} +#[repr(C)] +pub struct nftnl_set_list(c_void); + +extern "C" { + pub fn nftnl_set_list_alloc() -> *mut nftnl_set_list; + + pub fn nftnl_set_list_free(list: *mut nftnl_set_list); + + pub fn nftnl_set_list_is_empty(list: *const nftnl_set_list) -> c_int; + + pub fn nftnl_set_list_add(s: *mut nftnl_set, list: *mut nftnl_set_list); + + pub fn nftnl_set_list_add_tail(s: *mut nftnl_set, list: *mut nftnl_set_list); + + pub fn nftnl_set_list_del(s: *mut nftnl_set); + + pub fn nftnl_set_list_foreach( + set_list: *mut nftnl_set_list, + cb: Option c_int>, + data: *mut c_void, + ) -> c_int; +} +#[repr(C)] +pub struct nftnl_set_list_iter(c_void); + +extern "C" { + pub fn nftnl_set_list_iter_create(l: *const nftnl_set_list) -> *mut nftnl_set_list_iter; + + pub fn nftnl_set_list_iter_cur(iter: *const nftnl_set_list_iter) -> *mut nftnl_set; + + pub fn nftnl_set_list_iter_next(iter: *mut nftnl_set_list_iter) -> *mut nftnl_set; + + pub fn nftnl_set_list_iter_destroy(iter: *const nftnl_set_list_iter); + + pub fn nftnl_set_parse( + s: *mut nftnl_set, + type_: nftnl_parse_type, + data: *const c_char, + err: *mut nftnl_parse_err, + ) -> c_int; + + pub fn nftnl_set_parse_file( + s: *mut nftnl_set, + type_: nftnl_parse_type, + fp: *mut FILE, + err: *mut nftnl_parse_err, + ) -> c_int; +} +pub const NFTNL_SET_ELEM_FLAGS: u32 = 0; +pub const NFTNL_SET_ELEM_KEY: u32 = 1; +pub const NFTNL_SET_ELEM_VERDICT: u32 = 2; +pub const NFTNL_SET_ELEM_CHAIN: u32 = 3; +pub const NFTNL_SET_ELEM_DATA: u32 = 4; +pub const NFTNL_SET_ELEM_TIMEOUT: u32 = 5; +pub const NFTNL_SET_ELEM_EXPIRATION: u32 = 6; +pub const NFTNL_SET_ELEM_USERDATA: u32 = 7; +pub const NFTNL_SET_ELEM_EXPR: u32 = 8; +pub const NFTNL_SET_ELEM_OBJREF: u32 = 9; + +#[repr(C)] +pub struct nftnl_set_elem(c_void); + +extern "C" { + pub fn nftnl_set_elem_alloc() -> *mut nftnl_set_elem; + + pub fn nftnl_set_elem_free(s: *mut nftnl_set_elem); + + pub fn nftnl_set_elem_clone(elem: *mut nftnl_set_elem) -> *mut nftnl_set_elem; + + pub fn nftnl_set_elem_add(s: *mut nftnl_set, elem: *mut nftnl_set_elem); + + pub fn nftnl_set_elem_unset(s: *mut nftnl_set_elem, attr: u16); + + pub fn nftnl_set_elem_set( + s: *mut nftnl_set_elem, + attr: u16, + data: *const c_void, + data_len: u32, + ) -> c_int; + + pub fn nftnl_set_elem_set_u32(s: *mut nftnl_set_elem, attr: u16, val: u32); + + pub fn nftnl_set_elem_set_u64(s: *mut nftnl_set_elem, attr: u16, val: u64); + + pub fn nftnl_set_elem_set_str(s: *mut nftnl_set_elem, attr: u16, str_: *const c_char) -> c_int; + + pub fn nftnl_set_elem_get( + s: *mut nftnl_set_elem, + attr: u16, + data_len: *mut u32, + ) -> *const c_void; + + pub fn nftnl_set_elem_get_str(s: *mut nftnl_set_elem, attr: u16) -> *const c_char; + + pub fn nftnl_set_elem_get_u32(s: *mut nftnl_set_elem, attr: u16) -> u32; + + pub fn nftnl_set_elem_get_u64(s: *mut nftnl_set_elem, attr: u16) -> u64; + + pub fn nftnl_set_elem_is_set(s: *const nftnl_set_elem, attr: u16) -> bool; + + pub fn nftnl_set_elems_nlmsg_build_payload(nlh: *mut nlmsghdr, s: *mut nftnl_set); + + pub fn nftnl_set_elem_nlmsg_build_payload(nlh: *mut nlmsghdr, e: *mut nftnl_set_elem); + + pub fn nftnl_set_elem_parse( + e: *mut nftnl_set_elem, + type_: nftnl_parse_type, + data: *const c_char, + err: *mut nftnl_parse_err, + ) -> c_int; + + pub fn nftnl_set_elem_parse_file( + e: *mut nftnl_set_elem, + type_: nftnl_parse_type, + fp: *mut FILE, + err: *mut nftnl_parse_err, + ) -> c_int; + + pub fn nftnl_set_elem_snprintf( + buf: *mut c_char, + size: usize, + s: *const nftnl_set_elem, + type_: u32, + flags: u32, + ) -> c_int; + + pub fn nftnl_set_elem_fprintf( + fp: *mut FILE, + se: *mut nftnl_set_elem, + type_: u32, + flags: u32, + ) -> c_int; + + pub fn nftnl_set_elem_foreach( + s: *mut nftnl_set, + cb: Option c_int>, + data: *mut c_void, + ) -> c_int; +} +#[repr(C)] +pub struct nftnl_set_elems_iter(c_void); + +extern "C" { + pub fn nftnl_set_elems_iter_create(s: *const nftnl_set) -> *mut nftnl_set_elems_iter; + + pub fn nftnl_set_elems_iter_cur(iter: *const nftnl_set_elems_iter) -> *mut nftnl_set_elem; + + pub fn nftnl_set_elems_iter_next(iter: *mut nftnl_set_elems_iter) -> *mut nftnl_set_elem; + + pub fn nftnl_set_elems_iter_destroy(iter: *mut nftnl_set_elems_iter); + + pub fn nftnl_set_elems_nlmsg_build_payload_iter( + nlh: *mut nlmsghdr, + iter: *mut nftnl_set_elems_iter, + ) -> c_int; +} +#[repr(C)] +pub struct nftnl_table(c_void); + +extern "C" { + pub fn nftnl_table_alloc() -> *mut nftnl_table; + + pub fn nftnl_table_free(arg1: *const nftnl_table); +} +pub const NFTNL_TABLE_NAME: nftnl_table_attr = 0; +pub const NFTNL_TABLE_FAMILY: nftnl_table_attr = 1; +pub const NFTNL_TABLE_FLAGS: nftnl_table_attr = 2; +pub const NFTNL_TABLE_USE: nftnl_table_attr = 3; +pub const NFTNL_TABLE_HANDLE: nftnl_table_attr = 4; +pub const __NFTNL_TABLE_MAX: nftnl_table_attr = 5; +pub type nftnl_table_attr = c_uint; +extern "C" { + pub fn nftnl_table_is_set(t: *const nftnl_table, attr: u16) -> bool; + + pub fn nftnl_table_unset(t: *mut nftnl_table, attr: u16); + + pub fn nftnl_table_set(t: *mut nftnl_table, attr: u16, data: *const c_void); + + pub fn nftnl_table_set_data( + t: *mut nftnl_table, + attr: u16, + data: *const c_void, + data_len: u32, + ) -> c_int; + + pub fn nftnl_table_get(t: *const nftnl_table, attr: u16) -> *const c_void; + + pub fn nftnl_table_get_data( + t: *const nftnl_table, + attr: u16, + data_len: *mut u32, + ) -> *const c_void; + + pub fn nftnl_table_set_u8(t: *mut nftnl_table, attr: u16, data: u8); + + pub fn nftnl_table_set_u32(t: *mut nftnl_table, attr: u16, data: u32); + + pub fn nftnl_table_set_u64(t: *mut nftnl_table, attr: u16, data: u64); + + pub fn nftnl_table_set_str(t: *mut nftnl_table, attr: u16, str_: *const c_char) -> c_int; + + pub fn nftnl_table_get_u8(t: *const nftnl_table, attr: u16) -> u8; + + pub fn nftnl_table_get_u32(t: *const nftnl_table, attr: u16) -> u32; + + pub fn nftnl_table_get_u64(t: *const nftnl_table, attr: u16) -> u64; + + pub fn nftnl_table_get_str(t: *const nftnl_table, attr: u16) -> *const c_char; + + pub fn nftnl_table_nlmsg_build_payload(nlh: *mut nlmsghdr, t: *const nftnl_table); + + pub fn nftnl_table_parse( + t: *mut nftnl_table, + type_: nftnl_parse_type, + data: *const c_char, + err: *mut nftnl_parse_err, + ) -> c_int; + + pub fn nftnl_table_parse_file( + t: *mut nftnl_table, + type_: nftnl_parse_type, + fp: *mut FILE, + err: *mut nftnl_parse_err, + ) -> c_int; + + pub fn nftnl_table_snprintf( + buf: *mut c_char, + size: usize, + t: *const nftnl_table, + type_: u32, + flags: u32, + ) -> c_int; + + pub fn nftnl_table_fprintf( + fp: *mut FILE, + t: *const nftnl_table, + type_: u32, + flags: u32, + ) -> c_int; + + pub fn nftnl_table_nlmsg_parse(nlh: *const nlmsghdr, t: *mut nftnl_table) -> c_int; +} +#[repr(C)] +pub struct nftnl_table_list(c_void); + +extern "C" { + pub fn nftnl_table_list_alloc() -> *mut nftnl_table_list; + + pub fn nftnl_table_list_free(list: *mut nftnl_table_list); + + pub fn nftnl_table_list_is_empty(list: *const nftnl_table_list) -> c_int; + + pub fn nftnl_table_list_foreach( + table_list: *mut nftnl_table_list, + cb: Option c_int>, + data: *mut c_void, + ) -> c_int; + + pub fn nftnl_table_list_add(r: *mut nftnl_table, list: *mut nftnl_table_list); + + pub fn nftnl_table_list_add_tail(r: *mut nftnl_table, list: *mut nftnl_table_list); + + pub fn nftnl_table_list_del(r: *mut nftnl_table); +} +#[repr(C)] +pub struct nftnl_table_list_iter(c_void); + +extern "C" { + pub fn nftnl_table_list_iter_create(l: *const nftnl_table_list) -> *mut nftnl_table_list_iter; + + pub fn nftnl_table_list_iter_next(iter: *mut nftnl_table_list_iter) -> *mut nftnl_table; + + pub fn nftnl_table_list_iter_destroy(iter: *const nftnl_table_list_iter); +} +pub const NFTNL_TRACE_CHAIN: nftnl_trace_attr = 0; +pub const NFTNL_TRACE_FAMILY: nftnl_trace_attr = 1; +pub const NFTNL_TRACE_ID: nftnl_trace_attr = 2; +pub const NFTNL_TRACE_IIF: nftnl_trace_attr = 3; +pub const NFTNL_TRACE_IIFTYPE: nftnl_trace_attr = 4; +pub const NFTNL_TRACE_JUMP_TARGET: nftnl_trace_attr = 5; +pub const NFTNL_TRACE_OIF: nftnl_trace_attr = 6; +pub const NFTNL_TRACE_OIFTYPE: nftnl_trace_attr = 7; +pub const NFTNL_TRACE_MARK: nftnl_trace_attr = 8; +pub const NFTNL_TRACE_LL_HEADER: nftnl_trace_attr = 9; +pub const NFTNL_TRACE_NETWORK_HEADER: nftnl_trace_attr = 10; +pub const NFTNL_TRACE_TRANSPORT_HEADER: nftnl_trace_attr = 11; +pub const NFTNL_TRACE_TABLE: nftnl_trace_attr = 12; +pub const NFTNL_TRACE_TYPE: nftnl_trace_attr = 13; +pub const NFTNL_TRACE_RULE_HANDLE: nftnl_trace_attr = 14; +pub const NFTNL_TRACE_VERDICT: nftnl_trace_attr = 15; +pub const NFTNL_TRACE_NFPROTO: nftnl_trace_attr = 16; +pub const NFTNL_TRACE_POLICY: nftnl_trace_attr = 17; +pub const __NFTNL_TRACE_MAX: nftnl_trace_attr = 18; +pub type nftnl_trace_attr = c_uint; +#[repr(C)] +pub struct nftnl_trace(c_void); + +extern "C" { + pub fn nftnl_trace_alloc() -> *mut nftnl_trace; + + pub fn nftnl_trace_free(trace: *const nftnl_trace); + + pub fn nftnl_trace_is_set(trace: *const nftnl_trace, type_: u16) -> bool; + + pub fn nftnl_trace_get_data( + trace: *const nftnl_trace, + type_: u16, + data_len: *mut u32, + ) -> *const c_void; + + pub fn nftnl_trace_get_u16(trace: *const nftnl_trace, type_: u16) -> u16; + + pub fn nftnl_trace_get_u32(trace: *const nftnl_trace, type_: u16) -> u32; + + pub fn nftnl_trace_get_u64(trace: *const nftnl_trace, type_: u16) -> u64; + + pub fn nftnl_trace_get_str(trace: *const nftnl_trace, type_: u16) -> *const c_char; + + pub fn nftnl_trace_nlmsg_parse(nlh: *const nlmsghdr, t: *mut nftnl_trace) -> c_int; +} +pub const NFTNL_UDATA_RULE_COMMENT: nftnl_udata_rule_types = 0; +pub const NFTNL_UDATA_RULE_EBTABLES_POLICY: nftnl_udata_rule_types = 1; +pub const __NFTNL_UDATA_RULE_MAX: nftnl_udata_rule_types = 2; +pub type nftnl_udata_rule_types = c_uint; +pub const NFTNL_UDATA_SET_KEYBYTEORDER: nftnl_udata_set_types = 0; +pub const NFTNL_UDATA_SET_DATABYTEORDER: nftnl_udata_set_types = 1; +pub const NFTNL_UDATA_SET_MERGE_ELEMENTS: nftnl_udata_set_types = 2; +pub const __NFTNL_UDATA_SET_MAX: nftnl_udata_set_types = 3; +pub type nftnl_udata_set_types = c_uint; +pub const NFTNL_UDATA_SET_ELEM_COMMENT: nftnl_udata_set_elem_types = 0; +pub const NFTNL_UDATA_SET_ELEM_FLAGS: nftnl_udata_set_elem_types = 1; +pub const __NFTNL_UDATA_SET_ELEM_MAX: nftnl_udata_set_elem_types = 2; +pub type nftnl_udata_set_elem_types = c_uint; +pub const NFTNL_SET_ELEM_F_INTERVAL_OPEN: nftnl_udata_set_elem_flags = 1; +pub type nftnl_udata_set_elem_flags = c_uint; +#[repr(C)] +pub struct nftnl_udata(c_void); + +#[repr(C)] +pub struct nftnl_udata_buf(c_void); + +extern "C" { + pub fn nftnl_udata_buf_alloc(data_size: u32) -> *mut nftnl_udata_buf; + + pub fn nftnl_udata_buf_free(buf: *const nftnl_udata_buf); + + pub fn nftnl_udata_buf_len(buf: *const nftnl_udata_buf) -> u32; + + pub fn nftnl_udata_buf_data(buf: *const nftnl_udata_buf) -> *mut c_void; + + pub fn nftnl_udata_buf_put(buf: *mut nftnl_udata_buf, data: *const c_void, len: u32); + + pub fn nftnl_udata_start(buf: *const nftnl_udata_buf) -> *mut nftnl_udata; + + pub fn nftnl_udata_end(buf: *const nftnl_udata_buf) -> *mut nftnl_udata; + + pub fn nftnl_udata_put( + buf: *mut nftnl_udata_buf, + type_: u8, + len: u32, + value: *const c_void, + ) -> bool; + + pub fn nftnl_udata_put_u32(buf: *mut nftnl_udata_buf, type_: u8, data: u32) -> bool; + + pub fn nftnl_udata_put_strz(buf: *mut nftnl_udata_buf, type_: u8, strz: *const c_char) -> bool; + + pub fn nftnl_udata_type(attr: *const nftnl_udata) -> u8; + + pub fn nftnl_udata_len(attr: *const nftnl_udata) -> u8; + + pub fn nftnl_udata_get(attr: *const nftnl_udata) -> *mut c_void; + + pub fn nftnl_udata_get_u32(attr: *const nftnl_udata) -> u32; + + pub fn nftnl_udata_next(attr: *const nftnl_udata) -> *mut nftnl_udata; +} +pub type nftnl_udata_cb_t = + Option c_int>; +extern "C" { + pub fn nftnl_udata_parse( + data: *const c_void, + data_len: u32, + cb: nftnl_udata_cb_t, + cb_data: *mut c_void, + ) -> c_int; +} diff --git a/nftnl-sys/src/nftnl_1_1_4.rs b/nftnl-sys/src/nftnl_1_1_4.rs new file mode 100644 index 0000000..e3552b1 --- /dev/null +++ b/nftnl-sys/src/nftnl_1_1_4.rs @@ -0,0 +1,1393 @@ +/* automatically generated by rust-bindgen 0.69.4 */ + +use core::option::Option; +use libc::{c_char, c_int, c_uint, c_void, iovec, nlmsghdr, FILE}; + +pub const NFTNL_UDATA_COMMENT_MAXLEN: u32 = 128; +#[repr(C)] +pub struct nftnl_batch(c_void); + +extern "C" { + pub fn nftnl_batch_alloc(pg_size: u32, pg_overrun_size: u32) -> *mut nftnl_batch; + + pub fn nftnl_batch_update(batch: *mut nftnl_batch) -> c_int; + + pub fn nftnl_batch_free(batch: *mut nftnl_batch); + + pub fn nftnl_batch_buffer(batch: *mut nftnl_batch) -> *mut c_void; + + pub fn nftnl_batch_buffer_len(batch: *mut nftnl_batch) -> u32; + + pub fn nftnl_batch_iovec_len(batch: *mut nftnl_batch) -> c_int; + + pub fn nftnl_batch_iovec(batch: *mut nftnl_batch, iov: *mut iovec, iovlen: u32); +} +pub const NFTNL_PARSE_EBADINPUT: u32 = 0; +pub const NFTNL_PARSE_EMISSINGNODE: u32 = 1; +pub const NFTNL_PARSE_EBADTYPE: u32 = 2; +pub const NFTNL_PARSE_EOPNOTSUPP: u32 = 3; + +pub const NFTNL_OUTPUT_DEFAULT: nftnl_output_type = 0; +pub const NFTNL_OUTPUT_XML: nftnl_output_type = 1; +pub const NFTNL_OUTPUT_JSON: nftnl_output_type = 2; +pub type nftnl_output_type = c_uint; +pub const NFTNL_OF_EVENT_NEW: nftnl_output_flags = 1; +pub const NFTNL_OF_EVENT_DEL: nftnl_output_flags = 2; +pub const NFTNL_OF_EVENT_ANY: nftnl_output_flags = 3; +pub type nftnl_output_flags = c_uint; +pub const NFTNL_CMD_UNSPEC: nftnl_cmd_type = 0; +pub const NFTNL_CMD_ADD: nftnl_cmd_type = 1; +pub const NFTNL_CMD_INSERT: nftnl_cmd_type = 2; +pub const NFTNL_CMD_DELETE: nftnl_cmd_type = 3; +pub const NFTNL_CMD_REPLACE: nftnl_cmd_type = 4; +pub const NFTNL_CMD_FLUSH: nftnl_cmd_type = 5; +pub const NFTNL_CMD_MAX: nftnl_cmd_type = 6; +pub type nftnl_cmd_type = c_uint; +pub const NFTNL_PARSE_NONE: nftnl_parse_type = 0; +pub const NFTNL_PARSE_XML: nftnl_parse_type = 1; +pub const NFTNL_PARSE_JSON: nftnl_parse_type = 2; +pub const NFTNL_PARSE_MAX: nftnl_parse_type = 3; +pub type nftnl_parse_type = c_uint; +#[repr(C)] +pub struct nftnl_parse_err(c_void); + +extern "C" { + pub fn nftnl_nlmsg_build_hdr( + buf: *mut c_char, + type_: u16, + family: u16, + flags: u16, + seq: u32, + ) -> *mut nlmsghdr; + + pub fn nftnl_parse_err_alloc() -> *mut nftnl_parse_err; + + pub fn nftnl_parse_err_free(arg1: *mut nftnl_parse_err); + + pub fn nftnl_parse_perror(str_: *const c_char, err: *mut nftnl_parse_err) -> c_int; + + pub fn nftnl_batch_is_supported() -> c_int; + + pub fn nftnl_batch_begin(buf: *mut c_char, seq: u32) -> *mut nlmsghdr; + + pub fn nftnl_batch_end(buf: *mut c_char, seq: u32) -> *mut nlmsghdr; +} +#[repr(C)] +pub struct nftnl_chain(c_void); + +#[repr(C)] +pub struct nftnl_rule(c_void); + +extern "C" { + pub fn nftnl_chain_alloc() -> *mut nftnl_chain; + + pub fn nftnl_chain_free(arg1: *const nftnl_chain); +} +pub const NFTNL_CHAIN_NAME: nftnl_chain_attr = 0; +pub const NFTNL_CHAIN_FAMILY: nftnl_chain_attr = 1; +pub const NFTNL_CHAIN_TABLE: nftnl_chain_attr = 2; +pub const NFTNL_CHAIN_HOOKNUM: nftnl_chain_attr = 3; +pub const NFTNL_CHAIN_PRIO: nftnl_chain_attr = 4; +pub const NFTNL_CHAIN_POLICY: nftnl_chain_attr = 5; +pub const NFTNL_CHAIN_USE: nftnl_chain_attr = 6; +pub const NFTNL_CHAIN_BYTES: nftnl_chain_attr = 7; +pub const NFTNL_CHAIN_PACKETS: nftnl_chain_attr = 8; +pub const NFTNL_CHAIN_HANDLE: nftnl_chain_attr = 9; +pub const NFTNL_CHAIN_TYPE: nftnl_chain_attr = 10; +pub const NFTNL_CHAIN_DEV: nftnl_chain_attr = 11; +pub const __NFTNL_CHAIN_MAX: nftnl_chain_attr = 12; +pub type nftnl_chain_attr = c_uint; +extern "C" { + pub fn nftnl_chain_is_set(c: *const nftnl_chain, attr: u16) -> bool; + + pub fn nftnl_chain_unset(c: *mut nftnl_chain, attr: u16); + + pub fn nftnl_chain_set(t: *mut nftnl_chain, attr: u16, data: *const c_void); + + pub fn nftnl_chain_set_data( + t: *mut nftnl_chain, + attr: u16, + data: *const c_void, + data_len: u32, + ) -> c_int; + + pub fn nftnl_chain_set_u8(t: *mut nftnl_chain, attr: u16, data: u8); + + pub fn nftnl_chain_set_u32(t: *mut nftnl_chain, attr: u16, data: u32); + + pub fn nftnl_chain_set_s32(t: *mut nftnl_chain, attr: u16, data: i32); + + pub fn nftnl_chain_set_u64(t: *mut nftnl_chain, attr: u16, data: u64); + + pub fn nftnl_chain_set_str(t: *mut nftnl_chain, attr: u16, str_: *const c_char) -> c_int; + + pub fn nftnl_chain_get(c: *const nftnl_chain, attr: u16) -> *const c_void; + + pub fn nftnl_chain_get_data( + c: *const nftnl_chain, + attr: u16, + data_len: *mut u32, + ) -> *const c_void; + + pub fn nftnl_chain_get_str(c: *const nftnl_chain, attr: u16) -> *const c_char; + + pub fn nftnl_chain_get_u8(c: *const nftnl_chain, attr: u16) -> u8; + + pub fn nftnl_chain_get_u32(c: *const nftnl_chain, attr: u16) -> u32; + + pub fn nftnl_chain_get_s32(c: *const nftnl_chain, attr: u16) -> i32; + + pub fn nftnl_chain_get_u64(c: *const nftnl_chain, attr: u16) -> u64; + + pub fn nftnl_chain_rule_add(rule: *mut nftnl_rule, c: *mut nftnl_chain); + + pub fn nftnl_chain_rule_del(rule: *mut nftnl_rule); + + pub fn nftnl_chain_rule_add_tail(rule: *mut nftnl_rule, c: *mut nftnl_chain); + + pub fn nftnl_chain_rule_insert_at(rule: *mut nftnl_rule, pos: *mut nftnl_rule); + + pub fn nftnl_chain_rule_append_at(rule: *mut nftnl_rule, pos: *mut nftnl_rule); + + pub fn nftnl_chain_nlmsg_build_payload(nlh: *mut nlmsghdr, t: *const nftnl_chain); + + pub fn nftnl_chain_parse( + c: *mut nftnl_chain, + type_: nftnl_parse_type, + data: *const c_char, + err: *mut nftnl_parse_err, + ) -> c_int; + + pub fn nftnl_chain_parse_file( + c: *mut nftnl_chain, + type_: nftnl_parse_type, + fp: *mut FILE, + err: *mut nftnl_parse_err, + ) -> c_int; + + pub fn nftnl_chain_snprintf( + buf: *mut c_char, + size: usize, + t: *const nftnl_chain, + type_: u32, + flags: u32, + ) -> c_int; + + pub fn nftnl_chain_fprintf( + fp: *mut FILE, + c: *const nftnl_chain, + type_: u32, + flags: u32, + ) -> c_int; + + pub fn nftnl_chain_nlmsg_parse(nlh: *const nlmsghdr, t: *mut nftnl_chain) -> c_int; + + pub fn nftnl_rule_foreach( + c: *mut nftnl_chain, + cb: Option c_int>, + data: *mut c_void, + ) -> c_int; + + pub fn nftnl_rule_lookup_byindex(c: *mut nftnl_chain, index: u32) -> *mut nftnl_rule; +} +#[repr(C)] +pub struct nftnl_rule_iter(c_void); + +extern "C" { + pub fn nftnl_rule_iter_create(c: *const nftnl_chain) -> *mut nftnl_rule_iter; + + pub fn nftnl_rule_iter_next(iter: *mut nftnl_rule_iter) -> *mut nftnl_rule; + + pub fn nftnl_rule_iter_destroy(iter: *mut nftnl_rule_iter); +} +#[repr(C)] +pub struct nftnl_chain_list(c_void); + +extern "C" { + pub fn nftnl_chain_list_alloc() -> *mut nftnl_chain_list; + + pub fn nftnl_chain_list_free(list: *mut nftnl_chain_list); + + pub fn nftnl_chain_list_is_empty(list: *const nftnl_chain_list) -> c_int; + + pub fn nftnl_chain_list_foreach( + chain_list: *mut nftnl_chain_list, + cb: Option c_int>, + data: *mut c_void, + ) -> c_int; + + pub fn nftnl_chain_list_lookup_byname( + chain_list: *mut nftnl_chain_list, + chain: *const c_char, + ) -> *mut nftnl_chain; + + pub fn nftnl_chain_list_add(r: *mut nftnl_chain, list: *mut nftnl_chain_list); + + pub fn nftnl_chain_list_add_tail(r: *mut nftnl_chain, list: *mut nftnl_chain_list); + + pub fn nftnl_chain_list_del(c: *mut nftnl_chain); +} +#[repr(C)] +pub struct nftnl_chain_list_iter(c_void); + +extern "C" { + pub fn nftnl_chain_list_iter_create(l: *const nftnl_chain_list) -> *mut nftnl_chain_list_iter; + + pub fn nftnl_chain_list_iter_next(iter: *mut nftnl_chain_list_iter) -> *mut nftnl_chain; + + pub fn nftnl_chain_list_iter_destroy(iter: *mut nftnl_chain_list_iter); +} +#[repr(C)] +pub struct nftnl_expr(c_void); + +pub const NFTNL_EXPR_NAME: u32 = 0; +pub const NFTNL_EXPR_BASE: u32 = 1; + +extern "C" { + pub fn nftnl_expr_alloc(name: *const c_char) -> *mut nftnl_expr; + + pub fn nftnl_expr_free(expr: *const nftnl_expr); + + pub fn nftnl_expr_is_set(expr: *const nftnl_expr, type_: u16) -> bool; + + pub fn nftnl_expr_set( + expr: *mut nftnl_expr, + type_: u16, + data: *const c_void, + data_len: u32, + ) -> c_int; + + pub fn nftnl_expr_set_u8(expr: *mut nftnl_expr, type_: u16, data: u8); + + pub fn nftnl_expr_set_u16(expr: *mut nftnl_expr, type_: u16, data: u16); + + pub fn nftnl_expr_set_u32(expr: *mut nftnl_expr, type_: u16, data: u32); + + pub fn nftnl_expr_set_u64(expr: *mut nftnl_expr, type_: u16, data: u64); + + pub fn nftnl_expr_set_str(expr: *mut nftnl_expr, type_: u16, str_: *const c_char) -> c_int; + + pub fn nftnl_expr_get(expr: *const nftnl_expr, type_: u16, data_len: *mut u32) + -> *const c_void; + + pub fn nftnl_expr_get_u8(expr: *const nftnl_expr, type_: u16) -> u8; + + pub fn nftnl_expr_get_u16(expr: *const nftnl_expr, type_: u16) -> u16; + + pub fn nftnl_expr_get_u32(expr: *const nftnl_expr, type_: u16) -> u32; + + pub fn nftnl_expr_get_u64(expr: *const nftnl_expr, type_: u16) -> u64; + + pub fn nftnl_expr_get_str(expr: *const nftnl_expr, type_: u16) -> *const c_char; + + pub fn nftnl_expr_snprintf( + buf: *mut c_char, + buflen: usize, + expr: *const nftnl_expr, + type_: u32, + flags: u32, + ) -> c_int; + + pub fn nftnl_expr_fprintf( + fp: *mut FILE, + expr: *const nftnl_expr, + type_: u32, + flags: u32, + ) -> c_int; +} +pub const NFTNL_EXPR_PAYLOAD_DREG: u32 = 1; +pub const NFTNL_EXPR_PAYLOAD_BASE: u32 = 2; +pub const NFTNL_EXPR_PAYLOAD_OFFSET: u32 = 3; +pub const NFTNL_EXPR_PAYLOAD_LEN: u32 = 4; +pub const NFTNL_EXPR_PAYLOAD_SREG: u32 = 5; +pub const NFTNL_EXPR_PAYLOAD_CSUM_TYPE: u32 = 6; +pub const NFTNL_EXPR_PAYLOAD_CSUM_OFFSET: u32 = 7; +pub const NFTNL_EXPR_PAYLOAD_FLAGS: u32 = 8; + +pub const NFTNL_EXPR_NG_DREG: u32 = 1; +pub const NFTNL_EXPR_NG_MODULUS: u32 = 2; +pub const NFTNL_EXPR_NG_TYPE: u32 = 3; +pub const NFTNL_EXPR_NG_OFFSET: u32 = 4; +pub const NFTNL_EXPR_NG_SET_NAME: u32 = 5; +pub const NFTNL_EXPR_NG_SET_ID: u32 = 6; + +pub const NFTNL_EXPR_META_KEY: u32 = 1; +pub const NFTNL_EXPR_META_DREG: u32 = 2; +pub const NFTNL_EXPR_META_SREG: u32 = 3; + +pub const NFTNL_EXPR_RT_KEY: u32 = 1; +pub const NFTNL_EXPR_RT_DREG: u32 = 2; + +pub const NFTNL_EXPR_SOCKET_KEY: u32 = 1; +pub const NFTNL_EXPR_SOCKET_DREG: u32 = 2; + +pub const NFTNL_EXPR_TUNNEL_KEY: u32 = 1; +pub const NFTNL_EXPR_TUNNEL_DREG: u32 = 2; + +pub const NFTNL_EXPR_CMP_SREG: u32 = 1; +pub const NFTNL_EXPR_CMP_OP: u32 = 2; +pub const NFTNL_EXPR_CMP_DATA: u32 = 3; + +pub const NFTNL_EXPR_RANGE_SREG: u32 = 1; +pub const NFTNL_EXPR_RANGE_OP: u32 = 2; +pub const NFTNL_EXPR_RANGE_FROM_DATA: u32 = 3; +pub const NFTNL_EXPR_RANGE_TO_DATA: u32 = 4; + +pub const NFTNL_EXPR_IMM_DREG: u32 = 1; +pub const NFTNL_EXPR_IMM_DATA: u32 = 2; +pub const NFTNL_EXPR_IMM_VERDICT: u32 = 3; +pub const NFTNL_EXPR_IMM_CHAIN: u32 = 4; + +pub const NFTNL_EXPR_CTR_PACKETS: u32 = 1; +pub const NFTNL_EXPR_CTR_BYTES: u32 = 2; + +pub const NFTNL_EXPR_CONNLIMIT_COUNT: u32 = 1; +pub const NFTNL_EXPR_CONNLIMIT_FLAGS: u32 = 2; + +pub const NFTNL_EXPR_BITWISE_SREG: u32 = 1; +pub const NFTNL_EXPR_BITWISE_DREG: u32 = 2; +pub const NFTNL_EXPR_BITWISE_LEN: u32 = 3; +pub const NFTNL_EXPR_BITWISE_MASK: u32 = 4; +pub const NFTNL_EXPR_BITWISE_XOR: u32 = 5; + +pub const NFTNL_EXPR_TG_NAME: u32 = 1; +pub const NFTNL_EXPR_TG_REV: u32 = 2; +pub const NFTNL_EXPR_TG_INFO: u32 = 3; + +pub const NFTNL_EXPR_MT_NAME: u32 = 1; +pub const NFTNL_EXPR_MT_REV: u32 = 2; +pub const NFTNL_EXPR_MT_INFO: u32 = 3; + +pub const NFTNL_EXPR_NAT_TYPE: u32 = 1; +pub const NFTNL_EXPR_NAT_FAMILY: u32 = 2; +pub const NFTNL_EXPR_NAT_REG_ADDR_MIN: u32 = 3; +pub const NFTNL_EXPR_NAT_REG_ADDR_MAX: u32 = 4; +pub const NFTNL_EXPR_NAT_REG_PROTO_MIN: u32 = 5; +pub const NFTNL_EXPR_NAT_REG_PROTO_MAX: u32 = 6; +pub const NFTNL_EXPR_NAT_FLAGS: u32 = 7; + +pub const NFTNL_EXPR_TPROXY_FAMILY: u32 = 1; +pub const NFTNL_EXPR_TPROXY_REG_ADDR: u32 = 2; +pub const NFTNL_EXPR_TPROXY_REG_PORT: u32 = 3; + +pub const NFTNL_EXPR_LOOKUP_SREG: u32 = 1; +pub const NFTNL_EXPR_LOOKUP_DREG: u32 = 2; +pub const NFTNL_EXPR_LOOKUP_SET: u32 = 3; +pub const NFTNL_EXPR_LOOKUP_SET_ID: u32 = 4; +pub const NFTNL_EXPR_LOOKUP_FLAGS: u32 = 5; + +pub const NFTNL_EXPR_DYNSET_SREG_KEY: u32 = 1; +pub const NFTNL_EXPR_DYNSET_SREG_DATA: u32 = 2; +pub const NFTNL_EXPR_DYNSET_OP: u32 = 3; +pub const NFTNL_EXPR_DYNSET_TIMEOUT: u32 = 4; +pub const NFTNL_EXPR_DYNSET_SET_NAME: u32 = 5; +pub const NFTNL_EXPR_DYNSET_SET_ID: u32 = 6; +pub const NFTNL_EXPR_DYNSET_EXPR: u32 = 7; + +pub const NFTNL_EXPR_LOG_PREFIX: u32 = 1; +pub const NFTNL_EXPR_LOG_GROUP: u32 = 2; +pub const NFTNL_EXPR_LOG_SNAPLEN: u32 = 3; +pub const NFTNL_EXPR_LOG_QTHRESHOLD: u32 = 4; +pub const NFTNL_EXPR_LOG_LEVEL: u32 = 5; +pub const NFTNL_EXPR_LOG_FLAGS: u32 = 6; + +pub const NFTNL_EXPR_EXTHDR_DREG: u32 = 1; +pub const NFTNL_EXPR_EXTHDR_TYPE: u32 = 2; +pub const NFTNL_EXPR_EXTHDR_OFFSET: u32 = 3; +pub const NFTNL_EXPR_EXTHDR_LEN: u32 = 4; +pub const NFTNL_EXPR_EXTHDR_FLAGS: u32 = 5; +pub const NFTNL_EXPR_EXTHDR_OP: u32 = 6; +pub const NFTNL_EXPR_EXTHDR_SREG: u32 = 7; + +pub const NFTNL_EXPR_CT_DREG: u32 = 1; +pub const NFTNL_EXPR_CT_KEY: u32 = 2; +pub const NFTNL_EXPR_CT_DIR: u32 = 3; +pub const NFTNL_EXPR_CT_SREG: u32 = 4; + +pub const NFTNL_EXPR_BYTEORDER_DREG: u32 = 1; +pub const NFTNL_EXPR_BYTEORDER_SREG: u32 = 2; +pub const NFTNL_EXPR_BYTEORDER_OP: u32 = 3; +pub const NFTNL_EXPR_BYTEORDER_LEN: u32 = 4; +pub const NFTNL_EXPR_BYTEORDER_SIZE: u32 = 5; + +pub const NFTNL_EXPR_LIMIT_RATE: u32 = 1; +pub const NFTNL_EXPR_LIMIT_UNIT: u32 = 2; +pub const NFTNL_EXPR_LIMIT_BURST: u32 = 3; +pub const NFTNL_EXPR_LIMIT_TYPE: u32 = 4; +pub const NFTNL_EXPR_LIMIT_FLAGS: u32 = 5; + +pub const NFTNL_EXPR_REJECT_TYPE: u32 = 1; +pub const NFTNL_EXPR_REJECT_CODE: u32 = 2; + +pub const NFTNL_EXPR_QUEUE_NUM: u32 = 1; +pub const NFTNL_EXPR_QUEUE_TOTAL: u32 = 2; +pub const NFTNL_EXPR_QUEUE_FLAGS: u32 = 3; +pub const NFTNL_EXPR_QUEUE_SREG_QNUM: u32 = 4; + +pub const NFTNL_EXPR_QUOTA_BYTES: u32 = 1; +pub const NFTNL_EXPR_QUOTA_FLAGS: u32 = 2; +pub const NFTNL_EXPR_QUOTA_CONSUMED: u32 = 3; + +pub const NFTNL_EXPR_MASQ_FLAGS: u32 = 1; +pub const NFTNL_EXPR_MASQ_REG_PROTO_MIN: u32 = 2; +pub const NFTNL_EXPR_MASQ_REG_PROTO_MAX: u32 = 3; + +pub const NFTNL_EXPR_REDIR_REG_PROTO_MIN: u32 = 1; +pub const NFTNL_EXPR_REDIR_REG_PROTO_MAX: u32 = 2; +pub const NFTNL_EXPR_REDIR_FLAGS: u32 = 3; + +pub const NFTNL_EXPR_DUP_SREG_ADDR: u32 = 1; +pub const NFTNL_EXPR_DUP_SREG_DEV: u32 = 2; + +pub const NFTNL_EXPR_FLOW_TABLE_NAME: u32 = 1; + +pub const NFTNL_EXPR_FWD_SREG_DEV: u32 = 1; +pub const NFTNL_EXPR_FWD_SREG_ADDR: u32 = 2; +pub const NFTNL_EXPR_FWD_NFPROTO: u32 = 3; + +pub const NFTNL_EXPR_HASH_SREG: u32 = 1; +pub const NFTNL_EXPR_HASH_DREG: u32 = 2; +pub const NFTNL_EXPR_HASH_LEN: u32 = 3; +pub const NFTNL_EXPR_HASH_MODULUS: u32 = 4; +pub const NFTNL_EXPR_HASH_SEED: u32 = 5; +pub const NFTNL_EXPR_HASH_OFFSET: u32 = 6; +pub const NFTNL_EXPR_HASH_TYPE: u32 = 7; +pub const NFTNL_EXPR_HASH_SET_NAME: u32 = 8; +pub const NFTNL_EXPR_HASH_SET_ID: u32 = 9; + +pub const NFTNL_EXPR_FIB_DREG: u32 = 1; +pub const NFTNL_EXPR_FIB_RESULT: u32 = 2; +pub const NFTNL_EXPR_FIB_FLAGS: u32 = 3; + +pub const NFTNL_EXPR_OBJREF_IMM_TYPE: u32 = 1; +pub const NFTNL_EXPR_OBJREF_IMM_NAME: u32 = 2; +pub const NFTNL_EXPR_OBJREF_SET_SREG: u32 = 3; +pub const NFTNL_EXPR_OBJREF_SET_NAME: u32 = 4; +pub const NFTNL_EXPR_OBJREF_SET_ID: u32 = 5; + +pub const NFTNL_EXPR_OSF_DREG: u32 = 1; +pub const NFTNL_EXPR_OSF_TTL: u32 = 2; +pub const NFTNL_EXPR_OSF_FLAGS: u32 = 3; + +pub const NFTNL_EXPR_XFRM_DREG: u32 = 1; +pub const NFTNL_EXPR_XFRM_SREG: u32 = 2; +pub const NFTNL_EXPR_XFRM_KEY: u32 = 3; +pub const NFTNL_EXPR_XFRM_DIR: u32 = 4; +pub const NFTNL_EXPR_XFRM_SPNUM: u32 = 5; + +pub const NFTNL_EXPR_SYNPROXY_MSS: u32 = 1; +pub const NFTNL_EXPR_SYNPROXY_WSCALE: u32 = 2; +pub const NFTNL_EXPR_SYNPROXY_FLAGS: u32 = 3; + +#[repr(C)] +pub struct nftnl_gen(c_void); + +extern "C" { + pub fn nftnl_gen_alloc() -> *mut nftnl_gen; + + pub fn nftnl_gen_free(arg1: *const nftnl_gen); +} +pub const NFTNL_GEN_ID: u32 = 0; +pub const __NFTNL_GEN_MAX: u32 = 1; + +extern "C" { + pub fn nftnl_gen_is_set(gen: *const nftnl_gen, attr: u16) -> bool; + + pub fn nftnl_gen_unset(gen: *mut nftnl_gen, attr: u16); + + pub fn nftnl_gen_set(gen: *mut nftnl_gen, attr: u16, data: *const c_void) -> c_int; + + pub fn nftnl_gen_set_data( + gen: *mut nftnl_gen, + attr: u16, + data: *const c_void, + data_len: u32, + ) -> c_int; + + pub fn nftnl_gen_get(gen: *const nftnl_gen, attr: u16) -> *const c_void; + + pub fn nftnl_gen_get_data( + gen: *const nftnl_gen, + attr: u16, + data_len: *mut u32, + ) -> *const c_void; + + pub fn nftnl_gen_set_u32(gen: *mut nftnl_gen, attr: u16, data: u32); + + pub fn nftnl_gen_get_u32(gen: *const nftnl_gen, attr: u16) -> u32; + + pub fn nftnl_gen_nlmsg_parse(nlh: *const nlmsghdr, gen: *mut nftnl_gen) -> c_int; + + pub fn nftnl_gen_snprintf( + buf: *mut c_char, + size: usize, + gen: *const nftnl_gen, + type_: u32, + flags: u32, + ) -> c_int; + + pub fn nftnl_gen_fprintf(fp: *mut FILE, gen: *const nftnl_gen, type_: u32, flags: u32) + -> c_int; +} +pub const NFTNL_OBJ_TABLE: u32 = 0; +pub const NFTNL_OBJ_NAME: u32 = 1; +pub const NFTNL_OBJ_TYPE: u32 = 2; +pub const NFTNL_OBJ_FAMILY: u32 = 3; +pub const NFTNL_OBJ_USE: u32 = 4; +pub const NFTNL_OBJ_HANDLE: u32 = 5; +pub const NFTNL_OBJ_BASE: u32 = 16; +pub const __NFTNL_OBJ_MAX: u32 = 17; + +pub const NFTNL_OBJ_CTR_PKTS: u32 = 16; +pub const NFTNL_OBJ_CTR_BYTES: u32 = 17; + +pub const NFTNL_OBJ_QUOTA_BYTES: u32 = 16; +pub const NFTNL_OBJ_QUOTA_CONSUMED: u32 = 17; +pub const NFTNL_OBJ_QUOTA_FLAGS: u32 = 18; + +pub const NFTNL_OBJ_CT_HELPER_NAME: u32 = 16; +pub const NFTNL_OBJ_CT_HELPER_L3PROTO: u32 = 17; +pub const NFTNL_OBJ_CT_HELPER_L4PROTO: u32 = 18; + +pub const NFTNL_CTTIMEOUT_TCP_SYN_SENT: nftnl_cttimeout_array_tcp = 0; +pub const NFTNL_CTTIMEOUT_TCP_SYN_RECV: nftnl_cttimeout_array_tcp = 1; +pub const NFTNL_CTTIMEOUT_TCP_ESTABLISHED: nftnl_cttimeout_array_tcp = 2; +pub const NFTNL_CTTIMEOUT_TCP_FIN_WAIT: nftnl_cttimeout_array_tcp = 3; +pub const NFTNL_CTTIMEOUT_TCP_CLOSE_WAIT: nftnl_cttimeout_array_tcp = 4; +pub const NFTNL_CTTIMEOUT_TCP_LAST_ACK: nftnl_cttimeout_array_tcp = 5; +pub const NFTNL_CTTIMEOUT_TCP_TIME_WAIT: nftnl_cttimeout_array_tcp = 6; +pub const NFTNL_CTTIMEOUT_TCP_CLOSE: nftnl_cttimeout_array_tcp = 7; +pub const NFTNL_CTTIMEOUT_TCP_SYN_SENT2: nftnl_cttimeout_array_tcp = 8; +pub const NFTNL_CTTIMEOUT_TCP_RETRANS: nftnl_cttimeout_array_tcp = 9; +pub const NFTNL_CTTIMEOUT_TCP_UNACK: nftnl_cttimeout_array_tcp = 10; +pub const NFTNL_CTTIMEOUT_TCP_MAX: nftnl_cttimeout_array_tcp = 11; +pub type nftnl_cttimeout_array_tcp = c_uint; +pub const NFTNL_CTTIMEOUT_UDP_UNREPLIED: nftnl_cttimeout_array_udp = 0; +pub const NFTNL_CTTIMEOUT_UDP_REPLIED: nftnl_cttimeout_array_udp = 1; +pub const NFTNL_CTTIMEOUT_UDP_MAX: nftnl_cttimeout_array_udp = 2; +pub type nftnl_cttimeout_array_udp = c_uint; +pub const NFTNL_OBJ_CT_TIMEOUT_L3PROTO: u32 = 16; +pub const NFTNL_OBJ_CT_TIMEOUT_L4PROTO: u32 = 17; +pub const NFTNL_OBJ_CT_TIMEOUT_ARRAY: u32 = 18; + +pub const NFTNL_OBJ_CT_EXPECT_L3PROTO: u32 = 16; +pub const NFTNL_OBJ_CT_EXPECT_L4PROTO: u32 = 17; +pub const NFTNL_OBJ_CT_EXPECT_DPORT: u32 = 18; +pub const NFTNL_OBJ_CT_EXPECT_TIMEOUT: u32 = 19; +pub const NFTNL_OBJ_CT_EXPECT_SIZE: u32 = 20; + +pub const NFTNL_OBJ_LIMIT_RATE: u32 = 16; +pub const NFTNL_OBJ_LIMIT_UNIT: u32 = 17; +pub const NFTNL_OBJ_LIMIT_BURST: u32 = 18; +pub const NFTNL_OBJ_LIMIT_TYPE: u32 = 19; +pub const NFTNL_OBJ_LIMIT_FLAGS: u32 = 20; + +pub const NFTNL_OBJ_TUNNEL_ID: u32 = 16; +pub const NFTNL_OBJ_TUNNEL_IPV4_SRC: u32 = 17; +pub const NFTNL_OBJ_TUNNEL_IPV4_DST: u32 = 18; +pub const NFTNL_OBJ_TUNNEL_IPV6_SRC: u32 = 19; +pub const NFTNL_OBJ_TUNNEL_IPV6_DST: u32 = 20; +pub const NFTNL_OBJ_TUNNEL_IPV6_FLOWLABEL: u32 = 21; +pub const NFTNL_OBJ_TUNNEL_SPORT: u32 = 22; +pub const NFTNL_OBJ_TUNNEL_DPORT: u32 = 23; +pub const NFTNL_OBJ_TUNNEL_FLAGS: u32 = 24; +pub const NFTNL_OBJ_TUNNEL_TOS: u32 = 25; +pub const NFTNL_OBJ_TUNNEL_TTL: u32 = 26; +pub const NFTNL_OBJ_TUNNEL_VXLAN_GBP: u32 = 27; +pub const NFTNL_OBJ_TUNNEL_ERSPAN_VERSION: u32 = 28; +pub const NFTNL_OBJ_TUNNEL_ERSPAN_V1_INDEX: u32 = 29; +pub const NFTNL_OBJ_TUNNEL_ERSPAN_V2_HWID: u32 = 30; +pub const NFTNL_OBJ_TUNNEL_ERSPAN_V2_DIR: u32 = 31; + +pub const NFTNL_OBJ_SECMARK_CTX: u32 = 16; + +#[repr(C)] +pub struct nftnl_obj(c_void); + +extern "C" { + pub fn nftnl_obj_alloc() -> *mut nftnl_obj; + + pub fn nftnl_obj_free(ne: *const nftnl_obj); + + pub fn nftnl_obj_is_set(ne: *const nftnl_obj, attr: u16) -> bool; + + pub fn nftnl_obj_unset(ne: *mut nftnl_obj, attr: u16); + + pub fn nftnl_obj_set_data(ne: *mut nftnl_obj, attr: u16, data: *const c_void, data_len: u32); + + pub fn nftnl_obj_set(ne: *mut nftnl_obj, attr: u16, data: *const c_void); + + pub fn nftnl_obj_set_u8(ne: *mut nftnl_obj, attr: u16, val: u8); + + pub fn nftnl_obj_set_u16(ne: *mut nftnl_obj, attr: u16, val: u16); + + pub fn nftnl_obj_set_u32(ne: *mut nftnl_obj, attr: u16, val: u32); + + pub fn nftnl_obj_set_u64(obj: *mut nftnl_obj, attr: u16, val: u64); + + pub fn nftnl_obj_set_str(ne: *mut nftnl_obj, attr: u16, str_: *const c_char); + + pub fn nftnl_obj_get_data(ne: *mut nftnl_obj, attr: u16, data_len: *mut u32) -> *const c_void; + + pub fn nftnl_obj_get(ne: *mut nftnl_obj, attr: u16) -> *const c_void; + + pub fn nftnl_obj_get_u8(ne: *mut nftnl_obj, attr: u16) -> u8; + + pub fn nftnl_obj_get_u16(obj: *mut nftnl_obj, attr: u16) -> u16; + + pub fn nftnl_obj_get_u32(ne: *mut nftnl_obj, attr: u16) -> u32; + + pub fn nftnl_obj_get_u64(obj: *mut nftnl_obj, attr: u16) -> u64; + + pub fn nftnl_obj_get_str(ne: *mut nftnl_obj, attr: u16) -> *const c_char; + + pub fn nftnl_obj_nlmsg_build_payload(nlh: *mut nlmsghdr, ne: *const nftnl_obj); + + pub fn nftnl_obj_nlmsg_parse(nlh: *const nlmsghdr, ne: *mut nftnl_obj) -> c_int; + + pub fn nftnl_obj_parse( + ne: *mut nftnl_obj, + type_: nftnl_parse_type, + data: *const c_char, + err: *mut nftnl_parse_err, + ) -> c_int; + + pub fn nftnl_obj_parse_file( + ne: *mut nftnl_obj, + type_: nftnl_parse_type, + fp: *mut FILE, + err: *mut nftnl_parse_err, + ) -> c_int; + + pub fn nftnl_obj_snprintf( + buf: *mut c_char, + size: usize, + ne: *const nftnl_obj, + type_: u32, + flags: u32, + ) -> c_int; + + pub fn nftnl_obj_fprintf(fp: *mut FILE, ne: *const nftnl_obj, type_: u32, flags: u32) -> c_int; +} +#[repr(C)] +pub struct nftnl_obj_list(c_void); + +extern "C" { + pub fn nftnl_obj_list_alloc() -> *mut nftnl_obj_list; + + pub fn nftnl_obj_list_free(list: *mut nftnl_obj_list); + + pub fn nftnl_obj_list_is_empty(list: *mut nftnl_obj_list) -> c_int; + + pub fn nftnl_obj_list_add(r: *mut nftnl_obj, list: *mut nftnl_obj_list); + + pub fn nftnl_obj_list_add_tail(r: *mut nftnl_obj, list: *mut nftnl_obj_list); + + pub fn nftnl_obj_list_del(t: *mut nftnl_obj); + + pub fn nftnl_obj_list_foreach( + table_list: *mut nftnl_obj_list, + cb: Option c_int>, + data: *mut c_void, + ) -> c_int; +} +#[repr(C)] +pub struct nftnl_obj_list_iter(c_void); + +extern "C" { + pub fn nftnl_obj_list_iter_create(l: *mut nftnl_obj_list) -> *mut nftnl_obj_list_iter; + + pub fn nftnl_obj_list_iter_next(iter: *mut nftnl_obj_list_iter) -> *mut nftnl_obj; + + pub fn nftnl_obj_list_iter_destroy(iter: *mut nftnl_obj_list_iter); + + pub fn nftnl_rule_alloc() -> *mut nftnl_rule; + + pub fn nftnl_rule_free(arg1: *const nftnl_rule); +} +pub const NFTNL_RULE_FAMILY: nftnl_rule_attr = 0; +pub const NFTNL_RULE_TABLE: nftnl_rule_attr = 1; +pub const NFTNL_RULE_CHAIN: nftnl_rule_attr = 2; +pub const NFTNL_RULE_HANDLE: nftnl_rule_attr = 3; +pub const NFTNL_RULE_COMPAT_PROTO: nftnl_rule_attr = 4; +pub const NFTNL_RULE_COMPAT_FLAGS: nftnl_rule_attr = 5; +pub const NFTNL_RULE_POSITION: nftnl_rule_attr = 6; +pub const NFTNL_RULE_USERDATA: nftnl_rule_attr = 7; +pub const NFTNL_RULE_ID: nftnl_rule_attr = 8; +pub const NFTNL_RULE_POSITION_ID: nftnl_rule_attr = 9; +pub const __NFTNL_RULE_MAX: nftnl_rule_attr = 10; +pub type nftnl_rule_attr = c_uint; +extern "C" { + pub fn nftnl_rule_unset(r: *mut nftnl_rule, attr: u16); + + pub fn nftnl_rule_is_set(r: *const nftnl_rule, attr: u16) -> bool; + + pub fn nftnl_rule_set(r: *mut nftnl_rule, attr: u16, data: *const c_void) -> c_int; + + pub fn nftnl_rule_set_data( + r: *mut nftnl_rule, + attr: u16, + data: *const c_void, + data_len: u32, + ) -> c_int; + + pub fn nftnl_rule_set_u32(r: *mut nftnl_rule, attr: u16, val: u32); + + pub fn nftnl_rule_set_u64(r: *mut nftnl_rule, attr: u16, val: u64); + + pub fn nftnl_rule_set_str(r: *mut nftnl_rule, attr: u16, str_: *const c_char) -> c_int; + + pub fn nftnl_rule_get(r: *const nftnl_rule, attr: u16) -> *const c_void; + + pub fn nftnl_rule_get_data( + r: *const nftnl_rule, + attr: u16, + data_len: *mut u32, + ) -> *const c_void; + + pub fn nftnl_rule_get_str(r: *const nftnl_rule, attr: u16) -> *const c_char; + + pub fn nftnl_rule_get_u8(r: *const nftnl_rule, attr: u16) -> u8; + + pub fn nftnl_rule_get_u32(r: *const nftnl_rule, attr: u16) -> u32; + + pub fn nftnl_rule_get_u64(r: *const nftnl_rule, attr: u16) -> u64; + + pub fn nftnl_rule_add_expr(r: *mut nftnl_rule, expr: *mut nftnl_expr); + + pub fn nftnl_rule_nlmsg_build_payload(nlh: *mut nlmsghdr, t: *mut nftnl_rule); + + pub fn nftnl_rule_parse( + r: *mut nftnl_rule, + type_: nftnl_parse_type, + data: *const c_char, + err: *mut nftnl_parse_err, + ) -> c_int; + + pub fn nftnl_rule_parse_file( + r: *mut nftnl_rule, + type_: nftnl_parse_type, + fp: *mut FILE, + err: *mut nftnl_parse_err, + ) -> c_int; + + pub fn nftnl_rule_snprintf( + buf: *mut c_char, + size: usize, + t: *const nftnl_rule, + type_: u32, + flags: u32, + ) -> c_int; + + pub fn nftnl_rule_fprintf(fp: *mut FILE, r: *const nftnl_rule, type_: u32, flags: u32) + -> c_int; + + pub fn nftnl_rule_nlmsg_parse(nlh: *const nlmsghdr, t: *mut nftnl_rule) -> c_int; + + pub fn nftnl_expr_foreach( + r: *mut nftnl_rule, + cb: Option c_int>, + data: *mut c_void, + ) -> c_int; +} +#[repr(C)] +pub struct nftnl_expr_iter(c_void); + +extern "C" { + pub fn nftnl_expr_iter_create(r: *const nftnl_rule) -> *mut nftnl_expr_iter; + + pub fn nftnl_expr_iter_next(iter: *mut nftnl_expr_iter) -> *mut nftnl_expr; + + pub fn nftnl_expr_iter_destroy(iter: *mut nftnl_expr_iter); +} +#[repr(C)] +pub struct nftnl_rule_list(c_void); + +extern "C" { + pub fn nftnl_rule_list_alloc() -> *mut nftnl_rule_list; + + pub fn nftnl_rule_list_free(list: *mut nftnl_rule_list); + + pub fn nftnl_rule_list_is_empty(list: *const nftnl_rule_list) -> c_int; + + pub fn nftnl_rule_list_add(r: *mut nftnl_rule, list: *mut nftnl_rule_list); + + pub fn nftnl_rule_list_add_tail(r: *mut nftnl_rule, list: *mut nftnl_rule_list); + + pub fn nftnl_rule_list_insert_at(r: *mut nftnl_rule, pos: *mut nftnl_rule); + + pub fn nftnl_rule_list_del(r: *mut nftnl_rule); + + pub fn nftnl_rule_list_foreach( + rule_list: *mut nftnl_rule_list, + cb: Option c_int>, + data: *mut c_void, + ) -> c_int; +} +#[repr(C)] +pub struct nftnl_rule_list_iter(c_void); + +extern "C" { + pub fn nftnl_rule_list_iter_create(l: *const nftnl_rule_list) -> *mut nftnl_rule_list_iter; + + pub fn nftnl_rule_list_iter_cur(iter: *mut nftnl_rule_list_iter) -> *mut nftnl_rule; + + pub fn nftnl_rule_list_iter_next(iter: *mut nftnl_rule_list_iter) -> *mut nftnl_rule; + + pub fn nftnl_rule_list_iter_destroy(iter: *const nftnl_rule_list_iter); +} +#[repr(C)] +pub struct nftnl_ruleset(c_void); + +extern "C" { + pub fn nftnl_ruleset_alloc() -> *mut nftnl_ruleset; + + pub fn nftnl_ruleset_free(r: *const nftnl_ruleset); +} +pub const NFTNL_RULESET_TABLELIST: u32 = 0; +pub const NFTNL_RULESET_CHAINLIST: u32 = 1; +pub const NFTNL_RULESET_SETLIST: u32 = 2; +pub const NFTNL_RULESET_RULELIST: u32 = 3; + +pub const NFTNL_RULESET_UNSPEC: nftnl_ruleset_type = 0; +pub const NFTNL_RULESET_RULESET: nftnl_ruleset_type = 1; +pub const NFTNL_RULESET_TABLE: nftnl_ruleset_type = 2; +pub const NFTNL_RULESET_CHAIN: nftnl_ruleset_type = 3; +pub const NFTNL_RULESET_RULE: nftnl_ruleset_type = 4; +pub const NFTNL_RULESET_SET: nftnl_ruleset_type = 5; +pub const NFTNL_RULESET_SET_ELEMS: nftnl_ruleset_type = 6; +pub type nftnl_ruleset_type = c_uint; +extern "C" { + pub fn nftnl_ruleset_is_set(r: *const nftnl_ruleset, attr: u16) -> bool; + + pub fn nftnl_ruleset_unset(r: *mut nftnl_ruleset, attr: u16); + + pub fn nftnl_ruleset_set(r: *mut nftnl_ruleset, attr: u16, data: *mut c_void); + + pub fn nftnl_ruleset_get(r: *const nftnl_ruleset, attr: u16) -> *mut c_void; +} +pub const NFTNL_RULESET_CTX_CMD: u32 = 0; +pub const NFTNL_RULESET_CTX_TYPE: u32 = 1; +pub const NFTNL_RULESET_CTX_TABLE: u32 = 2; +pub const NFTNL_RULESET_CTX_CHAIN: u32 = 3; +pub const NFTNL_RULESET_CTX_RULE: u32 = 4; +pub const NFTNL_RULESET_CTX_SET: u32 = 5; +pub const NFTNL_RULESET_CTX_DATA: u32 = 6; + +#[repr(C)] +pub struct nftnl_parse_ctx(c_void); + +extern "C" { + pub fn nftnl_ruleset_ctx_free(ctx: *const nftnl_parse_ctx); + + pub fn nftnl_ruleset_ctx_is_set(ctx: *const nftnl_parse_ctx, attr: u16) -> bool; + + pub fn nftnl_ruleset_ctx_get(ctx: *const nftnl_parse_ctx, attr: u16) -> *mut c_void; + + pub fn nftnl_ruleset_ctx_get_u32(ctx: *const nftnl_parse_ctx, attr: u16) -> u32; + + pub fn nftnl_ruleset_parse_file_cb( + type_: nftnl_parse_type, + fp: *mut FILE, + err: *mut nftnl_parse_err, + data: *mut c_void, + cb: Option c_int>, + ) -> c_int; + + pub fn nftnl_ruleset_parse_buffer_cb( + type_: nftnl_parse_type, + buffer: *const c_char, + err: *mut nftnl_parse_err, + data: *mut c_void, + cb: Option c_int>, + ) -> c_int; + + pub fn nftnl_ruleset_parse( + rs: *mut nftnl_ruleset, + type_: nftnl_parse_type, + data: *const c_char, + err: *mut nftnl_parse_err, + ) -> c_int; + + pub fn nftnl_ruleset_parse_file( + rs: *mut nftnl_ruleset, + type_: nftnl_parse_type, + fp: *mut FILE, + err: *mut nftnl_parse_err, + ) -> c_int; + + pub fn nftnl_ruleset_snprintf( + buf: *mut c_char, + size: usize, + rs: *const nftnl_ruleset, + type_: u32, + flags: u32, + ) -> c_int; + + pub fn nftnl_ruleset_fprintf( + fp: *mut FILE, + rs: *const nftnl_ruleset, + type_: u32, + flags: u32, + ) -> c_int; +} +pub const NFTNL_SET_TABLE: nftnl_set_attr = 0; +pub const NFTNL_SET_NAME: nftnl_set_attr = 1; +pub const NFTNL_SET_FLAGS: nftnl_set_attr = 2; +pub const NFTNL_SET_KEY_TYPE: nftnl_set_attr = 3; +pub const NFTNL_SET_KEY_LEN: nftnl_set_attr = 4; +pub const NFTNL_SET_DATA_TYPE: nftnl_set_attr = 5; +pub const NFTNL_SET_DATA_LEN: nftnl_set_attr = 6; +pub const NFTNL_SET_FAMILY: nftnl_set_attr = 7; +pub const NFTNL_SET_ID: nftnl_set_attr = 8; +pub const NFTNL_SET_POLICY: nftnl_set_attr = 9; +pub const NFTNL_SET_DESC_SIZE: nftnl_set_attr = 10; +pub const NFTNL_SET_TIMEOUT: nftnl_set_attr = 11; +pub const NFTNL_SET_GC_INTERVAL: nftnl_set_attr = 12; +pub const NFTNL_SET_USERDATA: nftnl_set_attr = 13; +pub const NFTNL_SET_OBJ_TYPE: nftnl_set_attr = 14; +pub const NFTNL_SET_HANDLE: nftnl_set_attr = 15; +pub const __NFTNL_SET_MAX: nftnl_set_attr = 16; +pub type nftnl_set_attr = c_uint; +#[repr(C)] +pub struct nftnl_set(c_void); + +extern "C" { + pub fn nftnl_set_alloc() -> *mut nftnl_set; + + pub fn nftnl_set_free(s: *const nftnl_set); + + pub fn nftnl_set_clone(set: *const nftnl_set) -> *mut nftnl_set; + + pub fn nftnl_set_is_set(s: *const nftnl_set, attr: u16) -> bool; + + pub fn nftnl_set_unset(s: *mut nftnl_set, attr: u16); + + pub fn nftnl_set_set(s: *mut nftnl_set, attr: u16, data: *const c_void) -> c_int; + + pub fn nftnl_set_set_data( + s: *mut nftnl_set, + attr: u16, + data: *const c_void, + data_len: u32, + ) -> c_int; + + pub fn nftnl_set_set_u32(s: *mut nftnl_set, attr: u16, val: u32); + + pub fn nftnl_set_set_u64(s: *mut nftnl_set, attr: u16, val: u64); + + pub fn nftnl_set_set_str(s: *mut nftnl_set, attr: u16, str_: *const c_char) -> c_int; + + pub fn nftnl_set_get(s: *const nftnl_set, attr: u16) -> *const c_void; + + pub fn nftnl_set_get_data(s: *const nftnl_set, attr: u16, data_len: *mut u32) -> *const c_void; + + pub fn nftnl_set_get_str(s: *const nftnl_set, attr: u16) -> *const c_char; + + pub fn nftnl_set_get_u32(s: *const nftnl_set, attr: u16) -> u32; + + pub fn nftnl_set_get_u64(s: *const nftnl_set, attr: u16) -> u64; + + pub fn nftnl_set_nlmsg_build_payload(nlh: *mut nlmsghdr, s: *mut nftnl_set); + + pub fn nftnl_set_nlmsg_parse(nlh: *const nlmsghdr, s: *mut nftnl_set) -> c_int; + + pub fn nftnl_set_elems_nlmsg_parse(nlh: *const nlmsghdr, s: *mut nftnl_set) -> c_int; + + pub fn nftnl_set_snprintf( + buf: *mut c_char, + size: usize, + s: *const nftnl_set, + type_: u32, + flags: u32, + ) -> c_int; + + pub fn nftnl_set_fprintf(fp: *mut FILE, s: *const nftnl_set, type_: u32, flags: u32) -> c_int; +} +#[repr(C)] +pub struct nftnl_set_list(c_void); + +extern "C" { + pub fn nftnl_set_list_alloc() -> *mut nftnl_set_list; + + pub fn nftnl_set_list_free(list: *mut nftnl_set_list); + + pub fn nftnl_set_list_is_empty(list: *const nftnl_set_list) -> c_int; + + pub fn nftnl_set_list_add(s: *mut nftnl_set, list: *mut nftnl_set_list); + + pub fn nftnl_set_list_add_tail(s: *mut nftnl_set, list: *mut nftnl_set_list); + + pub fn nftnl_set_list_del(s: *mut nftnl_set); + + pub fn nftnl_set_list_foreach( + set_list: *mut nftnl_set_list, + cb: Option c_int>, + data: *mut c_void, + ) -> c_int; +} +#[repr(C)] +pub struct nftnl_set_list_iter(c_void); + +extern "C" { + pub fn nftnl_set_list_iter_create(l: *const nftnl_set_list) -> *mut nftnl_set_list_iter; + + pub fn nftnl_set_list_iter_cur(iter: *const nftnl_set_list_iter) -> *mut nftnl_set; + + pub fn nftnl_set_list_iter_next(iter: *mut nftnl_set_list_iter) -> *mut nftnl_set; + + pub fn nftnl_set_list_iter_destroy(iter: *const nftnl_set_list_iter); + + pub fn nftnl_set_parse( + s: *mut nftnl_set, + type_: nftnl_parse_type, + data: *const c_char, + err: *mut nftnl_parse_err, + ) -> c_int; + + pub fn nftnl_set_parse_file( + s: *mut nftnl_set, + type_: nftnl_parse_type, + fp: *mut FILE, + err: *mut nftnl_parse_err, + ) -> c_int; +} +pub const NFTNL_SET_ELEM_FLAGS: u32 = 0; +pub const NFTNL_SET_ELEM_KEY: u32 = 1; +pub const NFTNL_SET_ELEM_VERDICT: u32 = 2; +pub const NFTNL_SET_ELEM_CHAIN: u32 = 3; +pub const NFTNL_SET_ELEM_DATA: u32 = 4; +pub const NFTNL_SET_ELEM_TIMEOUT: u32 = 5; +pub const NFTNL_SET_ELEM_EXPIRATION: u32 = 6; +pub const NFTNL_SET_ELEM_USERDATA: u32 = 7; +pub const NFTNL_SET_ELEM_EXPR: u32 = 8; +pub const NFTNL_SET_ELEM_OBJREF: u32 = 9; + +#[repr(C)] +pub struct nftnl_set_elem(c_void); + +extern "C" { + pub fn nftnl_set_elem_alloc() -> *mut nftnl_set_elem; + + pub fn nftnl_set_elem_free(s: *mut nftnl_set_elem); + + pub fn nftnl_set_elem_clone(elem: *mut nftnl_set_elem) -> *mut nftnl_set_elem; + + pub fn nftnl_set_elem_add(s: *mut nftnl_set, elem: *mut nftnl_set_elem); + + pub fn nftnl_set_elem_unset(s: *mut nftnl_set_elem, attr: u16); + + pub fn nftnl_set_elem_set( + s: *mut nftnl_set_elem, + attr: u16, + data: *const c_void, + data_len: u32, + ) -> c_int; + + pub fn nftnl_set_elem_set_u32(s: *mut nftnl_set_elem, attr: u16, val: u32); + + pub fn nftnl_set_elem_set_u64(s: *mut nftnl_set_elem, attr: u16, val: u64); + + pub fn nftnl_set_elem_set_str(s: *mut nftnl_set_elem, attr: u16, str_: *const c_char) -> c_int; + + pub fn nftnl_set_elem_get( + s: *mut nftnl_set_elem, + attr: u16, + data_len: *mut u32, + ) -> *const c_void; + + pub fn nftnl_set_elem_get_str(s: *mut nftnl_set_elem, attr: u16) -> *const c_char; + + pub fn nftnl_set_elem_get_u32(s: *mut nftnl_set_elem, attr: u16) -> u32; + + pub fn nftnl_set_elem_get_u64(s: *mut nftnl_set_elem, attr: u16) -> u64; + + pub fn nftnl_set_elem_is_set(s: *const nftnl_set_elem, attr: u16) -> bool; + + pub fn nftnl_set_elems_nlmsg_build_payload(nlh: *mut nlmsghdr, s: *mut nftnl_set); + + pub fn nftnl_set_elem_nlmsg_build_payload(nlh: *mut nlmsghdr, e: *mut nftnl_set_elem); + + pub fn nftnl_set_elem_parse( + e: *mut nftnl_set_elem, + type_: nftnl_parse_type, + data: *const c_char, + err: *mut nftnl_parse_err, + ) -> c_int; + + pub fn nftnl_set_elem_parse_file( + e: *mut nftnl_set_elem, + type_: nftnl_parse_type, + fp: *mut FILE, + err: *mut nftnl_parse_err, + ) -> c_int; + + pub fn nftnl_set_elem_snprintf( + buf: *mut c_char, + size: usize, + s: *const nftnl_set_elem, + type_: u32, + flags: u32, + ) -> c_int; + + pub fn nftnl_set_elem_fprintf( + fp: *mut FILE, + se: *mut nftnl_set_elem, + type_: u32, + flags: u32, + ) -> c_int; + + pub fn nftnl_set_elem_foreach( + s: *mut nftnl_set, + cb: Option c_int>, + data: *mut c_void, + ) -> c_int; +} +#[repr(C)] +pub struct nftnl_set_elems_iter(c_void); + +extern "C" { + pub fn nftnl_set_elems_iter_create(s: *const nftnl_set) -> *mut nftnl_set_elems_iter; + + pub fn nftnl_set_elems_iter_cur(iter: *const nftnl_set_elems_iter) -> *mut nftnl_set_elem; + + pub fn nftnl_set_elems_iter_next(iter: *mut nftnl_set_elems_iter) -> *mut nftnl_set_elem; + + pub fn nftnl_set_elems_iter_destroy(iter: *mut nftnl_set_elems_iter); + + pub fn nftnl_set_elems_nlmsg_build_payload_iter( + nlh: *mut nlmsghdr, + iter: *mut nftnl_set_elems_iter, + ) -> c_int; +} +#[repr(C)] +pub struct nftnl_table(c_void); + +extern "C" { + pub fn nftnl_table_alloc() -> *mut nftnl_table; + + pub fn nftnl_table_free(arg1: *const nftnl_table); +} +pub const NFTNL_TABLE_NAME: nftnl_table_attr = 0; +pub const NFTNL_TABLE_FAMILY: nftnl_table_attr = 1; +pub const NFTNL_TABLE_FLAGS: nftnl_table_attr = 2; +pub const NFTNL_TABLE_USE: nftnl_table_attr = 3; +pub const NFTNL_TABLE_HANDLE: nftnl_table_attr = 4; +pub const __NFTNL_TABLE_MAX: nftnl_table_attr = 5; +pub type nftnl_table_attr = c_uint; +extern "C" { + pub fn nftnl_table_is_set(t: *const nftnl_table, attr: u16) -> bool; + + pub fn nftnl_table_unset(t: *mut nftnl_table, attr: u16); + + pub fn nftnl_table_set(t: *mut nftnl_table, attr: u16, data: *const c_void); + + pub fn nftnl_table_set_data( + t: *mut nftnl_table, + attr: u16, + data: *const c_void, + data_len: u32, + ) -> c_int; + + pub fn nftnl_table_get(t: *const nftnl_table, attr: u16) -> *const c_void; + + pub fn nftnl_table_get_data( + t: *const nftnl_table, + attr: u16, + data_len: *mut u32, + ) -> *const c_void; + + pub fn nftnl_table_set_u8(t: *mut nftnl_table, attr: u16, data: u8); + + pub fn nftnl_table_set_u32(t: *mut nftnl_table, attr: u16, data: u32); + + pub fn nftnl_table_set_u64(t: *mut nftnl_table, attr: u16, data: u64); + + pub fn nftnl_table_set_str(t: *mut nftnl_table, attr: u16, str_: *const c_char) -> c_int; + + pub fn nftnl_table_get_u8(t: *const nftnl_table, attr: u16) -> u8; + + pub fn nftnl_table_get_u32(t: *const nftnl_table, attr: u16) -> u32; + + pub fn nftnl_table_get_u64(t: *const nftnl_table, attr: u16) -> u64; + + pub fn nftnl_table_get_str(t: *const nftnl_table, attr: u16) -> *const c_char; + + pub fn nftnl_table_nlmsg_build_payload(nlh: *mut nlmsghdr, t: *const nftnl_table); + + pub fn nftnl_table_parse( + t: *mut nftnl_table, + type_: nftnl_parse_type, + data: *const c_char, + err: *mut nftnl_parse_err, + ) -> c_int; + + pub fn nftnl_table_parse_file( + t: *mut nftnl_table, + type_: nftnl_parse_type, + fp: *mut FILE, + err: *mut nftnl_parse_err, + ) -> c_int; + + pub fn nftnl_table_snprintf( + buf: *mut c_char, + size: usize, + t: *const nftnl_table, + type_: u32, + flags: u32, + ) -> c_int; + + pub fn nftnl_table_fprintf( + fp: *mut FILE, + t: *const nftnl_table, + type_: u32, + flags: u32, + ) -> c_int; + + pub fn nftnl_table_nlmsg_parse(nlh: *const nlmsghdr, t: *mut nftnl_table) -> c_int; +} +#[repr(C)] +pub struct nftnl_table_list(c_void); + +extern "C" { + pub fn nftnl_table_list_alloc() -> *mut nftnl_table_list; + + pub fn nftnl_table_list_free(list: *mut nftnl_table_list); + + pub fn nftnl_table_list_is_empty(list: *const nftnl_table_list) -> c_int; + + pub fn nftnl_table_list_foreach( + table_list: *mut nftnl_table_list, + cb: Option c_int>, + data: *mut c_void, + ) -> c_int; + + pub fn nftnl_table_list_add(r: *mut nftnl_table, list: *mut nftnl_table_list); + + pub fn nftnl_table_list_add_tail(r: *mut nftnl_table, list: *mut nftnl_table_list); + + pub fn nftnl_table_list_del(r: *mut nftnl_table); +} +#[repr(C)] +pub struct nftnl_table_list_iter(c_void); + +extern "C" { + pub fn nftnl_table_list_iter_create(l: *const nftnl_table_list) -> *mut nftnl_table_list_iter; + + pub fn nftnl_table_list_iter_next(iter: *mut nftnl_table_list_iter) -> *mut nftnl_table; + + pub fn nftnl_table_list_iter_destroy(iter: *const nftnl_table_list_iter); +} +pub const NFTNL_TRACE_CHAIN: nftnl_trace_attr = 0; +pub const NFTNL_TRACE_FAMILY: nftnl_trace_attr = 1; +pub const NFTNL_TRACE_ID: nftnl_trace_attr = 2; +pub const NFTNL_TRACE_IIF: nftnl_trace_attr = 3; +pub const NFTNL_TRACE_IIFTYPE: nftnl_trace_attr = 4; +pub const NFTNL_TRACE_JUMP_TARGET: nftnl_trace_attr = 5; +pub const NFTNL_TRACE_OIF: nftnl_trace_attr = 6; +pub const NFTNL_TRACE_OIFTYPE: nftnl_trace_attr = 7; +pub const NFTNL_TRACE_MARK: nftnl_trace_attr = 8; +pub const NFTNL_TRACE_LL_HEADER: nftnl_trace_attr = 9; +pub const NFTNL_TRACE_NETWORK_HEADER: nftnl_trace_attr = 10; +pub const NFTNL_TRACE_TRANSPORT_HEADER: nftnl_trace_attr = 11; +pub const NFTNL_TRACE_TABLE: nftnl_trace_attr = 12; +pub const NFTNL_TRACE_TYPE: nftnl_trace_attr = 13; +pub const NFTNL_TRACE_RULE_HANDLE: nftnl_trace_attr = 14; +pub const NFTNL_TRACE_VERDICT: nftnl_trace_attr = 15; +pub const NFTNL_TRACE_NFPROTO: nftnl_trace_attr = 16; +pub const NFTNL_TRACE_POLICY: nftnl_trace_attr = 17; +pub const __NFTNL_TRACE_MAX: nftnl_trace_attr = 18; +pub type nftnl_trace_attr = c_uint; +#[repr(C)] +pub struct nftnl_trace(c_void); + +extern "C" { + pub fn nftnl_trace_alloc() -> *mut nftnl_trace; + + pub fn nftnl_trace_free(trace: *const nftnl_trace); + + pub fn nftnl_trace_is_set(trace: *const nftnl_trace, type_: u16) -> bool; + + pub fn nftnl_trace_get_data( + trace: *const nftnl_trace, + type_: u16, + data_len: *mut u32, + ) -> *const c_void; + + pub fn nftnl_trace_get_u16(trace: *const nftnl_trace, type_: u16) -> u16; + + pub fn nftnl_trace_get_u32(trace: *const nftnl_trace, type_: u16) -> u32; + + pub fn nftnl_trace_get_u64(trace: *const nftnl_trace, type_: u16) -> u64; + + pub fn nftnl_trace_get_str(trace: *const nftnl_trace, type_: u16) -> *const c_char; + + pub fn nftnl_trace_nlmsg_parse(nlh: *const nlmsghdr, t: *mut nftnl_trace) -> c_int; +} +pub const NFTNL_UDATA_RULE_COMMENT: nftnl_udata_rule_types = 0; +pub const NFTNL_UDATA_RULE_EBTABLES_POLICY: nftnl_udata_rule_types = 1; +pub const __NFTNL_UDATA_RULE_MAX: nftnl_udata_rule_types = 2; +pub type nftnl_udata_rule_types = c_uint; +pub const NFTNL_UDATA_SET_KEYBYTEORDER: nftnl_udata_set_types = 0; +pub const NFTNL_UDATA_SET_DATABYTEORDER: nftnl_udata_set_types = 1; +pub const NFTNL_UDATA_SET_MERGE_ELEMENTS: nftnl_udata_set_types = 2; +pub const __NFTNL_UDATA_SET_MAX: nftnl_udata_set_types = 3; +pub type nftnl_udata_set_types = c_uint; +pub const NFTNL_UDATA_SET_ELEM_COMMENT: nftnl_udata_set_elem_types = 0; +pub const NFTNL_UDATA_SET_ELEM_FLAGS: nftnl_udata_set_elem_types = 1; +pub const __NFTNL_UDATA_SET_ELEM_MAX: nftnl_udata_set_elem_types = 2; +pub type nftnl_udata_set_elem_types = c_uint; +pub const NFTNL_SET_ELEM_F_INTERVAL_OPEN: nftnl_udata_set_elem_flags = 1; +pub type nftnl_udata_set_elem_flags = c_uint; +#[repr(C)] +pub struct nftnl_udata(c_void); + +#[repr(C)] +pub struct nftnl_udata_buf(c_void); + +extern "C" { + pub fn nftnl_udata_buf_alloc(data_size: u32) -> *mut nftnl_udata_buf; + + pub fn nftnl_udata_buf_free(buf: *const nftnl_udata_buf); + + pub fn nftnl_udata_buf_len(buf: *const nftnl_udata_buf) -> u32; + + pub fn nftnl_udata_buf_data(buf: *const nftnl_udata_buf) -> *mut c_void; + + pub fn nftnl_udata_buf_put(buf: *mut nftnl_udata_buf, data: *const c_void, len: u32); + + pub fn nftnl_udata_start(buf: *const nftnl_udata_buf) -> *mut nftnl_udata; + + pub fn nftnl_udata_end(buf: *const nftnl_udata_buf) -> *mut nftnl_udata; + + pub fn nftnl_udata_put( + buf: *mut nftnl_udata_buf, + type_: u8, + len: u32, + value: *const c_void, + ) -> bool; + + pub fn nftnl_udata_put_u32(buf: *mut nftnl_udata_buf, type_: u8, data: u32) -> bool; + + pub fn nftnl_udata_put_strz(buf: *mut nftnl_udata_buf, type_: u8, strz: *const c_char) -> bool; + + pub fn nftnl_udata_type(attr: *const nftnl_udata) -> u8; + + pub fn nftnl_udata_len(attr: *const nftnl_udata) -> u8; + + pub fn nftnl_udata_get(attr: *const nftnl_udata) -> *mut c_void; + + pub fn nftnl_udata_get_u32(attr: *const nftnl_udata) -> u32; + + pub fn nftnl_udata_next(attr: *const nftnl_udata) -> *mut nftnl_udata; +} +pub type nftnl_udata_cb_t = + Option c_int>; +extern "C" { + pub fn nftnl_udata_parse( + data: *const c_void, + data_len: u32, + cb: nftnl_udata_cb_t, + cb_data: *mut c_void, + ) -> c_int; +} diff --git a/nftnl-sys/src/nftnl_1_1_5.rs b/nftnl-sys/src/nftnl_1_1_5.rs new file mode 100644 index 0000000..dcf1a6e --- /dev/null +++ b/nftnl-sys/src/nftnl_1_1_5.rs @@ -0,0 +1,1404 @@ +/* automatically generated by rust-bindgen 0.69.4 */ + +use core::option::Option; +use libc::{c_char, c_int, c_uint, c_void, iovec, nlmsghdr, FILE}; + +pub const NFTNL_UDATA_COMMENT_MAXLEN: u32 = 128; +#[repr(C)] +pub struct nftnl_batch(c_void); + +extern "C" { + pub fn nftnl_batch_alloc(pg_size: u32, pg_overrun_size: u32) -> *mut nftnl_batch; + + pub fn nftnl_batch_update(batch: *mut nftnl_batch) -> c_int; + + pub fn nftnl_batch_free(batch: *mut nftnl_batch); + + pub fn nftnl_batch_buffer(batch: *mut nftnl_batch) -> *mut c_void; + + pub fn nftnl_batch_buffer_len(batch: *mut nftnl_batch) -> u32; + + pub fn nftnl_batch_iovec_len(batch: *mut nftnl_batch) -> c_int; + + pub fn nftnl_batch_iovec(batch: *mut nftnl_batch, iov: *mut iovec, iovlen: u32); +} +pub const NFTNL_PARSE_EBADINPUT: u32 = 0; +pub const NFTNL_PARSE_EMISSINGNODE: u32 = 1; +pub const NFTNL_PARSE_EBADTYPE: u32 = 2; +pub const NFTNL_PARSE_EOPNOTSUPP: u32 = 3; + +pub const NFTNL_OUTPUT_DEFAULT: nftnl_output_type = 0; +pub const NFTNL_OUTPUT_XML: nftnl_output_type = 1; +pub const NFTNL_OUTPUT_JSON: nftnl_output_type = 2; +pub type nftnl_output_type = c_uint; +pub const NFTNL_OF_EVENT_NEW: nftnl_output_flags = 1; +pub const NFTNL_OF_EVENT_DEL: nftnl_output_flags = 2; +pub const NFTNL_OF_EVENT_ANY: nftnl_output_flags = 3; +pub type nftnl_output_flags = c_uint; +pub const NFTNL_CMD_UNSPEC: nftnl_cmd_type = 0; +pub const NFTNL_CMD_ADD: nftnl_cmd_type = 1; +pub const NFTNL_CMD_INSERT: nftnl_cmd_type = 2; +pub const NFTNL_CMD_DELETE: nftnl_cmd_type = 3; +pub const NFTNL_CMD_REPLACE: nftnl_cmd_type = 4; +pub const NFTNL_CMD_FLUSH: nftnl_cmd_type = 5; +pub const NFTNL_CMD_MAX: nftnl_cmd_type = 6; +pub type nftnl_cmd_type = c_uint; +pub const NFTNL_PARSE_NONE: nftnl_parse_type = 0; +pub const NFTNL_PARSE_XML: nftnl_parse_type = 1; +pub const NFTNL_PARSE_JSON: nftnl_parse_type = 2; +pub const NFTNL_PARSE_MAX: nftnl_parse_type = 3; +pub type nftnl_parse_type = c_uint; +#[repr(C)] +pub struct nftnl_parse_err(c_void); + +extern "C" { + pub fn nftnl_nlmsg_build_hdr( + buf: *mut c_char, + type_: u16, + family: u16, + flags: u16, + seq: u32, + ) -> *mut nlmsghdr; + + pub fn nftnl_parse_err_alloc() -> *mut nftnl_parse_err; + + pub fn nftnl_parse_err_free(arg1: *mut nftnl_parse_err); + + pub fn nftnl_parse_perror(str_: *const c_char, err: *mut nftnl_parse_err) -> c_int; + + pub fn nftnl_batch_is_supported() -> c_int; + + pub fn nftnl_batch_begin(buf: *mut c_char, seq: u32) -> *mut nlmsghdr; + + pub fn nftnl_batch_end(buf: *mut c_char, seq: u32) -> *mut nlmsghdr; +} +#[repr(C)] +pub struct nftnl_chain(c_void); + +#[repr(C)] +pub struct nftnl_rule(c_void); + +extern "C" { + pub fn nftnl_chain_alloc() -> *mut nftnl_chain; + + pub fn nftnl_chain_free(arg1: *const nftnl_chain); +} +pub const NFTNL_CHAIN_NAME: nftnl_chain_attr = 0; +pub const NFTNL_CHAIN_FAMILY: nftnl_chain_attr = 1; +pub const NFTNL_CHAIN_TABLE: nftnl_chain_attr = 2; +pub const NFTNL_CHAIN_HOOKNUM: nftnl_chain_attr = 3; +pub const NFTNL_CHAIN_PRIO: nftnl_chain_attr = 4; +pub const NFTNL_CHAIN_POLICY: nftnl_chain_attr = 5; +pub const NFTNL_CHAIN_USE: nftnl_chain_attr = 6; +pub const NFTNL_CHAIN_BYTES: nftnl_chain_attr = 7; +pub const NFTNL_CHAIN_PACKETS: nftnl_chain_attr = 8; +pub const NFTNL_CHAIN_HANDLE: nftnl_chain_attr = 9; +pub const NFTNL_CHAIN_TYPE: nftnl_chain_attr = 10; +pub const NFTNL_CHAIN_DEV: nftnl_chain_attr = 11; +pub const NFTNL_CHAIN_DEVICES: nftnl_chain_attr = 12; +pub const __NFTNL_CHAIN_MAX: nftnl_chain_attr = 13; +pub type nftnl_chain_attr = c_uint; +extern "C" { + pub fn nftnl_chain_is_set(c: *const nftnl_chain, attr: u16) -> bool; + + pub fn nftnl_chain_unset(c: *mut nftnl_chain, attr: u16); + + pub fn nftnl_chain_set(t: *mut nftnl_chain, attr: u16, data: *const c_void); + + pub fn nftnl_chain_set_data( + t: *mut nftnl_chain, + attr: u16, + data: *const c_void, + data_len: u32, + ) -> c_int; + + pub fn nftnl_chain_set_u8(t: *mut nftnl_chain, attr: u16, data: u8); + + pub fn nftnl_chain_set_u32(t: *mut nftnl_chain, attr: u16, data: u32); + + pub fn nftnl_chain_set_s32(t: *mut nftnl_chain, attr: u16, data: i32); + + pub fn nftnl_chain_set_u64(t: *mut nftnl_chain, attr: u16, data: u64); + + pub fn nftnl_chain_set_str(t: *mut nftnl_chain, attr: u16, str_: *const c_char) -> c_int; + + pub fn nftnl_chain_get(c: *const nftnl_chain, attr: u16) -> *const c_void; + + pub fn nftnl_chain_get_data( + c: *const nftnl_chain, + attr: u16, + data_len: *mut u32, + ) -> *const c_void; + + pub fn nftnl_chain_get_str(c: *const nftnl_chain, attr: u16) -> *const c_char; + + pub fn nftnl_chain_get_u8(c: *const nftnl_chain, attr: u16) -> u8; + + pub fn nftnl_chain_get_u32(c: *const nftnl_chain, attr: u16) -> u32; + + pub fn nftnl_chain_get_s32(c: *const nftnl_chain, attr: u16) -> i32; + + pub fn nftnl_chain_get_u64(c: *const nftnl_chain, attr: u16) -> u64; + + pub fn nftnl_chain_rule_add(rule: *mut nftnl_rule, c: *mut nftnl_chain); + + pub fn nftnl_chain_rule_del(rule: *mut nftnl_rule); + + pub fn nftnl_chain_rule_add_tail(rule: *mut nftnl_rule, c: *mut nftnl_chain); + + pub fn nftnl_chain_rule_insert_at(rule: *mut nftnl_rule, pos: *mut nftnl_rule); + + pub fn nftnl_chain_rule_append_at(rule: *mut nftnl_rule, pos: *mut nftnl_rule); + + pub fn nftnl_chain_nlmsg_build_payload(nlh: *mut nlmsghdr, t: *const nftnl_chain); + + pub fn nftnl_chain_parse( + c: *mut nftnl_chain, + type_: nftnl_parse_type, + data: *const c_char, + err: *mut nftnl_parse_err, + ) -> c_int; + + pub fn nftnl_chain_parse_file( + c: *mut nftnl_chain, + type_: nftnl_parse_type, + fp: *mut FILE, + err: *mut nftnl_parse_err, + ) -> c_int; + + pub fn nftnl_chain_snprintf( + buf: *mut c_char, + size: usize, + t: *const nftnl_chain, + type_: u32, + flags: u32, + ) -> c_int; + + pub fn nftnl_chain_fprintf( + fp: *mut FILE, + c: *const nftnl_chain, + type_: u32, + flags: u32, + ) -> c_int; + + pub fn nftnl_chain_nlmsg_parse(nlh: *const nlmsghdr, t: *mut nftnl_chain) -> c_int; + + pub fn nftnl_rule_foreach( + c: *mut nftnl_chain, + cb: Option c_int>, + data: *mut c_void, + ) -> c_int; + + pub fn nftnl_rule_lookup_byindex(c: *mut nftnl_chain, index: u32) -> *mut nftnl_rule; +} +#[repr(C)] +pub struct nftnl_rule_iter(c_void); + +extern "C" { + pub fn nftnl_rule_iter_create(c: *const nftnl_chain) -> *mut nftnl_rule_iter; + + pub fn nftnl_rule_iter_next(iter: *mut nftnl_rule_iter) -> *mut nftnl_rule; + + pub fn nftnl_rule_iter_destroy(iter: *mut nftnl_rule_iter); +} +#[repr(C)] +pub struct nftnl_chain_list(c_void); + +extern "C" { + pub fn nftnl_chain_list_alloc() -> *mut nftnl_chain_list; + + pub fn nftnl_chain_list_free(list: *mut nftnl_chain_list); + + pub fn nftnl_chain_list_is_empty(list: *const nftnl_chain_list) -> c_int; + + pub fn nftnl_chain_list_foreach( + chain_list: *mut nftnl_chain_list, + cb: Option c_int>, + data: *mut c_void, + ) -> c_int; + + pub fn nftnl_chain_list_lookup_byname( + chain_list: *mut nftnl_chain_list, + chain: *const c_char, + ) -> *mut nftnl_chain; + + pub fn nftnl_chain_list_add(r: *mut nftnl_chain, list: *mut nftnl_chain_list); + + pub fn nftnl_chain_list_add_tail(r: *mut nftnl_chain, list: *mut nftnl_chain_list); + + pub fn nftnl_chain_list_del(c: *mut nftnl_chain); +} +#[repr(C)] +pub struct nftnl_chain_list_iter(c_void); + +extern "C" { + pub fn nftnl_chain_list_iter_create(l: *const nftnl_chain_list) -> *mut nftnl_chain_list_iter; + + pub fn nftnl_chain_list_iter_next(iter: *mut nftnl_chain_list_iter) -> *mut nftnl_chain; + + pub fn nftnl_chain_list_iter_destroy(iter: *mut nftnl_chain_list_iter); +} +#[repr(C)] +pub struct nftnl_expr(c_void); + +pub const NFTNL_EXPR_NAME: u32 = 0; +pub const NFTNL_EXPR_BASE: u32 = 1; + +extern "C" { + pub fn nftnl_expr_alloc(name: *const c_char) -> *mut nftnl_expr; + + pub fn nftnl_expr_free(expr: *const nftnl_expr); + + pub fn nftnl_expr_is_set(expr: *const nftnl_expr, type_: u16) -> bool; + + pub fn nftnl_expr_set( + expr: *mut nftnl_expr, + type_: u16, + data: *const c_void, + data_len: u32, + ) -> c_int; + + pub fn nftnl_expr_set_u8(expr: *mut nftnl_expr, type_: u16, data: u8); + + pub fn nftnl_expr_set_u16(expr: *mut nftnl_expr, type_: u16, data: u16); + + pub fn nftnl_expr_set_u32(expr: *mut nftnl_expr, type_: u16, data: u32); + + pub fn nftnl_expr_set_u64(expr: *mut nftnl_expr, type_: u16, data: u64); + + pub fn nftnl_expr_set_str(expr: *mut nftnl_expr, type_: u16, str_: *const c_char) -> c_int; + + pub fn nftnl_expr_get(expr: *const nftnl_expr, type_: u16, data_len: *mut u32) + -> *const c_void; + + pub fn nftnl_expr_get_u8(expr: *const nftnl_expr, type_: u16) -> u8; + + pub fn nftnl_expr_get_u16(expr: *const nftnl_expr, type_: u16) -> u16; + + pub fn nftnl_expr_get_u32(expr: *const nftnl_expr, type_: u16) -> u32; + + pub fn nftnl_expr_get_u64(expr: *const nftnl_expr, type_: u16) -> u64; + + pub fn nftnl_expr_get_str(expr: *const nftnl_expr, type_: u16) -> *const c_char; + + pub fn nftnl_expr_snprintf( + buf: *mut c_char, + buflen: usize, + expr: *const nftnl_expr, + type_: u32, + flags: u32, + ) -> c_int; + + pub fn nftnl_expr_fprintf( + fp: *mut FILE, + expr: *const nftnl_expr, + type_: u32, + flags: u32, + ) -> c_int; +} +pub const NFTNL_EXPR_PAYLOAD_DREG: u32 = 1; +pub const NFTNL_EXPR_PAYLOAD_BASE: u32 = 2; +pub const NFTNL_EXPR_PAYLOAD_OFFSET: u32 = 3; +pub const NFTNL_EXPR_PAYLOAD_LEN: u32 = 4; +pub const NFTNL_EXPR_PAYLOAD_SREG: u32 = 5; +pub const NFTNL_EXPR_PAYLOAD_CSUM_TYPE: u32 = 6; +pub const NFTNL_EXPR_PAYLOAD_CSUM_OFFSET: u32 = 7; +pub const NFTNL_EXPR_PAYLOAD_FLAGS: u32 = 8; + +pub const NFTNL_EXPR_NG_DREG: u32 = 1; +pub const NFTNL_EXPR_NG_MODULUS: u32 = 2; +pub const NFTNL_EXPR_NG_TYPE: u32 = 3; +pub const NFTNL_EXPR_NG_OFFSET: u32 = 4; +pub const NFTNL_EXPR_NG_SET_NAME: u32 = 5; +pub const NFTNL_EXPR_NG_SET_ID: u32 = 6; + +pub const NFTNL_EXPR_META_KEY: u32 = 1; +pub const NFTNL_EXPR_META_DREG: u32 = 2; +pub const NFTNL_EXPR_META_SREG: u32 = 3; + +pub const NFTNL_EXPR_RT_KEY: u32 = 1; +pub const NFTNL_EXPR_RT_DREG: u32 = 2; + +pub const NFTNL_EXPR_SOCKET_KEY: u32 = 1; +pub const NFTNL_EXPR_SOCKET_DREG: u32 = 2; + +pub const NFTNL_EXPR_TUNNEL_KEY: u32 = 1; +pub const NFTNL_EXPR_TUNNEL_DREG: u32 = 2; + +pub const NFTNL_EXPR_CMP_SREG: u32 = 1; +pub const NFTNL_EXPR_CMP_OP: u32 = 2; +pub const NFTNL_EXPR_CMP_DATA: u32 = 3; + +pub const NFTNL_EXPR_RANGE_SREG: u32 = 1; +pub const NFTNL_EXPR_RANGE_OP: u32 = 2; +pub const NFTNL_EXPR_RANGE_FROM_DATA: u32 = 3; +pub const NFTNL_EXPR_RANGE_TO_DATA: u32 = 4; + +pub const NFTNL_EXPR_IMM_DREG: u32 = 1; +pub const NFTNL_EXPR_IMM_DATA: u32 = 2; +pub const NFTNL_EXPR_IMM_VERDICT: u32 = 3; +pub const NFTNL_EXPR_IMM_CHAIN: u32 = 4; + +pub const NFTNL_EXPR_CTR_PACKETS: u32 = 1; +pub const NFTNL_EXPR_CTR_BYTES: u32 = 2; + +pub const NFTNL_EXPR_CONNLIMIT_COUNT: u32 = 1; +pub const NFTNL_EXPR_CONNLIMIT_FLAGS: u32 = 2; + +pub const NFTNL_EXPR_BITWISE_SREG: u32 = 1; +pub const NFTNL_EXPR_BITWISE_DREG: u32 = 2; +pub const NFTNL_EXPR_BITWISE_LEN: u32 = 3; +pub const NFTNL_EXPR_BITWISE_MASK: u32 = 4; +pub const NFTNL_EXPR_BITWISE_XOR: u32 = 5; + +pub const NFTNL_EXPR_TG_NAME: u32 = 1; +pub const NFTNL_EXPR_TG_REV: u32 = 2; +pub const NFTNL_EXPR_TG_INFO: u32 = 3; + +pub const NFTNL_EXPR_MT_NAME: u32 = 1; +pub const NFTNL_EXPR_MT_REV: u32 = 2; +pub const NFTNL_EXPR_MT_INFO: u32 = 3; + +pub const NFTNL_EXPR_NAT_TYPE: u32 = 1; +pub const NFTNL_EXPR_NAT_FAMILY: u32 = 2; +pub const NFTNL_EXPR_NAT_REG_ADDR_MIN: u32 = 3; +pub const NFTNL_EXPR_NAT_REG_ADDR_MAX: u32 = 4; +pub const NFTNL_EXPR_NAT_REG_PROTO_MIN: u32 = 5; +pub const NFTNL_EXPR_NAT_REG_PROTO_MAX: u32 = 6; +pub const NFTNL_EXPR_NAT_FLAGS: u32 = 7; + +pub const NFTNL_EXPR_TPROXY_FAMILY: u32 = 1; +pub const NFTNL_EXPR_TPROXY_REG_ADDR: u32 = 2; +pub const NFTNL_EXPR_TPROXY_REG_PORT: u32 = 3; + +pub const NFTNL_EXPR_LOOKUP_SREG: u32 = 1; +pub const NFTNL_EXPR_LOOKUP_DREG: u32 = 2; +pub const NFTNL_EXPR_LOOKUP_SET: u32 = 3; +pub const NFTNL_EXPR_LOOKUP_SET_ID: u32 = 4; +pub const NFTNL_EXPR_LOOKUP_FLAGS: u32 = 5; + +pub const NFTNL_EXPR_DYNSET_SREG_KEY: u32 = 1; +pub const NFTNL_EXPR_DYNSET_SREG_DATA: u32 = 2; +pub const NFTNL_EXPR_DYNSET_OP: u32 = 3; +pub const NFTNL_EXPR_DYNSET_TIMEOUT: u32 = 4; +pub const NFTNL_EXPR_DYNSET_SET_NAME: u32 = 5; +pub const NFTNL_EXPR_DYNSET_SET_ID: u32 = 6; +pub const NFTNL_EXPR_DYNSET_EXPR: u32 = 7; + +pub const NFTNL_EXPR_LOG_PREFIX: u32 = 1; +pub const NFTNL_EXPR_LOG_GROUP: u32 = 2; +pub const NFTNL_EXPR_LOG_SNAPLEN: u32 = 3; +pub const NFTNL_EXPR_LOG_QTHRESHOLD: u32 = 4; +pub const NFTNL_EXPR_LOG_LEVEL: u32 = 5; +pub const NFTNL_EXPR_LOG_FLAGS: u32 = 6; + +pub const NFTNL_EXPR_EXTHDR_DREG: u32 = 1; +pub const NFTNL_EXPR_EXTHDR_TYPE: u32 = 2; +pub const NFTNL_EXPR_EXTHDR_OFFSET: u32 = 3; +pub const NFTNL_EXPR_EXTHDR_LEN: u32 = 4; +pub const NFTNL_EXPR_EXTHDR_FLAGS: u32 = 5; +pub const NFTNL_EXPR_EXTHDR_OP: u32 = 6; +pub const NFTNL_EXPR_EXTHDR_SREG: u32 = 7; + +pub const NFTNL_EXPR_CT_DREG: u32 = 1; +pub const NFTNL_EXPR_CT_KEY: u32 = 2; +pub const NFTNL_EXPR_CT_DIR: u32 = 3; +pub const NFTNL_EXPR_CT_SREG: u32 = 4; + +pub const NFTNL_EXPR_BYTEORDER_DREG: u32 = 1; +pub const NFTNL_EXPR_BYTEORDER_SREG: u32 = 2; +pub const NFTNL_EXPR_BYTEORDER_OP: u32 = 3; +pub const NFTNL_EXPR_BYTEORDER_LEN: u32 = 4; +pub const NFTNL_EXPR_BYTEORDER_SIZE: u32 = 5; + +pub const NFTNL_EXPR_LIMIT_RATE: u32 = 1; +pub const NFTNL_EXPR_LIMIT_UNIT: u32 = 2; +pub const NFTNL_EXPR_LIMIT_BURST: u32 = 3; +pub const NFTNL_EXPR_LIMIT_TYPE: u32 = 4; +pub const NFTNL_EXPR_LIMIT_FLAGS: u32 = 5; + +pub const NFTNL_EXPR_REJECT_TYPE: u32 = 1; +pub const NFTNL_EXPR_REJECT_CODE: u32 = 2; + +pub const NFTNL_EXPR_QUEUE_NUM: u32 = 1; +pub const NFTNL_EXPR_QUEUE_TOTAL: u32 = 2; +pub const NFTNL_EXPR_QUEUE_FLAGS: u32 = 3; +pub const NFTNL_EXPR_QUEUE_SREG_QNUM: u32 = 4; + +pub const NFTNL_EXPR_QUOTA_BYTES: u32 = 1; +pub const NFTNL_EXPR_QUOTA_FLAGS: u32 = 2; +pub const NFTNL_EXPR_QUOTA_CONSUMED: u32 = 3; + +pub const NFTNL_EXPR_MASQ_FLAGS: u32 = 1; +pub const NFTNL_EXPR_MASQ_REG_PROTO_MIN: u32 = 2; +pub const NFTNL_EXPR_MASQ_REG_PROTO_MAX: u32 = 3; + +pub const NFTNL_EXPR_REDIR_REG_PROTO_MIN: u32 = 1; +pub const NFTNL_EXPR_REDIR_REG_PROTO_MAX: u32 = 2; +pub const NFTNL_EXPR_REDIR_FLAGS: u32 = 3; + +pub const NFTNL_EXPR_DUP_SREG_ADDR: u32 = 1; +pub const NFTNL_EXPR_DUP_SREG_DEV: u32 = 2; + +pub const NFTNL_EXPR_FLOW_TABLE_NAME: u32 = 1; + +pub const NFTNL_EXPR_FWD_SREG_DEV: u32 = 1; +pub const NFTNL_EXPR_FWD_SREG_ADDR: u32 = 2; +pub const NFTNL_EXPR_FWD_NFPROTO: u32 = 3; + +pub const NFTNL_EXPR_HASH_SREG: u32 = 1; +pub const NFTNL_EXPR_HASH_DREG: u32 = 2; +pub const NFTNL_EXPR_HASH_LEN: u32 = 3; +pub const NFTNL_EXPR_HASH_MODULUS: u32 = 4; +pub const NFTNL_EXPR_HASH_SEED: u32 = 5; +pub const NFTNL_EXPR_HASH_OFFSET: u32 = 6; +pub const NFTNL_EXPR_HASH_TYPE: u32 = 7; +pub const NFTNL_EXPR_HASH_SET_NAME: u32 = 8; +pub const NFTNL_EXPR_HASH_SET_ID: u32 = 9; + +pub const NFTNL_EXPR_FIB_DREG: u32 = 1; +pub const NFTNL_EXPR_FIB_RESULT: u32 = 2; +pub const NFTNL_EXPR_FIB_FLAGS: u32 = 3; + +pub const NFTNL_EXPR_OBJREF_IMM_TYPE: u32 = 1; +pub const NFTNL_EXPR_OBJREF_IMM_NAME: u32 = 2; +pub const NFTNL_EXPR_OBJREF_SET_SREG: u32 = 3; +pub const NFTNL_EXPR_OBJREF_SET_NAME: u32 = 4; +pub const NFTNL_EXPR_OBJREF_SET_ID: u32 = 5; + +pub const NFTNL_EXPR_OSF_DREG: u32 = 1; +pub const NFTNL_EXPR_OSF_TTL: u32 = 2; +pub const NFTNL_EXPR_OSF_FLAGS: u32 = 3; + +pub const NFTNL_EXPR_XFRM_DREG: u32 = 1; +pub const NFTNL_EXPR_XFRM_SREG: u32 = 2; +pub const NFTNL_EXPR_XFRM_KEY: u32 = 3; +pub const NFTNL_EXPR_XFRM_DIR: u32 = 4; +pub const NFTNL_EXPR_XFRM_SPNUM: u32 = 5; + +pub const NFTNL_EXPR_SYNPROXY_MSS: u32 = 1; +pub const NFTNL_EXPR_SYNPROXY_WSCALE: u32 = 2; +pub const NFTNL_EXPR_SYNPROXY_FLAGS: u32 = 3; + +#[repr(C)] +pub struct nftnl_gen(c_void); + +extern "C" { + pub fn nftnl_gen_alloc() -> *mut nftnl_gen; + + pub fn nftnl_gen_free(arg1: *const nftnl_gen); +} +pub const NFTNL_GEN_ID: u32 = 0; +pub const __NFTNL_GEN_MAX: u32 = 1; + +extern "C" { + pub fn nftnl_gen_is_set(gen: *const nftnl_gen, attr: u16) -> bool; + + pub fn nftnl_gen_unset(gen: *mut nftnl_gen, attr: u16); + + pub fn nftnl_gen_set(gen: *mut nftnl_gen, attr: u16, data: *const c_void) -> c_int; + + pub fn nftnl_gen_set_data( + gen: *mut nftnl_gen, + attr: u16, + data: *const c_void, + data_len: u32, + ) -> c_int; + + pub fn nftnl_gen_get(gen: *const nftnl_gen, attr: u16) -> *const c_void; + + pub fn nftnl_gen_get_data( + gen: *const nftnl_gen, + attr: u16, + data_len: *mut u32, + ) -> *const c_void; + + pub fn nftnl_gen_set_u32(gen: *mut nftnl_gen, attr: u16, data: u32); + + pub fn nftnl_gen_get_u32(gen: *const nftnl_gen, attr: u16) -> u32; + + pub fn nftnl_gen_nlmsg_parse(nlh: *const nlmsghdr, gen: *mut nftnl_gen) -> c_int; + + pub fn nftnl_gen_snprintf( + buf: *mut c_char, + size: usize, + gen: *const nftnl_gen, + type_: u32, + flags: u32, + ) -> c_int; + + pub fn nftnl_gen_fprintf(fp: *mut FILE, gen: *const nftnl_gen, type_: u32, flags: u32) + -> c_int; +} +pub const NFTNL_OBJ_TABLE: u32 = 0; +pub const NFTNL_OBJ_NAME: u32 = 1; +pub const NFTNL_OBJ_TYPE: u32 = 2; +pub const NFTNL_OBJ_FAMILY: u32 = 3; +pub const NFTNL_OBJ_USE: u32 = 4; +pub const NFTNL_OBJ_HANDLE: u32 = 5; +pub const NFTNL_OBJ_BASE: u32 = 16; +pub const __NFTNL_OBJ_MAX: u32 = 17; + +pub const NFTNL_OBJ_CTR_PKTS: u32 = 16; +pub const NFTNL_OBJ_CTR_BYTES: u32 = 17; + +pub const NFTNL_OBJ_QUOTA_BYTES: u32 = 16; +pub const NFTNL_OBJ_QUOTA_CONSUMED: u32 = 17; +pub const NFTNL_OBJ_QUOTA_FLAGS: u32 = 18; + +pub const NFTNL_OBJ_CT_HELPER_NAME: u32 = 16; +pub const NFTNL_OBJ_CT_HELPER_L3PROTO: u32 = 17; +pub const NFTNL_OBJ_CT_HELPER_L4PROTO: u32 = 18; + +pub const NFTNL_CTTIMEOUT_TCP_SYN_SENT: nftnl_cttimeout_array_tcp = 0; +pub const NFTNL_CTTIMEOUT_TCP_SYN_RECV: nftnl_cttimeout_array_tcp = 1; +pub const NFTNL_CTTIMEOUT_TCP_ESTABLISHED: nftnl_cttimeout_array_tcp = 2; +pub const NFTNL_CTTIMEOUT_TCP_FIN_WAIT: nftnl_cttimeout_array_tcp = 3; +pub const NFTNL_CTTIMEOUT_TCP_CLOSE_WAIT: nftnl_cttimeout_array_tcp = 4; +pub const NFTNL_CTTIMEOUT_TCP_LAST_ACK: nftnl_cttimeout_array_tcp = 5; +pub const NFTNL_CTTIMEOUT_TCP_TIME_WAIT: nftnl_cttimeout_array_tcp = 6; +pub const NFTNL_CTTIMEOUT_TCP_CLOSE: nftnl_cttimeout_array_tcp = 7; +pub const NFTNL_CTTIMEOUT_TCP_SYN_SENT2: nftnl_cttimeout_array_tcp = 8; +pub const NFTNL_CTTIMEOUT_TCP_RETRANS: nftnl_cttimeout_array_tcp = 9; +pub const NFTNL_CTTIMEOUT_TCP_UNACK: nftnl_cttimeout_array_tcp = 10; +pub const NFTNL_CTTIMEOUT_TCP_MAX: nftnl_cttimeout_array_tcp = 11; +pub type nftnl_cttimeout_array_tcp = c_uint; +pub const NFTNL_CTTIMEOUT_UDP_UNREPLIED: nftnl_cttimeout_array_udp = 0; +pub const NFTNL_CTTIMEOUT_UDP_REPLIED: nftnl_cttimeout_array_udp = 1; +pub const NFTNL_CTTIMEOUT_UDP_MAX: nftnl_cttimeout_array_udp = 2; +pub type nftnl_cttimeout_array_udp = c_uint; +pub const NFTNL_OBJ_CT_TIMEOUT_L3PROTO: u32 = 16; +pub const NFTNL_OBJ_CT_TIMEOUT_L4PROTO: u32 = 17; +pub const NFTNL_OBJ_CT_TIMEOUT_ARRAY: u32 = 18; + +pub const NFTNL_OBJ_CT_EXPECT_L3PROTO: u32 = 16; +pub const NFTNL_OBJ_CT_EXPECT_L4PROTO: u32 = 17; +pub const NFTNL_OBJ_CT_EXPECT_DPORT: u32 = 18; +pub const NFTNL_OBJ_CT_EXPECT_TIMEOUT: u32 = 19; +pub const NFTNL_OBJ_CT_EXPECT_SIZE: u32 = 20; + +pub const NFTNL_OBJ_LIMIT_RATE: u32 = 16; +pub const NFTNL_OBJ_LIMIT_UNIT: u32 = 17; +pub const NFTNL_OBJ_LIMIT_BURST: u32 = 18; +pub const NFTNL_OBJ_LIMIT_TYPE: u32 = 19; +pub const NFTNL_OBJ_LIMIT_FLAGS: u32 = 20; + +pub const NFTNL_OBJ_SYNPROXY_MSS: u32 = 16; +pub const NFTNL_OBJ_SYNPROXY_WSCALE: u32 = 17; +pub const NFTNL_OBJ_SYNPROXY_FLAGS: u32 = 18; + +pub const NFTNL_OBJ_TUNNEL_ID: u32 = 16; +pub const NFTNL_OBJ_TUNNEL_IPV4_SRC: u32 = 17; +pub const NFTNL_OBJ_TUNNEL_IPV4_DST: u32 = 18; +pub const NFTNL_OBJ_TUNNEL_IPV6_SRC: u32 = 19; +pub const NFTNL_OBJ_TUNNEL_IPV6_DST: u32 = 20; +pub const NFTNL_OBJ_TUNNEL_IPV6_FLOWLABEL: u32 = 21; +pub const NFTNL_OBJ_TUNNEL_SPORT: u32 = 22; +pub const NFTNL_OBJ_TUNNEL_DPORT: u32 = 23; +pub const NFTNL_OBJ_TUNNEL_FLAGS: u32 = 24; +pub const NFTNL_OBJ_TUNNEL_TOS: u32 = 25; +pub const NFTNL_OBJ_TUNNEL_TTL: u32 = 26; +pub const NFTNL_OBJ_TUNNEL_VXLAN_GBP: u32 = 27; +pub const NFTNL_OBJ_TUNNEL_ERSPAN_VERSION: u32 = 28; +pub const NFTNL_OBJ_TUNNEL_ERSPAN_V1_INDEX: u32 = 29; +pub const NFTNL_OBJ_TUNNEL_ERSPAN_V2_HWID: u32 = 30; +pub const NFTNL_OBJ_TUNNEL_ERSPAN_V2_DIR: u32 = 31; + +pub const NFTNL_OBJ_SECMARK_CTX: u32 = 16; + +#[repr(C)] +pub struct nftnl_obj(c_void); + +extern "C" { + pub fn nftnl_obj_alloc() -> *mut nftnl_obj; + + pub fn nftnl_obj_free(ne: *const nftnl_obj); + + pub fn nftnl_obj_is_set(ne: *const nftnl_obj, attr: u16) -> bool; + + pub fn nftnl_obj_unset(ne: *mut nftnl_obj, attr: u16); + + pub fn nftnl_obj_set_data(ne: *mut nftnl_obj, attr: u16, data: *const c_void, data_len: u32); + + pub fn nftnl_obj_set(ne: *mut nftnl_obj, attr: u16, data: *const c_void); + + pub fn nftnl_obj_set_u8(ne: *mut nftnl_obj, attr: u16, val: u8); + + pub fn nftnl_obj_set_u16(ne: *mut nftnl_obj, attr: u16, val: u16); + + pub fn nftnl_obj_set_u32(ne: *mut nftnl_obj, attr: u16, val: u32); + + pub fn nftnl_obj_set_u64(obj: *mut nftnl_obj, attr: u16, val: u64); + + pub fn nftnl_obj_set_str(ne: *mut nftnl_obj, attr: u16, str_: *const c_char); + + pub fn nftnl_obj_get_data(ne: *mut nftnl_obj, attr: u16, data_len: *mut u32) -> *const c_void; + + pub fn nftnl_obj_get(ne: *mut nftnl_obj, attr: u16) -> *const c_void; + + pub fn nftnl_obj_get_u8(ne: *mut nftnl_obj, attr: u16) -> u8; + + pub fn nftnl_obj_get_u16(obj: *mut nftnl_obj, attr: u16) -> u16; + + pub fn nftnl_obj_get_u32(ne: *mut nftnl_obj, attr: u16) -> u32; + + pub fn nftnl_obj_get_u64(obj: *mut nftnl_obj, attr: u16) -> u64; + + pub fn nftnl_obj_get_str(ne: *mut nftnl_obj, attr: u16) -> *const c_char; + + pub fn nftnl_obj_nlmsg_build_payload(nlh: *mut nlmsghdr, ne: *const nftnl_obj); + + pub fn nftnl_obj_nlmsg_parse(nlh: *const nlmsghdr, ne: *mut nftnl_obj) -> c_int; + + pub fn nftnl_obj_parse( + ne: *mut nftnl_obj, + type_: nftnl_parse_type, + data: *const c_char, + err: *mut nftnl_parse_err, + ) -> c_int; + + pub fn nftnl_obj_parse_file( + ne: *mut nftnl_obj, + type_: nftnl_parse_type, + fp: *mut FILE, + err: *mut nftnl_parse_err, + ) -> c_int; + + pub fn nftnl_obj_snprintf( + buf: *mut c_char, + size: usize, + ne: *const nftnl_obj, + type_: u32, + flags: u32, + ) -> c_int; + + pub fn nftnl_obj_fprintf(fp: *mut FILE, ne: *const nftnl_obj, type_: u32, flags: u32) -> c_int; +} +#[repr(C)] +pub struct nftnl_obj_list(c_void); + +extern "C" { + pub fn nftnl_obj_list_alloc() -> *mut nftnl_obj_list; + + pub fn nftnl_obj_list_free(list: *mut nftnl_obj_list); + + pub fn nftnl_obj_list_is_empty(list: *mut nftnl_obj_list) -> c_int; + + pub fn nftnl_obj_list_add(r: *mut nftnl_obj, list: *mut nftnl_obj_list); + + pub fn nftnl_obj_list_add_tail(r: *mut nftnl_obj, list: *mut nftnl_obj_list); + + pub fn nftnl_obj_list_del(t: *mut nftnl_obj); + + pub fn nftnl_obj_list_foreach( + table_list: *mut nftnl_obj_list, + cb: Option c_int>, + data: *mut c_void, + ) -> c_int; +} +#[repr(C)] +pub struct nftnl_obj_list_iter(c_void); + +extern "C" { + pub fn nftnl_obj_list_iter_create(l: *mut nftnl_obj_list) -> *mut nftnl_obj_list_iter; + + pub fn nftnl_obj_list_iter_next(iter: *mut nftnl_obj_list_iter) -> *mut nftnl_obj; + + pub fn nftnl_obj_list_iter_destroy(iter: *mut nftnl_obj_list_iter); + + pub fn nftnl_rule_alloc() -> *mut nftnl_rule; + + pub fn nftnl_rule_free(arg1: *const nftnl_rule); +} +pub const NFTNL_RULE_FAMILY: nftnl_rule_attr = 0; +pub const NFTNL_RULE_TABLE: nftnl_rule_attr = 1; +pub const NFTNL_RULE_CHAIN: nftnl_rule_attr = 2; +pub const NFTNL_RULE_HANDLE: nftnl_rule_attr = 3; +pub const NFTNL_RULE_COMPAT_PROTO: nftnl_rule_attr = 4; +pub const NFTNL_RULE_COMPAT_FLAGS: nftnl_rule_attr = 5; +pub const NFTNL_RULE_POSITION: nftnl_rule_attr = 6; +pub const NFTNL_RULE_USERDATA: nftnl_rule_attr = 7; +pub const NFTNL_RULE_ID: nftnl_rule_attr = 8; +pub const NFTNL_RULE_POSITION_ID: nftnl_rule_attr = 9; +pub const __NFTNL_RULE_MAX: nftnl_rule_attr = 10; +pub type nftnl_rule_attr = c_uint; +extern "C" { + pub fn nftnl_rule_unset(r: *mut nftnl_rule, attr: u16); + + pub fn nftnl_rule_is_set(r: *const nftnl_rule, attr: u16) -> bool; + + pub fn nftnl_rule_set(r: *mut nftnl_rule, attr: u16, data: *const c_void) -> c_int; + + pub fn nftnl_rule_set_data( + r: *mut nftnl_rule, + attr: u16, + data: *const c_void, + data_len: u32, + ) -> c_int; + + pub fn nftnl_rule_set_u32(r: *mut nftnl_rule, attr: u16, val: u32); + + pub fn nftnl_rule_set_u64(r: *mut nftnl_rule, attr: u16, val: u64); + + pub fn nftnl_rule_set_str(r: *mut nftnl_rule, attr: u16, str_: *const c_char) -> c_int; + + pub fn nftnl_rule_get(r: *const nftnl_rule, attr: u16) -> *const c_void; + + pub fn nftnl_rule_get_data( + r: *const nftnl_rule, + attr: u16, + data_len: *mut u32, + ) -> *const c_void; + + pub fn nftnl_rule_get_str(r: *const nftnl_rule, attr: u16) -> *const c_char; + + pub fn nftnl_rule_get_u8(r: *const nftnl_rule, attr: u16) -> u8; + + pub fn nftnl_rule_get_u32(r: *const nftnl_rule, attr: u16) -> u32; + + pub fn nftnl_rule_get_u64(r: *const nftnl_rule, attr: u16) -> u64; + + pub fn nftnl_rule_add_expr(r: *mut nftnl_rule, expr: *mut nftnl_expr); + + pub fn nftnl_rule_nlmsg_build_payload(nlh: *mut nlmsghdr, t: *mut nftnl_rule); + + pub fn nftnl_rule_parse( + r: *mut nftnl_rule, + type_: nftnl_parse_type, + data: *const c_char, + err: *mut nftnl_parse_err, + ) -> c_int; + + pub fn nftnl_rule_parse_file( + r: *mut nftnl_rule, + type_: nftnl_parse_type, + fp: *mut FILE, + err: *mut nftnl_parse_err, + ) -> c_int; + + pub fn nftnl_rule_snprintf( + buf: *mut c_char, + size: usize, + t: *const nftnl_rule, + type_: u32, + flags: u32, + ) -> c_int; + + pub fn nftnl_rule_fprintf(fp: *mut FILE, r: *const nftnl_rule, type_: u32, flags: u32) + -> c_int; + + pub fn nftnl_rule_nlmsg_parse(nlh: *const nlmsghdr, t: *mut nftnl_rule) -> c_int; + + pub fn nftnl_expr_foreach( + r: *mut nftnl_rule, + cb: Option c_int>, + data: *mut c_void, + ) -> c_int; +} +#[repr(C)] +pub struct nftnl_expr_iter(c_void); + +extern "C" { + pub fn nftnl_expr_iter_create(r: *const nftnl_rule) -> *mut nftnl_expr_iter; + + pub fn nftnl_expr_iter_next(iter: *mut nftnl_expr_iter) -> *mut nftnl_expr; + + pub fn nftnl_expr_iter_destroy(iter: *mut nftnl_expr_iter); +} +#[repr(C)] +pub struct nftnl_rule_list(c_void); + +extern "C" { + pub fn nftnl_rule_list_alloc() -> *mut nftnl_rule_list; + + pub fn nftnl_rule_list_free(list: *mut nftnl_rule_list); + + pub fn nftnl_rule_list_is_empty(list: *const nftnl_rule_list) -> c_int; + + pub fn nftnl_rule_list_add(r: *mut nftnl_rule, list: *mut nftnl_rule_list); + + pub fn nftnl_rule_list_add_tail(r: *mut nftnl_rule, list: *mut nftnl_rule_list); + + pub fn nftnl_rule_list_insert_at(r: *mut nftnl_rule, pos: *mut nftnl_rule); + + pub fn nftnl_rule_list_del(r: *mut nftnl_rule); + + pub fn nftnl_rule_list_foreach( + rule_list: *mut nftnl_rule_list, + cb: Option c_int>, + data: *mut c_void, + ) -> c_int; +} +#[repr(C)] +pub struct nftnl_rule_list_iter(c_void); + +extern "C" { + pub fn nftnl_rule_list_iter_create(l: *const nftnl_rule_list) -> *mut nftnl_rule_list_iter; + + pub fn nftnl_rule_list_iter_cur(iter: *mut nftnl_rule_list_iter) -> *mut nftnl_rule; + + pub fn nftnl_rule_list_iter_next(iter: *mut nftnl_rule_list_iter) -> *mut nftnl_rule; + + pub fn nftnl_rule_list_iter_destroy(iter: *const nftnl_rule_list_iter); +} +#[repr(C)] +pub struct nftnl_ruleset(c_void); + +extern "C" { + pub fn nftnl_ruleset_alloc() -> *mut nftnl_ruleset; + + pub fn nftnl_ruleset_free(r: *const nftnl_ruleset); +} +pub const NFTNL_RULESET_TABLELIST: u32 = 0; +pub const NFTNL_RULESET_CHAINLIST: u32 = 1; +pub const NFTNL_RULESET_SETLIST: u32 = 2; +pub const NFTNL_RULESET_RULELIST: u32 = 3; + +pub const NFTNL_RULESET_UNSPEC: nftnl_ruleset_type = 0; +pub const NFTNL_RULESET_RULESET: nftnl_ruleset_type = 1; +pub const NFTNL_RULESET_TABLE: nftnl_ruleset_type = 2; +pub const NFTNL_RULESET_CHAIN: nftnl_ruleset_type = 3; +pub const NFTNL_RULESET_RULE: nftnl_ruleset_type = 4; +pub const NFTNL_RULESET_SET: nftnl_ruleset_type = 5; +pub const NFTNL_RULESET_SET_ELEMS: nftnl_ruleset_type = 6; +pub type nftnl_ruleset_type = c_uint; +extern "C" { + pub fn nftnl_ruleset_is_set(r: *const nftnl_ruleset, attr: u16) -> bool; + + pub fn nftnl_ruleset_unset(r: *mut nftnl_ruleset, attr: u16); + + pub fn nftnl_ruleset_set(r: *mut nftnl_ruleset, attr: u16, data: *mut c_void); + + pub fn nftnl_ruleset_get(r: *const nftnl_ruleset, attr: u16) -> *mut c_void; +} +pub const NFTNL_RULESET_CTX_CMD: u32 = 0; +pub const NFTNL_RULESET_CTX_TYPE: u32 = 1; +pub const NFTNL_RULESET_CTX_TABLE: u32 = 2; +pub const NFTNL_RULESET_CTX_CHAIN: u32 = 3; +pub const NFTNL_RULESET_CTX_RULE: u32 = 4; +pub const NFTNL_RULESET_CTX_SET: u32 = 5; +pub const NFTNL_RULESET_CTX_DATA: u32 = 6; + +#[repr(C)] +pub struct nftnl_parse_ctx(c_void); + +extern "C" { + pub fn nftnl_ruleset_ctx_free(ctx: *const nftnl_parse_ctx); + + pub fn nftnl_ruleset_ctx_is_set(ctx: *const nftnl_parse_ctx, attr: u16) -> bool; + + pub fn nftnl_ruleset_ctx_get(ctx: *const nftnl_parse_ctx, attr: u16) -> *mut c_void; + + pub fn nftnl_ruleset_ctx_get_u32(ctx: *const nftnl_parse_ctx, attr: u16) -> u32; + + pub fn nftnl_ruleset_parse_file_cb( + type_: nftnl_parse_type, + fp: *mut FILE, + err: *mut nftnl_parse_err, + data: *mut c_void, + cb: Option c_int>, + ) -> c_int; + + pub fn nftnl_ruleset_parse_buffer_cb( + type_: nftnl_parse_type, + buffer: *const c_char, + err: *mut nftnl_parse_err, + data: *mut c_void, + cb: Option c_int>, + ) -> c_int; + + pub fn nftnl_ruleset_parse( + rs: *mut nftnl_ruleset, + type_: nftnl_parse_type, + data: *const c_char, + err: *mut nftnl_parse_err, + ) -> c_int; + + pub fn nftnl_ruleset_parse_file( + rs: *mut nftnl_ruleset, + type_: nftnl_parse_type, + fp: *mut FILE, + err: *mut nftnl_parse_err, + ) -> c_int; + + pub fn nftnl_ruleset_snprintf( + buf: *mut c_char, + size: usize, + rs: *const nftnl_ruleset, + type_: u32, + flags: u32, + ) -> c_int; + + pub fn nftnl_ruleset_fprintf( + fp: *mut FILE, + rs: *const nftnl_ruleset, + type_: u32, + flags: u32, + ) -> c_int; +} +pub const NFTNL_SET_TABLE: nftnl_set_attr = 0; +pub const NFTNL_SET_NAME: nftnl_set_attr = 1; +pub const NFTNL_SET_FLAGS: nftnl_set_attr = 2; +pub const NFTNL_SET_KEY_TYPE: nftnl_set_attr = 3; +pub const NFTNL_SET_KEY_LEN: nftnl_set_attr = 4; +pub const NFTNL_SET_DATA_TYPE: nftnl_set_attr = 5; +pub const NFTNL_SET_DATA_LEN: nftnl_set_attr = 6; +pub const NFTNL_SET_FAMILY: nftnl_set_attr = 7; +pub const NFTNL_SET_ID: nftnl_set_attr = 8; +pub const NFTNL_SET_POLICY: nftnl_set_attr = 9; +pub const NFTNL_SET_DESC_SIZE: nftnl_set_attr = 10; +pub const NFTNL_SET_TIMEOUT: nftnl_set_attr = 11; +pub const NFTNL_SET_GC_INTERVAL: nftnl_set_attr = 12; +pub const NFTNL_SET_USERDATA: nftnl_set_attr = 13; +pub const NFTNL_SET_OBJ_TYPE: nftnl_set_attr = 14; +pub const NFTNL_SET_HANDLE: nftnl_set_attr = 15; +pub const __NFTNL_SET_MAX: nftnl_set_attr = 16; +pub type nftnl_set_attr = c_uint; +#[repr(C)] +pub struct nftnl_set(c_void); + +extern "C" { + pub fn nftnl_set_alloc() -> *mut nftnl_set; + + pub fn nftnl_set_free(s: *const nftnl_set); + + pub fn nftnl_set_clone(set: *const nftnl_set) -> *mut nftnl_set; + + pub fn nftnl_set_is_set(s: *const nftnl_set, attr: u16) -> bool; + + pub fn nftnl_set_unset(s: *mut nftnl_set, attr: u16); + + pub fn nftnl_set_set(s: *mut nftnl_set, attr: u16, data: *const c_void) -> c_int; + + pub fn nftnl_set_set_data( + s: *mut nftnl_set, + attr: u16, + data: *const c_void, + data_len: u32, + ) -> c_int; + + pub fn nftnl_set_set_u32(s: *mut nftnl_set, attr: u16, val: u32); + + pub fn nftnl_set_set_u64(s: *mut nftnl_set, attr: u16, val: u64); + + pub fn nftnl_set_set_str(s: *mut nftnl_set, attr: u16, str_: *const c_char) -> c_int; + + pub fn nftnl_set_get(s: *const nftnl_set, attr: u16) -> *const c_void; + + pub fn nftnl_set_get_data(s: *const nftnl_set, attr: u16, data_len: *mut u32) -> *const c_void; + + pub fn nftnl_set_get_str(s: *const nftnl_set, attr: u16) -> *const c_char; + + pub fn nftnl_set_get_u32(s: *const nftnl_set, attr: u16) -> u32; + + pub fn nftnl_set_get_u64(s: *const nftnl_set, attr: u16) -> u64; + + pub fn nftnl_set_nlmsg_build_payload(nlh: *mut nlmsghdr, s: *mut nftnl_set); + + pub fn nftnl_set_nlmsg_parse(nlh: *const nlmsghdr, s: *mut nftnl_set) -> c_int; + + pub fn nftnl_set_elems_nlmsg_parse(nlh: *const nlmsghdr, s: *mut nftnl_set) -> c_int; + + pub fn nftnl_set_snprintf( + buf: *mut c_char, + size: usize, + s: *const nftnl_set, + type_: u32, + flags: u32, + ) -> c_int; + + pub fn nftnl_set_fprintf(fp: *mut FILE, s: *const nftnl_set, type_: u32, flags: u32) -> c_int; +} +#[repr(C)] +pub struct nftnl_set_list(c_void); + +extern "C" { + pub fn nftnl_set_list_alloc() -> *mut nftnl_set_list; + + pub fn nftnl_set_list_free(list: *mut nftnl_set_list); + + pub fn nftnl_set_list_is_empty(list: *const nftnl_set_list) -> c_int; + + pub fn nftnl_set_list_add(s: *mut nftnl_set, list: *mut nftnl_set_list); + + pub fn nftnl_set_list_add_tail(s: *mut nftnl_set, list: *mut nftnl_set_list); + + pub fn nftnl_set_list_del(s: *mut nftnl_set); + + pub fn nftnl_set_list_foreach( + set_list: *mut nftnl_set_list, + cb: Option c_int>, + data: *mut c_void, + ) -> c_int; + + pub fn nftnl_set_list_lookup_byname( + set_list: *mut nftnl_set_list, + set: *const c_char, + ) -> *mut nftnl_set; +} +#[repr(C)] +pub struct nftnl_set_list_iter(c_void); + +extern "C" { + pub fn nftnl_set_list_iter_create(l: *const nftnl_set_list) -> *mut nftnl_set_list_iter; + + pub fn nftnl_set_list_iter_cur(iter: *const nftnl_set_list_iter) -> *mut nftnl_set; + + pub fn nftnl_set_list_iter_next(iter: *mut nftnl_set_list_iter) -> *mut nftnl_set; + + pub fn nftnl_set_list_iter_destroy(iter: *const nftnl_set_list_iter); + + pub fn nftnl_set_parse( + s: *mut nftnl_set, + type_: nftnl_parse_type, + data: *const c_char, + err: *mut nftnl_parse_err, + ) -> c_int; + + pub fn nftnl_set_parse_file( + s: *mut nftnl_set, + type_: nftnl_parse_type, + fp: *mut FILE, + err: *mut nftnl_parse_err, + ) -> c_int; +} +pub const NFTNL_SET_ELEM_FLAGS: u32 = 0; +pub const NFTNL_SET_ELEM_KEY: u32 = 1; +pub const NFTNL_SET_ELEM_VERDICT: u32 = 2; +pub const NFTNL_SET_ELEM_CHAIN: u32 = 3; +pub const NFTNL_SET_ELEM_DATA: u32 = 4; +pub const NFTNL_SET_ELEM_TIMEOUT: u32 = 5; +pub const NFTNL_SET_ELEM_EXPIRATION: u32 = 6; +pub const NFTNL_SET_ELEM_USERDATA: u32 = 7; +pub const NFTNL_SET_ELEM_EXPR: u32 = 8; +pub const NFTNL_SET_ELEM_OBJREF: u32 = 9; +pub const __NFTNL_SET_ELEM_MAX: u32 = 10; + +#[repr(C)] +pub struct nftnl_set_elem(c_void); + +extern "C" { + pub fn nftnl_set_elem_alloc() -> *mut nftnl_set_elem; + + pub fn nftnl_set_elem_free(s: *mut nftnl_set_elem); + + pub fn nftnl_set_elem_clone(elem: *mut nftnl_set_elem) -> *mut nftnl_set_elem; + + pub fn nftnl_set_elem_add(s: *mut nftnl_set, elem: *mut nftnl_set_elem); + + pub fn nftnl_set_elem_unset(s: *mut nftnl_set_elem, attr: u16); + + pub fn nftnl_set_elem_set( + s: *mut nftnl_set_elem, + attr: u16, + data: *const c_void, + data_len: u32, + ) -> c_int; + + pub fn nftnl_set_elem_set_u32(s: *mut nftnl_set_elem, attr: u16, val: u32); + + pub fn nftnl_set_elem_set_u64(s: *mut nftnl_set_elem, attr: u16, val: u64); + + pub fn nftnl_set_elem_set_str(s: *mut nftnl_set_elem, attr: u16, str_: *const c_char) -> c_int; + + pub fn nftnl_set_elem_get( + s: *mut nftnl_set_elem, + attr: u16, + data_len: *mut u32, + ) -> *const c_void; + + pub fn nftnl_set_elem_get_str(s: *mut nftnl_set_elem, attr: u16) -> *const c_char; + + pub fn nftnl_set_elem_get_u32(s: *mut nftnl_set_elem, attr: u16) -> u32; + + pub fn nftnl_set_elem_get_u64(s: *mut nftnl_set_elem, attr: u16) -> u64; + + pub fn nftnl_set_elem_is_set(s: *const nftnl_set_elem, attr: u16) -> bool; + + pub fn nftnl_set_elems_nlmsg_build_payload(nlh: *mut nlmsghdr, s: *mut nftnl_set); + + pub fn nftnl_set_elem_nlmsg_build_payload(nlh: *mut nlmsghdr, e: *mut nftnl_set_elem); + + pub fn nftnl_set_elem_parse( + e: *mut nftnl_set_elem, + type_: nftnl_parse_type, + data: *const c_char, + err: *mut nftnl_parse_err, + ) -> c_int; + + pub fn nftnl_set_elem_parse_file( + e: *mut nftnl_set_elem, + type_: nftnl_parse_type, + fp: *mut FILE, + err: *mut nftnl_parse_err, + ) -> c_int; + + pub fn nftnl_set_elem_snprintf( + buf: *mut c_char, + size: usize, + s: *const nftnl_set_elem, + type_: u32, + flags: u32, + ) -> c_int; + + pub fn nftnl_set_elem_fprintf( + fp: *mut FILE, + se: *mut nftnl_set_elem, + type_: u32, + flags: u32, + ) -> c_int; + + pub fn nftnl_set_elem_foreach( + s: *mut nftnl_set, + cb: Option c_int>, + data: *mut c_void, + ) -> c_int; +} +#[repr(C)] +pub struct nftnl_set_elems_iter(c_void); + +extern "C" { + pub fn nftnl_set_elems_iter_create(s: *const nftnl_set) -> *mut nftnl_set_elems_iter; + + pub fn nftnl_set_elems_iter_cur(iter: *const nftnl_set_elems_iter) -> *mut nftnl_set_elem; + + pub fn nftnl_set_elems_iter_next(iter: *mut nftnl_set_elems_iter) -> *mut nftnl_set_elem; + + pub fn nftnl_set_elems_iter_destroy(iter: *mut nftnl_set_elems_iter); + + pub fn nftnl_set_elems_nlmsg_build_payload_iter( + nlh: *mut nlmsghdr, + iter: *mut nftnl_set_elems_iter, + ) -> c_int; +} +#[repr(C)] +pub struct nftnl_table(c_void); + +extern "C" { + pub fn nftnl_table_alloc() -> *mut nftnl_table; + + pub fn nftnl_table_free(arg1: *const nftnl_table); +} +pub const NFTNL_TABLE_NAME: nftnl_table_attr = 0; +pub const NFTNL_TABLE_FAMILY: nftnl_table_attr = 1; +pub const NFTNL_TABLE_FLAGS: nftnl_table_attr = 2; +pub const NFTNL_TABLE_USE: nftnl_table_attr = 3; +pub const NFTNL_TABLE_HANDLE: nftnl_table_attr = 4; +pub const __NFTNL_TABLE_MAX: nftnl_table_attr = 5; +pub type nftnl_table_attr = c_uint; +extern "C" { + pub fn nftnl_table_is_set(t: *const nftnl_table, attr: u16) -> bool; + + pub fn nftnl_table_unset(t: *mut nftnl_table, attr: u16); + + pub fn nftnl_table_set(t: *mut nftnl_table, attr: u16, data: *const c_void); + + pub fn nftnl_table_set_data( + t: *mut nftnl_table, + attr: u16, + data: *const c_void, + data_len: u32, + ) -> c_int; + + pub fn nftnl_table_get(t: *const nftnl_table, attr: u16) -> *const c_void; + + pub fn nftnl_table_get_data( + t: *const nftnl_table, + attr: u16, + data_len: *mut u32, + ) -> *const c_void; + + pub fn nftnl_table_set_u8(t: *mut nftnl_table, attr: u16, data: u8); + + pub fn nftnl_table_set_u32(t: *mut nftnl_table, attr: u16, data: u32); + + pub fn nftnl_table_set_u64(t: *mut nftnl_table, attr: u16, data: u64); + + pub fn nftnl_table_set_str(t: *mut nftnl_table, attr: u16, str_: *const c_char) -> c_int; + + pub fn nftnl_table_get_u8(t: *const nftnl_table, attr: u16) -> u8; + + pub fn nftnl_table_get_u32(t: *const nftnl_table, attr: u16) -> u32; + + pub fn nftnl_table_get_u64(t: *const nftnl_table, attr: u16) -> u64; + + pub fn nftnl_table_get_str(t: *const nftnl_table, attr: u16) -> *const c_char; + + pub fn nftnl_table_nlmsg_build_payload(nlh: *mut nlmsghdr, t: *const nftnl_table); + + pub fn nftnl_table_parse( + t: *mut nftnl_table, + type_: nftnl_parse_type, + data: *const c_char, + err: *mut nftnl_parse_err, + ) -> c_int; + + pub fn nftnl_table_parse_file( + t: *mut nftnl_table, + type_: nftnl_parse_type, + fp: *mut FILE, + err: *mut nftnl_parse_err, + ) -> c_int; + + pub fn nftnl_table_snprintf( + buf: *mut c_char, + size: usize, + t: *const nftnl_table, + type_: u32, + flags: u32, + ) -> c_int; + + pub fn nftnl_table_fprintf( + fp: *mut FILE, + t: *const nftnl_table, + type_: u32, + flags: u32, + ) -> c_int; + + pub fn nftnl_table_nlmsg_parse(nlh: *const nlmsghdr, t: *mut nftnl_table) -> c_int; +} +#[repr(C)] +pub struct nftnl_table_list(c_void); + +extern "C" { + pub fn nftnl_table_list_alloc() -> *mut nftnl_table_list; + + pub fn nftnl_table_list_free(list: *mut nftnl_table_list); + + pub fn nftnl_table_list_is_empty(list: *const nftnl_table_list) -> c_int; + + pub fn nftnl_table_list_foreach( + table_list: *mut nftnl_table_list, + cb: Option c_int>, + data: *mut c_void, + ) -> c_int; + + pub fn nftnl_table_list_add(r: *mut nftnl_table, list: *mut nftnl_table_list); + + pub fn nftnl_table_list_add_tail(r: *mut nftnl_table, list: *mut nftnl_table_list); + + pub fn nftnl_table_list_del(r: *mut nftnl_table); +} +#[repr(C)] +pub struct nftnl_table_list_iter(c_void); + +extern "C" { + pub fn nftnl_table_list_iter_create(l: *const nftnl_table_list) -> *mut nftnl_table_list_iter; + + pub fn nftnl_table_list_iter_next(iter: *mut nftnl_table_list_iter) -> *mut nftnl_table; + + pub fn nftnl_table_list_iter_destroy(iter: *const nftnl_table_list_iter); +} +pub const NFTNL_TRACE_CHAIN: nftnl_trace_attr = 0; +pub const NFTNL_TRACE_FAMILY: nftnl_trace_attr = 1; +pub const NFTNL_TRACE_ID: nftnl_trace_attr = 2; +pub const NFTNL_TRACE_IIF: nftnl_trace_attr = 3; +pub const NFTNL_TRACE_IIFTYPE: nftnl_trace_attr = 4; +pub const NFTNL_TRACE_JUMP_TARGET: nftnl_trace_attr = 5; +pub const NFTNL_TRACE_OIF: nftnl_trace_attr = 6; +pub const NFTNL_TRACE_OIFTYPE: nftnl_trace_attr = 7; +pub const NFTNL_TRACE_MARK: nftnl_trace_attr = 8; +pub const NFTNL_TRACE_LL_HEADER: nftnl_trace_attr = 9; +pub const NFTNL_TRACE_NETWORK_HEADER: nftnl_trace_attr = 10; +pub const NFTNL_TRACE_TRANSPORT_HEADER: nftnl_trace_attr = 11; +pub const NFTNL_TRACE_TABLE: nftnl_trace_attr = 12; +pub const NFTNL_TRACE_TYPE: nftnl_trace_attr = 13; +pub const NFTNL_TRACE_RULE_HANDLE: nftnl_trace_attr = 14; +pub const NFTNL_TRACE_VERDICT: nftnl_trace_attr = 15; +pub const NFTNL_TRACE_NFPROTO: nftnl_trace_attr = 16; +pub const NFTNL_TRACE_POLICY: nftnl_trace_attr = 17; +pub const __NFTNL_TRACE_MAX: nftnl_trace_attr = 18; +pub type nftnl_trace_attr = c_uint; +#[repr(C)] +pub struct nftnl_trace(c_void); + +extern "C" { + pub fn nftnl_trace_alloc() -> *mut nftnl_trace; + + pub fn nftnl_trace_free(trace: *const nftnl_trace); + + pub fn nftnl_trace_is_set(trace: *const nftnl_trace, type_: u16) -> bool; + + pub fn nftnl_trace_get_data( + trace: *const nftnl_trace, + type_: u16, + data_len: *mut u32, + ) -> *const c_void; + + pub fn nftnl_trace_get_u16(trace: *const nftnl_trace, type_: u16) -> u16; + + pub fn nftnl_trace_get_u32(trace: *const nftnl_trace, type_: u16) -> u32; + + pub fn nftnl_trace_get_u64(trace: *const nftnl_trace, type_: u16) -> u64; + + pub fn nftnl_trace_get_str(trace: *const nftnl_trace, type_: u16) -> *const c_char; + + pub fn nftnl_trace_nlmsg_parse(nlh: *const nlmsghdr, t: *mut nftnl_trace) -> c_int; +} +pub const NFTNL_UDATA_RULE_COMMENT: nftnl_udata_rule_types = 0; +pub const NFTNL_UDATA_RULE_EBTABLES_POLICY: nftnl_udata_rule_types = 1; +pub const __NFTNL_UDATA_RULE_MAX: nftnl_udata_rule_types = 2; +pub type nftnl_udata_rule_types = c_uint; +pub const NFTNL_UDATA_SET_KEYBYTEORDER: nftnl_udata_set_types = 0; +pub const NFTNL_UDATA_SET_DATABYTEORDER: nftnl_udata_set_types = 1; +pub const NFTNL_UDATA_SET_MERGE_ELEMENTS: nftnl_udata_set_types = 2; +pub const __NFTNL_UDATA_SET_MAX: nftnl_udata_set_types = 3; +pub type nftnl_udata_set_types = c_uint; +pub const NFTNL_UDATA_SET_ELEM_COMMENT: nftnl_udata_set_elem_types = 0; +pub const NFTNL_UDATA_SET_ELEM_FLAGS: nftnl_udata_set_elem_types = 1; +pub const __NFTNL_UDATA_SET_ELEM_MAX: nftnl_udata_set_elem_types = 2; +pub type nftnl_udata_set_elem_types = c_uint; +pub const NFTNL_SET_ELEM_F_INTERVAL_OPEN: nftnl_udata_set_elem_flags = 1; +pub type nftnl_udata_set_elem_flags = c_uint; +#[repr(C)] +pub struct nftnl_udata(c_void); + +#[repr(C)] +pub struct nftnl_udata_buf(c_void); + +extern "C" { + pub fn nftnl_udata_buf_alloc(data_size: u32) -> *mut nftnl_udata_buf; + + pub fn nftnl_udata_buf_free(buf: *const nftnl_udata_buf); + + pub fn nftnl_udata_buf_len(buf: *const nftnl_udata_buf) -> u32; + + pub fn nftnl_udata_buf_data(buf: *const nftnl_udata_buf) -> *mut c_void; + + pub fn nftnl_udata_buf_put(buf: *mut nftnl_udata_buf, data: *const c_void, len: u32); + + pub fn nftnl_udata_start(buf: *const nftnl_udata_buf) -> *mut nftnl_udata; + + pub fn nftnl_udata_end(buf: *const nftnl_udata_buf) -> *mut nftnl_udata; + + pub fn nftnl_udata_put( + buf: *mut nftnl_udata_buf, + type_: u8, + len: u32, + value: *const c_void, + ) -> bool; + + pub fn nftnl_udata_put_u32(buf: *mut nftnl_udata_buf, type_: u8, data: u32) -> bool; + + pub fn nftnl_udata_put_strz(buf: *mut nftnl_udata_buf, type_: u8, strz: *const c_char) -> bool; + + pub fn nftnl_udata_type(attr: *const nftnl_udata) -> u8; + + pub fn nftnl_udata_len(attr: *const nftnl_udata) -> u8; + + pub fn nftnl_udata_get(attr: *const nftnl_udata) -> *mut c_void; + + pub fn nftnl_udata_get_u32(attr: *const nftnl_udata) -> u32; + + pub fn nftnl_udata_next(attr: *const nftnl_udata) -> *mut nftnl_udata; +} +pub type nftnl_udata_cb_t = + Option c_int>; +extern "C" { + pub fn nftnl_udata_parse( + data: *const c_void, + data_len: u32, + cb: nftnl_udata_cb_t, + cb_data: *mut c_void, + ) -> c_int; +} diff --git a/nftnl-sys/src/nftnl_1_1_6.rs b/nftnl-sys/src/nftnl_1_1_6.rs new file mode 100644 index 0000000..3b68683 --- /dev/null +++ b/nftnl-sys/src/nftnl_1_1_6.rs @@ -0,0 +1,1426 @@ +/* automatically generated by rust-bindgen 0.69.4 */ + +use core::option::Option; +use libc::{c_char, c_int, c_uint, c_void, iovec, nlmsghdr, FILE}; + +pub const NFTNL_UDATA_COMMENT_MAXLEN: u32 = 128; +#[repr(C)] +pub struct nftnl_batch(c_void); + +extern "C" { + pub fn nftnl_batch_alloc(pg_size: u32, pg_overrun_size: u32) -> *mut nftnl_batch; + + pub fn nftnl_batch_update(batch: *mut nftnl_batch) -> c_int; + + pub fn nftnl_batch_free(batch: *mut nftnl_batch); + + pub fn nftnl_batch_buffer(batch: *mut nftnl_batch) -> *mut c_void; + + pub fn nftnl_batch_buffer_len(batch: *mut nftnl_batch) -> u32; + + pub fn nftnl_batch_iovec_len(batch: *mut nftnl_batch) -> c_int; + + pub fn nftnl_batch_iovec(batch: *mut nftnl_batch, iov: *mut iovec, iovlen: u32); +} +pub const NFTNL_PARSE_EBADINPUT: u32 = 0; +pub const NFTNL_PARSE_EMISSINGNODE: u32 = 1; +pub const NFTNL_PARSE_EBADTYPE: u32 = 2; +pub const NFTNL_PARSE_EOPNOTSUPP: u32 = 3; + +pub const NFTNL_OUTPUT_DEFAULT: nftnl_output_type = 0; +pub const NFTNL_OUTPUT_XML: nftnl_output_type = 1; +pub const NFTNL_OUTPUT_JSON: nftnl_output_type = 2; +pub type nftnl_output_type = c_uint; +pub const NFTNL_OF_EVENT_NEW: nftnl_output_flags = 1; +pub const NFTNL_OF_EVENT_DEL: nftnl_output_flags = 2; +pub const NFTNL_OF_EVENT_ANY: nftnl_output_flags = 3; +pub type nftnl_output_flags = c_uint; +pub const NFTNL_CMD_UNSPEC: nftnl_cmd_type = 0; +pub const NFTNL_CMD_ADD: nftnl_cmd_type = 1; +pub const NFTNL_CMD_INSERT: nftnl_cmd_type = 2; +pub const NFTNL_CMD_DELETE: nftnl_cmd_type = 3; +pub const NFTNL_CMD_REPLACE: nftnl_cmd_type = 4; +pub const NFTNL_CMD_FLUSH: nftnl_cmd_type = 5; +pub const NFTNL_CMD_MAX: nftnl_cmd_type = 6; +pub type nftnl_cmd_type = c_uint; +pub const NFTNL_PARSE_NONE: nftnl_parse_type = 0; +pub const NFTNL_PARSE_XML: nftnl_parse_type = 1; +pub const NFTNL_PARSE_JSON: nftnl_parse_type = 2; +pub const NFTNL_PARSE_MAX: nftnl_parse_type = 3; +pub type nftnl_parse_type = c_uint; +#[repr(C)] +pub struct nftnl_parse_err(c_void); + +extern "C" { + pub fn nftnl_nlmsg_build_hdr( + buf: *mut c_char, + type_: u16, + family: u16, + flags: u16, + seq: u32, + ) -> *mut nlmsghdr; + + pub fn nftnl_parse_err_alloc() -> *mut nftnl_parse_err; + + pub fn nftnl_parse_err_free(arg1: *mut nftnl_parse_err); + + pub fn nftnl_parse_perror(str_: *const c_char, err: *mut nftnl_parse_err) -> c_int; + + pub fn nftnl_batch_is_supported() -> c_int; + + pub fn nftnl_batch_begin(buf: *mut c_char, seq: u32) -> *mut nlmsghdr; + + pub fn nftnl_batch_end(buf: *mut c_char, seq: u32) -> *mut nlmsghdr; +} +#[repr(C)] +pub struct nftnl_chain(c_void); + +#[repr(C)] +pub struct nftnl_rule(c_void); + +extern "C" { + pub fn nftnl_chain_alloc() -> *mut nftnl_chain; + + pub fn nftnl_chain_free(arg1: *const nftnl_chain); +} +pub const NFTNL_CHAIN_NAME: nftnl_chain_attr = 0; +pub const NFTNL_CHAIN_FAMILY: nftnl_chain_attr = 1; +pub const NFTNL_CHAIN_TABLE: nftnl_chain_attr = 2; +pub const NFTNL_CHAIN_HOOKNUM: nftnl_chain_attr = 3; +pub const NFTNL_CHAIN_PRIO: nftnl_chain_attr = 4; +pub const NFTNL_CHAIN_POLICY: nftnl_chain_attr = 5; +pub const NFTNL_CHAIN_USE: nftnl_chain_attr = 6; +pub const NFTNL_CHAIN_BYTES: nftnl_chain_attr = 7; +pub const NFTNL_CHAIN_PACKETS: nftnl_chain_attr = 8; +pub const NFTNL_CHAIN_HANDLE: nftnl_chain_attr = 9; +pub const NFTNL_CHAIN_TYPE: nftnl_chain_attr = 10; +pub const NFTNL_CHAIN_DEV: nftnl_chain_attr = 11; +pub const NFTNL_CHAIN_DEVICES: nftnl_chain_attr = 12; +pub const NFTNL_CHAIN_FLAGS: nftnl_chain_attr = 13; +pub const __NFTNL_CHAIN_MAX: nftnl_chain_attr = 14; +pub type nftnl_chain_attr = c_uint; +extern "C" { + pub fn nftnl_chain_is_set(c: *const nftnl_chain, attr: u16) -> bool; + + pub fn nftnl_chain_unset(c: *mut nftnl_chain, attr: u16); + + pub fn nftnl_chain_set(t: *mut nftnl_chain, attr: u16, data: *const c_void); + + pub fn nftnl_chain_set_data( + t: *mut nftnl_chain, + attr: u16, + data: *const c_void, + data_len: u32, + ) -> c_int; + + pub fn nftnl_chain_set_u8(t: *mut nftnl_chain, attr: u16, data: u8); + + pub fn nftnl_chain_set_u32(t: *mut nftnl_chain, attr: u16, data: u32); + + pub fn nftnl_chain_set_s32(t: *mut nftnl_chain, attr: u16, data: i32); + + pub fn nftnl_chain_set_u64(t: *mut nftnl_chain, attr: u16, data: u64); + + pub fn nftnl_chain_set_str(t: *mut nftnl_chain, attr: u16, str_: *const c_char) -> c_int; + + pub fn nftnl_chain_set_array(t: *mut nftnl_chain, attr: u16, data: *mut *const c_char) + -> c_int; + + pub fn nftnl_chain_get(c: *const nftnl_chain, attr: u16) -> *const c_void; + + pub fn nftnl_chain_get_data( + c: *const nftnl_chain, + attr: u16, + data_len: *mut u32, + ) -> *const c_void; + + pub fn nftnl_chain_get_str(c: *const nftnl_chain, attr: u16) -> *const c_char; + + pub fn nftnl_chain_get_u8(c: *const nftnl_chain, attr: u16) -> u8; + + pub fn nftnl_chain_get_u32(c: *const nftnl_chain, attr: u16) -> u32; + + pub fn nftnl_chain_get_s32(c: *const nftnl_chain, attr: u16) -> i32; + + pub fn nftnl_chain_get_u64(c: *const nftnl_chain, attr: u16) -> u64; + + pub fn nftnl_chain_get_array(c: *const nftnl_chain, attr: u16) -> *const *const c_char; + + pub fn nftnl_chain_rule_add(rule: *mut nftnl_rule, c: *mut nftnl_chain); + + pub fn nftnl_chain_rule_del(rule: *mut nftnl_rule); + + pub fn nftnl_chain_rule_add_tail(rule: *mut nftnl_rule, c: *mut nftnl_chain); + + pub fn nftnl_chain_rule_insert_at(rule: *mut nftnl_rule, pos: *mut nftnl_rule); + + pub fn nftnl_chain_rule_append_at(rule: *mut nftnl_rule, pos: *mut nftnl_rule); + + pub fn nftnl_chain_nlmsg_build_payload(nlh: *mut nlmsghdr, t: *const nftnl_chain); + + pub fn nftnl_chain_parse( + c: *mut nftnl_chain, + type_: nftnl_parse_type, + data: *const c_char, + err: *mut nftnl_parse_err, + ) -> c_int; + + pub fn nftnl_chain_parse_file( + c: *mut nftnl_chain, + type_: nftnl_parse_type, + fp: *mut FILE, + err: *mut nftnl_parse_err, + ) -> c_int; + + pub fn nftnl_chain_snprintf( + buf: *mut c_char, + size: usize, + t: *const nftnl_chain, + type_: u32, + flags: u32, + ) -> c_int; + + pub fn nftnl_chain_fprintf( + fp: *mut FILE, + c: *const nftnl_chain, + type_: u32, + flags: u32, + ) -> c_int; + + pub fn nftnl_chain_nlmsg_parse(nlh: *const nlmsghdr, t: *mut nftnl_chain) -> c_int; + + pub fn nftnl_rule_foreach( + c: *mut nftnl_chain, + cb: Option c_int>, + data: *mut c_void, + ) -> c_int; + + pub fn nftnl_rule_lookup_byindex(c: *mut nftnl_chain, index: u32) -> *mut nftnl_rule; +} +#[repr(C)] +pub struct nftnl_rule_iter(c_void); + +extern "C" { + pub fn nftnl_rule_iter_create(c: *const nftnl_chain) -> *mut nftnl_rule_iter; + + pub fn nftnl_rule_iter_next(iter: *mut nftnl_rule_iter) -> *mut nftnl_rule; + + pub fn nftnl_rule_iter_destroy(iter: *mut nftnl_rule_iter); +} +#[repr(C)] +pub struct nftnl_chain_list(c_void); + +extern "C" { + pub fn nftnl_chain_list_alloc() -> *mut nftnl_chain_list; + + pub fn nftnl_chain_list_free(list: *mut nftnl_chain_list); + + pub fn nftnl_chain_list_is_empty(list: *const nftnl_chain_list) -> c_int; + + pub fn nftnl_chain_list_foreach( + chain_list: *mut nftnl_chain_list, + cb: Option c_int>, + data: *mut c_void, + ) -> c_int; + + pub fn nftnl_chain_list_lookup_byname( + chain_list: *mut nftnl_chain_list, + chain: *const c_char, + ) -> *mut nftnl_chain; + + pub fn nftnl_chain_list_add(r: *mut nftnl_chain, list: *mut nftnl_chain_list); + + pub fn nftnl_chain_list_add_tail(r: *mut nftnl_chain, list: *mut nftnl_chain_list); + + pub fn nftnl_chain_list_del(c: *mut nftnl_chain); +} +#[repr(C)] +pub struct nftnl_chain_list_iter(c_void); + +extern "C" { + pub fn nftnl_chain_list_iter_create(l: *const nftnl_chain_list) -> *mut nftnl_chain_list_iter; + + pub fn nftnl_chain_list_iter_next(iter: *mut nftnl_chain_list_iter) -> *mut nftnl_chain; + + pub fn nftnl_chain_list_iter_destroy(iter: *mut nftnl_chain_list_iter); +} +#[repr(C)] +pub struct nftnl_expr(c_void); + +pub const NFTNL_EXPR_NAME: u32 = 0; +pub const NFTNL_EXPR_BASE: u32 = 1; + +extern "C" { + pub fn nftnl_expr_alloc(name: *const c_char) -> *mut nftnl_expr; + + pub fn nftnl_expr_free(expr: *const nftnl_expr); + + pub fn nftnl_expr_is_set(expr: *const nftnl_expr, type_: u16) -> bool; + + pub fn nftnl_expr_set( + expr: *mut nftnl_expr, + type_: u16, + data: *const c_void, + data_len: u32, + ) -> c_int; + + pub fn nftnl_expr_set_u8(expr: *mut nftnl_expr, type_: u16, data: u8); + + pub fn nftnl_expr_set_u16(expr: *mut nftnl_expr, type_: u16, data: u16); + + pub fn nftnl_expr_set_u32(expr: *mut nftnl_expr, type_: u16, data: u32); + + pub fn nftnl_expr_set_u64(expr: *mut nftnl_expr, type_: u16, data: u64); + + pub fn nftnl_expr_set_str(expr: *mut nftnl_expr, type_: u16, str_: *const c_char) -> c_int; + + pub fn nftnl_expr_get(expr: *const nftnl_expr, type_: u16, data_len: *mut u32) + -> *const c_void; + + pub fn nftnl_expr_get_u8(expr: *const nftnl_expr, type_: u16) -> u8; + + pub fn nftnl_expr_get_u16(expr: *const nftnl_expr, type_: u16) -> u16; + + pub fn nftnl_expr_get_u32(expr: *const nftnl_expr, type_: u16) -> u32; + + pub fn nftnl_expr_get_u64(expr: *const nftnl_expr, type_: u16) -> u64; + + pub fn nftnl_expr_get_str(expr: *const nftnl_expr, type_: u16) -> *const c_char; + + pub fn nftnl_expr_snprintf( + buf: *mut c_char, + buflen: usize, + expr: *const nftnl_expr, + type_: u32, + flags: u32, + ) -> c_int; + + pub fn nftnl_expr_fprintf( + fp: *mut FILE, + expr: *const nftnl_expr, + type_: u32, + flags: u32, + ) -> c_int; +} +pub const NFTNL_EXPR_PAYLOAD_DREG: u32 = 1; +pub const NFTNL_EXPR_PAYLOAD_BASE: u32 = 2; +pub const NFTNL_EXPR_PAYLOAD_OFFSET: u32 = 3; +pub const NFTNL_EXPR_PAYLOAD_LEN: u32 = 4; +pub const NFTNL_EXPR_PAYLOAD_SREG: u32 = 5; +pub const NFTNL_EXPR_PAYLOAD_CSUM_TYPE: u32 = 6; +pub const NFTNL_EXPR_PAYLOAD_CSUM_OFFSET: u32 = 7; +pub const NFTNL_EXPR_PAYLOAD_FLAGS: u32 = 8; + +pub const NFTNL_EXPR_NG_DREG: u32 = 1; +pub const NFTNL_EXPR_NG_MODULUS: u32 = 2; +pub const NFTNL_EXPR_NG_TYPE: u32 = 3; +pub const NFTNL_EXPR_NG_OFFSET: u32 = 4; +pub const NFTNL_EXPR_NG_SET_NAME: u32 = 5; +pub const NFTNL_EXPR_NG_SET_ID: u32 = 6; + +pub const NFTNL_EXPR_META_KEY: u32 = 1; +pub const NFTNL_EXPR_META_DREG: u32 = 2; +pub const NFTNL_EXPR_META_SREG: u32 = 3; + +pub const NFTNL_EXPR_RT_KEY: u32 = 1; +pub const NFTNL_EXPR_RT_DREG: u32 = 2; + +pub const NFTNL_EXPR_SOCKET_KEY: u32 = 1; +pub const NFTNL_EXPR_SOCKET_DREG: u32 = 2; + +pub const NFTNL_EXPR_TUNNEL_KEY: u32 = 1; +pub const NFTNL_EXPR_TUNNEL_DREG: u32 = 2; + +pub const NFTNL_EXPR_CMP_SREG: u32 = 1; +pub const NFTNL_EXPR_CMP_OP: u32 = 2; +pub const NFTNL_EXPR_CMP_DATA: u32 = 3; + +pub const NFTNL_EXPR_RANGE_SREG: u32 = 1; +pub const NFTNL_EXPR_RANGE_OP: u32 = 2; +pub const NFTNL_EXPR_RANGE_FROM_DATA: u32 = 3; +pub const NFTNL_EXPR_RANGE_TO_DATA: u32 = 4; + +pub const NFTNL_EXPR_IMM_DREG: u32 = 1; +pub const NFTNL_EXPR_IMM_DATA: u32 = 2; +pub const NFTNL_EXPR_IMM_VERDICT: u32 = 3; +pub const NFTNL_EXPR_IMM_CHAIN: u32 = 4; + +pub const NFTNL_EXPR_CTR_PACKETS: u32 = 1; +pub const NFTNL_EXPR_CTR_BYTES: u32 = 2; + +pub const NFTNL_EXPR_CONNLIMIT_COUNT: u32 = 1; +pub const NFTNL_EXPR_CONNLIMIT_FLAGS: u32 = 2; + +pub const NFTNL_EXPR_BITWISE_SREG: u32 = 1; +pub const NFTNL_EXPR_BITWISE_DREG: u32 = 2; +pub const NFTNL_EXPR_BITWISE_LEN: u32 = 3; +pub const NFTNL_EXPR_BITWISE_MASK: u32 = 4; +pub const NFTNL_EXPR_BITWISE_XOR: u32 = 5; +pub const NFTNL_EXPR_BITWISE_OP: u32 = 6; +pub const NFTNL_EXPR_BITWISE_DATA: u32 = 7; + +pub const NFTNL_EXPR_TG_NAME: u32 = 1; +pub const NFTNL_EXPR_TG_REV: u32 = 2; +pub const NFTNL_EXPR_TG_INFO: u32 = 3; + +pub const NFTNL_EXPR_MT_NAME: u32 = 1; +pub const NFTNL_EXPR_MT_REV: u32 = 2; +pub const NFTNL_EXPR_MT_INFO: u32 = 3; + +pub const NFTNL_EXPR_NAT_TYPE: u32 = 1; +pub const NFTNL_EXPR_NAT_FAMILY: u32 = 2; +pub const NFTNL_EXPR_NAT_REG_ADDR_MIN: u32 = 3; +pub const NFTNL_EXPR_NAT_REG_ADDR_MAX: u32 = 4; +pub const NFTNL_EXPR_NAT_REG_PROTO_MIN: u32 = 5; +pub const NFTNL_EXPR_NAT_REG_PROTO_MAX: u32 = 6; +pub const NFTNL_EXPR_NAT_FLAGS: u32 = 7; + +pub const NFTNL_EXPR_TPROXY_FAMILY: u32 = 1; +pub const NFTNL_EXPR_TPROXY_REG_ADDR: u32 = 2; +pub const NFTNL_EXPR_TPROXY_REG_PORT: u32 = 3; + +pub const NFTNL_EXPR_LOOKUP_SREG: u32 = 1; +pub const NFTNL_EXPR_LOOKUP_DREG: u32 = 2; +pub const NFTNL_EXPR_LOOKUP_SET: u32 = 3; +pub const NFTNL_EXPR_LOOKUP_SET_ID: u32 = 4; +pub const NFTNL_EXPR_LOOKUP_FLAGS: u32 = 5; + +pub const NFTNL_EXPR_DYNSET_SREG_KEY: u32 = 1; +pub const NFTNL_EXPR_DYNSET_SREG_DATA: u32 = 2; +pub const NFTNL_EXPR_DYNSET_OP: u32 = 3; +pub const NFTNL_EXPR_DYNSET_TIMEOUT: u32 = 4; +pub const NFTNL_EXPR_DYNSET_SET_NAME: u32 = 5; +pub const NFTNL_EXPR_DYNSET_SET_ID: u32 = 6; +pub const NFTNL_EXPR_DYNSET_EXPR: u32 = 7; + +pub const NFTNL_EXPR_LOG_PREFIX: u32 = 1; +pub const NFTNL_EXPR_LOG_GROUP: u32 = 2; +pub const NFTNL_EXPR_LOG_SNAPLEN: u32 = 3; +pub const NFTNL_EXPR_LOG_QTHRESHOLD: u32 = 4; +pub const NFTNL_EXPR_LOG_LEVEL: u32 = 5; +pub const NFTNL_EXPR_LOG_FLAGS: u32 = 6; + +pub const NFTNL_EXPR_EXTHDR_DREG: u32 = 1; +pub const NFTNL_EXPR_EXTHDR_TYPE: u32 = 2; +pub const NFTNL_EXPR_EXTHDR_OFFSET: u32 = 3; +pub const NFTNL_EXPR_EXTHDR_LEN: u32 = 4; +pub const NFTNL_EXPR_EXTHDR_FLAGS: u32 = 5; +pub const NFTNL_EXPR_EXTHDR_OP: u32 = 6; +pub const NFTNL_EXPR_EXTHDR_SREG: u32 = 7; + +pub const NFTNL_EXPR_CT_DREG: u32 = 1; +pub const NFTNL_EXPR_CT_KEY: u32 = 2; +pub const NFTNL_EXPR_CT_DIR: u32 = 3; +pub const NFTNL_EXPR_CT_SREG: u32 = 4; + +pub const NFTNL_EXPR_BYTEORDER_DREG: u32 = 1; +pub const NFTNL_EXPR_BYTEORDER_SREG: u32 = 2; +pub const NFTNL_EXPR_BYTEORDER_OP: u32 = 3; +pub const NFTNL_EXPR_BYTEORDER_LEN: u32 = 4; +pub const NFTNL_EXPR_BYTEORDER_SIZE: u32 = 5; + +pub const NFTNL_EXPR_LIMIT_RATE: u32 = 1; +pub const NFTNL_EXPR_LIMIT_UNIT: u32 = 2; +pub const NFTNL_EXPR_LIMIT_BURST: u32 = 3; +pub const NFTNL_EXPR_LIMIT_TYPE: u32 = 4; +pub const NFTNL_EXPR_LIMIT_FLAGS: u32 = 5; + +pub const NFTNL_EXPR_REJECT_TYPE: u32 = 1; +pub const NFTNL_EXPR_REJECT_CODE: u32 = 2; + +pub const NFTNL_EXPR_QUEUE_NUM: u32 = 1; +pub const NFTNL_EXPR_QUEUE_TOTAL: u32 = 2; +pub const NFTNL_EXPR_QUEUE_FLAGS: u32 = 3; +pub const NFTNL_EXPR_QUEUE_SREG_QNUM: u32 = 4; + +pub const NFTNL_EXPR_QUOTA_BYTES: u32 = 1; +pub const NFTNL_EXPR_QUOTA_FLAGS: u32 = 2; +pub const NFTNL_EXPR_QUOTA_CONSUMED: u32 = 3; + +pub const NFTNL_EXPR_MASQ_FLAGS: u32 = 1; +pub const NFTNL_EXPR_MASQ_REG_PROTO_MIN: u32 = 2; +pub const NFTNL_EXPR_MASQ_REG_PROTO_MAX: u32 = 3; + +pub const NFTNL_EXPR_REDIR_REG_PROTO_MIN: u32 = 1; +pub const NFTNL_EXPR_REDIR_REG_PROTO_MAX: u32 = 2; +pub const NFTNL_EXPR_REDIR_FLAGS: u32 = 3; + +pub const NFTNL_EXPR_DUP_SREG_ADDR: u32 = 1; +pub const NFTNL_EXPR_DUP_SREG_DEV: u32 = 2; + +pub const NFTNL_EXPR_FLOW_TABLE_NAME: u32 = 1; + +pub const NFTNL_EXPR_FWD_SREG_DEV: u32 = 1; +pub const NFTNL_EXPR_FWD_SREG_ADDR: u32 = 2; +pub const NFTNL_EXPR_FWD_NFPROTO: u32 = 3; + +pub const NFTNL_EXPR_HASH_SREG: u32 = 1; +pub const NFTNL_EXPR_HASH_DREG: u32 = 2; +pub const NFTNL_EXPR_HASH_LEN: u32 = 3; +pub const NFTNL_EXPR_HASH_MODULUS: u32 = 4; +pub const NFTNL_EXPR_HASH_SEED: u32 = 5; +pub const NFTNL_EXPR_HASH_OFFSET: u32 = 6; +pub const NFTNL_EXPR_HASH_TYPE: u32 = 7; +pub const NFTNL_EXPR_HASH_SET_NAME: u32 = 8; +pub const NFTNL_EXPR_HASH_SET_ID: u32 = 9; + +pub const NFTNL_EXPR_FIB_DREG: u32 = 1; +pub const NFTNL_EXPR_FIB_RESULT: u32 = 2; +pub const NFTNL_EXPR_FIB_FLAGS: u32 = 3; + +pub const NFTNL_EXPR_OBJREF_IMM_TYPE: u32 = 1; +pub const NFTNL_EXPR_OBJREF_IMM_NAME: u32 = 2; +pub const NFTNL_EXPR_OBJREF_SET_SREG: u32 = 3; +pub const NFTNL_EXPR_OBJREF_SET_NAME: u32 = 4; +pub const NFTNL_EXPR_OBJREF_SET_ID: u32 = 5; + +pub const NFTNL_EXPR_OSF_DREG: u32 = 1; +pub const NFTNL_EXPR_OSF_TTL: u32 = 2; +pub const NFTNL_EXPR_OSF_FLAGS: u32 = 3; + +pub const NFTNL_EXPR_XFRM_DREG: u32 = 1; +pub const NFTNL_EXPR_XFRM_SREG: u32 = 2; +pub const NFTNL_EXPR_XFRM_KEY: u32 = 3; +pub const NFTNL_EXPR_XFRM_DIR: u32 = 4; +pub const NFTNL_EXPR_XFRM_SPNUM: u32 = 5; + +pub const NFTNL_EXPR_SYNPROXY_MSS: u32 = 1; +pub const NFTNL_EXPR_SYNPROXY_WSCALE: u32 = 2; +pub const NFTNL_EXPR_SYNPROXY_FLAGS: u32 = 3; + +#[repr(C)] +pub struct nftnl_gen(c_void); + +extern "C" { + pub fn nftnl_gen_alloc() -> *mut nftnl_gen; + + pub fn nftnl_gen_free(arg1: *const nftnl_gen); +} +pub const NFTNL_GEN_ID: u32 = 0; +pub const __NFTNL_GEN_MAX: u32 = 1; + +extern "C" { + pub fn nftnl_gen_is_set(gen: *const nftnl_gen, attr: u16) -> bool; + + pub fn nftnl_gen_unset(gen: *mut nftnl_gen, attr: u16); + + pub fn nftnl_gen_set(gen: *mut nftnl_gen, attr: u16, data: *const c_void) -> c_int; + + pub fn nftnl_gen_set_data( + gen: *mut nftnl_gen, + attr: u16, + data: *const c_void, + data_len: u32, + ) -> c_int; + + pub fn nftnl_gen_get(gen: *const nftnl_gen, attr: u16) -> *const c_void; + + pub fn nftnl_gen_get_data( + gen: *const nftnl_gen, + attr: u16, + data_len: *mut u32, + ) -> *const c_void; + + pub fn nftnl_gen_set_u32(gen: *mut nftnl_gen, attr: u16, data: u32); + + pub fn nftnl_gen_get_u32(gen: *const nftnl_gen, attr: u16) -> u32; + + pub fn nftnl_gen_nlmsg_parse(nlh: *const nlmsghdr, gen: *mut nftnl_gen) -> c_int; + + pub fn nftnl_gen_snprintf( + buf: *mut c_char, + size: usize, + gen: *const nftnl_gen, + type_: u32, + flags: u32, + ) -> c_int; + + pub fn nftnl_gen_fprintf(fp: *mut FILE, gen: *const nftnl_gen, type_: u32, flags: u32) + -> c_int; +} +pub const NFTNL_OBJ_TABLE: u32 = 0; +pub const NFTNL_OBJ_NAME: u32 = 1; +pub const NFTNL_OBJ_TYPE: u32 = 2; +pub const NFTNL_OBJ_FAMILY: u32 = 3; +pub const NFTNL_OBJ_USE: u32 = 4; +pub const NFTNL_OBJ_HANDLE: u32 = 5; +pub const NFTNL_OBJ_BASE: u32 = 16; +pub const __NFTNL_OBJ_MAX: u32 = 17; + +pub const NFTNL_OBJ_CTR_PKTS: u32 = 16; +pub const NFTNL_OBJ_CTR_BYTES: u32 = 17; + +pub const NFTNL_OBJ_QUOTA_BYTES: u32 = 16; +pub const NFTNL_OBJ_QUOTA_CONSUMED: u32 = 17; +pub const NFTNL_OBJ_QUOTA_FLAGS: u32 = 18; + +pub const NFTNL_OBJ_CT_HELPER_NAME: u32 = 16; +pub const NFTNL_OBJ_CT_HELPER_L3PROTO: u32 = 17; +pub const NFTNL_OBJ_CT_HELPER_L4PROTO: u32 = 18; + +pub const NFTNL_CTTIMEOUT_TCP_SYN_SENT: nftnl_cttimeout_array_tcp = 0; +pub const NFTNL_CTTIMEOUT_TCP_SYN_RECV: nftnl_cttimeout_array_tcp = 1; +pub const NFTNL_CTTIMEOUT_TCP_ESTABLISHED: nftnl_cttimeout_array_tcp = 2; +pub const NFTNL_CTTIMEOUT_TCP_FIN_WAIT: nftnl_cttimeout_array_tcp = 3; +pub const NFTNL_CTTIMEOUT_TCP_CLOSE_WAIT: nftnl_cttimeout_array_tcp = 4; +pub const NFTNL_CTTIMEOUT_TCP_LAST_ACK: nftnl_cttimeout_array_tcp = 5; +pub const NFTNL_CTTIMEOUT_TCP_TIME_WAIT: nftnl_cttimeout_array_tcp = 6; +pub const NFTNL_CTTIMEOUT_TCP_CLOSE: nftnl_cttimeout_array_tcp = 7; +pub const NFTNL_CTTIMEOUT_TCP_SYN_SENT2: nftnl_cttimeout_array_tcp = 8; +pub const NFTNL_CTTIMEOUT_TCP_RETRANS: nftnl_cttimeout_array_tcp = 9; +pub const NFTNL_CTTIMEOUT_TCP_UNACK: nftnl_cttimeout_array_tcp = 10; +pub const NFTNL_CTTIMEOUT_TCP_MAX: nftnl_cttimeout_array_tcp = 11; +pub type nftnl_cttimeout_array_tcp = c_uint; +pub const NFTNL_CTTIMEOUT_UDP_UNREPLIED: nftnl_cttimeout_array_udp = 0; +pub const NFTNL_CTTIMEOUT_UDP_REPLIED: nftnl_cttimeout_array_udp = 1; +pub const NFTNL_CTTIMEOUT_UDP_MAX: nftnl_cttimeout_array_udp = 2; +pub type nftnl_cttimeout_array_udp = c_uint; +pub const NFTNL_OBJ_CT_TIMEOUT_L3PROTO: u32 = 16; +pub const NFTNL_OBJ_CT_TIMEOUT_L4PROTO: u32 = 17; +pub const NFTNL_OBJ_CT_TIMEOUT_ARRAY: u32 = 18; + +pub const NFTNL_OBJ_CT_EXPECT_L3PROTO: u32 = 16; +pub const NFTNL_OBJ_CT_EXPECT_L4PROTO: u32 = 17; +pub const NFTNL_OBJ_CT_EXPECT_DPORT: u32 = 18; +pub const NFTNL_OBJ_CT_EXPECT_TIMEOUT: u32 = 19; +pub const NFTNL_OBJ_CT_EXPECT_SIZE: u32 = 20; + +pub const NFTNL_OBJ_LIMIT_RATE: u32 = 16; +pub const NFTNL_OBJ_LIMIT_UNIT: u32 = 17; +pub const NFTNL_OBJ_LIMIT_BURST: u32 = 18; +pub const NFTNL_OBJ_LIMIT_TYPE: u32 = 19; +pub const NFTNL_OBJ_LIMIT_FLAGS: u32 = 20; + +pub const NFTNL_OBJ_SYNPROXY_MSS: u32 = 16; +pub const NFTNL_OBJ_SYNPROXY_WSCALE: u32 = 17; +pub const NFTNL_OBJ_SYNPROXY_FLAGS: u32 = 18; + +pub const NFTNL_OBJ_TUNNEL_ID: u32 = 16; +pub const NFTNL_OBJ_TUNNEL_IPV4_SRC: u32 = 17; +pub const NFTNL_OBJ_TUNNEL_IPV4_DST: u32 = 18; +pub const NFTNL_OBJ_TUNNEL_IPV6_SRC: u32 = 19; +pub const NFTNL_OBJ_TUNNEL_IPV6_DST: u32 = 20; +pub const NFTNL_OBJ_TUNNEL_IPV6_FLOWLABEL: u32 = 21; +pub const NFTNL_OBJ_TUNNEL_SPORT: u32 = 22; +pub const NFTNL_OBJ_TUNNEL_DPORT: u32 = 23; +pub const NFTNL_OBJ_TUNNEL_FLAGS: u32 = 24; +pub const NFTNL_OBJ_TUNNEL_TOS: u32 = 25; +pub const NFTNL_OBJ_TUNNEL_TTL: u32 = 26; +pub const NFTNL_OBJ_TUNNEL_VXLAN_GBP: u32 = 27; +pub const NFTNL_OBJ_TUNNEL_ERSPAN_VERSION: u32 = 28; +pub const NFTNL_OBJ_TUNNEL_ERSPAN_V1_INDEX: u32 = 29; +pub const NFTNL_OBJ_TUNNEL_ERSPAN_V2_HWID: u32 = 30; +pub const NFTNL_OBJ_TUNNEL_ERSPAN_V2_DIR: u32 = 31; + +pub const NFTNL_OBJ_SECMARK_CTX: u32 = 16; + +#[repr(C)] +pub struct nftnl_obj(c_void); + +extern "C" { + pub fn nftnl_obj_alloc() -> *mut nftnl_obj; + + pub fn nftnl_obj_free(ne: *const nftnl_obj); + + pub fn nftnl_obj_is_set(ne: *const nftnl_obj, attr: u16) -> bool; + + pub fn nftnl_obj_unset(ne: *mut nftnl_obj, attr: u16); + + pub fn nftnl_obj_set_data(ne: *mut nftnl_obj, attr: u16, data: *const c_void, data_len: u32); + + pub fn nftnl_obj_set(ne: *mut nftnl_obj, attr: u16, data: *const c_void); + + pub fn nftnl_obj_set_u8(ne: *mut nftnl_obj, attr: u16, val: u8); + + pub fn nftnl_obj_set_u16(ne: *mut nftnl_obj, attr: u16, val: u16); + + pub fn nftnl_obj_set_u32(ne: *mut nftnl_obj, attr: u16, val: u32); + + pub fn nftnl_obj_set_u64(obj: *mut nftnl_obj, attr: u16, val: u64); + + pub fn nftnl_obj_set_str(ne: *mut nftnl_obj, attr: u16, str_: *const c_char); + + pub fn nftnl_obj_get_data(ne: *mut nftnl_obj, attr: u16, data_len: *mut u32) -> *const c_void; + + pub fn nftnl_obj_get(ne: *mut nftnl_obj, attr: u16) -> *const c_void; + + pub fn nftnl_obj_get_u8(ne: *mut nftnl_obj, attr: u16) -> u8; + + pub fn nftnl_obj_get_u16(obj: *mut nftnl_obj, attr: u16) -> u16; + + pub fn nftnl_obj_get_u32(ne: *mut nftnl_obj, attr: u16) -> u32; + + pub fn nftnl_obj_get_u64(obj: *mut nftnl_obj, attr: u16) -> u64; + + pub fn nftnl_obj_get_str(ne: *mut nftnl_obj, attr: u16) -> *const c_char; + + pub fn nftnl_obj_nlmsg_build_payload(nlh: *mut nlmsghdr, ne: *const nftnl_obj); + + pub fn nftnl_obj_nlmsg_parse(nlh: *const nlmsghdr, ne: *mut nftnl_obj) -> c_int; + + pub fn nftnl_obj_parse( + ne: *mut nftnl_obj, + type_: nftnl_parse_type, + data: *const c_char, + err: *mut nftnl_parse_err, + ) -> c_int; + + pub fn nftnl_obj_parse_file( + ne: *mut nftnl_obj, + type_: nftnl_parse_type, + fp: *mut FILE, + err: *mut nftnl_parse_err, + ) -> c_int; + + pub fn nftnl_obj_snprintf( + buf: *mut c_char, + size: usize, + ne: *const nftnl_obj, + type_: u32, + flags: u32, + ) -> c_int; + + pub fn nftnl_obj_fprintf(fp: *mut FILE, ne: *const nftnl_obj, type_: u32, flags: u32) -> c_int; +} +#[repr(C)] +pub struct nftnl_obj_list(c_void); + +extern "C" { + pub fn nftnl_obj_list_alloc() -> *mut nftnl_obj_list; + + pub fn nftnl_obj_list_free(list: *mut nftnl_obj_list); + + pub fn nftnl_obj_list_is_empty(list: *mut nftnl_obj_list) -> c_int; + + pub fn nftnl_obj_list_add(r: *mut nftnl_obj, list: *mut nftnl_obj_list); + + pub fn nftnl_obj_list_add_tail(r: *mut nftnl_obj, list: *mut nftnl_obj_list); + + pub fn nftnl_obj_list_del(t: *mut nftnl_obj); + + pub fn nftnl_obj_list_foreach( + table_list: *mut nftnl_obj_list, + cb: Option c_int>, + data: *mut c_void, + ) -> c_int; +} +#[repr(C)] +pub struct nftnl_obj_list_iter(c_void); + +extern "C" { + pub fn nftnl_obj_list_iter_create(l: *mut nftnl_obj_list) -> *mut nftnl_obj_list_iter; + + pub fn nftnl_obj_list_iter_next(iter: *mut nftnl_obj_list_iter) -> *mut nftnl_obj; + + pub fn nftnl_obj_list_iter_destroy(iter: *mut nftnl_obj_list_iter); + + pub fn nftnl_rule_alloc() -> *mut nftnl_rule; + + pub fn nftnl_rule_free(arg1: *const nftnl_rule); +} +pub const NFTNL_RULE_FAMILY: nftnl_rule_attr = 0; +pub const NFTNL_RULE_TABLE: nftnl_rule_attr = 1; +pub const NFTNL_RULE_CHAIN: nftnl_rule_attr = 2; +pub const NFTNL_RULE_HANDLE: nftnl_rule_attr = 3; +pub const NFTNL_RULE_COMPAT_PROTO: nftnl_rule_attr = 4; +pub const NFTNL_RULE_COMPAT_FLAGS: nftnl_rule_attr = 5; +pub const NFTNL_RULE_POSITION: nftnl_rule_attr = 6; +pub const NFTNL_RULE_USERDATA: nftnl_rule_attr = 7; +pub const NFTNL_RULE_ID: nftnl_rule_attr = 8; +pub const NFTNL_RULE_POSITION_ID: nftnl_rule_attr = 9; +pub const __NFTNL_RULE_MAX: nftnl_rule_attr = 10; +pub type nftnl_rule_attr = c_uint; +extern "C" { + pub fn nftnl_rule_unset(r: *mut nftnl_rule, attr: u16); + + pub fn nftnl_rule_is_set(r: *const nftnl_rule, attr: u16) -> bool; + + pub fn nftnl_rule_set(r: *mut nftnl_rule, attr: u16, data: *const c_void) -> c_int; + + pub fn nftnl_rule_set_data( + r: *mut nftnl_rule, + attr: u16, + data: *const c_void, + data_len: u32, + ) -> c_int; + + pub fn nftnl_rule_set_u32(r: *mut nftnl_rule, attr: u16, val: u32); + + pub fn nftnl_rule_set_u64(r: *mut nftnl_rule, attr: u16, val: u64); + + pub fn nftnl_rule_set_str(r: *mut nftnl_rule, attr: u16, str_: *const c_char) -> c_int; + + pub fn nftnl_rule_get(r: *const nftnl_rule, attr: u16) -> *const c_void; + + pub fn nftnl_rule_get_data( + r: *const nftnl_rule, + attr: u16, + data_len: *mut u32, + ) -> *const c_void; + + pub fn nftnl_rule_get_str(r: *const nftnl_rule, attr: u16) -> *const c_char; + + pub fn nftnl_rule_get_u8(r: *const nftnl_rule, attr: u16) -> u8; + + pub fn nftnl_rule_get_u32(r: *const nftnl_rule, attr: u16) -> u32; + + pub fn nftnl_rule_get_u64(r: *const nftnl_rule, attr: u16) -> u64; + + pub fn nftnl_rule_add_expr(r: *mut nftnl_rule, expr: *mut nftnl_expr); + + pub fn nftnl_rule_nlmsg_build_payload(nlh: *mut nlmsghdr, t: *mut nftnl_rule); + + pub fn nftnl_rule_parse( + r: *mut nftnl_rule, + type_: nftnl_parse_type, + data: *const c_char, + err: *mut nftnl_parse_err, + ) -> c_int; + + pub fn nftnl_rule_parse_file( + r: *mut nftnl_rule, + type_: nftnl_parse_type, + fp: *mut FILE, + err: *mut nftnl_parse_err, + ) -> c_int; + + pub fn nftnl_rule_snprintf( + buf: *mut c_char, + size: usize, + t: *const nftnl_rule, + type_: u32, + flags: u32, + ) -> c_int; + + pub fn nftnl_rule_fprintf(fp: *mut FILE, r: *const nftnl_rule, type_: u32, flags: u32) + -> c_int; + + pub fn nftnl_rule_nlmsg_parse(nlh: *const nlmsghdr, t: *mut nftnl_rule) -> c_int; + + pub fn nftnl_expr_foreach( + r: *mut nftnl_rule, + cb: Option c_int>, + data: *mut c_void, + ) -> c_int; +} +#[repr(C)] +pub struct nftnl_expr_iter(c_void); + +extern "C" { + pub fn nftnl_expr_iter_create(r: *const nftnl_rule) -> *mut nftnl_expr_iter; + + pub fn nftnl_expr_iter_next(iter: *mut nftnl_expr_iter) -> *mut nftnl_expr; + + pub fn nftnl_expr_iter_destroy(iter: *mut nftnl_expr_iter); +} +#[repr(C)] +pub struct nftnl_rule_list(c_void); + +extern "C" { + pub fn nftnl_rule_list_alloc() -> *mut nftnl_rule_list; + + pub fn nftnl_rule_list_free(list: *mut nftnl_rule_list); + + pub fn nftnl_rule_list_is_empty(list: *const nftnl_rule_list) -> c_int; + + pub fn nftnl_rule_list_add(r: *mut nftnl_rule, list: *mut nftnl_rule_list); + + pub fn nftnl_rule_list_add_tail(r: *mut nftnl_rule, list: *mut nftnl_rule_list); + + pub fn nftnl_rule_list_insert_at(r: *mut nftnl_rule, pos: *mut nftnl_rule); + + pub fn nftnl_rule_list_del(r: *mut nftnl_rule); + + pub fn nftnl_rule_list_foreach( + rule_list: *mut nftnl_rule_list, + cb: Option c_int>, + data: *mut c_void, + ) -> c_int; +} +#[repr(C)] +pub struct nftnl_rule_list_iter(c_void); + +extern "C" { + pub fn nftnl_rule_list_iter_create(l: *const nftnl_rule_list) -> *mut nftnl_rule_list_iter; + + pub fn nftnl_rule_list_iter_cur(iter: *mut nftnl_rule_list_iter) -> *mut nftnl_rule; + + pub fn nftnl_rule_list_iter_next(iter: *mut nftnl_rule_list_iter) -> *mut nftnl_rule; + + pub fn nftnl_rule_list_iter_destroy(iter: *const nftnl_rule_list_iter); +} +#[repr(C)] +pub struct nftnl_ruleset(c_void); + +extern "C" { + pub fn nftnl_ruleset_alloc() -> *mut nftnl_ruleset; + + pub fn nftnl_ruleset_free(r: *const nftnl_ruleset); +} +pub const NFTNL_RULESET_TABLELIST: u32 = 0; +pub const NFTNL_RULESET_CHAINLIST: u32 = 1; +pub const NFTNL_RULESET_SETLIST: u32 = 2; +pub const NFTNL_RULESET_RULELIST: u32 = 3; + +pub const NFTNL_RULESET_UNSPEC: nftnl_ruleset_type = 0; +pub const NFTNL_RULESET_RULESET: nftnl_ruleset_type = 1; +pub const NFTNL_RULESET_TABLE: nftnl_ruleset_type = 2; +pub const NFTNL_RULESET_CHAIN: nftnl_ruleset_type = 3; +pub const NFTNL_RULESET_RULE: nftnl_ruleset_type = 4; +pub const NFTNL_RULESET_SET: nftnl_ruleset_type = 5; +pub const NFTNL_RULESET_SET_ELEMS: nftnl_ruleset_type = 6; +pub type nftnl_ruleset_type = c_uint; +extern "C" { + pub fn nftnl_ruleset_is_set(r: *const nftnl_ruleset, attr: u16) -> bool; + + pub fn nftnl_ruleset_unset(r: *mut nftnl_ruleset, attr: u16); + + pub fn nftnl_ruleset_set(r: *mut nftnl_ruleset, attr: u16, data: *mut c_void); + + pub fn nftnl_ruleset_get(r: *const nftnl_ruleset, attr: u16) -> *mut c_void; +} +pub const NFTNL_RULESET_CTX_CMD: u32 = 0; +pub const NFTNL_RULESET_CTX_TYPE: u32 = 1; +pub const NFTNL_RULESET_CTX_TABLE: u32 = 2; +pub const NFTNL_RULESET_CTX_CHAIN: u32 = 3; +pub const NFTNL_RULESET_CTX_RULE: u32 = 4; +pub const NFTNL_RULESET_CTX_SET: u32 = 5; +pub const NFTNL_RULESET_CTX_DATA: u32 = 6; + +#[repr(C)] +pub struct nftnl_parse_ctx(c_void); + +extern "C" { + pub fn nftnl_ruleset_ctx_free(ctx: *const nftnl_parse_ctx); + + pub fn nftnl_ruleset_ctx_is_set(ctx: *const nftnl_parse_ctx, attr: u16) -> bool; + + pub fn nftnl_ruleset_ctx_get(ctx: *const nftnl_parse_ctx, attr: u16) -> *mut c_void; + + pub fn nftnl_ruleset_ctx_get_u32(ctx: *const nftnl_parse_ctx, attr: u16) -> u32; + + pub fn nftnl_ruleset_parse_file_cb( + type_: nftnl_parse_type, + fp: *mut FILE, + err: *mut nftnl_parse_err, + data: *mut c_void, + cb: Option c_int>, + ) -> c_int; + + pub fn nftnl_ruleset_parse_buffer_cb( + type_: nftnl_parse_type, + buffer: *const c_char, + err: *mut nftnl_parse_err, + data: *mut c_void, + cb: Option c_int>, + ) -> c_int; + + pub fn nftnl_ruleset_parse( + rs: *mut nftnl_ruleset, + type_: nftnl_parse_type, + data: *const c_char, + err: *mut nftnl_parse_err, + ) -> c_int; + + pub fn nftnl_ruleset_parse_file( + rs: *mut nftnl_ruleset, + type_: nftnl_parse_type, + fp: *mut FILE, + err: *mut nftnl_parse_err, + ) -> c_int; + + pub fn nftnl_ruleset_snprintf( + buf: *mut c_char, + size: usize, + rs: *const nftnl_ruleset, + type_: u32, + flags: u32, + ) -> c_int; + + pub fn nftnl_ruleset_fprintf( + fp: *mut FILE, + rs: *const nftnl_ruleset, + type_: u32, + flags: u32, + ) -> c_int; +} +pub const NFTNL_SET_TABLE: nftnl_set_attr = 0; +pub const NFTNL_SET_NAME: nftnl_set_attr = 1; +pub const NFTNL_SET_FLAGS: nftnl_set_attr = 2; +pub const NFTNL_SET_KEY_TYPE: nftnl_set_attr = 3; +pub const NFTNL_SET_KEY_LEN: nftnl_set_attr = 4; +pub const NFTNL_SET_DATA_TYPE: nftnl_set_attr = 5; +pub const NFTNL_SET_DATA_LEN: nftnl_set_attr = 6; +pub const NFTNL_SET_FAMILY: nftnl_set_attr = 7; +pub const NFTNL_SET_ID: nftnl_set_attr = 8; +pub const NFTNL_SET_POLICY: nftnl_set_attr = 9; +pub const NFTNL_SET_DESC_SIZE: nftnl_set_attr = 10; +pub const NFTNL_SET_TIMEOUT: nftnl_set_attr = 11; +pub const NFTNL_SET_GC_INTERVAL: nftnl_set_attr = 12; +pub const NFTNL_SET_USERDATA: nftnl_set_attr = 13; +pub const NFTNL_SET_OBJ_TYPE: nftnl_set_attr = 14; +pub const NFTNL_SET_HANDLE: nftnl_set_attr = 15; +pub const NFTNL_SET_DESC_CONCAT: nftnl_set_attr = 16; +pub const NFTNL_SET_EXPR: nftnl_set_attr = 17; +pub const __NFTNL_SET_MAX: nftnl_set_attr = 18; +pub type nftnl_set_attr = c_uint; +#[repr(C)] +pub struct nftnl_set(c_void); + +extern "C" { + pub fn nftnl_set_alloc() -> *mut nftnl_set; + + pub fn nftnl_set_free(s: *const nftnl_set); + + pub fn nftnl_set_clone(set: *const nftnl_set) -> *mut nftnl_set; + + pub fn nftnl_set_is_set(s: *const nftnl_set, attr: u16) -> bool; + + pub fn nftnl_set_unset(s: *mut nftnl_set, attr: u16); + + pub fn nftnl_set_set(s: *mut nftnl_set, attr: u16, data: *const c_void) -> c_int; + + pub fn nftnl_set_set_data( + s: *mut nftnl_set, + attr: u16, + data: *const c_void, + data_len: u32, + ) -> c_int; + + pub fn nftnl_set_set_u32(s: *mut nftnl_set, attr: u16, val: u32); + + pub fn nftnl_set_set_u64(s: *mut nftnl_set, attr: u16, val: u64); + + pub fn nftnl_set_set_str(s: *mut nftnl_set, attr: u16, str_: *const c_char) -> c_int; + + pub fn nftnl_set_get(s: *const nftnl_set, attr: u16) -> *const c_void; + + pub fn nftnl_set_get_data(s: *const nftnl_set, attr: u16, data_len: *mut u32) -> *const c_void; + + pub fn nftnl_set_get_str(s: *const nftnl_set, attr: u16) -> *const c_char; + + pub fn nftnl_set_get_u32(s: *const nftnl_set, attr: u16) -> u32; + + pub fn nftnl_set_get_u64(s: *const nftnl_set, attr: u16) -> u64; + + pub fn nftnl_set_nlmsg_build_payload(nlh: *mut nlmsghdr, s: *mut nftnl_set); + + pub fn nftnl_set_nlmsg_parse(nlh: *const nlmsghdr, s: *mut nftnl_set) -> c_int; + + pub fn nftnl_set_elems_nlmsg_parse(nlh: *const nlmsghdr, s: *mut nftnl_set) -> c_int; + + pub fn nftnl_set_snprintf( + buf: *mut c_char, + size: usize, + s: *const nftnl_set, + type_: u32, + flags: u32, + ) -> c_int; + + pub fn nftnl_set_fprintf(fp: *mut FILE, s: *const nftnl_set, type_: u32, flags: u32) -> c_int; +} +#[repr(C)] +pub struct nftnl_set_list(c_void); + +extern "C" { + pub fn nftnl_set_list_alloc() -> *mut nftnl_set_list; + + pub fn nftnl_set_list_free(list: *mut nftnl_set_list); + + pub fn nftnl_set_list_is_empty(list: *const nftnl_set_list) -> c_int; + + pub fn nftnl_set_list_add(s: *mut nftnl_set, list: *mut nftnl_set_list); + + pub fn nftnl_set_list_add_tail(s: *mut nftnl_set, list: *mut nftnl_set_list); + + pub fn nftnl_set_list_del(s: *mut nftnl_set); + + pub fn nftnl_set_list_foreach( + set_list: *mut nftnl_set_list, + cb: Option c_int>, + data: *mut c_void, + ) -> c_int; + + pub fn nftnl_set_list_lookup_byname( + set_list: *mut nftnl_set_list, + set: *const c_char, + ) -> *mut nftnl_set; +} +#[repr(C)] +pub struct nftnl_set_list_iter(c_void); + +extern "C" { + pub fn nftnl_set_list_iter_create(l: *const nftnl_set_list) -> *mut nftnl_set_list_iter; + + pub fn nftnl_set_list_iter_cur(iter: *const nftnl_set_list_iter) -> *mut nftnl_set; + + pub fn nftnl_set_list_iter_next(iter: *mut nftnl_set_list_iter) -> *mut nftnl_set; + + pub fn nftnl_set_list_iter_destroy(iter: *const nftnl_set_list_iter); + + pub fn nftnl_set_parse( + s: *mut nftnl_set, + type_: nftnl_parse_type, + data: *const c_char, + err: *mut nftnl_parse_err, + ) -> c_int; + + pub fn nftnl_set_parse_file( + s: *mut nftnl_set, + type_: nftnl_parse_type, + fp: *mut FILE, + err: *mut nftnl_parse_err, + ) -> c_int; +} +pub const NFTNL_SET_ELEM_FLAGS: u32 = 0; +pub const NFTNL_SET_ELEM_KEY: u32 = 1; +pub const NFTNL_SET_ELEM_VERDICT: u32 = 2; +pub const NFTNL_SET_ELEM_CHAIN: u32 = 3; +pub const NFTNL_SET_ELEM_DATA: u32 = 4; +pub const NFTNL_SET_ELEM_TIMEOUT: u32 = 5; +pub const NFTNL_SET_ELEM_EXPIRATION: u32 = 6; +pub const NFTNL_SET_ELEM_USERDATA: u32 = 7; +pub const NFTNL_SET_ELEM_EXPR: u32 = 8; +pub const NFTNL_SET_ELEM_OBJREF: u32 = 9; +pub const NFTNL_SET_ELEM_KEY_END: u32 = 10; +pub const __NFTNL_SET_ELEM_MAX: u32 = 11; + +#[repr(C)] +pub struct nftnl_set_elem(c_void); + +extern "C" { + pub fn nftnl_set_elem_alloc() -> *mut nftnl_set_elem; + + pub fn nftnl_set_elem_free(s: *mut nftnl_set_elem); + + pub fn nftnl_set_elem_clone(elem: *mut nftnl_set_elem) -> *mut nftnl_set_elem; + + pub fn nftnl_set_elem_add(s: *mut nftnl_set, elem: *mut nftnl_set_elem); + + pub fn nftnl_set_elem_unset(s: *mut nftnl_set_elem, attr: u16); + + pub fn nftnl_set_elem_set( + s: *mut nftnl_set_elem, + attr: u16, + data: *const c_void, + data_len: u32, + ) -> c_int; + + pub fn nftnl_set_elem_set_u32(s: *mut nftnl_set_elem, attr: u16, val: u32); + + pub fn nftnl_set_elem_set_u64(s: *mut nftnl_set_elem, attr: u16, val: u64); + + pub fn nftnl_set_elem_set_str(s: *mut nftnl_set_elem, attr: u16, str_: *const c_char) -> c_int; + + pub fn nftnl_set_elem_get( + s: *mut nftnl_set_elem, + attr: u16, + data_len: *mut u32, + ) -> *const c_void; + + pub fn nftnl_set_elem_get_str(s: *mut nftnl_set_elem, attr: u16) -> *const c_char; + + pub fn nftnl_set_elem_get_u32(s: *mut nftnl_set_elem, attr: u16) -> u32; + + pub fn nftnl_set_elem_get_u64(s: *mut nftnl_set_elem, attr: u16) -> u64; + + pub fn nftnl_set_elem_is_set(s: *const nftnl_set_elem, attr: u16) -> bool; + + pub fn nftnl_set_elems_nlmsg_build_payload(nlh: *mut nlmsghdr, s: *mut nftnl_set); + + pub fn nftnl_set_elem_nlmsg_build_payload(nlh: *mut nlmsghdr, e: *mut nftnl_set_elem); + + pub fn nftnl_set_elem_parse( + e: *mut nftnl_set_elem, + type_: nftnl_parse_type, + data: *const c_char, + err: *mut nftnl_parse_err, + ) -> c_int; + + pub fn nftnl_set_elem_parse_file( + e: *mut nftnl_set_elem, + type_: nftnl_parse_type, + fp: *mut FILE, + err: *mut nftnl_parse_err, + ) -> c_int; + + pub fn nftnl_set_elem_snprintf( + buf: *mut c_char, + size: usize, + s: *const nftnl_set_elem, + type_: u32, + flags: u32, + ) -> c_int; + + pub fn nftnl_set_elem_fprintf( + fp: *mut FILE, + se: *mut nftnl_set_elem, + type_: u32, + flags: u32, + ) -> c_int; + + pub fn nftnl_set_elem_foreach( + s: *mut nftnl_set, + cb: Option c_int>, + data: *mut c_void, + ) -> c_int; +} +#[repr(C)] +pub struct nftnl_set_elems_iter(c_void); + +extern "C" { + pub fn nftnl_set_elems_iter_create(s: *const nftnl_set) -> *mut nftnl_set_elems_iter; + + pub fn nftnl_set_elems_iter_cur(iter: *const nftnl_set_elems_iter) -> *mut nftnl_set_elem; + + pub fn nftnl_set_elems_iter_next(iter: *mut nftnl_set_elems_iter) -> *mut nftnl_set_elem; + + pub fn nftnl_set_elems_iter_destroy(iter: *mut nftnl_set_elems_iter); + + pub fn nftnl_set_elems_nlmsg_build_payload_iter( + nlh: *mut nlmsghdr, + iter: *mut nftnl_set_elems_iter, + ) -> c_int; +} +#[repr(C)] +pub struct nftnl_table(c_void); + +extern "C" { + pub fn nftnl_table_alloc() -> *mut nftnl_table; + + pub fn nftnl_table_free(arg1: *const nftnl_table); +} +pub const NFTNL_TABLE_NAME: nftnl_table_attr = 0; +pub const NFTNL_TABLE_FAMILY: nftnl_table_attr = 1; +pub const NFTNL_TABLE_FLAGS: nftnl_table_attr = 2; +pub const NFTNL_TABLE_USE: nftnl_table_attr = 3; +pub const NFTNL_TABLE_HANDLE: nftnl_table_attr = 4; +pub const __NFTNL_TABLE_MAX: nftnl_table_attr = 5; +pub type nftnl_table_attr = c_uint; +extern "C" { + pub fn nftnl_table_is_set(t: *const nftnl_table, attr: u16) -> bool; + + pub fn nftnl_table_unset(t: *mut nftnl_table, attr: u16); + + pub fn nftnl_table_set(t: *mut nftnl_table, attr: u16, data: *const c_void); + + pub fn nftnl_table_set_data( + t: *mut nftnl_table, + attr: u16, + data: *const c_void, + data_len: u32, + ) -> c_int; + + pub fn nftnl_table_get(t: *const nftnl_table, attr: u16) -> *const c_void; + + pub fn nftnl_table_get_data( + t: *const nftnl_table, + attr: u16, + data_len: *mut u32, + ) -> *const c_void; + + pub fn nftnl_table_set_u8(t: *mut nftnl_table, attr: u16, data: u8); + + pub fn nftnl_table_set_u32(t: *mut nftnl_table, attr: u16, data: u32); + + pub fn nftnl_table_set_u64(t: *mut nftnl_table, attr: u16, data: u64); + + pub fn nftnl_table_set_str(t: *mut nftnl_table, attr: u16, str_: *const c_char) -> c_int; + + pub fn nftnl_table_get_u8(t: *const nftnl_table, attr: u16) -> u8; + + pub fn nftnl_table_get_u32(t: *const nftnl_table, attr: u16) -> u32; + + pub fn nftnl_table_get_u64(t: *const nftnl_table, attr: u16) -> u64; + + pub fn nftnl_table_get_str(t: *const nftnl_table, attr: u16) -> *const c_char; + + pub fn nftnl_table_nlmsg_build_payload(nlh: *mut nlmsghdr, t: *const nftnl_table); + + pub fn nftnl_table_parse( + t: *mut nftnl_table, + type_: nftnl_parse_type, + data: *const c_char, + err: *mut nftnl_parse_err, + ) -> c_int; + + pub fn nftnl_table_parse_file( + t: *mut nftnl_table, + type_: nftnl_parse_type, + fp: *mut FILE, + err: *mut nftnl_parse_err, + ) -> c_int; + + pub fn nftnl_table_snprintf( + buf: *mut c_char, + size: usize, + t: *const nftnl_table, + type_: u32, + flags: u32, + ) -> c_int; + + pub fn nftnl_table_fprintf( + fp: *mut FILE, + t: *const nftnl_table, + type_: u32, + flags: u32, + ) -> c_int; + + pub fn nftnl_table_nlmsg_parse(nlh: *const nlmsghdr, t: *mut nftnl_table) -> c_int; +} +#[repr(C)] +pub struct nftnl_table_list(c_void); + +extern "C" { + pub fn nftnl_table_list_alloc() -> *mut nftnl_table_list; + + pub fn nftnl_table_list_free(list: *mut nftnl_table_list); + + pub fn nftnl_table_list_is_empty(list: *const nftnl_table_list) -> c_int; + + pub fn nftnl_table_list_foreach( + table_list: *mut nftnl_table_list, + cb: Option c_int>, + data: *mut c_void, + ) -> c_int; + + pub fn nftnl_table_list_add(r: *mut nftnl_table, list: *mut nftnl_table_list); + + pub fn nftnl_table_list_add_tail(r: *mut nftnl_table, list: *mut nftnl_table_list); + + pub fn nftnl_table_list_del(r: *mut nftnl_table); +} +#[repr(C)] +pub struct nftnl_table_list_iter(c_void); + +extern "C" { + pub fn nftnl_table_list_iter_create(l: *const nftnl_table_list) -> *mut nftnl_table_list_iter; + + pub fn nftnl_table_list_iter_next(iter: *mut nftnl_table_list_iter) -> *mut nftnl_table; + + pub fn nftnl_table_list_iter_destroy(iter: *const nftnl_table_list_iter); +} +pub const NFTNL_TRACE_CHAIN: nftnl_trace_attr = 0; +pub const NFTNL_TRACE_FAMILY: nftnl_trace_attr = 1; +pub const NFTNL_TRACE_ID: nftnl_trace_attr = 2; +pub const NFTNL_TRACE_IIF: nftnl_trace_attr = 3; +pub const NFTNL_TRACE_IIFTYPE: nftnl_trace_attr = 4; +pub const NFTNL_TRACE_JUMP_TARGET: nftnl_trace_attr = 5; +pub const NFTNL_TRACE_OIF: nftnl_trace_attr = 6; +pub const NFTNL_TRACE_OIFTYPE: nftnl_trace_attr = 7; +pub const NFTNL_TRACE_MARK: nftnl_trace_attr = 8; +pub const NFTNL_TRACE_LL_HEADER: nftnl_trace_attr = 9; +pub const NFTNL_TRACE_NETWORK_HEADER: nftnl_trace_attr = 10; +pub const NFTNL_TRACE_TRANSPORT_HEADER: nftnl_trace_attr = 11; +pub const NFTNL_TRACE_TABLE: nftnl_trace_attr = 12; +pub const NFTNL_TRACE_TYPE: nftnl_trace_attr = 13; +pub const NFTNL_TRACE_RULE_HANDLE: nftnl_trace_attr = 14; +pub const NFTNL_TRACE_VERDICT: nftnl_trace_attr = 15; +pub const NFTNL_TRACE_NFPROTO: nftnl_trace_attr = 16; +pub const NFTNL_TRACE_POLICY: nftnl_trace_attr = 17; +pub const __NFTNL_TRACE_MAX: nftnl_trace_attr = 18; +pub type nftnl_trace_attr = c_uint; +#[repr(C)] +pub struct nftnl_trace(c_void); + +extern "C" { + pub fn nftnl_trace_alloc() -> *mut nftnl_trace; + + pub fn nftnl_trace_free(trace: *const nftnl_trace); + + pub fn nftnl_trace_is_set(trace: *const nftnl_trace, type_: u16) -> bool; + + pub fn nftnl_trace_get_data( + trace: *const nftnl_trace, + type_: u16, + data_len: *mut u32, + ) -> *const c_void; + + pub fn nftnl_trace_get_u16(trace: *const nftnl_trace, type_: u16) -> u16; + + pub fn nftnl_trace_get_u32(trace: *const nftnl_trace, type_: u16) -> u32; + + pub fn nftnl_trace_get_u64(trace: *const nftnl_trace, type_: u16) -> u64; + + pub fn nftnl_trace_get_str(trace: *const nftnl_trace, type_: u16) -> *const c_char; + + pub fn nftnl_trace_nlmsg_parse(nlh: *const nlmsghdr, t: *mut nftnl_trace) -> c_int; +} +pub const NFTNL_UDATA_RULE_COMMENT: nftnl_udata_rule_types = 0; +pub const NFTNL_UDATA_RULE_EBTABLES_POLICY: nftnl_udata_rule_types = 1; +pub const __NFTNL_UDATA_RULE_MAX: nftnl_udata_rule_types = 2; +pub type nftnl_udata_rule_types = c_uint; +pub const NFTNL_UDATA_SET_KEYBYTEORDER: nftnl_udata_set_types = 0; +pub const NFTNL_UDATA_SET_DATABYTEORDER: nftnl_udata_set_types = 1; +pub const NFTNL_UDATA_SET_MERGE_ELEMENTS: nftnl_udata_set_types = 2; +pub const NFTNL_UDATA_SET_KEY_TYPEOF: nftnl_udata_set_types = 3; +pub const NFTNL_UDATA_SET_DATA_TYPEOF: nftnl_udata_set_types = 4; +pub const NFTNL_UDATA_SET_EXPR: nftnl_udata_set_types = 5; +pub const __NFTNL_UDATA_SET_MAX: nftnl_udata_set_types = 6; +pub type nftnl_udata_set_types = c_uint; +pub const NFTNL_UDATA_SET_TYPEOF_EXPR: u32 = 0; +pub const NFTNL_UDATA_SET_TYPEOF_DATA: u32 = 1; +pub const __NFTNL_UDATA_SET_TYPEOF_MAX: u32 = 2; + +pub const NFTNL_UDATA_SET_ELEM_COMMENT: nftnl_udata_set_elem_types = 0; +pub const NFTNL_UDATA_SET_ELEM_FLAGS: nftnl_udata_set_elem_types = 1; +pub const __NFTNL_UDATA_SET_ELEM_MAX: nftnl_udata_set_elem_types = 2; +pub type nftnl_udata_set_elem_types = c_uint; +pub const NFTNL_SET_ELEM_F_INTERVAL_OPEN: nftnl_udata_set_elem_flags = 1; +pub type nftnl_udata_set_elem_flags = c_uint; +#[repr(C)] +pub struct nftnl_udata(c_void); + +#[repr(C)] +pub struct nftnl_udata_buf(c_void); + +extern "C" { + pub fn nftnl_udata_buf_alloc(data_size: u32) -> *mut nftnl_udata_buf; + + pub fn nftnl_udata_buf_free(buf: *const nftnl_udata_buf); + + pub fn nftnl_udata_buf_len(buf: *const nftnl_udata_buf) -> u32; + + pub fn nftnl_udata_buf_data(buf: *const nftnl_udata_buf) -> *mut c_void; + + pub fn nftnl_udata_buf_put(buf: *mut nftnl_udata_buf, data: *const c_void, len: u32); + + pub fn nftnl_udata_start(buf: *const nftnl_udata_buf) -> *mut nftnl_udata; + + pub fn nftnl_udata_end(buf: *const nftnl_udata_buf) -> *mut nftnl_udata; + + pub fn nftnl_udata_put( + buf: *mut nftnl_udata_buf, + type_: u8, + len: u32, + value: *const c_void, + ) -> bool; + + pub fn nftnl_udata_put_u32(buf: *mut nftnl_udata_buf, type_: u8, data: u32) -> bool; + + pub fn nftnl_udata_put_strz(buf: *mut nftnl_udata_buf, type_: u8, strz: *const c_char) -> bool; + + pub fn nftnl_udata_nest_start(buf: *mut nftnl_udata_buf, type_: u8) -> *mut nftnl_udata; + + pub fn nftnl_udata_nest_end(buf: *mut nftnl_udata_buf, ud: *mut nftnl_udata); + + pub fn nftnl_udata_type(attr: *const nftnl_udata) -> u8; + + pub fn nftnl_udata_len(attr: *const nftnl_udata) -> u8; + + pub fn nftnl_udata_get(attr: *const nftnl_udata) -> *mut c_void; + + pub fn nftnl_udata_get_u32(attr: *const nftnl_udata) -> u32; + + pub fn nftnl_udata_next(attr: *const nftnl_udata) -> *mut nftnl_udata; +} +pub type nftnl_udata_cb_t = + Option c_int>; +extern "C" { + pub fn nftnl_udata_parse( + data: *const c_void, + data_len: u32, + cb: nftnl_udata_cb_t, + cb_data: *mut c_void, + ) -> c_int; +} diff --git a/nftnl-sys/src/nftnl_1_1_7.rs b/nftnl-sys/src/nftnl_1_1_7.rs new file mode 100644 index 0000000..e04c3d6 --- /dev/null +++ b/nftnl-sys/src/nftnl_1_1_7.rs @@ -0,0 +1,1427 @@ +/* automatically generated by rust-bindgen 0.69.4 */ + +use core::option::Option; +use libc::{c_char, c_int, c_uint, c_void, iovec, nlmsghdr, FILE}; + +pub const NFTNL_UDATA_COMMENT_MAXLEN: u32 = 128; +#[repr(C)] +pub struct nftnl_batch(c_void); + +extern "C" { + pub fn nftnl_batch_alloc(pg_size: u32, pg_overrun_size: u32) -> *mut nftnl_batch; + + pub fn nftnl_batch_update(batch: *mut nftnl_batch) -> c_int; + + pub fn nftnl_batch_free(batch: *mut nftnl_batch); + + pub fn nftnl_batch_buffer(batch: *mut nftnl_batch) -> *mut c_void; + + pub fn nftnl_batch_buffer_len(batch: *mut nftnl_batch) -> u32; + + pub fn nftnl_batch_iovec_len(batch: *mut nftnl_batch) -> c_int; + + pub fn nftnl_batch_iovec(batch: *mut nftnl_batch, iov: *mut iovec, iovlen: u32); +} +pub const NFTNL_PARSE_EBADINPUT: u32 = 0; +pub const NFTNL_PARSE_EMISSINGNODE: u32 = 1; +pub const NFTNL_PARSE_EBADTYPE: u32 = 2; +pub const NFTNL_PARSE_EOPNOTSUPP: u32 = 3; + +pub const NFTNL_OUTPUT_DEFAULT: nftnl_output_type = 0; +pub const NFTNL_OUTPUT_XML: nftnl_output_type = 1; +pub const NFTNL_OUTPUT_JSON: nftnl_output_type = 2; +pub type nftnl_output_type = c_uint; +pub const NFTNL_OF_EVENT_NEW: nftnl_output_flags = 1; +pub const NFTNL_OF_EVENT_DEL: nftnl_output_flags = 2; +pub const NFTNL_OF_EVENT_ANY: nftnl_output_flags = 3; +pub type nftnl_output_flags = c_uint; +pub const NFTNL_CMD_UNSPEC: nftnl_cmd_type = 0; +pub const NFTNL_CMD_ADD: nftnl_cmd_type = 1; +pub const NFTNL_CMD_INSERT: nftnl_cmd_type = 2; +pub const NFTNL_CMD_DELETE: nftnl_cmd_type = 3; +pub const NFTNL_CMD_REPLACE: nftnl_cmd_type = 4; +pub const NFTNL_CMD_FLUSH: nftnl_cmd_type = 5; +pub const NFTNL_CMD_MAX: nftnl_cmd_type = 6; +pub type nftnl_cmd_type = c_uint; +pub const NFTNL_PARSE_NONE: nftnl_parse_type = 0; +pub const NFTNL_PARSE_XML: nftnl_parse_type = 1; +pub const NFTNL_PARSE_JSON: nftnl_parse_type = 2; +pub const NFTNL_PARSE_MAX: nftnl_parse_type = 3; +pub type nftnl_parse_type = c_uint; +#[repr(C)] +pub struct nftnl_parse_err(c_void); + +extern "C" { + pub fn nftnl_nlmsg_build_hdr( + buf: *mut c_char, + type_: u16, + family: u16, + flags: u16, + seq: u32, + ) -> *mut nlmsghdr; + + pub fn nftnl_parse_err_alloc() -> *mut nftnl_parse_err; + + pub fn nftnl_parse_err_free(arg1: *mut nftnl_parse_err); + + pub fn nftnl_parse_perror(str_: *const c_char, err: *mut nftnl_parse_err) -> c_int; + + pub fn nftnl_batch_is_supported() -> c_int; + + pub fn nftnl_batch_begin(buf: *mut c_char, seq: u32) -> *mut nlmsghdr; + + pub fn nftnl_batch_end(buf: *mut c_char, seq: u32) -> *mut nlmsghdr; +} +#[repr(C)] +pub struct nftnl_chain(c_void); + +#[repr(C)] +pub struct nftnl_rule(c_void); + +extern "C" { + pub fn nftnl_chain_alloc() -> *mut nftnl_chain; + + pub fn nftnl_chain_free(arg1: *const nftnl_chain); +} +pub const NFTNL_CHAIN_NAME: nftnl_chain_attr = 0; +pub const NFTNL_CHAIN_FAMILY: nftnl_chain_attr = 1; +pub const NFTNL_CHAIN_TABLE: nftnl_chain_attr = 2; +pub const NFTNL_CHAIN_HOOKNUM: nftnl_chain_attr = 3; +pub const NFTNL_CHAIN_PRIO: nftnl_chain_attr = 4; +pub const NFTNL_CHAIN_POLICY: nftnl_chain_attr = 5; +pub const NFTNL_CHAIN_USE: nftnl_chain_attr = 6; +pub const NFTNL_CHAIN_BYTES: nftnl_chain_attr = 7; +pub const NFTNL_CHAIN_PACKETS: nftnl_chain_attr = 8; +pub const NFTNL_CHAIN_HANDLE: nftnl_chain_attr = 9; +pub const NFTNL_CHAIN_TYPE: nftnl_chain_attr = 10; +pub const NFTNL_CHAIN_DEV: nftnl_chain_attr = 11; +pub const NFTNL_CHAIN_DEVICES: nftnl_chain_attr = 12; +pub const NFTNL_CHAIN_FLAGS: nftnl_chain_attr = 13; +pub const __NFTNL_CHAIN_MAX: nftnl_chain_attr = 14; +pub type nftnl_chain_attr = c_uint; +extern "C" { + pub fn nftnl_chain_is_set(c: *const nftnl_chain, attr: u16) -> bool; + + pub fn nftnl_chain_unset(c: *mut nftnl_chain, attr: u16); + + pub fn nftnl_chain_set(t: *mut nftnl_chain, attr: u16, data: *const c_void); + + pub fn nftnl_chain_set_data( + t: *mut nftnl_chain, + attr: u16, + data: *const c_void, + data_len: u32, + ) -> c_int; + + pub fn nftnl_chain_set_u8(t: *mut nftnl_chain, attr: u16, data: u8); + + pub fn nftnl_chain_set_u32(t: *mut nftnl_chain, attr: u16, data: u32); + + pub fn nftnl_chain_set_s32(t: *mut nftnl_chain, attr: u16, data: i32); + + pub fn nftnl_chain_set_u64(t: *mut nftnl_chain, attr: u16, data: u64); + + pub fn nftnl_chain_set_str(t: *mut nftnl_chain, attr: u16, str_: *const c_char) -> c_int; + + pub fn nftnl_chain_set_array(t: *mut nftnl_chain, attr: u16, data: *mut *const c_char) + -> c_int; + + pub fn nftnl_chain_get(c: *const nftnl_chain, attr: u16) -> *const c_void; + + pub fn nftnl_chain_get_data( + c: *const nftnl_chain, + attr: u16, + data_len: *mut u32, + ) -> *const c_void; + + pub fn nftnl_chain_get_str(c: *const nftnl_chain, attr: u16) -> *const c_char; + + pub fn nftnl_chain_get_u8(c: *const nftnl_chain, attr: u16) -> u8; + + pub fn nftnl_chain_get_u32(c: *const nftnl_chain, attr: u16) -> u32; + + pub fn nftnl_chain_get_s32(c: *const nftnl_chain, attr: u16) -> i32; + + pub fn nftnl_chain_get_u64(c: *const nftnl_chain, attr: u16) -> u64; + + pub fn nftnl_chain_get_array(c: *const nftnl_chain, attr: u16) -> *const *const c_char; + + pub fn nftnl_chain_rule_add(rule: *mut nftnl_rule, c: *mut nftnl_chain); + + pub fn nftnl_chain_rule_del(rule: *mut nftnl_rule); + + pub fn nftnl_chain_rule_add_tail(rule: *mut nftnl_rule, c: *mut nftnl_chain); + + pub fn nftnl_chain_rule_insert_at(rule: *mut nftnl_rule, pos: *mut nftnl_rule); + + pub fn nftnl_chain_rule_append_at(rule: *mut nftnl_rule, pos: *mut nftnl_rule); + + pub fn nftnl_chain_nlmsg_build_payload(nlh: *mut nlmsghdr, t: *const nftnl_chain); + + pub fn nftnl_chain_parse( + c: *mut nftnl_chain, + type_: nftnl_parse_type, + data: *const c_char, + err: *mut nftnl_parse_err, + ) -> c_int; + + pub fn nftnl_chain_parse_file( + c: *mut nftnl_chain, + type_: nftnl_parse_type, + fp: *mut FILE, + err: *mut nftnl_parse_err, + ) -> c_int; + + pub fn nftnl_chain_snprintf( + buf: *mut c_char, + size: usize, + t: *const nftnl_chain, + type_: u32, + flags: u32, + ) -> c_int; + + pub fn nftnl_chain_fprintf( + fp: *mut FILE, + c: *const nftnl_chain, + type_: u32, + flags: u32, + ) -> c_int; + + pub fn nftnl_chain_nlmsg_parse(nlh: *const nlmsghdr, t: *mut nftnl_chain) -> c_int; + + pub fn nftnl_rule_foreach( + c: *mut nftnl_chain, + cb: Option c_int>, + data: *mut c_void, + ) -> c_int; + + pub fn nftnl_rule_lookup_byindex(c: *mut nftnl_chain, index: u32) -> *mut nftnl_rule; +} +#[repr(C)] +pub struct nftnl_rule_iter(c_void); + +extern "C" { + pub fn nftnl_rule_iter_create(c: *const nftnl_chain) -> *mut nftnl_rule_iter; + + pub fn nftnl_rule_iter_next(iter: *mut nftnl_rule_iter) -> *mut nftnl_rule; + + pub fn nftnl_rule_iter_destroy(iter: *mut nftnl_rule_iter); +} +#[repr(C)] +pub struct nftnl_chain_list(c_void); + +extern "C" { + pub fn nftnl_chain_list_alloc() -> *mut nftnl_chain_list; + + pub fn nftnl_chain_list_free(list: *mut nftnl_chain_list); + + pub fn nftnl_chain_list_is_empty(list: *const nftnl_chain_list) -> c_int; + + pub fn nftnl_chain_list_foreach( + chain_list: *mut nftnl_chain_list, + cb: Option c_int>, + data: *mut c_void, + ) -> c_int; + + pub fn nftnl_chain_list_lookup_byname( + chain_list: *mut nftnl_chain_list, + chain: *const c_char, + ) -> *mut nftnl_chain; + + pub fn nftnl_chain_list_add(r: *mut nftnl_chain, list: *mut nftnl_chain_list); + + pub fn nftnl_chain_list_add_tail(r: *mut nftnl_chain, list: *mut nftnl_chain_list); + + pub fn nftnl_chain_list_del(c: *mut nftnl_chain); +} +#[repr(C)] +pub struct nftnl_chain_list_iter(c_void); + +extern "C" { + pub fn nftnl_chain_list_iter_create(l: *const nftnl_chain_list) -> *mut nftnl_chain_list_iter; + + pub fn nftnl_chain_list_iter_next(iter: *mut nftnl_chain_list_iter) -> *mut nftnl_chain; + + pub fn nftnl_chain_list_iter_destroy(iter: *mut nftnl_chain_list_iter); +} +#[repr(C)] +pub struct nftnl_expr(c_void); + +pub const NFTNL_EXPR_NAME: u32 = 0; +pub const NFTNL_EXPR_BASE: u32 = 1; + +extern "C" { + pub fn nftnl_expr_alloc(name: *const c_char) -> *mut nftnl_expr; + + pub fn nftnl_expr_free(expr: *const nftnl_expr); + + pub fn nftnl_expr_is_set(expr: *const nftnl_expr, type_: u16) -> bool; + + pub fn nftnl_expr_set( + expr: *mut nftnl_expr, + type_: u16, + data: *const c_void, + data_len: u32, + ) -> c_int; + + pub fn nftnl_expr_set_u8(expr: *mut nftnl_expr, type_: u16, data: u8); + + pub fn nftnl_expr_set_u16(expr: *mut nftnl_expr, type_: u16, data: u16); + + pub fn nftnl_expr_set_u32(expr: *mut nftnl_expr, type_: u16, data: u32); + + pub fn nftnl_expr_set_u64(expr: *mut nftnl_expr, type_: u16, data: u64); + + pub fn nftnl_expr_set_str(expr: *mut nftnl_expr, type_: u16, str_: *const c_char) -> c_int; + + pub fn nftnl_expr_get(expr: *const nftnl_expr, type_: u16, data_len: *mut u32) + -> *const c_void; + + pub fn nftnl_expr_get_u8(expr: *const nftnl_expr, type_: u16) -> u8; + + pub fn nftnl_expr_get_u16(expr: *const nftnl_expr, type_: u16) -> u16; + + pub fn nftnl_expr_get_u32(expr: *const nftnl_expr, type_: u16) -> u32; + + pub fn nftnl_expr_get_u64(expr: *const nftnl_expr, type_: u16) -> u64; + + pub fn nftnl_expr_get_str(expr: *const nftnl_expr, type_: u16) -> *const c_char; + + pub fn nftnl_expr_snprintf( + buf: *mut c_char, + buflen: usize, + expr: *const nftnl_expr, + type_: u32, + flags: u32, + ) -> c_int; + + pub fn nftnl_expr_fprintf( + fp: *mut FILE, + expr: *const nftnl_expr, + type_: u32, + flags: u32, + ) -> c_int; +} +pub const NFTNL_EXPR_PAYLOAD_DREG: u32 = 1; +pub const NFTNL_EXPR_PAYLOAD_BASE: u32 = 2; +pub const NFTNL_EXPR_PAYLOAD_OFFSET: u32 = 3; +pub const NFTNL_EXPR_PAYLOAD_LEN: u32 = 4; +pub const NFTNL_EXPR_PAYLOAD_SREG: u32 = 5; +pub const NFTNL_EXPR_PAYLOAD_CSUM_TYPE: u32 = 6; +pub const NFTNL_EXPR_PAYLOAD_CSUM_OFFSET: u32 = 7; +pub const NFTNL_EXPR_PAYLOAD_FLAGS: u32 = 8; + +pub const NFTNL_EXPR_NG_DREG: u32 = 1; +pub const NFTNL_EXPR_NG_MODULUS: u32 = 2; +pub const NFTNL_EXPR_NG_TYPE: u32 = 3; +pub const NFTNL_EXPR_NG_OFFSET: u32 = 4; +pub const NFTNL_EXPR_NG_SET_NAME: u32 = 5; +pub const NFTNL_EXPR_NG_SET_ID: u32 = 6; + +pub const NFTNL_EXPR_META_KEY: u32 = 1; +pub const NFTNL_EXPR_META_DREG: u32 = 2; +pub const NFTNL_EXPR_META_SREG: u32 = 3; + +pub const NFTNL_EXPR_RT_KEY: u32 = 1; +pub const NFTNL_EXPR_RT_DREG: u32 = 2; + +pub const NFTNL_EXPR_SOCKET_KEY: u32 = 1; +pub const NFTNL_EXPR_SOCKET_DREG: u32 = 2; + +pub const NFTNL_EXPR_TUNNEL_KEY: u32 = 1; +pub const NFTNL_EXPR_TUNNEL_DREG: u32 = 2; + +pub const NFTNL_EXPR_CMP_SREG: u32 = 1; +pub const NFTNL_EXPR_CMP_OP: u32 = 2; +pub const NFTNL_EXPR_CMP_DATA: u32 = 3; + +pub const NFTNL_EXPR_RANGE_SREG: u32 = 1; +pub const NFTNL_EXPR_RANGE_OP: u32 = 2; +pub const NFTNL_EXPR_RANGE_FROM_DATA: u32 = 3; +pub const NFTNL_EXPR_RANGE_TO_DATA: u32 = 4; + +pub const NFTNL_EXPR_IMM_DREG: u32 = 1; +pub const NFTNL_EXPR_IMM_DATA: u32 = 2; +pub const NFTNL_EXPR_IMM_VERDICT: u32 = 3; +pub const NFTNL_EXPR_IMM_CHAIN: u32 = 4; + +pub const NFTNL_EXPR_CTR_PACKETS: u32 = 1; +pub const NFTNL_EXPR_CTR_BYTES: u32 = 2; + +pub const NFTNL_EXPR_CONNLIMIT_COUNT: u32 = 1; +pub const NFTNL_EXPR_CONNLIMIT_FLAGS: u32 = 2; + +pub const NFTNL_EXPR_BITWISE_SREG: u32 = 1; +pub const NFTNL_EXPR_BITWISE_DREG: u32 = 2; +pub const NFTNL_EXPR_BITWISE_LEN: u32 = 3; +pub const NFTNL_EXPR_BITWISE_MASK: u32 = 4; +pub const NFTNL_EXPR_BITWISE_XOR: u32 = 5; +pub const NFTNL_EXPR_BITWISE_OP: u32 = 6; +pub const NFTNL_EXPR_BITWISE_DATA: u32 = 7; + +pub const NFTNL_EXPR_TG_NAME: u32 = 1; +pub const NFTNL_EXPR_TG_REV: u32 = 2; +pub const NFTNL_EXPR_TG_INFO: u32 = 3; + +pub const NFTNL_EXPR_MT_NAME: u32 = 1; +pub const NFTNL_EXPR_MT_REV: u32 = 2; +pub const NFTNL_EXPR_MT_INFO: u32 = 3; + +pub const NFTNL_EXPR_NAT_TYPE: u32 = 1; +pub const NFTNL_EXPR_NAT_FAMILY: u32 = 2; +pub const NFTNL_EXPR_NAT_REG_ADDR_MIN: u32 = 3; +pub const NFTNL_EXPR_NAT_REG_ADDR_MAX: u32 = 4; +pub const NFTNL_EXPR_NAT_REG_PROTO_MIN: u32 = 5; +pub const NFTNL_EXPR_NAT_REG_PROTO_MAX: u32 = 6; +pub const NFTNL_EXPR_NAT_FLAGS: u32 = 7; + +pub const NFTNL_EXPR_TPROXY_FAMILY: u32 = 1; +pub const NFTNL_EXPR_TPROXY_REG_ADDR: u32 = 2; +pub const NFTNL_EXPR_TPROXY_REG_PORT: u32 = 3; + +pub const NFTNL_EXPR_LOOKUP_SREG: u32 = 1; +pub const NFTNL_EXPR_LOOKUP_DREG: u32 = 2; +pub const NFTNL_EXPR_LOOKUP_SET: u32 = 3; +pub const NFTNL_EXPR_LOOKUP_SET_ID: u32 = 4; +pub const NFTNL_EXPR_LOOKUP_FLAGS: u32 = 5; + +pub const NFTNL_EXPR_DYNSET_SREG_KEY: u32 = 1; +pub const NFTNL_EXPR_DYNSET_SREG_DATA: u32 = 2; +pub const NFTNL_EXPR_DYNSET_OP: u32 = 3; +pub const NFTNL_EXPR_DYNSET_TIMEOUT: u32 = 4; +pub const NFTNL_EXPR_DYNSET_SET_NAME: u32 = 5; +pub const NFTNL_EXPR_DYNSET_SET_ID: u32 = 6; +pub const NFTNL_EXPR_DYNSET_EXPR: u32 = 7; + +pub const NFTNL_EXPR_LOG_PREFIX: u32 = 1; +pub const NFTNL_EXPR_LOG_GROUP: u32 = 2; +pub const NFTNL_EXPR_LOG_SNAPLEN: u32 = 3; +pub const NFTNL_EXPR_LOG_QTHRESHOLD: u32 = 4; +pub const NFTNL_EXPR_LOG_LEVEL: u32 = 5; +pub const NFTNL_EXPR_LOG_FLAGS: u32 = 6; + +pub const NFTNL_EXPR_EXTHDR_DREG: u32 = 1; +pub const NFTNL_EXPR_EXTHDR_TYPE: u32 = 2; +pub const NFTNL_EXPR_EXTHDR_OFFSET: u32 = 3; +pub const NFTNL_EXPR_EXTHDR_LEN: u32 = 4; +pub const NFTNL_EXPR_EXTHDR_FLAGS: u32 = 5; +pub const NFTNL_EXPR_EXTHDR_OP: u32 = 6; +pub const NFTNL_EXPR_EXTHDR_SREG: u32 = 7; + +pub const NFTNL_EXPR_CT_DREG: u32 = 1; +pub const NFTNL_EXPR_CT_KEY: u32 = 2; +pub const NFTNL_EXPR_CT_DIR: u32 = 3; +pub const NFTNL_EXPR_CT_SREG: u32 = 4; + +pub const NFTNL_EXPR_BYTEORDER_DREG: u32 = 1; +pub const NFTNL_EXPR_BYTEORDER_SREG: u32 = 2; +pub const NFTNL_EXPR_BYTEORDER_OP: u32 = 3; +pub const NFTNL_EXPR_BYTEORDER_LEN: u32 = 4; +pub const NFTNL_EXPR_BYTEORDER_SIZE: u32 = 5; + +pub const NFTNL_EXPR_LIMIT_RATE: u32 = 1; +pub const NFTNL_EXPR_LIMIT_UNIT: u32 = 2; +pub const NFTNL_EXPR_LIMIT_BURST: u32 = 3; +pub const NFTNL_EXPR_LIMIT_TYPE: u32 = 4; +pub const NFTNL_EXPR_LIMIT_FLAGS: u32 = 5; + +pub const NFTNL_EXPR_REJECT_TYPE: u32 = 1; +pub const NFTNL_EXPR_REJECT_CODE: u32 = 2; + +pub const NFTNL_EXPR_QUEUE_NUM: u32 = 1; +pub const NFTNL_EXPR_QUEUE_TOTAL: u32 = 2; +pub const NFTNL_EXPR_QUEUE_FLAGS: u32 = 3; +pub const NFTNL_EXPR_QUEUE_SREG_QNUM: u32 = 4; + +pub const NFTNL_EXPR_QUOTA_BYTES: u32 = 1; +pub const NFTNL_EXPR_QUOTA_FLAGS: u32 = 2; +pub const NFTNL_EXPR_QUOTA_CONSUMED: u32 = 3; + +pub const NFTNL_EXPR_MASQ_FLAGS: u32 = 1; +pub const NFTNL_EXPR_MASQ_REG_PROTO_MIN: u32 = 2; +pub const NFTNL_EXPR_MASQ_REG_PROTO_MAX: u32 = 3; + +pub const NFTNL_EXPR_REDIR_REG_PROTO_MIN: u32 = 1; +pub const NFTNL_EXPR_REDIR_REG_PROTO_MAX: u32 = 2; +pub const NFTNL_EXPR_REDIR_FLAGS: u32 = 3; + +pub const NFTNL_EXPR_DUP_SREG_ADDR: u32 = 1; +pub const NFTNL_EXPR_DUP_SREG_DEV: u32 = 2; + +pub const NFTNL_EXPR_FLOW_TABLE_NAME: u32 = 1; + +pub const NFTNL_EXPR_FWD_SREG_DEV: u32 = 1; +pub const NFTNL_EXPR_FWD_SREG_ADDR: u32 = 2; +pub const NFTNL_EXPR_FWD_NFPROTO: u32 = 3; + +pub const NFTNL_EXPR_HASH_SREG: u32 = 1; +pub const NFTNL_EXPR_HASH_DREG: u32 = 2; +pub const NFTNL_EXPR_HASH_LEN: u32 = 3; +pub const NFTNL_EXPR_HASH_MODULUS: u32 = 4; +pub const NFTNL_EXPR_HASH_SEED: u32 = 5; +pub const NFTNL_EXPR_HASH_OFFSET: u32 = 6; +pub const NFTNL_EXPR_HASH_TYPE: u32 = 7; +pub const NFTNL_EXPR_HASH_SET_NAME: u32 = 8; +pub const NFTNL_EXPR_HASH_SET_ID: u32 = 9; + +pub const NFTNL_EXPR_FIB_DREG: u32 = 1; +pub const NFTNL_EXPR_FIB_RESULT: u32 = 2; +pub const NFTNL_EXPR_FIB_FLAGS: u32 = 3; + +pub const NFTNL_EXPR_OBJREF_IMM_TYPE: u32 = 1; +pub const NFTNL_EXPR_OBJREF_IMM_NAME: u32 = 2; +pub const NFTNL_EXPR_OBJREF_SET_SREG: u32 = 3; +pub const NFTNL_EXPR_OBJREF_SET_NAME: u32 = 4; +pub const NFTNL_EXPR_OBJREF_SET_ID: u32 = 5; + +pub const NFTNL_EXPR_OSF_DREG: u32 = 1; +pub const NFTNL_EXPR_OSF_TTL: u32 = 2; +pub const NFTNL_EXPR_OSF_FLAGS: u32 = 3; + +pub const NFTNL_EXPR_XFRM_DREG: u32 = 1; +pub const NFTNL_EXPR_XFRM_SREG: u32 = 2; +pub const NFTNL_EXPR_XFRM_KEY: u32 = 3; +pub const NFTNL_EXPR_XFRM_DIR: u32 = 4; +pub const NFTNL_EXPR_XFRM_SPNUM: u32 = 5; + +pub const NFTNL_EXPR_SYNPROXY_MSS: u32 = 1; +pub const NFTNL_EXPR_SYNPROXY_WSCALE: u32 = 2; +pub const NFTNL_EXPR_SYNPROXY_FLAGS: u32 = 3; + +#[repr(C)] +pub struct nftnl_gen(c_void); + +extern "C" { + pub fn nftnl_gen_alloc() -> *mut nftnl_gen; + + pub fn nftnl_gen_free(arg1: *const nftnl_gen); +} +pub const NFTNL_GEN_ID: u32 = 0; +pub const __NFTNL_GEN_MAX: u32 = 1; + +extern "C" { + pub fn nftnl_gen_is_set(gen: *const nftnl_gen, attr: u16) -> bool; + + pub fn nftnl_gen_unset(gen: *mut nftnl_gen, attr: u16); + + pub fn nftnl_gen_set(gen: *mut nftnl_gen, attr: u16, data: *const c_void) -> c_int; + + pub fn nftnl_gen_set_data( + gen: *mut nftnl_gen, + attr: u16, + data: *const c_void, + data_len: u32, + ) -> c_int; + + pub fn nftnl_gen_get(gen: *const nftnl_gen, attr: u16) -> *const c_void; + + pub fn nftnl_gen_get_data( + gen: *const nftnl_gen, + attr: u16, + data_len: *mut u32, + ) -> *const c_void; + + pub fn nftnl_gen_set_u32(gen: *mut nftnl_gen, attr: u16, data: u32); + + pub fn nftnl_gen_get_u32(gen: *const nftnl_gen, attr: u16) -> u32; + + pub fn nftnl_gen_nlmsg_parse(nlh: *const nlmsghdr, gen: *mut nftnl_gen) -> c_int; + + pub fn nftnl_gen_snprintf( + buf: *mut c_char, + size: usize, + gen: *const nftnl_gen, + type_: u32, + flags: u32, + ) -> c_int; + + pub fn nftnl_gen_fprintf(fp: *mut FILE, gen: *const nftnl_gen, type_: u32, flags: u32) + -> c_int; +} +pub const NFTNL_OBJ_TABLE: u32 = 0; +pub const NFTNL_OBJ_NAME: u32 = 1; +pub const NFTNL_OBJ_TYPE: u32 = 2; +pub const NFTNL_OBJ_FAMILY: u32 = 3; +pub const NFTNL_OBJ_USE: u32 = 4; +pub const NFTNL_OBJ_HANDLE: u32 = 5; +pub const NFTNL_OBJ_BASE: u32 = 16; +pub const __NFTNL_OBJ_MAX: u32 = 17; + +pub const NFTNL_OBJ_CTR_PKTS: u32 = 16; +pub const NFTNL_OBJ_CTR_BYTES: u32 = 17; + +pub const NFTNL_OBJ_QUOTA_BYTES: u32 = 16; +pub const NFTNL_OBJ_QUOTA_CONSUMED: u32 = 17; +pub const NFTNL_OBJ_QUOTA_FLAGS: u32 = 18; + +pub const NFTNL_OBJ_CT_HELPER_NAME: u32 = 16; +pub const NFTNL_OBJ_CT_HELPER_L3PROTO: u32 = 17; +pub const NFTNL_OBJ_CT_HELPER_L4PROTO: u32 = 18; + +pub const NFTNL_CTTIMEOUT_TCP_SYN_SENT: nftnl_cttimeout_array_tcp = 0; +pub const NFTNL_CTTIMEOUT_TCP_SYN_RECV: nftnl_cttimeout_array_tcp = 1; +pub const NFTNL_CTTIMEOUT_TCP_ESTABLISHED: nftnl_cttimeout_array_tcp = 2; +pub const NFTNL_CTTIMEOUT_TCP_FIN_WAIT: nftnl_cttimeout_array_tcp = 3; +pub const NFTNL_CTTIMEOUT_TCP_CLOSE_WAIT: nftnl_cttimeout_array_tcp = 4; +pub const NFTNL_CTTIMEOUT_TCP_LAST_ACK: nftnl_cttimeout_array_tcp = 5; +pub const NFTNL_CTTIMEOUT_TCP_TIME_WAIT: nftnl_cttimeout_array_tcp = 6; +pub const NFTNL_CTTIMEOUT_TCP_CLOSE: nftnl_cttimeout_array_tcp = 7; +pub const NFTNL_CTTIMEOUT_TCP_SYN_SENT2: nftnl_cttimeout_array_tcp = 8; +pub const NFTNL_CTTIMEOUT_TCP_RETRANS: nftnl_cttimeout_array_tcp = 9; +pub const NFTNL_CTTIMEOUT_TCP_UNACK: nftnl_cttimeout_array_tcp = 10; +pub const NFTNL_CTTIMEOUT_TCP_MAX: nftnl_cttimeout_array_tcp = 11; +pub type nftnl_cttimeout_array_tcp = c_uint; +pub const NFTNL_CTTIMEOUT_UDP_UNREPLIED: nftnl_cttimeout_array_udp = 0; +pub const NFTNL_CTTIMEOUT_UDP_REPLIED: nftnl_cttimeout_array_udp = 1; +pub const NFTNL_CTTIMEOUT_UDP_MAX: nftnl_cttimeout_array_udp = 2; +pub type nftnl_cttimeout_array_udp = c_uint; +pub const NFTNL_OBJ_CT_TIMEOUT_L3PROTO: u32 = 16; +pub const NFTNL_OBJ_CT_TIMEOUT_L4PROTO: u32 = 17; +pub const NFTNL_OBJ_CT_TIMEOUT_ARRAY: u32 = 18; + +pub const NFTNL_OBJ_CT_EXPECT_L3PROTO: u32 = 16; +pub const NFTNL_OBJ_CT_EXPECT_L4PROTO: u32 = 17; +pub const NFTNL_OBJ_CT_EXPECT_DPORT: u32 = 18; +pub const NFTNL_OBJ_CT_EXPECT_TIMEOUT: u32 = 19; +pub const NFTNL_OBJ_CT_EXPECT_SIZE: u32 = 20; + +pub const NFTNL_OBJ_LIMIT_RATE: u32 = 16; +pub const NFTNL_OBJ_LIMIT_UNIT: u32 = 17; +pub const NFTNL_OBJ_LIMIT_BURST: u32 = 18; +pub const NFTNL_OBJ_LIMIT_TYPE: u32 = 19; +pub const NFTNL_OBJ_LIMIT_FLAGS: u32 = 20; + +pub const NFTNL_OBJ_SYNPROXY_MSS: u32 = 16; +pub const NFTNL_OBJ_SYNPROXY_WSCALE: u32 = 17; +pub const NFTNL_OBJ_SYNPROXY_FLAGS: u32 = 18; + +pub const NFTNL_OBJ_TUNNEL_ID: u32 = 16; +pub const NFTNL_OBJ_TUNNEL_IPV4_SRC: u32 = 17; +pub const NFTNL_OBJ_TUNNEL_IPV4_DST: u32 = 18; +pub const NFTNL_OBJ_TUNNEL_IPV6_SRC: u32 = 19; +pub const NFTNL_OBJ_TUNNEL_IPV6_DST: u32 = 20; +pub const NFTNL_OBJ_TUNNEL_IPV6_FLOWLABEL: u32 = 21; +pub const NFTNL_OBJ_TUNNEL_SPORT: u32 = 22; +pub const NFTNL_OBJ_TUNNEL_DPORT: u32 = 23; +pub const NFTNL_OBJ_TUNNEL_FLAGS: u32 = 24; +pub const NFTNL_OBJ_TUNNEL_TOS: u32 = 25; +pub const NFTNL_OBJ_TUNNEL_TTL: u32 = 26; +pub const NFTNL_OBJ_TUNNEL_VXLAN_GBP: u32 = 27; +pub const NFTNL_OBJ_TUNNEL_ERSPAN_VERSION: u32 = 28; +pub const NFTNL_OBJ_TUNNEL_ERSPAN_V1_INDEX: u32 = 29; +pub const NFTNL_OBJ_TUNNEL_ERSPAN_V2_HWID: u32 = 30; +pub const NFTNL_OBJ_TUNNEL_ERSPAN_V2_DIR: u32 = 31; + +pub const NFTNL_OBJ_SECMARK_CTX: u32 = 16; + +#[repr(C)] +pub struct nftnl_obj(c_void); + +extern "C" { + pub fn nftnl_obj_alloc() -> *mut nftnl_obj; + + pub fn nftnl_obj_free(ne: *const nftnl_obj); + + pub fn nftnl_obj_is_set(ne: *const nftnl_obj, attr: u16) -> bool; + + pub fn nftnl_obj_unset(ne: *mut nftnl_obj, attr: u16); + + pub fn nftnl_obj_set_data(ne: *mut nftnl_obj, attr: u16, data: *const c_void, data_len: u32); + + pub fn nftnl_obj_set(ne: *mut nftnl_obj, attr: u16, data: *const c_void); + + pub fn nftnl_obj_set_u8(ne: *mut nftnl_obj, attr: u16, val: u8); + + pub fn nftnl_obj_set_u16(ne: *mut nftnl_obj, attr: u16, val: u16); + + pub fn nftnl_obj_set_u32(ne: *mut nftnl_obj, attr: u16, val: u32); + + pub fn nftnl_obj_set_u64(obj: *mut nftnl_obj, attr: u16, val: u64); + + pub fn nftnl_obj_set_str(ne: *mut nftnl_obj, attr: u16, str_: *const c_char); + + pub fn nftnl_obj_get_data(ne: *mut nftnl_obj, attr: u16, data_len: *mut u32) -> *const c_void; + + pub fn nftnl_obj_get(ne: *mut nftnl_obj, attr: u16) -> *const c_void; + + pub fn nftnl_obj_get_u8(ne: *mut nftnl_obj, attr: u16) -> u8; + + pub fn nftnl_obj_get_u16(obj: *mut nftnl_obj, attr: u16) -> u16; + + pub fn nftnl_obj_get_u32(ne: *mut nftnl_obj, attr: u16) -> u32; + + pub fn nftnl_obj_get_u64(obj: *mut nftnl_obj, attr: u16) -> u64; + + pub fn nftnl_obj_get_str(ne: *mut nftnl_obj, attr: u16) -> *const c_char; + + pub fn nftnl_obj_nlmsg_build_payload(nlh: *mut nlmsghdr, ne: *const nftnl_obj); + + pub fn nftnl_obj_nlmsg_parse(nlh: *const nlmsghdr, ne: *mut nftnl_obj) -> c_int; + + pub fn nftnl_obj_parse( + ne: *mut nftnl_obj, + type_: nftnl_parse_type, + data: *const c_char, + err: *mut nftnl_parse_err, + ) -> c_int; + + pub fn nftnl_obj_parse_file( + ne: *mut nftnl_obj, + type_: nftnl_parse_type, + fp: *mut FILE, + err: *mut nftnl_parse_err, + ) -> c_int; + + pub fn nftnl_obj_snprintf( + buf: *mut c_char, + size: usize, + ne: *const nftnl_obj, + type_: u32, + flags: u32, + ) -> c_int; + + pub fn nftnl_obj_fprintf(fp: *mut FILE, ne: *const nftnl_obj, type_: u32, flags: u32) -> c_int; +} +#[repr(C)] +pub struct nftnl_obj_list(c_void); + +extern "C" { + pub fn nftnl_obj_list_alloc() -> *mut nftnl_obj_list; + + pub fn nftnl_obj_list_free(list: *mut nftnl_obj_list); + + pub fn nftnl_obj_list_is_empty(list: *mut nftnl_obj_list) -> c_int; + + pub fn nftnl_obj_list_add(r: *mut nftnl_obj, list: *mut nftnl_obj_list); + + pub fn nftnl_obj_list_add_tail(r: *mut nftnl_obj, list: *mut nftnl_obj_list); + + pub fn nftnl_obj_list_del(t: *mut nftnl_obj); + + pub fn nftnl_obj_list_foreach( + table_list: *mut nftnl_obj_list, + cb: Option c_int>, + data: *mut c_void, + ) -> c_int; +} +#[repr(C)] +pub struct nftnl_obj_list_iter(c_void); + +extern "C" { + pub fn nftnl_obj_list_iter_create(l: *mut nftnl_obj_list) -> *mut nftnl_obj_list_iter; + + pub fn nftnl_obj_list_iter_next(iter: *mut nftnl_obj_list_iter) -> *mut nftnl_obj; + + pub fn nftnl_obj_list_iter_destroy(iter: *mut nftnl_obj_list_iter); + + pub fn nftnl_rule_alloc() -> *mut nftnl_rule; + + pub fn nftnl_rule_free(arg1: *const nftnl_rule); +} +pub const NFTNL_RULE_FAMILY: nftnl_rule_attr = 0; +pub const NFTNL_RULE_TABLE: nftnl_rule_attr = 1; +pub const NFTNL_RULE_CHAIN: nftnl_rule_attr = 2; +pub const NFTNL_RULE_HANDLE: nftnl_rule_attr = 3; +pub const NFTNL_RULE_COMPAT_PROTO: nftnl_rule_attr = 4; +pub const NFTNL_RULE_COMPAT_FLAGS: nftnl_rule_attr = 5; +pub const NFTNL_RULE_POSITION: nftnl_rule_attr = 6; +pub const NFTNL_RULE_USERDATA: nftnl_rule_attr = 7; +pub const NFTNL_RULE_ID: nftnl_rule_attr = 8; +pub const NFTNL_RULE_POSITION_ID: nftnl_rule_attr = 9; +pub const __NFTNL_RULE_MAX: nftnl_rule_attr = 10; +pub type nftnl_rule_attr = c_uint; +extern "C" { + pub fn nftnl_rule_unset(r: *mut nftnl_rule, attr: u16); + + pub fn nftnl_rule_is_set(r: *const nftnl_rule, attr: u16) -> bool; + + pub fn nftnl_rule_set(r: *mut nftnl_rule, attr: u16, data: *const c_void) -> c_int; + + pub fn nftnl_rule_set_data( + r: *mut nftnl_rule, + attr: u16, + data: *const c_void, + data_len: u32, + ) -> c_int; + + pub fn nftnl_rule_set_u32(r: *mut nftnl_rule, attr: u16, val: u32); + + pub fn nftnl_rule_set_u64(r: *mut nftnl_rule, attr: u16, val: u64); + + pub fn nftnl_rule_set_str(r: *mut nftnl_rule, attr: u16, str_: *const c_char) -> c_int; + + pub fn nftnl_rule_get(r: *const nftnl_rule, attr: u16) -> *const c_void; + + pub fn nftnl_rule_get_data( + r: *const nftnl_rule, + attr: u16, + data_len: *mut u32, + ) -> *const c_void; + + pub fn nftnl_rule_get_str(r: *const nftnl_rule, attr: u16) -> *const c_char; + + pub fn nftnl_rule_get_u8(r: *const nftnl_rule, attr: u16) -> u8; + + pub fn nftnl_rule_get_u32(r: *const nftnl_rule, attr: u16) -> u32; + + pub fn nftnl_rule_get_u64(r: *const nftnl_rule, attr: u16) -> u64; + + pub fn nftnl_rule_add_expr(r: *mut nftnl_rule, expr: *mut nftnl_expr); + + pub fn nftnl_rule_nlmsg_build_payload(nlh: *mut nlmsghdr, t: *mut nftnl_rule); + + pub fn nftnl_rule_parse( + r: *mut nftnl_rule, + type_: nftnl_parse_type, + data: *const c_char, + err: *mut nftnl_parse_err, + ) -> c_int; + + pub fn nftnl_rule_parse_file( + r: *mut nftnl_rule, + type_: nftnl_parse_type, + fp: *mut FILE, + err: *mut nftnl_parse_err, + ) -> c_int; + + pub fn nftnl_rule_snprintf( + buf: *mut c_char, + size: usize, + t: *const nftnl_rule, + type_: u32, + flags: u32, + ) -> c_int; + + pub fn nftnl_rule_fprintf(fp: *mut FILE, r: *const nftnl_rule, type_: u32, flags: u32) + -> c_int; + + pub fn nftnl_rule_nlmsg_parse(nlh: *const nlmsghdr, t: *mut nftnl_rule) -> c_int; + + pub fn nftnl_expr_foreach( + r: *mut nftnl_rule, + cb: Option c_int>, + data: *mut c_void, + ) -> c_int; +} +#[repr(C)] +pub struct nftnl_expr_iter(c_void); + +extern "C" { + pub fn nftnl_expr_iter_create(r: *const nftnl_rule) -> *mut nftnl_expr_iter; + + pub fn nftnl_expr_iter_next(iter: *mut nftnl_expr_iter) -> *mut nftnl_expr; + + pub fn nftnl_expr_iter_destroy(iter: *mut nftnl_expr_iter); +} +#[repr(C)] +pub struct nftnl_rule_list(c_void); + +extern "C" { + pub fn nftnl_rule_list_alloc() -> *mut nftnl_rule_list; + + pub fn nftnl_rule_list_free(list: *mut nftnl_rule_list); + + pub fn nftnl_rule_list_is_empty(list: *const nftnl_rule_list) -> c_int; + + pub fn nftnl_rule_list_add(r: *mut nftnl_rule, list: *mut nftnl_rule_list); + + pub fn nftnl_rule_list_add_tail(r: *mut nftnl_rule, list: *mut nftnl_rule_list); + + pub fn nftnl_rule_list_insert_at(r: *mut nftnl_rule, pos: *mut nftnl_rule); + + pub fn nftnl_rule_list_del(r: *mut nftnl_rule); + + pub fn nftnl_rule_list_foreach( + rule_list: *mut nftnl_rule_list, + cb: Option c_int>, + data: *mut c_void, + ) -> c_int; +} +#[repr(C)] +pub struct nftnl_rule_list_iter(c_void); + +extern "C" { + pub fn nftnl_rule_list_iter_create(l: *const nftnl_rule_list) -> *mut nftnl_rule_list_iter; + + pub fn nftnl_rule_list_iter_cur(iter: *mut nftnl_rule_list_iter) -> *mut nftnl_rule; + + pub fn nftnl_rule_list_iter_next(iter: *mut nftnl_rule_list_iter) -> *mut nftnl_rule; + + pub fn nftnl_rule_list_iter_destroy(iter: *const nftnl_rule_list_iter); +} +#[repr(C)] +pub struct nftnl_ruleset(c_void); + +extern "C" { + pub fn nftnl_ruleset_alloc() -> *mut nftnl_ruleset; + + pub fn nftnl_ruleset_free(r: *const nftnl_ruleset); +} +pub const NFTNL_RULESET_TABLELIST: u32 = 0; +pub const NFTNL_RULESET_CHAINLIST: u32 = 1; +pub const NFTNL_RULESET_SETLIST: u32 = 2; +pub const NFTNL_RULESET_RULELIST: u32 = 3; + +pub const NFTNL_RULESET_UNSPEC: nftnl_ruleset_type = 0; +pub const NFTNL_RULESET_RULESET: nftnl_ruleset_type = 1; +pub const NFTNL_RULESET_TABLE: nftnl_ruleset_type = 2; +pub const NFTNL_RULESET_CHAIN: nftnl_ruleset_type = 3; +pub const NFTNL_RULESET_RULE: nftnl_ruleset_type = 4; +pub const NFTNL_RULESET_SET: nftnl_ruleset_type = 5; +pub const NFTNL_RULESET_SET_ELEMS: nftnl_ruleset_type = 6; +pub type nftnl_ruleset_type = c_uint; +extern "C" { + pub fn nftnl_ruleset_is_set(r: *const nftnl_ruleset, attr: u16) -> bool; + + pub fn nftnl_ruleset_unset(r: *mut nftnl_ruleset, attr: u16); + + pub fn nftnl_ruleset_set(r: *mut nftnl_ruleset, attr: u16, data: *mut c_void); + + pub fn nftnl_ruleset_get(r: *const nftnl_ruleset, attr: u16) -> *mut c_void; +} +pub const NFTNL_RULESET_CTX_CMD: u32 = 0; +pub const NFTNL_RULESET_CTX_TYPE: u32 = 1; +pub const NFTNL_RULESET_CTX_TABLE: u32 = 2; +pub const NFTNL_RULESET_CTX_CHAIN: u32 = 3; +pub const NFTNL_RULESET_CTX_RULE: u32 = 4; +pub const NFTNL_RULESET_CTX_SET: u32 = 5; +pub const NFTNL_RULESET_CTX_DATA: u32 = 6; + +#[repr(C)] +pub struct nftnl_parse_ctx(c_void); + +extern "C" { + pub fn nftnl_ruleset_ctx_free(ctx: *const nftnl_parse_ctx); + + pub fn nftnl_ruleset_ctx_is_set(ctx: *const nftnl_parse_ctx, attr: u16) -> bool; + + pub fn nftnl_ruleset_ctx_get(ctx: *const nftnl_parse_ctx, attr: u16) -> *mut c_void; + + pub fn nftnl_ruleset_ctx_get_u32(ctx: *const nftnl_parse_ctx, attr: u16) -> u32; + + pub fn nftnl_ruleset_parse_file_cb( + type_: nftnl_parse_type, + fp: *mut FILE, + err: *mut nftnl_parse_err, + data: *mut c_void, + cb: Option c_int>, + ) -> c_int; + + pub fn nftnl_ruleset_parse_buffer_cb( + type_: nftnl_parse_type, + buffer: *const c_char, + err: *mut nftnl_parse_err, + data: *mut c_void, + cb: Option c_int>, + ) -> c_int; + + pub fn nftnl_ruleset_parse( + rs: *mut nftnl_ruleset, + type_: nftnl_parse_type, + data: *const c_char, + err: *mut nftnl_parse_err, + ) -> c_int; + + pub fn nftnl_ruleset_parse_file( + rs: *mut nftnl_ruleset, + type_: nftnl_parse_type, + fp: *mut FILE, + err: *mut nftnl_parse_err, + ) -> c_int; + + pub fn nftnl_ruleset_snprintf( + buf: *mut c_char, + size: usize, + rs: *const nftnl_ruleset, + type_: u32, + flags: u32, + ) -> c_int; + + pub fn nftnl_ruleset_fprintf( + fp: *mut FILE, + rs: *const nftnl_ruleset, + type_: u32, + flags: u32, + ) -> c_int; +} +pub const NFTNL_SET_TABLE: nftnl_set_attr = 0; +pub const NFTNL_SET_NAME: nftnl_set_attr = 1; +pub const NFTNL_SET_FLAGS: nftnl_set_attr = 2; +pub const NFTNL_SET_KEY_TYPE: nftnl_set_attr = 3; +pub const NFTNL_SET_KEY_LEN: nftnl_set_attr = 4; +pub const NFTNL_SET_DATA_TYPE: nftnl_set_attr = 5; +pub const NFTNL_SET_DATA_LEN: nftnl_set_attr = 6; +pub const NFTNL_SET_FAMILY: nftnl_set_attr = 7; +pub const NFTNL_SET_ID: nftnl_set_attr = 8; +pub const NFTNL_SET_POLICY: nftnl_set_attr = 9; +pub const NFTNL_SET_DESC_SIZE: nftnl_set_attr = 10; +pub const NFTNL_SET_TIMEOUT: nftnl_set_attr = 11; +pub const NFTNL_SET_GC_INTERVAL: nftnl_set_attr = 12; +pub const NFTNL_SET_USERDATA: nftnl_set_attr = 13; +pub const NFTNL_SET_OBJ_TYPE: nftnl_set_attr = 14; +pub const NFTNL_SET_HANDLE: nftnl_set_attr = 15; +pub const NFTNL_SET_DESC_CONCAT: nftnl_set_attr = 16; +pub const NFTNL_SET_EXPR: nftnl_set_attr = 17; +pub const __NFTNL_SET_MAX: nftnl_set_attr = 18; +pub type nftnl_set_attr = c_uint; +#[repr(C)] +pub struct nftnl_set(c_void); + +extern "C" { + pub fn nftnl_set_alloc() -> *mut nftnl_set; + + pub fn nftnl_set_free(s: *const nftnl_set); + + pub fn nftnl_set_clone(set: *const nftnl_set) -> *mut nftnl_set; + + pub fn nftnl_set_is_set(s: *const nftnl_set, attr: u16) -> bool; + + pub fn nftnl_set_unset(s: *mut nftnl_set, attr: u16); + + pub fn nftnl_set_set(s: *mut nftnl_set, attr: u16, data: *const c_void) -> c_int; + + pub fn nftnl_set_set_data( + s: *mut nftnl_set, + attr: u16, + data: *const c_void, + data_len: u32, + ) -> c_int; + + pub fn nftnl_set_set_u32(s: *mut nftnl_set, attr: u16, val: u32); + + pub fn nftnl_set_set_u64(s: *mut nftnl_set, attr: u16, val: u64); + + pub fn nftnl_set_set_str(s: *mut nftnl_set, attr: u16, str_: *const c_char) -> c_int; + + pub fn nftnl_set_get(s: *const nftnl_set, attr: u16) -> *const c_void; + + pub fn nftnl_set_get_data(s: *const nftnl_set, attr: u16, data_len: *mut u32) -> *const c_void; + + pub fn nftnl_set_get_str(s: *const nftnl_set, attr: u16) -> *const c_char; + + pub fn nftnl_set_get_u32(s: *const nftnl_set, attr: u16) -> u32; + + pub fn nftnl_set_get_u64(s: *const nftnl_set, attr: u16) -> u64; + + pub fn nftnl_set_nlmsg_build_payload(nlh: *mut nlmsghdr, s: *mut nftnl_set); + + pub fn nftnl_set_nlmsg_parse(nlh: *const nlmsghdr, s: *mut nftnl_set) -> c_int; + + pub fn nftnl_set_elems_nlmsg_parse(nlh: *const nlmsghdr, s: *mut nftnl_set) -> c_int; + + pub fn nftnl_set_snprintf( + buf: *mut c_char, + size: usize, + s: *const nftnl_set, + type_: u32, + flags: u32, + ) -> c_int; + + pub fn nftnl_set_fprintf(fp: *mut FILE, s: *const nftnl_set, type_: u32, flags: u32) -> c_int; +} +#[repr(C)] +pub struct nftnl_set_list(c_void); + +extern "C" { + pub fn nftnl_set_list_alloc() -> *mut nftnl_set_list; + + pub fn nftnl_set_list_free(list: *mut nftnl_set_list); + + pub fn nftnl_set_list_is_empty(list: *const nftnl_set_list) -> c_int; + + pub fn nftnl_set_list_add(s: *mut nftnl_set, list: *mut nftnl_set_list); + + pub fn nftnl_set_list_add_tail(s: *mut nftnl_set, list: *mut nftnl_set_list); + + pub fn nftnl_set_list_del(s: *mut nftnl_set); + + pub fn nftnl_set_list_foreach( + set_list: *mut nftnl_set_list, + cb: Option c_int>, + data: *mut c_void, + ) -> c_int; + + pub fn nftnl_set_list_lookup_byname( + set_list: *mut nftnl_set_list, + set: *const c_char, + ) -> *mut nftnl_set; +} +#[repr(C)] +pub struct nftnl_set_list_iter(c_void); + +extern "C" { + pub fn nftnl_set_list_iter_create(l: *const nftnl_set_list) -> *mut nftnl_set_list_iter; + + pub fn nftnl_set_list_iter_cur(iter: *const nftnl_set_list_iter) -> *mut nftnl_set; + + pub fn nftnl_set_list_iter_next(iter: *mut nftnl_set_list_iter) -> *mut nftnl_set; + + pub fn nftnl_set_list_iter_destroy(iter: *const nftnl_set_list_iter); + + pub fn nftnl_set_parse( + s: *mut nftnl_set, + type_: nftnl_parse_type, + data: *const c_char, + err: *mut nftnl_parse_err, + ) -> c_int; + + pub fn nftnl_set_parse_file( + s: *mut nftnl_set, + type_: nftnl_parse_type, + fp: *mut FILE, + err: *mut nftnl_parse_err, + ) -> c_int; +} +pub const NFTNL_SET_ELEM_FLAGS: u32 = 0; +pub const NFTNL_SET_ELEM_KEY: u32 = 1; +pub const NFTNL_SET_ELEM_VERDICT: u32 = 2; +pub const NFTNL_SET_ELEM_CHAIN: u32 = 3; +pub const NFTNL_SET_ELEM_DATA: u32 = 4; +pub const NFTNL_SET_ELEM_TIMEOUT: u32 = 5; +pub const NFTNL_SET_ELEM_EXPIRATION: u32 = 6; +pub const NFTNL_SET_ELEM_USERDATA: u32 = 7; +pub const NFTNL_SET_ELEM_EXPR: u32 = 8; +pub const NFTNL_SET_ELEM_OBJREF: u32 = 9; +pub const NFTNL_SET_ELEM_KEY_END: u32 = 10; +pub const __NFTNL_SET_ELEM_MAX: u32 = 11; + +#[repr(C)] +pub struct nftnl_set_elem(c_void); + +extern "C" { + pub fn nftnl_set_elem_alloc() -> *mut nftnl_set_elem; + + pub fn nftnl_set_elem_free(s: *mut nftnl_set_elem); + + pub fn nftnl_set_elem_clone(elem: *mut nftnl_set_elem) -> *mut nftnl_set_elem; + + pub fn nftnl_set_elem_add(s: *mut nftnl_set, elem: *mut nftnl_set_elem); + + pub fn nftnl_set_elem_unset(s: *mut nftnl_set_elem, attr: u16); + + pub fn nftnl_set_elem_set( + s: *mut nftnl_set_elem, + attr: u16, + data: *const c_void, + data_len: u32, + ) -> c_int; + + pub fn nftnl_set_elem_set_u32(s: *mut nftnl_set_elem, attr: u16, val: u32); + + pub fn nftnl_set_elem_set_u64(s: *mut nftnl_set_elem, attr: u16, val: u64); + + pub fn nftnl_set_elem_set_str(s: *mut nftnl_set_elem, attr: u16, str_: *const c_char) -> c_int; + + pub fn nftnl_set_elem_get( + s: *mut nftnl_set_elem, + attr: u16, + data_len: *mut u32, + ) -> *const c_void; + + pub fn nftnl_set_elem_get_str(s: *mut nftnl_set_elem, attr: u16) -> *const c_char; + + pub fn nftnl_set_elem_get_u32(s: *mut nftnl_set_elem, attr: u16) -> u32; + + pub fn nftnl_set_elem_get_u64(s: *mut nftnl_set_elem, attr: u16) -> u64; + + pub fn nftnl_set_elem_is_set(s: *const nftnl_set_elem, attr: u16) -> bool; + + pub fn nftnl_set_elems_nlmsg_build_payload(nlh: *mut nlmsghdr, s: *mut nftnl_set); + + pub fn nftnl_set_elem_nlmsg_build_payload(nlh: *mut nlmsghdr, e: *mut nftnl_set_elem); + + pub fn nftnl_set_elem_parse( + e: *mut nftnl_set_elem, + type_: nftnl_parse_type, + data: *const c_char, + err: *mut nftnl_parse_err, + ) -> c_int; + + pub fn nftnl_set_elem_parse_file( + e: *mut nftnl_set_elem, + type_: nftnl_parse_type, + fp: *mut FILE, + err: *mut nftnl_parse_err, + ) -> c_int; + + pub fn nftnl_set_elem_snprintf( + buf: *mut c_char, + size: usize, + s: *const nftnl_set_elem, + type_: u32, + flags: u32, + ) -> c_int; + + pub fn nftnl_set_elem_fprintf( + fp: *mut FILE, + se: *mut nftnl_set_elem, + type_: u32, + flags: u32, + ) -> c_int; + + pub fn nftnl_set_elem_foreach( + s: *mut nftnl_set, + cb: Option c_int>, + data: *mut c_void, + ) -> c_int; +} +#[repr(C)] +pub struct nftnl_set_elems_iter(c_void); + +extern "C" { + pub fn nftnl_set_elems_iter_create(s: *const nftnl_set) -> *mut nftnl_set_elems_iter; + + pub fn nftnl_set_elems_iter_cur(iter: *const nftnl_set_elems_iter) -> *mut nftnl_set_elem; + + pub fn nftnl_set_elems_iter_next(iter: *mut nftnl_set_elems_iter) -> *mut nftnl_set_elem; + + pub fn nftnl_set_elems_iter_destroy(iter: *mut nftnl_set_elems_iter); + + pub fn nftnl_set_elems_nlmsg_build_payload_iter( + nlh: *mut nlmsghdr, + iter: *mut nftnl_set_elems_iter, + ) -> c_int; +} +#[repr(C)] +pub struct nftnl_table(c_void); + +extern "C" { + pub fn nftnl_table_alloc() -> *mut nftnl_table; + + pub fn nftnl_table_free(arg1: *const nftnl_table); +} +pub const NFTNL_TABLE_NAME: nftnl_table_attr = 0; +pub const NFTNL_TABLE_FAMILY: nftnl_table_attr = 1; +pub const NFTNL_TABLE_FLAGS: nftnl_table_attr = 2; +pub const NFTNL_TABLE_USE: nftnl_table_attr = 3; +pub const NFTNL_TABLE_HANDLE: nftnl_table_attr = 4; +pub const __NFTNL_TABLE_MAX: nftnl_table_attr = 5; +pub type nftnl_table_attr = c_uint; +extern "C" { + pub fn nftnl_table_is_set(t: *const nftnl_table, attr: u16) -> bool; + + pub fn nftnl_table_unset(t: *mut nftnl_table, attr: u16); + + pub fn nftnl_table_set(t: *mut nftnl_table, attr: u16, data: *const c_void); + + pub fn nftnl_table_set_data( + t: *mut nftnl_table, + attr: u16, + data: *const c_void, + data_len: u32, + ) -> c_int; + + pub fn nftnl_table_get(t: *const nftnl_table, attr: u16) -> *const c_void; + + pub fn nftnl_table_get_data( + t: *const nftnl_table, + attr: u16, + data_len: *mut u32, + ) -> *const c_void; + + pub fn nftnl_table_set_u8(t: *mut nftnl_table, attr: u16, data: u8); + + pub fn nftnl_table_set_u32(t: *mut nftnl_table, attr: u16, data: u32); + + pub fn nftnl_table_set_u64(t: *mut nftnl_table, attr: u16, data: u64); + + pub fn nftnl_table_set_str(t: *mut nftnl_table, attr: u16, str_: *const c_char) -> c_int; + + pub fn nftnl_table_get_u8(t: *const nftnl_table, attr: u16) -> u8; + + pub fn nftnl_table_get_u32(t: *const nftnl_table, attr: u16) -> u32; + + pub fn nftnl_table_get_u64(t: *const nftnl_table, attr: u16) -> u64; + + pub fn nftnl_table_get_str(t: *const nftnl_table, attr: u16) -> *const c_char; + + pub fn nftnl_table_nlmsg_build_payload(nlh: *mut nlmsghdr, t: *const nftnl_table); + + pub fn nftnl_table_parse( + t: *mut nftnl_table, + type_: nftnl_parse_type, + data: *const c_char, + err: *mut nftnl_parse_err, + ) -> c_int; + + pub fn nftnl_table_parse_file( + t: *mut nftnl_table, + type_: nftnl_parse_type, + fp: *mut FILE, + err: *mut nftnl_parse_err, + ) -> c_int; + + pub fn nftnl_table_snprintf( + buf: *mut c_char, + size: usize, + t: *const nftnl_table, + type_: u32, + flags: u32, + ) -> c_int; + + pub fn nftnl_table_fprintf( + fp: *mut FILE, + t: *const nftnl_table, + type_: u32, + flags: u32, + ) -> c_int; + + pub fn nftnl_table_nlmsg_parse(nlh: *const nlmsghdr, t: *mut nftnl_table) -> c_int; +} +#[repr(C)] +pub struct nftnl_table_list(c_void); + +extern "C" { + pub fn nftnl_table_list_alloc() -> *mut nftnl_table_list; + + pub fn nftnl_table_list_free(list: *mut nftnl_table_list); + + pub fn nftnl_table_list_is_empty(list: *const nftnl_table_list) -> c_int; + + pub fn nftnl_table_list_foreach( + table_list: *mut nftnl_table_list, + cb: Option c_int>, + data: *mut c_void, + ) -> c_int; + + pub fn nftnl_table_list_add(r: *mut nftnl_table, list: *mut nftnl_table_list); + + pub fn nftnl_table_list_add_tail(r: *mut nftnl_table, list: *mut nftnl_table_list); + + pub fn nftnl_table_list_del(r: *mut nftnl_table); +} +#[repr(C)] +pub struct nftnl_table_list_iter(c_void); + +extern "C" { + pub fn nftnl_table_list_iter_create(l: *const nftnl_table_list) -> *mut nftnl_table_list_iter; + + pub fn nftnl_table_list_iter_next(iter: *mut nftnl_table_list_iter) -> *mut nftnl_table; + + pub fn nftnl_table_list_iter_destroy(iter: *const nftnl_table_list_iter); +} +pub const NFTNL_TRACE_CHAIN: nftnl_trace_attr = 0; +pub const NFTNL_TRACE_FAMILY: nftnl_trace_attr = 1; +pub const NFTNL_TRACE_ID: nftnl_trace_attr = 2; +pub const NFTNL_TRACE_IIF: nftnl_trace_attr = 3; +pub const NFTNL_TRACE_IIFTYPE: nftnl_trace_attr = 4; +pub const NFTNL_TRACE_JUMP_TARGET: nftnl_trace_attr = 5; +pub const NFTNL_TRACE_OIF: nftnl_trace_attr = 6; +pub const NFTNL_TRACE_OIFTYPE: nftnl_trace_attr = 7; +pub const NFTNL_TRACE_MARK: nftnl_trace_attr = 8; +pub const NFTNL_TRACE_LL_HEADER: nftnl_trace_attr = 9; +pub const NFTNL_TRACE_NETWORK_HEADER: nftnl_trace_attr = 10; +pub const NFTNL_TRACE_TRANSPORT_HEADER: nftnl_trace_attr = 11; +pub const NFTNL_TRACE_TABLE: nftnl_trace_attr = 12; +pub const NFTNL_TRACE_TYPE: nftnl_trace_attr = 13; +pub const NFTNL_TRACE_RULE_HANDLE: nftnl_trace_attr = 14; +pub const NFTNL_TRACE_VERDICT: nftnl_trace_attr = 15; +pub const NFTNL_TRACE_NFPROTO: nftnl_trace_attr = 16; +pub const NFTNL_TRACE_POLICY: nftnl_trace_attr = 17; +pub const __NFTNL_TRACE_MAX: nftnl_trace_attr = 18; +pub type nftnl_trace_attr = c_uint; +#[repr(C)] +pub struct nftnl_trace(c_void); + +extern "C" { + pub fn nftnl_trace_alloc() -> *mut nftnl_trace; + + pub fn nftnl_trace_free(trace: *const nftnl_trace); + + pub fn nftnl_trace_is_set(trace: *const nftnl_trace, type_: u16) -> bool; + + pub fn nftnl_trace_get_data( + trace: *const nftnl_trace, + type_: u16, + data_len: *mut u32, + ) -> *const c_void; + + pub fn nftnl_trace_get_u16(trace: *const nftnl_trace, type_: u16) -> u16; + + pub fn nftnl_trace_get_u32(trace: *const nftnl_trace, type_: u16) -> u32; + + pub fn nftnl_trace_get_u64(trace: *const nftnl_trace, type_: u16) -> u64; + + pub fn nftnl_trace_get_str(trace: *const nftnl_trace, type_: u16) -> *const c_char; + + pub fn nftnl_trace_nlmsg_parse(nlh: *const nlmsghdr, t: *mut nftnl_trace) -> c_int; +} +pub const NFTNL_UDATA_RULE_COMMENT: nftnl_udata_rule_types = 0; +pub const NFTNL_UDATA_RULE_EBTABLES_POLICY: nftnl_udata_rule_types = 1; +pub const __NFTNL_UDATA_RULE_MAX: nftnl_udata_rule_types = 2; +pub type nftnl_udata_rule_types = c_uint; +pub const NFTNL_UDATA_SET_KEYBYTEORDER: nftnl_udata_set_types = 0; +pub const NFTNL_UDATA_SET_DATABYTEORDER: nftnl_udata_set_types = 1; +pub const NFTNL_UDATA_SET_MERGE_ELEMENTS: nftnl_udata_set_types = 2; +pub const NFTNL_UDATA_SET_KEY_TYPEOF: nftnl_udata_set_types = 3; +pub const NFTNL_UDATA_SET_DATA_TYPEOF: nftnl_udata_set_types = 4; +pub const NFTNL_UDATA_SET_EXPR: nftnl_udata_set_types = 5; +pub const NFTNL_UDATA_SET_DATA_INTERVAL: nftnl_udata_set_types = 6; +pub const __NFTNL_UDATA_SET_MAX: nftnl_udata_set_types = 7; +pub type nftnl_udata_set_types = c_uint; +pub const NFTNL_UDATA_SET_TYPEOF_EXPR: u32 = 0; +pub const NFTNL_UDATA_SET_TYPEOF_DATA: u32 = 1; +pub const __NFTNL_UDATA_SET_TYPEOF_MAX: u32 = 2; + +pub const NFTNL_UDATA_SET_ELEM_COMMENT: nftnl_udata_set_elem_types = 0; +pub const NFTNL_UDATA_SET_ELEM_FLAGS: nftnl_udata_set_elem_types = 1; +pub const __NFTNL_UDATA_SET_ELEM_MAX: nftnl_udata_set_elem_types = 2; +pub type nftnl_udata_set_elem_types = c_uint; +pub const NFTNL_SET_ELEM_F_INTERVAL_OPEN: nftnl_udata_set_elem_flags = 1; +pub type nftnl_udata_set_elem_flags = c_uint; +#[repr(C)] +pub struct nftnl_udata(c_void); + +#[repr(C)] +pub struct nftnl_udata_buf(c_void); + +extern "C" { + pub fn nftnl_udata_buf_alloc(data_size: u32) -> *mut nftnl_udata_buf; + + pub fn nftnl_udata_buf_free(buf: *const nftnl_udata_buf); + + pub fn nftnl_udata_buf_len(buf: *const nftnl_udata_buf) -> u32; + + pub fn nftnl_udata_buf_data(buf: *const nftnl_udata_buf) -> *mut c_void; + + pub fn nftnl_udata_buf_put(buf: *mut nftnl_udata_buf, data: *const c_void, len: u32); + + pub fn nftnl_udata_start(buf: *const nftnl_udata_buf) -> *mut nftnl_udata; + + pub fn nftnl_udata_end(buf: *const nftnl_udata_buf) -> *mut nftnl_udata; + + pub fn nftnl_udata_put( + buf: *mut nftnl_udata_buf, + type_: u8, + len: u32, + value: *const c_void, + ) -> bool; + + pub fn nftnl_udata_put_u32(buf: *mut nftnl_udata_buf, type_: u8, data: u32) -> bool; + + pub fn nftnl_udata_put_strz(buf: *mut nftnl_udata_buf, type_: u8, strz: *const c_char) -> bool; + + pub fn nftnl_udata_nest_start(buf: *mut nftnl_udata_buf, type_: u8) -> *mut nftnl_udata; + + pub fn nftnl_udata_nest_end(buf: *mut nftnl_udata_buf, ud: *mut nftnl_udata); + + pub fn nftnl_udata_type(attr: *const nftnl_udata) -> u8; + + pub fn nftnl_udata_len(attr: *const nftnl_udata) -> u8; + + pub fn nftnl_udata_get(attr: *const nftnl_udata) -> *mut c_void; + + pub fn nftnl_udata_get_u32(attr: *const nftnl_udata) -> u32; + + pub fn nftnl_udata_next(attr: *const nftnl_udata) -> *mut nftnl_udata; +} +pub type nftnl_udata_cb_t = + Option c_int>; +extern "C" { + pub fn nftnl_udata_parse( + data: *const c_void, + data_len: u32, + cb: nftnl_udata_cb_t, + cb_data: *mut c_void, + ) -> c_int; +} diff --git a/nftnl-sys/src/nftnl_1_1_8.rs b/nftnl-sys/src/nftnl_1_1_8.rs new file mode 100644 index 0000000..7b2e1c3 --- /dev/null +++ b/nftnl-sys/src/nftnl_1_1_8.rs @@ -0,0 +1,1446 @@ +/* automatically generated by rust-bindgen 0.69.4 */ + +use core::option::Option; +use libc::{c_char, c_int, c_uint, c_void, iovec, nlmsghdr, FILE}; + +pub const NFTNL_UDATA_COMMENT_MAXLEN: u32 = 128; +#[repr(C)] +pub struct nftnl_batch(c_void); + +extern "C" { + pub fn nftnl_batch_alloc(pg_size: u32, pg_overrun_size: u32) -> *mut nftnl_batch; + + pub fn nftnl_batch_update(batch: *mut nftnl_batch) -> c_int; + + pub fn nftnl_batch_free(batch: *mut nftnl_batch); + + pub fn nftnl_batch_buffer(batch: *mut nftnl_batch) -> *mut c_void; + + pub fn nftnl_batch_buffer_len(batch: *mut nftnl_batch) -> u32; + + pub fn nftnl_batch_iovec_len(batch: *mut nftnl_batch) -> c_int; + + pub fn nftnl_batch_iovec(batch: *mut nftnl_batch, iov: *mut iovec, iovlen: u32); +} +pub const NFTNL_PARSE_EBADINPUT: u32 = 0; +pub const NFTNL_PARSE_EMISSINGNODE: u32 = 1; +pub const NFTNL_PARSE_EBADTYPE: u32 = 2; +pub const NFTNL_PARSE_EOPNOTSUPP: u32 = 3; + +pub const NFTNL_OUTPUT_DEFAULT: nftnl_output_type = 0; +pub const NFTNL_OUTPUT_XML: nftnl_output_type = 1; +pub const NFTNL_OUTPUT_JSON: nftnl_output_type = 2; +pub type nftnl_output_type = c_uint; +pub const NFTNL_OF_EVENT_NEW: nftnl_output_flags = 1; +pub const NFTNL_OF_EVENT_DEL: nftnl_output_flags = 2; +pub const NFTNL_OF_EVENT_ANY: nftnl_output_flags = 3; +pub type nftnl_output_flags = c_uint; +pub const NFTNL_CMD_UNSPEC: nftnl_cmd_type = 0; +pub const NFTNL_CMD_ADD: nftnl_cmd_type = 1; +pub const NFTNL_CMD_INSERT: nftnl_cmd_type = 2; +pub const NFTNL_CMD_DELETE: nftnl_cmd_type = 3; +pub const NFTNL_CMD_REPLACE: nftnl_cmd_type = 4; +pub const NFTNL_CMD_FLUSH: nftnl_cmd_type = 5; +pub const NFTNL_CMD_MAX: nftnl_cmd_type = 6; +pub type nftnl_cmd_type = c_uint; +pub const NFTNL_PARSE_NONE: nftnl_parse_type = 0; +pub const NFTNL_PARSE_XML: nftnl_parse_type = 1; +pub const NFTNL_PARSE_JSON: nftnl_parse_type = 2; +pub const NFTNL_PARSE_MAX: nftnl_parse_type = 3; +pub type nftnl_parse_type = c_uint; +#[repr(C)] +pub struct nftnl_parse_err(c_void); + +extern "C" { + pub fn nftnl_nlmsg_build_hdr( + buf: *mut c_char, + type_: u16, + family: u16, + flags: u16, + seq: u32, + ) -> *mut nlmsghdr; + + pub fn nftnl_parse_err_alloc() -> *mut nftnl_parse_err; + + pub fn nftnl_parse_err_free(arg1: *mut nftnl_parse_err); + + pub fn nftnl_parse_perror(str_: *const c_char, err: *mut nftnl_parse_err) -> c_int; + + pub fn nftnl_batch_is_supported() -> c_int; + + pub fn nftnl_batch_begin(buf: *mut c_char, seq: u32) -> *mut nlmsghdr; + + pub fn nftnl_batch_end(buf: *mut c_char, seq: u32) -> *mut nlmsghdr; +} +#[repr(C)] +pub struct nftnl_chain(c_void); + +#[repr(C)] +pub struct nftnl_rule(c_void); + +extern "C" { + pub fn nftnl_chain_alloc() -> *mut nftnl_chain; + + pub fn nftnl_chain_free(arg1: *const nftnl_chain); +} +pub const NFTNL_CHAIN_NAME: nftnl_chain_attr = 0; +pub const NFTNL_CHAIN_FAMILY: nftnl_chain_attr = 1; +pub const NFTNL_CHAIN_TABLE: nftnl_chain_attr = 2; +pub const NFTNL_CHAIN_HOOKNUM: nftnl_chain_attr = 3; +pub const NFTNL_CHAIN_PRIO: nftnl_chain_attr = 4; +pub const NFTNL_CHAIN_POLICY: nftnl_chain_attr = 5; +pub const NFTNL_CHAIN_USE: nftnl_chain_attr = 6; +pub const NFTNL_CHAIN_BYTES: nftnl_chain_attr = 7; +pub const NFTNL_CHAIN_PACKETS: nftnl_chain_attr = 8; +pub const NFTNL_CHAIN_HANDLE: nftnl_chain_attr = 9; +pub const NFTNL_CHAIN_TYPE: nftnl_chain_attr = 10; +pub const NFTNL_CHAIN_DEV: nftnl_chain_attr = 11; +pub const NFTNL_CHAIN_DEVICES: nftnl_chain_attr = 12; +pub const NFTNL_CHAIN_FLAGS: nftnl_chain_attr = 13; +pub const NFTNL_CHAIN_ID: nftnl_chain_attr = 14; +pub const NFTNL_CHAIN_USERDATA: nftnl_chain_attr = 15; +pub const __NFTNL_CHAIN_MAX: nftnl_chain_attr = 16; +pub type nftnl_chain_attr = c_uint; +extern "C" { + pub fn nftnl_chain_is_set(c: *const nftnl_chain, attr: u16) -> bool; + + pub fn nftnl_chain_unset(c: *mut nftnl_chain, attr: u16); + + pub fn nftnl_chain_set(t: *mut nftnl_chain, attr: u16, data: *const c_void); + + pub fn nftnl_chain_set_data( + t: *mut nftnl_chain, + attr: u16, + data: *const c_void, + data_len: u32, + ) -> c_int; + + pub fn nftnl_chain_set_u8(t: *mut nftnl_chain, attr: u16, data: u8); + + pub fn nftnl_chain_set_u32(t: *mut nftnl_chain, attr: u16, data: u32); + + pub fn nftnl_chain_set_s32(t: *mut nftnl_chain, attr: u16, data: i32); + + pub fn nftnl_chain_set_u64(t: *mut nftnl_chain, attr: u16, data: u64); + + pub fn nftnl_chain_set_str(t: *mut nftnl_chain, attr: u16, str_: *const c_char) -> c_int; + + pub fn nftnl_chain_set_array(t: *mut nftnl_chain, attr: u16, data: *mut *const c_char) + -> c_int; + + pub fn nftnl_chain_get(c: *const nftnl_chain, attr: u16) -> *const c_void; + + pub fn nftnl_chain_get_data( + c: *const nftnl_chain, + attr: u16, + data_len: *mut u32, + ) -> *const c_void; + + pub fn nftnl_chain_get_str(c: *const nftnl_chain, attr: u16) -> *const c_char; + + pub fn nftnl_chain_get_u8(c: *const nftnl_chain, attr: u16) -> u8; + + pub fn nftnl_chain_get_u32(c: *const nftnl_chain, attr: u16) -> u32; + + pub fn nftnl_chain_get_s32(c: *const nftnl_chain, attr: u16) -> i32; + + pub fn nftnl_chain_get_u64(c: *const nftnl_chain, attr: u16) -> u64; + + pub fn nftnl_chain_get_array(c: *const nftnl_chain, attr: u16) -> *const *const c_char; + + pub fn nftnl_chain_rule_add(rule: *mut nftnl_rule, c: *mut nftnl_chain); + + pub fn nftnl_chain_rule_del(rule: *mut nftnl_rule); + + pub fn nftnl_chain_rule_add_tail(rule: *mut nftnl_rule, c: *mut nftnl_chain); + + pub fn nftnl_chain_rule_insert_at(rule: *mut nftnl_rule, pos: *mut nftnl_rule); + + pub fn nftnl_chain_rule_append_at(rule: *mut nftnl_rule, pos: *mut nftnl_rule); + + pub fn nftnl_chain_nlmsg_build_payload(nlh: *mut nlmsghdr, t: *const nftnl_chain); + + pub fn nftnl_chain_parse( + c: *mut nftnl_chain, + type_: nftnl_parse_type, + data: *const c_char, + err: *mut nftnl_parse_err, + ) -> c_int; + + pub fn nftnl_chain_parse_file( + c: *mut nftnl_chain, + type_: nftnl_parse_type, + fp: *mut FILE, + err: *mut nftnl_parse_err, + ) -> c_int; + + pub fn nftnl_chain_snprintf( + buf: *mut c_char, + size: usize, + t: *const nftnl_chain, + type_: u32, + flags: u32, + ) -> c_int; + + pub fn nftnl_chain_fprintf( + fp: *mut FILE, + c: *const nftnl_chain, + type_: u32, + flags: u32, + ) -> c_int; + + pub fn nftnl_chain_nlmsg_parse(nlh: *const nlmsghdr, t: *mut nftnl_chain) -> c_int; + + pub fn nftnl_rule_foreach( + c: *mut nftnl_chain, + cb: Option c_int>, + data: *mut c_void, + ) -> c_int; + + pub fn nftnl_rule_lookup_byindex(c: *mut nftnl_chain, index: u32) -> *mut nftnl_rule; +} +#[repr(C)] +pub struct nftnl_rule_iter(c_void); + +extern "C" { + pub fn nftnl_rule_iter_create(c: *const nftnl_chain) -> *mut nftnl_rule_iter; + + pub fn nftnl_rule_iter_next(iter: *mut nftnl_rule_iter) -> *mut nftnl_rule; + + pub fn nftnl_rule_iter_destroy(iter: *mut nftnl_rule_iter); +} +#[repr(C)] +pub struct nftnl_chain_list(c_void); + +extern "C" { + pub fn nftnl_chain_list_alloc() -> *mut nftnl_chain_list; + + pub fn nftnl_chain_list_free(list: *mut nftnl_chain_list); + + pub fn nftnl_chain_list_is_empty(list: *const nftnl_chain_list) -> c_int; + + pub fn nftnl_chain_list_foreach( + chain_list: *mut nftnl_chain_list, + cb: Option c_int>, + data: *mut c_void, + ) -> c_int; + + pub fn nftnl_chain_list_lookup_byname( + chain_list: *mut nftnl_chain_list, + chain: *const c_char, + ) -> *mut nftnl_chain; + + pub fn nftnl_chain_list_add(r: *mut nftnl_chain, list: *mut nftnl_chain_list); + + pub fn nftnl_chain_list_add_tail(r: *mut nftnl_chain, list: *mut nftnl_chain_list); + + pub fn nftnl_chain_list_del(c: *mut nftnl_chain); +} +#[repr(C)] +pub struct nftnl_chain_list_iter(c_void); + +extern "C" { + pub fn nftnl_chain_list_iter_create(l: *const nftnl_chain_list) -> *mut nftnl_chain_list_iter; + + pub fn nftnl_chain_list_iter_next(iter: *mut nftnl_chain_list_iter) -> *mut nftnl_chain; + + pub fn nftnl_chain_list_iter_destroy(iter: *mut nftnl_chain_list_iter); +} +#[repr(C)] +pub struct nftnl_expr(c_void); + +pub const NFTNL_EXPR_NAME: u32 = 0; +pub const NFTNL_EXPR_BASE: u32 = 1; + +extern "C" { + pub fn nftnl_expr_alloc(name: *const c_char) -> *mut nftnl_expr; + + pub fn nftnl_expr_free(expr: *const nftnl_expr); + + pub fn nftnl_expr_is_set(expr: *const nftnl_expr, type_: u16) -> bool; + + pub fn nftnl_expr_set( + expr: *mut nftnl_expr, + type_: u16, + data: *const c_void, + data_len: u32, + ) -> c_int; + + pub fn nftnl_expr_set_u8(expr: *mut nftnl_expr, type_: u16, data: u8); + + pub fn nftnl_expr_set_u16(expr: *mut nftnl_expr, type_: u16, data: u16); + + pub fn nftnl_expr_set_u32(expr: *mut nftnl_expr, type_: u16, data: u32); + + pub fn nftnl_expr_set_u64(expr: *mut nftnl_expr, type_: u16, data: u64); + + pub fn nftnl_expr_set_str(expr: *mut nftnl_expr, type_: u16, str_: *const c_char) -> c_int; + + pub fn nftnl_expr_get(expr: *const nftnl_expr, type_: u16, data_len: *mut u32) + -> *const c_void; + + pub fn nftnl_expr_get_u8(expr: *const nftnl_expr, type_: u16) -> u8; + + pub fn nftnl_expr_get_u16(expr: *const nftnl_expr, type_: u16) -> u16; + + pub fn nftnl_expr_get_u32(expr: *const nftnl_expr, type_: u16) -> u32; + + pub fn nftnl_expr_get_u64(expr: *const nftnl_expr, type_: u16) -> u64; + + pub fn nftnl_expr_get_str(expr: *const nftnl_expr, type_: u16) -> *const c_char; + + pub fn nftnl_expr_build_payload(nlh: *mut nlmsghdr, expr: *mut nftnl_expr); + + pub fn nftnl_expr_snprintf( + buf: *mut c_char, + buflen: usize, + expr: *const nftnl_expr, + type_: u32, + flags: u32, + ) -> c_int; + + pub fn nftnl_expr_fprintf( + fp: *mut FILE, + expr: *const nftnl_expr, + type_: u32, + flags: u32, + ) -> c_int; +} +pub const NFTNL_EXPR_PAYLOAD_DREG: u32 = 1; +pub const NFTNL_EXPR_PAYLOAD_BASE: u32 = 2; +pub const NFTNL_EXPR_PAYLOAD_OFFSET: u32 = 3; +pub const NFTNL_EXPR_PAYLOAD_LEN: u32 = 4; +pub const NFTNL_EXPR_PAYLOAD_SREG: u32 = 5; +pub const NFTNL_EXPR_PAYLOAD_CSUM_TYPE: u32 = 6; +pub const NFTNL_EXPR_PAYLOAD_CSUM_OFFSET: u32 = 7; +pub const NFTNL_EXPR_PAYLOAD_FLAGS: u32 = 8; + +pub const NFTNL_EXPR_NG_DREG: u32 = 1; +pub const NFTNL_EXPR_NG_MODULUS: u32 = 2; +pub const NFTNL_EXPR_NG_TYPE: u32 = 3; +pub const NFTNL_EXPR_NG_OFFSET: u32 = 4; +pub const NFTNL_EXPR_NG_SET_NAME: u32 = 5; +pub const NFTNL_EXPR_NG_SET_ID: u32 = 6; + +pub const NFTNL_EXPR_META_KEY: u32 = 1; +pub const NFTNL_EXPR_META_DREG: u32 = 2; +pub const NFTNL_EXPR_META_SREG: u32 = 3; + +pub const NFTNL_EXPR_RT_KEY: u32 = 1; +pub const NFTNL_EXPR_RT_DREG: u32 = 2; + +pub const NFTNL_EXPR_SOCKET_KEY: u32 = 1; +pub const NFTNL_EXPR_SOCKET_DREG: u32 = 2; + +pub const NFTNL_EXPR_TUNNEL_KEY: u32 = 1; +pub const NFTNL_EXPR_TUNNEL_DREG: u32 = 2; + +pub const NFTNL_EXPR_CMP_SREG: u32 = 1; +pub const NFTNL_EXPR_CMP_OP: u32 = 2; +pub const NFTNL_EXPR_CMP_DATA: u32 = 3; + +pub const NFTNL_EXPR_RANGE_SREG: u32 = 1; +pub const NFTNL_EXPR_RANGE_OP: u32 = 2; +pub const NFTNL_EXPR_RANGE_FROM_DATA: u32 = 3; +pub const NFTNL_EXPR_RANGE_TO_DATA: u32 = 4; + +pub const NFTNL_EXPR_IMM_DREG: u32 = 1; +pub const NFTNL_EXPR_IMM_DATA: u32 = 2; +pub const NFTNL_EXPR_IMM_VERDICT: u32 = 3; +pub const NFTNL_EXPR_IMM_CHAIN: u32 = 4; +pub const NFTNL_EXPR_IMM_CHAIN_ID: u32 = 5; + +pub const NFTNL_EXPR_CTR_PACKETS: u32 = 1; +pub const NFTNL_EXPR_CTR_BYTES: u32 = 2; + +pub const NFTNL_EXPR_CONNLIMIT_COUNT: u32 = 1; +pub const NFTNL_EXPR_CONNLIMIT_FLAGS: u32 = 2; + +pub const NFTNL_EXPR_BITWISE_SREG: u32 = 1; +pub const NFTNL_EXPR_BITWISE_DREG: u32 = 2; +pub const NFTNL_EXPR_BITWISE_LEN: u32 = 3; +pub const NFTNL_EXPR_BITWISE_MASK: u32 = 4; +pub const NFTNL_EXPR_BITWISE_XOR: u32 = 5; +pub const NFTNL_EXPR_BITWISE_OP: u32 = 6; +pub const NFTNL_EXPR_BITWISE_DATA: u32 = 7; + +pub const NFTNL_EXPR_TG_NAME: u32 = 1; +pub const NFTNL_EXPR_TG_REV: u32 = 2; +pub const NFTNL_EXPR_TG_INFO: u32 = 3; + +pub const NFTNL_EXPR_MT_NAME: u32 = 1; +pub const NFTNL_EXPR_MT_REV: u32 = 2; +pub const NFTNL_EXPR_MT_INFO: u32 = 3; + +pub const NFTNL_EXPR_NAT_TYPE: u32 = 1; +pub const NFTNL_EXPR_NAT_FAMILY: u32 = 2; +pub const NFTNL_EXPR_NAT_REG_ADDR_MIN: u32 = 3; +pub const NFTNL_EXPR_NAT_REG_ADDR_MAX: u32 = 4; +pub const NFTNL_EXPR_NAT_REG_PROTO_MIN: u32 = 5; +pub const NFTNL_EXPR_NAT_REG_PROTO_MAX: u32 = 6; +pub const NFTNL_EXPR_NAT_FLAGS: u32 = 7; + +pub const NFTNL_EXPR_TPROXY_FAMILY: u32 = 1; +pub const NFTNL_EXPR_TPROXY_REG_ADDR: u32 = 2; +pub const NFTNL_EXPR_TPROXY_REG_PORT: u32 = 3; + +pub const NFTNL_EXPR_LOOKUP_SREG: u32 = 1; +pub const NFTNL_EXPR_LOOKUP_DREG: u32 = 2; +pub const NFTNL_EXPR_LOOKUP_SET: u32 = 3; +pub const NFTNL_EXPR_LOOKUP_SET_ID: u32 = 4; +pub const NFTNL_EXPR_LOOKUP_FLAGS: u32 = 5; + +pub const NFTNL_EXPR_DYNSET_SREG_KEY: u32 = 1; +pub const NFTNL_EXPR_DYNSET_SREG_DATA: u32 = 2; +pub const NFTNL_EXPR_DYNSET_OP: u32 = 3; +pub const NFTNL_EXPR_DYNSET_TIMEOUT: u32 = 4; +pub const NFTNL_EXPR_DYNSET_SET_NAME: u32 = 5; +pub const NFTNL_EXPR_DYNSET_SET_ID: u32 = 6; +pub const NFTNL_EXPR_DYNSET_EXPR: u32 = 7; + +pub const NFTNL_EXPR_LOG_PREFIX: u32 = 1; +pub const NFTNL_EXPR_LOG_GROUP: u32 = 2; +pub const NFTNL_EXPR_LOG_SNAPLEN: u32 = 3; +pub const NFTNL_EXPR_LOG_QTHRESHOLD: u32 = 4; +pub const NFTNL_EXPR_LOG_LEVEL: u32 = 5; +pub const NFTNL_EXPR_LOG_FLAGS: u32 = 6; + +pub const NFTNL_EXPR_EXTHDR_DREG: u32 = 1; +pub const NFTNL_EXPR_EXTHDR_TYPE: u32 = 2; +pub const NFTNL_EXPR_EXTHDR_OFFSET: u32 = 3; +pub const NFTNL_EXPR_EXTHDR_LEN: u32 = 4; +pub const NFTNL_EXPR_EXTHDR_FLAGS: u32 = 5; +pub const NFTNL_EXPR_EXTHDR_OP: u32 = 6; +pub const NFTNL_EXPR_EXTHDR_SREG: u32 = 7; + +pub const NFTNL_EXPR_CT_DREG: u32 = 1; +pub const NFTNL_EXPR_CT_KEY: u32 = 2; +pub const NFTNL_EXPR_CT_DIR: u32 = 3; +pub const NFTNL_EXPR_CT_SREG: u32 = 4; + +pub const NFTNL_EXPR_BYTEORDER_DREG: u32 = 1; +pub const NFTNL_EXPR_BYTEORDER_SREG: u32 = 2; +pub const NFTNL_EXPR_BYTEORDER_OP: u32 = 3; +pub const NFTNL_EXPR_BYTEORDER_LEN: u32 = 4; +pub const NFTNL_EXPR_BYTEORDER_SIZE: u32 = 5; + +pub const NFTNL_EXPR_LIMIT_RATE: u32 = 1; +pub const NFTNL_EXPR_LIMIT_UNIT: u32 = 2; +pub const NFTNL_EXPR_LIMIT_BURST: u32 = 3; +pub const NFTNL_EXPR_LIMIT_TYPE: u32 = 4; +pub const NFTNL_EXPR_LIMIT_FLAGS: u32 = 5; + +pub const NFTNL_EXPR_REJECT_TYPE: u32 = 1; +pub const NFTNL_EXPR_REJECT_CODE: u32 = 2; + +pub const NFTNL_EXPR_QUEUE_NUM: u32 = 1; +pub const NFTNL_EXPR_QUEUE_TOTAL: u32 = 2; +pub const NFTNL_EXPR_QUEUE_FLAGS: u32 = 3; +pub const NFTNL_EXPR_QUEUE_SREG_QNUM: u32 = 4; + +pub const NFTNL_EXPR_QUOTA_BYTES: u32 = 1; +pub const NFTNL_EXPR_QUOTA_FLAGS: u32 = 2; +pub const NFTNL_EXPR_QUOTA_CONSUMED: u32 = 3; + +pub const NFTNL_EXPR_MASQ_FLAGS: u32 = 1; +pub const NFTNL_EXPR_MASQ_REG_PROTO_MIN: u32 = 2; +pub const NFTNL_EXPR_MASQ_REG_PROTO_MAX: u32 = 3; + +pub const NFTNL_EXPR_REDIR_REG_PROTO_MIN: u32 = 1; +pub const NFTNL_EXPR_REDIR_REG_PROTO_MAX: u32 = 2; +pub const NFTNL_EXPR_REDIR_FLAGS: u32 = 3; + +pub const NFTNL_EXPR_DUP_SREG_ADDR: u32 = 1; +pub const NFTNL_EXPR_DUP_SREG_DEV: u32 = 2; + +pub const NFTNL_EXPR_FLOW_TABLE_NAME: u32 = 1; + +pub const NFTNL_EXPR_FWD_SREG_DEV: u32 = 1; +pub const NFTNL_EXPR_FWD_SREG_ADDR: u32 = 2; +pub const NFTNL_EXPR_FWD_NFPROTO: u32 = 3; + +pub const NFTNL_EXPR_HASH_SREG: u32 = 1; +pub const NFTNL_EXPR_HASH_DREG: u32 = 2; +pub const NFTNL_EXPR_HASH_LEN: u32 = 3; +pub const NFTNL_EXPR_HASH_MODULUS: u32 = 4; +pub const NFTNL_EXPR_HASH_SEED: u32 = 5; +pub const NFTNL_EXPR_HASH_OFFSET: u32 = 6; +pub const NFTNL_EXPR_HASH_TYPE: u32 = 7; +pub const NFTNL_EXPR_HASH_SET_NAME: u32 = 8; +pub const NFTNL_EXPR_HASH_SET_ID: u32 = 9; + +pub const NFTNL_EXPR_FIB_DREG: u32 = 1; +pub const NFTNL_EXPR_FIB_RESULT: u32 = 2; +pub const NFTNL_EXPR_FIB_FLAGS: u32 = 3; + +pub const NFTNL_EXPR_OBJREF_IMM_TYPE: u32 = 1; +pub const NFTNL_EXPR_OBJREF_IMM_NAME: u32 = 2; +pub const NFTNL_EXPR_OBJREF_SET_SREG: u32 = 3; +pub const NFTNL_EXPR_OBJREF_SET_NAME: u32 = 4; +pub const NFTNL_EXPR_OBJREF_SET_ID: u32 = 5; + +pub const NFTNL_EXPR_OSF_DREG: u32 = 1; +pub const NFTNL_EXPR_OSF_TTL: u32 = 2; +pub const NFTNL_EXPR_OSF_FLAGS: u32 = 3; + +pub const NFTNL_EXPR_XFRM_DREG: u32 = 1; +pub const NFTNL_EXPR_XFRM_SREG: u32 = 2; +pub const NFTNL_EXPR_XFRM_KEY: u32 = 3; +pub const NFTNL_EXPR_XFRM_DIR: u32 = 4; +pub const NFTNL_EXPR_XFRM_SPNUM: u32 = 5; + +pub const NFTNL_EXPR_SYNPROXY_MSS: u32 = 1; +pub const NFTNL_EXPR_SYNPROXY_WSCALE: u32 = 2; +pub const NFTNL_EXPR_SYNPROXY_FLAGS: u32 = 3; + +#[repr(C)] +pub struct nftnl_gen(c_void); + +extern "C" { + pub fn nftnl_gen_alloc() -> *mut nftnl_gen; + + pub fn nftnl_gen_free(arg1: *const nftnl_gen); +} +pub const NFTNL_GEN_ID: u32 = 0; +pub const __NFTNL_GEN_MAX: u32 = 1; + +extern "C" { + pub fn nftnl_gen_is_set(gen: *const nftnl_gen, attr: u16) -> bool; + + pub fn nftnl_gen_unset(gen: *mut nftnl_gen, attr: u16); + + pub fn nftnl_gen_set(gen: *mut nftnl_gen, attr: u16, data: *const c_void) -> c_int; + + pub fn nftnl_gen_set_data( + gen: *mut nftnl_gen, + attr: u16, + data: *const c_void, + data_len: u32, + ) -> c_int; + + pub fn nftnl_gen_get(gen: *const nftnl_gen, attr: u16) -> *const c_void; + + pub fn nftnl_gen_get_data( + gen: *const nftnl_gen, + attr: u16, + data_len: *mut u32, + ) -> *const c_void; + + pub fn nftnl_gen_set_u32(gen: *mut nftnl_gen, attr: u16, data: u32); + + pub fn nftnl_gen_get_u32(gen: *const nftnl_gen, attr: u16) -> u32; + + pub fn nftnl_gen_nlmsg_parse(nlh: *const nlmsghdr, gen: *mut nftnl_gen) -> c_int; + + pub fn nftnl_gen_snprintf( + buf: *mut c_char, + size: usize, + gen: *const nftnl_gen, + type_: u32, + flags: u32, + ) -> c_int; + + pub fn nftnl_gen_fprintf(fp: *mut FILE, gen: *const nftnl_gen, type_: u32, flags: u32) + -> c_int; +} +pub const NFTNL_OBJ_TABLE: u32 = 0; +pub const NFTNL_OBJ_NAME: u32 = 1; +pub const NFTNL_OBJ_TYPE: u32 = 2; +pub const NFTNL_OBJ_FAMILY: u32 = 3; +pub const NFTNL_OBJ_USE: u32 = 4; +pub const NFTNL_OBJ_HANDLE: u32 = 5; +pub const NFTNL_OBJ_USERDATA: u32 = 6; +pub const NFTNL_OBJ_BASE: u32 = 16; +pub const __NFTNL_OBJ_MAX: u32 = 17; + +pub const NFTNL_OBJ_CTR_PKTS: u32 = 16; +pub const NFTNL_OBJ_CTR_BYTES: u32 = 17; + +pub const NFTNL_OBJ_QUOTA_BYTES: u32 = 16; +pub const NFTNL_OBJ_QUOTA_CONSUMED: u32 = 17; +pub const NFTNL_OBJ_QUOTA_FLAGS: u32 = 18; + +pub const NFTNL_OBJ_CT_HELPER_NAME: u32 = 16; +pub const NFTNL_OBJ_CT_HELPER_L3PROTO: u32 = 17; +pub const NFTNL_OBJ_CT_HELPER_L4PROTO: u32 = 18; + +pub const NFTNL_CTTIMEOUT_TCP_SYN_SENT: nftnl_cttimeout_array_tcp = 0; +pub const NFTNL_CTTIMEOUT_TCP_SYN_RECV: nftnl_cttimeout_array_tcp = 1; +pub const NFTNL_CTTIMEOUT_TCP_ESTABLISHED: nftnl_cttimeout_array_tcp = 2; +pub const NFTNL_CTTIMEOUT_TCP_FIN_WAIT: nftnl_cttimeout_array_tcp = 3; +pub const NFTNL_CTTIMEOUT_TCP_CLOSE_WAIT: nftnl_cttimeout_array_tcp = 4; +pub const NFTNL_CTTIMEOUT_TCP_LAST_ACK: nftnl_cttimeout_array_tcp = 5; +pub const NFTNL_CTTIMEOUT_TCP_TIME_WAIT: nftnl_cttimeout_array_tcp = 6; +pub const NFTNL_CTTIMEOUT_TCP_CLOSE: nftnl_cttimeout_array_tcp = 7; +pub const NFTNL_CTTIMEOUT_TCP_SYN_SENT2: nftnl_cttimeout_array_tcp = 8; +pub const NFTNL_CTTIMEOUT_TCP_RETRANS: nftnl_cttimeout_array_tcp = 9; +pub const NFTNL_CTTIMEOUT_TCP_UNACK: nftnl_cttimeout_array_tcp = 10; +pub const NFTNL_CTTIMEOUT_TCP_MAX: nftnl_cttimeout_array_tcp = 11; +pub type nftnl_cttimeout_array_tcp = c_uint; +pub const NFTNL_CTTIMEOUT_UDP_UNREPLIED: nftnl_cttimeout_array_udp = 0; +pub const NFTNL_CTTIMEOUT_UDP_REPLIED: nftnl_cttimeout_array_udp = 1; +pub const NFTNL_CTTIMEOUT_UDP_MAX: nftnl_cttimeout_array_udp = 2; +pub type nftnl_cttimeout_array_udp = c_uint; +pub const NFTNL_OBJ_CT_TIMEOUT_L3PROTO: u32 = 16; +pub const NFTNL_OBJ_CT_TIMEOUT_L4PROTO: u32 = 17; +pub const NFTNL_OBJ_CT_TIMEOUT_ARRAY: u32 = 18; + +pub const NFTNL_OBJ_CT_EXPECT_L3PROTO: u32 = 16; +pub const NFTNL_OBJ_CT_EXPECT_L4PROTO: u32 = 17; +pub const NFTNL_OBJ_CT_EXPECT_DPORT: u32 = 18; +pub const NFTNL_OBJ_CT_EXPECT_TIMEOUT: u32 = 19; +pub const NFTNL_OBJ_CT_EXPECT_SIZE: u32 = 20; + +pub const NFTNL_OBJ_LIMIT_RATE: u32 = 16; +pub const NFTNL_OBJ_LIMIT_UNIT: u32 = 17; +pub const NFTNL_OBJ_LIMIT_BURST: u32 = 18; +pub const NFTNL_OBJ_LIMIT_TYPE: u32 = 19; +pub const NFTNL_OBJ_LIMIT_FLAGS: u32 = 20; + +pub const NFTNL_OBJ_SYNPROXY_MSS: u32 = 16; +pub const NFTNL_OBJ_SYNPROXY_WSCALE: u32 = 17; +pub const NFTNL_OBJ_SYNPROXY_FLAGS: u32 = 18; + +pub const NFTNL_OBJ_TUNNEL_ID: u32 = 16; +pub const NFTNL_OBJ_TUNNEL_IPV4_SRC: u32 = 17; +pub const NFTNL_OBJ_TUNNEL_IPV4_DST: u32 = 18; +pub const NFTNL_OBJ_TUNNEL_IPV6_SRC: u32 = 19; +pub const NFTNL_OBJ_TUNNEL_IPV6_DST: u32 = 20; +pub const NFTNL_OBJ_TUNNEL_IPV6_FLOWLABEL: u32 = 21; +pub const NFTNL_OBJ_TUNNEL_SPORT: u32 = 22; +pub const NFTNL_OBJ_TUNNEL_DPORT: u32 = 23; +pub const NFTNL_OBJ_TUNNEL_FLAGS: u32 = 24; +pub const NFTNL_OBJ_TUNNEL_TOS: u32 = 25; +pub const NFTNL_OBJ_TUNNEL_TTL: u32 = 26; +pub const NFTNL_OBJ_TUNNEL_VXLAN_GBP: u32 = 27; +pub const NFTNL_OBJ_TUNNEL_ERSPAN_VERSION: u32 = 28; +pub const NFTNL_OBJ_TUNNEL_ERSPAN_V1_INDEX: u32 = 29; +pub const NFTNL_OBJ_TUNNEL_ERSPAN_V2_HWID: u32 = 30; +pub const NFTNL_OBJ_TUNNEL_ERSPAN_V2_DIR: u32 = 31; + +pub const NFTNL_OBJ_SECMARK_CTX: u32 = 16; + +#[repr(C)] +pub struct nftnl_obj(c_void); + +extern "C" { + pub fn nftnl_obj_alloc() -> *mut nftnl_obj; + + pub fn nftnl_obj_free(ne: *const nftnl_obj); + + pub fn nftnl_obj_is_set(ne: *const nftnl_obj, attr: u16) -> bool; + + pub fn nftnl_obj_unset(ne: *mut nftnl_obj, attr: u16); + + pub fn nftnl_obj_set_data(ne: *mut nftnl_obj, attr: u16, data: *const c_void, data_len: u32); + + pub fn nftnl_obj_set(ne: *mut nftnl_obj, attr: u16, data: *const c_void); + + pub fn nftnl_obj_set_u8(ne: *mut nftnl_obj, attr: u16, val: u8); + + pub fn nftnl_obj_set_u16(ne: *mut nftnl_obj, attr: u16, val: u16); + + pub fn nftnl_obj_set_u32(ne: *mut nftnl_obj, attr: u16, val: u32); + + pub fn nftnl_obj_set_u64(obj: *mut nftnl_obj, attr: u16, val: u64); + + pub fn nftnl_obj_set_str(ne: *mut nftnl_obj, attr: u16, str_: *const c_char); + + pub fn nftnl_obj_get_data(ne: *mut nftnl_obj, attr: u16, data_len: *mut u32) -> *const c_void; + + pub fn nftnl_obj_get(ne: *mut nftnl_obj, attr: u16) -> *const c_void; + + pub fn nftnl_obj_get_u8(ne: *mut nftnl_obj, attr: u16) -> u8; + + pub fn nftnl_obj_get_u16(obj: *mut nftnl_obj, attr: u16) -> u16; + + pub fn nftnl_obj_get_u32(ne: *mut nftnl_obj, attr: u16) -> u32; + + pub fn nftnl_obj_get_u64(obj: *mut nftnl_obj, attr: u16) -> u64; + + pub fn nftnl_obj_get_str(ne: *mut nftnl_obj, attr: u16) -> *const c_char; + + pub fn nftnl_obj_nlmsg_build_payload(nlh: *mut nlmsghdr, ne: *const nftnl_obj); + + pub fn nftnl_obj_nlmsg_parse(nlh: *const nlmsghdr, ne: *mut nftnl_obj) -> c_int; + + pub fn nftnl_obj_parse( + ne: *mut nftnl_obj, + type_: nftnl_parse_type, + data: *const c_char, + err: *mut nftnl_parse_err, + ) -> c_int; + + pub fn nftnl_obj_parse_file( + ne: *mut nftnl_obj, + type_: nftnl_parse_type, + fp: *mut FILE, + err: *mut nftnl_parse_err, + ) -> c_int; + + pub fn nftnl_obj_snprintf( + buf: *mut c_char, + size: usize, + ne: *const nftnl_obj, + type_: u32, + flags: u32, + ) -> c_int; + + pub fn nftnl_obj_fprintf(fp: *mut FILE, ne: *const nftnl_obj, type_: u32, flags: u32) -> c_int; +} +#[repr(C)] +pub struct nftnl_obj_list(c_void); + +extern "C" { + pub fn nftnl_obj_list_alloc() -> *mut nftnl_obj_list; + + pub fn nftnl_obj_list_free(list: *mut nftnl_obj_list); + + pub fn nftnl_obj_list_is_empty(list: *mut nftnl_obj_list) -> c_int; + + pub fn nftnl_obj_list_add(r: *mut nftnl_obj, list: *mut nftnl_obj_list); + + pub fn nftnl_obj_list_add_tail(r: *mut nftnl_obj, list: *mut nftnl_obj_list); + + pub fn nftnl_obj_list_del(t: *mut nftnl_obj); + + pub fn nftnl_obj_list_foreach( + table_list: *mut nftnl_obj_list, + cb: Option c_int>, + data: *mut c_void, + ) -> c_int; +} +#[repr(C)] +pub struct nftnl_obj_list_iter(c_void); + +extern "C" { + pub fn nftnl_obj_list_iter_create(l: *mut nftnl_obj_list) -> *mut nftnl_obj_list_iter; + + pub fn nftnl_obj_list_iter_next(iter: *mut nftnl_obj_list_iter) -> *mut nftnl_obj; + + pub fn nftnl_obj_list_iter_destroy(iter: *mut nftnl_obj_list_iter); + + pub fn nftnl_rule_alloc() -> *mut nftnl_rule; + + pub fn nftnl_rule_free(arg1: *const nftnl_rule); +} +pub const NFTNL_RULE_FAMILY: nftnl_rule_attr = 0; +pub const NFTNL_RULE_TABLE: nftnl_rule_attr = 1; +pub const NFTNL_RULE_CHAIN: nftnl_rule_attr = 2; +pub const NFTNL_RULE_HANDLE: nftnl_rule_attr = 3; +pub const NFTNL_RULE_COMPAT_PROTO: nftnl_rule_attr = 4; +pub const NFTNL_RULE_COMPAT_FLAGS: nftnl_rule_attr = 5; +pub const NFTNL_RULE_POSITION: nftnl_rule_attr = 6; +pub const NFTNL_RULE_USERDATA: nftnl_rule_attr = 7; +pub const NFTNL_RULE_ID: nftnl_rule_attr = 8; +pub const NFTNL_RULE_POSITION_ID: nftnl_rule_attr = 9; +pub const __NFTNL_RULE_MAX: nftnl_rule_attr = 10; +pub type nftnl_rule_attr = c_uint; +extern "C" { + pub fn nftnl_rule_unset(r: *mut nftnl_rule, attr: u16); + + pub fn nftnl_rule_is_set(r: *const nftnl_rule, attr: u16) -> bool; + + pub fn nftnl_rule_set(r: *mut nftnl_rule, attr: u16, data: *const c_void) -> c_int; + + pub fn nftnl_rule_set_data( + r: *mut nftnl_rule, + attr: u16, + data: *const c_void, + data_len: u32, + ) -> c_int; + + pub fn nftnl_rule_set_u32(r: *mut nftnl_rule, attr: u16, val: u32); + + pub fn nftnl_rule_set_u64(r: *mut nftnl_rule, attr: u16, val: u64); + + pub fn nftnl_rule_set_str(r: *mut nftnl_rule, attr: u16, str_: *const c_char) -> c_int; + + pub fn nftnl_rule_get(r: *const nftnl_rule, attr: u16) -> *const c_void; + + pub fn nftnl_rule_get_data( + r: *const nftnl_rule, + attr: u16, + data_len: *mut u32, + ) -> *const c_void; + + pub fn nftnl_rule_get_str(r: *const nftnl_rule, attr: u16) -> *const c_char; + + pub fn nftnl_rule_get_u8(r: *const nftnl_rule, attr: u16) -> u8; + + pub fn nftnl_rule_get_u32(r: *const nftnl_rule, attr: u16) -> u32; + + pub fn nftnl_rule_get_u64(r: *const nftnl_rule, attr: u16) -> u64; + + pub fn nftnl_rule_add_expr(r: *mut nftnl_rule, expr: *mut nftnl_expr); + + pub fn nftnl_rule_del_expr(expr: *mut nftnl_expr); + + pub fn nftnl_rule_nlmsg_build_payload(nlh: *mut nlmsghdr, t: *mut nftnl_rule); + + pub fn nftnl_rule_parse( + r: *mut nftnl_rule, + type_: nftnl_parse_type, + data: *const c_char, + err: *mut nftnl_parse_err, + ) -> c_int; + + pub fn nftnl_rule_parse_file( + r: *mut nftnl_rule, + type_: nftnl_parse_type, + fp: *mut FILE, + err: *mut nftnl_parse_err, + ) -> c_int; + + pub fn nftnl_rule_snprintf( + buf: *mut c_char, + size: usize, + t: *const nftnl_rule, + type_: u32, + flags: u32, + ) -> c_int; + + pub fn nftnl_rule_fprintf(fp: *mut FILE, r: *const nftnl_rule, type_: u32, flags: u32) + -> c_int; + + pub fn nftnl_rule_nlmsg_parse(nlh: *const nlmsghdr, t: *mut nftnl_rule) -> c_int; + + pub fn nftnl_expr_foreach( + r: *mut nftnl_rule, + cb: Option c_int>, + data: *mut c_void, + ) -> c_int; +} +#[repr(C)] +pub struct nftnl_expr_iter(c_void); + +extern "C" { + pub fn nftnl_expr_iter_create(r: *const nftnl_rule) -> *mut nftnl_expr_iter; + + pub fn nftnl_expr_iter_next(iter: *mut nftnl_expr_iter) -> *mut nftnl_expr; + + pub fn nftnl_expr_iter_destroy(iter: *mut nftnl_expr_iter); +} +#[repr(C)] +pub struct nftnl_rule_list(c_void); + +extern "C" { + pub fn nftnl_rule_list_alloc() -> *mut nftnl_rule_list; + + pub fn nftnl_rule_list_free(list: *mut nftnl_rule_list); + + pub fn nftnl_rule_list_is_empty(list: *const nftnl_rule_list) -> c_int; + + pub fn nftnl_rule_list_add(r: *mut nftnl_rule, list: *mut nftnl_rule_list); + + pub fn nftnl_rule_list_add_tail(r: *mut nftnl_rule, list: *mut nftnl_rule_list); + + pub fn nftnl_rule_list_insert_at(r: *mut nftnl_rule, pos: *mut nftnl_rule); + + pub fn nftnl_rule_list_del(r: *mut nftnl_rule); + + pub fn nftnl_rule_list_foreach( + rule_list: *mut nftnl_rule_list, + cb: Option c_int>, + data: *mut c_void, + ) -> c_int; +} +#[repr(C)] +pub struct nftnl_rule_list_iter(c_void); + +extern "C" { + pub fn nftnl_rule_list_iter_create(l: *const nftnl_rule_list) -> *mut nftnl_rule_list_iter; + + pub fn nftnl_rule_list_iter_cur(iter: *mut nftnl_rule_list_iter) -> *mut nftnl_rule; + + pub fn nftnl_rule_list_iter_next(iter: *mut nftnl_rule_list_iter) -> *mut nftnl_rule; + + pub fn nftnl_rule_list_iter_destroy(iter: *const nftnl_rule_list_iter); +} +#[repr(C)] +pub struct nftnl_ruleset(c_void); + +extern "C" { + pub fn nftnl_ruleset_alloc() -> *mut nftnl_ruleset; + + pub fn nftnl_ruleset_free(r: *const nftnl_ruleset); +} +pub const NFTNL_RULESET_TABLELIST: u32 = 0; +pub const NFTNL_RULESET_CHAINLIST: u32 = 1; +pub const NFTNL_RULESET_SETLIST: u32 = 2; +pub const NFTNL_RULESET_RULELIST: u32 = 3; + +pub const NFTNL_RULESET_UNSPEC: nftnl_ruleset_type = 0; +pub const NFTNL_RULESET_RULESET: nftnl_ruleset_type = 1; +pub const NFTNL_RULESET_TABLE: nftnl_ruleset_type = 2; +pub const NFTNL_RULESET_CHAIN: nftnl_ruleset_type = 3; +pub const NFTNL_RULESET_RULE: nftnl_ruleset_type = 4; +pub const NFTNL_RULESET_SET: nftnl_ruleset_type = 5; +pub const NFTNL_RULESET_SET_ELEMS: nftnl_ruleset_type = 6; +pub type nftnl_ruleset_type = c_uint; +extern "C" { + pub fn nftnl_ruleset_is_set(r: *const nftnl_ruleset, attr: u16) -> bool; + + pub fn nftnl_ruleset_unset(r: *mut nftnl_ruleset, attr: u16); + + pub fn nftnl_ruleset_set(r: *mut nftnl_ruleset, attr: u16, data: *mut c_void); + + pub fn nftnl_ruleset_get(r: *const nftnl_ruleset, attr: u16) -> *mut c_void; +} +pub const NFTNL_RULESET_CTX_CMD: u32 = 0; +pub const NFTNL_RULESET_CTX_TYPE: u32 = 1; +pub const NFTNL_RULESET_CTX_TABLE: u32 = 2; +pub const NFTNL_RULESET_CTX_CHAIN: u32 = 3; +pub const NFTNL_RULESET_CTX_RULE: u32 = 4; +pub const NFTNL_RULESET_CTX_SET: u32 = 5; +pub const NFTNL_RULESET_CTX_DATA: u32 = 6; + +#[repr(C)] +pub struct nftnl_parse_ctx(c_void); + +extern "C" { + pub fn nftnl_ruleset_ctx_free(ctx: *const nftnl_parse_ctx); + + pub fn nftnl_ruleset_ctx_is_set(ctx: *const nftnl_parse_ctx, attr: u16) -> bool; + + pub fn nftnl_ruleset_ctx_get(ctx: *const nftnl_parse_ctx, attr: u16) -> *mut c_void; + + pub fn nftnl_ruleset_ctx_get_u32(ctx: *const nftnl_parse_ctx, attr: u16) -> u32; + + pub fn nftnl_ruleset_parse_file_cb( + type_: nftnl_parse_type, + fp: *mut FILE, + err: *mut nftnl_parse_err, + data: *mut c_void, + cb: Option c_int>, + ) -> c_int; + + pub fn nftnl_ruleset_parse_buffer_cb( + type_: nftnl_parse_type, + buffer: *const c_char, + err: *mut nftnl_parse_err, + data: *mut c_void, + cb: Option c_int>, + ) -> c_int; + + pub fn nftnl_ruleset_parse( + rs: *mut nftnl_ruleset, + type_: nftnl_parse_type, + data: *const c_char, + err: *mut nftnl_parse_err, + ) -> c_int; + + pub fn nftnl_ruleset_parse_file( + rs: *mut nftnl_ruleset, + type_: nftnl_parse_type, + fp: *mut FILE, + err: *mut nftnl_parse_err, + ) -> c_int; + + pub fn nftnl_ruleset_snprintf( + buf: *mut c_char, + size: usize, + rs: *const nftnl_ruleset, + type_: u32, + flags: u32, + ) -> c_int; + + pub fn nftnl_ruleset_fprintf( + fp: *mut FILE, + rs: *const nftnl_ruleset, + type_: u32, + flags: u32, + ) -> c_int; +} +pub const NFTNL_SET_TABLE: nftnl_set_attr = 0; +pub const NFTNL_SET_NAME: nftnl_set_attr = 1; +pub const NFTNL_SET_FLAGS: nftnl_set_attr = 2; +pub const NFTNL_SET_KEY_TYPE: nftnl_set_attr = 3; +pub const NFTNL_SET_KEY_LEN: nftnl_set_attr = 4; +pub const NFTNL_SET_DATA_TYPE: nftnl_set_attr = 5; +pub const NFTNL_SET_DATA_LEN: nftnl_set_attr = 6; +pub const NFTNL_SET_FAMILY: nftnl_set_attr = 7; +pub const NFTNL_SET_ID: nftnl_set_attr = 8; +pub const NFTNL_SET_POLICY: nftnl_set_attr = 9; +pub const NFTNL_SET_DESC_SIZE: nftnl_set_attr = 10; +pub const NFTNL_SET_TIMEOUT: nftnl_set_attr = 11; +pub const NFTNL_SET_GC_INTERVAL: nftnl_set_attr = 12; +pub const NFTNL_SET_USERDATA: nftnl_set_attr = 13; +pub const NFTNL_SET_OBJ_TYPE: nftnl_set_attr = 14; +pub const NFTNL_SET_HANDLE: nftnl_set_attr = 15; +pub const NFTNL_SET_DESC_CONCAT: nftnl_set_attr = 16; +pub const NFTNL_SET_EXPR: nftnl_set_attr = 17; +pub const __NFTNL_SET_MAX: nftnl_set_attr = 18; +pub type nftnl_set_attr = c_uint; +#[repr(C)] +pub struct nftnl_set(c_void); + +extern "C" { + pub fn nftnl_set_alloc() -> *mut nftnl_set; + + pub fn nftnl_set_free(s: *const nftnl_set); + + pub fn nftnl_set_clone(set: *const nftnl_set) -> *mut nftnl_set; + + pub fn nftnl_set_is_set(s: *const nftnl_set, attr: u16) -> bool; + + pub fn nftnl_set_unset(s: *mut nftnl_set, attr: u16); + + pub fn nftnl_set_set(s: *mut nftnl_set, attr: u16, data: *const c_void) -> c_int; + + pub fn nftnl_set_set_data( + s: *mut nftnl_set, + attr: u16, + data: *const c_void, + data_len: u32, + ) -> c_int; + + pub fn nftnl_set_set_u32(s: *mut nftnl_set, attr: u16, val: u32); + + pub fn nftnl_set_set_u64(s: *mut nftnl_set, attr: u16, val: u64); + + pub fn nftnl_set_set_str(s: *mut nftnl_set, attr: u16, str_: *const c_char) -> c_int; + + pub fn nftnl_set_get(s: *const nftnl_set, attr: u16) -> *const c_void; + + pub fn nftnl_set_get_data(s: *const nftnl_set, attr: u16, data_len: *mut u32) -> *const c_void; + + pub fn nftnl_set_get_str(s: *const nftnl_set, attr: u16) -> *const c_char; + + pub fn nftnl_set_get_u32(s: *const nftnl_set, attr: u16) -> u32; + + pub fn nftnl_set_get_u64(s: *const nftnl_set, attr: u16) -> u64; + + pub fn nftnl_set_nlmsg_build_payload(nlh: *mut nlmsghdr, s: *mut nftnl_set); + + pub fn nftnl_set_nlmsg_parse(nlh: *const nlmsghdr, s: *mut nftnl_set) -> c_int; + + pub fn nftnl_set_elems_nlmsg_parse(nlh: *const nlmsghdr, s: *mut nftnl_set) -> c_int; + + pub fn nftnl_set_snprintf( + buf: *mut c_char, + size: usize, + s: *const nftnl_set, + type_: u32, + flags: u32, + ) -> c_int; + + pub fn nftnl_set_fprintf(fp: *mut FILE, s: *const nftnl_set, type_: u32, flags: u32) -> c_int; +} +#[repr(C)] +pub struct nftnl_set_list(c_void); + +extern "C" { + pub fn nftnl_set_list_alloc() -> *mut nftnl_set_list; + + pub fn nftnl_set_list_free(list: *mut nftnl_set_list); + + pub fn nftnl_set_list_is_empty(list: *const nftnl_set_list) -> c_int; + + pub fn nftnl_set_list_add(s: *mut nftnl_set, list: *mut nftnl_set_list); + + pub fn nftnl_set_list_add_tail(s: *mut nftnl_set, list: *mut nftnl_set_list); + + pub fn nftnl_set_list_del(s: *mut nftnl_set); + + pub fn nftnl_set_list_foreach( + set_list: *mut nftnl_set_list, + cb: Option c_int>, + data: *mut c_void, + ) -> c_int; + + pub fn nftnl_set_list_lookup_byname( + set_list: *mut nftnl_set_list, + set: *const c_char, + ) -> *mut nftnl_set; +} +#[repr(C)] +pub struct nftnl_set_list_iter(c_void); + +extern "C" { + pub fn nftnl_set_list_iter_create(l: *const nftnl_set_list) -> *mut nftnl_set_list_iter; + + pub fn nftnl_set_list_iter_cur(iter: *const nftnl_set_list_iter) -> *mut nftnl_set; + + pub fn nftnl_set_list_iter_next(iter: *mut nftnl_set_list_iter) -> *mut nftnl_set; + + pub fn nftnl_set_list_iter_destroy(iter: *const nftnl_set_list_iter); + + pub fn nftnl_set_parse( + s: *mut nftnl_set, + type_: nftnl_parse_type, + data: *const c_char, + err: *mut nftnl_parse_err, + ) -> c_int; + + pub fn nftnl_set_parse_file( + s: *mut nftnl_set, + type_: nftnl_parse_type, + fp: *mut FILE, + err: *mut nftnl_parse_err, + ) -> c_int; +} +pub const NFTNL_SET_ELEM_FLAGS: u32 = 0; +pub const NFTNL_SET_ELEM_KEY: u32 = 1; +pub const NFTNL_SET_ELEM_VERDICT: u32 = 2; +pub const NFTNL_SET_ELEM_CHAIN: u32 = 3; +pub const NFTNL_SET_ELEM_DATA: u32 = 4; +pub const NFTNL_SET_ELEM_TIMEOUT: u32 = 5; +pub const NFTNL_SET_ELEM_EXPIRATION: u32 = 6; +pub const NFTNL_SET_ELEM_USERDATA: u32 = 7; +pub const NFTNL_SET_ELEM_EXPR: u32 = 8; +pub const NFTNL_SET_ELEM_OBJREF: u32 = 9; +pub const NFTNL_SET_ELEM_KEY_END: u32 = 10; +pub const __NFTNL_SET_ELEM_MAX: u32 = 11; + +#[repr(C)] +pub struct nftnl_set_elem(c_void); + +extern "C" { + pub fn nftnl_set_elem_alloc() -> *mut nftnl_set_elem; + + pub fn nftnl_set_elem_free(s: *mut nftnl_set_elem); + + pub fn nftnl_set_elem_clone(elem: *mut nftnl_set_elem) -> *mut nftnl_set_elem; + + pub fn nftnl_set_elem_add(s: *mut nftnl_set, elem: *mut nftnl_set_elem); + + pub fn nftnl_set_elem_unset(s: *mut nftnl_set_elem, attr: u16); + + pub fn nftnl_set_elem_set( + s: *mut nftnl_set_elem, + attr: u16, + data: *const c_void, + data_len: u32, + ) -> c_int; + + pub fn nftnl_set_elem_set_u32(s: *mut nftnl_set_elem, attr: u16, val: u32); + + pub fn nftnl_set_elem_set_u64(s: *mut nftnl_set_elem, attr: u16, val: u64); + + pub fn nftnl_set_elem_set_str(s: *mut nftnl_set_elem, attr: u16, str_: *const c_char) -> c_int; + + pub fn nftnl_set_elem_get( + s: *mut nftnl_set_elem, + attr: u16, + data_len: *mut u32, + ) -> *const c_void; + + pub fn nftnl_set_elem_get_str(s: *mut nftnl_set_elem, attr: u16) -> *const c_char; + + pub fn nftnl_set_elem_get_u32(s: *mut nftnl_set_elem, attr: u16) -> u32; + + pub fn nftnl_set_elem_get_u64(s: *mut nftnl_set_elem, attr: u16) -> u64; + + pub fn nftnl_set_elem_is_set(s: *const nftnl_set_elem, attr: u16) -> bool; + + pub fn nftnl_set_elems_nlmsg_build_payload(nlh: *mut nlmsghdr, s: *mut nftnl_set); + + pub fn nftnl_set_elem_nlmsg_build_payload(nlh: *mut nlmsghdr, e: *mut nftnl_set_elem); + + pub fn nftnl_set_elem_parse( + e: *mut nftnl_set_elem, + type_: nftnl_parse_type, + data: *const c_char, + err: *mut nftnl_parse_err, + ) -> c_int; + + pub fn nftnl_set_elem_parse_file( + e: *mut nftnl_set_elem, + type_: nftnl_parse_type, + fp: *mut FILE, + err: *mut nftnl_parse_err, + ) -> c_int; + + pub fn nftnl_set_elem_snprintf( + buf: *mut c_char, + size: usize, + s: *const nftnl_set_elem, + type_: u32, + flags: u32, + ) -> c_int; + + pub fn nftnl_set_elem_fprintf( + fp: *mut FILE, + se: *const nftnl_set_elem, + type_: u32, + flags: u32, + ) -> c_int; + + pub fn nftnl_set_elem_foreach( + s: *mut nftnl_set, + cb: Option c_int>, + data: *mut c_void, + ) -> c_int; +} +#[repr(C)] +pub struct nftnl_set_elems_iter(c_void); + +extern "C" { + pub fn nftnl_set_elems_iter_create(s: *const nftnl_set) -> *mut nftnl_set_elems_iter; + + pub fn nftnl_set_elems_iter_cur(iter: *const nftnl_set_elems_iter) -> *mut nftnl_set_elem; + + pub fn nftnl_set_elems_iter_next(iter: *mut nftnl_set_elems_iter) -> *mut nftnl_set_elem; + + pub fn nftnl_set_elems_iter_destroy(iter: *mut nftnl_set_elems_iter); + + pub fn nftnl_set_elems_nlmsg_build_payload_iter( + nlh: *mut nlmsghdr, + iter: *mut nftnl_set_elems_iter, + ) -> c_int; +} +#[repr(C)] +pub struct nftnl_table(c_void); + +extern "C" { + pub fn nftnl_table_alloc() -> *mut nftnl_table; + + pub fn nftnl_table_free(arg1: *const nftnl_table); +} +pub const NFTNL_TABLE_NAME: nftnl_table_attr = 0; +pub const NFTNL_TABLE_FAMILY: nftnl_table_attr = 1; +pub const NFTNL_TABLE_FLAGS: nftnl_table_attr = 2; +pub const NFTNL_TABLE_USE: nftnl_table_attr = 3; +pub const NFTNL_TABLE_HANDLE: nftnl_table_attr = 4; +pub const NFTNL_TABLE_USERDATA: nftnl_table_attr = 5; +pub const __NFTNL_TABLE_MAX: nftnl_table_attr = 6; +pub type nftnl_table_attr = c_uint; +extern "C" { + pub fn nftnl_table_is_set(t: *const nftnl_table, attr: u16) -> bool; + + pub fn nftnl_table_unset(t: *mut nftnl_table, attr: u16); + + pub fn nftnl_table_set(t: *mut nftnl_table, attr: u16, data: *const c_void); + + pub fn nftnl_table_set_data( + t: *mut nftnl_table, + attr: u16, + data: *const c_void, + data_len: u32, + ) -> c_int; + + pub fn nftnl_table_get(t: *const nftnl_table, attr: u16) -> *const c_void; + + pub fn nftnl_table_get_data( + t: *const nftnl_table, + attr: u16, + data_len: *mut u32, + ) -> *const c_void; + + pub fn nftnl_table_set_u8(t: *mut nftnl_table, attr: u16, data: u8); + + pub fn nftnl_table_set_u32(t: *mut nftnl_table, attr: u16, data: u32); + + pub fn nftnl_table_set_u64(t: *mut nftnl_table, attr: u16, data: u64); + + pub fn nftnl_table_set_str(t: *mut nftnl_table, attr: u16, str_: *const c_char) -> c_int; + + pub fn nftnl_table_get_u8(t: *const nftnl_table, attr: u16) -> u8; + + pub fn nftnl_table_get_u32(t: *const nftnl_table, attr: u16) -> u32; + + pub fn nftnl_table_get_u64(t: *const nftnl_table, attr: u16) -> u64; + + pub fn nftnl_table_get_str(t: *const nftnl_table, attr: u16) -> *const c_char; + + pub fn nftnl_table_nlmsg_build_payload(nlh: *mut nlmsghdr, t: *const nftnl_table); + + pub fn nftnl_table_parse( + t: *mut nftnl_table, + type_: nftnl_parse_type, + data: *const c_char, + err: *mut nftnl_parse_err, + ) -> c_int; + + pub fn nftnl_table_parse_file( + t: *mut nftnl_table, + type_: nftnl_parse_type, + fp: *mut FILE, + err: *mut nftnl_parse_err, + ) -> c_int; + + pub fn nftnl_table_snprintf( + buf: *mut c_char, + size: usize, + t: *const nftnl_table, + type_: u32, + flags: u32, + ) -> c_int; + + pub fn nftnl_table_fprintf( + fp: *mut FILE, + t: *const nftnl_table, + type_: u32, + flags: u32, + ) -> c_int; + + pub fn nftnl_table_nlmsg_parse(nlh: *const nlmsghdr, t: *mut nftnl_table) -> c_int; +} +#[repr(C)] +pub struct nftnl_table_list(c_void); + +extern "C" { + pub fn nftnl_table_list_alloc() -> *mut nftnl_table_list; + + pub fn nftnl_table_list_free(list: *mut nftnl_table_list); + + pub fn nftnl_table_list_is_empty(list: *const nftnl_table_list) -> c_int; + + pub fn nftnl_table_list_foreach( + table_list: *mut nftnl_table_list, + cb: Option c_int>, + data: *mut c_void, + ) -> c_int; + + pub fn nftnl_table_list_add(r: *mut nftnl_table, list: *mut nftnl_table_list); + + pub fn nftnl_table_list_add_tail(r: *mut nftnl_table, list: *mut nftnl_table_list); + + pub fn nftnl_table_list_del(r: *mut nftnl_table); +} +#[repr(C)] +pub struct nftnl_table_list_iter(c_void); + +extern "C" { + pub fn nftnl_table_list_iter_create(l: *const nftnl_table_list) -> *mut nftnl_table_list_iter; + + pub fn nftnl_table_list_iter_next(iter: *mut nftnl_table_list_iter) -> *mut nftnl_table; + + pub fn nftnl_table_list_iter_destroy(iter: *const nftnl_table_list_iter); +} +pub const NFTNL_TRACE_CHAIN: nftnl_trace_attr = 0; +pub const NFTNL_TRACE_FAMILY: nftnl_trace_attr = 1; +pub const NFTNL_TRACE_ID: nftnl_trace_attr = 2; +pub const NFTNL_TRACE_IIF: nftnl_trace_attr = 3; +pub const NFTNL_TRACE_IIFTYPE: nftnl_trace_attr = 4; +pub const NFTNL_TRACE_JUMP_TARGET: nftnl_trace_attr = 5; +pub const NFTNL_TRACE_OIF: nftnl_trace_attr = 6; +pub const NFTNL_TRACE_OIFTYPE: nftnl_trace_attr = 7; +pub const NFTNL_TRACE_MARK: nftnl_trace_attr = 8; +pub const NFTNL_TRACE_LL_HEADER: nftnl_trace_attr = 9; +pub const NFTNL_TRACE_NETWORK_HEADER: nftnl_trace_attr = 10; +pub const NFTNL_TRACE_TRANSPORT_HEADER: nftnl_trace_attr = 11; +pub const NFTNL_TRACE_TABLE: nftnl_trace_attr = 12; +pub const NFTNL_TRACE_TYPE: nftnl_trace_attr = 13; +pub const NFTNL_TRACE_RULE_HANDLE: nftnl_trace_attr = 14; +pub const NFTNL_TRACE_VERDICT: nftnl_trace_attr = 15; +pub const NFTNL_TRACE_NFPROTO: nftnl_trace_attr = 16; +pub const NFTNL_TRACE_POLICY: nftnl_trace_attr = 17; +pub const __NFTNL_TRACE_MAX: nftnl_trace_attr = 18; +pub type nftnl_trace_attr = c_uint; +#[repr(C)] +pub struct nftnl_trace(c_void); + +extern "C" { + pub fn nftnl_trace_alloc() -> *mut nftnl_trace; + + pub fn nftnl_trace_free(trace: *const nftnl_trace); + + pub fn nftnl_trace_is_set(trace: *const nftnl_trace, type_: u16) -> bool; + + pub fn nftnl_trace_get_data( + trace: *const nftnl_trace, + type_: u16, + data_len: *mut u32, + ) -> *const c_void; + + pub fn nftnl_trace_get_u16(trace: *const nftnl_trace, type_: u16) -> u16; + + pub fn nftnl_trace_get_u32(trace: *const nftnl_trace, type_: u16) -> u32; + + pub fn nftnl_trace_get_u64(trace: *const nftnl_trace, type_: u16) -> u64; + + pub fn nftnl_trace_get_str(trace: *const nftnl_trace, type_: u16) -> *const c_char; + + pub fn nftnl_trace_nlmsg_parse(nlh: *const nlmsghdr, t: *mut nftnl_trace) -> c_int; +} +pub const NFTNL_UDATA_TABLE_COMMENT: nftnl_udata_table_types = 0; +pub const __NFTNL_UDATA_TABLE_MAX: nftnl_udata_table_types = 1; +pub type nftnl_udata_table_types = c_uint; +pub const NFTNL_UDATA_CHAIN_COMMENT: nftnl_udata_chain_types = 0; +pub const __NFTNL_UDATA_CHAIN_MAX: nftnl_udata_chain_types = 1; +pub type nftnl_udata_chain_types = c_uint; +pub const NFTNL_UDATA_RULE_COMMENT: nftnl_udata_rule_types = 0; +pub const NFTNL_UDATA_RULE_EBTABLES_POLICY: nftnl_udata_rule_types = 1; +pub const __NFTNL_UDATA_RULE_MAX: nftnl_udata_rule_types = 2; +pub type nftnl_udata_rule_types = c_uint; +pub const NFTNL_UDATA_OBJ_COMMENT: nftnl_udata_obj_types = 0; +pub const __NFTNL_UDATA_OBJ_MAX: nftnl_udata_obj_types = 1; +pub type nftnl_udata_obj_types = c_uint; +pub const NFTNL_UDATA_SET_KEYBYTEORDER: nftnl_udata_set_types = 0; +pub const NFTNL_UDATA_SET_DATABYTEORDER: nftnl_udata_set_types = 1; +pub const NFTNL_UDATA_SET_MERGE_ELEMENTS: nftnl_udata_set_types = 2; +pub const NFTNL_UDATA_SET_KEY_TYPEOF: nftnl_udata_set_types = 3; +pub const NFTNL_UDATA_SET_DATA_TYPEOF: nftnl_udata_set_types = 4; +pub const NFTNL_UDATA_SET_EXPR: nftnl_udata_set_types = 5; +pub const NFTNL_UDATA_SET_DATA_INTERVAL: nftnl_udata_set_types = 6; +pub const NFTNL_UDATA_SET_COMMENT: nftnl_udata_set_types = 7; +pub const __NFTNL_UDATA_SET_MAX: nftnl_udata_set_types = 8; +pub type nftnl_udata_set_types = c_uint; +pub const NFTNL_UDATA_SET_TYPEOF_EXPR: u32 = 0; +pub const NFTNL_UDATA_SET_TYPEOF_DATA: u32 = 1; +pub const __NFTNL_UDATA_SET_TYPEOF_MAX: u32 = 2; + +pub const NFTNL_UDATA_SET_ELEM_COMMENT: nftnl_udata_set_elem_types = 0; +pub const NFTNL_UDATA_SET_ELEM_FLAGS: nftnl_udata_set_elem_types = 1; +pub const __NFTNL_UDATA_SET_ELEM_MAX: nftnl_udata_set_elem_types = 2; +pub type nftnl_udata_set_elem_types = c_uint; +pub const NFTNL_SET_ELEM_F_INTERVAL_OPEN: nftnl_udata_set_elem_flags = 1; +pub type nftnl_udata_set_elem_flags = c_uint; +#[repr(C)] +pub struct nftnl_udata(c_void); + +#[repr(C)] +pub struct nftnl_udata_buf(c_void); + +extern "C" { + pub fn nftnl_udata_buf_alloc(data_size: u32) -> *mut nftnl_udata_buf; + + pub fn nftnl_udata_buf_free(buf: *const nftnl_udata_buf); + + pub fn nftnl_udata_buf_len(buf: *const nftnl_udata_buf) -> u32; + + pub fn nftnl_udata_buf_data(buf: *const nftnl_udata_buf) -> *mut c_void; + + pub fn nftnl_udata_buf_put(buf: *mut nftnl_udata_buf, data: *const c_void, len: u32); + + pub fn nftnl_udata_start(buf: *const nftnl_udata_buf) -> *mut nftnl_udata; + + pub fn nftnl_udata_end(buf: *const nftnl_udata_buf) -> *mut nftnl_udata; + + pub fn nftnl_udata_put( + buf: *mut nftnl_udata_buf, + type_: u8, + len: u32, + value: *const c_void, + ) -> bool; + + pub fn nftnl_udata_put_u32(buf: *mut nftnl_udata_buf, type_: u8, data: u32) -> bool; + + pub fn nftnl_udata_put_strz(buf: *mut nftnl_udata_buf, type_: u8, strz: *const c_char) -> bool; + + pub fn nftnl_udata_nest_start(buf: *mut nftnl_udata_buf, type_: u8) -> *mut nftnl_udata; + + pub fn nftnl_udata_nest_end(buf: *mut nftnl_udata_buf, ud: *mut nftnl_udata); + + pub fn nftnl_udata_type(attr: *const nftnl_udata) -> u8; + + pub fn nftnl_udata_len(attr: *const nftnl_udata) -> u8; + + pub fn nftnl_udata_get(attr: *const nftnl_udata) -> *mut c_void; + + pub fn nftnl_udata_get_u32(attr: *const nftnl_udata) -> u32; + + pub fn nftnl_udata_next(attr: *const nftnl_udata) -> *mut nftnl_udata; +} +pub type nftnl_udata_cb_t = + Option c_int>; +extern "C" { + pub fn nftnl_udata_parse( + data: *const c_void, + data_len: u32, + cb: nftnl_udata_cb_t, + cb_data: *mut c_void, + ) -> c_int; +} diff --git a/nftnl-sys/src/nftnl_1_1_9.rs b/nftnl-sys/src/nftnl_1_1_9.rs new file mode 100644 index 0000000..1c5eac9 --- /dev/null +++ b/nftnl-sys/src/nftnl_1_1_9.rs @@ -0,0 +1,1474 @@ +/* automatically generated by rust-bindgen 0.69.4 */ + +use core::option::Option; +use libc::{c_char, c_int, c_uint, c_void, iovec, nlmsghdr, FILE}; + +pub const NFTNL_UDATA_COMMENT_MAXLEN: u32 = 128; +#[repr(C)] +pub struct nftnl_batch(c_void); + +extern "C" { + pub fn nftnl_batch_alloc(pg_size: u32, pg_overrun_size: u32) -> *mut nftnl_batch; + + pub fn nftnl_batch_update(batch: *mut nftnl_batch) -> c_int; + + pub fn nftnl_batch_free(batch: *mut nftnl_batch); + + pub fn nftnl_batch_buffer(batch: *mut nftnl_batch) -> *mut c_void; + + pub fn nftnl_batch_buffer_len(batch: *mut nftnl_batch) -> u32; + + pub fn nftnl_batch_iovec_len(batch: *mut nftnl_batch) -> c_int; + + pub fn nftnl_batch_iovec(batch: *mut nftnl_batch, iov: *mut iovec, iovlen: u32); +} +pub const NFTNL_PARSE_EBADINPUT: u32 = 0; +pub const NFTNL_PARSE_EMISSINGNODE: u32 = 1; +pub const NFTNL_PARSE_EBADTYPE: u32 = 2; +pub const NFTNL_PARSE_EOPNOTSUPP: u32 = 3; + +pub const NFTNL_OUTPUT_DEFAULT: nftnl_output_type = 0; +pub const NFTNL_OUTPUT_XML: nftnl_output_type = 1; +pub const NFTNL_OUTPUT_JSON: nftnl_output_type = 2; +pub type nftnl_output_type = c_uint; +pub const NFTNL_OF_EVENT_NEW: nftnl_output_flags = 1; +pub const NFTNL_OF_EVENT_DEL: nftnl_output_flags = 2; +pub const NFTNL_OF_EVENT_ANY: nftnl_output_flags = 3; +pub type nftnl_output_flags = c_uint; +pub const NFTNL_CMD_UNSPEC: nftnl_cmd_type = 0; +pub const NFTNL_CMD_ADD: nftnl_cmd_type = 1; +pub const NFTNL_CMD_INSERT: nftnl_cmd_type = 2; +pub const NFTNL_CMD_DELETE: nftnl_cmd_type = 3; +pub const NFTNL_CMD_REPLACE: nftnl_cmd_type = 4; +pub const NFTNL_CMD_FLUSH: nftnl_cmd_type = 5; +pub const NFTNL_CMD_MAX: nftnl_cmd_type = 6; +pub type nftnl_cmd_type = c_uint; +pub const NFTNL_PARSE_NONE: nftnl_parse_type = 0; +pub const NFTNL_PARSE_XML: nftnl_parse_type = 1; +pub const NFTNL_PARSE_JSON: nftnl_parse_type = 2; +pub const NFTNL_PARSE_MAX: nftnl_parse_type = 3; +pub type nftnl_parse_type = c_uint; +#[repr(C)] +pub struct nftnl_parse_err(c_void); + +extern "C" { + pub fn nftnl_nlmsg_build_hdr( + buf: *mut c_char, + type_: u16, + family: u16, + flags: u16, + seq: u32, + ) -> *mut nlmsghdr; + + pub fn nftnl_parse_err_alloc() -> *mut nftnl_parse_err; + + pub fn nftnl_parse_err_free(arg1: *mut nftnl_parse_err); + + pub fn nftnl_parse_perror(str_: *const c_char, err: *mut nftnl_parse_err) -> c_int; + + pub fn nftnl_batch_is_supported() -> c_int; + + pub fn nftnl_batch_begin(buf: *mut c_char, seq: u32) -> *mut nlmsghdr; + + pub fn nftnl_batch_end(buf: *mut c_char, seq: u32) -> *mut nlmsghdr; +} +#[repr(C)] +pub struct nftnl_chain(c_void); + +#[repr(C)] +pub struct nftnl_rule(c_void); + +extern "C" { + pub fn nftnl_chain_alloc() -> *mut nftnl_chain; + + pub fn nftnl_chain_free(arg1: *const nftnl_chain); +} +pub const NFTNL_CHAIN_NAME: nftnl_chain_attr = 0; +pub const NFTNL_CHAIN_FAMILY: nftnl_chain_attr = 1; +pub const NFTNL_CHAIN_TABLE: nftnl_chain_attr = 2; +pub const NFTNL_CHAIN_HOOKNUM: nftnl_chain_attr = 3; +pub const NFTNL_CHAIN_PRIO: nftnl_chain_attr = 4; +pub const NFTNL_CHAIN_POLICY: nftnl_chain_attr = 5; +pub const NFTNL_CHAIN_USE: nftnl_chain_attr = 6; +pub const NFTNL_CHAIN_BYTES: nftnl_chain_attr = 7; +pub const NFTNL_CHAIN_PACKETS: nftnl_chain_attr = 8; +pub const NFTNL_CHAIN_HANDLE: nftnl_chain_attr = 9; +pub const NFTNL_CHAIN_TYPE: nftnl_chain_attr = 10; +pub const NFTNL_CHAIN_DEV: nftnl_chain_attr = 11; +pub const NFTNL_CHAIN_DEVICES: nftnl_chain_attr = 12; +pub const NFTNL_CHAIN_FLAGS: nftnl_chain_attr = 13; +pub const NFTNL_CHAIN_ID: nftnl_chain_attr = 14; +pub const NFTNL_CHAIN_USERDATA: nftnl_chain_attr = 15; +pub const __NFTNL_CHAIN_MAX: nftnl_chain_attr = 16; +pub type nftnl_chain_attr = c_uint; +extern "C" { + pub fn nftnl_chain_is_set(c: *const nftnl_chain, attr: u16) -> bool; + + pub fn nftnl_chain_unset(c: *mut nftnl_chain, attr: u16); + + pub fn nftnl_chain_set(t: *mut nftnl_chain, attr: u16, data: *const c_void); + + pub fn nftnl_chain_set_data( + t: *mut nftnl_chain, + attr: u16, + data: *const c_void, + data_len: u32, + ) -> c_int; + + pub fn nftnl_chain_set_u8(t: *mut nftnl_chain, attr: u16, data: u8); + + pub fn nftnl_chain_set_u32(t: *mut nftnl_chain, attr: u16, data: u32); + + pub fn nftnl_chain_set_s32(t: *mut nftnl_chain, attr: u16, data: i32); + + pub fn nftnl_chain_set_u64(t: *mut nftnl_chain, attr: u16, data: u64); + + pub fn nftnl_chain_set_str(t: *mut nftnl_chain, attr: u16, str_: *const c_char) -> c_int; + + pub fn nftnl_chain_set_array(t: *mut nftnl_chain, attr: u16, data: *mut *const c_char) + -> c_int; + + pub fn nftnl_chain_get(c: *const nftnl_chain, attr: u16) -> *const c_void; + + pub fn nftnl_chain_get_data( + c: *const nftnl_chain, + attr: u16, + data_len: *mut u32, + ) -> *const c_void; + + pub fn nftnl_chain_get_str(c: *const nftnl_chain, attr: u16) -> *const c_char; + + pub fn nftnl_chain_get_u8(c: *const nftnl_chain, attr: u16) -> u8; + + pub fn nftnl_chain_get_u32(c: *const nftnl_chain, attr: u16) -> u32; + + pub fn nftnl_chain_get_s32(c: *const nftnl_chain, attr: u16) -> i32; + + pub fn nftnl_chain_get_u64(c: *const nftnl_chain, attr: u16) -> u64; + + pub fn nftnl_chain_get_array(c: *const nftnl_chain, attr: u16) -> *const *const c_char; + + pub fn nftnl_chain_rule_add(rule: *mut nftnl_rule, c: *mut nftnl_chain); + + pub fn nftnl_chain_rule_del(rule: *mut nftnl_rule); + + pub fn nftnl_chain_rule_add_tail(rule: *mut nftnl_rule, c: *mut nftnl_chain); + + pub fn nftnl_chain_rule_insert_at(rule: *mut nftnl_rule, pos: *mut nftnl_rule); + + pub fn nftnl_chain_rule_append_at(rule: *mut nftnl_rule, pos: *mut nftnl_rule); + + pub fn nftnl_chain_nlmsg_build_payload(nlh: *mut nlmsghdr, t: *const nftnl_chain); + + pub fn nftnl_chain_parse( + c: *mut nftnl_chain, + type_: nftnl_parse_type, + data: *const c_char, + err: *mut nftnl_parse_err, + ) -> c_int; + + pub fn nftnl_chain_parse_file( + c: *mut nftnl_chain, + type_: nftnl_parse_type, + fp: *mut FILE, + err: *mut nftnl_parse_err, + ) -> c_int; + + pub fn nftnl_chain_snprintf( + buf: *mut c_char, + size: usize, + t: *const nftnl_chain, + type_: u32, + flags: u32, + ) -> c_int; + + pub fn nftnl_chain_fprintf( + fp: *mut FILE, + c: *const nftnl_chain, + type_: u32, + flags: u32, + ) -> c_int; + + pub fn nftnl_chain_nlmsg_parse(nlh: *const nlmsghdr, t: *mut nftnl_chain) -> c_int; + + pub fn nftnl_rule_foreach( + c: *mut nftnl_chain, + cb: Option c_int>, + data: *mut c_void, + ) -> c_int; + + pub fn nftnl_rule_lookup_byindex(c: *mut nftnl_chain, index: u32) -> *mut nftnl_rule; +} +#[repr(C)] +pub struct nftnl_rule_iter(c_void); + +extern "C" { + pub fn nftnl_rule_iter_create(c: *const nftnl_chain) -> *mut nftnl_rule_iter; + + pub fn nftnl_rule_iter_next(iter: *mut nftnl_rule_iter) -> *mut nftnl_rule; + + pub fn nftnl_rule_iter_destroy(iter: *mut nftnl_rule_iter); +} +#[repr(C)] +pub struct nftnl_chain_list(c_void); + +extern "C" { + pub fn nftnl_chain_list_alloc() -> *mut nftnl_chain_list; + + pub fn nftnl_chain_list_free(list: *mut nftnl_chain_list); + + pub fn nftnl_chain_list_is_empty(list: *const nftnl_chain_list) -> c_int; + + pub fn nftnl_chain_list_foreach( + chain_list: *mut nftnl_chain_list, + cb: Option c_int>, + data: *mut c_void, + ) -> c_int; + + pub fn nftnl_chain_list_lookup_byname( + chain_list: *mut nftnl_chain_list, + chain: *const c_char, + ) -> *mut nftnl_chain; + + pub fn nftnl_chain_list_add(r: *mut nftnl_chain, list: *mut nftnl_chain_list); + + pub fn nftnl_chain_list_add_tail(r: *mut nftnl_chain, list: *mut nftnl_chain_list); + + pub fn nftnl_chain_list_del(c: *mut nftnl_chain); +} +#[repr(C)] +pub struct nftnl_chain_list_iter(c_void); + +extern "C" { + pub fn nftnl_chain_list_iter_create(l: *const nftnl_chain_list) -> *mut nftnl_chain_list_iter; + + pub fn nftnl_chain_list_iter_next(iter: *mut nftnl_chain_list_iter) -> *mut nftnl_chain; + + pub fn nftnl_chain_list_iter_destroy(iter: *mut nftnl_chain_list_iter); +} +#[repr(C)] +pub struct nftnl_expr(c_void); + +pub const NFTNL_EXPR_NAME: u32 = 0; +pub const NFTNL_EXPR_BASE: u32 = 1; + +extern "C" { + pub fn nftnl_expr_alloc(name: *const c_char) -> *mut nftnl_expr; + + pub fn nftnl_expr_free(expr: *const nftnl_expr); + + pub fn nftnl_expr_is_set(expr: *const nftnl_expr, type_: u16) -> bool; + + pub fn nftnl_expr_set( + expr: *mut nftnl_expr, + type_: u16, + data: *const c_void, + data_len: u32, + ) -> c_int; + + pub fn nftnl_expr_set_u8(expr: *mut nftnl_expr, type_: u16, data: u8); + + pub fn nftnl_expr_set_u16(expr: *mut nftnl_expr, type_: u16, data: u16); + + pub fn nftnl_expr_set_u32(expr: *mut nftnl_expr, type_: u16, data: u32); + + pub fn nftnl_expr_set_u64(expr: *mut nftnl_expr, type_: u16, data: u64); + + pub fn nftnl_expr_set_str(expr: *mut nftnl_expr, type_: u16, str_: *const c_char) -> c_int; + + pub fn nftnl_expr_get(expr: *const nftnl_expr, type_: u16, data_len: *mut u32) + -> *const c_void; + + pub fn nftnl_expr_get_u8(expr: *const nftnl_expr, type_: u16) -> u8; + + pub fn nftnl_expr_get_u16(expr: *const nftnl_expr, type_: u16) -> u16; + + pub fn nftnl_expr_get_u32(expr: *const nftnl_expr, type_: u16) -> u32; + + pub fn nftnl_expr_get_u64(expr: *const nftnl_expr, type_: u16) -> u64; + + pub fn nftnl_expr_get_str(expr: *const nftnl_expr, type_: u16) -> *const c_char; + + pub fn nftnl_expr_build_payload(nlh: *mut nlmsghdr, expr: *mut nftnl_expr); + + pub fn nftnl_expr_add_expr(expr: *mut nftnl_expr, type_: u32, e: *mut nftnl_expr); + + pub fn nftnl_expr_expr_foreach( + e: *const nftnl_expr, + cb: Option c_int>, + data: *mut c_void, + ) -> c_int; + + pub fn nftnl_expr_snprintf( + buf: *mut c_char, + buflen: usize, + expr: *const nftnl_expr, + type_: u32, + flags: u32, + ) -> c_int; + + pub fn nftnl_expr_fprintf( + fp: *mut FILE, + expr: *const nftnl_expr, + type_: u32, + flags: u32, + ) -> c_int; +} +pub const NFTNL_EXPR_PAYLOAD_DREG: u32 = 1; +pub const NFTNL_EXPR_PAYLOAD_BASE: u32 = 2; +pub const NFTNL_EXPR_PAYLOAD_OFFSET: u32 = 3; +pub const NFTNL_EXPR_PAYLOAD_LEN: u32 = 4; +pub const NFTNL_EXPR_PAYLOAD_SREG: u32 = 5; +pub const NFTNL_EXPR_PAYLOAD_CSUM_TYPE: u32 = 6; +pub const NFTNL_EXPR_PAYLOAD_CSUM_OFFSET: u32 = 7; +pub const NFTNL_EXPR_PAYLOAD_FLAGS: u32 = 8; + +pub const NFTNL_EXPR_NG_DREG: u32 = 1; +pub const NFTNL_EXPR_NG_MODULUS: u32 = 2; +pub const NFTNL_EXPR_NG_TYPE: u32 = 3; +pub const NFTNL_EXPR_NG_OFFSET: u32 = 4; +pub const NFTNL_EXPR_NG_SET_NAME: u32 = 5; +pub const NFTNL_EXPR_NG_SET_ID: u32 = 6; + +pub const NFTNL_EXPR_META_KEY: u32 = 1; +pub const NFTNL_EXPR_META_DREG: u32 = 2; +pub const NFTNL_EXPR_META_SREG: u32 = 3; + +pub const NFTNL_EXPR_RT_KEY: u32 = 1; +pub const NFTNL_EXPR_RT_DREG: u32 = 2; + +pub const NFTNL_EXPR_SOCKET_KEY: u32 = 1; +pub const NFTNL_EXPR_SOCKET_DREG: u32 = 2; + +pub const NFTNL_EXPR_TUNNEL_KEY: u32 = 1; +pub const NFTNL_EXPR_TUNNEL_DREG: u32 = 2; + +pub const NFTNL_EXPR_CMP_SREG: u32 = 1; +pub const NFTNL_EXPR_CMP_OP: u32 = 2; +pub const NFTNL_EXPR_CMP_DATA: u32 = 3; + +pub const NFTNL_EXPR_RANGE_SREG: u32 = 1; +pub const NFTNL_EXPR_RANGE_OP: u32 = 2; +pub const NFTNL_EXPR_RANGE_FROM_DATA: u32 = 3; +pub const NFTNL_EXPR_RANGE_TO_DATA: u32 = 4; + +pub const NFTNL_EXPR_IMM_DREG: u32 = 1; +pub const NFTNL_EXPR_IMM_DATA: u32 = 2; +pub const NFTNL_EXPR_IMM_VERDICT: u32 = 3; +pub const NFTNL_EXPR_IMM_CHAIN: u32 = 4; +pub const NFTNL_EXPR_IMM_CHAIN_ID: u32 = 5; + +pub const NFTNL_EXPR_CTR_PACKETS: u32 = 1; +pub const NFTNL_EXPR_CTR_BYTES: u32 = 2; + +pub const NFTNL_EXPR_CONNLIMIT_COUNT: u32 = 1; +pub const NFTNL_EXPR_CONNLIMIT_FLAGS: u32 = 2; + +pub const NFTNL_EXPR_BITWISE_SREG: u32 = 1; +pub const NFTNL_EXPR_BITWISE_DREG: u32 = 2; +pub const NFTNL_EXPR_BITWISE_LEN: u32 = 3; +pub const NFTNL_EXPR_BITWISE_MASK: u32 = 4; +pub const NFTNL_EXPR_BITWISE_XOR: u32 = 5; +pub const NFTNL_EXPR_BITWISE_OP: u32 = 6; +pub const NFTNL_EXPR_BITWISE_DATA: u32 = 7; + +pub const NFTNL_EXPR_TG_NAME: u32 = 1; +pub const NFTNL_EXPR_TG_REV: u32 = 2; +pub const NFTNL_EXPR_TG_INFO: u32 = 3; + +pub const NFTNL_EXPR_MT_NAME: u32 = 1; +pub const NFTNL_EXPR_MT_REV: u32 = 2; +pub const NFTNL_EXPR_MT_INFO: u32 = 3; + +pub const NFTNL_EXPR_NAT_TYPE: u32 = 1; +pub const NFTNL_EXPR_NAT_FAMILY: u32 = 2; +pub const NFTNL_EXPR_NAT_REG_ADDR_MIN: u32 = 3; +pub const NFTNL_EXPR_NAT_REG_ADDR_MAX: u32 = 4; +pub const NFTNL_EXPR_NAT_REG_PROTO_MIN: u32 = 5; +pub const NFTNL_EXPR_NAT_REG_PROTO_MAX: u32 = 6; +pub const NFTNL_EXPR_NAT_FLAGS: u32 = 7; + +pub const NFTNL_EXPR_TPROXY_FAMILY: u32 = 1; +pub const NFTNL_EXPR_TPROXY_REG_ADDR: u32 = 2; +pub const NFTNL_EXPR_TPROXY_REG_PORT: u32 = 3; + +pub const NFTNL_EXPR_LOOKUP_SREG: u32 = 1; +pub const NFTNL_EXPR_LOOKUP_DREG: u32 = 2; +pub const NFTNL_EXPR_LOOKUP_SET: u32 = 3; +pub const NFTNL_EXPR_LOOKUP_SET_ID: u32 = 4; +pub const NFTNL_EXPR_LOOKUP_FLAGS: u32 = 5; + +pub const NFTNL_EXPR_DYNSET_SREG_KEY: u32 = 1; +pub const NFTNL_EXPR_DYNSET_SREG_DATA: u32 = 2; +pub const NFTNL_EXPR_DYNSET_OP: u32 = 3; +pub const NFTNL_EXPR_DYNSET_TIMEOUT: u32 = 4; +pub const NFTNL_EXPR_DYNSET_SET_NAME: u32 = 5; +pub const NFTNL_EXPR_DYNSET_SET_ID: u32 = 6; +pub const NFTNL_EXPR_DYNSET_EXPR: u32 = 7; +pub const NFTNL_EXPR_DYNSET_EXPRESSIONS: u32 = 8; +pub const NFTNL_EXPR_DYNSET_FLAGS: u32 = 9; + +pub const NFTNL_EXPR_LOG_PREFIX: u32 = 1; +pub const NFTNL_EXPR_LOG_GROUP: u32 = 2; +pub const NFTNL_EXPR_LOG_SNAPLEN: u32 = 3; +pub const NFTNL_EXPR_LOG_QTHRESHOLD: u32 = 4; +pub const NFTNL_EXPR_LOG_LEVEL: u32 = 5; +pub const NFTNL_EXPR_LOG_FLAGS: u32 = 6; + +pub const NFTNL_EXPR_EXTHDR_DREG: u32 = 1; +pub const NFTNL_EXPR_EXTHDR_TYPE: u32 = 2; +pub const NFTNL_EXPR_EXTHDR_OFFSET: u32 = 3; +pub const NFTNL_EXPR_EXTHDR_LEN: u32 = 4; +pub const NFTNL_EXPR_EXTHDR_FLAGS: u32 = 5; +pub const NFTNL_EXPR_EXTHDR_OP: u32 = 6; +pub const NFTNL_EXPR_EXTHDR_SREG: u32 = 7; + +pub const NFTNL_EXPR_CT_DREG: u32 = 1; +pub const NFTNL_EXPR_CT_KEY: u32 = 2; +pub const NFTNL_EXPR_CT_DIR: u32 = 3; +pub const NFTNL_EXPR_CT_SREG: u32 = 4; + +pub const NFTNL_EXPR_BYTEORDER_DREG: u32 = 1; +pub const NFTNL_EXPR_BYTEORDER_SREG: u32 = 2; +pub const NFTNL_EXPR_BYTEORDER_OP: u32 = 3; +pub const NFTNL_EXPR_BYTEORDER_LEN: u32 = 4; +pub const NFTNL_EXPR_BYTEORDER_SIZE: u32 = 5; + +pub const NFTNL_EXPR_LIMIT_RATE: u32 = 1; +pub const NFTNL_EXPR_LIMIT_UNIT: u32 = 2; +pub const NFTNL_EXPR_LIMIT_BURST: u32 = 3; +pub const NFTNL_EXPR_LIMIT_TYPE: u32 = 4; +pub const NFTNL_EXPR_LIMIT_FLAGS: u32 = 5; + +pub const NFTNL_EXPR_REJECT_TYPE: u32 = 1; +pub const NFTNL_EXPR_REJECT_CODE: u32 = 2; + +pub const NFTNL_EXPR_QUEUE_NUM: u32 = 1; +pub const NFTNL_EXPR_QUEUE_TOTAL: u32 = 2; +pub const NFTNL_EXPR_QUEUE_FLAGS: u32 = 3; +pub const NFTNL_EXPR_QUEUE_SREG_QNUM: u32 = 4; + +pub const NFTNL_EXPR_QUOTA_BYTES: u32 = 1; +pub const NFTNL_EXPR_QUOTA_FLAGS: u32 = 2; +pub const NFTNL_EXPR_QUOTA_CONSUMED: u32 = 3; + +pub const NFTNL_EXPR_MASQ_FLAGS: u32 = 1; +pub const NFTNL_EXPR_MASQ_REG_PROTO_MIN: u32 = 2; +pub const NFTNL_EXPR_MASQ_REG_PROTO_MAX: u32 = 3; + +pub const NFTNL_EXPR_REDIR_REG_PROTO_MIN: u32 = 1; +pub const NFTNL_EXPR_REDIR_REG_PROTO_MAX: u32 = 2; +pub const NFTNL_EXPR_REDIR_FLAGS: u32 = 3; + +pub const NFTNL_EXPR_DUP_SREG_ADDR: u32 = 1; +pub const NFTNL_EXPR_DUP_SREG_DEV: u32 = 2; + +pub const NFTNL_EXPR_FLOW_TABLE_NAME: u32 = 1; + +pub const NFTNL_EXPR_FWD_SREG_DEV: u32 = 1; +pub const NFTNL_EXPR_FWD_SREG_ADDR: u32 = 2; +pub const NFTNL_EXPR_FWD_NFPROTO: u32 = 3; + +pub const NFTNL_EXPR_HASH_SREG: u32 = 1; +pub const NFTNL_EXPR_HASH_DREG: u32 = 2; +pub const NFTNL_EXPR_HASH_LEN: u32 = 3; +pub const NFTNL_EXPR_HASH_MODULUS: u32 = 4; +pub const NFTNL_EXPR_HASH_SEED: u32 = 5; +pub const NFTNL_EXPR_HASH_OFFSET: u32 = 6; +pub const NFTNL_EXPR_HASH_TYPE: u32 = 7; +pub const NFTNL_EXPR_HASH_SET_NAME: u32 = 8; +pub const NFTNL_EXPR_HASH_SET_ID: u32 = 9; + +pub const NFTNL_EXPR_FIB_DREG: u32 = 1; +pub const NFTNL_EXPR_FIB_RESULT: u32 = 2; +pub const NFTNL_EXPR_FIB_FLAGS: u32 = 3; + +pub const NFTNL_EXPR_OBJREF_IMM_TYPE: u32 = 1; +pub const NFTNL_EXPR_OBJREF_IMM_NAME: u32 = 2; +pub const NFTNL_EXPR_OBJREF_SET_SREG: u32 = 3; +pub const NFTNL_EXPR_OBJREF_SET_NAME: u32 = 4; +pub const NFTNL_EXPR_OBJREF_SET_ID: u32 = 5; + +pub const NFTNL_EXPR_OSF_DREG: u32 = 1; +pub const NFTNL_EXPR_OSF_TTL: u32 = 2; +pub const NFTNL_EXPR_OSF_FLAGS: u32 = 3; + +pub const NFTNL_EXPR_XFRM_DREG: u32 = 1; +pub const NFTNL_EXPR_XFRM_SREG: u32 = 2; +pub const NFTNL_EXPR_XFRM_KEY: u32 = 3; +pub const NFTNL_EXPR_XFRM_DIR: u32 = 4; +pub const NFTNL_EXPR_XFRM_SPNUM: u32 = 5; + +pub const NFTNL_EXPR_SYNPROXY_MSS: u32 = 1; +pub const NFTNL_EXPR_SYNPROXY_WSCALE: u32 = 2; +pub const NFTNL_EXPR_SYNPROXY_FLAGS: u32 = 3; + +#[repr(C)] +pub struct nftnl_gen(c_void); + +extern "C" { + pub fn nftnl_gen_alloc() -> *mut nftnl_gen; + + pub fn nftnl_gen_free(arg1: *const nftnl_gen); +} +pub const NFTNL_GEN_ID: u32 = 0; +pub const __NFTNL_GEN_MAX: u32 = 1; + +extern "C" { + pub fn nftnl_gen_is_set(gen: *const nftnl_gen, attr: u16) -> bool; + + pub fn nftnl_gen_unset(gen: *mut nftnl_gen, attr: u16); + + pub fn nftnl_gen_set(gen: *mut nftnl_gen, attr: u16, data: *const c_void) -> c_int; + + pub fn nftnl_gen_set_data( + gen: *mut nftnl_gen, + attr: u16, + data: *const c_void, + data_len: u32, + ) -> c_int; + + pub fn nftnl_gen_get(gen: *const nftnl_gen, attr: u16) -> *const c_void; + + pub fn nftnl_gen_get_data( + gen: *const nftnl_gen, + attr: u16, + data_len: *mut u32, + ) -> *const c_void; + + pub fn nftnl_gen_set_u32(gen: *mut nftnl_gen, attr: u16, data: u32); + + pub fn nftnl_gen_get_u32(gen: *const nftnl_gen, attr: u16) -> u32; + + pub fn nftnl_gen_nlmsg_parse(nlh: *const nlmsghdr, gen: *mut nftnl_gen) -> c_int; + + pub fn nftnl_gen_snprintf( + buf: *mut c_char, + size: usize, + gen: *const nftnl_gen, + type_: u32, + flags: u32, + ) -> c_int; + + pub fn nftnl_gen_fprintf(fp: *mut FILE, gen: *const nftnl_gen, type_: u32, flags: u32) + -> c_int; +} +pub const NFTNL_OBJ_TABLE: u32 = 0; +pub const NFTNL_OBJ_NAME: u32 = 1; +pub const NFTNL_OBJ_TYPE: u32 = 2; +pub const NFTNL_OBJ_FAMILY: u32 = 3; +pub const NFTNL_OBJ_USE: u32 = 4; +pub const NFTNL_OBJ_HANDLE: u32 = 5; +pub const NFTNL_OBJ_USERDATA: u32 = 6; +pub const NFTNL_OBJ_BASE: u32 = 16; +pub const __NFTNL_OBJ_MAX: u32 = 17; + +pub const NFTNL_OBJ_CTR_PKTS: u32 = 16; +pub const NFTNL_OBJ_CTR_BYTES: u32 = 17; + +pub const NFTNL_OBJ_QUOTA_BYTES: u32 = 16; +pub const NFTNL_OBJ_QUOTA_CONSUMED: u32 = 17; +pub const NFTNL_OBJ_QUOTA_FLAGS: u32 = 18; + +pub const NFTNL_OBJ_CT_HELPER_NAME: u32 = 16; +pub const NFTNL_OBJ_CT_HELPER_L3PROTO: u32 = 17; +pub const NFTNL_OBJ_CT_HELPER_L4PROTO: u32 = 18; + +pub const NFTNL_CTTIMEOUT_TCP_SYN_SENT: nftnl_cttimeout_array_tcp = 0; +pub const NFTNL_CTTIMEOUT_TCP_SYN_RECV: nftnl_cttimeout_array_tcp = 1; +pub const NFTNL_CTTIMEOUT_TCP_ESTABLISHED: nftnl_cttimeout_array_tcp = 2; +pub const NFTNL_CTTIMEOUT_TCP_FIN_WAIT: nftnl_cttimeout_array_tcp = 3; +pub const NFTNL_CTTIMEOUT_TCP_CLOSE_WAIT: nftnl_cttimeout_array_tcp = 4; +pub const NFTNL_CTTIMEOUT_TCP_LAST_ACK: nftnl_cttimeout_array_tcp = 5; +pub const NFTNL_CTTIMEOUT_TCP_TIME_WAIT: nftnl_cttimeout_array_tcp = 6; +pub const NFTNL_CTTIMEOUT_TCP_CLOSE: nftnl_cttimeout_array_tcp = 7; +pub const NFTNL_CTTIMEOUT_TCP_SYN_SENT2: nftnl_cttimeout_array_tcp = 8; +pub const NFTNL_CTTIMEOUT_TCP_RETRANS: nftnl_cttimeout_array_tcp = 9; +pub const NFTNL_CTTIMEOUT_TCP_UNACK: nftnl_cttimeout_array_tcp = 10; +pub const NFTNL_CTTIMEOUT_TCP_MAX: nftnl_cttimeout_array_tcp = 11; +pub type nftnl_cttimeout_array_tcp = c_uint; +pub const NFTNL_CTTIMEOUT_UDP_UNREPLIED: nftnl_cttimeout_array_udp = 0; +pub const NFTNL_CTTIMEOUT_UDP_REPLIED: nftnl_cttimeout_array_udp = 1; +pub const NFTNL_CTTIMEOUT_UDP_MAX: nftnl_cttimeout_array_udp = 2; +pub type nftnl_cttimeout_array_udp = c_uint; +pub const NFTNL_OBJ_CT_TIMEOUT_L3PROTO: u32 = 16; +pub const NFTNL_OBJ_CT_TIMEOUT_L4PROTO: u32 = 17; +pub const NFTNL_OBJ_CT_TIMEOUT_ARRAY: u32 = 18; + +pub const NFTNL_OBJ_CT_EXPECT_L3PROTO: u32 = 16; +pub const NFTNL_OBJ_CT_EXPECT_L4PROTO: u32 = 17; +pub const NFTNL_OBJ_CT_EXPECT_DPORT: u32 = 18; +pub const NFTNL_OBJ_CT_EXPECT_TIMEOUT: u32 = 19; +pub const NFTNL_OBJ_CT_EXPECT_SIZE: u32 = 20; + +pub const NFTNL_OBJ_LIMIT_RATE: u32 = 16; +pub const NFTNL_OBJ_LIMIT_UNIT: u32 = 17; +pub const NFTNL_OBJ_LIMIT_BURST: u32 = 18; +pub const NFTNL_OBJ_LIMIT_TYPE: u32 = 19; +pub const NFTNL_OBJ_LIMIT_FLAGS: u32 = 20; + +pub const NFTNL_OBJ_SYNPROXY_MSS: u32 = 16; +pub const NFTNL_OBJ_SYNPROXY_WSCALE: u32 = 17; +pub const NFTNL_OBJ_SYNPROXY_FLAGS: u32 = 18; + +pub const NFTNL_OBJ_TUNNEL_ID: u32 = 16; +pub const NFTNL_OBJ_TUNNEL_IPV4_SRC: u32 = 17; +pub const NFTNL_OBJ_TUNNEL_IPV4_DST: u32 = 18; +pub const NFTNL_OBJ_TUNNEL_IPV6_SRC: u32 = 19; +pub const NFTNL_OBJ_TUNNEL_IPV6_DST: u32 = 20; +pub const NFTNL_OBJ_TUNNEL_IPV6_FLOWLABEL: u32 = 21; +pub const NFTNL_OBJ_TUNNEL_SPORT: u32 = 22; +pub const NFTNL_OBJ_TUNNEL_DPORT: u32 = 23; +pub const NFTNL_OBJ_TUNNEL_FLAGS: u32 = 24; +pub const NFTNL_OBJ_TUNNEL_TOS: u32 = 25; +pub const NFTNL_OBJ_TUNNEL_TTL: u32 = 26; +pub const NFTNL_OBJ_TUNNEL_VXLAN_GBP: u32 = 27; +pub const NFTNL_OBJ_TUNNEL_ERSPAN_VERSION: u32 = 28; +pub const NFTNL_OBJ_TUNNEL_ERSPAN_V1_INDEX: u32 = 29; +pub const NFTNL_OBJ_TUNNEL_ERSPAN_V2_HWID: u32 = 30; +pub const NFTNL_OBJ_TUNNEL_ERSPAN_V2_DIR: u32 = 31; + +pub const NFTNL_OBJ_SECMARK_CTX: u32 = 16; + +#[repr(C)] +pub struct nftnl_obj(c_void); + +extern "C" { + pub fn nftnl_obj_alloc() -> *mut nftnl_obj; + + pub fn nftnl_obj_free(ne: *const nftnl_obj); + + pub fn nftnl_obj_is_set(ne: *const nftnl_obj, attr: u16) -> bool; + + pub fn nftnl_obj_unset(ne: *mut nftnl_obj, attr: u16); + + pub fn nftnl_obj_set_data(ne: *mut nftnl_obj, attr: u16, data: *const c_void, data_len: u32); + + pub fn nftnl_obj_set(ne: *mut nftnl_obj, attr: u16, data: *const c_void); + + pub fn nftnl_obj_set_u8(ne: *mut nftnl_obj, attr: u16, val: u8); + + pub fn nftnl_obj_set_u16(ne: *mut nftnl_obj, attr: u16, val: u16); + + pub fn nftnl_obj_set_u32(ne: *mut nftnl_obj, attr: u16, val: u32); + + pub fn nftnl_obj_set_u64(obj: *mut nftnl_obj, attr: u16, val: u64); + + pub fn nftnl_obj_set_str(ne: *mut nftnl_obj, attr: u16, str_: *const c_char); + + pub fn nftnl_obj_get_data(ne: *mut nftnl_obj, attr: u16, data_len: *mut u32) -> *const c_void; + + pub fn nftnl_obj_get(ne: *mut nftnl_obj, attr: u16) -> *const c_void; + + pub fn nftnl_obj_get_u8(ne: *mut nftnl_obj, attr: u16) -> u8; + + pub fn nftnl_obj_get_u16(obj: *mut nftnl_obj, attr: u16) -> u16; + + pub fn nftnl_obj_get_u32(ne: *mut nftnl_obj, attr: u16) -> u32; + + pub fn nftnl_obj_get_u64(obj: *mut nftnl_obj, attr: u16) -> u64; + + pub fn nftnl_obj_get_str(ne: *mut nftnl_obj, attr: u16) -> *const c_char; + + pub fn nftnl_obj_nlmsg_build_payload(nlh: *mut nlmsghdr, ne: *const nftnl_obj); + + pub fn nftnl_obj_nlmsg_parse(nlh: *const nlmsghdr, ne: *mut nftnl_obj) -> c_int; + + pub fn nftnl_obj_parse( + ne: *mut nftnl_obj, + type_: nftnl_parse_type, + data: *const c_char, + err: *mut nftnl_parse_err, + ) -> c_int; + + pub fn nftnl_obj_parse_file( + ne: *mut nftnl_obj, + type_: nftnl_parse_type, + fp: *mut FILE, + err: *mut nftnl_parse_err, + ) -> c_int; + + pub fn nftnl_obj_snprintf( + buf: *mut c_char, + size: usize, + ne: *const nftnl_obj, + type_: u32, + flags: u32, + ) -> c_int; + + pub fn nftnl_obj_fprintf(fp: *mut FILE, ne: *const nftnl_obj, type_: u32, flags: u32) -> c_int; +} +#[repr(C)] +pub struct nftnl_obj_list(c_void); + +extern "C" { + pub fn nftnl_obj_list_alloc() -> *mut nftnl_obj_list; + + pub fn nftnl_obj_list_free(list: *mut nftnl_obj_list); + + pub fn nftnl_obj_list_is_empty(list: *mut nftnl_obj_list) -> c_int; + + pub fn nftnl_obj_list_add(r: *mut nftnl_obj, list: *mut nftnl_obj_list); + + pub fn nftnl_obj_list_add_tail(r: *mut nftnl_obj, list: *mut nftnl_obj_list); + + pub fn nftnl_obj_list_del(t: *mut nftnl_obj); + + pub fn nftnl_obj_list_foreach( + table_list: *mut nftnl_obj_list, + cb: Option c_int>, + data: *mut c_void, + ) -> c_int; +} +#[repr(C)] +pub struct nftnl_obj_list_iter(c_void); + +extern "C" { + pub fn nftnl_obj_list_iter_create(l: *mut nftnl_obj_list) -> *mut nftnl_obj_list_iter; + + pub fn nftnl_obj_list_iter_next(iter: *mut nftnl_obj_list_iter) -> *mut nftnl_obj; + + pub fn nftnl_obj_list_iter_destroy(iter: *mut nftnl_obj_list_iter); + + pub fn nftnl_rule_alloc() -> *mut nftnl_rule; + + pub fn nftnl_rule_free(arg1: *const nftnl_rule); +} +pub const NFTNL_RULE_FAMILY: nftnl_rule_attr = 0; +pub const NFTNL_RULE_TABLE: nftnl_rule_attr = 1; +pub const NFTNL_RULE_CHAIN: nftnl_rule_attr = 2; +pub const NFTNL_RULE_HANDLE: nftnl_rule_attr = 3; +pub const NFTNL_RULE_COMPAT_PROTO: nftnl_rule_attr = 4; +pub const NFTNL_RULE_COMPAT_FLAGS: nftnl_rule_attr = 5; +pub const NFTNL_RULE_POSITION: nftnl_rule_attr = 6; +pub const NFTNL_RULE_USERDATA: nftnl_rule_attr = 7; +pub const NFTNL_RULE_ID: nftnl_rule_attr = 8; +pub const NFTNL_RULE_POSITION_ID: nftnl_rule_attr = 9; +pub const __NFTNL_RULE_MAX: nftnl_rule_attr = 10; +pub type nftnl_rule_attr = c_uint; +extern "C" { + pub fn nftnl_rule_unset(r: *mut nftnl_rule, attr: u16); + + pub fn nftnl_rule_is_set(r: *const nftnl_rule, attr: u16) -> bool; + + pub fn nftnl_rule_set(r: *mut nftnl_rule, attr: u16, data: *const c_void) -> c_int; + + pub fn nftnl_rule_set_data( + r: *mut nftnl_rule, + attr: u16, + data: *const c_void, + data_len: u32, + ) -> c_int; + + pub fn nftnl_rule_set_u32(r: *mut nftnl_rule, attr: u16, val: u32); + + pub fn nftnl_rule_set_u64(r: *mut nftnl_rule, attr: u16, val: u64); + + pub fn nftnl_rule_set_str(r: *mut nftnl_rule, attr: u16, str_: *const c_char) -> c_int; + + pub fn nftnl_rule_get(r: *const nftnl_rule, attr: u16) -> *const c_void; + + pub fn nftnl_rule_get_data( + r: *const nftnl_rule, + attr: u16, + data_len: *mut u32, + ) -> *const c_void; + + pub fn nftnl_rule_get_str(r: *const nftnl_rule, attr: u16) -> *const c_char; + + pub fn nftnl_rule_get_u8(r: *const nftnl_rule, attr: u16) -> u8; + + pub fn nftnl_rule_get_u32(r: *const nftnl_rule, attr: u16) -> u32; + + pub fn nftnl_rule_get_u64(r: *const nftnl_rule, attr: u16) -> u64; + + pub fn nftnl_rule_add_expr(r: *mut nftnl_rule, expr: *mut nftnl_expr); + + pub fn nftnl_rule_del_expr(expr: *mut nftnl_expr); + + pub fn nftnl_rule_nlmsg_build_payload(nlh: *mut nlmsghdr, t: *mut nftnl_rule); + + pub fn nftnl_rule_parse( + r: *mut nftnl_rule, + type_: nftnl_parse_type, + data: *const c_char, + err: *mut nftnl_parse_err, + ) -> c_int; + + pub fn nftnl_rule_parse_file( + r: *mut nftnl_rule, + type_: nftnl_parse_type, + fp: *mut FILE, + err: *mut nftnl_parse_err, + ) -> c_int; + + pub fn nftnl_rule_snprintf( + buf: *mut c_char, + size: usize, + t: *const nftnl_rule, + type_: u32, + flags: u32, + ) -> c_int; + + pub fn nftnl_rule_fprintf(fp: *mut FILE, r: *const nftnl_rule, type_: u32, flags: u32) + -> c_int; + + pub fn nftnl_rule_nlmsg_parse(nlh: *const nlmsghdr, t: *mut nftnl_rule) -> c_int; + + pub fn nftnl_expr_foreach( + r: *mut nftnl_rule, + cb: Option c_int>, + data: *mut c_void, + ) -> c_int; +} +#[repr(C)] +pub struct nftnl_expr_iter(c_void); + +extern "C" { + pub fn nftnl_expr_iter_create(r: *const nftnl_rule) -> *mut nftnl_expr_iter; + + pub fn nftnl_expr_iter_next(iter: *mut nftnl_expr_iter) -> *mut nftnl_expr; + + pub fn nftnl_expr_iter_destroy(iter: *mut nftnl_expr_iter); +} +#[repr(C)] +pub struct nftnl_rule_list(c_void); + +extern "C" { + pub fn nftnl_rule_list_alloc() -> *mut nftnl_rule_list; + + pub fn nftnl_rule_list_free(list: *mut nftnl_rule_list); + + pub fn nftnl_rule_list_is_empty(list: *const nftnl_rule_list) -> c_int; + + pub fn nftnl_rule_list_add(r: *mut nftnl_rule, list: *mut nftnl_rule_list); + + pub fn nftnl_rule_list_add_tail(r: *mut nftnl_rule, list: *mut nftnl_rule_list); + + pub fn nftnl_rule_list_insert_at(r: *mut nftnl_rule, pos: *mut nftnl_rule); + + pub fn nftnl_rule_list_del(r: *mut nftnl_rule); + + pub fn nftnl_rule_list_foreach( + rule_list: *mut nftnl_rule_list, + cb: Option c_int>, + data: *mut c_void, + ) -> c_int; +} +#[repr(C)] +pub struct nftnl_rule_list_iter(c_void); + +extern "C" { + pub fn nftnl_rule_list_iter_create(l: *const nftnl_rule_list) -> *mut nftnl_rule_list_iter; + + pub fn nftnl_rule_list_iter_cur(iter: *mut nftnl_rule_list_iter) -> *mut nftnl_rule; + + pub fn nftnl_rule_list_iter_next(iter: *mut nftnl_rule_list_iter) -> *mut nftnl_rule; + + pub fn nftnl_rule_list_iter_destroy(iter: *const nftnl_rule_list_iter); +} +#[repr(C)] +pub struct nftnl_ruleset(c_void); + +extern "C" { + pub fn nftnl_ruleset_alloc() -> *mut nftnl_ruleset; + + pub fn nftnl_ruleset_free(r: *const nftnl_ruleset); +} +pub const NFTNL_RULESET_TABLELIST: u32 = 0; +pub const NFTNL_RULESET_CHAINLIST: u32 = 1; +pub const NFTNL_RULESET_SETLIST: u32 = 2; +pub const NFTNL_RULESET_RULELIST: u32 = 3; + +pub const NFTNL_RULESET_UNSPEC: nftnl_ruleset_type = 0; +pub const NFTNL_RULESET_RULESET: nftnl_ruleset_type = 1; +pub const NFTNL_RULESET_TABLE: nftnl_ruleset_type = 2; +pub const NFTNL_RULESET_CHAIN: nftnl_ruleset_type = 3; +pub const NFTNL_RULESET_RULE: nftnl_ruleset_type = 4; +pub const NFTNL_RULESET_SET: nftnl_ruleset_type = 5; +pub const NFTNL_RULESET_SET_ELEMS: nftnl_ruleset_type = 6; +pub type nftnl_ruleset_type = c_uint; +extern "C" { + pub fn nftnl_ruleset_is_set(r: *const nftnl_ruleset, attr: u16) -> bool; + + pub fn nftnl_ruleset_unset(r: *mut nftnl_ruleset, attr: u16); + + pub fn nftnl_ruleset_set(r: *mut nftnl_ruleset, attr: u16, data: *mut c_void); + + pub fn nftnl_ruleset_get(r: *const nftnl_ruleset, attr: u16) -> *mut c_void; +} +pub const NFTNL_RULESET_CTX_CMD: u32 = 0; +pub const NFTNL_RULESET_CTX_TYPE: u32 = 1; +pub const NFTNL_RULESET_CTX_TABLE: u32 = 2; +pub const NFTNL_RULESET_CTX_CHAIN: u32 = 3; +pub const NFTNL_RULESET_CTX_RULE: u32 = 4; +pub const NFTNL_RULESET_CTX_SET: u32 = 5; +pub const NFTNL_RULESET_CTX_DATA: u32 = 6; + +#[repr(C)] +pub struct nftnl_parse_ctx(c_void); + +extern "C" { + pub fn nftnl_ruleset_ctx_free(ctx: *const nftnl_parse_ctx); + + pub fn nftnl_ruleset_ctx_is_set(ctx: *const nftnl_parse_ctx, attr: u16) -> bool; + + pub fn nftnl_ruleset_ctx_get(ctx: *const nftnl_parse_ctx, attr: u16) -> *mut c_void; + + pub fn nftnl_ruleset_ctx_get_u32(ctx: *const nftnl_parse_ctx, attr: u16) -> u32; + + pub fn nftnl_ruleset_parse_file_cb( + type_: nftnl_parse_type, + fp: *mut FILE, + err: *mut nftnl_parse_err, + data: *mut c_void, + cb: Option c_int>, + ) -> c_int; + + pub fn nftnl_ruleset_parse_buffer_cb( + type_: nftnl_parse_type, + buffer: *const c_char, + err: *mut nftnl_parse_err, + data: *mut c_void, + cb: Option c_int>, + ) -> c_int; + + pub fn nftnl_ruleset_parse( + rs: *mut nftnl_ruleset, + type_: nftnl_parse_type, + data: *const c_char, + err: *mut nftnl_parse_err, + ) -> c_int; + + pub fn nftnl_ruleset_parse_file( + rs: *mut nftnl_ruleset, + type_: nftnl_parse_type, + fp: *mut FILE, + err: *mut nftnl_parse_err, + ) -> c_int; + + pub fn nftnl_ruleset_snprintf( + buf: *mut c_char, + size: usize, + rs: *const nftnl_ruleset, + type_: u32, + flags: u32, + ) -> c_int; + + pub fn nftnl_ruleset_fprintf( + fp: *mut FILE, + rs: *const nftnl_ruleset, + type_: u32, + flags: u32, + ) -> c_int; +} +pub const NFTNL_SET_TABLE: nftnl_set_attr = 0; +pub const NFTNL_SET_NAME: nftnl_set_attr = 1; +pub const NFTNL_SET_FLAGS: nftnl_set_attr = 2; +pub const NFTNL_SET_KEY_TYPE: nftnl_set_attr = 3; +pub const NFTNL_SET_KEY_LEN: nftnl_set_attr = 4; +pub const NFTNL_SET_DATA_TYPE: nftnl_set_attr = 5; +pub const NFTNL_SET_DATA_LEN: nftnl_set_attr = 6; +pub const NFTNL_SET_FAMILY: nftnl_set_attr = 7; +pub const NFTNL_SET_ID: nftnl_set_attr = 8; +pub const NFTNL_SET_POLICY: nftnl_set_attr = 9; +pub const NFTNL_SET_DESC_SIZE: nftnl_set_attr = 10; +pub const NFTNL_SET_TIMEOUT: nftnl_set_attr = 11; +pub const NFTNL_SET_GC_INTERVAL: nftnl_set_attr = 12; +pub const NFTNL_SET_USERDATA: nftnl_set_attr = 13; +pub const NFTNL_SET_OBJ_TYPE: nftnl_set_attr = 14; +pub const NFTNL_SET_HANDLE: nftnl_set_attr = 15; +pub const NFTNL_SET_DESC_CONCAT: nftnl_set_attr = 16; +pub const NFTNL_SET_EXPR: nftnl_set_attr = 17; +pub const NFTNL_SET_EXPRESSIONS: nftnl_set_attr = 18; +pub const __NFTNL_SET_MAX: nftnl_set_attr = 19; +pub type nftnl_set_attr = c_uint; +#[repr(C)] +pub struct nftnl_set(c_void); + +extern "C" { + pub fn nftnl_set_alloc() -> *mut nftnl_set; + + pub fn nftnl_set_free(s: *const nftnl_set); + + pub fn nftnl_set_clone(set: *const nftnl_set) -> *mut nftnl_set; + + pub fn nftnl_set_is_set(s: *const nftnl_set, attr: u16) -> bool; + + pub fn nftnl_set_unset(s: *mut nftnl_set, attr: u16); + + pub fn nftnl_set_set(s: *mut nftnl_set, attr: u16, data: *const c_void) -> c_int; + + pub fn nftnl_set_set_data( + s: *mut nftnl_set, + attr: u16, + data: *const c_void, + data_len: u32, + ) -> c_int; + + pub fn nftnl_set_set_u32(s: *mut nftnl_set, attr: u16, val: u32); + + pub fn nftnl_set_set_u64(s: *mut nftnl_set, attr: u16, val: u64); + + pub fn nftnl_set_set_str(s: *mut nftnl_set, attr: u16, str_: *const c_char) -> c_int; + + pub fn nftnl_set_get(s: *const nftnl_set, attr: u16) -> *const c_void; + + pub fn nftnl_set_get_data(s: *const nftnl_set, attr: u16, data_len: *mut u32) -> *const c_void; + + pub fn nftnl_set_get_str(s: *const nftnl_set, attr: u16) -> *const c_char; + + pub fn nftnl_set_get_u32(s: *const nftnl_set, attr: u16) -> u32; + + pub fn nftnl_set_get_u64(s: *const nftnl_set, attr: u16) -> u64; + + pub fn nftnl_set_nlmsg_build_payload(nlh: *mut nlmsghdr, s: *mut nftnl_set); + + pub fn nftnl_set_nlmsg_parse(nlh: *const nlmsghdr, s: *mut nftnl_set) -> c_int; + + pub fn nftnl_set_elems_nlmsg_parse(nlh: *const nlmsghdr, s: *mut nftnl_set) -> c_int; + + pub fn nftnl_set_snprintf( + buf: *mut c_char, + size: usize, + s: *const nftnl_set, + type_: u32, + flags: u32, + ) -> c_int; + + pub fn nftnl_set_fprintf(fp: *mut FILE, s: *const nftnl_set, type_: u32, flags: u32) -> c_int; +} +#[repr(C)] +pub struct nftnl_set_list(c_void); + +extern "C" { + pub fn nftnl_set_list_alloc() -> *mut nftnl_set_list; + + pub fn nftnl_set_list_free(list: *mut nftnl_set_list); + + pub fn nftnl_set_list_is_empty(list: *const nftnl_set_list) -> c_int; + + pub fn nftnl_set_list_add(s: *mut nftnl_set, list: *mut nftnl_set_list); + + pub fn nftnl_set_list_add_tail(s: *mut nftnl_set, list: *mut nftnl_set_list); + + pub fn nftnl_set_list_del(s: *mut nftnl_set); + + pub fn nftnl_set_list_foreach( + set_list: *mut nftnl_set_list, + cb: Option c_int>, + data: *mut c_void, + ) -> c_int; + + pub fn nftnl_set_list_lookup_byname( + set_list: *mut nftnl_set_list, + set: *const c_char, + ) -> *mut nftnl_set; + + pub fn nftnl_set_add_expr(s: *mut nftnl_set, expr: *mut nftnl_expr); + + pub fn nftnl_set_expr_foreach( + s: *const nftnl_set, + cb: Option c_int>, + data: *mut c_void, + ) -> c_int; +} +#[repr(C)] +pub struct nftnl_set_list_iter(c_void); + +extern "C" { + pub fn nftnl_set_list_iter_create(l: *const nftnl_set_list) -> *mut nftnl_set_list_iter; + + pub fn nftnl_set_list_iter_cur(iter: *const nftnl_set_list_iter) -> *mut nftnl_set; + + pub fn nftnl_set_list_iter_next(iter: *mut nftnl_set_list_iter) -> *mut nftnl_set; + + pub fn nftnl_set_list_iter_destroy(iter: *const nftnl_set_list_iter); + + pub fn nftnl_set_parse( + s: *mut nftnl_set, + type_: nftnl_parse_type, + data: *const c_char, + err: *mut nftnl_parse_err, + ) -> c_int; + + pub fn nftnl_set_parse_file( + s: *mut nftnl_set, + type_: nftnl_parse_type, + fp: *mut FILE, + err: *mut nftnl_parse_err, + ) -> c_int; +} +pub const NFTNL_SET_ELEM_FLAGS: u32 = 0; +pub const NFTNL_SET_ELEM_KEY: u32 = 1; +pub const NFTNL_SET_ELEM_VERDICT: u32 = 2; +pub const NFTNL_SET_ELEM_CHAIN: u32 = 3; +pub const NFTNL_SET_ELEM_DATA: u32 = 4; +pub const NFTNL_SET_ELEM_TIMEOUT: u32 = 5; +pub const NFTNL_SET_ELEM_EXPIRATION: u32 = 6; +pub const NFTNL_SET_ELEM_USERDATA: u32 = 7; +pub const NFTNL_SET_ELEM_EXPR: u32 = 8; +pub const NFTNL_SET_ELEM_OBJREF: u32 = 9; +pub const NFTNL_SET_ELEM_KEY_END: u32 = 10; +pub const NFTNL_SET_ELEM_EXPRESSIONS: u32 = 11; +pub const __NFTNL_SET_ELEM_MAX: u32 = 12; + +#[repr(C)] +pub struct nftnl_set_elem(c_void); + +extern "C" { + pub fn nftnl_set_elem_alloc() -> *mut nftnl_set_elem; + + pub fn nftnl_set_elem_free(s: *mut nftnl_set_elem); + + pub fn nftnl_set_elem_clone(elem: *mut nftnl_set_elem) -> *mut nftnl_set_elem; + + pub fn nftnl_set_elem_add(s: *mut nftnl_set, elem: *mut nftnl_set_elem); + + pub fn nftnl_set_elem_unset(s: *mut nftnl_set_elem, attr: u16); + + pub fn nftnl_set_elem_set( + s: *mut nftnl_set_elem, + attr: u16, + data: *const c_void, + data_len: u32, + ) -> c_int; + + pub fn nftnl_set_elem_set_u32(s: *mut nftnl_set_elem, attr: u16, val: u32); + + pub fn nftnl_set_elem_set_u64(s: *mut nftnl_set_elem, attr: u16, val: u64); + + pub fn nftnl_set_elem_set_str(s: *mut nftnl_set_elem, attr: u16, str_: *const c_char) -> c_int; + + pub fn nftnl_set_elem_get( + s: *mut nftnl_set_elem, + attr: u16, + data_len: *mut u32, + ) -> *const c_void; + + pub fn nftnl_set_elem_get_str(s: *mut nftnl_set_elem, attr: u16) -> *const c_char; + + pub fn nftnl_set_elem_get_u32(s: *mut nftnl_set_elem, attr: u16) -> u32; + + pub fn nftnl_set_elem_get_u64(s: *mut nftnl_set_elem, attr: u16) -> u64; + + pub fn nftnl_set_elem_is_set(s: *const nftnl_set_elem, attr: u16) -> bool; + + pub fn nftnl_set_elems_nlmsg_build_payload(nlh: *mut nlmsghdr, s: *mut nftnl_set); + + pub fn nftnl_set_elem_nlmsg_build_payload(nlh: *mut nlmsghdr, e: *mut nftnl_set_elem); + + pub fn nftnl_set_elem_parse( + e: *mut nftnl_set_elem, + type_: nftnl_parse_type, + data: *const c_char, + err: *mut nftnl_parse_err, + ) -> c_int; + + pub fn nftnl_set_elem_parse_file( + e: *mut nftnl_set_elem, + type_: nftnl_parse_type, + fp: *mut FILE, + err: *mut nftnl_parse_err, + ) -> c_int; + + pub fn nftnl_set_elem_snprintf( + buf: *mut c_char, + size: usize, + s: *const nftnl_set_elem, + type_: u32, + flags: u32, + ) -> c_int; + + pub fn nftnl_set_elem_fprintf( + fp: *mut FILE, + se: *const nftnl_set_elem, + type_: u32, + flags: u32, + ) -> c_int; + + pub fn nftnl_set_elem_add_expr(e: *mut nftnl_set_elem, expr: *mut nftnl_expr); + + pub fn nftnl_set_elem_expr_foreach( + e: *mut nftnl_set_elem, + cb: Option c_int>, + data: *mut c_void, + ) -> c_int; + + pub fn nftnl_set_elem_foreach( + s: *mut nftnl_set, + cb: Option c_int>, + data: *mut c_void, + ) -> c_int; +} +#[repr(C)] +pub struct nftnl_set_elems_iter(c_void); + +extern "C" { + pub fn nftnl_set_elems_iter_create(s: *const nftnl_set) -> *mut nftnl_set_elems_iter; + + pub fn nftnl_set_elems_iter_cur(iter: *const nftnl_set_elems_iter) -> *mut nftnl_set_elem; + + pub fn nftnl_set_elems_iter_next(iter: *mut nftnl_set_elems_iter) -> *mut nftnl_set_elem; + + pub fn nftnl_set_elems_iter_destroy(iter: *mut nftnl_set_elems_iter); + + pub fn nftnl_set_elems_nlmsg_build_payload_iter( + nlh: *mut nlmsghdr, + iter: *mut nftnl_set_elems_iter, + ) -> c_int; +} +#[repr(C)] +pub struct nftnl_table(c_void); + +extern "C" { + pub fn nftnl_table_alloc() -> *mut nftnl_table; + + pub fn nftnl_table_free(arg1: *const nftnl_table); +} +pub const NFTNL_TABLE_NAME: nftnl_table_attr = 0; +pub const NFTNL_TABLE_FAMILY: nftnl_table_attr = 1; +pub const NFTNL_TABLE_FLAGS: nftnl_table_attr = 2; +pub const NFTNL_TABLE_USE: nftnl_table_attr = 3; +pub const NFTNL_TABLE_HANDLE: nftnl_table_attr = 4; +pub const NFTNL_TABLE_USERDATA: nftnl_table_attr = 5; +pub const __NFTNL_TABLE_MAX: nftnl_table_attr = 6; +pub type nftnl_table_attr = c_uint; +extern "C" { + pub fn nftnl_table_is_set(t: *const nftnl_table, attr: u16) -> bool; + + pub fn nftnl_table_unset(t: *mut nftnl_table, attr: u16); + + pub fn nftnl_table_set(t: *mut nftnl_table, attr: u16, data: *const c_void); + + pub fn nftnl_table_set_data( + t: *mut nftnl_table, + attr: u16, + data: *const c_void, + data_len: u32, + ) -> c_int; + + pub fn nftnl_table_get(t: *const nftnl_table, attr: u16) -> *const c_void; + + pub fn nftnl_table_get_data( + t: *const nftnl_table, + attr: u16, + data_len: *mut u32, + ) -> *const c_void; + + pub fn nftnl_table_set_u8(t: *mut nftnl_table, attr: u16, data: u8); + + pub fn nftnl_table_set_u32(t: *mut nftnl_table, attr: u16, data: u32); + + pub fn nftnl_table_set_u64(t: *mut nftnl_table, attr: u16, data: u64); + + pub fn nftnl_table_set_str(t: *mut nftnl_table, attr: u16, str_: *const c_char) -> c_int; + + pub fn nftnl_table_get_u8(t: *const nftnl_table, attr: u16) -> u8; + + pub fn nftnl_table_get_u32(t: *const nftnl_table, attr: u16) -> u32; + + pub fn nftnl_table_get_u64(t: *const nftnl_table, attr: u16) -> u64; + + pub fn nftnl_table_get_str(t: *const nftnl_table, attr: u16) -> *const c_char; + + pub fn nftnl_table_nlmsg_build_payload(nlh: *mut nlmsghdr, t: *const nftnl_table); + + pub fn nftnl_table_parse( + t: *mut nftnl_table, + type_: nftnl_parse_type, + data: *const c_char, + err: *mut nftnl_parse_err, + ) -> c_int; + + pub fn nftnl_table_parse_file( + t: *mut nftnl_table, + type_: nftnl_parse_type, + fp: *mut FILE, + err: *mut nftnl_parse_err, + ) -> c_int; + + pub fn nftnl_table_snprintf( + buf: *mut c_char, + size: usize, + t: *const nftnl_table, + type_: u32, + flags: u32, + ) -> c_int; + + pub fn nftnl_table_fprintf( + fp: *mut FILE, + t: *const nftnl_table, + type_: u32, + flags: u32, + ) -> c_int; + + pub fn nftnl_table_nlmsg_parse(nlh: *const nlmsghdr, t: *mut nftnl_table) -> c_int; +} +#[repr(C)] +pub struct nftnl_table_list(c_void); + +extern "C" { + pub fn nftnl_table_list_alloc() -> *mut nftnl_table_list; + + pub fn nftnl_table_list_free(list: *mut nftnl_table_list); + + pub fn nftnl_table_list_is_empty(list: *const nftnl_table_list) -> c_int; + + pub fn nftnl_table_list_foreach( + table_list: *mut nftnl_table_list, + cb: Option c_int>, + data: *mut c_void, + ) -> c_int; + + pub fn nftnl_table_list_add(r: *mut nftnl_table, list: *mut nftnl_table_list); + + pub fn nftnl_table_list_add_tail(r: *mut nftnl_table, list: *mut nftnl_table_list); + + pub fn nftnl_table_list_del(r: *mut nftnl_table); +} +#[repr(C)] +pub struct nftnl_table_list_iter(c_void); + +extern "C" { + pub fn nftnl_table_list_iter_create(l: *const nftnl_table_list) -> *mut nftnl_table_list_iter; + + pub fn nftnl_table_list_iter_next(iter: *mut nftnl_table_list_iter) -> *mut nftnl_table; + + pub fn nftnl_table_list_iter_destroy(iter: *const nftnl_table_list_iter); +} +pub const NFTNL_TRACE_CHAIN: nftnl_trace_attr = 0; +pub const NFTNL_TRACE_FAMILY: nftnl_trace_attr = 1; +pub const NFTNL_TRACE_ID: nftnl_trace_attr = 2; +pub const NFTNL_TRACE_IIF: nftnl_trace_attr = 3; +pub const NFTNL_TRACE_IIFTYPE: nftnl_trace_attr = 4; +pub const NFTNL_TRACE_JUMP_TARGET: nftnl_trace_attr = 5; +pub const NFTNL_TRACE_OIF: nftnl_trace_attr = 6; +pub const NFTNL_TRACE_OIFTYPE: nftnl_trace_attr = 7; +pub const NFTNL_TRACE_MARK: nftnl_trace_attr = 8; +pub const NFTNL_TRACE_LL_HEADER: nftnl_trace_attr = 9; +pub const NFTNL_TRACE_NETWORK_HEADER: nftnl_trace_attr = 10; +pub const NFTNL_TRACE_TRANSPORT_HEADER: nftnl_trace_attr = 11; +pub const NFTNL_TRACE_TABLE: nftnl_trace_attr = 12; +pub const NFTNL_TRACE_TYPE: nftnl_trace_attr = 13; +pub const NFTNL_TRACE_RULE_HANDLE: nftnl_trace_attr = 14; +pub const NFTNL_TRACE_VERDICT: nftnl_trace_attr = 15; +pub const NFTNL_TRACE_NFPROTO: nftnl_trace_attr = 16; +pub const NFTNL_TRACE_POLICY: nftnl_trace_attr = 17; +pub const __NFTNL_TRACE_MAX: nftnl_trace_attr = 18; +pub type nftnl_trace_attr = c_uint; +#[repr(C)] +pub struct nftnl_trace(c_void); + +extern "C" { + pub fn nftnl_trace_alloc() -> *mut nftnl_trace; + + pub fn nftnl_trace_free(trace: *const nftnl_trace); + + pub fn nftnl_trace_is_set(trace: *const nftnl_trace, type_: u16) -> bool; + + pub fn nftnl_trace_get_data( + trace: *const nftnl_trace, + type_: u16, + data_len: *mut u32, + ) -> *const c_void; + + pub fn nftnl_trace_get_u16(trace: *const nftnl_trace, type_: u16) -> u16; + + pub fn nftnl_trace_get_u32(trace: *const nftnl_trace, type_: u16) -> u32; + + pub fn nftnl_trace_get_u64(trace: *const nftnl_trace, type_: u16) -> u64; + + pub fn nftnl_trace_get_str(trace: *const nftnl_trace, type_: u16) -> *const c_char; + + pub fn nftnl_trace_nlmsg_parse(nlh: *const nlmsghdr, t: *mut nftnl_trace) -> c_int; +} +pub const NFTNL_UDATA_TABLE_COMMENT: nftnl_udata_table_types = 0; +pub const __NFTNL_UDATA_TABLE_MAX: nftnl_udata_table_types = 1; +pub type nftnl_udata_table_types = c_uint; +pub const NFTNL_UDATA_CHAIN_COMMENT: nftnl_udata_chain_types = 0; +pub const __NFTNL_UDATA_CHAIN_MAX: nftnl_udata_chain_types = 1; +pub type nftnl_udata_chain_types = c_uint; +pub const NFTNL_UDATA_RULE_COMMENT: nftnl_udata_rule_types = 0; +pub const NFTNL_UDATA_RULE_EBTABLES_POLICY: nftnl_udata_rule_types = 1; +pub const __NFTNL_UDATA_RULE_MAX: nftnl_udata_rule_types = 2; +pub type nftnl_udata_rule_types = c_uint; +pub const NFTNL_UDATA_OBJ_COMMENT: nftnl_udata_obj_types = 0; +pub const __NFTNL_UDATA_OBJ_MAX: nftnl_udata_obj_types = 1; +pub type nftnl_udata_obj_types = c_uint; +pub const NFTNL_UDATA_SET_KEYBYTEORDER: nftnl_udata_set_types = 0; +pub const NFTNL_UDATA_SET_DATABYTEORDER: nftnl_udata_set_types = 1; +pub const NFTNL_UDATA_SET_MERGE_ELEMENTS: nftnl_udata_set_types = 2; +pub const NFTNL_UDATA_SET_KEY_TYPEOF: nftnl_udata_set_types = 3; +pub const NFTNL_UDATA_SET_DATA_TYPEOF: nftnl_udata_set_types = 4; +pub const NFTNL_UDATA_SET_EXPR: nftnl_udata_set_types = 5; +pub const NFTNL_UDATA_SET_DATA_INTERVAL: nftnl_udata_set_types = 6; +pub const NFTNL_UDATA_SET_COMMENT: nftnl_udata_set_types = 7; +pub const __NFTNL_UDATA_SET_MAX: nftnl_udata_set_types = 8; +pub type nftnl_udata_set_types = c_uint; +pub const NFTNL_UDATA_SET_TYPEOF_EXPR: u32 = 0; +pub const NFTNL_UDATA_SET_TYPEOF_DATA: u32 = 1; +pub const __NFTNL_UDATA_SET_TYPEOF_MAX: u32 = 2; + +pub const NFTNL_UDATA_SET_ELEM_COMMENT: nftnl_udata_set_elem_types = 0; +pub const NFTNL_UDATA_SET_ELEM_FLAGS: nftnl_udata_set_elem_types = 1; +pub const __NFTNL_UDATA_SET_ELEM_MAX: nftnl_udata_set_elem_types = 2; +pub type nftnl_udata_set_elem_types = c_uint; +pub const NFTNL_SET_ELEM_F_INTERVAL_OPEN: nftnl_udata_set_elem_flags = 1; +pub type nftnl_udata_set_elem_flags = c_uint; +#[repr(C)] +pub struct nftnl_udata(c_void); + +#[repr(C)] +pub struct nftnl_udata_buf(c_void); + +extern "C" { + pub fn nftnl_udata_buf_alloc(data_size: u32) -> *mut nftnl_udata_buf; + + pub fn nftnl_udata_buf_free(buf: *const nftnl_udata_buf); + + pub fn nftnl_udata_buf_len(buf: *const nftnl_udata_buf) -> u32; + + pub fn nftnl_udata_buf_data(buf: *const nftnl_udata_buf) -> *mut c_void; + + pub fn nftnl_udata_buf_put(buf: *mut nftnl_udata_buf, data: *const c_void, len: u32); + + pub fn nftnl_udata_start(buf: *const nftnl_udata_buf) -> *mut nftnl_udata; + + pub fn nftnl_udata_end(buf: *const nftnl_udata_buf) -> *mut nftnl_udata; + + pub fn nftnl_udata_put( + buf: *mut nftnl_udata_buf, + type_: u8, + len: u32, + value: *const c_void, + ) -> bool; + + pub fn nftnl_udata_put_u32(buf: *mut nftnl_udata_buf, type_: u8, data: u32) -> bool; + + pub fn nftnl_udata_put_strz(buf: *mut nftnl_udata_buf, type_: u8, strz: *const c_char) -> bool; + + pub fn nftnl_udata_nest_start(buf: *mut nftnl_udata_buf, type_: u8) -> *mut nftnl_udata; + + pub fn nftnl_udata_nest_end(buf: *mut nftnl_udata_buf, ud: *mut nftnl_udata); + + pub fn nftnl_udata_type(attr: *const nftnl_udata) -> u8; + + pub fn nftnl_udata_len(attr: *const nftnl_udata) -> u8; + + pub fn nftnl_udata_get(attr: *const nftnl_udata) -> *mut c_void; + + pub fn nftnl_udata_get_u32(attr: *const nftnl_udata) -> u32; + + pub fn nftnl_udata_next(attr: *const nftnl_udata) -> *mut nftnl_udata; +} +pub type nftnl_udata_cb_t = + Option c_int>; +extern "C" { + pub fn nftnl_udata_parse( + data: *const c_void, + data_len: u32, + cb: nftnl_udata_cb_t, + cb_data: *mut c_void, + ) -> c_int; +} diff --git a/nftnl-sys/src/nftnl_1_2_0.rs b/nftnl-sys/src/nftnl_1_2_0.rs new file mode 100644 index 0000000..f2d3332 --- /dev/null +++ b/nftnl-sys/src/nftnl_1_2_0.rs @@ -0,0 +1,1476 @@ +/* automatically generated by rust-bindgen 0.69.4 */ + +use core::option::Option; +use libc::{c_char, c_int, c_uint, c_void, iovec, nlmsghdr, FILE}; + +pub const NFTNL_UDATA_COMMENT_MAXLEN: u32 = 128; +#[repr(C)] +pub struct nftnl_batch(c_void); + +extern "C" { + pub fn nftnl_batch_alloc(pg_size: u32, pg_overrun_size: u32) -> *mut nftnl_batch; + + pub fn nftnl_batch_update(batch: *mut nftnl_batch) -> c_int; + + pub fn nftnl_batch_free(batch: *mut nftnl_batch); + + pub fn nftnl_batch_buffer(batch: *mut nftnl_batch) -> *mut c_void; + + pub fn nftnl_batch_buffer_len(batch: *mut nftnl_batch) -> u32; + + pub fn nftnl_batch_iovec_len(batch: *mut nftnl_batch) -> c_int; + + pub fn nftnl_batch_iovec(batch: *mut nftnl_batch, iov: *mut iovec, iovlen: u32); +} +pub const NFTNL_PARSE_EBADINPUT: u32 = 0; +pub const NFTNL_PARSE_EMISSINGNODE: u32 = 1; +pub const NFTNL_PARSE_EBADTYPE: u32 = 2; +pub const NFTNL_PARSE_EOPNOTSUPP: u32 = 3; + +pub const NFTNL_OUTPUT_DEFAULT: nftnl_output_type = 0; +pub const NFTNL_OUTPUT_XML: nftnl_output_type = 1; +pub const NFTNL_OUTPUT_JSON: nftnl_output_type = 2; +pub type nftnl_output_type = c_uint; +pub const NFTNL_OF_EVENT_NEW: nftnl_output_flags = 1; +pub const NFTNL_OF_EVENT_DEL: nftnl_output_flags = 2; +pub const NFTNL_OF_EVENT_ANY: nftnl_output_flags = 3; +pub type nftnl_output_flags = c_uint; +pub const NFTNL_CMD_UNSPEC: nftnl_cmd_type = 0; +pub const NFTNL_CMD_ADD: nftnl_cmd_type = 1; +pub const NFTNL_CMD_INSERT: nftnl_cmd_type = 2; +pub const NFTNL_CMD_DELETE: nftnl_cmd_type = 3; +pub const NFTNL_CMD_REPLACE: nftnl_cmd_type = 4; +pub const NFTNL_CMD_FLUSH: nftnl_cmd_type = 5; +pub const NFTNL_CMD_MAX: nftnl_cmd_type = 6; +pub type nftnl_cmd_type = c_uint; +pub const NFTNL_PARSE_NONE: nftnl_parse_type = 0; +pub const NFTNL_PARSE_XML: nftnl_parse_type = 1; +pub const NFTNL_PARSE_JSON: nftnl_parse_type = 2; +pub const NFTNL_PARSE_MAX: nftnl_parse_type = 3; +pub type nftnl_parse_type = c_uint; +#[repr(C)] +pub struct nftnl_parse_err(c_void); + +extern "C" { + pub fn nftnl_nlmsg_build_hdr( + buf: *mut c_char, + type_: u16, + family: u16, + flags: u16, + seq: u32, + ) -> *mut nlmsghdr; + + pub fn nftnl_parse_err_alloc() -> *mut nftnl_parse_err; + + pub fn nftnl_parse_err_free(arg1: *mut nftnl_parse_err); + + pub fn nftnl_parse_perror(str_: *const c_char, err: *mut nftnl_parse_err) -> c_int; + + pub fn nftnl_batch_is_supported() -> c_int; + + pub fn nftnl_batch_begin(buf: *mut c_char, seq: u32) -> *mut nlmsghdr; + + pub fn nftnl_batch_end(buf: *mut c_char, seq: u32) -> *mut nlmsghdr; +} +#[repr(C)] +pub struct nftnl_chain(c_void); + +#[repr(C)] +pub struct nftnl_rule(c_void); + +extern "C" { + pub fn nftnl_chain_alloc() -> *mut nftnl_chain; + + pub fn nftnl_chain_free(arg1: *const nftnl_chain); +} +pub const NFTNL_CHAIN_NAME: nftnl_chain_attr = 0; +pub const NFTNL_CHAIN_FAMILY: nftnl_chain_attr = 1; +pub const NFTNL_CHAIN_TABLE: nftnl_chain_attr = 2; +pub const NFTNL_CHAIN_HOOKNUM: nftnl_chain_attr = 3; +pub const NFTNL_CHAIN_PRIO: nftnl_chain_attr = 4; +pub const NFTNL_CHAIN_POLICY: nftnl_chain_attr = 5; +pub const NFTNL_CHAIN_USE: nftnl_chain_attr = 6; +pub const NFTNL_CHAIN_BYTES: nftnl_chain_attr = 7; +pub const NFTNL_CHAIN_PACKETS: nftnl_chain_attr = 8; +pub const NFTNL_CHAIN_HANDLE: nftnl_chain_attr = 9; +pub const NFTNL_CHAIN_TYPE: nftnl_chain_attr = 10; +pub const NFTNL_CHAIN_DEV: nftnl_chain_attr = 11; +pub const NFTNL_CHAIN_DEVICES: nftnl_chain_attr = 12; +pub const NFTNL_CHAIN_FLAGS: nftnl_chain_attr = 13; +pub const NFTNL_CHAIN_ID: nftnl_chain_attr = 14; +pub const NFTNL_CHAIN_USERDATA: nftnl_chain_attr = 15; +pub const __NFTNL_CHAIN_MAX: nftnl_chain_attr = 16; +pub type nftnl_chain_attr = c_uint; +extern "C" { + pub fn nftnl_chain_is_set(c: *const nftnl_chain, attr: u16) -> bool; + + pub fn nftnl_chain_unset(c: *mut nftnl_chain, attr: u16); + + pub fn nftnl_chain_set(t: *mut nftnl_chain, attr: u16, data: *const c_void); + + pub fn nftnl_chain_set_data( + t: *mut nftnl_chain, + attr: u16, + data: *const c_void, + data_len: u32, + ) -> c_int; + + pub fn nftnl_chain_set_u8(t: *mut nftnl_chain, attr: u16, data: u8); + + pub fn nftnl_chain_set_u32(t: *mut nftnl_chain, attr: u16, data: u32); + + pub fn nftnl_chain_set_s32(t: *mut nftnl_chain, attr: u16, data: i32); + + pub fn nftnl_chain_set_u64(t: *mut nftnl_chain, attr: u16, data: u64); + + pub fn nftnl_chain_set_str(t: *mut nftnl_chain, attr: u16, str_: *const c_char) -> c_int; + + pub fn nftnl_chain_set_array(t: *mut nftnl_chain, attr: u16, data: *mut *const c_char) + -> c_int; + + pub fn nftnl_chain_get(c: *const nftnl_chain, attr: u16) -> *const c_void; + + pub fn nftnl_chain_get_data( + c: *const nftnl_chain, + attr: u16, + data_len: *mut u32, + ) -> *const c_void; + + pub fn nftnl_chain_get_str(c: *const nftnl_chain, attr: u16) -> *const c_char; + + pub fn nftnl_chain_get_u8(c: *const nftnl_chain, attr: u16) -> u8; + + pub fn nftnl_chain_get_u32(c: *const nftnl_chain, attr: u16) -> u32; + + pub fn nftnl_chain_get_s32(c: *const nftnl_chain, attr: u16) -> i32; + + pub fn nftnl_chain_get_u64(c: *const nftnl_chain, attr: u16) -> u64; + + pub fn nftnl_chain_get_array(c: *const nftnl_chain, attr: u16) -> *const *const c_char; + + pub fn nftnl_chain_rule_add(rule: *mut nftnl_rule, c: *mut nftnl_chain); + + pub fn nftnl_chain_rule_del(rule: *mut nftnl_rule); + + pub fn nftnl_chain_rule_add_tail(rule: *mut nftnl_rule, c: *mut nftnl_chain); + + pub fn nftnl_chain_rule_insert_at(rule: *mut nftnl_rule, pos: *mut nftnl_rule); + + pub fn nftnl_chain_rule_append_at(rule: *mut nftnl_rule, pos: *mut nftnl_rule); + + pub fn nftnl_chain_nlmsg_build_payload(nlh: *mut nlmsghdr, t: *const nftnl_chain); + + pub fn nftnl_chain_parse( + c: *mut nftnl_chain, + type_: nftnl_parse_type, + data: *const c_char, + err: *mut nftnl_parse_err, + ) -> c_int; + + pub fn nftnl_chain_parse_file( + c: *mut nftnl_chain, + type_: nftnl_parse_type, + fp: *mut FILE, + err: *mut nftnl_parse_err, + ) -> c_int; + + pub fn nftnl_chain_snprintf( + buf: *mut c_char, + size: usize, + t: *const nftnl_chain, + type_: u32, + flags: u32, + ) -> c_int; + + pub fn nftnl_chain_fprintf( + fp: *mut FILE, + c: *const nftnl_chain, + type_: u32, + flags: u32, + ) -> c_int; + + pub fn nftnl_chain_nlmsg_parse(nlh: *const nlmsghdr, t: *mut nftnl_chain) -> c_int; + + pub fn nftnl_rule_foreach( + c: *mut nftnl_chain, + cb: Option c_int>, + data: *mut c_void, + ) -> c_int; + + pub fn nftnl_rule_lookup_byindex(c: *mut nftnl_chain, index: u32) -> *mut nftnl_rule; +} +#[repr(C)] +pub struct nftnl_rule_iter(c_void); + +extern "C" { + pub fn nftnl_rule_iter_create(c: *const nftnl_chain) -> *mut nftnl_rule_iter; + + pub fn nftnl_rule_iter_next(iter: *mut nftnl_rule_iter) -> *mut nftnl_rule; + + pub fn nftnl_rule_iter_destroy(iter: *mut nftnl_rule_iter); +} +#[repr(C)] +pub struct nftnl_chain_list(c_void); + +extern "C" { + pub fn nftnl_chain_list_alloc() -> *mut nftnl_chain_list; + + pub fn nftnl_chain_list_free(list: *mut nftnl_chain_list); + + pub fn nftnl_chain_list_is_empty(list: *const nftnl_chain_list) -> c_int; + + pub fn nftnl_chain_list_foreach( + chain_list: *mut nftnl_chain_list, + cb: Option c_int>, + data: *mut c_void, + ) -> c_int; + + pub fn nftnl_chain_list_lookup_byname( + chain_list: *mut nftnl_chain_list, + chain: *const c_char, + ) -> *mut nftnl_chain; + + pub fn nftnl_chain_list_add(r: *mut nftnl_chain, list: *mut nftnl_chain_list); + + pub fn nftnl_chain_list_add_tail(r: *mut nftnl_chain, list: *mut nftnl_chain_list); + + pub fn nftnl_chain_list_del(c: *mut nftnl_chain); +} +#[repr(C)] +pub struct nftnl_chain_list_iter(c_void); + +extern "C" { + pub fn nftnl_chain_list_iter_create(l: *const nftnl_chain_list) -> *mut nftnl_chain_list_iter; + + pub fn nftnl_chain_list_iter_next(iter: *mut nftnl_chain_list_iter) -> *mut nftnl_chain; + + pub fn nftnl_chain_list_iter_destroy(iter: *mut nftnl_chain_list_iter); +} +#[repr(C)] +pub struct nftnl_expr(c_void); + +pub const NFTNL_EXPR_NAME: u32 = 0; +pub const NFTNL_EXPR_BASE: u32 = 1; + +extern "C" { + pub fn nftnl_expr_alloc(name: *const c_char) -> *mut nftnl_expr; + + pub fn nftnl_expr_free(expr: *const nftnl_expr); + + pub fn nftnl_expr_is_set(expr: *const nftnl_expr, type_: u16) -> bool; + + pub fn nftnl_expr_set( + expr: *mut nftnl_expr, + type_: u16, + data: *const c_void, + data_len: u32, + ) -> c_int; + + pub fn nftnl_expr_set_u8(expr: *mut nftnl_expr, type_: u16, data: u8); + + pub fn nftnl_expr_set_u16(expr: *mut nftnl_expr, type_: u16, data: u16); + + pub fn nftnl_expr_set_u32(expr: *mut nftnl_expr, type_: u16, data: u32); + + pub fn nftnl_expr_set_u64(expr: *mut nftnl_expr, type_: u16, data: u64); + + pub fn nftnl_expr_set_str(expr: *mut nftnl_expr, type_: u16, str_: *const c_char) -> c_int; + + pub fn nftnl_expr_get(expr: *const nftnl_expr, type_: u16, data_len: *mut u32) + -> *const c_void; + + pub fn nftnl_expr_get_u8(expr: *const nftnl_expr, type_: u16) -> u8; + + pub fn nftnl_expr_get_u16(expr: *const nftnl_expr, type_: u16) -> u16; + + pub fn nftnl_expr_get_u32(expr: *const nftnl_expr, type_: u16) -> u32; + + pub fn nftnl_expr_get_u64(expr: *const nftnl_expr, type_: u16) -> u64; + + pub fn nftnl_expr_get_str(expr: *const nftnl_expr, type_: u16) -> *const c_char; + + pub fn nftnl_expr_build_payload(nlh: *mut nlmsghdr, expr: *mut nftnl_expr); + + pub fn nftnl_expr_add_expr(expr: *mut nftnl_expr, type_: u32, e: *mut nftnl_expr); + + pub fn nftnl_expr_expr_foreach( + e: *const nftnl_expr, + cb: Option c_int>, + data: *mut c_void, + ) -> c_int; + + pub fn nftnl_expr_snprintf( + buf: *mut c_char, + buflen: usize, + expr: *const nftnl_expr, + type_: u32, + flags: u32, + ) -> c_int; + + pub fn nftnl_expr_fprintf( + fp: *mut FILE, + expr: *const nftnl_expr, + type_: u32, + flags: u32, + ) -> c_int; +} +pub const NFTNL_EXPR_PAYLOAD_DREG: u32 = 1; +pub const NFTNL_EXPR_PAYLOAD_BASE: u32 = 2; +pub const NFTNL_EXPR_PAYLOAD_OFFSET: u32 = 3; +pub const NFTNL_EXPR_PAYLOAD_LEN: u32 = 4; +pub const NFTNL_EXPR_PAYLOAD_SREG: u32 = 5; +pub const NFTNL_EXPR_PAYLOAD_CSUM_TYPE: u32 = 6; +pub const NFTNL_EXPR_PAYLOAD_CSUM_OFFSET: u32 = 7; +pub const NFTNL_EXPR_PAYLOAD_FLAGS: u32 = 8; + +pub const NFTNL_EXPR_NG_DREG: u32 = 1; +pub const NFTNL_EXPR_NG_MODULUS: u32 = 2; +pub const NFTNL_EXPR_NG_TYPE: u32 = 3; +pub const NFTNL_EXPR_NG_OFFSET: u32 = 4; +pub const NFTNL_EXPR_NG_SET_NAME: u32 = 5; +pub const NFTNL_EXPR_NG_SET_ID: u32 = 6; + +pub const NFTNL_EXPR_META_KEY: u32 = 1; +pub const NFTNL_EXPR_META_DREG: u32 = 2; +pub const NFTNL_EXPR_META_SREG: u32 = 3; + +pub const NFTNL_EXPR_RT_KEY: u32 = 1; +pub const NFTNL_EXPR_RT_DREG: u32 = 2; + +pub const NFTNL_EXPR_SOCKET_KEY: u32 = 1; +pub const NFTNL_EXPR_SOCKET_DREG: u32 = 2; +pub const NFTNL_EXPR_SOCKET_LEVEL: u32 = 3; + +pub const NFTNL_EXPR_TUNNEL_KEY: u32 = 1; +pub const NFTNL_EXPR_TUNNEL_DREG: u32 = 2; + +pub const NFTNL_EXPR_CMP_SREG: u32 = 1; +pub const NFTNL_EXPR_CMP_OP: u32 = 2; +pub const NFTNL_EXPR_CMP_DATA: u32 = 3; + +pub const NFTNL_EXPR_RANGE_SREG: u32 = 1; +pub const NFTNL_EXPR_RANGE_OP: u32 = 2; +pub const NFTNL_EXPR_RANGE_FROM_DATA: u32 = 3; +pub const NFTNL_EXPR_RANGE_TO_DATA: u32 = 4; + +pub const NFTNL_EXPR_IMM_DREG: u32 = 1; +pub const NFTNL_EXPR_IMM_DATA: u32 = 2; +pub const NFTNL_EXPR_IMM_VERDICT: u32 = 3; +pub const NFTNL_EXPR_IMM_CHAIN: u32 = 4; +pub const NFTNL_EXPR_IMM_CHAIN_ID: u32 = 5; + +pub const NFTNL_EXPR_CTR_PACKETS: u32 = 1; +pub const NFTNL_EXPR_CTR_BYTES: u32 = 2; + +pub const NFTNL_EXPR_CONNLIMIT_COUNT: u32 = 1; +pub const NFTNL_EXPR_CONNLIMIT_FLAGS: u32 = 2; + +pub const NFTNL_EXPR_BITWISE_SREG: u32 = 1; +pub const NFTNL_EXPR_BITWISE_DREG: u32 = 2; +pub const NFTNL_EXPR_BITWISE_LEN: u32 = 3; +pub const NFTNL_EXPR_BITWISE_MASK: u32 = 4; +pub const NFTNL_EXPR_BITWISE_XOR: u32 = 5; +pub const NFTNL_EXPR_BITWISE_OP: u32 = 6; +pub const NFTNL_EXPR_BITWISE_DATA: u32 = 7; + +pub const NFTNL_EXPR_TG_NAME: u32 = 1; +pub const NFTNL_EXPR_TG_REV: u32 = 2; +pub const NFTNL_EXPR_TG_INFO: u32 = 3; + +pub const NFTNL_EXPR_MT_NAME: u32 = 1; +pub const NFTNL_EXPR_MT_REV: u32 = 2; +pub const NFTNL_EXPR_MT_INFO: u32 = 3; + +pub const NFTNL_EXPR_NAT_TYPE: u32 = 1; +pub const NFTNL_EXPR_NAT_FAMILY: u32 = 2; +pub const NFTNL_EXPR_NAT_REG_ADDR_MIN: u32 = 3; +pub const NFTNL_EXPR_NAT_REG_ADDR_MAX: u32 = 4; +pub const NFTNL_EXPR_NAT_REG_PROTO_MIN: u32 = 5; +pub const NFTNL_EXPR_NAT_REG_PROTO_MAX: u32 = 6; +pub const NFTNL_EXPR_NAT_FLAGS: u32 = 7; + +pub const NFTNL_EXPR_TPROXY_FAMILY: u32 = 1; +pub const NFTNL_EXPR_TPROXY_REG_ADDR: u32 = 2; +pub const NFTNL_EXPR_TPROXY_REG_PORT: u32 = 3; + +pub const NFTNL_EXPR_LOOKUP_SREG: u32 = 1; +pub const NFTNL_EXPR_LOOKUP_DREG: u32 = 2; +pub const NFTNL_EXPR_LOOKUP_SET: u32 = 3; +pub const NFTNL_EXPR_LOOKUP_SET_ID: u32 = 4; +pub const NFTNL_EXPR_LOOKUP_FLAGS: u32 = 5; + +pub const NFTNL_EXPR_DYNSET_SREG_KEY: u32 = 1; +pub const NFTNL_EXPR_DYNSET_SREG_DATA: u32 = 2; +pub const NFTNL_EXPR_DYNSET_OP: u32 = 3; +pub const NFTNL_EXPR_DYNSET_TIMEOUT: u32 = 4; +pub const NFTNL_EXPR_DYNSET_SET_NAME: u32 = 5; +pub const NFTNL_EXPR_DYNSET_SET_ID: u32 = 6; +pub const NFTNL_EXPR_DYNSET_EXPR: u32 = 7; +pub const NFTNL_EXPR_DYNSET_EXPRESSIONS: u32 = 8; +pub const NFTNL_EXPR_DYNSET_FLAGS: u32 = 9; + +pub const NFTNL_EXPR_LOG_PREFIX: u32 = 1; +pub const NFTNL_EXPR_LOG_GROUP: u32 = 2; +pub const NFTNL_EXPR_LOG_SNAPLEN: u32 = 3; +pub const NFTNL_EXPR_LOG_QTHRESHOLD: u32 = 4; +pub const NFTNL_EXPR_LOG_LEVEL: u32 = 5; +pub const NFTNL_EXPR_LOG_FLAGS: u32 = 6; + +pub const NFTNL_EXPR_EXTHDR_DREG: u32 = 1; +pub const NFTNL_EXPR_EXTHDR_TYPE: u32 = 2; +pub const NFTNL_EXPR_EXTHDR_OFFSET: u32 = 3; +pub const NFTNL_EXPR_EXTHDR_LEN: u32 = 4; +pub const NFTNL_EXPR_EXTHDR_FLAGS: u32 = 5; +pub const NFTNL_EXPR_EXTHDR_OP: u32 = 6; +pub const NFTNL_EXPR_EXTHDR_SREG: u32 = 7; + +pub const NFTNL_EXPR_CT_DREG: u32 = 1; +pub const NFTNL_EXPR_CT_KEY: u32 = 2; +pub const NFTNL_EXPR_CT_DIR: u32 = 3; +pub const NFTNL_EXPR_CT_SREG: u32 = 4; + +pub const NFTNL_EXPR_BYTEORDER_DREG: u32 = 1; +pub const NFTNL_EXPR_BYTEORDER_SREG: u32 = 2; +pub const NFTNL_EXPR_BYTEORDER_OP: u32 = 3; +pub const NFTNL_EXPR_BYTEORDER_LEN: u32 = 4; +pub const NFTNL_EXPR_BYTEORDER_SIZE: u32 = 5; + +pub const NFTNL_EXPR_LIMIT_RATE: u32 = 1; +pub const NFTNL_EXPR_LIMIT_UNIT: u32 = 2; +pub const NFTNL_EXPR_LIMIT_BURST: u32 = 3; +pub const NFTNL_EXPR_LIMIT_TYPE: u32 = 4; +pub const NFTNL_EXPR_LIMIT_FLAGS: u32 = 5; + +pub const NFTNL_EXPR_REJECT_TYPE: u32 = 1; +pub const NFTNL_EXPR_REJECT_CODE: u32 = 2; + +pub const NFTNL_EXPR_QUEUE_NUM: u32 = 1; +pub const NFTNL_EXPR_QUEUE_TOTAL: u32 = 2; +pub const NFTNL_EXPR_QUEUE_FLAGS: u32 = 3; +pub const NFTNL_EXPR_QUEUE_SREG_QNUM: u32 = 4; + +pub const NFTNL_EXPR_QUOTA_BYTES: u32 = 1; +pub const NFTNL_EXPR_QUOTA_FLAGS: u32 = 2; +pub const NFTNL_EXPR_QUOTA_CONSUMED: u32 = 3; + +pub const NFTNL_EXPR_MASQ_FLAGS: u32 = 1; +pub const NFTNL_EXPR_MASQ_REG_PROTO_MIN: u32 = 2; +pub const NFTNL_EXPR_MASQ_REG_PROTO_MAX: u32 = 3; + +pub const NFTNL_EXPR_REDIR_REG_PROTO_MIN: u32 = 1; +pub const NFTNL_EXPR_REDIR_REG_PROTO_MAX: u32 = 2; +pub const NFTNL_EXPR_REDIR_FLAGS: u32 = 3; + +pub const NFTNL_EXPR_DUP_SREG_ADDR: u32 = 1; +pub const NFTNL_EXPR_DUP_SREG_DEV: u32 = 2; + +pub const NFTNL_EXPR_FLOW_TABLE_NAME: u32 = 1; + +pub const NFTNL_EXPR_FWD_SREG_DEV: u32 = 1; +pub const NFTNL_EXPR_FWD_SREG_ADDR: u32 = 2; +pub const NFTNL_EXPR_FWD_NFPROTO: u32 = 3; + +pub const NFTNL_EXPR_HASH_SREG: u32 = 1; +pub const NFTNL_EXPR_HASH_DREG: u32 = 2; +pub const NFTNL_EXPR_HASH_LEN: u32 = 3; +pub const NFTNL_EXPR_HASH_MODULUS: u32 = 4; +pub const NFTNL_EXPR_HASH_SEED: u32 = 5; +pub const NFTNL_EXPR_HASH_OFFSET: u32 = 6; +pub const NFTNL_EXPR_HASH_TYPE: u32 = 7; +pub const NFTNL_EXPR_HASH_SET_NAME: u32 = 8; +pub const NFTNL_EXPR_HASH_SET_ID: u32 = 9; + +pub const NFTNL_EXPR_FIB_DREG: u32 = 1; +pub const NFTNL_EXPR_FIB_RESULT: u32 = 2; +pub const NFTNL_EXPR_FIB_FLAGS: u32 = 3; + +pub const NFTNL_EXPR_OBJREF_IMM_TYPE: u32 = 1; +pub const NFTNL_EXPR_OBJREF_IMM_NAME: u32 = 2; +pub const NFTNL_EXPR_OBJREF_SET_SREG: u32 = 3; +pub const NFTNL_EXPR_OBJREF_SET_NAME: u32 = 4; +pub const NFTNL_EXPR_OBJREF_SET_ID: u32 = 5; + +pub const NFTNL_EXPR_OSF_DREG: u32 = 1; +pub const NFTNL_EXPR_OSF_TTL: u32 = 2; +pub const NFTNL_EXPR_OSF_FLAGS: u32 = 3; + +pub const NFTNL_EXPR_XFRM_DREG: u32 = 1; +pub const NFTNL_EXPR_XFRM_SREG: u32 = 2; +pub const NFTNL_EXPR_XFRM_KEY: u32 = 3; +pub const NFTNL_EXPR_XFRM_DIR: u32 = 4; +pub const NFTNL_EXPR_XFRM_SPNUM: u32 = 5; + +pub const NFTNL_EXPR_SYNPROXY_MSS: u32 = 1; +pub const NFTNL_EXPR_SYNPROXY_WSCALE: u32 = 2; +pub const NFTNL_EXPR_SYNPROXY_FLAGS: u32 = 3; + +#[repr(C)] +pub struct nftnl_gen(c_void); + +extern "C" { + pub fn nftnl_gen_alloc() -> *mut nftnl_gen; + + pub fn nftnl_gen_free(arg1: *const nftnl_gen); +} +pub const NFTNL_GEN_ID: u32 = 0; +pub const __NFTNL_GEN_MAX: u32 = 1; + +extern "C" { + pub fn nftnl_gen_is_set(gen: *const nftnl_gen, attr: u16) -> bool; + + pub fn nftnl_gen_unset(gen: *mut nftnl_gen, attr: u16); + + pub fn nftnl_gen_set(gen: *mut nftnl_gen, attr: u16, data: *const c_void) -> c_int; + + pub fn nftnl_gen_set_data( + gen: *mut nftnl_gen, + attr: u16, + data: *const c_void, + data_len: u32, + ) -> c_int; + + pub fn nftnl_gen_get(gen: *const nftnl_gen, attr: u16) -> *const c_void; + + pub fn nftnl_gen_get_data( + gen: *const nftnl_gen, + attr: u16, + data_len: *mut u32, + ) -> *const c_void; + + pub fn nftnl_gen_set_u32(gen: *mut nftnl_gen, attr: u16, data: u32); + + pub fn nftnl_gen_get_u32(gen: *const nftnl_gen, attr: u16) -> u32; + + pub fn nftnl_gen_nlmsg_parse(nlh: *const nlmsghdr, gen: *mut nftnl_gen) -> c_int; + + pub fn nftnl_gen_snprintf( + buf: *mut c_char, + size: usize, + gen: *const nftnl_gen, + type_: u32, + flags: u32, + ) -> c_int; + + pub fn nftnl_gen_fprintf(fp: *mut FILE, gen: *const nftnl_gen, type_: u32, flags: u32) + -> c_int; +} +pub const NFTNL_OBJ_TABLE: u32 = 0; +pub const NFTNL_OBJ_NAME: u32 = 1; +pub const NFTNL_OBJ_TYPE: u32 = 2; +pub const NFTNL_OBJ_FAMILY: u32 = 3; +pub const NFTNL_OBJ_USE: u32 = 4; +pub const NFTNL_OBJ_HANDLE: u32 = 5; +pub const NFTNL_OBJ_USERDATA: u32 = 6; +pub const NFTNL_OBJ_BASE: u32 = 16; +pub const __NFTNL_OBJ_MAX: u32 = 17; + +pub const NFTNL_OBJ_CTR_PKTS: u32 = 16; +pub const NFTNL_OBJ_CTR_BYTES: u32 = 17; + +pub const NFTNL_OBJ_QUOTA_BYTES: u32 = 16; +pub const NFTNL_OBJ_QUOTA_CONSUMED: u32 = 17; +pub const NFTNL_OBJ_QUOTA_FLAGS: u32 = 18; + +pub const NFTNL_OBJ_CT_HELPER_NAME: u32 = 16; +pub const NFTNL_OBJ_CT_HELPER_L3PROTO: u32 = 17; +pub const NFTNL_OBJ_CT_HELPER_L4PROTO: u32 = 18; + +pub const NFTNL_CTTIMEOUT_TCP_SYN_SENT: nftnl_cttimeout_array_tcp = 0; +pub const NFTNL_CTTIMEOUT_TCP_SYN_RECV: nftnl_cttimeout_array_tcp = 1; +pub const NFTNL_CTTIMEOUT_TCP_ESTABLISHED: nftnl_cttimeout_array_tcp = 2; +pub const NFTNL_CTTIMEOUT_TCP_FIN_WAIT: nftnl_cttimeout_array_tcp = 3; +pub const NFTNL_CTTIMEOUT_TCP_CLOSE_WAIT: nftnl_cttimeout_array_tcp = 4; +pub const NFTNL_CTTIMEOUT_TCP_LAST_ACK: nftnl_cttimeout_array_tcp = 5; +pub const NFTNL_CTTIMEOUT_TCP_TIME_WAIT: nftnl_cttimeout_array_tcp = 6; +pub const NFTNL_CTTIMEOUT_TCP_CLOSE: nftnl_cttimeout_array_tcp = 7; +pub const NFTNL_CTTIMEOUT_TCP_SYN_SENT2: nftnl_cttimeout_array_tcp = 8; +pub const NFTNL_CTTIMEOUT_TCP_RETRANS: nftnl_cttimeout_array_tcp = 9; +pub const NFTNL_CTTIMEOUT_TCP_UNACK: nftnl_cttimeout_array_tcp = 10; +pub const NFTNL_CTTIMEOUT_TCP_MAX: nftnl_cttimeout_array_tcp = 11; +pub type nftnl_cttimeout_array_tcp = c_uint; +pub const NFTNL_CTTIMEOUT_UDP_UNREPLIED: nftnl_cttimeout_array_udp = 0; +pub const NFTNL_CTTIMEOUT_UDP_REPLIED: nftnl_cttimeout_array_udp = 1; +pub const NFTNL_CTTIMEOUT_UDP_MAX: nftnl_cttimeout_array_udp = 2; +pub type nftnl_cttimeout_array_udp = c_uint; +pub const NFTNL_OBJ_CT_TIMEOUT_L3PROTO: u32 = 16; +pub const NFTNL_OBJ_CT_TIMEOUT_L4PROTO: u32 = 17; +pub const NFTNL_OBJ_CT_TIMEOUT_ARRAY: u32 = 18; + +pub const NFTNL_OBJ_CT_EXPECT_L3PROTO: u32 = 16; +pub const NFTNL_OBJ_CT_EXPECT_L4PROTO: u32 = 17; +pub const NFTNL_OBJ_CT_EXPECT_DPORT: u32 = 18; +pub const NFTNL_OBJ_CT_EXPECT_TIMEOUT: u32 = 19; +pub const NFTNL_OBJ_CT_EXPECT_SIZE: u32 = 20; + +pub const NFTNL_OBJ_LIMIT_RATE: u32 = 16; +pub const NFTNL_OBJ_LIMIT_UNIT: u32 = 17; +pub const NFTNL_OBJ_LIMIT_BURST: u32 = 18; +pub const NFTNL_OBJ_LIMIT_TYPE: u32 = 19; +pub const NFTNL_OBJ_LIMIT_FLAGS: u32 = 20; + +pub const NFTNL_OBJ_SYNPROXY_MSS: u32 = 16; +pub const NFTNL_OBJ_SYNPROXY_WSCALE: u32 = 17; +pub const NFTNL_OBJ_SYNPROXY_FLAGS: u32 = 18; + +pub const NFTNL_OBJ_TUNNEL_ID: u32 = 16; +pub const NFTNL_OBJ_TUNNEL_IPV4_SRC: u32 = 17; +pub const NFTNL_OBJ_TUNNEL_IPV4_DST: u32 = 18; +pub const NFTNL_OBJ_TUNNEL_IPV6_SRC: u32 = 19; +pub const NFTNL_OBJ_TUNNEL_IPV6_DST: u32 = 20; +pub const NFTNL_OBJ_TUNNEL_IPV6_FLOWLABEL: u32 = 21; +pub const NFTNL_OBJ_TUNNEL_SPORT: u32 = 22; +pub const NFTNL_OBJ_TUNNEL_DPORT: u32 = 23; +pub const NFTNL_OBJ_TUNNEL_FLAGS: u32 = 24; +pub const NFTNL_OBJ_TUNNEL_TOS: u32 = 25; +pub const NFTNL_OBJ_TUNNEL_TTL: u32 = 26; +pub const NFTNL_OBJ_TUNNEL_VXLAN_GBP: u32 = 27; +pub const NFTNL_OBJ_TUNNEL_ERSPAN_VERSION: u32 = 28; +pub const NFTNL_OBJ_TUNNEL_ERSPAN_V1_INDEX: u32 = 29; +pub const NFTNL_OBJ_TUNNEL_ERSPAN_V2_HWID: u32 = 30; +pub const NFTNL_OBJ_TUNNEL_ERSPAN_V2_DIR: u32 = 31; + +pub const NFTNL_OBJ_SECMARK_CTX: u32 = 16; + +#[repr(C)] +pub struct nftnl_obj(c_void); + +extern "C" { + pub fn nftnl_obj_alloc() -> *mut nftnl_obj; + + pub fn nftnl_obj_free(ne: *const nftnl_obj); + + pub fn nftnl_obj_is_set(ne: *const nftnl_obj, attr: u16) -> bool; + + pub fn nftnl_obj_unset(ne: *mut nftnl_obj, attr: u16); + + pub fn nftnl_obj_set_data(ne: *mut nftnl_obj, attr: u16, data: *const c_void, data_len: u32); + + pub fn nftnl_obj_set(ne: *mut nftnl_obj, attr: u16, data: *const c_void); + + pub fn nftnl_obj_set_u8(ne: *mut nftnl_obj, attr: u16, val: u8); + + pub fn nftnl_obj_set_u16(ne: *mut nftnl_obj, attr: u16, val: u16); + + pub fn nftnl_obj_set_u32(ne: *mut nftnl_obj, attr: u16, val: u32); + + pub fn nftnl_obj_set_u64(obj: *mut nftnl_obj, attr: u16, val: u64); + + pub fn nftnl_obj_set_str(ne: *mut nftnl_obj, attr: u16, str_: *const c_char); + + pub fn nftnl_obj_get_data(ne: *mut nftnl_obj, attr: u16, data_len: *mut u32) -> *const c_void; + + pub fn nftnl_obj_get(ne: *mut nftnl_obj, attr: u16) -> *const c_void; + + pub fn nftnl_obj_get_u8(ne: *mut nftnl_obj, attr: u16) -> u8; + + pub fn nftnl_obj_get_u16(obj: *mut nftnl_obj, attr: u16) -> u16; + + pub fn nftnl_obj_get_u32(ne: *mut nftnl_obj, attr: u16) -> u32; + + pub fn nftnl_obj_get_u64(obj: *mut nftnl_obj, attr: u16) -> u64; + + pub fn nftnl_obj_get_str(ne: *mut nftnl_obj, attr: u16) -> *const c_char; + + pub fn nftnl_obj_nlmsg_build_payload(nlh: *mut nlmsghdr, ne: *const nftnl_obj); + + pub fn nftnl_obj_nlmsg_parse(nlh: *const nlmsghdr, ne: *mut nftnl_obj) -> c_int; + + pub fn nftnl_obj_parse( + ne: *mut nftnl_obj, + type_: nftnl_parse_type, + data: *const c_char, + err: *mut nftnl_parse_err, + ) -> c_int; + + pub fn nftnl_obj_parse_file( + ne: *mut nftnl_obj, + type_: nftnl_parse_type, + fp: *mut FILE, + err: *mut nftnl_parse_err, + ) -> c_int; + + pub fn nftnl_obj_snprintf( + buf: *mut c_char, + size: usize, + ne: *const nftnl_obj, + type_: u32, + flags: u32, + ) -> c_int; + + pub fn nftnl_obj_fprintf(fp: *mut FILE, ne: *const nftnl_obj, type_: u32, flags: u32) -> c_int; +} +#[repr(C)] +pub struct nftnl_obj_list(c_void); + +extern "C" { + pub fn nftnl_obj_list_alloc() -> *mut nftnl_obj_list; + + pub fn nftnl_obj_list_free(list: *mut nftnl_obj_list); + + pub fn nftnl_obj_list_is_empty(list: *mut nftnl_obj_list) -> c_int; + + pub fn nftnl_obj_list_add(r: *mut nftnl_obj, list: *mut nftnl_obj_list); + + pub fn nftnl_obj_list_add_tail(r: *mut nftnl_obj, list: *mut nftnl_obj_list); + + pub fn nftnl_obj_list_del(t: *mut nftnl_obj); + + pub fn nftnl_obj_list_foreach( + table_list: *mut nftnl_obj_list, + cb: Option c_int>, + data: *mut c_void, + ) -> c_int; +} +#[repr(C)] +pub struct nftnl_obj_list_iter(c_void); + +extern "C" { + pub fn nftnl_obj_list_iter_create(l: *mut nftnl_obj_list) -> *mut nftnl_obj_list_iter; + + pub fn nftnl_obj_list_iter_next(iter: *mut nftnl_obj_list_iter) -> *mut nftnl_obj; + + pub fn nftnl_obj_list_iter_destroy(iter: *mut nftnl_obj_list_iter); + + pub fn nftnl_rule_alloc() -> *mut nftnl_rule; + + pub fn nftnl_rule_free(arg1: *const nftnl_rule); +} +pub const NFTNL_RULE_FAMILY: nftnl_rule_attr = 0; +pub const NFTNL_RULE_TABLE: nftnl_rule_attr = 1; +pub const NFTNL_RULE_CHAIN: nftnl_rule_attr = 2; +pub const NFTNL_RULE_HANDLE: nftnl_rule_attr = 3; +pub const NFTNL_RULE_COMPAT_PROTO: nftnl_rule_attr = 4; +pub const NFTNL_RULE_COMPAT_FLAGS: nftnl_rule_attr = 5; +pub const NFTNL_RULE_POSITION: nftnl_rule_attr = 6; +pub const NFTNL_RULE_USERDATA: nftnl_rule_attr = 7; +pub const NFTNL_RULE_ID: nftnl_rule_attr = 8; +pub const NFTNL_RULE_POSITION_ID: nftnl_rule_attr = 9; +pub const __NFTNL_RULE_MAX: nftnl_rule_attr = 10; +pub type nftnl_rule_attr = c_uint; +extern "C" { + pub fn nftnl_rule_unset(r: *mut nftnl_rule, attr: u16); + + pub fn nftnl_rule_is_set(r: *const nftnl_rule, attr: u16) -> bool; + + pub fn nftnl_rule_set(r: *mut nftnl_rule, attr: u16, data: *const c_void) -> c_int; + + pub fn nftnl_rule_set_data( + r: *mut nftnl_rule, + attr: u16, + data: *const c_void, + data_len: u32, + ) -> c_int; + + pub fn nftnl_rule_set_u32(r: *mut nftnl_rule, attr: u16, val: u32); + + pub fn nftnl_rule_set_u64(r: *mut nftnl_rule, attr: u16, val: u64); + + pub fn nftnl_rule_set_str(r: *mut nftnl_rule, attr: u16, str_: *const c_char) -> c_int; + + pub fn nftnl_rule_get(r: *const nftnl_rule, attr: u16) -> *const c_void; + + pub fn nftnl_rule_get_data( + r: *const nftnl_rule, + attr: u16, + data_len: *mut u32, + ) -> *const c_void; + + pub fn nftnl_rule_get_str(r: *const nftnl_rule, attr: u16) -> *const c_char; + + pub fn nftnl_rule_get_u8(r: *const nftnl_rule, attr: u16) -> u8; + + pub fn nftnl_rule_get_u32(r: *const nftnl_rule, attr: u16) -> u32; + + pub fn nftnl_rule_get_u64(r: *const nftnl_rule, attr: u16) -> u64; + + pub fn nftnl_rule_add_expr(r: *mut nftnl_rule, expr: *mut nftnl_expr); + + pub fn nftnl_rule_del_expr(expr: *mut nftnl_expr); + + pub fn nftnl_rule_nlmsg_build_payload(nlh: *mut nlmsghdr, t: *mut nftnl_rule); + + pub fn nftnl_rule_parse( + r: *mut nftnl_rule, + type_: nftnl_parse_type, + data: *const c_char, + err: *mut nftnl_parse_err, + ) -> c_int; + + pub fn nftnl_rule_parse_file( + r: *mut nftnl_rule, + type_: nftnl_parse_type, + fp: *mut FILE, + err: *mut nftnl_parse_err, + ) -> c_int; + + pub fn nftnl_rule_snprintf( + buf: *mut c_char, + size: usize, + t: *const nftnl_rule, + type_: u32, + flags: u32, + ) -> c_int; + + pub fn nftnl_rule_fprintf(fp: *mut FILE, r: *const nftnl_rule, type_: u32, flags: u32) + -> c_int; + + pub fn nftnl_rule_nlmsg_parse(nlh: *const nlmsghdr, t: *mut nftnl_rule) -> c_int; + + pub fn nftnl_expr_foreach( + r: *mut nftnl_rule, + cb: Option c_int>, + data: *mut c_void, + ) -> c_int; +} +#[repr(C)] +pub struct nftnl_expr_iter(c_void); + +extern "C" { + pub fn nftnl_expr_iter_create(r: *const nftnl_rule) -> *mut nftnl_expr_iter; + + pub fn nftnl_expr_iter_next(iter: *mut nftnl_expr_iter) -> *mut nftnl_expr; + + pub fn nftnl_expr_iter_destroy(iter: *mut nftnl_expr_iter); +} +#[repr(C)] +pub struct nftnl_rule_list(c_void); + +extern "C" { + pub fn nftnl_rule_list_alloc() -> *mut nftnl_rule_list; + + pub fn nftnl_rule_list_free(list: *mut nftnl_rule_list); + + pub fn nftnl_rule_list_is_empty(list: *const nftnl_rule_list) -> c_int; + + pub fn nftnl_rule_list_add(r: *mut nftnl_rule, list: *mut nftnl_rule_list); + + pub fn nftnl_rule_list_add_tail(r: *mut nftnl_rule, list: *mut nftnl_rule_list); + + pub fn nftnl_rule_list_insert_at(r: *mut nftnl_rule, pos: *mut nftnl_rule); + + pub fn nftnl_rule_list_del(r: *mut nftnl_rule); + + pub fn nftnl_rule_list_foreach( + rule_list: *mut nftnl_rule_list, + cb: Option c_int>, + data: *mut c_void, + ) -> c_int; +} +#[repr(C)] +pub struct nftnl_rule_list_iter(c_void); + +extern "C" { + pub fn nftnl_rule_list_iter_create(l: *const nftnl_rule_list) -> *mut nftnl_rule_list_iter; + + pub fn nftnl_rule_list_iter_cur(iter: *mut nftnl_rule_list_iter) -> *mut nftnl_rule; + + pub fn nftnl_rule_list_iter_next(iter: *mut nftnl_rule_list_iter) -> *mut nftnl_rule; + + pub fn nftnl_rule_list_iter_destroy(iter: *const nftnl_rule_list_iter); +} +#[repr(C)] +pub struct nftnl_ruleset(c_void); + +extern "C" { + pub fn nftnl_ruleset_alloc() -> *mut nftnl_ruleset; + + pub fn nftnl_ruleset_free(r: *const nftnl_ruleset); +} +pub const NFTNL_RULESET_TABLELIST: u32 = 0; +pub const NFTNL_RULESET_CHAINLIST: u32 = 1; +pub const NFTNL_RULESET_SETLIST: u32 = 2; +pub const NFTNL_RULESET_RULELIST: u32 = 3; + +pub const NFTNL_RULESET_UNSPEC: nftnl_ruleset_type = 0; +pub const NFTNL_RULESET_RULESET: nftnl_ruleset_type = 1; +pub const NFTNL_RULESET_TABLE: nftnl_ruleset_type = 2; +pub const NFTNL_RULESET_CHAIN: nftnl_ruleset_type = 3; +pub const NFTNL_RULESET_RULE: nftnl_ruleset_type = 4; +pub const NFTNL_RULESET_SET: nftnl_ruleset_type = 5; +pub const NFTNL_RULESET_SET_ELEMS: nftnl_ruleset_type = 6; +pub type nftnl_ruleset_type = c_uint; +extern "C" { + pub fn nftnl_ruleset_is_set(r: *const nftnl_ruleset, attr: u16) -> bool; + + pub fn nftnl_ruleset_unset(r: *mut nftnl_ruleset, attr: u16); + + pub fn nftnl_ruleset_set(r: *mut nftnl_ruleset, attr: u16, data: *mut c_void); + + pub fn nftnl_ruleset_get(r: *const nftnl_ruleset, attr: u16) -> *mut c_void; +} +pub const NFTNL_RULESET_CTX_CMD: u32 = 0; +pub const NFTNL_RULESET_CTX_TYPE: u32 = 1; +pub const NFTNL_RULESET_CTX_TABLE: u32 = 2; +pub const NFTNL_RULESET_CTX_CHAIN: u32 = 3; +pub const NFTNL_RULESET_CTX_RULE: u32 = 4; +pub const NFTNL_RULESET_CTX_SET: u32 = 5; +pub const NFTNL_RULESET_CTX_DATA: u32 = 6; + +#[repr(C)] +pub struct nftnl_parse_ctx(c_void); + +extern "C" { + pub fn nftnl_ruleset_ctx_free(ctx: *const nftnl_parse_ctx); + + pub fn nftnl_ruleset_ctx_is_set(ctx: *const nftnl_parse_ctx, attr: u16) -> bool; + + pub fn nftnl_ruleset_ctx_get(ctx: *const nftnl_parse_ctx, attr: u16) -> *mut c_void; + + pub fn nftnl_ruleset_ctx_get_u32(ctx: *const nftnl_parse_ctx, attr: u16) -> u32; + + pub fn nftnl_ruleset_parse_file_cb( + type_: nftnl_parse_type, + fp: *mut FILE, + err: *mut nftnl_parse_err, + data: *mut c_void, + cb: Option c_int>, + ) -> c_int; + + pub fn nftnl_ruleset_parse_buffer_cb( + type_: nftnl_parse_type, + buffer: *const c_char, + err: *mut nftnl_parse_err, + data: *mut c_void, + cb: Option c_int>, + ) -> c_int; + + pub fn nftnl_ruleset_parse( + rs: *mut nftnl_ruleset, + type_: nftnl_parse_type, + data: *const c_char, + err: *mut nftnl_parse_err, + ) -> c_int; + + pub fn nftnl_ruleset_parse_file( + rs: *mut nftnl_ruleset, + type_: nftnl_parse_type, + fp: *mut FILE, + err: *mut nftnl_parse_err, + ) -> c_int; + + pub fn nftnl_ruleset_snprintf( + buf: *mut c_char, + size: usize, + rs: *const nftnl_ruleset, + type_: u32, + flags: u32, + ) -> c_int; + + pub fn nftnl_ruleset_fprintf( + fp: *mut FILE, + rs: *const nftnl_ruleset, + type_: u32, + flags: u32, + ) -> c_int; +} +pub const NFTNL_SET_TABLE: nftnl_set_attr = 0; +pub const NFTNL_SET_NAME: nftnl_set_attr = 1; +pub const NFTNL_SET_FLAGS: nftnl_set_attr = 2; +pub const NFTNL_SET_KEY_TYPE: nftnl_set_attr = 3; +pub const NFTNL_SET_KEY_LEN: nftnl_set_attr = 4; +pub const NFTNL_SET_DATA_TYPE: nftnl_set_attr = 5; +pub const NFTNL_SET_DATA_LEN: nftnl_set_attr = 6; +pub const NFTNL_SET_FAMILY: nftnl_set_attr = 7; +pub const NFTNL_SET_ID: nftnl_set_attr = 8; +pub const NFTNL_SET_POLICY: nftnl_set_attr = 9; +pub const NFTNL_SET_DESC_SIZE: nftnl_set_attr = 10; +pub const NFTNL_SET_TIMEOUT: nftnl_set_attr = 11; +pub const NFTNL_SET_GC_INTERVAL: nftnl_set_attr = 12; +pub const NFTNL_SET_USERDATA: nftnl_set_attr = 13; +pub const NFTNL_SET_OBJ_TYPE: nftnl_set_attr = 14; +pub const NFTNL_SET_HANDLE: nftnl_set_attr = 15; +pub const NFTNL_SET_DESC_CONCAT: nftnl_set_attr = 16; +pub const NFTNL_SET_EXPR: nftnl_set_attr = 17; +pub const NFTNL_SET_EXPRESSIONS: nftnl_set_attr = 18; +pub const __NFTNL_SET_MAX: nftnl_set_attr = 19; +pub type nftnl_set_attr = c_uint; +#[repr(C)] +pub struct nftnl_set(c_void); + +extern "C" { + pub fn nftnl_set_alloc() -> *mut nftnl_set; + + pub fn nftnl_set_free(s: *const nftnl_set); + + pub fn nftnl_set_clone(set: *const nftnl_set) -> *mut nftnl_set; + + pub fn nftnl_set_is_set(s: *const nftnl_set, attr: u16) -> bool; + + pub fn nftnl_set_unset(s: *mut nftnl_set, attr: u16); + + pub fn nftnl_set_set(s: *mut nftnl_set, attr: u16, data: *const c_void) -> c_int; + + pub fn nftnl_set_set_data( + s: *mut nftnl_set, + attr: u16, + data: *const c_void, + data_len: u32, + ) -> c_int; + + pub fn nftnl_set_set_u32(s: *mut nftnl_set, attr: u16, val: u32); + + pub fn nftnl_set_set_u64(s: *mut nftnl_set, attr: u16, val: u64); + + pub fn nftnl_set_set_str(s: *mut nftnl_set, attr: u16, str_: *const c_char) -> c_int; + + pub fn nftnl_set_get(s: *const nftnl_set, attr: u16) -> *const c_void; + + pub fn nftnl_set_get_data(s: *const nftnl_set, attr: u16, data_len: *mut u32) -> *const c_void; + + pub fn nftnl_set_get_str(s: *const nftnl_set, attr: u16) -> *const c_char; + + pub fn nftnl_set_get_u32(s: *const nftnl_set, attr: u16) -> u32; + + pub fn nftnl_set_get_u64(s: *const nftnl_set, attr: u16) -> u64; + + pub fn nftnl_set_nlmsg_build_payload(nlh: *mut nlmsghdr, s: *mut nftnl_set); + + pub fn nftnl_set_nlmsg_parse(nlh: *const nlmsghdr, s: *mut nftnl_set) -> c_int; + + pub fn nftnl_set_elems_nlmsg_parse(nlh: *const nlmsghdr, s: *mut nftnl_set) -> c_int; + + pub fn nftnl_set_snprintf( + buf: *mut c_char, + size: usize, + s: *const nftnl_set, + type_: u32, + flags: u32, + ) -> c_int; + + pub fn nftnl_set_fprintf(fp: *mut FILE, s: *const nftnl_set, type_: u32, flags: u32) -> c_int; +} +#[repr(C)] +pub struct nftnl_set_list(c_void); + +extern "C" { + pub fn nftnl_set_list_alloc() -> *mut nftnl_set_list; + + pub fn nftnl_set_list_free(list: *mut nftnl_set_list); + + pub fn nftnl_set_list_is_empty(list: *const nftnl_set_list) -> c_int; + + pub fn nftnl_set_list_add(s: *mut nftnl_set, list: *mut nftnl_set_list); + + pub fn nftnl_set_list_add_tail(s: *mut nftnl_set, list: *mut nftnl_set_list); + + pub fn nftnl_set_list_del(s: *mut nftnl_set); + + pub fn nftnl_set_list_foreach( + set_list: *mut nftnl_set_list, + cb: Option c_int>, + data: *mut c_void, + ) -> c_int; + + pub fn nftnl_set_list_lookup_byname( + set_list: *mut nftnl_set_list, + set: *const c_char, + ) -> *mut nftnl_set; + + pub fn nftnl_set_add_expr(s: *mut nftnl_set, expr: *mut nftnl_expr); + + pub fn nftnl_set_expr_foreach( + s: *const nftnl_set, + cb: Option c_int>, + data: *mut c_void, + ) -> c_int; +} +#[repr(C)] +pub struct nftnl_set_list_iter(c_void); + +extern "C" { + pub fn nftnl_set_list_iter_create(l: *const nftnl_set_list) -> *mut nftnl_set_list_iter; + + pub fn nftnl_set_list_iter_cur(iter: *const nftnl_set_list_iter) -> *mut nftnl_set; + + pub fn nftnl_set_list_iter_next(iter: *mut nftnl_set_list_iter) -> *mut nftnl_set; + + pub fn nftnl_set_list_iter_destroy(iter: *const nftnl_set_list_iter); + + pub fn nftnl_set_parse( + s: *mut nftnl_set, + type_: nftnl_parse_type, + data: *const c_char, + err: *mut nftnl_parse_err, + ) -> c_int; + + pub fn nftnl_set_parse_file( + s: *mut nftnl_set, + type_: nftnl_parse_type, + fp: *mut FILE, + err: *mut nftnl_parse_err, + ) -> c_int; +} +pub const NFTNL_SET_ELEM_FLAGS: u32 = 0; +pub const NFTNL_SET_ELEM_KEY: u32 = 1; +pub const NFTNL_SET_ELEM_VERDICT: u32 = 2; +pub const NFTNL_SET_ELEM_CHAIN: u32 = 3; +pub const NFTNL_SET_ELEM_DATA: u32 = 4; +pub const NFTNL_SET_ELEM_TIMEOUT: u32 = 5; +pub const NFTNL_SET_ELEM_EXPIRATION: u32 = 6; +pub const NFTNL_SET_ELEM_USERDATA: u32 = 7; +pub const NFTNL_SET_ELEM_EXPR: u32 = 8; +pub const NFTNL_SET_ELEM_OBJREF: u32 = 9; +pub const NFTNL_SET_ELEM_KEY_END: u32 = 10; +pub const NFTNL_SET_ELEM_EXPRESSIONS: u32 = 11; +pub const __NFTNL_SET_ELEM_MAX: u32 = 12; + +#[repr(C)] +pub struct nftnl_set_elem(c_void); + +extern "C" { + pub fn nftnl_set_elem_alloc() -> *mut nftnl_set_elem; + + pub fn nftnl_set_elem_free(s: *mut nftnl_set_elem); + + pub fn nftnl_set_elem_clone(elem: *mut nftnl_set_elem) -> *mut nftnl_set_elem; + + pub fn nftnl_set_elem_add(s: *mut nftnl_set, elem: *mut nftnl_set_elem); + + pub fn nftnl_set_elem_unset(s: *mut nftnl_set_elem, attr: u16); + + pub fn nftnl_set_elem_set( + s: *mut nftnl_set_elem, + attr: u16, + data: *const c_void, + data_len: u32, + ) -> c_int; + + pub fn nftnl_set_elem_set_u32(s: *mut nftnl_set_elem, attr: u16, val: u32); + + pub fn nftnl_set_elem_set_u64(s: *mut nftnl_set_elem, attr: u16, val: u64); + + pub fn nftnl_set_elem_set_str(s: *mut nftnl_set_elem, attr: u16, str_: *const c_char) -> c_int; + + pub fn nftnl_set_elem_get( + s: *mut nftnl_set_elem, + attr: u16, + data_len: *mut u32, + ) -> *const c_void; + + pub fn nftnl_set_elem_get_str(s: *mut nftnl_set_elem, attr: u16) -> *const c_char; + + pub fn nftnl_set_elem_get_u32(s: *mut nftnl_set_elem, attr: u16) -> u32; + + pub fn nftnl_set_elem_get_u64(s: *mut nftnl_set_elem, attr: u16) -> u64; + + pub fn nftnl_set_elem_is_set(s: *const nftnl_set_elem, attr: u16) -> bool; + + pub fn nftnl_set_elems_nlmsg_build_payload(nlh: *mut nlmsghdr, s: *mut nftnl_set); + + pub fn nftnl_set_elem_nlmsg_build_payload(nlh: *mut nlmsghdr, e: *mut nftnl_set_elem); + + pub fn nftnl_set_elem_parse( + e: *mut nftnl_set_elem, + type_: nftnl_parse_type, + data: *const c_char, + err: *mut nftnl_parse_err, + ) -> c_int; + + pub fn nftnl_set_elem_parse_file( + e: *mut nftnl_set_elem, + type_: nftnl_parse_type, + fp: *mut FILE, + err: *mut nftnl_parse_err, + ) -> c_int; + + pub fn nftnl_set_elem_snprintf( + buf: *mut c_char, + size: usize, + s: *const nftnl_set_elem, + type_: u32, + flags: u32, + ) -> c_int; + + pub fn nftnl_set_elem_fprintf( + fp: *mut FILE, + se: *const nftnl_set_elem, + type_: u32, + flags: u32, + ) -> c_int; + + pub fn nftnl_set_elem_add_expr(e: *mut nftnl_set_elem, expr: *mut nftnl_expr); + + pub fn nftnl_set_elem_expr_foreach( + e: *mut nftnl_set_elem, + cb: Option c_int>, + data: *mut c_void, + ) -> c_int; + + pub fn nftnl_set_elem_foreach( + s: *mut nftnl_set, + cb: Option c_int>, + data: *mut c_void, + ) -> c_int; +} +#[repr(C)] +pub struct nftnl_set_elems_iter(c_void); + +extern "C" { + pub fn nftnl_set_elems_iter_create(s: *const nftnl_set) -> *mut nftnl_set_elems_iter; + + pub fn nftnl_set_elems_iter_cur(iter: *const nftnl_set_elems_iter) -> *mut nftnl_set_elem; + + pub fn nftnl_set_elems_iter_next(iter: *mut nftnl_set_elems_iter) -> *mut nftnl_set_elem; + + pub fn nftnl_set_elems_iter_destroy(iter: *mut nftnl_set_elems_iter); + + pub fn nftnl_set_elems_nlmsg_build_payload_iter( + nlh: *mut nlmsghdr, + iter: *mut nftnl_set_elems_iter, + ) -> c_int; +} +#[repr(C)] +pub struct nftnl_table(c_void); + +extern "C" { + pub fn nftnl_table_alloc() -> *mut nftnl_table; + + pub fn nftnl_table_free(arg1: *const nftnl_table); +} +pub const NFTNL_TABLE_NAME: nftnl_table_attr = 0; +pub const NFTNL_TABLE_FAMILY: nftnl_table_attr = 1; +pub const NFTNL_TABLE_FLAGS: nftnl_table_attr = 2; +pub const NFTNL_TABLE_USE: nftnl_table_attr = 3; +pub const NFTNL_TABLE_HANDLE: nftnl_table_attr = 4; +pub const NFTNL_TABLE_USERDATA: nftnl_table_attr = 5; +pub const NFTNL_TABLE_OWNER: nftnl_table_attr = 6; +pub const __NFTNL_TABLE_MAX: nftnl_table_attr = 7; +pub type nftnl_table_attr = c_uint; +extern "C" { + pub fn nftnl_table_is_set(t: *const nftnl_table, attr: u16) -> bool; + + pub fn nftnl_table_unset(t: *mut nftnl_table, attr: u16); + + pub fn nftnl_table_set(t: *mut nftnl_table, attr: u16, data: *const c_void); + + pub fn nftnl_table_set_data( + t: *mut nftnl_table, + attr: u16, + data: *const c_void, + data_len: u32, + ) -> c_int; + + pub fn nftnl_table_get(t: *const nftnl_table, attr: u16) -> *const c_void; + + pub fn nftnl_table_get_data( + t: *const nftnl_table, + attr: u16, + data_len: *mut u32, + ) -> *const c_void; + + pub fn nftnl_table_set_u8(t: *mut nftnl_table, attr: u16, data: u8); + + pub fn nftnl_table_set_u32(t: *mut nftnl_table, attr: u16, data: u32); + + pub fn nftnl_table_set_u64(t: *mut nftnl_table, attr: u16, data: u64); + + pub fn nftnl_table_set_str(t: *mut nftnl_table, attr: u16, str_: *const c_char) -> c_int; + + pub fn nftnl_table_get_u8(t: *const nftnl_table, attr: u16) -> u8; + + pub fn nftnl_table_get_u32(t: *const nftnl_table, attr: u16) -> u32; + + pub fn nftnl_table_get_u64(t: *const nftnl_table, attr: u16) -> u64; + + pub fn nftnl_table_get_str(t: *const nftnl_table, attr: u16) -> *const c_char; + + pub fn nftnl_table_nlmsg_build_payload(nlh: *mut nlmsghdr, t: *const nftnl_table); + + pub fn nftnl_table_parse( + t: *mut nftnl_table, + type_: nftnl_parse_type, + data: *const c_char, + err: *mut nftnl_parse_err, + ) -> c_int; + + pub fn nftnl_table_parse_file( + t: *mut nftnl_table, + type_: nftnl_parse_type, + fp: *mut FILE, + err: *mut nftnl_parse_err, + ) -> c_int; + + pub fn nftnl_table_snprintf( + buf: *mut c_char, + size: usize, + t: *const nftnl_table, + type_: u32, + flags: u32, + ) -> c_int; + + pub fn nftnl_table_fprintf( + fp: *mut FILE, + t: *const nftnl_table, + type_: u32, + flags: u32, + ) -> c_int; + + pub fn nftnl_table_nlmsg_parse(nlh: *const nlmsghdr, t: *mut nftnl_table) -> c_int; +} +#[repr(C)] +pub struct nftnl_table_list(c_void); + +extern "C" { + pub fn nftnl_table_list_alloc() -> *mut nftnl_table_list; + + pub fn nftnl_table_list_free(list: *mut nftnl_table_list); + + pub fn nftnl_table_list_is_empty(list: *const nftnl_table_list) -> c_int; + + pub fn nftnl_table_list_foreach( + table_list: *mut nftnl_table_list, + cb: Option c_int>, + data: *mut c_void, + ) -> c_int; + + pub fn nftnl_table_list_add(r: *mut nftnl_table, list: *mut nftnl_table_list); + + pub fn nftnl_table_list_add_tail(r: *mut nftnl_table, list: *mut nftnl_table_list); + + pub fn nftnl_table_list_del(r: *mut nftnl_table); +} +#[repr(C)] +pub struct nftnl_table_list_iter(c_void); + +extern "C" { + pub fn nftnl_table_list_iter_create(l: *const nftnl_table_list) -> *mut nftnl_table_list_iter; + + pub fn nftnl_table_list_iter_next(iter: *mut nftnl_table_list_iter) -> *mut nftnl_table; + + pub fn nftnl_table_list_iter_destroy(iter: *const nftnl_table_list_iter); +} +pub const NFTNL_TRACE_CHAIN: nftnl_trace_attr = 0; +pub const NFTNL_TRACE_FAMILY: nftnl_trace_attr = 1; +pub const NFTNL_TRACE_ID: nftnl_trace_attr = 2; +pub const NFTNL_TRACE_IIF: nftnl_trace_attr = 3; +pub const NFTNL_TRACE_IIFTYPE: nftnl_trace_attr = 4; +pub const NFTNL_TRACE_JUMP_TARGET: nftnl_trace_attr = 5; +pub const NFTNL_TRACE_OIF: nftnl_trace_attr = 6; +pub const NFTNL_TRACE_OIFTYPE: nftnl_trace_attr = 7; +pub const NFTNL_TRACE_MARK: nftnl_trace_attr = 8; +pub const NFTNL_TRACE_LL_HEADER: nftnl_trace_attr = 9; +pub const NFTNL_TRACE_NETWORK_HEADER: nftnl_trace_attr = 10; +pub const NFTNL_TRACE_TRANSPORT_HEADER: nftnl_trace_attr = 11; +pub const NFTNL_TRACE_TABLE: nftnl_trace_attr = 12; +pub const NFTNL_TRACE_TYPE: nftnl_trace_attr = 13; +pub const NFTNL_TRACE_RULE_HANDLE: nftnl_trace_attr = 14; +pub const NFTNL_TRACE_VERDICT: nftnl_trace_attr = 15; +pub const NFTNL_TRACE_NFPROTO: nftnl_trace_attr = 16; +pub const NFTNL_TRACE_POLICY: nftnl_trace_attr = 17; +pub const __NFTNL_TRACE_MAX: nftnl_trace_attr = 18; +pub type nftnl_trace_attr = c_uint; +#[repr(C)] +pub struct nftnl_trace(c_void); + +extern "C" { + pub fn nftnl_trace_alloc() -> *mut nftnl_trace; + + pub fn nftnl_trace_free(trace: *const nftnl_trace); + + pub fn nftnl_trace_is_set(trace: *const nftnl_trace, type_: u16) -> bool; + + pub fn nftnl_trace_get_data( + trace: *const nftnl_trace, + type_: u16, + data_len: *mut u32, + ) -> *const c_void; + + pub fn nftnl_trace_get_u16(trace: *const nftnl_trace, type_: u16) -> u16; + + pub fn nftnl_trace_get_u32(trace: *const nftnl_trace, type_: u16) -> u32; + + pub fn nftnl_trace_get_u64(trace: *const nftnl_trace, type_: u16) -> u64; + + pub fn nftnl_trace_get_str(trace: *const nftnl_trace, type_: u16) -> *const c_char; + + pub fn nftnl_trace_nlmsg_parse(nlh: *const nlmsghdr, t: *mut nftnl_trace) -> c_int; +} +pub const NFTNL_UDATA_TABLE_COMMENT: nftnl_udata_table_types = 0; +pub const __NFTNL_UDATA_TABLE_MAX: nftnl_udata_table_types = 1; +pub type nftnl_udata_table_types = c_uint; +pub const NFTNL_UDATA_CHAIN_COMMENT: nftnl_udata_chain_types = 0; +pub const __NFTNL_UDATA_CHAIN_MAX: nftnl_udata_chain_types = 1; +pub type nftnl_udata_chain_types = c_uint; +pub const NFTNL_UDATA_RULE_COMMENT: nftnl_udata_rule_types = 0; +pub const NFTNL_UDATA_RULE_EBTABLES_POLICY: nftnl_udata_rule_types = 1; +pub const __NFTNL_UDATA_RULE_MAX: nftnl_udata_rule_types = 2; +pub type nftnl_udata_rule_types = c_uint; +pub const NFTNL_UDATA_OBJ_COMMENT: nftnl_udata_obj_types = 0; +pub const __NFTNL_UDATA_OBJ_MAX: nftnl_udata_obj_types = 1; +pub type nftnl_udata_obj_types = c_uint; +pub const NFTNL_UDATA_SET_KEYBYTEORDER: nftnl_udata_set_types = 0; +pub const NFTNL_UDATA_SET_DATABYTEORDER: nftnl_udata_set_types = 1; +pub const NFTNL_UDATA_SET_MERGE_ELEMENTS: nftnl_udata_set_types = 2; +pub const NFTNL_UDATA_SET_KEY_TYPEOF: nftnl_udata_set_types = 3; +pub const NFTNL_UDATA_SET_DATA_TYPEOF: nftnl_udata_set_types = 4; +pub const NFTNL_UDATA_SET_EXPR: nftnl_udata_set_types = 5; +pub const NFTNL_UDATA_SET_DATA_INTERVAL: nftnl_udata_set_types = 6; +pub const NFTNL_UDATA_SET_COMMENT: nftnl_udata_set_types = 7; +pub const __NFTNL_UDATA_SET_MAX: nftnl_udata_set_types = 8; +pub type nftnl_udata_set_types = c_uint; +pub const NFTNL_UDATA_SET_TYPEOF_EXPR: u32 = 0; +pub const NFTNL_UDATA_SET_TYPEOF_DATA: u32 = 1; +pub const __NFTNL_UDATA_SET_TYPEOF_MAX: u32 = 2; + +pub const NFTNL_UDATA_SET_ELEM_COMMENT: nftnl_udata_set_elem_types = 0; +pub const NFTNL_UDATA_SET_ELEM_FLAGS: nftnl_udata_set_elem_types = 1; +pub const __NFTNL_UDATA_SET_ELEM_MAX: nftnl_udata_set_elem_types = 2; +pub type nftnl_udata_set_elem_types = c_uint; +pub const NFTNL_SET_ELEM_F_INTERVAL_OPEN: nftnl_udata_set_elem_flags = 1; +pub type nftnl_udata_set_elem_flags = c_uint; +#[repr(C)] +pub struct nftnl_udata(c_void); + +#[repr(C)] +pub struct nftnl_udata_buf(c_void); + +extern "C" { + pub fn nftnl_udata_buf_alloc(data_size: u32) -> *mut nftnl_udata_buf; + + pub fn nftnl_udata_buf_free(buf: *const nftnl_udata_buf); + + pub fn nftnl_udata_buf_len(buf: *const nftnl_udata_buf) -> u32; + + pub fn nftnl_udata_buf_data(buf: *const nftnl_udata_buf) -> *mut c_void; + + pub fn nftnl_udata_buf_put(buf: *mut nftnl_udata_buf, data: *const c_void, len: u32); + + pub fn nftnl_udata_start(buf: *const nftnl_udata_buf) -> *mut nftnl_udata; + + pub fn nftnl_udata_end(buf: *const nftnl_udata_buf) -> *mut nftnl_udata; + + pub fn nftnl_udata_put( + buf: *mut nftnl_udata_buf, + type_: u8, + len: u32, + value: *const c_void, + ) -> bool; + + pub fn nftnl_udata_put_u32(buf: *mut nftnl_udata_buf, type_: u8, data: u32) -> bool; + + pub fn nftnl_udata_put_strz(buf: *mut nftnl_udata_buf, type_: u8, strz: *const c_char) -> bool; + + pub fn nftnl_udata_nest_start(buf: *mut nftnl_udata_buf, type_: u8) -> *mut nftnl_udata; + + pub fn nftnl_udata_nest_end(buf: *mut nftnl_udata_buf, ud: *mut nftnl_udata); + + pub fn nftnl_udata_type(attr: *const nftnl_udata) -> u8; + + pub fn nftnl_udata_len(attr: *const nftnl_udata) -> u8; + + pub fn nftnl_udata_get(attr: *const nftnl_udata) -> *mut c_void; + + pub fn nftnl_udata_get_u32(attr: *const nftnl_udata) -> u32; + + pub fn nftnl_udata_next(attr: *const nftnl_udata) -> *mut nftnl_udata; +} +pub type nftnl_udata_cb_t = + Option c_int>; +extern "C" { + pub fn nftnl_udata_parse( + data: *const c_void, + data_len: u32, + cb: nftnl_udata_cb_t, + cb_data: *mut c_void, + ) -> c_int; +} diff --git a/nftnl-sys/src/nftnl_1_2_1.rs b/nftnl-sys/src/nftnl_1_2_1.rs new file mode 100644 index 0000000..c9f128f --- /dev/null +++ b/nftnl-sys/src/nftnl_1_2_1.rs @@ -0,0 +1,1489 @@ +/* automatically generated by rust-bindgen 0.69.4 */ + +use core::option::Option; +use libc::{c_char, c_int, c_uint, c_void, iovec, nlmsghdr, FILE}; + +pub const NFTNL_UDATA_COMMENT_MAXLEN: u32 = 128; +#[repr(C)] +pub struct nftnl_batch(c_void); + +extern "C" { + pub fn nftnl_batch_alloc(pg_size: u32, pg_overrun_size: u32) -> *mut nftnl_batch; + + pub fn nftnl_batch_update(batch: *mut nftnl_batch) -> c_int; + + pub fn nftnl_batch_free(batch: *mut nftnl_batch); + + pub fn nftnl_batch_buffer(batch: *mut nftnl_batch) -> *mut c_void; + + pub fn nftnl_batch_buffer_len(batch: *mut nftnl_batch) -> u32; + + pub fn nftnl_batch_iovec_len(batch: *mut nftnl_batch) -> c_int; + + pub fn nftnl_batch_iovec(batch: *mut nftnl_batch, iov: *mut iovec, iovlen: u32); +} +pub const NFTNL_PARSE_EBADINPUT: u32 = 0; +pub const NFTNL_PARSE_EMISSINGNODE: u32 = 1; +pub const NFTNL_PARSE_EBADTYPE: u32 = 2; +pub const NFTNL_PARSE_EOPNOTSUPP: u32 = 3; + +pub const NFTNL_OUTPUT_DEFAULT: nftnl_output_type = 0; +pub const NFTNL_OUTPUT_XML: nftnl_output_type = 1; +pub const NFTNL_OUTPUT_JSON: nftnl_output_type = 2; +pub type nftnl_output_type = c_uint; +pub const NFTNL_OF_EVENT_NEW: nftnl_output_flags = 1; +pub const NFTNL_OF_EVENT_DEL: nftnl_output_flags = 2; +pub const NFTNL_OF_EVENT_ANY: nftnl_output_flags = 3; +pub type nftnl_output_flags = c_uint; +pub const NFTNL_CMD_UNSPEC: nftnl_cmd_type = 0; +pub const NFTNL_CMD_ADD: nftnl_cmd_type = 1; +pub const NFTNL_CMD_INSERT: nftnl_cmd_type = 2; +pub const NFTNL_CMD_DELETE: nftnl_cmd_type = 3; +pub const NFTNL_CMD_REPLACE: nftnl_cmd_type = 4; +pub const NFTNL_CMD_FLUSH: nftnl_cmd_type = 5; +pub const NFTNL_CMD_MAX: nftnl_cmd_type = 6; +pub type nftnl_cmd_type = c_uint; +pub const NFTNL_PARSE_NONE: nftnl_parse_type = 0; +pub const NFTNL_PARSE_XML: nftnl_parse_type = 1; +pub const NFTNL_PARSE_JSON: nftnl_parse_type = 2; +pub const NFTNL_PARSE_MAX: nftnl_parse_type = 3; +pub type nftnl_parse_type = c_uint; +#[repr(C)] +pub struct nftnl_parse_err(c_void); + +extern "C" { + pub fn nftnl_nlmsg_build_hdr( + buf: *mut c_char, + type_: u16, + family: u16, + flags: u16, + seq: u32, + ) -> *mut nlmsghdr; + + pub fn nftnl_parse_err_alloc() -> *mut nftnl_parse_err; + + pub fn nftnl_parse_err_free(arg1: *mut nftnl_parse_err); + + pub fn nftnl_parse_perror(str_: *const c_char, err: *mut nftnl_parse_err) -> c_int; + + pub fn nftnl_batch_is_supported() -> c_int; + + pub fn nftnl_batch_begin(buf: *mut c_char, seq: u32) -> *mut nlmsghdr; + + pub fn nftnl_batch_end(buf: *mut c_char, seq: u32) -> *mut nlmsghdr; +} +#[repr(C)] +pub struct nftnl_chain(c_void); + +#[repr(C)] +pub struct nftnl_rule(c_void); + +extern "C" { + pub fn nftnl_chain_alloc() -> *mut nftnl_chain; + + pub fn nftnl_chain_free(arg1: *const nftnl_chain); +} +pub const NFTNL_CHAIN_NAME: nftnl_chain_attr = 0; +pub const NFTNL_CHAIN_FAMILY: nftnl_chain_attr = 1; +pub const NFTNL_CHAIN_TABLE: nftnl_chain_attr = 2; +pub const NFTNL_CHAIN_HOOKNUM: nftnl_chain_attr = 3; +pub const NFTNL_CHAIN_PRIO: nftnl_chain_attr = 4; +pub const NFTNL_CHAIN_POLICY: nftnl_chain_attr = 5; +pub const NFTNL_CHAIN_USE: nftnl_chain_attr = 6; +pub const NFTNL_CHAIN_BYTES: nftnl_chain_attr = 7; +pub const NFTNL_CHAIN_PACKETS: nftnl_chain_attr = 8; +pub const NFTNL_CHAIN_HANDLE: nftnl_chain_attr = 9; +pub const NFTNL_CHAIN_TYPE: nftnl_chain_attr = 10; +pub const NFTNL_CHAIN_DEV: nftnl_chain_attr = 11; +pub const NFTNL_CHAIN_DEVICES: nftnl_chain_attr = 12; +pub const NFTNL_CHAIN_FLAGS: nftnl_chain_attr = 13; +pub const NFTNL_CHAIN_ID: nftnl_chain_attr = 14; +pub const NFTNL_CHAIN_USERDATA: nftnl_chain_attr = 15; +pub const __NFTNL_CHAIN_MAX: nftnl_chain_attr = 16; +pub type nftnl_chain_attr = c_uint; +extern "C" { + pub fn nftnl_chain_is_set(c: *const nftnl_chain, attr: u16) -> bool; + + pub fn nftnl_chain_unset(c: *mut nftnl_chain, attr: u16); + + pub fn nftnl_chain_set(t: *mut nftnl_chain, attr: u16, data: *const c_void); + + pub fn nftnl_chain_set_data( + t: *mut nftnl_chain, + attr: u16, + data: *const c_void, + data_len: u32, + ) -> c_int; + + pub fn nftnl_chain_set_u8(t: *mut nftnl_chain, attr: u16, data: u8); + + pub fn nftnl_chain_set_u32(t: *mut nftnl_chain, attr: u16, data: u32); + + pub fn nftnl_chain_set_s32(t: *mut nftnl_chain, attr: u16, data: i32); + + pub fn nftnl_chain_set_u64(t: *mut nftnl_chain, attr: u16, data: u64); + + pub fn nftnl_chain_set_str(t: *mut nftnl_chain, attr: u16, str_: *const c_char) -> c_int; + + pub fn nftnl_chain_set_array(t: *mut nftnl_chain, attr: u16, data: *mut *const c_char) + -> c_int; + + pub fn nftnl_chain_get(c: *const nftnl_chain, attr: u16) -> *const c_void; + + pub fn nftnl_chain_get_data( + c: *const nftnl_chain, + attr: u16, + data_len: *mut u32, + ) -> *const c_void; + + pub fn nftnl_chain_get_str(c: *const nftnl_chain, attr: u16) -> *const c_char; + + pub fn nftnl_chain_get_u8(c: *const nftnl_chain, attr: u16) -> u8; + + pub fn nftnl_chain_get_u32(c: *const nftnl_chain, attr: u16) -> u32; + + pub fn nftnl_chain_get_s32(c: *const nftnl_chain, attr: u16) -> i32; + + pub fn nftnl_chain_get_u64(c: *const nftnl_chain, attr: u16) -> u64; + + pub fn nftnl_chain_get_array(c: *const nftnl_chain, attr: u16) -> *const *const c_char; + + pub fn nftnl_chain_rule_add(rule: *mut nftnl_rule, c: *mut nftnl_chain); + + pub fn nftnl_chain_rule_del(rule: *mut nftnl_rule); + + pub fn nftnl_chain_rule_add_tail(rule: *mut nftnl_rule, c: *mut nftnl_chain); + + pub fn nftnl_chain_rule_insert_at(rule: *mut nftnl_rule, pos: *mut nftnl_rule); + + pub fn nftnl_chain_rule_append_at(rule: *mut nftnl_rule, pos: *mut nftnl_rule); + + pub fn nftnl_chain_nlmsg_build_payload(nlh: *mut nlmsghdr, t: *const nftnl_chain); + + pub fn nftnl_chain_parse( + c: *mut nftnl_chain, + type_: nftnl_parse_type, + data: *const c_char, + err: *mut nftnl_parse_err, + ) -> c_int; + + pub fn nftnl_chain_parse_file( + c: *mut nftnl_chain, + type_: nftnl_parse_type, + fp: *mut FILE, + err: *mut nftnl_parse_err, + ) -> c_int; + + pub fn nftnl_chain_snprintf( + buf: *mut c_char, + size: usize, + t: *const nftnl_chain, + type_: u32, + flags: u32, + ) -> c_int; + + pub fn nftnl_chain_fprintf( + fp: *mut FILE, + c: *const nftnl_chain, + type_: u32, + flags: u32, + ) -> c_int; + + pub fn nftnl_chain_nlmsg_parse(nlh: *const nlmsghdr, t: *mut nftnl_chain) -> c_int; + + pub fn nftnl_rule_foreach( + c: *mut nftnl_chain, + cb: Option c_int>, + data: *mut c_void, + ) -> c_int; + + pub fn nftnl_rule_lookup_byindex(c: *mut nftnl_chain, index: u32) -> *mut nftnl_rule; +} +#[repr(C)] +pub struct nftnl_rule_iter(c_void); + +extern "C" { + pub fn nftnl_rule_iter_create(c: *const nftnl_chain) -> *mut nftnl_rule_iter; + + pub fn nftnl_rule_iter_next(iter: *mut nftnl_rule_iter) -> *mut nftnl_rule; + + pub fn nftnl_rule_iter_destroy(iter: *mut nftnl_rule_iter); +} +#[repr(C)] +pub struct nftnl_chain_list(c_void); + +extern "C" { + pub fn nftnl_chain_list_alloc() -> *mut nftnl_chain_list; + + pub fn nftnl_chain_list_free(list: *mut nftnl_chain_list); + + pub fn nftnl_chain_list_is_empty(list: *const nftnl_chain_list) -> c_int; + + pub fn nftnl_chain_list_foreach( + chain_list: *mut nftnl_chain_list, + cb: Option c_int>, + data: *mut c_void, + ) -> c_int; + + pub fn nftnl_chain_list_lookup_byname( + chain_list: *mut nftnl_chain_list, + chain: *const c_char, + ) -> *mut nftnl_chain; + + pub fn nftnl_chain_list_add(r: *mut nftnl_chain, list: *mut nftnl_chain_list); + + pub fn nftnl_chain_list_add_tail(r: *mut nftnl_chain, list: *mut nftnl_chain_list); + + pub fn nftnl_chain_list_del(c: *mut nftnl_chain); +} +#[repr(C)] +pub struct nftnl_chain_list_iter(c_void); + +extern "C" { + pub fn nftnl_chain_list_iter_create(l: *const nftnl_chain_list) -> *mut nftnl_chain_list_iter; + + pub fn nftnl_chain_list_iter_next(iter: *mut nftnl_chain_list_iter) -> *mut nftnl_chain; + + pub fn nftnl_chain_list_iter_destroy(iter: *mut nftnl_chain_list_iter); +} +#[repr(C)] +pub struct nftnl_expr(c_void); + +pub const NFTNL_EXPR_NAME: u32 = 0; +pub const NFTNL_EXPR_BASE: u32 = 1; + +extern "C" { + pub fn nftnl_expr_alloc(name: *const c_char) -> *mut nftnl_expr; + + pub fn nftnl_expr_free(expr: *const nftnl_expr); + + pub fn nftnl_expr_is_set(expr: *const nftnl_expr, type_: u16) -> bool; + + pub fn nftnl_expr_set( + expr: *mut nftnl_expr, + type_: u16, + data: *const c_void, + data_len: u32, + ) -> c_int; + + pub fn nftnl_expr_set_u8(expr: *mut nftnl_expr, type_: u16, data: u8); + + pub fn nftnl_expr_set_u16(expr: *mut nftnl_expr, type_: u16, data: u16); + + pub fn nftnl_expr_set_u32(expr: *mut nftnl_expr, type_: u16, data: u32); + + pub fn nftnl_expr_set_u64(expr: *mut nftnl_expr, type_: u16, data: u64); + + pub fn nftnl_expr_set_str(expr: *mut nftnl_expr, type_: u16, str_: *const c_char) -> c_int; + + pub fn nftnl_expr_get(expr: *const nftnl_expr, type_: u16, data_len: *mut u32) + -> *const c_void; + + pub fn nftnl_expr_get_u8(expr: *const nftnl_expr, type_: u16) -> u8; + + pub fn nftnl_expr_get_u16(expr: *const nftnl_expr, type_: u16) -> u16; + + pub fn nftnl_expr_get_u32(expr: *const nftnl_expr, type_: u16) -> u32; + + pub fn nftnl_expr_get_u64(expr: *const nftnl_expr, type_: u16) -> u64; + + pub fn nftnl_expr_get_str(expr: *const nftnl_expr, type_: u16) -> *const c_char; + + pub fn nftnl_expr_build_payload(nlh: *mut nlmsghdr, expr: *mut nftnl_expr); + + pub fn nftnl_expr_add_expr(expr: *mut nftnl_expr, type_: u32, e: *mut nftnl_expr); + + pub fn nftnl_expr_expr_foreach( + e: *const nftnl_expr, + cb: Option c_int>, + data: *mut c_void, + ) -> c_int; + + pub fn nftnl_expr_snprintf( + buf: *mut c_char, + buflen: usize, + expr: *const nftnl_expr, + type_: u32, + flags: u32, + ) -> c_int; + + pub fn nftnl_expr_fprintf( + fp: *mut FILE, + expr: *const nftnl_expr, + type_: u32, + flags: u32, + ) -> c_int; +} +pub const NFTNL_EXPR_PAYLOAD_DREG: u32 = 1; +pub const NFTNL_EXPR_PAYLOAD_BASE: u32 = 2; +pub const NFTNL_EXPR_PAYLOAD_OFFSET: u32 = 3; +pub const NFTNL_EXPR_PAYLOAD_LEN: u32 = 4; +pub const NFTNL_EXPR_PAYLOAD_SREG: u32 = 5; +pub const NFTNL_EXPR_PAYLOAD_CSUM_TYPE: u32 = 6; +pub const NFTNL_EXPR_PAYLOAD_CSUM_OFFSET: u32 = 7; +pub const NFTNL_EXPR_PAYLOAD_FLAGS: u32 = 8; + +pub const NFTNL_EXPR_NG_DREG: u32 = 1; +pub const NFTNL_EXPR_NG_MODULUS: u32 = 2; +pub const NFTNL_EXPR_NG_TYPE: u32 = 3; +pub const NFTNL_EXPR_NG_OFFSET: u32 = 4; +pub const NFTNL_EXPR_NG_SET_NAME: u32 = 5; +pub const NFTNL_EXPR_NG_SET_ID: u32 = 6; + +pub const NFTNL_EXPR_META_KEY: u32 = 1; +pub const NFTNL_EXPR_META_DREG: u32 = 2; +pub const NFTNL_EXPR_META_SREG: u32 = 3; + +pub const NFTNL_EXPR_RT_KEY: u32 = 1; +pub const NFTNL_EXPR_RT_DREG: u32 = 2; + +pub const NFTNL_EXPR_SOCKET_KEY: u32 = 1; +pub const NFTNL_EXPR_SOCKET_DREG: u32 = 2; +pub const NFTNL_EXPR_SOCKET_LEVEL: u32 = 3; + +pub const NFTNL_EXPR_TUNNEL_KEY: u32 = 1; +pub const NFTNL_EXPR_TUNNEL_DREG: u32 = 2; + +pub const NFTNL_EXPR_CMP_SREG: u32 = 1; +pub const NFTNL_EXPR_CMP_OP: u32 = 2; +pub const NFTNL_EXPR_CMP_DATA: u32 = 3; + +pub const NFTNL_EXPR_RANGE_SREG: u32 = 1; +pub const NFTNL_EXPR_RANGE_OP: u32 = 2; +pub const NFTNL_EXPR_RANGE_FROM_DATA: u32 = 3; +pub const NFTNL_EXPR_RANGE_TO_DATA: u32 = 4; + +pub const NFTNL_EXPR_IMM_DREG: u32 = 1; +pub const NFTNL_EXPR_IMM_DATA: u32 = 2; +pub const NFTNL_EXPR_IMM_VERDICT: u32 = 3; +pub const NFTNL_EXPR_IMM_CHAIN: u32 = 4; +pub const NFTNL_EXPR_IMM_CHAIN_ID: u32 = 5; + +pub const NFTNL_EXPR_CTR_PACKETS: u32 = 1; +pub const NFTNL_EXPR_CTR_BYTES: u32 = 2; + +pub const NFTNL_EXPR_CONNLIMIT_COUNT: u32 = 1; +pub const NFTNL_EXPR_CONNLIMIT_FLAGS: u32 = 2; + +pub const NFTNL_EXPR_BITWISE_SREG: u32 = 1; +pub const NFTNL_EXPR_BITWISE_DREG: u32 = 2; +pub const NFTNL_EXPR_BITWISE_LEN: u32 = 3; +pub const NFTNL_EXPR_BITWISE_MASK: u32 = 4; +pub const NFTNL_EXPR_BITWISE_XOR: u32 = 5; +pub const NFTNL_EXPR_BITWISE_OP: u32 = 6; +pub const NFTNL_EXPR_BITWISE_DATA: u32 = 7; + +pub const NFTNL_EXPR_TG_NAME: u32 = 1; +pub const NFTNL_EXPR_TG_REV: u32 = 2; +pub const NFTNL_EXPR_TG_INFO: u32 = 3; + +pub const NFTNL_EXPR_MT_NAME: u32 = 1; +pub const NFTNL_EXPR_MT_REV: u32 = 2; +pub const NFTNL_EXPR_MT_INFO: u32 = 3; + +pub const NFTNL_EXPR_NAT_TYPE: u32 = 1; +pub const NFTNL_EXPR_NAT_FAMILY: u32 = 2; +pub const NFTNL_EXPR_NAT_REG_ADDR_MIN: u32 = 3; +pub const NFTNL_EXPR_NAT_REG_ADDR_MAX: u32 = 4; +pub const NFTNL_EXPR_NAT_REG_PROTO_MIN: u32 = 5; +pub const NFTNL_EXPR_NAT_REG_PROTO_MAX: u32 = 6; +pub const NFTNL_EXPR_NAT_FLAGS: u32 = 7; + +pub const NFTNL_EXPR_TPROXY_FAMILY: u32 = 1; +pub const NFTNL_EXPR_TPROXY_REG_ADDR: u32 = 2; +pub const NFTNL_EXPR_TPROXY_REG_PORT: u32 = 3; + +pub const NFTNL_EXPR_LOOKUP_SREG: u32 = 1; +pub const NFTNL_EXPR_LOOKUP_DREG: u32 = 2; +pub const NFTNL_EXPR_LOOKUP_SET: u32 = 3; +pub const NFTNL_EXPR_LOOKUP_SET_ID: u32 = 4; +pub const NFTNL_EXPR_LOOKUP_FLAGS: u32 = 5; + +pub const NFTNL_EXPR_DYNSET_SREG_KEY: u32 = 1; +pub const NFTNL_EXPR_DYNSET_SREG_DATA: u32 = 2; +pub const NFTNL_EXPR_DYNSET_OP: u32 = 3; +pub const NFTNL_EXPR_DYNSET_TIMEOUT: u32 = 4; +pub const NFTNL_EXPR_DYNSET_SET_NAME: u32 = 5; +pub const NFTNL_EXPR_DYNSET_SET_ID: u32 = 6; +pub const NFTNL_EXPR_DYNSET_EXPR: u32 = 7; +pub const NFTNL_EXPR_DYNSET_EXPRESSIONS: u32 = 8; +pub const NFTNL_EXPR_DYNSET_FLAGS: u32 = 9; + +pub const NFTNL_EXPR_LOG_PREFIX: u32 = 1; +pub const NFTNL_EXPR_LOG_GROUP: u32 = 2; +pub const NFTNL_EXPR_LOG_SNAPLEN: u32 = 3; +pub const NFTNL_EXPR_LOG_QTHRESHOLD: u32 = 4; +pub const NFTNL_EXPR_LOG_LEVEL: u32 = 5; +pub const NFTNL_EXPR_LOG_FLAGS: u32 = 6; + +pub const NFTNL_EXPR_EXTHDR_DREG: u32 = 1; +pub const NFTNL_EXPR_EXTHDR_TYPE: u32 = 2; +pub const NFTNL_EXPR_EXTHDR_OFFSET: u32 = 3; +pub const NFTNL_EXPR_EXTHDR_LEN: u32 = 4; +pub const NFTNL_EXPR_EXTHDR_FLAGS: u32 = 5; +pub const NFTNL_EXPR_EXTHDR_OP: u32 = 6; +pub const NFTNL_EXPR_EXTHDR_SREG: u32 = 7; + +pub const NFTNL_EXPR_CT_DREG: u32 = 1; +pub const NFTNL_EXPR_CT_KEY: u32 = 2; +pub const NFTNL_EXPR_CT_DIR: u32 = 3; +pub const NFTNL_EXPR_CT_SREG: u32 = 4; + +pub const NFTNL_EXPR_BYTEORDER_DREG: u32 = 1; +pub const NFTNL_EXPR_BYTEORDER_SREG: u32 = 2; +pub const NFTNL_EXPR_BYTEORDER_OP: u32 = 3; +pub const NFTNL_EXPR_BYTEORDER_LEN: u32 = 4; +pub const NFTNL_EXPR_BYTEORDER_SIZE: u32 = 5; + +pub const NFTNL_EXPR_LIMIT_RATE: u32 = 1; +pub const NFTNL_EXPR_LIMIT_UNIT: u32 = 2; +pub const NFTNL_EXPR_LIMIT_BURST: u32 = 3; +pub const NFTNL_EXPR_LIMIT_TYPE: u32 = 4; +pub const NFTNL_EXPR_LIMIT_FLAGS: u32 = 5; + +pub const NFTNL_EXPR_REJECT_TYPE: u32 = 1; +pub const NFTNL_EXPR_REJECT_CODE: u32 = 2; + +pub const NFTNL_EXPR_QUEUE_NUM: u32 = 1; +pub const NFTNL_EXPR_QUEUE_TOTAL: u32 = 2; +pub const NFTNL_EXPR_QUEUE_FLAGS: u32 = 3; +pub const NFTNL_EXPR_QUEUE_SREG_QNUM: u32 = 4; + +pub const NFTNL_EXPR_QUOTA_BYTES: u32 = 1; +pub const NFTNL_EXPR_QUOTA_FLAGS: u32 = 2; +pub const NFTNL_EXPR_QUOTA_CONSUMED: u32 = 3; + +pub const NFTNL_EXPR_MASQ_FLAGS: u32 = 1; +pub const NFTNL_EXPR_MASQ_REG_PROTO_MIN: u32 = 2; +pub const NFTNL_EXPR_MASQ_REG_PROTO_MAX: u32 = 3; + +pub const NFTNL_EXPR_REDIR_REG_PROTO_MIN: u32 = 1; +pub const NFTNL_EXPR_REDIR_REG_PROTO_MAX: u32 = 2; +pub const NFTNL_EXPR_REDIR_FLAGS: u32 = 3; + +pub const NFTNL_EXPR_DUP_SREG_ADDR: u32 = 1; +pub const NFTNL_EXPR_DUP_SREG_DEV: u32 = 2; + +pub const NFTNL_EXPR_FLOW_TABLE_NAME: u32 = 1; + +pub const NFTNL_EXPR_FWD_SREG_DEV: u32 = 1; +pub const NFTNL_EXPR_FWD_SREG_ADDR: u32 = 2; +pub const NFTNL_EXPR_FWD_NFPROTO: u32 = 3; + +pub const NFTNL_EXPR_HASH_SREG: u32 = 1; +pub const NFTNL_EXPR_HASH_DREG: u32 = 2; +pub const NFTNL_EXPR_HASH_LEN: u32 = 3; +pub const NFTNL_EXPR_HASH_MODULUS: u32 = 4; +pub const NFTNL_EXPR_HASH_SEED: u32 = 5; +pub const NFTNL_EXPR_HASH_OFFSET: u32 = 6; +pub const NFTNL_EXPR_HASH_TYPE: u32 = 7; +pub const NFTNL_EXPR_HASH_SET_NAME: u32 = 8; +pub const NFTNL_EXPR_HASH_SET_ID: u32 = 9; + +pub const NFTNL_EXPR_FIB_DREG: u32 = 1; +pub const NFTNL_EXPR_FIB_RESULT: u32 = 2; +pub const NFTNL_EXPR_FIB_FLAGS: u32 = 3; + +pub const NFTNL_EXPR_OBJREF_IMM_TYPE: u32 = 1; +pub const NFTNL_EXPR_OBJREF_IMM_NAME: u32 = 2; +pub const NFTNL_EXPR_OBJREF_SET_SREG: u32 = 3; +pub const NFTNL_EXPR_OBJREF_SET_NAME: u32 = 4; +pub const NFTNL_EXPR_OBJREF_SET_ID: u32 = 5; + +pub const NFTNL_EXPR_OSF_DREG: u32 = 1; +pub const NFTNL_EXPR_OSF_TTL: u32 = 2; +pub const NFTNL_EXPR_OSF_FLAGS: u32 = 3; + +pub const NFTNL_EXPR_XFRM_DREG: u32 = 1; +pub const NFTNL_EXPR_XFRM_SREG: u32 = 2; +pub const NFTNL_EXPR_XFRM_KEY: u32 = 3; +pub const NFTNL_EXPR_XFRM_DIR: u32 = 4; +pub const NFTNL_EXPR_XFRM_SPNUM: u32 = 5; + +pub const NFTNL_EXPR_SYNPROXY_MSS: u32 = 1; +pub const NFTNL_EXPR_SYNPROXY_WSCALE: u32 = 2; +pub const NFTNL_EXPR_SYNPROXY_FLAGS: u32 = 3; + +pub const NFTNL_EXPR_LAST_MSECS: u32 = 1; +pub const NFTNL_EXPR_LAST_SET: u32 = 2; + +#[repr(C)] +pub struct nftnl_gen(c_void); + +extern "C" { + pub fn nftnl_gen_alloc() -> *mut nftnl_gen; + + pub fn nftnl_gen_free(arg1: *const nftnl_gen); +} +pub const NFTNL_GEN_ID: u32 = 0; +pub const __NFTNL_GEN_MAX: u32 = 1; + +extern "C" { + pub fn nftnl_gen_is_set(gen: *const nftnl_gen, attr: u16) -> bool; + + pub fn nftnl_gen_unset(gen: *mut nftnl_gen, attr: u16); + + pub fn nftnl_gen_set(gen: *mut nftnl_gen, attr: u16, data: *const c_void) -> c_int; + + pub fn nftnl_gen_set_data( + gen: *mut nftnl_gen, + attr: u16, + data: *const c_void, + data_len: u32, + ) -> c_int; + + pub fn nftnl_gen_get(gen: *const nftnl_gen, attr: u16) -> *const c_void; + + pub fn nftnl_gen_get_data( + gen: *const nftnl_gen, + attr: u16, + data_len: *mut u32, + ) -> *const c_void; + + pub fn nftnl_gen_set_u32(gen: *mut nftnl_gen, attr: u16, data: u32); + + pub fn nftnl_gen_get_u32(gen: *const nftnl_gen, attr: u16) -> u32; + + pub fn nftnl_gen_nlmsg_parse(nlh: *const nlmsghdr, gen: *mut nftnl_gen) -> c_int; + + pub fn nftnl_gen_snprintf( + buf: *mut c_char, + size: usize, + gen: *const nftnl_gen, + type_: u32, + flags: u32, + ) -> c_int; + + pub fn nftnl_gen_fprintf(fp: *mut FILE, gen: *const nftnl_gen, type_: u32, flags: u32) + -> c_int; +} +pub const NFTNL_OBJ_TABLE: u32 = 0; +pub const NFTNL_OBJ_NAME: u32 = 1; +pub const NFTNL_OBJ_TYPE: u32 = 2; +pub const NFTNL_OBJ_FAMILY: u32 = 3; +pub const NFTNL_OBJ_USE: u32 = 4; +pub const NFTNL_OBJ_HANDLE: u32 = 5; +pub const NFTNL_OBJ_USERDATA: u32 = 6; +pub const NFTNL_OBJ_BASE: u32 = 16; +pub const __NFTNL_OBJ_MAX: u32 = 17; + +pub const NFTNL_OBJ_CTR_PKTS: u32 = 16; +pub const NFTNL_OBJ_CTR_BYTES: u32 = 17; + +pub const NFTNL_OBJ_QUOTA_BYTES: u32 = 16; +pub const NFTNL_OBJ_QUOTA_CONSUMED: u32 = 17; +pub const NFTNL_OBJ_QUOTA_FLAGS: u32 = 18; + +pub const NFTNL_OBJ_CT_HELPER_NAME: u32 = 16; +pub const NFTNL_OBJ_CT_HELPER_L3PROTO: u32 = 17; +pub const NFTNL_OBJ_CT_HELPER_L4PROTO: u32 = 18; + +pub const NFTNL_CTTIMEOUT_TCP_SYN_SENT: nftnl_cttimeout_array_tcp = 0; +pub const NFTNL_CTTIMEOUT_TCP_SYN_RECV: nftnl_cttimeout_array_tcp = 1; +pub const NFTNL_CTTIMEOUT_TCP_ESTABLISHED: nftnl_cttimeout_array_tcp = 2; +pub const NFTNL_CTTIMEOUT_TCP_FIN_WAIT: nftnl_cttimeout_array_tcp = 3; +pub const NFTNL_CTTIMEOUT_TCP_CLOSE_WAIT: nftnl_cttimeout_array_tcp = 4; +pub const NFTNL_CTTIMEOUT_TCP_LAST_ACK: nftnl_cttimeout_array_tcp = 5; +pub const NFTNL_CTTIMEOUT_TCP_TIME_WAIT: nftnl_cttimeout_array_tcp = 6; +pub const NFTNL_CTTIMEOUT_TCP_CLOSE: nftnl_cttimeout_array_tcp = 7; +pub const NFTNL_CTTIMEOUT_TCP_SYN_SENT2: nftnl_cttimeout_array_tcp = 8; +pub const NFTNL_CTTIMEOUT_TCP_RETRANS: nftnl_cttimeout_array_tcp = 9; +pub const NFTNL_CTTIMEOUT_TCP_UNACK: nftnl_cttimeout_array_tcp = 10; +pub const NFTNL_CTTIMEOUT_TCP_MAX: nftnl_cttimeout_array_tcp = 11; +pub type nftnl_cttimeout_array_tcp = c_uint; +pub const NFTNL_CTTIMEOUT_UDP_UNREPLIED: nftnl_cttimeout_array_udp = 0; +pub const NFTNL_CTTIMEOUT_UDP_REPLIED: nftnl_cttimeout_array_udp = 1; +pub const NFTNL_CTTIMEOUT_UDP_MAX: nftnl_cttimeout_array_udp = 2; +pub type nftnl_cttimeout_array_udp = c_uint; +pub const NFTNL_OBJ_CT_TIMEOUT_L3PROTO: u32 = 16; +pub const NFTNL_OBJ_CT_TIMEOUT_L4PROTO: u32 = 17; +pub const NFTNL_OBJ_CT_TIMEOUT_ARRAY: u32 = 18; + +pub const NFTNL_OBJ_CT_EXPECT_L3PROTO: u32 = 16; +pub const NFTNL_OBJ_CT_EXPECT_L4PROTO: u32 = 17; +pub const NFTNL_OBJ_CT_EXPECT_DPORT: u32 = 18; +pub const NFTNL_OBJ_CT_EXPECT_TIMEOUT: u32 = 19; +pub const NFTNL_OBJ_CT_EXPECT_SIZE: u32 = 20; + +pub const NFTNL_OBJ_LIMIT_RATE: u32 = 16; +pub const NFTNL_OBJ_LIMIT_UNIT: u32 = 17; +pub const NFTNL_OBJ_LIMIT_BURST: u32 = 18; +pub const NFTNL_OBJ_LIMIT_TYPE: u32 = 19; +pub const NFTNL_OBJ_LIMIT_FLAGS: u32 = 20; + +pub const NFTNL_OBJ_SYNPROXY_MSS: u32 = 16; +pub const NFTNL_OBJ_SYNPROXY_WSCALE: u32 = 17; +pub const NFTNL_OBJ_SYNPROXY_FLAGS: u32 = 18; + +pub const NFTNL_OBJ_TUNNEL_ID: u32 = 16; +pub const NFTNL_OBJ_TUNNEL_IPV4_SRC: u32 = 17; +pub const NFTNL_OBJ_TUNNEL_IPV4_DST: u32 = 18; +pub const NFTNL_OBJ_TUNNEL_IPV6_SRC: u32 = 19; +pub const NFTNL_OBJ_TUNNEL_IPV6_DST: u32 = 20; +pub const NFTNL_OBJ_TUNNEL_IPV6_FLOWLABEL: u32 = 21; +pub const NFTNL_OBJ_TUNNEL_SPORT: u32 = 22; +pub const NFTNL_OBJ_TUNNEL_DPORT: u32 = 23; +pub const NFTNL_OBJ_TUNNEL_FLAGS: u32 = 24; +pub const NFTNL_OBJ_TUNNEL_TOS: u32 = 25; +pub const NFTNL_OBJ_TUNNEL_TTL: u32 = 26; +pub const NFTNL_OBJ_TUNNEL_VXLAN_GBP: u32 = 27; +pub const NFTNL_OBJ_TUNNEL_ERSPAN_VERSION: u32 = 28; +pub const NFTNL_OBJ_TUNNEL_ERSPAN_V1_INDEX: u32 = 29; +pub const NFTNL_OBJ_TUNNEL_ERSPAN_V2_HWID: u32 = 30; +pub const NFTNL_OBJ_TUNNEL_ERSPAN_V2_DIR: u32 = 31; + +pub const NFTNL_OBJ_SECMARK_CTX: u32 = 16; + +#[repr(C)] +pub struct nftnl_obj(c_void); + +extern "C" { + pub fn nftnl_obj_alloc() -> *mut nftnl_obj; + + pub fn nftnl_obj_free(ne: *const nftnl_obj); + + pub fn nftnl_obj_is_set(ne: *const nftnl_obj, attr: u16) -> bool; + + pub fn nftnl_obj_unset(ne: *mut nftnl_obj, attr: u16); + + pub fn nftnl_obj_set_data(ne: *mut nftnl_obj, attr: u16, data: *const c_void, data_len: u32); + + pub fn nftnl_obj_set(ne: *mut nftnl_obj, attr: u16, data: *const c_void); + + pub fn nftnl_obj_set_u8(ne: *mut nftnl_obj, attr: u16, val: u8); + + pub fn nftnl_obj_set_u16(ne: *mut nftnl_obj, attr: u16, val: u16); + + pub fn nftnl_obj_set_u32(ne: *mut nftnl_obj, attr: u16, val: u32); + + pub fn nftnl_obj_set_u64(obj: *mut nftnl_obj, attr: u16, val: u64); + + pub fn nftnl_obj_set_str(ne: *mut nftnl_obj, attr: u16, str_: *const c_char); + + pub fn nftnl_obj_get_data(ne: *mut nftnl_obj, attr: u16, data_len: *mut u32) -> *const c_void; + + pub fn nftnl_obj_get(ne: *mut nftnl_obj, attr: u16) -> *const c_void; + + pub fn nftnl_obj_get_u8(ne: *mut nftnl_obj, attr: u16) -> u8; + + pub fn nftnl_obj_get_u16(obj: *mut nftnl_obj, attr: u16) -> u16; + + pub fn nftnl_obj_get_u32(ne: *mut nftnl_obj, attr: u16) -> u32; + + pub fn nftnl_obj_get_u64(obj: *mut nftnl_obj, attr: u16) -> u64; + + pub fn nftnl_obj_get_str(ne: *mut nftnl_obj, attr: u16) -> *const c_char; + + pub fn nftnl_obj_nlmsg_build_payload(nlh: *mut nlmsghdr, ne: *const nftnl_obj); + + pub fn nftnl_obj_nlmsg_parse(nlh: *const nlmsghdr, ne: *mut nftnl_obj) -> c_int; + + pub fn nftnl_obj_parse( + ne: *mut nftnl_obj, + type_: nftnl_parse_type, + data: *const c_char, + err: *mut nftnl_parse_err, + ) -> c_int; + + pub fn nftnl_obj_parse_file( + ne: *mut nftnl_obj, + type_: nftnl_parse_type, + fp: *mut FILE, + err: *mut nftnl_parse_err, + ) -> c_int; + + pub fn nftnl_obj_snprintf( + buf: *mut c_char, + size: usize, + ne: *const nftnl_obj, + type_: u32, + flags: u32, + ) -> c_int; + + pub fn nftnl_obj_fprintf(fp: *mut FILE, ne: *const nftnl_obj, type_: u32, flags: u32) -> c_int; +} +#[repr(C)] +pub struct nftnl_obj_list(c_void); + +extern "C" { + pub fn nftnl_obj_list_alloc() -> *mut nftnl_obj_list; + + pub fn nftnl_obj_list_free(list: *mut nftnl_obj_list); + + pub fn nftnl_obj_list_is_empty(list: *mut nftnl_obj_list) -> c_int; + + pub fn nftnl_obj_list_add(r: *mut nftnl_obj, list: *mut nftnl_obj_list); + + pub fn nftnl_obj_list_add_tail(r: *mut nftnl_obj, list: *mut nftnl_obj_list); + + pub fn nftnl_obj_list_del(t: *mut nftnl_obj); + + pub fn nftnl_obj_list_foreach( + table_list: *mut nftnl_obj_list, + cb: Option c_int>, + data: *mut c_void, + ) -> c_int; +} +#[repr(C)] +pub struct nftnl_obj_list_iter(c_void); + +extern "C" { + pub fn nftnl_obj_list_iter_create(l: *mut nftnl_obj_list) -> *mut nftnl_obj_list_iter; + + pub fn nftnl_obj_list_iter_next(iter: *mut nftnl_obj_list_iter) -> *mut nftnl_obj; + + pub fn nftnl_obj_list_iter_destroy(iter: *mut nftnl_obj_list_iter); + + pub fn nftnl_rule_alloc() -> *mut nftnl_rule; + + pub fn nftnl_rule_free(arg1: *const nftnl_rule); +} +pub const NFTNL_RULE_FAMILY: nftnl_rule_attr = 0; +pub const NFTNL_RULE_TABLE: nftnl_rule_attr = 1; +pub const NFTNL_RULE_CHAIN: nftnl_rule_attr = 2; +pub const NFTNL_RULE_HANDLE: nftnl_rule_attr = 3; +pub const NFTNL_RULE_COMPAT_PROTO: nftnl_rule_attr = 4; +pub const NFTNL_RULE_COMPAT_FLAGS: nftnl_rule_attr = 5; +pub const NFTNL_RULE_POSITION: nftnl_rule_attr = 6; +pub const NFTNL_RULE_USERDATA: nftnl_rule_attr = 7; +pub const NFTNL_RULE_ID: nftnl_rule_attr = 8; +pub const NFTNL_RULE_POSITION_ID: nftnl_rule_attr = 9; +pub const __NFTNL_RULE_MAX: nftnl_rule_attr = 10; +pub type nftnl_rule_attr = c_uint; +extern "C" { + pub fn nftnl_rule_unset(r: *mut nftnl_rule, attr: u16); + + pub fn nftnl_rule_is_set(r: *const nftnl_rule, attr: u16) -> bool; + + pub fn nftnl_rule_set(r: *mut nftnl_rule, attr: u16, data: *const c_void) -> c_int; + + pub fn nftnl_rule_set_data( + r: *mut nftnl_rule, + attr: u16, + data: *const c_void, + data_len: u32, + ) -> c_int; + + pub fn nftnl_rule_set_u32(r: *mut nftnl_rule, attr: u16, val: u32); + + pub fn nftnl_rule_set_u64(r: *mut nftnl_rule, attr: u16, val: u64); + + pub fn nftnl_rule_set_str(r: *mut nftnl_rule, attr: u16, str_: *const c_char) -> c_int; + + pub fn nftnl_rule_get(r: *const nftnl_rule, attr: u16) -> *const c_void; + + pub fn nftnl_rule_get_data( + r: *const nftnl_rule, + attr: u16, + data_len: *mut u32, + ) -> *const c_void; + + pub fn nftnl_rule_get_str(r: *const nftnl_rule, attr: u16) -> *const c_char; + + pub fn nftnl_rule_get_u8(r: *const nftnl_rule, attr: u16) -> u8; + + pub fn nftnl_rule_get_u32(r: *const nftnl_rule, attr: u16) -> u32; + + pub fn nftnl_rule_get_u64(r: *const nftnl_rule, attr: u16) -> u64; + + pub fn nftnl_rule_add_expr(r: *mut nftnl_rule, expr: *mut nftnl_expr); + + pub fn nftnl_rule_del_expr(expr: *mut nftnl_expr); + + pub fn nftnl_rule_nlmsg_build_payload(nlh: *mut nlmsghdr, t: *mut nftnl_rule); + + pub fn nftnl_rule_parse( + r: *mut nftnl_rule, + type_: nftnl_parse_type, + data: *const c_char, + err: *mut nftnl_parse_err, + ) -> c_int; + + pub fn nftnl_rule_parse_file( + r: *mut nftnl_rule, + type_: nftnl_parse_type, + fp: *mut FILE, + err: *mut nftnl_parse_err, + ) -> c_int; + + pub fn nftnl_rule_snprintf( + buf: *mut c_char, + size: usize, + t: *const nftnl_rule, + type_: u32, + flags: u32, + ) -> c_int; + + pub fn nftnl_rule_fprintf(fp: *mut FILE, r: *const nftnl_rule, type_: u32, flags: u32) + -> c_int; + + pub fn nftnl_rule_nlmsg_parse(nlh: *const nlmsghdr, t: *mut nftnl_rule) -> c_int; + + pub fn nftnl_expr_foreach( + r: *mut nftnl_rule, + cb: Option c_int>, + data: *mut c_void, + ) -> c_int; +} +#[repr(C)] +pub struct nftnl_expr_iter(c_void); + +extern "C" { + pub fn nftnl_expr_iter_create(r: *const nftnl_rule) -> *mut nftnl_expr_iter; + + pub fn nftnl_expr_iter_next(iter: *mut nftnl_expr_iter) -> *mut nftnl_expr; + + pub fn nftnl_expr_iter_destroy(iter: *mut nftnl_expr_iter); +} +#[repr(C)] +pub struct nftnl_rule_list(c_void); + +extern "C" { + pub fn nftnl_rule_list_alloc() -> *mut nftnl_rule_list; + + pub fn nftnl_rule_list_free(list: *mut nftnl_rule_list); + + pub fn nftnl_rule_list_is_empty(list: *const nftnl_rule_list) -> c_int; + + pub fn nftnl_rule_list_add(r: *mut nftnl_rule, list: *mut nftnl_rule_list); + + pub fn nftnl_rule_list_add_tail(r: *mut nftnl_rule, list: *mut nftnl_rule_list); + + pub fn nftnl_rule_list_insert_at(r: *mut nftnl_rule, pos: *mut nftnl_rule); + + pub fn nftnl_rule_list_del(r: *mut nftnl_rule); + + pub fn nftnl_rule_list_foreach( + rule_list: *mut nftnl_rule_list, + cb: Option c_int>, + data: *mut c_void, + ) -> c_int; +} +#[repr(C)] +pub struct nftnl_rule_list_iter(c_void); + +extern "C" { + pub fn nftnl_rule_list_iter_create(l: *const nftnl_rule_list) -> *mut nftnl_rule_list_iter; + + pub fn nftnl_rule_list_iter_cur(iter: *mut nftnl_rule_list_iter) -> *mut nftnl_rule; + + pub fn nftnl_rule_list_iter_next(iter: *mut nftnl_rule_list_iter) -> *mut nftnl_rule; + + pub fn nftnl_rule_list_iter_destroy(iter: *const nftnl_rule_list_iter); +} +#[repr(C)] +pub struct nftnl_ruleset(c_void); + +extern "C" { + pub fn nftnl_ruleset_alloc() -> *mut nftnl_ruleset; + + pub fn nftnl_ruleset_free(r: *const nftnl_ruleset); +} +pub const NFTNL_RULESET_TABLELIST: u32 = 0; +pub const NFTNL_RULESET_CHAINLIST: u32 = 1; +pub const NFTNL_RULESET_SETLIST: u32 = 2; +pub const NFTNL_RULESET_RULELIST: u32 = 3; + +pub const NFTNL_RULESET_UNSPEC: nftnl_ruleset_type = 0; +pub const NFTNL_RULESET_RULESET: nftnl_ruleset_type = 1; +pub const NFTNL_RULESET_TABLE: nftnl_ruleset_type = 2; +pub const NFTNL_RULESET_CHAIN: nftnl_ruleset_type = 3; +pub const NFTNL_RULESET_RULE: nftnl_ruleset_type = 4; +pub const NFTNL_RULESET_SET: nftnl_ruleset_type = 5; +pub const NFTNL_RULESET_SET_ELEMS: nftnl_ruleset_type = 6; +pub type nftnl_ruleset_type = c_uint; +extern "C" { + pub fn nftnl_ruleset_is_set(r: *const nftnl_ruleset, attr: u16) -> bool; + + pub fn nftnl_ruleset_unset(r: *mut nftnl_ruleset, attr: u16); + + pub fn nftnl_ruleset_set(r: *mut nftnl_ruleset, attr: u16, data: *mut c_void); + + pub fn nftnl_ruleset_get(r: *const nftnl_ruleset, attr: u16) -> *mut c_void; +} +pub const NFTNL_RULESET_CTX_CMD: u32 = 0; +pub const NFTNL_RULESET_CTX_TYPE: u32 = 1; +pub const NFTNL_RULESET_CTX_TABLE: u32 = 2; +pub const NFTNL_RULESET_CTX_CHAIN: u32 = 3; +pub const NFTNL_RULESET_CTX_RULE: u32 = 4; +pub const NFTNL_RULESET_CTX_SET: u32 = 5; +pub const NFTNL_RULESET_CTX_DATA: u32 = 6; + +#[repr(C)] +pub struct nftnl_parse_ctx(c_void); + +extern "C" { + pub fn nftnl_ruleset_ctx_free(ctx: *const nftnl_parse_ctx); + + pub fn nftnl_ruleset_ctx_is_set(ctx: *const nftnl_parse_ctx, attr: u16) -> bool; + + pub fn nftnl_ruleset_ctx_get(ctx: *const nftnl_parse_ctx, attr: u16) -> *mut c_void; + + pub fn nftnl_ruleset_ctx_get_u32(ctx: *const nftnl_parse_ctx, attr: u16) -> u32; + + pub fn nftnl_ruleset_parse_file_cb( + type_: nftnl_parse_type, + fp: *mut FILE, + err: *mut nftnl_parse_err, + data: *mut c_void, + cb: Option c_int>, + ) -> c_int; + + pub fn nftnl_ruleset_parse_buffer_cb( + type_: nftnl_parse_type, + buffer: *const c_char, + err: *mut nftnl_parse_err, + data: *mut c_void, + cb: Option c_int>, + ) -> c_int; + + pub fn nftnl_ruleset_parse( + rs: *mut nftnl_ruleset, + type_: nftnl_parse_type, + data: *const c_char, + err: *mut nftnl_parse_err, + ) -> c_int; + + pub fn nftnl_ruleset_parse_file( + rs: *mut nftnl_ruleset, + type_: nftnl_parse_type, + fp: *mut FILE, + err: *mut nftnl_parse_err, + ) -> c_int; + + pub fn nftnl_ruleset_snprintf( + buf: *mut c_char, + size: usize, + rs: *const nftnl_ruleset, + type_: u32, + flags: u32, + ) -> c_int; + + pub fn nftnl_ruleset_fprintf( + fp: *mut FILE, + rs: *const nftnl_ruleset, + type_: u32, + flags: u32, + ) -> c_int; +} +pub const NFTNL_SET_TABLE: nftnl_set_attr = 0; +pub const NFTNL_SET_NAME: nftnl_set_attr = 1; +pub const NFTNL_SET_FLAGS: nftnl_set_attr = 2; +pub const NFTNL_SET_KEY_TYPE: nftnl_set_attr = 3; +pub const NFTNL_SET_KEY_LEN: nftnl_set_attr = 4; +pub const NFTNL_SET_DATA_TYPE: nftnl_set_attr = 5; +pub const NFTNL_SET_DATA_LEN: nftnl_set_attr = 6; +pub const NFTNL_SET_FAMILY: nftnl_set_attr = 7; +pub const NFTNL_SET_ID: nftnl_set_attr = 8; +pub const NFTNL_SET_POLICY: nftnl_set_attr = 9; +pub const NFTNL_SET_DESC_SIZE: nftnl_set_attr = 10; +pub const NFTNL_SET_TIMEOUT: nftnl_set_attr = 11; +pub const NFTNL_SET_GC_INTERVAL: nftnl_set_attr = 12; +pub const NFTNL_SET_USERDATA: nftnl_set_attr = 13; +pub const NFTNL_SET_OBJ_TYPE: nftnl_set_attr = 14; +pub const NFTNL_SET_HANDLE: nftnl_set_attr = 15; +pub const NFTNL_SET_DESC_CONCAT: nftnl_set_attr = 16; +pub const NFTNL_SET_EXPR: nftnl_set_attr = 17; +pub const NFTNL_SET_EXPRESSIONS: nftnl_set_attr = 18; +pub const __NFTNL_SET_MAX: nftnl_set_attr = 19; +pub type nftnl_set_attr = c_uint; +#[repr(C)] +pub struct nftnl_set(c_void); + +extern "C" { + pub fn nftnl_set_alloc() -> *mut nftnl_set; + + pub fn nftnl_set_free(s: *const nftnl_set); + + pub fn nftnl_set_clone(set: *const nftnl_set) -> *mut nftnl_set; + + pub fn nftnl_set_is_set(s: *const nftnl_set, attr: u16) -> bool; + + pub fn nftnl_set_unset(s: *mut nftnl_set, attr: u16); + + pub fn nftnl_set_set(s: *mut nftnl_set, attr: u16, data: *const c_void) -> c_int; + + pub fn nftnl_set_set_data( + s: *mut nftnl_set, + attr: u16, + data: *const c_void, + data_len: u32, + ) -> c_int; + + pub fn nftnl_set_set_u32(s: *mut nftnl_set, attr: u16, val: u32); + + pub fn nftnl_set_set_u64(s: *mut nftnl_set, attr: u16, val: u64); + + pub fn nftnl_set_set_str(s: *mut nftnl_set, attr: u16, str_: *const c_char) -> c_int; + + pub fn nftnl_set_get(s: *const nftnl_set, attr: u16) -> *const c_void; + + pub fn nftnl_set_get_data(s: *const nftnl_set, attr: u16, data_len: *mut u32) -> *const c_void; + + pub fn nftnl_set_get_str(s: *const nftnl_set, attr: u16) -> *const c_char; + + pub fn nftnl_set_get_u32(s: *const nftnl_set, attr: u16) -> u32; + + pub fn nftnl_set_get_u64(s: *const nftnl_set, attr: u16) -> u64; + + pub fn nftnl_set_nlmsg_build_payload(nlh: *mut nlmsghdr, s: *mut nftnl_set); + + pub fn nftnl_set_nlmsg_parse(nlh: *const nlmsghdr, s: *mut nftnl_set) -> c_int; + + pub fn nftnl_set_elems_nlmsg_parse(nlh: *const nlmsghdr, s: *mut nftnl_set) -> c_int; + + pub fn nftnl_set_snprintf( + buf: *mut c_char, + size: usize, + s: *const nftnl_set, + type_: u32, + flags: u32, + ) -> c_int; + + pub fn nftnl_set_fprintf(fp: *mut FILE, s: *const nftnl_set, type_: u32, flags: u32) -> c_int; +} +#[repr(C)] +pub struct nftnl_set_list(c_void); + +extern "C" { + pub fn nftnl_set_list_alloc() -> *mut nftnl_set_list; + + pub fn nftnl_set_list_free(list: *mut nftnl_set_list); + + pub fn nftnl_set_list_is_empty(list: *const nftnl_set_list) -> c_int; + + pub fn nftnl_set_list_add(s: *mut nftnl_set, list: *mut nftnl_set_list); + + pub fn nftnl_set_list_add_tail(s: *mut nftnl_set, list: *mut nftnl_set_list); + + pub fn nftnl_set_list_del(s: *mut nftnl_set); + + pub fn nftnl_set_list_foreach( + set_list: *mut nftnl_set_list, + cb: Option c_int>, + data: *mut c_void, + ) -> c_int; + + pub fn nftnl_set_list_lookup_byname( + set_list: *mut nftnl_set_list, + set: *const c_char, + ) -> *mut nftnl_set; + + pub fn nftnl_set_add_expr(s: *mut nftnl_set, expr: *mut nftnl_expr); + + pub fn nftnl_set_expr_foreach( + s: *const nftnl_set, + cb: Option c_int>, + data: *mut c_void, + ) -> c_int; +} +#[repr(C)] +pub struct nftnl_set_list_iter(c_void); + +extern "C" { + pub fn nftnl_set_list_iter_create(l: *const nftnl_set_list) -> *mut nftnl_set_list_iter; + + pub fn nftnl_set_list_iter_cur(iter: *const nftnl_set_list_iter) -> *mut nftnl_set; + + pub fn nftnl_set_list_iter_next(iter: *mut nftnl_set_list_iter) -> *mut nftnl_set; + + pub fn nftnl_set_list_iter_destroy(iter: *const nftnl_set_list_iter); + + pub fn nftnl_set_parse( + s: *mut nftnl_set, + type_: nftnl_parse_type, + data: *const c_char, + err: *mut nftnl_parse_err, + ) -> c_int; + + pub fn nftnl_set_parse_file( + s: *mut nftnl_set, + type_: nftnl_parse_type, + fp: *mut FILE, + err: *mut nftnl_parse_err, + ) -> c_int; +} +pub const NFTNL_SET_ELEM_FLAGS: u32 = 0; +pub const NFTNL_SET_ELEM_KEY: u32 = 1; +pub const NFTNL_SET_ELEM_VERDICT: u32 = 2; +pub const NFTNL_SET_ELEM_CHAIN: u32 = 3; +pub const NFTNL_SET_ELEM_DATA: u32 = 4; +pub const NFTNL_SET_ELEM_TIMEOUT: u32 = 5; +pub const NFTNL_SET_ELEM_EXPIRATION: u32 = 6; +pub const NFTNL_SET_ELEM_USERDATA: u32 = 7; +pub const NFTNL_SET_ELEM_EXPR: u32 = 8; +pub const NFTNL_SET_ELEM_OBJREF: u32 = 9; +pub const NFTNL_SET_ELEM_KEY_END: u32 = 10; +pub const NFTNL_SET_ELEM_EXPRESSIONS: u32 = 11; +pub const __NFTNL_SET_ELEM_MAX: u32 = 12; + +#[repr(C)] +pub struct nftnl_set_elem(c_void); + +extern "C" { + pub fn nftnl_set_elem_alloc() -> *mut nftnl_set_elem; + + pub fn nftnl_set_elem_free(s: *mut nftnl_set_elem); + + pub fn nftnl_set_elem_clone(elem: *mut nftnl_set_elem) -> *mut nftnl_set_elem; + + pub fn nftnl_set_elem_add(s: *mut nftnl_set, elem: *mut nftnl_set_elem); + + pub fn nftnl_set_elem_unset(s: *mut nftnl_set_elem, attr: u16); + + pub fn nftnl_set_elem_set( + s: *mut nftnl_set_elem, + attr: u16, + data: *const c_void, + data_len: u32, + ) -> c_int; + + pub fn nftnl_set_elem_set_u32(s: *mut nftnl_set_elem, attr: u16, val: u32); + + pub fn nftnl_set_elem_set_u64(s: *mut nftnl_set_elem, attr: u16, val: u64); + + pub fn nftnl_set_elem_set_str(s: *mut nftnl_set_elem, attr: u16, str_: *const c_char) -> c_int; + + pub fn nftnl_set_elem_get( + s: *mut nftnl_set_elem, + attr: u16, + data_len: *mut u32, + ) -> *const c_void; + + pub fn nftnl_set_elem_get_str(s: *mut nftnl_set_elem, attr: u16) -> *const c_char; + + pub fn nftnl_set_elem_get_u32(s: *mut nftnl_set_elem, attr: u16) -> u32; + + pub fn nftnl_set_elem_get_u64(s: *mut nftnl_set_elem, attr: u16) -> u64; + + pub fn nftnl_set_elem_is_set(s: *const nftnl_set_elem, attr: u16) -> bool; + + pub fn nftnl_set_elems_nlmsg_build_payload(nlh: *mut nlmsghdr, s: *mut nftnl_set); + + pub fn nftnl_set_elem_nlmsg_build_payload(nlh: *mut nlmsghdr, e: *mut nftnl_set_elem); +} +#[repr(C)] +pub struct nlattr(c_void); + +extern "C" { + pub fn nftnl_set_elem_nlmsg_build( + nlh: *mut nlmsghdr, + elem: *mut nftnl_set_elem, + i: c_int, + ) -> *mut nlattr; + + pub fn nftnl_set_elem_parse( + e: *mut nftnl_set_elem, + type_: nftnl_parse_type, + data: *const c_char, + err: *mut nftnl_parse_err, + ) -> c_int; + + pub fn nftnl_set_elem_parse_file( + e: *mut nftnl_set_elem, + type_: nftnl_parse_type, + fp: *mut FILE, + err: *mut nftnl_parse_err, + ) -> c_int; + + pub fn nftnl_set_elem_snprintf( + buf: *mut c_char, + size: usize, + s: *const nftnl_set_elem, + type_: u32, + flags: u32, + ) -> c_int; + + pub fn nftnl_set_elem_fprintf( + fp: *mut FILE, + se: *const nftnl_set_elem, + type_: u32, + flags: u32, + ) -> c_int; + + pub fn nftnl_set_elem_add_expr(e: *mut nftnl_set_elem, expr: *mut nftnl_expr); + + pub fn nftnl_set_elem_expr_foreach( + e: *mut nftnl_set_elem, + cb: Option c_int>, + data: *mut c_void, + ) -> c_int; + + pub fn nftnl_set_elem_foreach( + s: *mut nftnl_set, + cb: Option c_int>, + data: *mut c_void, + ) -> c_int; +} +#[repr(C)] +pub struct nftnl_set_elems_iter(c_void); + +extern "C" { + pub fn nftnl_set_elems_iter_create(s: *const nftnl_set) -> *mut nftnl_set_elems_iter; + + pub fn nftnl_set_elems_iter_cur(iter: *const nftnl_set_elems_iter) -> *mut nftnl_set_elem; + + pub fn nftnl_set_elems_iter_next(iter: *mut nftnl_set_elems_iter) -> *mut nftnl_set_elem; + + pub fn nftnl_set_elems_iter_destroy(iter: *mut nftnl_set_elems_iter); + + pub fn nftnl_set_elems_nlmsg_build_payload_iter( + nlh: *mut nlmsghdr, + iter: *mut nftnl_set_elems_iter, + ) -> c_int; +} +#[repr(C)] +pub struct nftnl_table(c_void); + +extern "C" { + pub fn nftnl_table_alloc() -> *mut nftnl_table; + + pub fn nftnl_table_free(arg1: *const nftnl_table); +} +pub const NFTNL_TABLE_NAME: nftnl_table_attr = 0; +pub const NFTNL_TABLE_FAMILY: nftnl_table_attr = 1; +pub const NFTNL_TABLE_FLAGS: nftnl_table_attr = 2; +pub const NFTNL_TABLE_USE: nftnl_table_attr = 3; +pub const NFTNL_TABLE_HANDLE: nftnl_table_attr = 4; +pub const NFTNL_TABLE_USERDATA: nftnl_table_attr = 5; +pub const NFTNL_TABLE_OWNER: nftnl_table_attr = 6; +pub const __NFTNL_TABLE_MAX: nftnl_table_attr = 7; +pub type nftnl_table_attr = c_uint; +extern "C" { + pub fn nftnl_table_is_set(t: *const nftnl_table, attr: u16) -> bool; + + pub fn nftnl_table_unset(t: *mut nftnl_table, attr: u16); + + pub fn nftnl_table_set(t: *mut nftnl_table, attr: u16, data: *const c_void); + + pub fn nftnl_table_set_data( + t: *mut nftnl_table, + attr: u16, + data: *const c_void, + data_len: u32, + ) -> c_int; + + pub fn nftnl_table_get(t: *const nftnl_table, attr: u16) -> *const c_void; + + pub fn nftnl_table_get_data( + t: *const nftnl_table, + attr: u16, + data_len: *mut u32, + ) -> *const c_void; + + pub fn nftnl_table_set_u8(t: *mut nftnl_table, attr: u16, data: u8); + + pub fn nftnl_table_set_u32(t: *mut nftnl_table, attr: u16, data: u32); + + pub fn nftnl_table_set_u64(t: *mut nftnl_table, attr: u16, data: u64); + + pub fn nftnl_table_set_str(t: *mut nftnl_table, attr: u16, str_: *const c_char) -> c_int; + + pub fn nftnl_table_get_u8(t: *const nftnl_table, attr: u16) -> u8; + + pub fn nftnl_table_get_u32(t: *const nftnl_table, attr: u16) -> u32; + + pub fn nftnl_table_get_u64(t: *const nftnl_table, attr: u16) -> u64; + + pub fn nftnl_table_get_str(t: *const nftnl_table, attr: u16) -> *const c_char; + + pub fn nftnl_table_nlmsg_build_payload(nlh: *mut nlmsghdr, t: *const nftnl_table); + + pub fn nftnl_table_parse( + t: *mut nftnl_table, + type_: nftnl_parse_type, + data: *const c_char, + err: *mut nftnl_parse_err, + ) -> c_int; + + pub fn nftnl_table_parse_file( + t: *mut nftnl_table, + type_: nftnl_parse_type, + fp: *mut FILE, + err: *mut nftnl_parse_err, + ) -> c_int; + + pub fn nftnl_table_snprintf( + buf: *mut c_char, + size: usize, + t: *const nftnl_table, + type_: u32, + flags: u32, + ) -> c_int; + + pub fn nftnl_table_fprintf( + fp: *mut FILE, + t: *const nftnl_table, + type_: u32, + flags: u32, + ) -> c_int; + + pub fn nftnl_table_nlmsg_parse(nlh: *const nlmsghdr, t: *mut nftnl_table) -> c_int; +} +#[repr(C)] +pub struct nftnl_table_list(c_void); + +extern "C" { + pub fn nftnl_table_list_alloc() -> *mut nftnl_table_list; + + pub fn nftnl_table_list_free(list: *mut nftnl_table_list); + + pub fn nftnl_table_list_is_empty(list: *const nftnl_table_list) -> c_int; + + pub fn nftnl_table_list_foreach( + table_list: *mut nftnl_table_list, + cb: Option c_int>, + data: *mut c_void, + ) -> c_int; + + pub fn nftnl_table_list_add(r: *mut nftnl_table, list: *mut nftnl_table_list); + + pub fn nftnl_table_list_add_tail(r: *mut nftnl_table, list: *mut nftnl_table_list); + + pub fn nftnl_table_list_del(r: *mut nftnl_table); +} +#[repr(C)] +pub struct nftnl_table_list_iter(c_void); + +extern "C" { + pub fn nftnl_table_list_iter_create(l: *const nftnl_table_list) -> *mut nftnl_table_list_iter; + + pub fn nftnl_table_list_iter_next(iter: *mut nftnl_table_list_iter) -> *mut nftnl_table; + + pub fn nftnl_table_list_iter_destroy(iter: *const nftnl_table_list_iter); +} +pub const NFTNL_TRACE_CHAIN: nftnl_trace_attr = 0; +pub const NFTNL_TRACE_FAMILY: nftnl_trace_attr = 1; +pub const NFTNL_TRACE_ID: nftnl_trace_attr = 2; +pub const NFTNL_TRACE_IIF: nftnl_trace_attr = 3; +pub const NFTNL_TRACE_IIFTYPE: nftnl_trace_attr = 4; +pub const NFTNL_TRACE_JUMP_TARGET: nftnl_trace_attr = 5; +pub const NFTNL_TRACE_OIF: nftnl_trace_attr = 6; +pub const NFTNL_TRACE_OIFTYPE: nftnl_trace_attr = 7; +pub const NFTNL_TRACE_MARK: nftnl_trace_attr = 8; +pub const NFTNL_TRACE_LL_HEADER: nftnl_trace_attr = 9; +pub const NFTNL_TRACE_NETWORK_HEADER: nftnl_trace_attr = 10; +pub const NFTNL_TRACE_TRANSPORT_HEADER: nftnl_trace_attr = 11; +pub const NFTNL_TRACE_TABLE: nftnl_trace_attr = 12; +pub const NFTNL_TRACE_TYPE: nftnl_trace_attr = 13; +pub const NFTNL_TRACE_RULE_HANDLE: nftnl_trace_attr = 14; +pub const NFTNL_TRACE_VERDICT: nftnl_trace_attr = 15; +pub const NFTNL_TRACE_NFPROTO: nftnl_trace_attr = 16; +pub const NFTNL_TRACE_POLICY: nftnl_trace_attr = 17; +pub const __NFTNL_TRACE_MAX: nftnl_trace_attr = 18; +pub type nftnl_trace_attr = c_uint; +#[repr(C)] +pub struct nftnl_trace(c_void); + +extern "C" { + pub fn nftnl_trace_alloc() -> *mut nftnl_trace; + + pub fn nftnl_trace_free(trace: *const nftnl_trace); + + pub fn nftnl_trace_is_set(trace: *const nftnl_trace, type_: u16) -> bool; + + pub fn nftnl_trace_get_data( + trace: *const nftnl_trace, + type_: u16, + data_len: *mut u32, + ) -> *const c_void; + + pub fn nftnl_trace_get_u16(trace: *const nftnl_trace, type_: u16) -> u16; + + pub fn nftnl_trace_get_u32(trace: *const nftnl_trace, type_: u16) -> u32; + + pub fn nftnl_trace_get_u64(trace: *const nftnl_trace, type_: u16) -> u64; + + pub fn nftnl_trace_get_str(trace: *const nftnl_trace, type_: u16) -> *const c_char; + + pub fn nftnl_trace_nlmsg_parse(nlh: *const nlmsghdr, t: *mut nftnl_trace) -> c_int; +} +pub const NFTNL_UDATA_TABLE_COMMENT: nftnl_udata_table_types = 0; +pub const __NFTNL_UDATA_TABLE_MAX: nftnl_udata_table_types = 1; +pub type nftnl_udata_table_types = c_uint; +pub const NFTNL_UDATA_CHAIN_COMMENT: nftnl_udata_chain_types = 0; +pub const __NFTNL_UDATA_CHAIN_MAX: nftnl_udata_chain_types = 1; +pub type nftnl_udata_chain_types = c_uint; +pub const NFTNL_UDATA_RULE_COMMENT: nftnl_udata_rule_types = 0; +pub const NFTNL_UDATA_RULE_EBTABLES_POLICY: nftnl_udata_rule_types = 1; +pub const __NFTNL_UDATA_RULE_MAX: nftnl_udata_rule_types = 2; +pub type nftnl_udata_rule_types = c_uint; +pub const NFTNL_UDATA_OBJ_COMMENT: nftnl_udata_obj_types = 0; +pub const __NFTNL_UDATA_OBJ_MAX: nftnl_udata_obj_types = 1; +pub type nftnl_udata_obj_types = c_uint; +pub const NFTNL_UDATA_SET_KEYBYTEORDER: nftnl_udata_set_types = 0; +pub const NFTNL_UDATA_SET_DATABYTEORDER: nftnl_udata_set_types = 1; +pub const NFTNL_UDATA_SET_MERGE_ELEMENTS: nftnl_udata_set_types = 2; +pub const NFTNL_UDATA_SET_KEY_TYPEOF: nftnl_udata_set_types = 3; +pub const NFTNL_UDATA_SET_DATA_TYPEOF: nftnl_udata_set_types = 4; +pub const NFTNL_UDATA_SET_EXPR: nftnl_udata_set_types = 5; +pub const NFTNL_UDATA_SET_DATA_INTERVAL: nftnl_udata_set_types = 6; +pub const NFTNL_UDATA_SET_COMMENT: nftnl_udata_set_types = 7; +pub const __NFTNL_UDATA_SET_MAX: nftnl_udata_set_types = 8; +pub type nftnl_udata_set_types = c_uint; +pub const NFTNL_UDATA_SET_TYPEOF_EXPR: u32 = 0; +pub const NFTNL_UDATA_SET_TYPEOF_DATA: u32 = 1; +pub const __NFTNL_UDATA_SET_TYPEOF_MAX: u32 = 2; + +pub const NFTNL_UDATA_SET_ELEM_COMMENT: nftnl_udata_set_elem_types = 0; +pub const NFTNL_UDATA_SET_ELEM_FLAGS: nftnl_udata_set_elem_types = 1; +pub const __NFTNL_UDATA_SET_ELEM_MAX: nftnl_udata_set_elem_types = 2; +pub type nftnl_udata_set_elem_types = c_uint; +pub const NFTNL_SET_ELEM_F_INTERVAL_OPEN: nftnl_udata_set_elem_flags = 1; +pub type nftnl_udata_set_elem_flags = c_uint; +#[repr(C)] +pub struct nftnl_udata(c_void); + +#[repr(C)] +pub struct nftnl_udata_buf(c_void); + +extern "C" { + pub fn nftnl_udata_buf_alloc(data_size: u32) -> *mut nftnl_udata_buf; + + pub fn nftnl_udata_buf_free(buf: *const nftnl_udata_buf); + + pub fn nftnl_udata_buf_len(buf: *const nftnl_udata_buf) -> u32; + + pub fn nftnl_udata_buf_data(buf: *const nftnl_udata_buf) -> *mut c_void; + + pub fn nftnl_udata_buf_put(buf: *mut nftnl_udata_buf, data: *const c_void, len: u32); + + pub fn nftnl_udata_start(buf: *const nftnl_udata_buf) -> *mut nftnl_udata; + + pub fn nftnl_udata_end(buf: *const nftnl_udata_buf) -> *mut nftnl_udata; + + pub fn nftnl_udata_put( + buf: *mut nftnl_udata_buf, + type_: u8, + len: u32, + value: *const c_void, + ) -> bool; + + pub fn nftnl_udata_put_u32(buf: *mut nftnl_udata_buf, type_: u8, data: u32) -> bool; + + pub fn nftnl_udata_put_strz(buf: *mut nftnl_udata_buf, type_: u8, strz: *const c_char) -> bool; + + pub fn nftnl_udata_nest_start(buf: *mut nftnl_udata_buf, type_: u8) -> *mut nftnl_udata; + + pub fn nftnl_udata_nest_end(buf: *mut nftnl_udata_buf, ud: *mut nftnl_udata); + + pub fn nftnl_udata_type(attr: *const nftnl_udata) -> u8; + + pub fn nftnl_udata_len(attr: *const nftnl_udata) -> u8; + + pub fn nftnl_udata_get(attr: *const nftnl_udata) -> *mut c_void; + + pub fn nftnl_udata_get_u32(attr: *const nftnl_udata) -> u32; + + pub fn nftnl_udata_next(attr: *const nftnl_udata) -> *mut nftnl_udata; +} +pub type nftnl_udata_cb_t = + Option c_int>; +extern "C" { + pub fn nftnl_udata_parse( + data: *const c_void, + data_len: u32, + cb: nftnl_udata_cb_t, + cb_data: *mut c_void, + ) -> c_int; +} diff --git a/nftnl-sys/src/nftnl_1_2_2.rs b/nftnl-sys/src/nftnl_1_2_2.rs new file mode 100644 index 0000000..c9f128f --- /dev/null +++ b/nftnl-sys/src/nftnl_1_2_2.rs @@ -0,0 +1,1489 @@ +/* automatically generated by rust-bindgen 0.69.4 */ + +use core::option::Option; +use libc::{c_char, c_int, c_uint, c_void, iovec, nlmsghdr, FILE}; + +pub const NFTNL_UDATA_COMMENT_MAXLEN: u32 = 128; +#[repr(C)] +pub struct nftnl_batch(c_void); + +extern "C" { + pub fn nftnl_batch_alloc(pg_size: u32, pg_overrun_size: u32) -> *mut nftnl_batch; + + pub fn nftnl_batch_update(batch: *mut nftnl_batch) -> c_int; + + pub fn nftnl_batch_free(batch: *mut nftnl_batch); + + pub fn nftnl_batch_buffer(batch: *mut nftnl_batch) -> *mut c_void; + + pub fn nftnl_batch_buffer_len(batch: *mut nftnl_batch) -> u32; + + pub fn nftnl_batch_iovec_len(batch: *mut nftnl_batch) -> c_int; + + pub fn nftnl_batch_iovec(batch: *mut nftnl_batch, iov: *mut iovec, iovlen: u32); +} +pub const NFTNL_PARSE_EBADINPUT: u32 = 0; +pub const NFTNL_PARSE_EMISSINGNODE: u32 = 1; +pub const NFTNL_PARSE_EBADTYPE: u32 = 2; +pub const NFTNL_PARSE_EOPNOTSUPP: u32 = 3; + +pub const NFTNL_OUTPUT_DEFAULT: nftnl_output_type = 0; +pub const NFTNL_OUTPUT_XML: nftnl_output_type = 1; +pub const NFTNL_OUTPUT_JSON: nftnl_output_type = 2; +pub type nftnl_output_type = c_uint; +pub const NFTNL_OF_EVENT_NEW: nftnl_output_flags = 1; +pub const NFTNL_OF_EVENT_DEL: nftnl_output_flags = 2; +pub const NFTNL_OF_EVENT_ANY: nftnl_output_flags = 3; +pub type nftnl_output_flags = c_uint; +pub const NFTNL_CMD_UNSPEC: nftnl_cmd_type = 0; +pub const NFTNL_CMD_ADD: nftnl_cmd_type = 1; +pub const NFTNL_CMD_INSERT: nftnl_cmd_type = 2; +pub const NFTNL_CMD_DELETE: nftnl_cmd_type = 3; +pub const NFTNL_CMD_REPLACE: nftnl_cmd_type = 4; +pub const NFTNL_CMD_FLUSH: nftnl_cmd_type = 5; +pub const NFTNL_CMD_MAX: nftnl_cmd_type = 6; +pub type nftnl_cmd_type = c_uint; +pub const NFTNL_PARSE_NONE: nftnl_parse_type = 0; +pub const NFTNL_PARSE_XML: nftnl_parse_type = 1; +pub const NFTNL_PARSE_JSON: nftnl_parse_type = 2; +pub const NFTNL_PARSE_MAX: nftnl_parse_type = 3; +pub type nftnl_parse_type = c_uint; +#[repr(C)] +pub struct nftnl_parse_err(c_void); + +extern "C" { + pub fn nftnl_nlmsg_build_hdr( + buf: *mut c_char, + type_: u16, + family: u16, + flags: u16, + seq: u32, + ) -> *mut nlmsghdr; + + pub fn nftnl_parse_err_alloc() -> *mut nftnl_parse_err; + + pub fn nftnl_parse_err_free(arg1: *mut nftnl_parse_err); + + pub fn nftnl_parse_perror(str_: *const c_char, err: *mut nftnl_parse_err) -> c_int; + + pub fn nftnl_batch_is_supported() -> c_int; + + pub fn nftnl_batch_begin(buf: *mut c_char, seq: u32) -> *mut nlmsghdr; + + pub fn nftnl_batch_end(buf: *mut c_char, seq: u32) -> *mut nlmsghdr; +} +#[repr(C)] +pub struct nftnl_chain(c_void); + +#[repr(C)] +pub struct nftnl_rule(c_void); + +extern "C" { + pub fn nftnl_chain_alloc() -> *mut nftnl_chain; + + pub fn nftnl_chain_free(arg1: *const nftnl_chain); +} +pub const NFTNL_CHAIN_NAME: nftnl_chain_attr = 0; +pub const NFTNL_CHAIN_FAMILY: nftnl_chain_attr = 1; +pub const NFTNL_CHAIN_TABLE: nftnl_chain_attr = 2; +pub const NFTNL_CHAIN_HOOKNUM: nftnl_chain_attr = 3; +pub const NFTNL_CHAIN_PRIO: nftnl_chain_attr = 4; +pub const NFTNL_CHAIN_POLICY: nftnl_chain_attr = 5; +pub const NFTNL_CHAIN_USE: nftnl_chain_attr = 6; +pub const NFTNL_CHAIN_BYTES: nftnl_chain_attr = 7; +pub const NFTNL_CHAIN_PACKETS: nftnl_chain_attr = 8; +pub const NFTNL_CHAIN_HANDLE: nftnl_chain_attr = 9; +pub const NFTNL_CHAIN_TYPE: nftnl_chain_attr = 10; +pub const NFTNL_CHAIN_DEV: nftnl_chain_attr = 11; +pub const NFTNL_CHAIN_DEVICES: nftnl_chain_attr = 12; +pub const NFTNL_CHAIN_FLAGS: nftnl_chain_attr = 13; +pub const NFTNL_CHAIN_ID: nftnl_chain_attr = 14; +pub const NFTNL_CHAIN_USERDATA: nftnl_chain_attr = 15; +pub const __NFTNL_CHAIN_MAX: nftnl_chain_attr = 16; +pub type nftnl_chain_attr = c_uint; +extern "C" { + pub fn nftnl_chain_is_set(c: *const nftnl_chain, attr: u16) -> bool; + + pub fn nftnl_chain_unset(c: *mut nftnl_chain, attr: u16); + + pub fn nftnl_chain_set(t: *mut nftnl_chain, attr: u16, data: *const c_void); + + pub fn nftnl_chain_set_data( + t: *mut nftnl_chain, + attr: u16, + data: *const c_void, + data_len: u32, + ) -> c_int; + + pub fn nftnl_chain_set_u8(t: *mut nftnl_chain, attr: u16, data: u8); + + pub fn nftnl_chain_set_u32(t: *mut nftnl_chain, attr: u16, data: u32); + + pub fn nftnl_chain_set_s32(t: *mut nftnl_chain, attr: u16, data: i32); + + pub fn nftnl_chain_set_u64(t: *mut nftnl_chain, attr: u16, data: u64); + + pub fn nftnl_chain_set_str(t: *mut nftnl_chain, attr: u16, str_: *const c_char) -> c_int; + + pub fn nftnl_chain_set_array(t: *mut nftnl_chain, attr: u16, data: *mut *const c_char) + -> c_int; + + pub fn nftnl_chain_get(c: *const nftnl_chain, attr: u16) -> *const c_void; + + pub fn nftnl_chain_get_data( + c: *const nftnl_chain, + attr: u16, + data_len: *mut u32, + ) -> *const c_void; + + pub fn nftnl_chain_get_str(c: *const nftnl_chain, attr: u16) -> *const c_char; + + pub fn nftnl_chain_get_u8(c: *const nftnl_chain, attr: u16) -> u8; + + pub fn nftnl_chain_get_u32(c: *const nftnl_chain, attr: u16) -> u32; + + pub fn nftnl_chain_get_s32(c: *const nftnl_chain, attr: u16) -> i32; + + pub fn nftnl_chain_get_u64(c: *const nftnl_chain, attr: u16) -> u64; + + pub fn nftnl_chain_get_array(c: *const nftnl_chain, attr: u16) -> *const *const c_char; + + pub fn nftnl_chain_rule_add(rule: *mut nftnl_rule, c: *mut nftnl_chain); + + pub fn nftnl_chain_rule_del(rule: *mut nftnl_rule); + + pub fn nftnl_chain_rule_add_tail(rule: *mut nftnl_rule, c: *mut nftnl_chain); + + pub fn nftnl_chain_rule_insert_at(rule: *mut nftnl_rule, pos: *mut nftnl_rule); + + pub fn nftnl_chain_rule_append_at(rule: *mut nftnl_rule, pos: *mut nftnl_rule); + + pub fn nftnl_chain_nlmsg_build_payload(nlh: *mut nlmsghdr, t: *const nftnl_chain); + + pub fn nftnl_chain_parse( + c: *mut nftnl_chain, + type_: nftnl_parse_type, + data: *const c_char, + err: *mut nftnl_parse_err, + ) -> c_int; + + pub fn nftnl_chain_parse_file( + c: *mut nftnl_chain, + type_: nftnl_parse_type, + fp: *mut FILE, + err: *mut nftnl_parse_err, + ) -> c_int; + + pub fn nftnl_chain_snprintf( + buf: *mut c_char, + size: usize, + t: *const nftnl_chain, + type_: u32, + flags: u32, + ) -> c_int; + + pub fn nftnl_chain_fprintf( + fp: *mut FILE, + c: *const nftnl_chain, + type_: u32, + flags: u32, + ) -> c_int; + + pub fn nftnl_chain_nlmsg_parse(nlh: *const nlmsghdr, t: *mut nftnl_chain) -> c_int; + + pub fn nftnl_rule_foreach( + c: *mut nftnl_chain, + cb: Option c_int>, + data: *mut c_void, + ) -> c_int; + + pub fn nftnl_rule_lookup_byindex(c: *mut nftnl_chain, index: u32) -> *mut nftnl_rule; +} +#[repr(C)] +pub struct nftnl_rule_iter(c_void); + +extern "C" { + pub fn nftnl_rule_iter_create(c: *const nftnl_chain) -> *mut nftnl_rule_iter; + + pub fn nftnl_rule_iter_next(iter: *mut nftnl_rule_iter) -> *mut nftnl_rule; + + pub fn nftnl_rule_iter_destroy(iter: *mut nftnl_rule_iter); +} +#[repr(C)] +pub struct nftnl_chain_list(c_void); + +extern "C" { + pub fn nftnl_chain_list_alloc() -> *mut nftnl_chain_list; + + pub fn nftnl_chain_list_free(list: *mut nftnl_chain_list); + + pub fn nftnl_chain_list_is_empty(list: *const nftnl_chain_list) -> c_int; + + pub fn nftnl_chain_list_foreach( + chain_list: *mut nftnl_chain_list, + cb: Option c_int>, + data: *mut c_void, + ) -> c_int; + + pub fn nftnl_chain_list_lookup_byname( + chain_list: *mut nftnl_chain_list, + chain: *const c_char, + ) -> *mut nftnl_chain; + + pub fn nftnl_chain_list_add(r: *mut nftnl_chain, list: *mut nftnl_chain_list); + + pub fn nftnl_chain_list_add_tail(r: *mut nftnl_chain, list: *mut nftnl_chain_list); + + pub fn nftnl_chain_list_del(c: *mut nftnl_chain); +} +#[repr(C)] +pub struct nftnl_chain_list_iter(c_void); + +extern "C" { + pub fn nftnl_chain_list_iter_create(l: *const nftnl_chain_list) -> *mut nftnl_chain_list_iter; + + pub fn nftnl_chain_list_iter_next(iter: *mut nftnl_chain_list_iter) -> *mut nftnl_chain; + + pub fn nftnl_chain_list_iter_destroy(iter: *mut nftnl_chain_list_iter); +} +#[repr(C)] +pub struct nftnl_expr(c_void); + +pub const NFTNL_EXPR_NAME: u32 = 0; +pub const NFTNL_EXPR_BASE: u32 = 1; + +extern "C" { + pub fn nftnl_expr_alloc(name: *const c_char) -> *mut nftnl_expr; + + pub fn nftnl_expr_free(expr: *const nftnl_expr); + + pub fn nftnl_expr_is_set(expr: *const nftnl_expr, type_: u16) -> bool; + + pub fn nftnl_expr_set( + expr: *mut nftnl_expr, + type_: u16, + data: *const c_void, + data_len: u32, + ) -> c_int; + + pub fn nftnl_expr_set_u8(expr: *mut nftnl_expr, type_: u16, data: u8); + + pub fn nftnl_expr_set_u16(expr: *mut nftnl_expr, type_: u16, data: u16); + + pub fn nftnl_expr_set_u32(expr: *mut nftnl_expr, type_: u16, data: u32); + + pub fn nftnl_expr_set_u64(expr: *mut nftnl_expr, type_: u16, data: u64); + + pub fn nftnl_expr_set_str(expr: *mut nftnl_expr, type_: u16, str_: *const c_char) -> c_int; + + pub fn nftnl_expr_get(expr: *const nftnl_expr, type_: u16, data_len: *mut u32) + -> *const c_void; + + pub fn nftnl_expr_get_u8(expr: *const nftnl_expr, type_: u16) -> u8; + + pub fn nftnl_expr_get_u16(expr: *const nftnl_expr, type_: u16) -> u16; + + pub fn nftnl_expr_get_u32(expr: *const nftnl_expr, type_: u16) -> u32; + + pub fn nftnl_expr_get_u64(expr: *const nftnl_expr, type_: u16) -> u64; + + pub fn nftnl_expr_get_str(expr: *const nftnl_expr, type_: u16) -> *const c_char; + + pub fn nftnl_expr_build_payload(nlh: *mut nlmsghdr, expr: *mut nftnl_expr); + + pub fn nftnl_expr_add_expr(expr: *mut nftnl_expr, type_: u32, e: *mut nftnl_expr); + + pub fn nftnl_expr_expr_foreach( + e: *const nftnl_expr, + cb: Option c_int>, + data: *mut c_void, + ) -> c_int; + + pub fn nftnl_expr_snprintf( + buf: *mut c_char, + buflen: usize, + expr: *const nftnl_expr, + type_: u32, + flags: u32, + ) -> c_int; + + pub fn nftnl_expr_fprintf( + fp: *mut FILE, + expr: *const nftnl_expr, + type_: u32, + flags: u32, + ) -> c_int; +} +pub const NFTNL_EXPR_PAYLOAD_DREG: u32 = 1; +pub const NFTNL_EXPR_PAYLOAD_BASE: u32 = 2; +pub const NFTNL_EXPR_PAYLOAD_OFFSET: u32 = 3; +pub const NFTNL_EXPR_PAYLOAD_LEN: u32 = 4; +pub const NFTNL_EXPR_PAYLOAD_SREG: u32 = 5; +pub const NFTNL_EXPR_PAYLOAD_CSUM_TYPE: u32 = 6; +pub const NFTNL_EXPR_PAYLOAD_CSUM_OFFSET: u32 = 7; +pub const NFTNL_EXPR_PAYLOAD_FLAGS: u32 = 8; + +pub const NFTNL_EXPR_NG_DREG: u32 = 1; +pub const NFTNL_EXPR_NG_MODULUS: u32 = 2; +pub const NFTNL_EXPR_NG_TYPE: u32 = 3; +pub const NFTNL_EXPR_NG_OFFSET: u32 = 4; +pub const NFTNL_EXPR_NG_SET_NAME: u32 = 5; +pub const NFTNL_EXPR_NG_SET_ID: u32 = 6; + +pub const NFTNL_EXPR_META_KEY: u32 = 1; +pub const NFTNL_EXPR_META_DREG: u32 = 2; +pub const NFTNL_EXPR_META_SREG: u32 = 3; + +pub const NFTNL_EXPR_RT_KEY: u32 = 1; +pub const NFTNL_EXPR_RT_DREG: u32 = 2; + +pub const NFTNL_EXPR_SOCKET_KEY: u32 = 1; +pub const NFTNL_EXPR_SOCKET_DREG: u32 = 2; +pub const NFTNL_EXPR_SOCKET_LEVEL: u32 = 3; + +pub const NFTNL_EXPR_TUNNEL_KEY: u32 = 1; +pub const NFTNL_EXPR_TUNNEL_DREG: u32 = 2; + +pub const NFTNL_EXPR_CMP_SREG: u32 = 1; +pub const NFTNL_EXPR_CMP_OP: u32 = 2; +pub const NFTNL_EXPR_CMP_DATA: u32 = 3; + +pub const NFTNL_EXPR_RANGE_SREG: u32 = 1; +pub const NFTNL_EXPR_RANGE_OP: u32 = 2; +pub const NFTNL_EXPR_RANGE_FROM_DATA: u32 = 3; +pub const NFTNL_EXPR_RANGE_TO_DATA: u32 = 4; + +pub const NFTNL_EXPR_IMM_DREG: u32 = 1; +pub const NFTNL_EXPR_IMM_DATA: u32 = 2; +pub const NFTNL_EXPR_IMM_VERDICT: u32 = 3; +pub const NFTNL_EXPR_IMM_CHAIN: u32 = 4; +pub const NFTNL_EXPR_IMM_CHAIN_ID: u32 = 5; + +pub const NFTNL_EXPR_CTR_PACKETS: u32 = 1; +pub const NFTNL_EXPR_CTR_BYTES: u32 = 2; + +pub const NFTNL_EXPR_CONNLIMIT_COUNT: u32 = 1; +pub const NFTNL_EXPR_CONNLIMIT_FLAGS: u32 = 2; + +pub const NFTNL_EXPR_BITWISE_SREG: u32 = 1; +pub const NFTNL_EXPR_BITWISE_DREG: u32 = 2; +pub const NFTNL_EXPR_BITWISE_LEN: u32 = 3; +pub const NFTNL_EXPR_BITWISE_MASK: u32 = 4; +pub const NFTNL_EXPR_BITWISE_XOR: u32 = 5; +pub const NFTNL_EXPR_BITWISE_OP: u32 = 6; +pub const NFTNL_EXPR_BITWISE_DATA: u32 = 7; + +pub const NFTNL_EXPR_TG_NAME: u32 = 1; +pub const NFTNL_EXPR_TG_REV: u32 = 2; +pub const NFTNL_EXPR_TG_INFO: u32 = 3; + +pub const NFTNL_EXPR_MT_NAME: u32 = 1; +pub const NFTNL_EXPR_MT_REV: u32 = 2; +pub const NFTNL_EXPR_MT_INFO: u32 = 3; + +pub const NFTNL_EXPR_NAT_TYPE: u32 = 1; +pub const NFTNL_EXPR_NAT_FAMILY: u32 = 2; +pub const NFTNL_EXPR_NAT_REG_ADDR_MIN: u32 = 3; +pub const NFTNL_EXPR_NAT_REG_ADDR_MAX: u32 = 4; +pub const NFTNL_EXPR_NAT_REG_PROTO_MIN: u32 = 5; +pub const NFTNL_EXPR_NAT_REG_PROTO_MAX: u32 = 6; +pub const NFTNL_EXPR_NAT_FLAGS: u32 = 7; + +pub const NFTNL_EXPR_TPROXY_FAMILY: u32 = 1; +pub const NFTNL_EXPR_TPROXY_REG_ADDR: u32 = 2; +pub const NFTNL_EXPR_TPROXY_REG_PORT: u32 = 3; + +pub const NFTNL_EXPR_LOOKUP_SREG: u32 = 1; +pub const NFTNL_EXPR_LOOKUP_DREG: u32 = 2; +pub const NFTNL_EXPR_LOOKUP_SET: u32 = 3; +pub const NFTNL_EXPR_LOOKUP_SET_ID: u32 = 4; +pub const NFTNL_EXPR_LOOKUP_FLAGS: u32 = 5; + +pub const NFTNL_EXPR_DYNSET_SREG_KEY: u32 = 1; +pub const NFTNL_EXPR_DYNSET_SREG_DATA: u32 = 2; +pub const NFTNL_EXPR_DYNSET_OP: u32 = 3; +pub const NFTNL_EXPR_DYNSET_TIMEOUT: u32 = 4; +pub const NFTNL_EXPR_DYNSET_SET_NAME: u32 = 5; +pub const NFTNL_EXPR_DYNSET_SET_ID: u32 = 6; +pub const NFTNL_EXPR_DYNSET_EXPR: u32 = 7; +pub const NFTNL_EXPR_DYNSET_EXPRESSIONS: u32 = 8; +pub const NFTNL_EXPR_DYNSET_FLAGS: u32 = 9; + +pub const NFTNL_EXPR_LOG_PREFIX: u32 = 1; +pub const NFTNL_EXPR_LOG_GROUP: u32 = 2; +pub const NFTNL_EXPR_LOG_SNAPLEN: u32 = 3; +pub const NFTNL_EXPR_LOG_QTHRESHOLD: u32 = 4; +pub const NFTNL_EXPR_LOG_LEVEL: u32 = 5; +pub const NFTNL_EXPR_LOG_FLAGS: u32 = 6; + +pub const NFTNL_EXPR_EXTHDR_DREG: u32 = 1; +pub const NFTNL_EXPR_EXTHDR_TYPE: u32 = 2; +pub const NFTNL_EXPR_EXTHDR_OFFSET: u32 = 3; +pub const NFTNL_EXPR_EXTHDR_LEN: u32 = 4; +pub const NFTNL_EXPR_EXTHDR_FLAGS: u32 = 5; +pub const NFTNL_EXPR_EXTHDR_OP: u32 = 6; +pub const NFTNL_EXPR_EXTHDR_SREG: u32 = 7; + +pub const NFTNL_EXPR_CT_DREG: u32 = 1; +pub const NFTNL_EXPR_CT_KEY: u32 = 2; +pub const NFTNL_EXPR_CT_DIR: u32 = 3; +pub const NFTNL_EXPR_CT_SREG: u32 = 4; + +pub const NFTNL_EXPR_BYTEORDER_DREG: u32 = 1; +pub const NFTNL_EXPR_BYTEORDER_SREG: u32 = 2; +pub const NFTNL_EXPR_BYTEORDER_OP: u32 = 3; +pub const NFTNL_EXPR_BYTEORDER_LEN: u32 = 4; +pub const NFTNL_EXPR_BYTEORDER_SIZE: u32 = 5; + +pub const NFTNL_EXPR_LIMIT_RATE: u32 = 1; +pub const NFTNL_EXPR_LIMIT_UNIT: u32 = 2; +pub const NFTNL_EXPR_LIMIT_BURST: u32 = 3; +pub const NFTNL_EXPR_LIMIT_TYPE: u32 = 4; +pub const NFTNL_EXPR_LIMIT_FLAGS: u32 = 5; + +pub const NFTNL_EXPR_REJECT_TYPE: u32 = 1; +pub const NFTNL_EXPR_REJECT_CODE: u32 = 2; + +pub const NFTNL_EXPR_QUEUE_NUM: u32 = 1; +pub const NFTNL_EXPR_QUEUE_TOTAL: u32 = 2; +pub const NFTNL_EXPR_QUEUE_FLAGS: u32 = 3; +pub const NFTNL_EXPR_QUEUE_SREG_QNUM: u32 = 4; + +pub const NFTNL_EXPR_QUOTA_BYTES: u32 = 1; +pub const NFTNL_EXPR_QUOTA_FLAGS: u32 = 2; +pub const NFTNL_EXPR_QUOTA_CONSUMED: u32 = 3; + +pub const NFTNL_EXPR_MASQ_FLAGS: u32 = 1; +pub const NFTNL_EXPR_MASQ_REG_PROTO_MIN: u32 = 2; +pub const NFTNL_EXPR_MASQ_REG_PROTO_MAX: u32 = 3; + +pub const NFTNL_EXPR_REDIR_REG_PROTO_MIN: u32 = 1; +pub const NFTNL_EXPR_REDIR_REG_PROTO_MAX: u32 = 2; +pub const NFTNL_EXPR_REDIR_FLAGS: u32 = 3; + +pub const NFTNL_EXPR_DUP_SREG_ADDR: u32 = 1; +pub const NFTNL_EXPR_DUP_SREG_DEV: u32 = 2; + +pub const NFTNL_EXPR_FLOW_TABLE_NAME: u32 = 1; + +pub const NFTNL_EXPR_FWD_SREG_DEV: u32 = 1; +pub const NFTNL_EXPR_FWD_SREG_ADDR: u32 = 2; +pub const NFTNL_EXPR_FWD_NFPROTO: u32 = 3; + +pub const NFTNL_EXPR_HASH_SREG: u32 = 1; +pub const NFTNL_EXPR_HASH_DREG: u32 = 2; +pub const NFTNL_EXPR_HASH_LEN: u32 = 3; +pub const NFTNL_EXPR_HASH_MODULUS: u32 = 4; +pub const NFTNL_EXPR_HASH_SEED: u32 = 5; +pub const NFTNL_EXPR_HASH_OFFSET: u32 = 6; +pub const NFTNL_EXPR_HASH_TYPE: u32 = 7; +pub const NFTNL_EXPR_HASH_SET_NAME: u32 = 8; +pub const NFTNL_EXPR_HASH_SET_ID: u32 = 9; + +pub const NFTNL_EXPR_FIB_DREG: u32 = 1; +pub const NFTNL_EXPR_FIB_RESULT: u32 = 2; +pub const NFTNL_EXPR_FIB_FLAGS: u32 = 3; + +pub const NFTNL_EXPR_OBJREF_IMM_TYPE: u32 = 1; +pub const NFTNL_EXPR_OBJREF_IMM_NAME: u32 = 2; +pub const NFTNL_EXPR_OBJREF_SET_SREG: u32 = 3; +pub const NFTNL_EXPR_OBJREF_SET_NAME: u32 = 4; +pub const NFTNL_EXPR_OBJREF_SET_ID: u32 = 5; + +pub const NFTNL_EXPR_OSF_DREG: u32 = 1; +pub const NFTNL_EXPR_OSF_TTL: u32 = 2; +pub const NFTNL_EXPR_OSF_FLAGS: u32 = 3; + +pub const NFTNL_EXPR_XFRM_DREG: u32 = 1; +pub const NFTNL_EXPR_XFRM_SREG: u32 = 2; +pub const NFTNL_EXPR_XFRM_KEY: u32 = 3; +pub const NFTNL_EXPR_XFRM_DIR: u32 = 4; +pub const NFTNL_EXPR_XFRM_SPNUM: u32 = 5; + +pub const NFTNL_EXPR_SYNPROXY_MSS: u32 = 1; +pub const NFTNL_EXPR_SYNPROXY_WSCALE: u32 = 2; +pub const NFTNL_EXPR_SYNPROXY_FLAGS: u32 = 3; + +pub const NFTNL_EXPR_LAST_MSECS: u32 = 1; +pub const NFTNL_EXPR_LAST_SET: u32 = 2; + +#[repr(C)] +pub struct nftnl_gen(c_void); + +extern "C" { + pub fn nftnl_gen_alloc() -> *mut nftnl_gen; + + pub fn nftnl_gen_free(arg1: *const nftnl_gen); +} +pub const NFTNL_GEN_ID: u32 = 0; +pub const __NFTNL_GEN_MAX: u32 = 1; + +extern "C" { + pub fn nftnl_gen_is_set(gen: *const nftnl_gen, attr: u16) -> bool; + + pub fn nftnl_gen_unset(gen: *mut nftnl_gen, attr: u16); + + pub fn nftnl_gen_set(gen: *mut nftnl_gen, attr: u16, data: *const c_void) -> c_int; + + pub fn nftnl_gen_set_data( + gen: *mut nftnl_gen, + attr: u16, + data: *const c_void, + data_len: u32, + ) -> c_int; + + pub fn nftnl_gen_get(gen: *const nftnl_gen, attr: u16) -> *const c_void; + + pub fn nftnl_gen_get_data( + gen: *const nftnl_gen, + attr: u16, + data_len: *mut u32, + ) -> *const c_void; + + pub fn nftnl_gen_set_u32(gen: *mut nftnl_gen, attr: u16, data: u32); + + pub fn nftnl_gen_get_u32(gen: *const nftnl_gen, attr: u16) -> u32; + + pub fn nftnl_gen_nlmsg_parse(nlh: *const nlmsghdr, gen: *mut nftnl_gen) -> c_int; + + pub fn nftnl_gen_snprintf( + buf: *mut c_char, + size: usize, + gen: *const nftnl_gen, + type_: u32, + flags: u32, + ) -> c_int; + + pub fn nftnl_gen_fprintf(fp: *mut FILE, gen: *const nftnl_gen, type_: u32, flags: u32) + -> c_int; +} +pub const NFTNL_OBJ_TABLE: u32 = 0; +pub const NFTNL_OBJ_NAME: u32 = 1; +pub const NFTNL_OBJ_TYPE: u32 = 2; +pub const NFTNL_OBJ_FAMILY: u32 = 3; +pub const NFTNL_OBJ_USE: u32 = 4; +pub const NFTNL_OBJ_HANDLE: u32 = 5; +pub const NFTNL_OBJ_USERDATA: u32 = 6; +pub const NFTNL_OBJ_BASE: u32 = 16; +pub const __NFTNL_OBJ_MAX: u32 = 17; + +pub const NFTNL_OBJ_CTR_PKTS: u32 = 16; +pub const NFTNL_OBJ_CTR_BYTES: u32 = 17; + +pub const NFTNL_OBJ_QUOTA_BYTES: u32 = 16; +pub const NFTNL_OBJ_QUOTA_CONSUMED: u32 = 17; +pub const NFTNL_OBJ_QUOTA_FLAGS: u32 = 18; + +pub const NFTNL_OBJ_CT_HELPER_NAME: u32 = 16; +pub const NFTNL_OBJ_CT_HELPER_L3PROTO: u32 = 17; +pub const NFTNL_OBJ_CT_HELPER_L4PROTO: u32 = 18; + +pub const NFTNL_CTTIMEOUT_TCP_SYN_SENT: nftnl_cttimeout_array_tcp = 0; +pub const NFTNL_CTTIMEOUT_TCP_SYN_RECV: nftnl_cttimeout_array_tcp = 1; +pub const NFTNL_CTTIMEOUT_TCP_ESTABLISHED: nftnl_cttimeout_array_tcp = 2; +pub const NFTNL_CTTIMEOUT_TCP_FIN_WAIT: nftnl_cttimeout_array_tcp = 3; +pub const NFTNL_CTTIMEOUT_TCP_CLOSE_WAIT: nftnl_cttimeout_array_tcp = 4; +pub const NFTNL_CTTIMEOUT_TCP_LAST_ACK: nftnl_cttimeout_array_tcp = 5; +pub const NFTNL_CTTIMEOUT_TCP_TIME_WAIT: nftnl_cttimeout_array_tcp = 6; +pub const NFTNL_CTTIMEOUT_TCP_CLOSE: nftnl_cttimeout_array_tcp = 7; +pub const NFTNL_CTTIMEOUT_TCP_SYN_SENT2: nftnl_cttimeout_array_tcp = 8; +pub const NFTNL_CTTIMEOUT_TCP_RETRANS: nftnl_cttimeout_array_tcp = 9; +pub const NFTNL_CTTIMEOUT_TCP_UNACK: nftnl_cttimeout_array_tcp = 10; +pub const NFTNL_CTTIMEOUT_TCP_MAX: nftnl_cttimeout_array_tcp = 11; +pub type nftnl_cttimeout_array_tcp = c_uint; +pub const NFTNL_CTTIMEOUT_UDP_UNREPLIED: nftnl_cttimeout_array_udp = 0; +pub const NFTNL_CTTIMEOUT_UDP_REPLIED: nftnl_cttimeout_array_udp = 1; +pub const NFTNL_CTTIMEOUT_UDP_MAX: nftnl_cttimeout_array_udp = 2; +pub type nftnl_cttimeout_array_udp = c_uint; +pub const NFTNL_OBJ_CT_TIMEOUT_L3PROTO: u32 = 16; +pub const NFTNL_OBJ_CT_TIMEOUT_L4PROTO: u32 = 17; +pub const NFTNL_OBJ_CT_TIMEOUT_ARRAY: u32 = 18; + +pub const NFTNL_OBJ_CT_EXPECT_L3PROTO: u32 = 16; +pub const NFTNL_OBJ_CT_EXPECT_L4PROTO: u32 = 17; +pub const NFTNL_OBJ_CT_EXPECT_DPORT: u32 = 18; +pub const NFTNL_OBJ_CT_EXPECT_TIMEOUT: u32 = 19; +pub const NFTNL_OBJ_CT_EXPECT_SIZE: u32 = 20; + +pub const NFTNL_OBJ_LIMIT_RATE: u32 = 16; +pub const NFTNL_OBJ_LIMIT_UNIT: u32 = 17; +pub const NFTNL_OBJ_LIMIT_BURST: u32 = 18; +pub const NFTNL_OBJ_LIMIT_TYPE: u32 = 19; +pub const NFTNL_OBJ_LIMIT_FLAGS: u32 = 20; + +pub const NFTNL_OBJ_SYNPROXY_MSS: u32 = 16; +pub const NFTNL_OBJ_SYNPROXY_WSCALE: u32 = 17; +pub const NFTNL_OBJ_SYNPROXY_FLAGS: u32 = 18; + +pub const NFTNL_OBJ_TUNNEL_ID: u32 = 16; +pub const NFTNL_OBJ_TUNNEL_IPV4_SRC: u32 = 17; +pub const NFTNL_OBJ_TUNNEL_IPV4_DST: u32 = 18; +pub const NFTNL_OBJ_TUNNEL_IPV6_SRC: u32 = 19; +pub const NFTNL_OBJ_TUNNEL_IPV6_DST: u32 = 20; +pub const NFTNL_OBJ_TUNNEL_IPV6_FLOWLABEL: u32 = 21; +pub const NFTNL_OBJ_TUNNEL_SPORT: u32 = 22; +pub const NFTNL_OBJ_TUNNEL_DPORT: u32 = 23; +pub const NFTNL_OBJ_TUNNEL_FLAGS: u32 = 24; +pub const NFTNL_OBJ_TUNNEL_TOS: u32 = 25; +pub const NFTNL_OBJ_TUNNEL_TTL: u32 = 26; +pub const NFTNL_OBJ_TUNNEL_VXLAN_GBP: u32 = 27; +pub const NFTNL_OBJ_TUNNEL_ERSPAN_VERSION: u32 = 28; +pub const NFTNL_OBJ_TUNNEL_ERSPAN_V1_INDEX: u32 = 29; +pub const NFTNL_OBJ_TUNNEL_ERSPAN_V2_HWID: u32 = 30; +pub const NFTNL_OBJ_TUNNEL_ERSPAN_V2_DIR: u32 = 31; + +pub const NFTNL_OBJ_SECMARK_CTX: u32 = 16; + +#[repr(C)] +pub struct nftnl_obj(c_void); + +extern "C" { + pub fn nftnl_obj_alloc() -> *mut nftnl_obj; + + pub fn nftnl_obj_free(ne: *const nftnl_obj); + + pub fn nftnl_obj_is_set(ne: *const nftnl_obj, attr: u16) -> bool; + + pub fn nftnl_obj_unset(ne: *mut nftnl_obj, attr: u16); + + pub fn nftnl_obj_set_data(ne: *mut nftnl_obj, attr: u16, data: *const c_void, data_len: u32); + + pub fn nftnl_obj_set(ne: *mut nftnl_obj, attr: u16, data: *const c_void); + + pub fn nftnl_obj_set_u8(ne: *mut nftnl_obj, attr: u16, val: u8); + + pub fn nftnl_obj_set_u16(ne: *mut nftnl_obj, attr: u16, val: u16); + + pub fn nftnl_obj_set_u32(ne: *mut nftnl_obj, attr: u16, val: u32); + + pub fn nftnl_obj_set_u64(obj: *mut nftnl_obj, attr: u16, val: u64); + + pub fn nftnl_obj_set_str(ne: *mut nftnl_obj, attr: u16, str_: *const c_char); + + pub fn nftnl_obj_get_data(ne: *mut nftnl_obj, attr: u16, data_len: *mut u32) -> *const c_void; + + pub fn nftnl_obj_get(ne: *mut nftnl_obj, attr: u16) -> *const c_void; + + pub fn nftnl_obj_get_u8(ne: *mut nftnl_obj, attr: u16) -> u8; + + pub fn nftnl_obj_get_u16(obj: *mut nftnl_obj, attr: u16) -> u16; + + pub fn nftnl_obj_get_u32(ne: *mut nftnl_obj, attr: u16) -> u32; + + pub fn nftnl_obj_get_u64(obj: *mut nftnl_obj, attr: u16) -> u64; + + pub fn nftnl_obj_get_str(ne: *mut nftnl_obj, attr: u16) -> *const c_char; + + pub fn nftnl_obj_nlmsg_build_payload(nlh: *mut nlmsghdr, ne: *const nftnl_obj); + + pub fn nftnl_obj_nlmsg_parse(nlh: *const nlmsghdr, ne: *mut nftnl_obj) -> c_int; + + pub fn nftnl_obj_parse( + ne: *mut nftnl_obj, + type_: nftnl_parse_type, + data: *const c_char, + err: *mut nftnl_parse_err, + ) -> c_int; + + pub fn nftnl_obj_parse_file( + ne: *mut nftnl_obj, + type_: nftnl_parse_type, + fp: *mut FILE, + err: *mut nftnl_parse_err, + ) -> c_int; + + pub fn nftnl_obj_snprintf( + buf: *mut c_char, + size: usize, + ne: *const nftnl_obj, + type_: u32, + flags: u32, + ) -> c_int; + + pub fn nftnl_obj_fprintf(fp: *mut FILE, ne: *const nftnl_obj, type_: u32, flags: u32) -> c_int; +} +#[repr(C)] +pub struct nftnl_obj_list(c_void); + +extern "C" { + pub fn nftnl_obj_list_alloc() -> *mut nftnl_obj_list; + + pub fn nftnl_obj_list_free(list: *mut nftnl_obj_list); + + pub fn nftnl_obj_list_is_empty(list: *mut nftnl_obj_list) -> c_int; + + pub fn nftnl_obj_list_add(r: *mut nftnl_obj, list: *mut nftnl_obj_list); + + pub fn nftnl_obj_list_add_tail(r: *mut nftnl_obj, list: *mut nftnl_obj_list); + + pub fn nftnl_obj_list_del(t: *mut nftnl_obj); + + pub fn nftnl_obj_list_foreach( + table_list: *mut nftnl_obj_list, + cb: Option c_int>, + data: *mut c_void, + ) -> c_int; +} +#[repr(C)] +pub struct nftnl_obj_list_iter(c_void); + +extern "C" { + pub fn nftnl_obj_list_iter_create(l: *mut nftnl_obj_list) -> *mut nftnl_obj_list_iter; + + pub fn nftnl_obj_list_iter_next(iter: *mut nftnl_obj_list_iter) -> *mut nftnl_obj; + + pub fn nftnl_obj_list_iter_destroy(iter: *mut nftnl_obj_list_iter); + + pub fn nftnl_rule_alloc() -> *mut nftnl_rule; + + pub fn nftnl_rule_free(arg1: *const nftnl_rule); +} +pub const NFTNL_RULE_FAMILY: nftnl_rule_attr = 0; +pub const NFTNL_RULE_TABLE: nftnl_rule_attr = 1; +pub const NFTNL_RULE_CHAIN: nftnl_rule_attr = 2; +pub const NFTNL_RULE_HANDLE: nftnl_rule_attr = 3; +pub const NFTNL_RULE_COMPAT_PROTO: nftnl_rule_attr = 4; +pub const NFTNL_RULE_COMPAT_FLAGS: nftnl_rule_attr = 5; +pub const NFTNL_RULE_POSITION: nftnl_rule_attr = 6; +pub const NFTNL_RULE_USERDATA: nftnl_rule_attr = 7; +pub const NFTNL_RULE_ID: nftnl_rule_attr = 8; +pub const NFTNL_RULE_POSITION_ID: nftnl_rule_attr = 9; +pub const __NFTNL_RULE_MAX: nftnl_rule_attr = 10; +pub type nftnl_rule_attr = c_uint; +extern "C" { + pub fn nftnl_rule_unset(r: *mut nftnl_rule, attr: u16); + + pub fn nftnl_rule_is_set(r: *const nftnl_rule, attr: u16) -> bool; + + pub fn nftnl_rule_set(r: *mut nftnl_rule, attr: u16, data: *const c_void) -> c_int; + + pub fn nftnl_rule_set_data( + r: *mut nftnl_rule, + attr: u16, + data: *const c_void, + data_len: u32, + ) -> c_int; + + pub fn nftnl_rule_set_u32(r: *mut nftnl_rule, attr: u16, val: u32); + + pub fn nftnl_rule_set_u64(r: *mut nftnl_rule, attr: u16, val: u64); + + pub fn nftnl_rule_set_str(r: *mut nftnl_rule, attr: u16, str_: *const c_char) -> c_int; + + pub fn nftnl_rule_get(r: *const nftnl_rule, attr: u16) -> *const c_void; + + pub fn nftnl_rule_get_data( + r: *const nftnl_rule, + attr: u16, + data_len: *mut u32, + ) -> *const c_void; + + pub fn nftnl_rule_get_str(r: *const nftnl_rule, attr: u16) -> *const c_char; + + pub fn nftnl_rule_get_u8(r: *const nftnl_rule, attr: u16) -> u8; + + pub fn nftnl_rule_get_u32(r: *const nftnl_rule, attr: u16) -> u32; + + pub fn nftnl_rule_get_u64(r: *const nftnl_rule, attr: u16) -> u64; + + pub fn nftnl_rule_add_expr(r: *mut nftnl_rule, expr: *mut nftnl_expr); + + pub fn nftnl_rule_del_expr(expr: *mut nftnl_expr); + + pub fn nftnl_rule_nlmsg_build_payload(nlh: *mut nlmsghdr, t: *mut nftnl_rule); + + pub fn nftnl_rule_parse( + r: *mut nftnl_rule, + type_: nftnl_parse_type, + data: *const c_char, + err: *mut nftnl_parse_err, + ) -> c_int; + + pub fn nftnl_rule_parse_file( + r: *mut nftnl_rule, + type_: nftnl_parse_type, + fp: *mut FILE, + err: *mut nftnl_parse_err, + ) -> c_int; + + pub fn nftnl_rule_snprintf( + buf: *mut c_char, + size: usize, + t: *const nftnl_rule, + type_: u32, + flags: u32, + ) -> c_int; + + pub fn nftnl_rule_fprintf(fp: *mut FILE, r: *const nftnl_rule, type_: u32, flags: u32) + -> c_int; + + pub fn nftnl_rule_nlmsg_parse(nlh: *const nlmsghdr, t: *mut nftnl_rule) -> c_int; + + pub fn nftnl_expr_foreach( + r: *mut nftnl_rule, + cb: Option c_int>, + data: *mut c_void, + ) -> c_int; +} +#[repr(C)] +pub struct nftnl_expr_iter(c_void); + +extern "C" { + pub fn nftnl_expr_iter_create(r: *const nftnl_rule) -> *mut nftnl_expr_iter; + + pub fn nftnl_expr_iter_next(iter: *mut nftnl_expr_iter) -> *mut nftnl_expr; + + pub fn nftnl_expr_iter_destroy(iter: *mut nftnl_expr_iter); +} +#[repr(C)] +pub struct nftnl_rule_list(c_void); + +extern "C" { + pub fn nftnl_rule_list_alloc() -> *mut nftnl_rule_list; + + pub fn nftnl_rule_list_free(list: *mut nftnl_rule_list); + + pub fn nftnl_rule_list_is_empty(list: *const nftnl_rule_list) -> c_int; + + pub fn nftnl_rule_list_add(r: *mut nftnl_rule, list: *mut nftnl_rule_list); + + pub fn nftnl_rule_list_add_tail(r: *mut nftnl_rule, list: *mut nftnl_rule_list); + + pub fn nftnl_rule_list_insert_at(r: *mut nftnl_rule, pos: *mut nftnl_rule); + + pub fn nftnl_rule_list_del(r: *mut nftnl_rule); + + pub fn nftnl_rule_list_foreach( + rule_list: *mut nftnl_rule_list, + cb: Option c_int>, + data: *mut c_void, + ) -> c_int; +} +#[repr(C)] +pub struct nftnl_rule_list_iter(c_void); + +extern "C" { + pub fn nftnl_rule_list_iter_create(l: *const nftnl_rule_list) -> *mut nftnl_rule_list_iter; + + pub fn nftnl_rule_list_iter_cur(iter: *mut nftnl_rule_list_iter) -> *mut nftnl_rule; + + pub fn nftnl_rule_list_iter_next(iter: *mut nftnl_rule_list_iter) -> *mut nftnl_rule; + + pub fn nftnl_rule_list_iter_destroy(iter: *const nftnl_rule_list_iter); +} +#[repr(C)] +pub struct nftnl_ruleset(c_void); + +extern "C" { + pub fn nftnl_ruleset_alloc() -> *mut nftnl_ruleset; + + pub fn nftnl_ruleset_free(r: *const nftnl_ruleset); +} +pub const NFTNL_RULESET_TABLELIST: u32 = 0; +pub const NFTNL_RULESET_CHAINLIST: u32 = 1; +pub const NFTNL_RULESET_SETLIST: u32 = 2; +pub const NFTNL_RULESET_RULELIST: u32 = 3; + +pub const NFTNL_RULESET_UNSPEC: nftnl_ruleset_type = 0; +pub const NFTNL_RULESET_RULESET: nftnl_ruleset_type = 1; +pub const NFTNL_RULESET_TABLE: nftnl_ruleset_type = 2; +pub const NFTNL_RULESET_CHAIN: nftnl_ruleset_type = 3; +pub const NFTNL_RULESET_RULE: nftnl_ruleset_type = 4; +pub const NFTNL_RULESET_SET: nftnl_ruleset_type = 5; +pub const NFTNL_RULESET_SET_ELEMS: nftnl_ruleset_type = 6; +pub type nftnl_ruleset_type = c_uint; +extern "C" { + pub fn nftnl_ruleset_is_set(r: *const nftnl_ruleset, attr: u16) -> bool; + + pub fn nftnl_ruleset_unset(r: *mut nftnl_ruleset, attr: u16); + + pub fn nftnl_ruleset_set(r: *mut nftnl_ruleset, attr: u16, data: *mut c_void); + + pub fn nftnl_ruleset_get(r: *const nftnl_ruleset, attr: u16) -> *mut c_void; +} +pub const NFTNL_RULESET_CTX_CMD: u32 = 0; +pub const NFTNL_RULESET_CTX_TYPE: u32 = 1; +pub const NFTNL_RULESET_CTX_TABLE: u32 = 2; +pub const NFTNL_RULESET_CTX_CHAIN: u32 = 3; +pub const NFTNL_RULESET_CTX_RULE: u32 = 4; +pub const NFTNL_RULESET_CTX_SET: u32 = 5; +pub const NFTNL_RULESET_CTX_DATA: u32 = 6; + +#[repr(C)] +pub struct nftnl_parse_ctx(c_void); + +extern "C" { + pub fn nftnl_ruleset_ctx_free(ctx: *const nftnl_parse_ctx); + + pub fn nftnl_ruleset_ctx_is_set(ctx: *const nftnl_parse_ctx, attr: u16) -> bool; + + pub fn nftnl_ruleset_ctx_get(ctx: *const nftnl_parse_ctx, attr: u16) -> *mut c_void; + + pub fn nftnl_ruleset_ctx_get_u32(ctx: *const nftnl_parse_ctx, attr: u16) -> u32; + + pub fn nftnl_ruleset_parse_file_cb( + type_: nftnl_parse_type, + fp: *mut FILE, + err: *mut nftnl_parse_err, + data: *mut c_void, + cb: Option c_int>, + ) -> c_int; + + pub fn nftnl_ruleset_parse_buffer_cb( + type_: nftnl_parse_type, + buffer: *const c_char, + err: *mut nftnl_parse_err, + data: *mut c_void, + cb: Option c_int>, + ) -> c_int; + + pub fn nftnl_ruleset_parse( + rs: *mut nftnl_ruleset, + type_: nftnl_parse_type, + data: *const c_char, + err: *mut nftnl_parse_err, + ) -> c_int; + + pub fn nftnl_ruleset_parse_file( + rs: *mut nftnl_ruleset, + type_: nftnl_parse_type, + fp: *mut FILE, + err: *mut nftnl_parse_err, + ) -> c_int; + + pub fn nftnl_ruleset_snprintf( + buf: *mut c_char, + size: usize, + rs: *const nftnl_ruleset, + type_: u32, + flags: u32, + ) -> c_int; + + pub fn nftnl_ruleset_fprintf( + fp: *mut FILE, + rs: *const nftnl_ruleset, + type_: u32, + flags: u32, + ) -> c_int; +} +pub const NFTNL_SET_TABLE: nftnl_set_attr = 0; +pub const NFTNL_SET_NAME: nftnl_set_attr = 1; +pub const NFTNL_SET_FLAGS: nftnl_set_attr = 2; +pub const NFTNL_SET_KEY_TYPE: nftnl_set_attr = 3; +pub const NFTNL_SET_KEY_LEN: nftnl_set_attr = 4; +pub const NFTNL_SET_DATA_TYPE: nftnl_set_attr = 5; +pub const NFTNL_SET_DATA_LEN: nftnl_set_attr = 6; +pub const NFTNL_SET_FAMILY: nftnl_set_attr = 7; +pub const NFTNL_SET_ID: nftnl_set_attr = 8; +pub const NFTNL_SET_POLICY: nftnl_set_attr = 9; +pub const NFTNL_SET_DESC_SIZE: nftnl_set_attr = 10; +pub const NFTNL_SET_TIMEOUT: nftnl_set_attr = 11; +pub const NFTNL_SET_GC_INTERVAL: nftnl_set_attr = 12; +pub const NFTNL_SET_USERDATA: nftnl_set_attr = 13; +pub const NFTNL_SET_OBJ_TYPE: nftnl_set_attr = 14; +pub const NFTNL_SET_HANDLE: nftnl_set_attr = 15; +pub const NFTNL_SET_DESC_CONCAT: nftnl_set_attr = 16; +pub const NFTNL_SET_EXPR: nftnl_set_attr = 17; +pub const NFTNL_SET_EXPRESSIONS: nftnl_set_attr = 18; +pub const __NFTNL_SET_MAX: nftnl_set_attr = 19; +pub type nftnl_set_attr = c_uint; +#[repr(C)] +pub struct nftnl_set(c_void); + +extern "C" { + pub fn nftnl_set_alloc() -> *mut nftnl_set; + + pub fn nftnl_set_free(s: *const nftnl_set); + + pub fn nftnl_set_clone(set: *const nftnl_set) -> *mut nftnl_set; + + pub fn nftnl_set_is_set(s: *const nftnl_set, attr: u16) -> bool; + + pub fn nftnl_set_unset(s: *mut nftnl_set, attr: u16); + + pub fn nftnl_set_set(s: *mut nftnl_set, attr: u16, data: *const c_void) -> c_int; + + pub fn nftnl_set_set_data( + s: *mut nftnl_set, + attr: u16, + data: *const c_void, + data_len: u32, + ) -> c_int; + + pub fn nftnl_set_set_u32(s: *mut nftnl_set, attr: u16, val: u32); + + pub fn nftnl_set_set_u64(s: *mut nftnl_set, attr: u16, val: u64); + + pub fn nftnl_set_set_str(s: *mut nftnl_set, attr: u16, str_: *const c_char) -> c_int; + + pub fn nftnl_set_get(s: *const nftnl_set, attr: u16) -> *const c_void; + + pub fn nftnl_set_get_data(s: *const nftnl_set, attr: u16, data_len: *mut u32) -> *const c_void; + + pub fn nftnl_set_get_str(s: *const nftnl_set, attr: u16) -> *const c_char; + + pub fn nftnl_set_get_u32(s: *const nftnl_set, attr: u16) -> u32; + + pub fn nftnl_set_get_u64(s: *const nftnl_set, attr: u16) -> u64; + + pub fn nftnl_set_nlmsg_build_payload(nlh: *mut nlmsghdr, s: *mut nftnl_set); + + pub fn nftnl_set_nlmsg_parse(nlh: *const nlmsghdr, s: *mut nftnl_set) -> c_int; + + pub fn nftnl_set_elems_nlmsg_parse(nlh: *const nlmsghdr, s: *mut nftnl_set) -> c_int; + + pub fn nftnl_set_snprintf( + buf: *mut c_char, + size: usize, + s: *const nftnl_set, + type_: u32, + flags: u32, + ) -> c_int; + + pub fn nftnl_set_fprintf(fp: *mut FILE, s: *const nftnl_set, type_: u32, flags: u32) -> c_int; +} +#[repr(C)] +pub struct nftnl_set_list(c_void); + +extern "C" { + pub fn nftnl_set_list_alloc() -> *mut nftnl_set_list; + + pub fn nftnl_set_list_free(list: *mut nftnl_set_list); + + pub fn nftnl_set_list_is_empty(list: *const nftnl_set_list) -> c_int; + + pub fn nftnl_set_list_add(s: *mut nftnl_set, list: *mut nftnl_set_list); + + pub fn nftnl_set_list_add_tail(s: *mut nftnl_set, list: *mut nftnl_set_list); + + pub fn nftnl_set_list_del(s: *mut nftnl_set); + + pub fn nftnl_set_list_foreach( + set_list: *mut nftnl_set_list, + cb: Option c_int>, + data: *mut c_void, + ) -> c_int; + + pub fn nftnl_set_list_lookup_byname( + set_list: *mut nftnl_set_list, + set: *const c_char, + ) -> *mut nftnl_set; + + pub fn nftnl_set_add_expr(s: *mut nftnl_set, expr: *mut nftnl_expr); + + pub fn nftnl_set_expr_foreach( + s: *const nftnl_set, + cb: Option c_int>, + data: *mut c_void, + ) -> c_int; +} +#[repr(C)] +pub struct nftnl_set_list_iter(c_void); + +extern "C" { + pub fn nftnl_set_list_iter_create(l: *const nftnl_set_list) -> *mut nftnl_set_list_iter; + + pub fn nftnl_set_list_iter_cur(iter: *const nftnl_set_list_iter) -> *mut nftnl_set; + + pub fn nftnl_set_list_iter_next(iter: *mut nftnl_set_list_iter) -> *mut nftnl_set; + + pub fn nftnl_set_list_iter_destroy(iter: *const nftnl_set_list_iter); + + pub fn nftnl_set_parse( + s: *mut nftnl_set, + type_: nftnl_parse_type, + data: *const c_char, + err: *mut nftnl_parse_err, + ) -> c_int; + + pub fn nftnl_set_parse_file( + s: *mut nftnl_set, + type_: nftnl_parse_type, + fp: *mut FILE, + err: *mut nftnl_parse_err, + ) -> c_int; +} +pub const NFTNL_SET_ELEM_FLAGS: u32 = 0; +pub const NFTNL_SET_ELEM_KEY: u32 = 1; +pub const NFTNL_SET_ELEM_VERDICT: u32 = 2; +pub const NFTNL_SET_ELEM_CHAIN: u32 = 3; +pub const NFTNL_SET_ELEM_DATA: u32 = 4; +pub const NFTNL_SET_ELEM_TIMEOUT: u32 = 5; +pub const NFTNL_SET_ELEM_EXPIRATION: u32 = 6; +pub const NFTNL_SET_ELEM_USERDATA: u32 = 7; +pub const NFTNL_SET_ELEM_EXPR: u32 = 8; +pub const NFTNL_SET_ELEM_OBJREF: u32 = 9; +pub const NFTNL_SET_ELEM_KEY_END: u32 = 10; +pub const NFTNL_SET_ELEM_EXPRESSIONS: u32 = 11; +pub const __NFTNL_SET_ELEM_MAX: u32 = 12; + +#[repr(C)] +pub struct nftnl_set_elem(c_void); + +extern "C" { + pub fn nftnl_set_elem_alloc() -> *mut nftnl_set_elem; + + pub fn nftnl_set_elem_free(s: *mut nftnl_set_elem); + + pub fn nftnl_set_elem_clone(elem: *mut nftnl_set_elem) -> *mut nftnl_set_elem; + + pub fn nftnl_set_elem_add(s: *mut nftnl_set, elem: *mut nftnl_set_elem); + + pub fn nftnl_set_elem_unset(s: *mut nftnl_set_elem, attr: u16); + + pub fn nftnl_set_elem_set( + s: *mut nftnl_set_elem, + attr: u16, + data: *const c_void, + data_len: u32, + ) -> c_int; + + pub fn nftnl_set_elem_set_u32(s: *mut nftnl_set_elem, attr: u16, val: u32); + + pub fn nftnl_set_elem_set_u64(s: *mut nftnl_set_elem, attr: u16, val: u64); + + pub fn nftnl_set_elem_set_str(s: *mut nftnl_set_elem, attr: u16, str_: *const c_char) -> c_int; + + pub fn nftnl_set_elem_get( + s: *mut nftnl_set_elem, + attr: u16, + data_len: *mut u32, + ) -> *const c_void; + + pub fn nftnl_set_elem_get_str(s: *mut nftnl_set_elem, attr: u16) -> *const c_char; + + pub fn nftnl_set_elem_get_u32(s: *mut nftnl_set_elem, attr: u16) -> u32; + + pub fn nftnl_set_elem_get_u64(s: *mut nftnl_set_elem, attr: u16) -> u64; + + pub fn nftnl_set_elem_is_set(s: *const nftnl_set_elem, attr: u16) -> bool; + + pub fn nftnl_set_elems_nlmsg_build_payload(nlh: *mut nlmsghdr, s: *mut nftnl_set); + + pub fn nftnl_set_elem_nlmsg_build_payload(nlh: *mut nlmsghdr, e: *mut nftnl_set_elem); +} +#[repr(C)] +pub struct nlattr(c_void); + +extern "C" { + pub fn nftnl_set_elem_nlmsg_build( + nlh: *mut nlmsghdr, + elem: *mut nftnl_set_elem, + i: c_int, + ) -> *mut nlattr; + + pub fn nftnl_set_elem_parse( + e: *mut nftnl_set_elem, + type_: nftnl_parse_type, + data: *const c_char, + err: *mut nftnl_parse_err, + ) -> c_int; + + pub fn nftnl_set_elem_parse_file( + e: *mut nftnl_set_elem, + type_: nftnl_parse_type, + fp: *mut FILE, + err: *mut nftnl_parse_err, + ) -> c_int; + + pub fn nftnl_set_elem_snprintf( + buf: *mut c_char, + size: usize, + s: *const nftnl_set_elem, + type_: u32, + flags: u32, + ) -> c_int; + + pub fn nftnl_set_elem_fprintf( + fp: *mut FILE, + se: *const nftnl_set_elem, + type_: u32, + flags: u32, + ) -> c_int; + + pub fn nftnl_set_elem_add_expr(e: *mut nftnl_set_elem, expr: *mut nftnl_expr); + + pub fn nftnl_set_elem_expr_foreach( + e: *mut nftnl_set_elem, + cb: Option c_int>, + data: *mut c_void, + ) -> c_int; + + pub fn nftnl_set_elem_foreach( + s: *mut nftnl_set, + cb: Option c_int>, + data: *mut c_void, + ) -> c_int; +} +#[repr(C)] +pub struct nftnl_set_elems_iter(c_void); + +extern "C" { + pub fn nftnl_set_elems_iter_create(s: *const nftnl_set) -> *mut nftnl_set_elems_iter; + + pub fn nftnl_set_elems_iter_cur(iter: *const nftnl_set_elems_iter) -> *mut nftnl_set_elem; + + pub fn nftnl_set_elems_iter_next(iter: *mut nftnl_set_elems_iter) -> *mut nftnl_set_elem; + + pub fn nftnl_set_elems_iter_destroy(iter: *mut nftnl_set_elems_iter); + + pub fn nftnl_set_elems_nlmsg_build_payload_iter( + nlh: *mut nlmsghdr, + iter: *mut nftnl_set_elems_iter, + ) -> c_int; +} +#[repr(C)] +pub struct nftnl_table(c_void); + +extern "C" { + pub fn nftnl_table_alloc() -> *mut nftnl_table; + + pub fn nftnl_table_free(arg1: *const nftnl_table); +} +pub const NFTNL_TABLE_NAME: nftnl_table_attr = 0; +pub const NFTNL_TABLE_FAMILY: nftnl_table_attr = 1; +pub const NFTNL_TABLE_FLAGS: nftnl_table_attr = 2; +pub const NFTNL_TABLE_USE: nftnl_table_attr = 3; +pub const NFTNL_TABLE_HANDLE: nftnl_table_attr = 4; +pub const NFTNL_TABLE_USERDATA: nftnl_table_attr = 5; +pub const NFTNL_TABLE_OWNER: nftnl_table_attr = 6; +pub const __NFTNL_TABLE_MAX: nftnl_table_attr = 7; +pub type nftnl_table_attr = c_uint; +extern "C" { + pub fn nftnl_table_is_set(t: *const nftnl_table, attr: u16) -> bool; + + pub fn nftnl_table_unset(t: *mut nftnl_table, attr: u16); + + pub fn nftnl_table_set(t: *mut nftnl_table, attr: u16, data: *const c_void); + + pub fn nftnl_table_set_data( + t: *mut nftnl_table, + attr: u16, + data: *const c_void, + data_len: u32, + ) -> c_int; + + pub fn nftnl_table_get(t: *const nftnl_table, attr: u16) -> *const c_void; + + pub fn nftnl_table_get_data( + t: *const nftnl_table, + attr: u16, + data_len: *mut u32, + ) -> *const c_void; + + pub fn nftnl_table_set_u8(t: *mut nftnl_table, attr: u16, data: u8); + + pub fn nftnl_table_set_u32(t: *mut nftnl_table, attr: u16, data: u32); + + pub fn nftnl_table_set_u64(t: *mut nftnl_table, attr: u16, data: u64); + + pub fn nftnl_table_set_str(t: *mut nftnl_table, attr: u16, str_: *const c_char) -> c_int; + + pub fn nftnl_table_get_u8(t: *const nftnl_table, attr: u16) -> u8; + + pub fn nftnl_table_get_u32(t: *const nftnl_table, attr: u16) -> u32; + + pub fn nftnl_table_get_u64(t: *const nftnl_table, attr: u16) -> u64; + + pub fn nftnl_table_get_str(t: *const nftnl_table, attr: u16) -> *const c_char; + + pub fn nftnl_table_nlmsg_build_payload(nlh: *mut nlmsghdr, t: *const nftnl_table); + + pub fn nftnl_table_parse( + t: *mut nftnl_table, + type_: nftnl_parse_type, + data: *const c_char, + err: *mut nftnl_parse_err, + ) -> c_int; + + pub fn nftnl_table_parse_file( + t: *mut nftnl_table, + type_: nftnl_parse_type, + fp: *mut FILE, + err: *mut nftnl_parse_err, + ) -> c_int; + + pub fn nftnl_table_snprintf( + buf: *mut c_char, + size: usize, + t: *const nftnl_table, + type_: u32, + flags: u32, + ) -> c_int; + + pub fn nftnl_table_fprintf( + fp: *mut FILE, + t: *const nftnl_table, + type_: u32, + flags: u32, + ) -> c_int; + + pub fn nftnl_table_nlmsg_parse(nlh: *const nlmsghdr, t: *mut nftnl_table) -> c_int; +} +#[repr(C)] +pub struct nftnl_table_list(c_void); + +extern "C" { + pub fn nftnl_table_list_alloc() -> *mut nftnl_table_list; + + pub fn nftnl_table_list_free(list: *mut nftnl_table_list); + + pub fn nftnl_table_list_is_empty(list: *const nftnl_table_list) -> c_int; + + pub fn nftnl_table_list_foreach( + table_list: *mut nftnl_table_list, + cb: Option c_int>, + data: *mut c_void, + ) -> c_int; + + pub fn nftnl_table_list_add(r: *mut nftnl_table, list: *mut nftnl_table_list); + + pub fn nftnl_table_list_add_tail(r: *mut nftnl_table, list: *mut nftnl_table_list); + + pub fn nftnl_table_list_del(r: *mut nftnl_table); +} +#[repr(C)] +pub struct nftnl_table_list_iter(c_void); + +extern "C" { + pub fn nftnl_table_list_iter_create(l: *const nftnl_table_list) -> *mut nftnl_table_list_iter; + + pub fn nftnl_table_list_iter_next(iter: *mut nftnl_table_list_iter) -> *mut nftnl_table; + + pub fn nftnl_table_list_iter_destroy(iter: *const nftnl_table_list_iter); +} +pub const NFTNL_TRACE_CHAIN: nftnl_trace_attr = 0; +pub const NFTNL_TRACE_FAMILY: nftnl_trace_attr = 1; +pub const NFTNL_TRACE_ID: nftnl_trace_attr = 2; +pub const NFTNL_TRACE_IIF: nftnl_trace_attr = 3; +pub const NFTNL_TRACE_IIFTYPE: nftnl_trace_attr = 4; +pub const NFTNL_TRACE_JUMP_TARGET: nftnl_trace_attr = 5; +pub const NFTNL_TRACE_OIF: nftnl_trace_attr = 6; +pub const NFTNL_TRACE_OIFTYPE: nftnl_trace_attr = 7; +pub const NFTNL_TRACE_MARK: nftnl_trace_attr = 8; +pub const NFTNL_TRACE_LL_HEADER: nftnl_trace_attr = 9; +pub const NFTNL_TRACE_NETWORK_HEADER: nftnl_trace_attr = 10; +pub const NFTNL_TRACE_TRANSPORT_HEADER: nftnl_trace_attr = 11; +pub const NFTNL_TRACE_TABLE: nftnl_trace_attr = 12; +pub const NFTNL_TRACE_TYPE: nftnl_trace_attr = 13; +pub const NFTNL_TRACE_RULE_HANDLE: nftnl_trace_attr = 14; +pub const NFTNL_TRACE_VERDICT: nftnl_trace_attr = 15; +pub const NFTNL_TRACE_NFPROTO: nftnl_trace_attr = 16; +pub const NFTNL_TRACE_POLICY: nftnl_trace_attr = 17; +pub const __NFTNL_TRACE_MAX: nftnl_trace_attr = 18; +pub type nftnl_trace_attr = c_uint; +#[repr(C)] +pub struct nftnl_trace(c_void); + +extern "C" { + pub fn nftnl_trace_alloc() -> *mut nftnl_trace; + + pub fn nftnl_trace_free(trace: *const nftnl_trace); + + pub fn nftnl_trace_is_set(trace: *const nftnl_trace, type_: u16) -> bool; + + pub fn nftnl_trace_get_data( + trace: *const nftnl_trace, + type_: u16, + data_len: *mut u32, + ) -> *const c_void; + + pub fn nftnl_trace_get_u16(trace: *const nftnl_trace, type_: u16) -> u16; + + pub fn nftnl_trace_get_u32(trace: *const nftnl_trace, type_: u16) -> u32; + + pub fn nftnl_trace_get_u64(trace: *const nftnl_trace, type_: u16) -> u64; + + pub fn nftnl_trace_get_str(trace: *const nftnl_trace, type_: u16) -> *const c_char; + + pub fn nftnl_trace_nlmsg_parse(nlh: *const nlmsghdr, t: *mut nftnl_trace) -> c_int; +} +pub const NFTNL_UDATA_TABLE_COMMENT: nftnl_udata_table_types = 0; +pub const __NFTNL_UDATA_TABLE_MAX: nftnl_udata_table_types = 1; +pub type nftnl_udata_table_types = c_uint; +pub const NFTNL_UDATA_CHAIN_COMMENT: nftnl_udata_chain_types = 0; +pub const __NFTNL_UDATA_CHAIN_MAX: nftnl_udata_chain_types = 1; +pub type nftnl_udata_chain_types = c_uint; +pub const NFTNL_UDATA_RULE_COMMENT: nftnl_udata_rule_types = 0; +pub const NFTNL_UDATA_RULE_EBTABLES_POLICY: nftnl_udata_rule_types = 1; +pub const __NFTNL_UDATA_RULE_MAX: nftnl_udata_rule_types = 2; +pub type nftnl_udata_rule_types = c_uint; +pub const NFTNL_UDATA_OBJ_COMMENT: nftnl_udata_obj_types = 0; +pub const __NFTNL_UDATA_OBJ_MAX: nftnl_udata_obj_types = 1; +pub type nftnl_udata_obj_types = c_uint; +pub const NFTNL_UDATA_SET_KEYBYTEORDER: nftnl_udata_set_types = 0; +pub const NFTNL_UDATA_SET_DATABYTEORDER: nftnl_udata_set_types = 1; +pub const NFTNL_UDATA_SET_MERGE_ELEMENTS: nftnl_udata_set_types = 2; +pub const NFTNL_UDATA_SET_KEY_TYPEOF: nftnl_udata_set_types = 3; +pub const NFTNL_UDATA_SET_DATA_TYPEOF: nftnl_udata_set_types = 4; +pub const NFTNL_UDATA_SET_EXPR: nftnl_udata_set_types = 5; +pub const NFTNL_UDATA_SET_DATA_INTERVAL: nftnl_udata_set_types = 6; +pub const NFTNL_UDATA_SET_COMMENT: nftnl_udata_set_types = 7; +pub const __NFTNL_UDATA_SET_MAX: nftnl_udata_set_types = 8; +pub type nftnl_udata_set_types = c_uint; +pub const NFTNL_UDATA_SET_TYPEOF_EXPR: u32 = 0; +pub const NFTNL_UDATA_SET_TYPEOF_DATA: u32 = 1; +pub const __NFTNL_UDATA_SET_TYPEOF_MAX: u32 = 2; + +pub const NFTNL_UDATA_SET_ELEM_COMMENT: nftnl_udata_set_elem_types = 0; +pub const NFTNL_UDATA_SET_ELEM_FLAGS: nftnl_udata_set_elem_types = 1; +pub const __NFTNL_UDATA_SET_ELEM_MAX: nftnl_udata_set_elem_types = 2; +pub type nftnl_udata_set_elem_types = c_uint; +pub const NFTNL_SET_ELEM_F_INTERVAL_OPEN: nftnl_udata_set_elem_flags = 1; +pub type nftnl_udata_set_elem_flags = c_uint; +#[repr(C)] +pub struct nftnl_udata(c_void); + +#[repr(C)] +pub struct nftnl_udata_buf(c_void); + +extern "C" { + pub fn nftnl_udata_buf_alloc(data_size: u32) -> *mut nftnl_udata_buf; + + pub fn nftnl_udata_buf_free(buf: *const nftnl_udata_buf); + + pub fn nftnl_udata_buf_len(buf: *const nftnl_udata_buf) -> u32; + + pub fn nftnl_udata_buf_data(buf: *const nftnl_udata_buf) -> *mut c_void; + + pub fn nftnl_udata_buf_put(buf: *mut nftnl_udata_buf, data: *const c_void, len: u32); + + pub fn nftnl_udata_start(buf: *const nftnl_udata_buf) -> *mut nftnl_udata; + + pub fn nftnl_udata_end(buf: *const nftnl_udata_buf) -> *mut nftnl_udata; + + pub fn nftnl_udata_put( + buf: *mut nftnl_udata_buf, + type_: u8, + len: u32, + value: *const c_void, + ) -> bool; + + pub fn nftnl_udata_put_u32(buf: *mut nftnl_udata_buf, type_: u8, data: u32) -> bool; + + pub fn nftnl_udata_put_strz(buf: *mut nftnl_udata_buf, type_: u8, strz: *const c_char) -> bool; + + pub fn nftnl_udata_nest_start(buf: *mut nftnl_udata_buf, type_: u8) -> *mut nftnl_udata; + + pub fn nftnl_udata_nest_end(buf: *mut nftnl_udata_buf, ud: *mut nftnl_udata); + + pub fn nftnl_udata_type(attr: *const nftnl_udata) -> u8; + + pub fn nftnl_udata_len(attr: *const nftnl_udata) -> u8; + + pub fn nftnl_udata_get(attr: *const nftnl_udata) -> *mut c_void; + + pub fn nftnl_udata_get_u32(attr: *const nftnl_udata) -> u32; + + pub fn nftnl_udata_next(attr: *const nftnl_udata) -> *mut nftnl_udata; +} +pub type nftnl_udata_cb_t = + Option c_int>; +extern "C" { + pub fn nftnl_udata_parse( + data: *const c_void, + data_len: u32, + cb: nftnl_udata_cb_t, + cb_data: *mut c_void, + ) -> c_int; +} diff --git a/nftnl-sys/src/nftnl_1_2_3.rs b/nftnl-sys/src/nftnl_1_2_3.rs new file mode 100644 index 0000000..c9f128f --- /dev/null +++ b/nftnl-sys/src/nftnl_1_2_3.rs @@ -0,0 +1,1489 @@ +/* automatically generated by rust-bindgen 0.69.4 */ + +use core::option::Option; +use libc::{c_char, c_int, c_uint, c_void, iovec, nlmsghdr, FILE}; + +pub const NFTNL_UDATA_COMMENT_MAXLEN: u32 = 128; +#[repr(C)] +pub struct nftnl_batch(c_void); + +extern "C" { + pub fn nftnl_batch_alloc(pg_size: u32, pg_overrun_size: u32) -> *mut nftnl_batch; + + pub fn nftnl_batch_update(batch: *mut nftnl_batch) -> c_int; + + pub fn nftnl_batch_free(batch: *mut nftnl_batch); + + pub fn nftnl_batch_buffer(batch: *mut nftnl_batch) -> *mut c_void; + + pub fn nftnl_batch_buffer_len(batch: *mut nftnl_batch) -> u32; + + pub fn nftnl_batch_iovec_len(batch: *mut nftnl_batch) -> c_int; + + pub fn nftnl_batch_iovec(batch: *mut nftnl_batch, iov: *mut iovec, iovlen: u32); +} +pub const NFTNL_PARSE_EBADINPUT: u32 = 0; +pub const NFTNL_PARSE_EMISSINGNODE: u32 = 1; +pub const NFTNL_PARSE_EBADTYPE: u32 = 2; +pub const NFTNL_PARSE_EOPNOTSUPP: u32 = 3; + +pub const NFTNL_OUTPUT_DEFAULT: nftnl_output_type = 0; +pub const NFTNL_OUTPUT_XML: nftnl_output_type = 1; +pub const NFTNL_OUTPUT_JSON: nftnl_output_type = 2; +pub type nftnl_output_type = c_uint; +pub const NFTNL_OF_EVENT_NEW: nftnl_output_flags = 1; +pub const NFTNL_OF_EVENT_DEL: nftnl_output_flags = 2; +pub const NFTNL_OF_EVENT_ANY: nftnl_output_flags = 3; +pub type nftnl_output_flags = c_uint; +pub const NFTNL_CMD_UNSPEC: nftnl_cmd_type = 0; +pub const NFTNL_CMD_ADD: nftnl_cmd_type = 1; +pub const NFTNL_CMD_INSERT: nftnl_cmd_type = 2; +pub const NFTNL_CMD_DELETE: nftnl_cmd_type = 3; +pub const NFTNL_CMD_REPLACE: nftnl_cmd_type = 4; +pub const NFTNL_CMD_FLUSH: nftnl_cmd_type = 5; +pub const NFTNL_CMD_MAX: nftnl_cmd_type = 6; +pub type nftnl_cmd_type = c_uint; +pub const NFTNL_PARSE_NONE: nftnl_parse_type = 0; +pub const NFTNL_PARSE_XML: nftnl_parse_type = 1; +pub const NFTNL_PARSE_JSON: nftnl_parse_type = 2; +pub const NFTNL_PARSE_MAX: nftnl_parse_type = 3; +pub type nftnl_parse_type = c_uint; +#[repr(C)] +pub struct nftnl_parse_err(c_void); + +extern "C" { + pub fn nftnl_nlmsg_build_hdr( + buf: *mut c_char, + type_: u16, + family: u16, + flags: u16, + seq: u32, + ) -> *mut nlmsghdr; + + pub fn nftnl_parse_err_alloc() -> *mut nftnl_parse_err; + + pub fn nftnl_parse_err_free(arg1: *mut nftnl_parse_err); + + pub fn nftnl_parse_perror(str_: *const c_char, err: *mut nftnl_parse_err) -> c_int; + + pub fn nftnl_batch_is_supported() -> c_int; + + pub fn nftnl_batch_begin(buf: *mut c_char, seq: u32) -> *mut nlmsghdr; + + pub fn nftnl_batch_end(buf: *mut c_char, seq: u32) -> *mut nlmsghdr; +} +#[repr(C)] +pub struct nftnl_chain(c_void); + +#[repr(C)] +pub struct nftnl_rule(c_void); + +extern "C" { + pub fn nftnl_chain_alloc() -> *mut nftnl_chain; + + pub fn nftnl_chain_free(arg1: *const nftnl_chain); +} +pub const NFTNL_CHAIN_NAME: nftnl_chain_attr = 0; +pub const NFTNL_CHAIN_FAMILY: nftnl_chain_attr = 1; +pub const NFTNL_CHAIN_TABLE: nftnl_chain_attr = 2; +pub const NFTNL_CHAIN_HOOKNUM: nftnl_chain_attr = 3; +pub const NFTNL_CHAIN_PRIO: nftnl_chain_attr = 4; +pub const NFTNL_CHAIN_POLICY: nftnl_chain_attr = 5; +pub const NFTNL_CHAIN_USE: nftnl_chain_attr = 6; +pub const NFTNL_CHAIN_BYTES: nftnl_chain_attr = 7; +pub const NFTNL_CHAIN_PACKETS: nftnl_chain_attr = 8; +pub const NFTNL_CHAIN_HANDLE: nftnl_chain_attr = 9; +pub const NFTNL_CHAIN_TYPE: nftnl_chain_attr = 10; +pub const NFTNL_CHAIN_DEV: nftnl_chain_attr = 11; +pub const NFTNL_CHAIN_DEVICES: nftnl_chain_attr = 12; +pub const NFTNL_CHAIN_FLAGS: nftnl_chain_attr = 13; +pub const NFTNL_CHAIN_ID: nftnl_chain_attr = 14; +pub const NFTNL_CHAIN_USERDATA: nftnl_chain_attr = 15; +pub const __NFTNL_CHAIN_MAX: nftnl_chain_attr = 16; +pub type nftnl_chain_attr = c_uint; +extern "C" { + pub fn nftnl_chain_is_set(c: *const nftnl_chain, attr: u16) -> bool; + + pub fn nftnl_chain_unset(c: *mut nftnl_chain, attr: u16); + + pub fn nftnl_chain_set(t: *mut nftnl_chain, attr: u16, data: *const c_void); + + pub fn nftnl_chain_set_data( + t: *mut nftnl_chain, + attr: u16, + data: *const c_void, + data_len: u32, + ) -> c_int; + + pub fn nftnl_chain_set_u8(t: *mut nftnl_chain, attr: u16, data: u8); + + pub fn nftnl_chain_set_u32(t: *mut nftnl_chain, attr: u16, data: u32); + + pub fn nftnl_chain_set_s32(t: *mut nftnl_chain, attr: u16, data: i32); + + pub fn nftnl_chain_set_u64(t: *mut nftnl_chain, attr: u16, data: u64); + + pub fn nftnl_chain_set_str(t: *mut nftnl_chain, attr: u16, str_: *const c_char) -> c_int; + + pub fn nftnl_chain_set_array(t: *mut nftnl_chain, attr: u16, data: *mut *const c_char) + -> c_int; + + pub fn nftnl_chain_get(c: *const nftnl_chain, attr: u16) -> *const c_void; + + pub fn nftnl_chain_get_data( + c: *const nftnl_chain, + attr: u16, + data_len: *mut u32, + ) -> *const c_void; + + pub fn nftnl_chain_get_str(c: *const nftnl_chain, attr: u16) -> *const c_char; + + pub fn nftnl_chain_get_u8(c: *const nftnl_chain, attr: u16) -> u8; + + pub fn nftnl_chain_get_u32(c: *const nftnl_chain, attr: u16) -> u32; + + pub fn nftnl_chain_get_s32(c: *const nftnl_chain, attr: u16) -> i32; + + pub fn nftnl_chain_get_u64(c: *const nftnl_chain, attr: u16) -> u64; + + pub fn nftnl_chain_get_array(c: *const nftnl_chain, attr: u16) -> *const *const c_char; + + pub fn nftnl_chain_rule_add(rule: *mut nftnl_rule, c: *mut nftnl_chain); + + pub fn nftnl_chain_rule_del(rule: *mut nftnl_rule); + + pub fn nftnl_chain_rule_add_tail(rule: *mut nftnl_rule, c: *mut nftnl_chain); + + pub fn nftnl_chain_rule_insert_at(rule: *mut nftnl_rule, pos: *mut nftnl_rule); + + pub fn nftnl_chain_rule_append_at(rule: *mut nftnl_rule, pos: *mut nftnl_rule); + + pub fn nftnl_chain_nlmsg_build_payload(nlh: *mut nlmsghdr, t: *const nftnl_chain); + + pub fn nftnl_chain_parse( + c: *mut nftnl_chain, + type_: nftnl_parse_type, + data: *const c_char, + err: *mut nftnl_parse_err, + ) -> c_int; + + pub fn nftnl_chain_parse_file( + c: *mut nftnl_chain, + type_: nftnl_parse_type, + fp: *mut FILE, + err: *mut nftnl_parse_err, + ) -> c_int; + + pub fn nftnl_chain_snprintf( + buf: *mut c_char, + size: usize, + t: *const nftnl_chain, + type_: u32, + flags: u32, + ) -> c_int; + + pub fn nftnl_chain_fprintf( + fp: *mut FILE, + c: *const nftnl_chain, + type_: u32, + flags: u32, + ) -> c_int; + + pub fn nftnl_chain_nlmsg_parse(nlh: *const nlmsghdr, t: *mut nftnl_chain) -> c_int; + + pub fn nftnl_rule_foreach( + c: *mut nftnl_chain, + cb: Option c_int>, + data: *mut c_void, + ) -> c_int; + + pub fn nftnl_rule_lookup_byindex(c: *mut nftnl_chain, index: u32) -> *mut nftnl_rule; +} +#[repr(C)] +pub struct nftnl_rule_iter(c_void); + +extern "C" { + pub fn nftnl_rule_iter_create(c: *const nftnl_chain) -> *mut nftnl_rule_iter; + + pub fn nftnl_rule_iter_next(iter: *mut nftnl_rule_iter) -> *mut nftnl_rule; + + pub fn nftnl_rule_iter_destroy(iter: *mut nftnl_rule_iter); +} +#[repr(C)] +pub struct nftnl_chain_list(c_void); + +extern "C" { + pub fn nftnl_chain_list_alloc() -> *mut nftnl_chain_list; + + pub fn nftnl_chain_list_free(list: *mut nftnl_chain_list); + + pub fn nftnl_chain_list_is_empty(list: *const nftnl_chain_list) -> c_int; + + pub fn nftnl_chain_list_foreach( + chain_list: *mut nftnl_chain_list, + cb: Option c_int>, + data: *mut c_void, + ) -> c_int; + + pub fn nftnl_chain_list_lookup_byname( + chain_list: *mut nftnl_chain_list, + chain: *const c_char, + ) -> *mut nftnl_chain; + + pub fn nftnl_chain_list_add(r: *mut nftnl_chain, list: *mut nftnl_chain_list); + + pub fn nftnl_chain_list_add_tail(r: *mut nftnl_chain, list: *mut nftnl_chain_list); + + pub fn nftnl_chain_list_del(c: *mut nftnl_chain); +} +#[repr(C)] +pub struct nftnl_chain_list_iter(c_void); + +extern "C" { + pub fn nftnl_chain_list_iter_create(l: *const nftnl_chain_list) -> *mut nftnl_chain_list_iter; + + pub fn nftnl_chain_list_iter_next(iter: *mut nftnl_chain_list_iter) -> *mut nftnl_chain; + + pub fn nftnl_chain_list_iter_destroy(iter: *mut nftnl_chain_list_iter); +} +#[repr(C)] +pub struct nftnl_expr(c_void); + +pub const NFTNL_EXPR_NAME: u32 = 0; +pub const NFTNL_EXPR_BASE: u32 = 1; + +extern "C" { + pub fn nftnl_expr_alloc(name: *const c_char) -> *mut nftnl_expr; + + pub fn nftnl_expr_free(expr: *const nftnl_expr); + + pub fn nftnl_expr_is_set(expr: *const nftnl_expr, type_: u16) -> bool; + + pub fn nftnl_expr_set( + expr: *mut nftnl_expr, + type_: u16, + data: *const c_void, + data_len: u32, + ) -> c_int; + + pub fn nftnl_expr_set_u8(expr: *mut nftnl_expr, type_: u16, data: u8); + + pub fn nftnl_expr_set_u16(expr: *mut nftnl_expr, type_: u16, data: u16); + + pub fn nftnl_expr_set_u32(expr: *mut nftnl_expr, type_: u16, data: u32); + + pub fn nftnl_expr_set_u64(expr: *mut nftnl_expr, type_: u16, data: u64); + + pub fn nftnl_expr_set_str(expr: *mut nftnl_expr, type_: u16, str_: *const c_char) -> c_int; + + pub fn nftnl_expr_get(expr: *const nftnl_expr, type_: u16, data_len: *mut u32) + -> *const c_void; + + pub fn nftnl_expr_get_u8(expr: *const nftnl_expr, type_: u16) -> u8; + + pub fn nftnl_expr_get_u16(expr: *const nftnl_expr, type_: u16) -> u16; + + pub fn nftnl_expr_get_u32(expr: *const nftnl_expr, type_: u16) -> u32; + + pub fn nftnl_expr_get_u64(expr: *const nftnl_expr, type_: u16) -> u64; + + pub fn nftnl_expr_get_str(expr: *const nftnl_expr, type_: u16) -> *const c_char; + + pub fn nftnl_expr_build_payload(nlh: *mut nlmsghdr, expr: *mut nftnl_expr); + + pub fn nftnl_expr_add_expr(expr: *mut nftnl_expr, type_: u32, e: *mut nftnl_expr); + + pub fn nftnl_expr_expr_foreach( + e: *const nftnl_expr, + cb: Option c_int>, + data: *mut c_void, + ) -> c_int; + + pub fn nftnl_expr_snprintf( + buf: *mut c_char, + buflen: usize, + expr: *const nftnl_expr, + type_: u32, + flags: u32, + ) -> c_int; + + pub fn nftnl_expr_fprintf( + fp: *mut FILE, + expr: *const nftnl_expr, + type_: u32, + flags: u32, + ) -> c_int; +} +pub const NFTNL_EXPR_PAYLOAD_DREG: u32 = 1; +pub const NFTNL_EXPR_PAYLOAD_BASE: u32 = 2; +pub const NFTNL_EXPR_PAYLOAD_OFFSET: u32 = 3; +pub const NFTNL_EXPR_PAYLOAD_LEN: u32 = 4; +pub const NFTNL_EXPR_PAYLOAD_SREG: u32 = 5; +pub const NFTNL_EXPR_PAYLOAD_CSUM_TYPE: u32 = 6; +pub const NFTNL_EXPR_PAYLOAD_CSUM_OFFSET: u32 = 7; +pub const NFTNL_EXPR_PAYLOAD_FLAGS: u32 = 8; + +pub const NFTNL_EXPR_NG_DREG: u32 = 1; +pub const NFTNL_EXPR_NG_MODULUS: u32 = 2; +pub const NFTNL_EXPR_NG_TYPE: u32 = 3; +pub const NFTNL_EXPR_NG_OFFSET: u32 = 4; +pub const NFTNL_EXPR_NG_SET_NAME: u32 = 5; +pub const NFTNL_EXPR_NG_SET_ID: u32 = 6; + +pub const NFTNL_EXPR_META_KEY: u32 = 1; +pub const NFTNL_EXPR_META_DREG: u32 = 2; +pub const NFTNL_EXPR_META_SREG: u32 = 3; + +pub const NFTNL_EXPR_RT_KEY: u32 = 1; +pub const NFTNL_EXPR_RT_DREG: u32 = 2; + +pub const NFTNL_EXPR_SOCKET_KEY: u32 = 1; +pub const NFTNL_EXPR_SOCKET_DREG: u32 = 2; +pub const NFTNL_EXPR_SOCKET_LEVEL: u32 = 3; + +pub const NFTNL_EXPR_TUNNEL_KEY: u32 = 1; +pub const NFTNL_EXPR_TUNNEL_DREG: u32 = 2; + +pub const NFTNL_EXPR_CMP_SREG: u32 = 1; +pub const NFTNL_EXPR_CMP_OP: u32 = 2; +pub const NFTNL_EXPR_CMP_DATA: u32 = 3; + +pub const NFTNL_EXPR_RANGE_SREG: u32 = 1; +pub const NFTNL_EXPR_RANGE_OP: u32 = 2; +pub const NFTNL_EXPR_RANGE_FROM_DATA: u32 = 3; +pub const NFTNL_EXPR_RANGE_TO_DATA: u32 = 4; + +pub const NFTNL_EXPR_IMM_DREG: u32 = 1; +pub const NFTNL_EXPR_IMM_DATA: u32 = 2; +pub const NFTNL_EXPR_IMM_VERDICT: u32 = 3; +pub const NFTNL_EXPR_IMM_CHAIN: u32 = 4; +pub const NFTNL_EXPR_IMM_CHAIN_ID: u32 = 5; + +pub const NFTNL_EXPR_CTR_PACKETS: u32 = 1; +pub const NFTNL_EXPR_CTR_BYTES: u32 = 2; + +pub const NFTNL_EXPR_CONNLIMIT_COUNT: u32 = 1; +pub const NFTNL_EXPR_CONNLIMIT_FLAGS: u32 = 2; + +pub const NFTNL_EXPR_BITWISE_SREG: u32 = 1; +pub const NFTNL_EXPR_BITWISE_DREG: u32 = 2; +pub const NFTNL_EXPR_BITWISE_LEN: u32 = 3; +pub const NFTNL_EXPR_BITWISE_MASK: u32 = 4; +pub const NFTNL_EXPR_BITWISE_XOR: u32 = 5; +pub const NFTNL_EXPR_BITWISE_OP: u32 = 6; +pub const NFTNL_EXPR_BITWISE_DATA: u32 = 7; + +pub const NFTNL_EXPR_TG_NAME: u32 = 1; +pub const NFTNL_EXPR_TG_REV: u32 = 2; +pub const NFTNL_EXPR_TG_INFO: u32 = 3; + +pub const NFTNL_EXPR_MT_NAME: u32 = 1; +pub const NFTNL_EXPR_MT_REV: u32 = 2; +pub const NFTNL_EXPR_MT_INFO: u32 = 3; + +pub const NFTNL_EXPR_NAT_TYPE: u32 = 1; +pub const NFTNL_EXPR_NAT_FAMILY: u32 = 2; +pub const NFTNL_EXPR_NAT_REG_ADDR_MIN: u32 = 3; +pub const NFTNL_EXPR_NAT_REG_ADDR_MAX: u32 = 4; +pub const NFTNL_EXPR_NAT_REG_PROTO_MIN: u32 = 5; +pub const NFTNL_EXPR_NAT_REG_PROTO_MAX: u32 = 6; +pub const NFTNL_EXPR_NAT_FLAGS: u32 = 7; + +pub const NFTNL_EXPR_TPROXY_FAMILY: u32 = 1; +pub const NFTNL_EXPR_TPROXY_REG_ADDR: u32 = 2; +pub const NFTNL_EXPR_TPROXY_REG_PORT: u32 = 3; + +pub const NFTNL_EXPR_LOOKUP_SREG: u32 = 1; +pub const NFTNL_EXPR_LOOKUP_DREG: u32 = 2; +pub const NFTNL_EXPR_LOOKUP_SET: u32 = 3; +pub const NFTNL_EXPR_LOOKUP_SET_ID: u32 = 4; +pub const NFTNL_EXPR_LOOKUP_FLAGS: u32 = 5; + +pub const NFTNL_EXPR_DYNSET_SREG_KEY: u32 = 1; +pub const NFTNL_EXPR_DYNSET_SREG_DATA: u32 = 2; +pub const NFTNL_EXPR_DYNSET_OP: u32 = 3; +pub const NFTNL_EXPR_DYNSET_TIMEOUT: u32 = 4; +pub const NFTNL_EXPR_DYNSET_SET_NAME: u32 = 5; +pub const NFTNL_EXPR_DYNSET_SET_ID: u32 = 6; +pub const NFTNL_EXPR_DYNSET_EXPR: u32 = 7; +pub const NFTNL_EXPR_DYNSET_EXPRESSIONS: u32 = 8; +pub const NFTNL_EXPR_DYNSET_FLAGS: u32 = 9; + +pub const NFTNL_EXPR_LOG_PREFIX: u32 = 1; +pub const NFTNL_EXPR_LOG_GROUP: u32 = 2; +pub const NFTNL_EXPR_LOG_SNAPLEN: u32 = 3; +pub const NFTNL_EXPR_LOG_QTHRESHOLD: u32 = 4; +pub const NFTNL_EXPR_LOG_LEVEL: u32 = 5; +pub const NFTNL_EXPR_LOG_FLAGS: u32 = 6; + +pub const NFTNL_EXPR_EXTHDR_DREG: u32 = 1; +pub const NFTNL_EXPR_EXTHDR_TYPE: u32 = 2; +pub const NFTNL_EXPR_EXTHDR_OFFSET: u32 = 3; +pub const NFTNL_EXPR_EXTHDR_LEN: u32 = 4; +pub const NFTNL_EXPR_EXTHDR_FLAGS: u32 = 5; +pub const NFTNL_EXPR_EXTHDR_OP: u32 = 6; +pub const NFTNL_EXPR_EXTHDR_SREG: u32 = 7; + +pub const NFTNL_EXPR_CT_DREG: u32 = 1; +pub const NFTNL_EXPR_CT_KEY: u32 = 2; +pub const NFTNL_EXPR_CT_DIR: u32 = 3; +pub const NFTNL_EXPR_CT_SREG: u32 = 4; + +pub const NFTNL_EXPR_BYTEORDER_DREG: u32 = 1; +pub const NFTNL_EXPR_BYTEORDER_SREG: u32 = 2; +pub const NFTNL_EXPR_BYTEORDER_OP: u32 = 3; +pub const NFTNL_EXPR_BYTEORDER_LEN: u32 = 4; +pub const NFTNL_EXPR_BYTEORDER_SIZE: u32 = 5; + +pub const NFTNL_EXPR_LIMIT_RATE: u32 = 1; +pub const NFTNL_EXPR_LIMIT_UNIT: u32 = 2; +pub const NFTNL_EXPR_LIMIT_BURST: u32 = 3; +pub const NFTNL_EXPR_LIMIT_TYPE: u32 = 4; +pub const NFTNL_EXPR_LIMIT_FLAGS: u32 = 5; + +pub const NFTNL_EXPR_REJECT_TYPE: u32 = 1; +pub const NFTNL_EXPR_REJECT_CODE: u32 = 2; + +pub const NFTNL_EXPR_QUEUE_NUM: u32 = 1; +pub const NFTNL_EXPR_QUEUE_TOTAL: u32 = 2; +pub const NFTNL_EXPR_QUEUE_FLAGS: u32 = 3; +pub const NFTNL_EXPR_QUEUE_SREG_QNUM: u32 = 4; + +pub const NFTNL_EXPR_QUOTA_BYTES: u32 = 1; +pub const NFTNL_EXPR_QUOTA_FLAGS: u32 = 2; +pub const NFTNL_EXPR_QUOTA_CONSUMED: u32 = 3; + +pub const NFTNL_EXPR_MASQ_FLAGS: u32 = 1; +pub const NFTNL_EXPR_MASQ_REG_PROTO_MIN: u32 = 2; +pub const NFTNL_EXPR_MASQ_REG_PROTO_MAX: u32 = 3; + +pub const NFTNL_EXPR_REDIR_REG_PROTO_MIN: u32 = 1; +pub const NFTNL_EXPR_REDIR_REG_PROTO_MAX: u32 = 2; +pub const NFTNL_EXPR_REDIR_FLAGS: u32 = 3; + +pub const NFTNL_EXPR_DUP_SREG_ADDR: u32 = 1; +pub const NFTNL_EXPR_DUP_SREG_DEV: u32 = 2; + +pub const NFTNL_EXPR_FLOW_TABLE_NAME: u32 = 1; + +pub const NFTNL_EXPR_FWD_SREG_DEV: u32 = 1; +pub const NFTNL_EXPR_FWD_SREG_ADDR: u32 = 2; +pub const NFTNL_EXPR_FWD_NFPROTO: u32 = 3; + +pub const NFTNL_EXPR_HASH_SREG: u32 = 1; +pub const NFTNL_EXPR_HASH_DREG: u32 = 2; +pub const NFTNL_EXPR_HASH_LEN: u32 = 3; +pub const NFTNL_EXPR_HASH_MODULUS: u32 = 4; +pub const NFTNL_EXPR_HASH_SEED: u32 = 5; +pub const NFTNL_EXPR_HASH_OFFSET: u32 = 6; +pub const NFTNL_EXPR_HASH_TYPE: u32 = 7; +pub const NFTNL_EXPR_HASH_SET_NAME: u32 = 8; +pub const NFTNL_EXPR_HASH_SET_ID: u32 = 9; + +pub const NFTNL_EXPR_FIB_DREG: u32 = 1; +pub const NFTNL_EXPR_FIB_RESULT: u32 = 2; +pub const NFTNL_EXPR_FIB_FLAGS: u32 = 3; + +pub const NFTNL_EXPR_OBJREF_IMM_TYPE: u32 = 1; +pub const NFTNL_EXPR_OBJREF_IMM_NAME: u32 = 2; +pub const NFTNL_EXPR_OBJREF_SET_SREG: u32 = 3; +pub const NFTNL_EXPR_OBJREF_SET_NAME: u32 = 4; +pub const NFTNL_EXPR_OBJREF_SET_ID: u32 = 5; + +pub const NFTNL_EXPR_OSF_DREG: u32 = 1; +pub const NFTNL_EXPR_OSF_TTL: u32 = 2; +pub const NFTNL_EXPR_OSF_FLAGS: u32 = 3; + +pub const NFTNL_EXPR_XFRM_DREG: u32 = 1; +pub const NFTNL_EXPR_XFRM_SREG: u32 = 2; +pub const NFTNL_EXPR_XFRM_KEY: u32 = 3; +pub const NFTNL_EXPR_XFRM_DIR: u32 = 4; +pub const NFTNL_EXPR_XFRM_SPNUM: u32 = 5; + +pub const NFTNL_EXPR_SYNPROXY_MSS: u32 = 1; +pub const NFTNL_EXPR_SYNPROXY_WSCALE: u32 = 2; +pub const NFTNL_EXPR_SYNPROXY_FLAGS: u32 = 3; + +pub const NFTNL_EXPR_LAST_MSECS: u32 = 1; +pub const NFTNL_EXPR_LAST_SET: u32 = 2; + +#[repr(C)] +pub struct nftnl_gen(c_void); + +extern "C" { + pub fn nftnl_gen_alloc() -> *mut nftnl_gen; + + pub fn nftnl_gen_free(arg1: *const nftnl_gen); +} +pub const NFTNL_GEN_ID: u32 = 0; +pub const __NFTNL_GEN_MAX: u32 = 1; + +extern "C" { + pub fn nftnl_gen_is_set(gen: *const nftnl_gen, attr: u16) -> bool; + + pub fn nftnl_gen_unset(gen: *mut nftnl_gen, attr: u16); + + pub fn nftnl_gen_set(gen: *mut nftnl_gen, attr: u16, data: *const c_void) -> c_int; + + pub fn nftnl_gen_set_data( + gen: *mut nftnl_gen, + attr: u16, + data: *const c_void, + data_len: u32, + ) -> c_int; + + pub fn nftnl_gen_get(gen: *const nftnl_gen, attr: u16) -> *const c_void; + + pub fn nftnl_gen_get_data( + gen: *const nftnl_gen, + attr: u16, + data_len: *mut u32, + ) -> *const c_void; + + pub fn nftnl_gen_set_u32(gen: *mut nftnl_gen, attr: u16, data: u32); + + pub fn nftnl_gen_get_u32(gen: *const nftnl_gen, attr: u16) -> u32; + + pub fn nftnl_gen_nlmsg_parse(nlh: *const nlmsghdr, gen: *mut nftnl_gen) -> c_int; + + pub fn nftnl_gen_snprintf( + buf: *mut c_char, + size: usize, + gen: *const nftnl_gen, + type_: u32, + flags: u32, + ) -> c_int; + + pub fn nftnl_gen_fprintf(fp: *mut FILE, gen: *const nftnl_gen, type_: u32, flags: u32) + -> c_int; +} +pub const NFTNL_OBJ_TABLE: u32 = 0; +pub const NFTNL_OBJ_NAME: u32 = 1; +pub const NFTNL_OBJ_TYPE: u32 = 2; +pub const NFTNL_OBJ_FAMILY: u32 = 3; +pub const NFTNL_OBJ_USE: u32 = 4; +pub const NFTNL_OBJ_HANDLE: u32 = 5; +pub const NFTNL_OBJ_USERDATA: u32 = 6; +pub const NFTNL_OBJ_BASE: u32 = 16; +pub const __NFTNL_OBJ_MAX: u32 = 17; + +pub const NFTNL_OBJ_CTR_PKTS: u32 = 16; +pub const NFTNL_OBJ_CTR_BYTES: u32 = 17; + +pub const NFTNL_OBJ_QUOTA_BYTES: u32 = 16; +pub const NFTNL_OBJ_QUOTA_CONSUMED: u32 = 17; +pub const NFTNL_OBJ_QUOTA_FLAGS: u32 = 18; + +pub const NFTNL_OBJ_CT_HELPER_NAME: u32 = 16; +pub const NFTNL_OBJ_CT_HELPER_L3PROTO: u32 = 17; +pub const NFTNL_OBJ_CT_HELPER_L4PROTO: u32 = 18; + +pub const NFTNL_CTTIMEOUT_TCP_SYN_SENT: nftnl_cttimeout_array_tcp = 0; +pub const NFTNL_CTTIMEOUT_TCP_SYN_RECV: nftnl_cttimeout_array_tcp = 1; +pub const NFTNL_CTTIMEOUT_TCP_ESTABLISHED: nftnl_cttimeout_array_tcp = 2; +pub const NFTNL_CTTIMEOUT_TCP_FIN_WAIT: nftnl_cttimeout_array_tcp = 3; +pub const NFTNL_CTTIMEOUT_TCP_CLOSE_WAIT: nftnl_cttimeout_array_tcp = 4; +pub const NFTNL_CTTIMEOUT_TCP_LAST_ACK: nftnl_cttimeout_array_tcp = 5; +pub const NFTNL_CTTIMEOUT_TCP_TIME_WAIT: nftnl_cttimeout_array_tcp = 6; +pub const NFTNL_CTTIMEOUT_TCP_CLOSE: nftnl_cttimeout_array_tcp = 7; +pub const NFTNL_CTTIMEOUT_TCP_SYN_SENT2: nftnl_cttimeout_array_tcp = 8; +pub const NFTNL_CTTIMEOUT_TCP_RETRANS: nftnl_cttimeout_array_tcp = 9; +pub const NFTNL_CTTIMEOUT_TCP_UNACK: nftnl_cttimeout_array_tcp = 10; +pub const NFTNL_CTTIMEOUT_TCP_MAX: nftnl_cttimeout_array_tcp = 11; +pub type nftnl_cttimeout_array_tcp = c_uint; +pub const NFTNL_CTTIMEOUT_UDP_UNREPLIED: nftnl_cttimeout_array_udp = 0; +pub const NFTNL_CTTIMEOUT_UDP_REPLIED: nftnl_cttimeout_array_udp = 1; +pub const NFTNL_CTTIMEOUT_UDP_MAX: nftnl_cttimeout_array_udp = 2; +pub type nftnl_cttimeout_array_udp = c_uint; +pub const NFTNL_OBJ_CT_TIMEOUT_L3PROTO: u32 = 16; +pub const NFTNL_OBJ_CT_TIMEOUT_L4PROTO: u32 = 17; +pub const NFTNL_OBJ_CT_TIMEOUT_ARRAY: u32 = 18; + +pub const NFTNL_OBJ_CT_EXPECT_L3PROTO: u32 = 16; +pub const NFTNL_OBJ_CT_EXPECT_L4PROTO: u32 = 17; +pub const NFTNL_OBJ_CT_EXPECT_DPORT: u32 = 18; +pub const NFTNL_OBJ_CT_EXPECT_TIMEOUT: u32 = 19; +pub const NFTNL_OBJ_CT_EXPECT_SIZE: u32 = 20; + +pub const NFTNL_OBJ_LIMIT_RATE: u32 = 16; +pub const NFTNL_OBJ_LIMIT_UNIT: u32 = 17; +pub const NFTNL_OBJ_LIMIT_BURST: u32 = 18; +pub const NFTNL_OBJ_LIMIT_TYPE: u32 = 19; +pub const NFTNL_OBJ_LIMIT_FLAGS: u32 = 20; + +pub const NFTNL_OBJ_SYNPROXY_MSS: u32 = 16; +pub const NFTNL_OBJ_SYNPROXY_WSCALE: u32 = 17; +pub const NFTNL_OBJ_SYNPROXY_FLAGS: u32 = 18; + +pub const NFTNL_OBJ_TUNNEL_ID: u32 = 16; +pub const NFTNL_OBJ_TUNNEL_IPV4_SRC: u32 = 17; +pub const NFTNL_OBJ_TUNNEL_IPV4_DST: u32 = 18; +pub const NFTNL_OBJ_TUNNEL_IPV6_SRC: u32 = 19; +pub const NFTNL_OBJ_TUNNEL_IPV6_DST: u32 = 20; +pub const NFTNL_OBJ_TUNNEL_IPV6_FLOWLABEL: u32 = 21; +pub const NFTNL_OBJ_TUNNEL_SPORT: u32 = 22; +pub const NFTNL_OBJ_TUNNEL_DPORT: u32 = 23; +pub const NFTNL_OBJ_TUNNEL_FLAGS: u32 = 24; +pub const NFTNL_OBJ_TUNNEL_TOS: u32 = 25; +pub const NFTNL_OBJ_TUNNEL_TTL: u32 = 26; +pub const NFTNL_OBJ_TUNNEL_VXLAN_GBP: u32 = 27; +pub const NFTNL_OBJ_TUNNEL_ERSPAN_VERSION: u32 = 28; +pub const NFTNL_OBJ_TUNNEL_ERSPAN_V1_INDEX: u32 = 29; +pub const NFTNL_OBJ_TUNNEL_ERSPAN_V2_HWID: u32 = 30; +pub const NFTNL_OBJ_TUNNEL_ERSPAN_V2_DIR: u32 = 31; + +pub const NFTNL_OBJ_SECMARK_CTX: u32 = 16; + +#[repr(C)] +pub struct nftnl_obj(c_void); + +extern "C" { + pub fn nftnl_obj_alloc() -> *mut nftnl_obj; + + pub fn nftnl_obj_free(ne: *const nftnl_obj); + + pub fn nftnl_obj_is_set(ne: *const nftnl_obj, attr: u16) -> bool; + + pub fn nftnl_obj_unset(ne: *mut nftnl_obj, attr: u16); + + pub fn nftnl_obj_set_data(ne: *mut nftnl_obj, attr: u16, data: *const c_void, data_len: u32); + + pub fn nftnl_obj_set(ne: *mut nftnl_obj, attr: u16, data: *const c_void); + + pub fn nftnl_obj_set_u8(ne: *mut nftnl_obj, attr: u16, val: u8); + + pub fn nftnl_obj_set_u16(ne: *mut nftnl_obj, attr: u16, val: u16); + + pub fn nftnl_obj_set_u32(ne: *mut nftnl_obj, attr: u16, val: u32); + + pub fn nftnl_obj_set_u64(obj: *mut nftnl_obj, attr: u16, val: u64); + + pub fn nftnl_obj_set_str(ne: *mut nftnl_obj, attr: u16, str_: *const c_char); + + pub fn nftnl_obj_get_data(ne: *mut nftnl_obj, attr: u16, data_len: *mut u32) -> *const c_void; + + pub fn nftnl_obj_get(ne: *mut nftnl_obj, attr: u16) -> *const c_void; + + pub fn nftnl_obj_get_u8(ne: *mut nftnl_obj, attr: u16) -> u8; + + pub fn nftnl_obj_get_u16(obj: *mut nftnl_obj, attr: u16) -> u16; + + pub fn nftnl_obj_get_u32(ne: *mut nftnl_obj, attr: u16) -> u32; + + pub fn nftnl_obj_get_u64(obj: *mut nftnl_obj, attr: u16) -> u64; + + pub fn nftnl_obj_get_str(ne: *mut nftnl_obj, attr: u16) -> *const c_char; + + pub fn nftnl_obj_nlmsg_build_payload(nlh: *mut nlmsghdr, ne: *const nftnl_obj); + + pub fn nftnl_obj_nlmsg_parse(nlh: *const nlmsghdr, ne: *mut nftnl_obj) -> c_int; + + pub fn nftnl_obj_parse( + ne: *mut nftnl_obj, + type_: nftnl_parse_type, + data: *const c_char, + err: *mut nftnl_parse_err, + ) -> c_int; + + pub fn nftnl_obj_parse_file( + ne: *mut nftnl_obj, + type_: nftnl_parse_type, + fp: *mut FILE, + err: *mut nftnl_parse_err, + ) -> c_int; + + pub fn nftnl_obj_snprintf( + buf: *mut c_char, + size: usize, + ne: *const nftnl_obj, + type_: u32, + flags: u32, + ) -> c_int; + + pub fn nftnl_obj_fprintf(fp: *mut FILE, ne: *const nftnl_obj, type_: u32, flags: u32) -> c_int; +} +#[repr(C)] +pub struct nftnl_obj_list(c_void); + +extern "C" { + pub fn nftnl_obj_list_alloc() -> *mut nftnl_obj_list; + + pub fn nftnl_obj_list_free(list: *mut nftnl_obj_list); + + pub fn nftnl_obj_list_is_empty(list: *mut nftnl_obj_list) -> c_int; + + pub fn nftnl_obj_list_add(r: *mut nftnl_obj, list: *mut nftnl_obj_list); + + pub fn nftnl_obj_list_add_tail(r: *mut nftnl_obj, list: *mut nftnl_obj_list); + + pub fn nftnl_obj_list_del(t: *mut nftnl_obj); + + pub fn nftnl_obj_list_foreach( + table_list: *mut nftnl_obj_list, + cb: Option c_int>, + data: *mut c_void, + ) -> c_int; +} +#[repr(C)] +pub struct nftnl_obj_list_iter(c_void); + +extern "C" { + pub fn nftnl_obj_list_iter_create(l: *mut nftnl_obj_list) -> *mut nftnl_obj_list_iter; + + pub fn nftnl_obj_list_iter_next(iter: *mut nftnl_obj_list_iter) -> *mut nftnl_obj; + + pub fn nftnl_obj_list_iter_destroy(iter: *mut nftnl_obj_list_iter); + + pub fn nftnl_rule_alloc() -> *mut nftnl_rule; + + pub fn nftnl_rule_free(arg1: *const nftnl_rule); +} +pub const NFTNL_RULE_FAMILY: nftnl_rule_attr = 0; +pub const NFTNL_RULE_TABLE: nftnl_rule_attr = 1; +pub const NFTNL_RULE_CHAIN: nftnl_rule_attr = 2; +pub const NFTNL_RULE_HANDLE: nftnl_rule_attr = 3; +pub const NFTNL_RULE_COMPAT_PROTO: nftnl_rule_attr = 4; +pub const NFTNL_RULE_COMPAT_FLAGS: nftnl_rule_attr = 5; +pub const NFTNL_RULE_POSITION: nftnl_rule_attr = 6; +pub const NFTNL_RULE_USERDATA: nftnl_rule_attr = 7; +pub const NFTNL_RULE_ID: nftnl_rule_attr = 8; +pub const NFTNL_RULE_POSITION_ID: nftnl_rule_attr = 9; +pub const __NFTNL_RULE_MAX: nftnl_rule_attr = 10; +pub type nftnl_rule_attr = c_uint; +extern "C" { + pub fn nftnl_rule_unset(r: *mut nftnl_rule, attr: u16); + + pub fn nftnl_rule_is_set(r: *const nftnl_rule, attr: u16) -> bool; + + pub fn nftnl_rule_set(r: *mut nftnl_rule, attr: u16, data: *const c_void) -> c_int; + + pub fn nftnl_rule_set_data( + r: *mut nftnl_rule, + attr: u16, + data: *const c_void, + data_len: u32, + ) -> c_int; + + pub fn nftnl_rule_set_u32(r: *mut nftnl_rule, attr: u16, val: u32); + + pub fn nftnl_rule_set_u64(r: *mut nftnl_rule, attr: u16, val: u64); + + pub fn nftnl_rule_set_str(r: *mut nftnl_rule, attr: u16, str_: *const c_char) -> c_int; + + pub fn nftnl_rule_get(r: *const nftnl_rule, attr: u16) -> *const c_void; + + pub fn nftnl_rule_get_data( + r: *const nftnl_rule, + attr: u16, + data_len: *mut u32, + ) -> *const c_void; + + pub fn nftnl_rule_get_str(r: *const nftnl_rule, attr: u16) -> *const c_char; + + pub fn nftnl_rule_get_u8(r: *const nftnl_rule, attr: u16) -> u8; + + pub fn nftnl_rule_get_u32(r: *const nftnl_rule, attr: u16) -> u32; + + pub fn nftnl_rule_get_u64(r: *const nftnl_rule, attr: u16) -> u64; + + pub fn nftnl_rule_add_expr(r: *mut nftnl_rule, expr: *mut nftnl_expr); + + pub fn nftnl_rule_del_expr(expr: *mut nftnl_expr); + + pub fn nftnl_rule_nlmsg_build_payload(nlh: *mut nlmsghdr, t: *mut nftnl_rule); + + pub fn nftnl_rule_parse( + r: *mut nftnl_rule, + type_: nftnl_parse_type, + data: *const c_char, + err: *mut nftnl_parse_err, + ) -> c_int; + + pub fn nftnl_rule_parse_file( + r: *mut nftnl_rule, + type_: nftnl_parse_type, + fp: *mut FILE, + err: *mut nftnl_parse_err, + ) -> c_int; + + pub fn nftnl_rule_snprintf( + buf: *mut c_char, + size: usize, + t: *const nftnl_rule, + type_: u32, + flags: u32, + ) -> c_int; + + pub fn nftnl_rule_fprintf(fp: *mut FILE, r: *const nftnl_rule, type_: u32, flags: u32) + -> c_int; + + pub fn nftnl_rule_nlmsg_parse(nlh: *const nlmsghdr, t: *mut nftnl_rule) -> c_int; + + pub fn nftnl_expr_foreach( + r: *mut nftnl_rule, + cb: Option c_int>, + data: *mut c_void, + ) -> c_int; +} +#[repr(C)] +pub struct nftnl_expr_iter(c_void); + +extern "C" { + pub fn nftnl_expr_iter_create(r: *const nftnl_rule) -> *mut nftnl_expr_iter; + + pub fn nftnl_expr_iter_next(iter: *mut nftnl_expr_iter) -> *mut nftnl_expr; + + pub fn nftnl_expr_iter_destroy(iter: *mut nftnl_expr_iter); +} +#[repr(C)] +pub struct nftnl_rule_list(c_void); + +extern "C" { + pub fn nftnl_rule_list_alloc() -> *mut nftnl_rule_list; + + pub fn nftnl_rule_list_free(list: *mut nftnl_rule_list); + + pub fn nftnl_rule_list_is_empty(list: *const nftnl_rule_list) -> c_int; + + pub fn nftnl_rule_list_add(r: *mut nftnl_rule, list: *mut nftnl_rule_list); + + pub fn nftnl_rule_list_add_tail(r: *mut nftnl_rule, list: *mut nftnl_rule_list); + + pub fn nftnl_rule_list_insert_at(r: *mut nftnl_rule, pos: *mut nftnl_rule); + + pub fn nftnl_rule_list_del(r: *mut nftnl_rule); + + pub fn nftnl_rule_list_foreach( + rule_list: *mut nftnl_rule_list, + cb: Option c_int>, + data: *mut c_void, + ) -> c_int; +} +#[repr(C)] +pub struct nftnl_rule_list_iter(c_void); + +extern "C" { + pub fn nftnl_rule_list_iter_create(l: *const nftnl_rule_list) -> *mut nftnl_rule_list_iter; + + pub fn nftnl_rule_list_iter_cur(iter: *mut nftnl_rule_list_iter) -> *mut nftnl_rule; + + pub fn nftnl_rule_list_iter_next(iter: *mut nftnl_rule_list_iter) -> *mut nftnl_rule; + + pub fn nftnl_rule_list_iter_destroy(iter: *const nftnl_rule_list_iter); +} +#[repr(C)] +pub struct nftnl_ruleset(c_void); + +extern "C" { + pub fn nftnl_ruleset_alloc() -> *mut nftnl_ruleset; + + pub fn nftnl_ruleset_free(r: *const nftnl_ruleset); +} +pub const NFTNL_RULESET_TABLELIST: u32 = 0; +pub const NFTNL_RULESET_CHAINLIST: u32 = 1; +pub const NFTNL_RULESET_SETLIST: u32 = 2; +pub const NFTNL_RULESET_RULELIST: u32 = 3; + +pub const NFTNL_RULESET_UNSPEC: nftnl_ruleset_type = 0; +pub const NFTNL_RULESET_RULESET: nftnl_ruleset_type = 1; +pub const NFTNL_RULESET_TABLE: nftnl_ruleset_type = 2; +pub const NFTNL_RULESET_CHAIN: nftnl_ruleset_type = 3; +pub const NFTNL_RULESET_RULE: nftnl_ruleset_type = 4; +pub const NFTNL_RULESET_SET: nftnl_ruleset_type = 5; +pub const NFTNL_RULESET_SET_ELEMS: nftnl_ruleset_type = 6; +pub type nftnl_ruleset_type = c_uint; +extern "C" { + pub fn nftnl_ruleset_is_set(r: *const nftnl_ruleset, attr: u16) -> bool; + + pub fn nftnl_ruleset_unset(r: *mut nftnl_ruleset, attr: u16); + + pub fn nftnl_ruleset_set(r: *mut nftnl_ruleset, attr: u16, data: *mut c_void); + + pub fn nftnl_ruleset_get(r: *const nftnl_ruleset, attr: u16) -> *mut c_void; +} +pub const NFTNL_RULESET_CTX_CMD: u32 = 0; +pub const NFTNL_RULESET_CTX_TYPE: u32 = 1; +pub const NFTNL_RULESET_CTX_TABLE: u32 = 2; +pub const NFTNL_RULESET_CTX_CHAIN: u32 = 3; +pub const NFTNL_RULESET_CTX_RULE: u32 = 4; +pub const NFTNL_RULESET_CTX_SET: u32 = 5; +pub const NFTNL_RULESET_CTX_DATA: u32 = 6; + +#[repr(C)] +pub struct nftnl_parse_ctx(c_void); + +extern "C" { + pub fn nftnl_ruleset_ctx_free(ctx: *const nftnl_parse_ctx); + + pub fn nftnl_ruleset_ctx_is_set(ctx: *const nftnl_parse_ctx, attr: u16) -> bool; + + pub fn nftnl_ruleset_ctx_get(ctx: *const nftnl_parse_ctx, attr: u16) -> *mut c_void; + + pub fn nftnl_ruleset_ctx_get_u32(ctx: *const nftnl_parse_ctx, attr: u16) -> u32; + + pub fn nftnl_ruleset_parse_file_cb( + type_: nftnl_parse_type, + fp: *mut FILE, + err: *mut nftnl_parse_err, + data: *mut c_void, + cb: Option c_int>, + ) -> c_int; + + pub fn nftnl_ruleset_parse_buffer_cb( + type_: nftnl_parse_type, + buffer: *const c_char, + err: *mut nftnl_parse_err, + data: *mut c_void, + cb: Option c_int>, + ) -> c_int; + + pub fn nftnl_ruleset_parse( + rs: *mut nftnl_ruleset, + type_: nftnl_parse_type, + data: *const c_char, + err: *mut nftnl_parse_err, + ) -> c_int; + + pub fn nftnl_ruleset_parse_file( + rs: *mut nftnl_ruleset, + type_: nftnl_parse_type, + fp: *mut FILE, + err: *mut nftnl_parse_err, + ) -> c_int; + + pub fn nftnl_ruleset_snprintf( + buf: *mut c_char, + size: usize, + rs: *const nftnl_ruleset, + type_: u32, + flags: u32, + ) -> c_int; + + pub fn nftnl_ruleset_fprintf( + fp: *mut FILE, + rs: *const nftnl_ruleset, + type_: u32, + flags: u32, + ) -> c_int; +} +pub const NFTNL_SET_TABLE: nftnl_set_attr = 0; +pub const NFTNL_SET_NAME: nftnl_set_attr = 1; +pub const NFTNL_SET_FLAGS: nftnl_set_attr = 2; +pub const NFTNL_SET_KEY_TYPE: nftnl_set_attr = 3; +pub const NFTNL_SET_KEY_LEN: nftnl_set_attr = 4; +pub const NFTNL_SET_DATA_TYPE: nftnl_set_attr = 5; +pub const NFTNL_SET_DATA_LEN: nftnl_set_attr = 6; +pub const NFTNL_SET_FAMILY: nftnl_set_attr = 7; +pub const NFTNL_SET_ID: nftnl_set_attr = 8; +pub const NFTNL_SET_POLICY: nftnl_set_attr = 9; +pub const NFTNL_SET_DESC_SIZE: nftnl_set_attr = 10; +pub const NFTNL_SET_TIMEOUT: nftnl_set_attr = 11; +pub const NFTNL_SET_GC_INTERVAL: nftnl_set_attr = 12; +pub const NFTNL_SET_USERDATA: nftnl_set_attr = 13; +pub const NFTNL_SET_OBJ_TYPE: nftnl_set_attr = 14; +pub const NFTNL_SET_HANDLE: nftnl_set_attr = 15; +pub const NFTNL_SET_DESC_CONCAT: nftnl_set_attr = 16; +pub const NFTNL_SET_EXPR: nftnl_set_attr = 17; +pub const NFTNL_SET_EXPRESSIONS: nftnl_set_attr = 18; +pub const __NFTNL_SET_MAX: nftnl_set_attr = 19; +pub type nftnl_set_attr = c_uint; +#[repr(C)] +pub struct nftnl_set(c_void); + +extern "C" { + pub fn nftnl_set_alloc() -> *mut nftnl_set; + + pub fn nftnl_set_free(s: *const nftnl_set); + + pub fn nftnl_set_clone(set: *const nftnl_set) -> *mut nftnl_set; + + pub fn nftnl_set_is_set(s: *const nftnl_set, attr: u16) -> bool; + + pub fn nftnl_set_unset(s: *mut nftnl_set, attr: u16); + + pub fn nftnl_set_set(s: *mut nftnl_set, attr: u16, data: *const c_void) -> c_int; + + pub fn nftnl_set_set_data( + s: *mut nftnl_set, + attr: u16, + data: *const c_void, + data_len: u32, + ) -> c_int; + + pub fn nftnl_set_set_u32(s: *mut nftnl_set, attr: u16, val: u32); + + pub fn nftnl_set_set_u64(s: *mut nftnl_set, attr: u16, val: u64); + + pub fn nftnl_set_set_str(s: *mut nftnl_set, attr: u16, str_: *const c_char) -> c_int; + + pub fn nftnl_set_get(s: *const nftnl_set, attr: u16) -> *const c_void; + + pub fn nftnl_set_get_data(s: *const nftnl_set, attr: u16, data_len: *mut u32) -> *const c_void; + + pub fn nftnl_set_get_str(s: *const nftnl_set, attr: u16) -> *const c_char; + + pub fn nftnl_set_get_u32(s: *const nftnl_set, attr: u16) -> u32; + + pub fn nftnl_set_get_u64(s: *const nftnl_set, attr: u16) -> u64; + + pub fn nftnl_set_nlmsg_build_payload(nlh: *mut nlmsghdr, s: *mut nftnl_set); + + pub fn nftnl_set_nlmsg_parse(nlh: *const nlmsghdr, s: *mut nftnl_set) -> c_int; + + pub fn nftnl_set_elems_nlmsg_parse(nlh: *const nlmsghdr, s: *mut nftnl_set) -> c_int; + + pub fn nftnl_set_snprintf( + buf: *mut c_char, + size: usize, + s: *const nftnl_set, + type_: u32, + flags: u32, + ) -> c_int; + + pub fn nftnl_set_fprintf(fp: *mut FILE, s: *const nftnl_set, type_: u32, flags: u32) -> c_int; +} +#[repr(C)] +pub struct nftnl_set_list(c_void); + +extern "C" { + pub fn nftnl_set_list_alloc() -> *mut nftnl_set_list; + + pub fn nftnl_set_list_free(list: *mut nftnl_set_list); + + pub fn nftnl_set_list_is_empty(list: *const nftnl_set_list) -> c_int; + + pub fn nftnl_set_list_add(s: *mut nftnl_set, list: *mut nftnl_set_list); + + pub fn nftnl_set_list_add_tail(s: *mut nftnl_set, list: *mut nftnl_set_list); + + pub fn nftnl_set_list_del(s: *mut nftnl_set); + + pub fn nftnl_set_list_foreach( + set_list: *mut nftnl_set_list, + cb: Option c_int>, + data: *mut c_void, + ) -> c_int; + + pub fn nftnl_set_list_lookup_byname( + set_list: *mut nftnl_set_list, + set: *const c_char, + ) -> *mut nftnl_set; + + pub fn nftnl_set_add_expr(s: *mut nftnl_set, expr: *mut nftnl_expr); + + pub fn nftnl_set_expr_foreach( + s: *const nftnl_set, + cb: Option c_int>, + data: *mut c_void, + ) -> c_int; +} +#[repr(C)] +pub struct nftnl_set_list_iter(c_void); + +extern "C" { + pub fn nftnl_set_list_iter_create(l: *const nftnl_set_list) -> *mut nftnl_set_list_iter; + + pub fn nftnl_set_list_iter_cur(iter: *const nftnl_set_list_iter) -> *mut nftnl_set; + + pub fn nftnl_set_list_iter_next(iter: *mut nftnl_set_list_iter) -> *mut nftnl_set; + + pub fn nftnl_set_list_iter_destroy(iter: *const nftnl_set_list_iter); + + pub fn nftnl_set_parse( + s: *mut nftnl_set, + type_: nftnl_parse_type, + data: *const c_char, + err: *mut nftnl_parse_err, + ) -> c_int; + + pub fn nftnl_set_parse_file( + s: *mut nftnl_set, + type_: nftnl_parse_type, + fp: *mut FILE, + err: *mut nftnl_parse_err, + ) -> c_int; +} +pub const NFTNL_SET_ELEM_FLAGS: u32 = 0; +pub const NFTNL_SET_ELEM_KEY: u32 = 1; +pub const NFTNL_SET_ELEM_VERDICT: u32 = 2; +pub const NFTNL_SET_ELEM_CHAIN: u32 = 3; +pub const NFTNL_SET_ELEM_DATA: u32 = 4; +pub const NFTNL_SET_ELEM_TIMEOUT: u32 = 5; +pub const NFTNL_SET_ELEM_EXPIRATION: u32 = 6; +pub const NFTNL_SET_ELEM_USERDATA: u32 = 7; +pub const NFTNL_SET_ELEM_EXPR: u32 = 8; +pub const NFTNL_SET_ELEM_OBJREF: u32 = 9; +pub const NFTNL_SET_ELEM_KEY_END: u32 = 10; +pub const NFTNL_SET_ELEM_EXPRESSIONS: u32 = 11; +pub const __NFTNL_SET_ELEM_MAX: u32 = 12; + +#[repr(C)] +pub struct nftnl_set_elem(c_void); + +extern "C" { + pub fn nftnl_set_elem_alloc() -> *mut nftnl_set_elem; + + pub fn nftnl_set_elem_free(s: *mut nftnl_set_elem); + + pub fn nftnl_set_elem_clone(elem: *mut nftnl_set_elem) -> *mut nftnl_set_elem; + + pub fn nftnl_set_elem_add(s: *mut nftnl_set, elem: *mut nftnl_set_elem); + + pub fn nftnl_set_elem_unset(s: *mut nftnl_set_elem, attr: u16); + + pub fn nftnl_set_elem_set( + s: *mut nftnl_set_elem, + attr: u16, + data: *const c_void, + data_len: u32, + ) -> c_int; + + pub fn nftnl_set_elem_set_u32(s: *mut nftnl_set_elem, attr: u16, val: u32); + + pub fn nftnl_set_elem_set_u64(s: *mut nftnl_set_elem, attr: u16, val: u64); + + pub fn nftnl_set_elem_set_str(s: *mut nftnl_set_elem, attr: u16, str_: *const c_char) -> c_int; + + pub fn nftnl_set_elem_get( + s: *mut nftnl_set_elem, + attr: u16, + data_len: *mut u32, + ) -> *const c_void; + + pub fn nftnl_set_elem_get_str(s: *mut nftnl_set_elem, attr: u16) -> *const c_char; + + pub fn nftnl_set_elem_get_u32(s: *mut nftnl_set_elem, attr: u16) -> u32; + + pub fn nftnl_set_elem_get_u64(s: *mut nftnl_set_elem, attr: u16) -> u64; + + pub fn nftnl_set_elem_is_set(s: *const nftnl_set_elem, attr: u16) -> bool; + + pub fn nftnl_set_elems_nlmsg_build_payload(nlh: *mut nlmsghdr, s: *mut nftnl_set); + + pub fn nftnl_set_elem_nlmsg_build_payload(nlh: *mut nlmsghdr, e: *mut nftnl_set_elem); +} +#[repr(C)] +pub struct nlattr(c_void); + +extern "C" { + pub fn nftnl_set_elem_nlmsg_build( + nlh: *mut nlmsghdr, + elem: *mut nftnl_set_elem, + i: c_int, + ) -> *mut nlattr; + + pub fn nftnl_set_elem_parse( + e: *mut nftnl_set_elem, + type_: nftnl_parse_type, + data: *const c_char, + err: *mut nftnl_parse_err, + ) -> c_int; + + pub fn nftnl_set_elem_parse_file( + e: *mut nftnl_set_elem, + type_: nftnl_parse_type, + fp: *mut FILE, + err: *mut nftnl_parse_err, + ) -> c_int; + + pub fn nftnl_set_elem_snprintf( + buf: *mut c_char, + size: usize, + s: *const nftnl_set_elem, + type_: u32, + flags: u32, + ) -> c_int; + + pub fn nftnl_set_elem_fprintf( + fp: *mut FILE, + se: *const nftnl_set_elem, + type_: u32, + flags: u32, + ) -> c_int; + + pub fn nftnl_set_elem_add_expr(e: *mut nftnl_set_elem, expr: *mut nftnl_expr); + + pub fn nftnl_set_elem_expr_foreach( + e: *mut nftnl_set_elem, + cb: Option c_int>, + data: *mut c_void, + ) -> c_int; + + pub fn nftnl_set_elem_foreach( + s: *mut nftnl_set, + cb: Option c_int>, + data: *mut c_void, + ) -> c_int; +} +#[repr(C)] +pub struct nftnl_set_elems_iter(c_void); + +extern "C" { + pub fn nftnl_set_elems_iter_create(s: *const nftnl_set) -> *mut nftnl_set_elems_iter; + + pub fn nftnl_set_elems_iter_cur(iter: *const nftnl_set_elems_iter) -> *mut nftnl_set_elem; + + pub fn nftnl_set_elems_iter_next(iter: *mut nftnl_set_elems_iter) -> *mut nftnl_set_elem; + + pub fn nftnl_set_elems_iter_destroy(iter: *mut nftnl_set_elems_iter); + + pub fn nftnl_set_elems_nlmsg_build_payload_iter( + nlh: *mut nlmsghdr, + iter: *mut nftnl_set_elems_iter, + ) -> c_int; +} +#[repr(C)] +pub struct nftnl_table(c_void); + +extern "C" { + pub fn nftnl_table_alloc() -> *mut nftnl_table; + + pub fn nftnl_table_free(arg1: *const nftnl_table); +} +pub const NFTNL_TABLE_NAME: nftnl_table_attr = 0; +pub const NFTNL_TABLE_FAMILY: nftnl_table_attr = 1; +pub const NFTNL_TABLE_FLAGS: nftnl_table_attr = 2; +pub const NFTNL_TABLE_USE: nftnl_table_attr = 3; +pub const NFTNL_TABLE_HANDLE: nftnl_table_attr = 4; +pub const NFTNL_TABLE_USERDATA: nftnl_table_attr = 5; +pub const NFTNL_TABLE_OWNER: nftnl_table_attr = 6; +pub const __NFTNL_TABLE_MAX: nftnl_table_attr = 7; +pub type nftnl_table_attr = c_uint; +extern "C" { + pub fn nftnl_table_is_set(t: *const nftnl_table, attr: u16) -> bool; + + pub fn nftnl_table_unset(t: *mut nftnl_table, attr: u16); + + pub fn nftnl_table_set(t: *mut nftnl_table, attr: u16, data: *const c_void); + + pub fn nftnl_table_set_data( + t: *mut nftnl_table, + attr: u16, + data: *const c_void, + data_len: u32, + ) -> c_int; + + pub fn nftnl_table_get(t: *const nftnl_table, attr: u16) -> *const c_void; + + pub fn nftnl_table_get_data( + t: *const nftnl_table, + attr: u16, + data_len: *mut u32, + ) -> *const c_void; + + pub fn nftnl_table_set_u8(t: *mut nftnl_table, attr: u16, data: u8); + + pub fn nftnl_table_set_u32(t: *mut nftnl_table, attr: u16, data: u32); + + pub fn nftnl_table_set_u64(t: *mut nftnl_table, attr: u16, data: u64); + + pub fn nftnl_table_set_str(t: *mut nftnl_table, attr: u16, str_: *const c_char) -> c_int; + + pub fn nftnl_table_get_u8(t: *const nftnl_table, attr: u16) -> u8; + + pub fn nftnl_table_get_u32(t: *const nftnl_table, attr: u16) -> u32; + + pub fn nftnl_table_get_u64(t: *const nftnl_table, attr: u16) -> u64; + + pub fn nftnl_table_get_str(t: *const nftnl_table, attr: u16) -> *const c_char; + + pub fn nftnl_table_nlmsg_build_payload(nlh: *mut nlmsghdr, t: *const nftnl_table); + + pub fn nftnl_table_parse( + t: *mut nftnl_table, + type_: nftnl_parse_type, + data: *const c_char, + err: *mut nftnl_parse_err, + ) -> c_int; + + pub fn nftnl_table_parse_file( + t: *mut nftnl_table, + type_: nftnl_parse_type, + fp: *mut FILE, + err: *mut nftnl_parse_err, + ) -> c_int; + + pub fn nftnl_table_snprintf( + buf: *mut c_char, + size: usize, + t: *const nftnl_table, + type_: u32, + flags: u32, + ) -> c_int; + + pub fn nftnl_table_fprintf( + fp: *mut FILE, + t: *const nftnl_table, + type_: u32, + flags: u32, + ) -> c_int; + + pub fn nftnl_table_nlmsg_parse(nlh: *const nlmsghdr, t: *mut nftnl_table) -> c_int; +} +#[repr(C)] +pub struct nftnl_table_list(c_void); + +extern "C" { + pub fn nftnl_table_list_alloc() -> *mut nftnl_table_list; + + pub fn nftnl_table_list_free(list: *mut nftnl_table_list); + + pub fn nftnl_table_list_is_empty(list: *const nftnl_table_list) -> c_int; + + pub fn nftnl_table_list_foreach( + table_list: *mut nftnl_table_list, + cb: Option c_int>, + data: *mut c_void, + ) -> c_int; + + pub fn nftnl_table_list_add(r: *mut nftnl_table, list: *mut nftnl_table_list); + + pub fn nftnl_table_list_add_tail(r: *mut nftnl_table, list: *mut nftnl_table_list); + + pub fn nftnl_table_list_del(r: *mut nftnl_table); +} +#[repr(C)] +pub struct nftnl_table_list_iter(c_void); + +extern "C" { + pub fn nftnl_table_list_iter_create(l: *const nftnl_table_list) -> *mut nftnl_table_list_iter; + + pub fn nftnl_table_list_iter_next(iter: *mut nftnl_table_list_iter) -> *mut nftnl_table; + + pub fn nftnl_table_list_iter_destroy(iter: *const nftnl_table_list_iter); +} +pub const NFTNL_TRACE_CHAIN: nftnl_trace_attr = 0; +pub const NFTNL_TRACE_FAMILY: nftnl_trace_attr = 1; +pub const NFTNL_TRACE_ID: nftnl_trace_attr = 2; +pub const NFTNL_TRACE_IIF: nftnl_trace_attr = 3; +pub const NFTNL_TRACE_IIFTYPE: nftnl_trace_attr = 4; +pub const NFTNL_TRACE_JUMP_TARGET: nftnl_trace_attr = 5; +pub const NFTNL_TRACE_OIF: nftnl_trace_attr = 6; +pub const NFTNL_TRACE_OIFTYPE: nftnl_trace_attr = 7; +pub const NFTNL_TRACE_MARK: nftnl_trace_attr = 8; +pub const NFTNL_TRACE_LL_HEADER: nftnl_trace_attr = 9; +pub const NFTNL_TRACE_NETWORK_HEADER: nftnl_trace_attr = 10; +pub const NFTNL_TRACE_TRANSPORT_HEADER: nftnl_trace_attr = 11; +pub const NFTNL_TRACE_TABLE: nftnl_trace_attr = 12; +pub const NFTNL_TRACE_TYPE: nftnl_trace_attr = 13; +pub const NFTNL_TRACE_RULE_HANDLE: nftnl_trace_attr = 14; +pub const NFTNL_TRACE_VERDICT: nftnl_trace_attr = 15; +pub const NFTNL_TRACE_NFPROTO: nftnl_trace_attr = 16; +pub const NFTNL_TRACE_POLICY: nftnl_trace_attr = 17; +pub const __NFTNL_TRACE_MAX: nftnl_trace_attr = 18; +pub type nftnl_trace_attr = c_uint; +#[repr(C)] +pub struct nftnl_trace(c_void); + +extern "C" { + pub fn nftnl_trace_alloc() -> *mut nftnl_trace; + + pub fn nftnl_trace_free(trace: *const nftnl_trace); + + pub fn nftnl_trace_is_set(trace: *const nftnl_trace, type_: u16) -> bool; + + pub fn nftnl_trace_get_data( + trace: *const nftnl_trace, + type_: u16, + data_len: *mut u32, + ) -> *const c_void; + + pub fn nftnl_trace_get_u16(trace: *const nftnl_trace, type_: u16) -> u16; + + pub fn nftnl_trace_get_u32(trace: *const nftnl_trace, type_: u16) -> u32; + + pub fn nftnl_trace_get_u64(trace: *const nftnl_trace, type_: u16) -> u64; + + pub fn nftnl_trace_get_str(trace: *const nftnl_trace, type_: u16) -> *const c_char; + + pub fn nftnl_trace_nlmsg_parse(nlh: *const nlmsghdr, t: *mut nftnl_trace) -> c_int; +} +pub const NFTNL_UDATA_TABLE_COMMENT: nftnl_udata_table_types = 0; +pub const __NFTNL_UDATA_TABLE_MAX: nftnl_udata_table_types = 1; +pub type nftnl_udata_table_types = c_uint; +pub const NFTNL_UDATA_CHAIN_COMMENT: nftnl_udata_chain_types = 0; +pub const __NFTNL_UDATA_CHAIN_MAX: nftnl_udata_chain_types = 1; +pub type nftnl_udata_chain_types = c_uint; +pub const NFTNL_UDATA_RULE_COMMENT: nftnl_udata_rule_types = 0; +pub const NFTNL_UDATA_RULE_EBTABLES_POLICY: nftnl_udata_rule_types = 1; +pub const __NFTNL_UDATA_RULE_MAX: nftnl_udata_rule_types = 2; +pub type nftnl_udata_rule_types = c_uint; +pub const NFTNL_UDATA_OBJ_COMMENT: nftnl_udata_obj_types = 0; +pub const __NFTNL_UDATA_OBJ_MAX: nftnl_udata_obj_types = 1; +pub type nftnl_udata_obj_types = c_uint; +pub const NFTNL_UDATA_SET_KEYBYTEORDER: nftnl_udata_set_types = 0; +pub const NFTNL_UDATA_SET_DATABYTEORDER: nftnl_udata_set_types = 1; +pub const NFTNL_UDATA_SET_MERGE_ELEMENTS: nftnl_udata_set_types = 2; +pub const NFTNL_UDATA_SET_KEY_TYPEOF: nftnl_udata_set_types = 3; +pub const NFTNL_UDATA_SET_DATA_TYPEOF: nftnl_udata_set_types = 4; +pub const NFTNL_UDATA_SET_EXPR: nftnl_udata_set_types = 5; +pub const NFTNL_UDATA_SET_DATA_INTERVAL: nftnl_udata_set_types = 6; +pub const NFTNL_UDATA_SET_COMMENT: nftnl_udata_set_types = 7; +pub const __NFTNL_UDATA_SET_MAX: nftnl_udata_set_types = 8; +pub type nftnl_udata_set_types = c_uint; +pub const NFTNL_UDATA_SET_TYPEOF_EXPR: u32 = 0; +pub const NFTNL_UDATA_SET_TYPEOF_DATA: u32 = 1; +pub const __NFTNL_UDATA_SET_TYPEOF_MAX: u32 = 2; + +pub const NFTNL_UDATA_SET_ELEM_COMMENT: nftnl_udata_set_elem_types = 0; +pub const NFTNL_UDATA_SET_ELEM_FLAGS: nftnl_udata_set_elem_types = 1; +pub const __NFTNL_UDATA_SET_ELEM_MAX: nftnl_udata_set_elem_types = 2; +pub type nftnl_udata_set_elem_types = c_uint; +pub const NFTNL_SET_ELEM_F_INTERVAL_OPEN: nftnl_udata_set_elem_flags = 1; +pub type nftnl_udata_set_elem_flags = c_uint; +#[repr(C)] +pub struct nftnl_udata(c_void); + +#[repr(C)] +pub struct nftnl_udata_buf(c_void); + +extern "C" { + pub fn nftnl_udata_buf_alloc(data_size: u32) -> *mut nftnl_udata_buf; + + pub fn nftnl_udata_buf_free(buf: *const nftnl_udata_buf); + + pub fn nftnl_udata_buf_len(buf: *const nftnl_udata_buf) -> u32; + + pub fn nftnl_udata_buf_data(buf: *const nftnl_udata_buf) -> *mut c_void; + + pub fn nftnl_udata_buf_put(buf: *mut nftnl_udata_buf, data: *const c_void, len: u32); + + pub fn nftnl_udata_start(buf: *const nftnl_udata_buf) -> *mut nftnl_udata; + + pub fn nftnl_udata_end(buf: *const nftnl_udata_buf) -> *mut nftnl_udata; + + pub fn nftnl_udata_put( + buf: *mut nftnl_udata_buf, + type_: u8, + len: u32, + value: *const c_void, + ) -> bool; + + pub fn nftnl_udata_put_u32(buf: *mut nftnl_udata_buf, type_: u8, data: u32) -> bool; + + pub fn nftnl_udata_put_strz(buf: *mut nftnl_udata_buf, type_: u8, strz: *const c_char) -> bool; + + pub fn nftnl_udata_nest_start(buf: *mut nftnl_udata_buf, type_: u8) -> *mut nftnl_udata; + + pub fn nftnl_udata_nest_end(buf: *mut nftnl_udata_buf, ud: *mut nftnl_udata); + + pub fn nftnl_udata_type(attr: *const nftnl_udata) -> u8; + + pub fn nftnl_udata_len(attr: *const nftnl_udata) -> u8; + + pub fn nftnl_udata_get(attr: *const nftnl_udata) -> *mut c_void; + + pub fn nftnl_udata_get_u32(attr: *const nftnl_udata) -> u32; + + pub fn nftnl_udata_next(attr: *const nftnl_udata) -> *mut nftnl_udata; +} +pub type nftnl_udata_cb_t = + Option c_int>; +extern "C" { + pub fn nftnl_udata_parse( + data: *const c_void, + data_len: u32, + cb: nftnl_udata_cb_t, + cb_data: *mut c_void, + ) -> c_int; +} diff --git a/nftnl-sys/src/nftnl_1_2_4.rs b/nftnl-sys/src/nftnl_1_2_4.rs new file mode 100644 index 0000000..c9f128f --- /dev/null +++ b/nftnl-sys/src/nftnl_1_2_4.rs @@ -0,0 +1,1489 @@ +/* automatically generated by rust-bindgen 0.69.4 */ + +use core::option::Option; +use libc::{c_char, c_int, c_uint, c_void, iovec, nlmsghdr, FILE}; + +pub const NFTNL_UDATA_COMMENT_MAXLEN: u32 = 128; +#[repr(C)] +pub struct nftnl_batch(c_void); + +extern "C" { + pub fn nftnl_batch_alloc(pg_size: u32, pg_overrun_size: u32) -> *mut nftnl_batch; + + pub fn nftnl_batch_update(batch: *mut nftnl_batch) -> c_int; + + pub fn nftnl_batch_free(batch: *mut nftnl_batch); + + pub fn nftnl_batch_buffer(batch: *mut nftnl_batch) -> *mut c_void; + + pub fn nftnl_batch_buffer_len(batch: *mut nftnl_batch) -> u32; + + pub fn nftnl_batch_iovec_len(batch: *mut nftnl_batch) -> c_int; + + pub fn nftnl_batch_iovec(batch: *mut nftnl_batch, iov: *mut iovec, iovlen: u32); +} +pub const NFTNL_PARSE_EBADINPUT: u32 = 0; +pub const NFTNL_PARSE_EMISSINGNODE: u32 = 1; +pub const NFTNL_PARSE_EBADTYPE: u32 = 2; +pub const NFTNL_PARSE_EOPNOTSUPP: u32 = 3; + +pub const NFTNL_OUTPUT_DEFAULT: nftnl_output_type = 0; +pub const NFTNL_OUTPUT_XML: nftnl_output_type = 1; +pub const NFTNL_OUTPUT_JSON: nftnl_output_type = 2; +pub type nftnl_output_type = c_uint; +pub const NFTNL_OF_EVENT_NEW: nftnl_output_flags = 1; +pub const NFTNL_OF_EVENT_DEL: nftnl_output_flags = 2; +pub const NFTNL_OF_EVENT_ANY: nftnl_output_flags = 3; +pub type nftnl_output_flags = c_uint; +pub const NFTNL_CMD_UNSPEC: nftnl_cmd_type = 0; +pub const NFTNL_CMD_ADD: nftnl_cmd_type = 1; +pub const NFTNL_CMD_INSERT: nftnl_cmd_type = 2; +pub const NFTNL_CMD_DELETE: nftnl_cmd_type = 3; +pub const NFTNL_CMD_REPLACE: nftnl_cmd_type = 4; +pub const NFTNL_CMD_FLUSH: nftnl_cmd_type = 5; +pub const NFTNL_CMD_MAX: nftnl_cmd_type = 6; +pub type nftnl_cmd_type = c_uint; +pub const NFTNL_PARSE_NONE: nftnl_parse_type = 0; +pub const NFTNL_PARSE_XML: nftnl_parse_type = 1; +pub const NFTNL_PARSE_JSON: nftnl_parse_type = 2; +pub const NFTNL_PARSE_MAX: nftnl_parse_type = 3; +pub type nftnl_parse_type = c_uint; +#[repr(C)] +pub struct nftnl_parse_err(c_void); + +extern "C" { + pub fn nftnl_nlmsg_build_hdr( + buf: *mut c_char, + type_: u16, + family: u16, + flags: u16, + seq: u32, + ) -> *mut nlmsghdr; + + pub fn nftnl_parse_err_alloc() -> *mut nftnl_parse_err; + + pub fn nftnl_parse_err_free(arg1: *mut nftnl_parse_err); + + pub fn nftnl_parse_perror(str_: *const c_char, err: *mut nftnl_parse_err) -> c_int; + + pub fn nftnl_batch_is_supported() -> c_int; + + pub fn nftnl_batch_begin(buf: *mut c_char, seq: u32) -> *mut nlmsghdr; + + pub fn nftnl_batch_end(buf: *mut c_char, seq: u32) -> *mut nlmsghdr; +} +#[repr(C)] +pub struct nftnl_chain(c_void); + +#[repr(C)] +pub struct nftnl_rule(c_void); + +extern "C" { + pub fn nftnl_chain_alloc() -> *mut nftnl_chain; + + pub fn nftnl_chain_free(arg1: *const nftnl_chain); +} +pub const NFTNL_CHAIN_NAME: nftnl_chain_attr = 0; +pub const NFTNL_CHAIN_FAMILY: nftnl_chain_attr = 1; +pub const NFTNL_CHAIN_TABLE: nftnl_chain_attr = 2; +pub const NFTNL_CHAIN_HOOKNUM: nftnl_chain_attr = 3; +pub const NFTNL_CHAIN_PRIO: nftnl_chain_attr = 4; +pub const NFTNL_CHAIN_POLICY: nftnl_chain_attr = 5; +pub const NFTNL_CHAIN_USE: nftnl_chain_attr = 6; +pub const NFTNL_CHAIN_BYTES: nftnl_chain_attr = 7; +pub const NFTNL_CHAIN_PACKETS: nftnl_chain_attr = 8; +pub const NFTNL_CHAIN_HANDLE: nftnl_chain_attr = 9; +pub const NFTNL_CHAIN_TYPE: nftnl_chain_attr = 10; +pub const NFTNL_CHAIN_DEV: nftnl_chain_attr = 11; +pub const NFTNL_CHAIN_DEVICES: nftnl_chain_attr = 12; +pub const NFTNL_CHAIN_FLAGS: nftnl_chain_attr = 13; +pub const NFTNL_CHAIN_ID: nftnl_chain_attr = 14; +pub const NFTNL_CHAIN_USERDATA: nftnl_chain_attr = 15; +pub const __NFTNL_CHAIN_MAX: nftnl_chain_attr = 16; +pub type nftnl_chain_attr = c_uint; +extern "C" { + pub fn nftnl_chain_is_set(c: *const nftnl_chain, attr: u16) -> bool; + + pub fn nftnl_chain_unset(c: *mut nftnl_chain, attr: u16); + + pub fn nftnl_chain_set(t: *mut nftnl_chain, attr: u16, data: *const c_void); + + pub fn nftnl_chain_set_data( + t: *mut nftnl_chain, + attr: u16, + data: *const c_void, + data_len: u32, + ) -> c_int; + + pub fn nftnl_chain_set_u8(t: *mut nftnl_chain, attr: u16, data: u8); + + pub fn nftnl_chain_set_u32(t: *mut nftnl_chain, attr: u16, data: u32); + + pub fn nftnl_chain_set_s32(t: *mut nftnl_chain, attr: u16, data: i32); + + pub fn nftnl_chain_set_u64(t: *mut nftnl_chain, attr: u16, data: u64); + + pub fn nftnl_chain_set_str(t: *mut nftnl_chain, attr: u16, str_: *const c_char) -> c_int; + + pub fn nftnl_chain_set_array(t: *mut nftnl_chain, attr: u16, data: *mut *const c_char) + -> c_int; + + pub fn nftnl_chain_get(c: *const nftnl_chain, attr: u16) -> *const c_void; + + pub fn nftnl_chain_get_data( + c: *const nftnl_chain, + attr: u16, + data_len: *mut u32, + ) -> *const c_void; + + pub fn nftnl_chain_get_str(c: *const nftnl_chain, attr: u16) -> *const c_char; + + pub fn nftnl_chain_get_u8(c: *const nftnl_chain, attr: u16) -> u8; + + pub fn nftnl_chain_get_u32(c: *const nftnl_chain, attr: u16) -> u32; + + pub fn nftnl_chain_get_s32(c: *const nftnl_chain, attr: u16) -> i32; + + pub fn nftnl_chain_get_u64(c: *const nftnl_chain, attr: u16) -> u64; + + pub fn nftnl_chain_get_array(c: *const nftnl_chain, attr: u16) -> *const *const c_char; + + pub fn nftnl_chain_rule_add(rule: *mut nftnl_rule, c: *mut nftnl_chain); + + pub fn nftnl_chain_rule_del(rule: *mut nftnl_rule); + + pub fn nftnl_chain_rule_add_tail(rule: *mut nftnl_rule, c: *mut nftnl_chain); + + pub fn nftnl_chain_rule_insert_at(rule: *mut nftnl_rule, pos: *mut nftnl_rule); + + pub fn nftnl_chain_rule_append_at(rule: *mut nftnl_rule, pos: *mut nftnl_rule); + + pub fn nftnl_chain_nlmsg_build_payload(nlh: *mut nlmsghdr, t: *const nftnl_chain); + + pub fn nftnl_chain_parse( + c: *mut nftnl_chain, + type_: nftnl_parse_type, + data: *const c_char, + err: *mut nftnl_parse_err, + ) -> c_int; + + pub fn nftnl_chain_parse_file( + c: *mut nftnl_chain, + type_: nftnl_parse_type, + fp: *mut FILE, + err: *mut nftnl_parse_err, + ) -> c_int; + + pub fn nftnl_chain_snprintf( + buf: *mut c_char, + size: usize, + t: *const nftnl_chain, + type_: u32, + flags: u32, + ) -> c_int; + + pub fn nftnl_chain_fprintf( + fp: *mut FILE, + c: *const nftnl_chain, + type_: u32, + flags: u32, + ) -> c_int; + + pub fn nftnl_chain_nlmsg_parse(nlh: *const nlmsghdr, t: *mut nftnl_chain) -> c_int; + + pub fn nftnl_rule_foreach( + c: *mut nftnl_chain, + cb: Option c_int>, + data: *mut c_void, + ) -> c_int; + + pub fn nftnl_rule_lookup_byindex(c: *mut nftnl_chain, index: u32) -> *mut nftnl_rule; +} +#[repr(C)] +pub struct nftnl_rule_iter(c_void); + +extern "C" { + pub fn nftnl_rule_iter_create(c: *const nftnl_chain) -> *mut nftnl_rule_iter; + + pub fn nftnl_rule_iter_next(iter: *mut nftnl_rule_iter) -> *mut nftnl_rule; + + pub fn nftnl_rule_iter_destroy(iter: *mut nftnl_rule_iter); +} +#[repr(C)] +pub struct nftnl_chain_list(c_void); + +extern "C" { + pub fn nftnl_chain_list_alloc() -> *mut nftnl_chain_list; + + pub fn nftnl_chain_list_free(list: *mut nftnl_chain_list); + + pub fn nftnl_chain_list_is_empty(list: *const nftnl_chain_list) -> c_int; + + pub fn nftnl_chain_list_foreach( + chain_list: *mut nftnl_chain_list, + cb: Option c_int>, + data: *mut c_void, + ) -> c_int; + + pub fn nftnl_chain_list_lookup_byname( + chain_list: *mut nftnl_chain_list, + chain: *const c_char, + ) -> *mut nftnl_chain; + + pub fn nftnl_chain_list_add(r: *mut nftnl_chain, list: *mut nftnl_chain_list); + + pub fn nftnl_chain_list_add_tail(r: *mut nftnl_chain, list: *mut nftnl_chain_list); + + pub fn nftnl_chain_list_del(c: *mut nftnl_chain); +} +#[repr(C)] +pub struct nftnl_chain_list_iter(c_void); + +extern "C" { + pub fn nftnl_chain_list_iter_create(l: *const nftnl_chain_list) -> *mut nftnl_chain_list_iter; + + pub fn nftnl_chain_list_iter_next(iter: *mut nftnl_chain_list_iter) -> *mut nftnl_chain; + + pub fn nftnl_chain_list_iter_destroy(iter: *mut nftnl_chain_list_iter); +} +#[repr(C)] +pub struct nftnl_expr(c_void); + +pub const NFTNL_EXPR_NAME: u32 = 0; +pub const NFTNL_EXPR_BASE: u32 = 1; + +extern "C" { + pub fn nftnl_expr_alloc(name: *const c_char) -> *mut nftnl_expr; + + pub fn nftnl_expr_free(expr: *const nftnl_expr); + + pub fn nftnl_expr_is_set(expr: *const nftnl_expr, type_: u16) -> bool; + + pub fn nftnl_expr_set( + expr: *mut nftnl_expr, + type_: u16, + data: *const c_void, + data_len: u32, + ) -> c_int; + + pub fn nftnl_expr_set_u8(expr: *mut nftnl_expr, type_: u16, data: u8); + + pub fn nftnl_expr_set_u16(expr: *mut nftnl_expr, type_: u16, data: u16); + + pub fn nftnl_expr_set_u32(expr: *mut nftnl_expr, type_: u16, data: u32); + + pub fn nftnl_expr_set_u64(expr: *mut nftnl_expr, type_: u16, data: u64); + + pub fn nftnl_expr_set_str(expr: *mut nftnl_expr, type_: u16, str_: *const c_char) -> c_int; + + pub fn nftnl_expr_get(expr: *const nftnl_expr, type_: u16, data_len: *mut u32) + -> *const c_void; + + pub fn nftnl_expr_get_u8(expr: *const nftnl_expr, type_: u16) -> u8; + + pub fn nftnl_expr_get_u16(expr: *const nftnl_expr, type_: u16) -> u16; + + pub fn nftnl_expr_get_u32(expr: *const nftnl_expr, type_: u16) -> u32; + + pub fn nftnl_expr_get_u64(expr: *const nftnl_expr, type_: u16) -> u64; + + pub fn nftnl_expr_get_str(expr: *const nftnl_expr, type_: u16) -> *const c_char; + + pub fn nftnl_expr_build_payload(nlh: *mut nlmsghdr, expr: *mut nftnl_expr); + + pub fn nftnl_expr_add_expr(expr: *mut nftnl_expr, type_: u32, e: *mut nftnl_expr); + + pub fn nftnl_expr_expr_foreach( + e: *const nftnl_expr, + cb: Option c_int>, + data: *mut c_void, + ) -> c_int; + + pub fn nftnl_expr_snprintf( + buf: *mut c_char, + buflen: usize, + expr: *const nftnl_expr, + type_: u32, + flags: u32, + ) -> c_int; + + pub fn nftnl_expr_fprintf( + fp: *mut FILE, + expr: *const nftnl_expr, + type_: u32, + flags: u32, + ) -> c_int; +} +pub const NFTNL_EXPR_PAYLOAD_DREG: u32 = 1; +pub const NFTNL_EXPR_PAYLOAD_BASE: u32 = 2; +pub const NFTNL_EXPR_PAYLOAD_OFFSET: u32 = 3; +pub const NFTNL_EXPR_PAYLOAD_LEN: u32 = 4; +pub const NFTNL_EXPR_PAYLOAD_SREG: u32 = 5; +pub const NFTNL_EXPR_PAYLOAD_CSUM_TYPE: u32 = 6; +pub const NFTNL_EXPR_PAYLOAD_CSUM_OFFSET: u32 = 7; +pub const NFTNL_EXPR_PAYLOAD_FLAGS: u32 = 8; + +pub const NFTNL_EXPR_NG_DREG: u32 = 1; +pub const NFTNL_EXPR_NG_MODULUS: u32 = 2; +pub const NFTNL_EXPR_NG_TYPE: u32 = 3; +pub const NFTNL_EXPR_NG_OFFSET: u32 = 4; +pub const NFTNL_EXPR_NG_SET_NAME: u32 = 5; +pub const NFTNL_EXPR_NG_SET_ID: u32 = 6; + +pub const NFTNL_EXPR_META_KEY: u32 = 1; +pub const NFTNL_EXPR_META_DREG: u32 = 2; +pub const NFTNL_EXPR_META_SREG: u32 = 3; + +pub const NFTNL_EXPR_RT_KEY: u32 = 1; +pub const NFTNL_EXPR_RT_DREG: u32 = 2; + +pub const NFTNL_EXPR_SOCKET_KEY: u32 = 1; +pub const NFTNL_EXPR_SOCKET_DREG: u32 = 2; +pub const NFTNL_EXPR_SOCKET_LEVEL: u32 = 3; + +pub const NFTNL_EXPR_TUNNEL_KEY: u32 = 1; +pub const NFTNL_EXPR_TUNNEL_DREG: u32 = 2; + +pub const NFTNL_EXPR_CMP_SREG: u32 = 1; +pub const NFTNL_EXPR_CMP_OP: u32 = 2; +pub const NFTNL_EXPR_CMP_DATA: u32 = 3; + +pub const NFTNL_EXPR_RANGE_SREG: u32 = 1; +pub const NFTNL_EXPR_RANGE_OP: u32 = 2; +pub const NFTNL_EXPR_RANGE_FROM_DATA: u32 = 3; +pub const NFTNL_EXPR_RANGE_TO_DATA: u32 = 4; + +pub const NFTNL_EXPR_IMM_DREG: u32 = 1; +pub const NFTNL_EXPR_IMM_DATA: u32 = 2; +pub const NFTNL_EXPR_IMM_VERDICT: u32 = 3; +pub const NFTNL_EXPR_IMM_CHAIN: u32 = 4; +pub const NFTNL_EXPR_IMM_CHAIN_ID: u32 = 5; + +pub const NFTNL_EXPR_CTR_PACKETS: u32 = 1; +pub const NFTNL_EXPR_CTR_BYTES: u32 = 2; + +pub const NFTNL_EXPR_CONNLIMIT_COUNT: u32 = 1; +pub const NFTNL_EXPR_CONNLIMIT_FLAGS: u32 = 2; + +pub const NFTNL_EXPR_BITWISE_SREG: u32 = 1; +pub const NFTNL_EXPR_BITWISE_DREG: u32 = 2; +pub const NFTNL_EXPR_BITWISE_LEN: u32 = 3; +pub const NFTNL_EXPR_BITWISE_MASK: u32 = 4; +pub const NFTNL_EXPR_BITWISE_XOR: u32 = 5; +pub const NFTNL_EXPR_BITWISE_OP: u32 = 6; +pub const NFTNL_EXPR_BITWISE_DATA: u32 = 7; + +pub const NFTNL_EXPR_TG_NAME: u32 = 1; +pub const NFTNL_EXPR_TG_REV: u32 = 2; +pub const NFTNL_EXPR_TG_INFO: u32 = 3; + +pub const NFTNL_EXPR_MT_NAME: u32 = 1; +pub const NFTNL_EXPR_MT_REV: u32 = 2; +pub const NFTNL_EXPR_MT_INFO: u32 = 3; + +pub const NFTNL_EXPR_NAT_TYPE: u32 = 1; +pub const NFTNL_EXPR_NAT_FAMILY: u32 = 2; +pub const NFTNL_EXPR_NAT_REG_ADDR_MIN: u32 = 3; +pub const NFTNL_EXPR_NAT_REG_ADDR_MAX: u32 = 4; +pub const NFTNL_EXPR_NAT_REG_PROTO_MIN: u32 = 5; +pub const NFTNL_EXPR_NAT_REG_PROTO_MAX: u32 = 6; +pub const NFTNL_EXPR_NAT_FLAGS: u32 = 7; + +pub const NFTNL_EXPR_TPROXY_FAMILY: u32 = 1; +pub const NFTNL_EXPR_TPROXY_REG_ADDR: u32 = 2; +pub const NFTNL_EXPR_TPROXY_REG_PORT: u32 = 3; + +pub const NFTNL_EXPR_LOOKUP_SREG: u32 = 1; +pub const NFTNL_EXPR_LOOKUP_DREG: u32 = 2; +pub const NFTNL_EXPR_LOOKUP_SET: u32 = 3; +pub const NFTNL_EXPR_LOOKUP_SET_ID: u32 = 4; +pub const NFTNL_EXPR_LOOKUP_FLAGS: u32 = 5; + +pub const NFTNL_EXPR_DYNSET_SREG_KEY: u32 = 1; +pub const NFTNL_EXPR_DYNSET_SREG_DATA: u32 = 2; +pub const NFTNL_EXPR_DYNSET_OP: u32 = 3; +pub const NFTNL_EXPR_DYNSET_TIMEOUT: u32 = 4; +pub const NFTNL_EXPR_DYNSET_SET_NAME: u32 = 5; +pub const NFTNL_EXPR_DYNSET_SET_ID: u32 = 6; +pub const NFTNL_EXPR_DYNSET_EXPR: u32 = 7; +pub const NFTNL_EXPR_DYNSET_EXPRESSIONS: u32 = 8; +pub const NFTNL_EXPR_DYNSET_FLAGS: u32 = 9; + +pub const NFTNL_EXPR_LOG_PREFIX: u32 = 1; +pub const NFTNL_EXPR_LOG_GROUP: u32 = 2; +pub const NFTNL_EXPR_LOG_SNAPLEN: u32 = 3; +pub const NFTNL_EXPR_LOG_QTHRESHOLD: u32 = 4; +pub const NFTNL_EXPR_LOG_LEVEL: u32 = 5; +pub const NFTNL_EXPR_LOG_FLAGS: u32 = 6; + +pub const NFTNL_EXPR_EXTHDR_DREG: u32 = 1; +pub const NFTNL_EXPR_EXTHDR_TYPE: u32 = 2; +pub const NFTNL_EXPR_EXTHDR_OFFSET: u32 = 3; +pub const NFTNL_EXPR_EXTHDR_LEN: u32 = 4; +pub const NFTNL_EXPR_EXTHDR_FLAGS: u32 = 5; +pub const NFTNL_EXPR_EXTHDR_OP: u32 = 6; +pub const NFTNL_EXPR_EXTHDR_SREG: u32 = 7; + +pub const NFTNL_EXPR_CT_DREG: u32 = 1; +pub const NFTNL_EXPR_CT_KEY: u32 = 2; +pub const NFTNL_EXPR_CT_DIR: u32 = 3; +pub const NFTNL_EXPR_CT_SREG: u32 = 4; + +pub const NFTNL_EXPR_BYTEORDER_DREG: u32 = 1; +pub const NFTNL_EXPR_BYTEORDER_SREG: u32 = 2; +pub const NFTNL_EXPR_BYTEORDER_OP: u32 = 3; +pub const NFTNL_EXPR_BYTEORDER_LEN: u32 = 4; +pub const NFTNL_EXPR_BYTEORDER_SIZE: u32 = 5; + +pub const NFTNL_EXPR_LIMIT_RATE: u32 = 1; +pub const NFTNL_EXPR_LIMIT_UNIT: u32 = 2; +pub const NFTNL_EXPR_LIMIT_BURST: u32 = 3; +pub const NFTNL_EXPR_LIMIT_TYPE: u32 = 4; +pub const NFTNL_EXPR_LIMIT_FLAGS: u32 = 5; + +pub const NFTNL_EXPR_REJECT_TYPE: u32 = 1; +pub const NFTNL_EXPR_REJECT_CODE: u32 = 2; + +pub const NFTNL_EXPR_QUEUE_NUM: u32 = 1; +pub const NFTNL_EXPR_QUEUE_TOTAL: u32 = 2; +pub const NFTNL_EXPR_QUEUE_FLAGS: u32 = 3; +pub const NFTNL_EXPR_QUEUE_SREG_QNUM: u32 = 4; + +pub const NFTNL_EXPR_QUOTA_BYTES: u32 = 1; +pub const NFTNL_EXPR_QUOTA_FLAGS: u32 = 2; +pub const NFTNL_EXPR_QUOTA_CONSUMED: u32 = 3; + +pub const NFTNL_EXPR_MASQ_FLAGS: u32 = 1; +pub const NFTNL_EXPR_MASQ_REG_PROTO_MIN: u32 = 2; +pub const NFTNL_EXPR_MASQ_REG_PROTO_MAX: u32 = 3; + +pub const NFTNL_EXPR_REDIR_REG_PROTO_MIN: u32 = 1; +pub const NFTNL_EXPR_REDIR_REG_PROTO_MAX: u32 = 2; +pub const NFTNL_EXPR_REDIR_FLAGS: u32 = 3; + +pub const NFTNL_EXPR_DUP_SREG_ADDR: u32 = 1; +pub const NFTNL_EXPR_DUP_SREG_DEV: u32 = 2; + +pub const NFTNL_EXPR_FLOW_TABLE_NAME: u32 = 1; + +pub const NFTNL_EXPR_FWD_SREG_DEV: u32 = 1; +pub const NFTNL_EXPR_FWD_SREG_ADDR: u32 = 2; +pub const NFTNL_EXPR_FWD_NFPROTO: u32 = 3; + +pub const NFTNL_EXPR_HASH_SREG: u32 = 1; +pub const NFTNL_EXPR_HASH_DREG: u32 = 2; +pub const NFTNL_EXPR_HASH_LEN: u32 = 3; +pub const NFTNL_EXPR_HASH_MODULUS: u32 = 4; +pub const NFTNL_EXPR_HASH_SEED: u32 = 5; +pub const NFTNL_EXPR_HASH_OFFSET: u32 = 6; +pub const NFTNL_EXPR_HASH_TYPE: u32 = 7; +pub const NFTNL_EXPR_HASH_SET_NAME: u32 = 8; +pub const NFTNL_EXPR_HASH_SET_ID: u32 = 9; + +pub const NFTNL_EXPR_FIB_DREG: u32 = 1; +pub const NFTNL_EXPR_FIB_RESULT: u32 = 2; +pub const NFTNL_EXPR_FIB_FLAGS: u32 = 3; + +pub const NFTNL_EXPR_OBJREF_IMM_TYPE: u32 = 1; +pub const NFTNL_EXPR_OBJREF_IMM_NAME: u32 = 2; +pub const NFTNL_EXPR_OBJREF_SET_SREG: u32 = 3; +pub const NFTNL_EXPR_OBJREF_SET_NAME: u32 = 4; +pub const NFTNL_EXPR_OBJREF_SET_ID: u32 = 5; + +pub const NFTNL_EXPR_OSF_DREG: u32 = 1; +pub const NFTNL_EXPR_OSF_TTL: u32 = 2; +pub const NFTNL_EXPR_OSF_FLAGS: u32 = 3; + +pub const NFTNL_EXPR_XFRM_DREG: u32 = 1; +pub const NFTNL_EXPR_XFRM_SREG: u32 = 2; +pub const NFTNL_EXPR_XFRM_KEY: u32 = 3; +pub const NFTNL_EXPR_XFRM_DIR: u32 = 4; +pub const NFTNL_EXPR_XFRM_SPNUM: u32 = 5; + +pub const NFTNL_EXPR_SYNPROXY_MSS: u32 = 1; +pub const NFTNL_EXPR_SYNPROXY_WSCALE: u32 = 2; +pub const NFTNL_EXPR_SYNPROXY_FLAGS: u32 = 3; + +pub const NFTNL_EXPR_LAST_MSECS: u32 = 1; +pub const NFTNL_EXPR_LAST_SET: u32 = 2; + +#[repr(C)] +pub struct nftnl_gen(c_void); + +extern "C" { + pub fn nftnl_gen_alloc() -> *mut nftnl_gen; + + pub fn nftnl_gen_free(arg1: *const nftnl_gen); +} +pub const NFTNL_GEN_ID: u32 = 0; +pub const __NFTNL_GEN_MAX: u32 = 1; + +extern "C" { + pub fn nftnl_gen_is_set(gen: *const nftnl_gen, attr: u16) -> bool; + + pub fn nftnl_gen_unset(gen: *mut nftnl_gen, attr: u16); + + pub fn nftnl_gen_set(gen: *mut nftnl_gen, attr: u16, data: *const c_void) -> c_int; + + pub fn nftnl_gen_set_data( + gen: *mut nftnl_gen, + attr: u16, + data: *const c_void, + data_len: u32, + ) -> c_int; + + pub fn nftnl_gen_get(gen: *const nftnl_gen, attr: u16) -> *const c_void; + + pub fn nftnl_gen_get_data( + gen: *const nftnl_gen, + attr: u16, + data_len: *mut u32, + ) -> *const c_void; + + pub fn nftnl_gen_set_u32(gen: *mut nftnl_gen, attr: u16, data: u32); + + pub fn nftnl_gen_get_u32(gen: *const nftnl_gen, attr: u16) -> u32; + + pub fn nftnl_gen_nlmsg_parse(nlh: *const nlmsghdr, gen: *mut nftnl_gen) -> c_int; + + pub fn nftnl_gen_snprintf( + buf: *mut c_char, + size: usize, + gen: *const nftnl_gen, + type_: u32, + flags: u32, + ) -> c_int; + + pub fn nftnl_gen_fprintf(fp: *mut FILE, gen: *const nftnl_gen, type_: u32, flags: u32) + -> c_int; +} +pub const NFTNL_OBJ_TABLE: u32 = 0; +pub const NFTNL_OBJ_NAME: u32 = 1; +pub const NFTNL_OBJ_TYPE: u32 = 2; +pub const NFTNL_OBJ_FAMILY: u32 = 3; +pub const NFTNL_OBJ_USE: u32 = 4; +pub const NFTNL_OBJ_HANDLE: u32 = 5; +pub const NFTNL_OBJ_USERDATA: u32 = 6; +pub const NFTNL_OBJ_BASE: u32 = 16; +pub const __NFTNL_OBJ_MAX: u32 = 17; + +pub const NFTNL_OBJ_CTR_PKTS: u32 = 16; +pub const NFTNL_OBJ_CTR_BYTES: u32 = 17; + +pub const NFTNL_OBJ_QUOTA_BYTES: u32 = 16; +pub const NFTNL_OBJ_QUOTA_CONSUMED: u32 = 17; +pub const NFTNL_OBJ_QUOTA_FLAGS: u32 = 18; + +pub const NFTNL_OBJ_CT_HELPER_NAME: u32 = 16; +pub const NFTNL_OBJ_CT_HELPER_L3PROTO: u32 = 17; +pub const NFTNL_OBJ_CT_HELPER_L4PROTO: u32 = 18; + +pub const NFTNL_CTTIMEOUT_TCP_SYN_SENT: nftnl_cttimeout_array_tcp = 0; +pub const NFTNL_CTTIMEOUT_TCP_SYN_RECV: nftnl_cttimeout_array_tcp = 1; +pub const NFTNL_CTTIMEOUT_TCP_ESTABLISHED: nftnl_cttimeout_array_tcp = 2; +pub const NFTNL_CTTIMEOUT_TCP_FIN_WAIT: nftnl_cttimeout_array_tcp = 3; +pub const NFTNL_CTTIMEOUT_TCP_CLOSE_WAIT: nftnl_cttimeout_array_tcp = 4; +pub const NFTNL_CTTIMEOUT_TCP_LAST_ACK: nftnl_cttimeout_array_tcp = 5; +pub const NFTNL_CTTIMEOUT_TCP_TIME_WAIT: nftnl_cttimeout_array_tcp = 6; +pub const NFTNL_CTTIMEOUT_TCP_CLOSE: nftnl_cttimeout_array_tcp = 7; +pub const NFTNL_CTTIMEOUT_TCP_SYN_SENT2: nftnl_cttimeout_array_tcp = 8; +pub const NFTNL_CTTIMEOUT_TCP_RETRANS: nftnl_cttimeout_array_tcp = 9; +pub const NFTNL_CTTIMEOUT_TCP_UNACK: nftnl_cttimeout_array_tcp = 10; +pub const NFTNL_CTTIMEOUT_TCP_MAX: nftnl_cttimeout_array_tcp = 11; +pub type nftnl_cttimeout_array_tcp = c_uint; +pub const NFTNL_CTTIMEOUT_UDP_UNREPLIED: nftnl_cttimeout_array_udp = 0; +pub const NFTNL_CTTIMEOUT_UDP_REPLIED: nftnl_cttimeout_array_udp = 1; +pub const NFTNL_CTTIMEOUT_UDP_MAX: nftnl_cttimeout_array_udp = 2; +pub type nftnl_cttimeout_array_udp = c_uint; +pub const NFTNL_OBJ_CT_TIMEOUT_L3PROTO: u32 = 16; +pub const NFTNL_OBJ_CT_TIMEOUT_L4PROTO: u32 = 17; +pub const NFTNL_OBJ_CT_TIMEOUT_ARRAY: u32 = 18; + +pub const NFTNL_OBJ_CT_EXPECT_L3PROTO: u32 = 16; +pub const NFTNL_OBJ_CT_EXPECT_L4PROTO: u32 = 17; +pub const NFTNL_OBJ_CT_EXPECT_DPORT: u32 = 18; +pub const NFTNL_OBJ_CT_EXPECT_TIMEOUT: u32 = 19; +pub const NFTNL_OBJ_CT_EXPECT_SIZE: u32 = 20; + +pub const NFTNL_OBJ_LIMIT_RATE: u32 = 16; +pub const NFTNL_OBJ_LIMIT_UNIT: u32 = 17; +pub const NFTNL_OBJ_LIMIT_BURST: u32 = 18; +pub const NFTNL_OBJ_LIMIT_TYPE: u32 = 19; +pub const NFTNL_OBJ_LIMIT_FLAGS: u32 = 20; + +pub const NFTNL_OBJ_SYNPROXY_MSS: u32 = 16; +pub const NFTNL_OBJ_SYNPROXY_WSCALE: u32 = 17; +pub const NFTNL_OBJ_SYNPROXY_FLAGS: u32 = 18; + +pub const NFTNL_OBJ_TUNNEL_ID: u32 = 16; +pub const NFTNL_OBJ_TUNNEL_IPV4_SRC: u32 = 17; +pub const NFTNL_OBJ_TUNNEL_IPV4_DST: u32 = 18; +pub const NFTNL_OBJ_TUNNEL_IPV6_SRC: u32 = 19; +pub const NFTNL_OBJ_TUNNEL_IPV6_DST: u32 = 20; +pub const NFTNL_OBJ_TUNNEL_IPV6_FLOWLABEL: u32 = 21; +pub const NFTNL_OBJ_TUNNEL_SPORT: u32 = 22; +pub const NFTNL_OBJ_TUNNEL_DPORT: u32 = 23; +pub const NFTNL_OBJ_TUNNEL_FLAGS: u32 = 24; +pub const NFTNL_OBJ_TUNNEL_TOS: u32 = 25; +pub const NFTNL_OBJ_TUNNEL_TTL: u32 = 26; +pub const NFTNL_OBJ_TUNNEL_VXLAN_GBP: u32 = 27; +pub const NFTNL_OBJ_TUNNEL_ERSPAN_VERSION: u32 = 28; +pub const NFTNL_OBJ_TUNNEL_ERSPAN_V1_INDEX: u32 = 29; +pub const NFTNL_OBJ_TUNNEL_ERSPAN_V2_HWID: u32 = 30; +pub const NFTNL_OBJ_TUNNEL_ERSPAN_V2_DIR: u32 = 31; + +pub const NFTNL_OBJ_SECMARK_CTX: u32 = 16; + +#[repr(C)] +pub struct nftnl_obj(c_void); + +extern "C" { + pub fn nftnl_obj_alloc() -> *mut nftnl_obj; + + pub fn nftnl_obj_free(ne: *const nftnl_obj); + + pub fn nftnl_obj_is_set(ne: *const nftnl_obj, attr: u16) -> bool; + + pub fn nftnl_obj_unset(ne: *mut nftnl_obj, attr: u16); + + pub fn nftnl_obj_set_data(ne: *mut nftnl_obj, attr: u16, data: *const c_void, data_len: u32); + + pub fn nftnl_obj_set(ne: *mut nftnl_obj, attr: u16, data: *const c_void); + + pub fn nftnl_obj_set_u8(ne: *mut nftnl_obj, attr: u16, val: u8); + + pub fn nftnl_obj_set_u16(ne: *mut nftnl_obj, attr: u16, val: u16); + + pub fn nftnl_obj_set_u32(ne: *mut nftnl_obj, attr: u16, val: u32); + + pub fn nftnl_obj_set_u64(obj: *mut nftnl_obj, attr: u16, val: u64); + + pub fn nftnl_obj_set_str(ne: *mut nftnl_obj, attr: u16, str_: *const c_char); + + pub fn nftnl_obj_get_data(ne: *mut nftnl_obj, attr: u16, data_len: *mut u32) -> *const c_void; + + pub fn nftnl_obj_get(ne: *mut nftnl_obj, attr: u16) -> *const c_void; + + pub fn nftnl_obj_get_u8(ne: *mut nftnl_obj, attr: u16) -> u8; + + pub fn nftnl_obj_get_u16(obj: *mut nftnl_obj, attr: u16) -> u16; + + pub fn nftnl_obj_get_u32(ne: *mut nftnl_obj, attr: u16) -> u32; + + pub fn nftnl_obj_get_u64(obj: *mut nftnl_obj, attr: u16) -> u64; + + pub fn nftnl_obj_get_str(ne: *mut nftnl_obj, attr: u16) -> *const c_char; + + pub fn nftnl_obj_nlmsg_build_payload(nlh: *mut nlmsghdr, ne: *const nftnl_obj); + + pub fn nftnl_obj_nlmsg_parse(nlh: *const nlmsghdr, ne: *mut nftnl_obj) -> c_int; + + pub fn nftnl_obj_parse( + ne: *mut nftnl_obj, + type_: nftnl_parse_type, + data: *const c_char, + err: *mut nftnl_parse_err, + ) -> c_int; + + pub fn nftnl_obj_parse_file( + ne: *mut nftnl_obj, + type_: nftnl_parse_type, + fp: *mut FILE, + err: *mut nftnl_parse_err, + ) -> c_int; + + pub fn nftnl_obj_snprintf( + buf: *mut c_char, + size: usize, + ne: *const nftnl_obj, + type_: u32, + flags: u32, + ) -> c_int; + + pub fn nftnl_obj_fprintf(fp: *mut FILE, ne: *const nftnl_obj, type_: u32, flags: u32) -> c_int; +} +#[repr(C)] +pub struct nftnl_obj_list(c_void); + +extern "C" { + pub fn nftnl_obj_list_alloc() -> *mut nftnl_obj_list; + + pub fn nftnl_obj_list_free(list: *mut nftnl_obj_list); + + pub fn nftnl_obj_list_is_empty(list: *mut nftnl_obj_list) -> c_int; + + pub fn nftnl_obj_list_add(r: *mut nftnl_obj, list: *mut nftnl_obj_list); + + pub fn nftnl_obj_list_add_tail(r: *mut nftnl_obj, list: *mut nftnl_obj_list); + + pub fn nftnl_obj_list_del(t: *mut nftnl_obj); + + pub fn nftnl_obj_list_foreach( + table_list: *mut nftnl_obj_list, + cb: Option c_int>, + data: *mut c_void, + ) -> c_int; +} +#[repr(C)] +pub struct nftnl_obj_list_iter(c_void); + +extern "C" { + pub fn nftnl_obj_list_iter_create(l: *mut nftnl_obj_list) -> *mut nftnl_obj_list_iter; + + pub fn nftnl_obj_list_iter_next(iter: *mut nftnl_obj_list_iter) -> *mut nftnl_obj; + + pub fn nftnl_obj_list_iter_destroy(iter: *mut nftnl_obj_list_iter); + + pub fn nftnl_rule_alloc() -> *mut nftnl_rule; + + pub fn nftnl_rule_free(arg1: *const nftnl_rule); +} +pub const NFTNL_RULE_FAMILY: nftnl_rule_attr = 0; +pub const NFTNL_RULE_TABLE: nftnl_rule_attr = 1; +pub const NFTNL_RULE_CHAIN: nftnl_rule_attr = 2; +pub const NFTNL_RULE_HANDLE: nftnl_rule_attr = 3; +pub const NFTNL_RULE_COMPAT_PROTO: nftnl_rule_attr = 4; +pub const NFTNL_RULE_COMPAT_FLAGS: nftnl_rule_attr = 5; +pub const NFTNL_RULE_POSITION: nftnl_rule_attr = 6; +pub const NFTNL_RULE_USERDATA: nftnl_rule_attr = 7; +pub const NFTNL_RULE_ID: nftnl_rule_attr = 8; +pub const NFTNL_RULE_POSITION_ID: nftnl_rule_attr = 9; +pub const __NFTNL_RULE_MAX: nftnl_rule_attr = 10; +pub type nftnl_rule_attr = c_uint; +extern "C" { + pub fn nftnl_rule_unset(r: *mut nftnl_rule, attr: u16); + + pub fn nftnl_rule_is_set(r: *const nftnl_rule, attr: u16) -> bool; + + pub fn nftnl_rule_set(r: *mut nftnl_rule, attr: u16, data: *const c_void) -> c_int; + + pub fn nftnl_rule_set_data( + r: *mut nftnl_rule, + attr: u16, + data: *const c_void, + data_len: u32, + ) -> c_int; + + pub fn nftnl_rule_set_u32(r: *mut nftnl_rule, attr: u16, val: u32); + + pub fn nftnl_rule_set_u64(r: *mut nftnl_rule, attr: u16, val: u64); + + pub fn nftnl_rule_set_str(r: *mut nftnl_rule, attr: u16, str_: *const c_char) -> c_int; + + pub fn nftnl_rule_get(r: *const nftnl_rule, attr: u16) -> *const c_void; + + pub fn nftnl_rule_get_data( + r: *const nftnl_rule, + attr: u16, + data_len: *mut u32, + ) -> *const c_void; + + pub fn nftnl_rule_get_str(r: *const nftnl_rule, attr: u16) -> *const c_char; + + pub fn nftnl_rule_get_u8(r: *const nftnl_rule, attr: u16) -> u8; + + pub fn nftnl_rule_get_u32(r: *const nftnl_rule, attr: u16) -> u32; + + pub fn nftnl_rule_get_u64(r: *const nftnl_rule, attr: u16) -> u64; + + pub fn nftnl_rule_add_expr(r: *mut nftnl_rule, expr: *mut nftnl_expr); + + pub fn nftnl_rule_del_expr(expr: *mut nftnl_expr); + + pub fn nftnl_rule_nlmsg_build_payload(nlh: *mut nlmsghdr, t: *mut nftnl_rule); + + pub fn nftnl_rule_parse( + r: *mut nftnl_rule, + type_: nftnl_parse_type, + data: *const c_char, + err: *mut nftnl_parse_err, + ) -> c_int; + + pub fn nftnl_rule_parse_file( + r: *mut nftnl_rule, + type_: nftnl_parse_type, + fp: *mut FILE, + err: *mut nftnl_parse_err, + ) -> c_int; + + pub fn nftnl_rule_snprintf( + buf: *mut c_char, + size: usize, + t: *const nftnl_rule, + type_: u32, + flags: u32, + ) -> c_int; + + pub fn nftnl_rule_fprintf(fp: *mut FILE, r: *const nftnl_rule, type_: u32, flags: u32) + -> c_int; + + pub fn nftnl_rule_nlmsg_parse(nlh: *const nlmsghdr, t: *mut nftnl_rule) -> c_int; + + pub fn nftnl_expr_foreach( + r: *mut nftnl_rule, + cb: Option c_int>, + data: *mut c_void, + ) -> c_int; +} +#[repr(C)] +pub struct nftnl_expr_iter(c_void); + +extern "C" { + pub fn nftnl_expr_iter_create(r: *const nftnl_rule) -> *mut nftnl_expr_iter; + + pub fn nftnl_expr_iter_next(iter: *mut nftnl_expr_iter) -> *mut nftnl_expr; + + pub fn nftnl_expr_iter_destroy(iter: *mut nftnl_expr_iter); +} +#[repr(C)] +pub struct nftnl_rule_list(c_void); + +extern "C" { + pub fn nftnl_rule_list_alloc() -> *mut nftnl_rule_list; + + pub fn nftnl_rule_list_free(list: *mut nftnl_rule_list); + + pub fn nftnl_rule_list_is_empty(list: *const nftnl_rule_list) -> c_int; + + pub fn nftnl_rule_list_add(r: *mut nftnl_rule, list: *mut nftnl_rule_list); + + pub fn nftnl_rule_list_add_tail(r: *mut nftnl_rule, list: *mut nftnl_rule_list); + + pub fn nftnl_rule_list_insert_at(r: *mut nftnl_rule, pos: *mut nftnl_rule); + + pub fn nftnl_rule_list_del(r: *mut nftnl_rule); + + pub fn nftnl_rule_list_foreach( + rule_list: *mut nftnl_rule_list, + cb: Option c_int>, + data: *mut c_void, + ) -> c_int; +} +#[repr(C)] +pub struct nftnl_rule_list_iter(c_void); + +extern "C" { + pub fn nftnl_rule_list_iter_create(l: *const nftnl_rule_list) -> *mut nftnl_rule_list_iter; + + pub fn nftnl_rule_list_iter_cur(iter: *mut nftnl_rule_list_iter) -> *mut nftnl_rule; + + pub fn nftnl_rule_list_iter_next(iter: *mut nftnl_rule_list_iter) -> *mut nftnl_rule; + + pub fn nftnl_rule_list_iter_destroy(iter: *const nftnl_rule_list_iter); +} +#[repr(C)] +pub struct nftnl_ruleset(c_void); + +extern "C" { + pub fn nftnl_ruleset_alloc() -> *mut nftnl_ruleset; + + pub fn nftnl_ruleset_free(r: *const nftnl_ruleset); +} +pub const NFTNL_RULESET_TABLELIST: u32 = 0; +pub const NFTNL_RULESET_CHAINLIST: u32 = 1; +pub const NFTNL_RULESET_SETLIST: u32 = 2; +pub const NFTNL_RULESET_RULELIST: u32 = 3; + +pub const NFTNL_RULESET_UNSPEC: nftnl_ruleset_type = 0; +pub const NFTNL_RULESET_RULESET: nftnl_ruleset_type = 1; +pub const NFTNL_RULESET_TABLE: nftnl_ruleset_type = 2; +pub const NFTNL_RULESET_CHAIN: nftnl_ruleset_type = 3; +pub const NFTNL_RULESET_RULE: nftnl_ruleset_type = 4; +pub const NFTNL_RULESET_SET: nftnl_ruleset_type = 5; +pub const NFTNL_RULESET_SET_ELEMS: nftnl_ruleset_type = 6; +pub type nftnl_ruleset_type = c_uint; +extern "C" { + pub fn nftnl_ruleset_is_set(r: *const nftnl_ruleset, attr: u16) -> bool; + + pub fn nftnl_ruleset_unset(r: *mut nftnl_ruleset, attr: u16); + + pub fn nftnl_ruleset_set(r: *mut nftnl_ruleset, attr: u16, data: *mut c_void); + + pub fn nftnl_ruleset_get(r: *const nftnl_ruleset, attr: u16) -> *mut c_void; +} +pub const NFTNL_RULESET_CTX_CMD: u32 = 0; +pub const NFTNL_RULESET_CTX_TYPE: u32 = 1; +pub const NFTNL_RULESET_CTX_TABLE: u32 = 2; +pub const NFTNL_RULESET_CTX_CHAIN: u32 = 3; +pub const NFTNL_RULESET_CTX_RULE: u32 = 4; +pub const NFTNL_RULESET_CTX_SET: u32 = 5; +pub const NFTNL_RULESET_CTX_DATA: u32 = 6; + +#[repr(C)] +pub struct nftnl_parse_ctx(c_void); + +extern "C" { + pub fn nftnl_ruleset_ctx_free(ctx: *const nftnl_parse_ctx); + + pub fn nftnl_ruleset_ctx_is_set(ctx: *const nftnl_parse_ctx, attr: u16) -> bool; + + pub fn nftnl_ruleset_ctx_get(ctx: *const nftnl_parse_ctx, attr: u16) -> *mut c_void; + + pub fn nftnl_ruleset_ctx_get_u32(ctx: *const nftnl_parse_ctx, attr: u16) -> u32; + + pub fn nftnl_ruleset_parse_file_cb( + type_: nftnl_parse_type, + fp: *mut FILE, + err: *mut nftnl_parse_err, + data: *mut c_void, + cb: Option c_int>, + ) -> c_int; + + pub fn nftnl_ruleset_parse_buffer_cb( + type_: nftnl_parse_type, + buffer: *const c_char, + err: *mut nftnl_parse_err, + data: *mut c_void, + cb: Option c_int>, + ) -> c_int; + + pub fn nftnl_ruleset_parse( + rs: *mut nftnl_ruleset, + type_: nftnl_parse_type, + data: *const c_char, + err: *mut nftnl_parse_err, + ) -> c_int; + + pub fn nftnl_ruleset_parse_file( + rs: *mut nftnl_ruleset, + type_: nftnl_parse_type, + fp: *mut FILE, + err: *mut nftnl_parse_err, + ) -> c_int; + + pub fn nftnl_ruleset_snprintf( + buf: *mut c_char, + size: usize, + rs: *const nftnl_ruleset, + type_: u32, + flags: u32, + ) -> c_int; + + pub fn nftnl_ruleset_fprintf( + fp: *mut FILE, + rs: *const nftnl_ruleset, + type_: u32, + flags: u32, + ) -> c_int; +} +pub const NFTNL_SET_TABLE: nftnl_set_attr = 0; +pub const NFTNL_SET_NAME: nftnl_set_attr = 1; +pub const NFTNL_SET_FLAGS: nftnl_set_attr = 2; +pub const NFTNL_SET_KEY_TYPE: nftnl_set_attr = 3; +pub const NFTNL_SET_KEY_LEN: nftnl_set_attr = 4; +pub const NFTNL_SET_DATA_TYPE: nftnl_set_attr = 5; +pub const NFTNL_SET_DATA_LEN: nftnl_set_attr = 6; +pub const NFTNL_SET_FAMILY: nftnl_set_attr = 7; +pub const NFTNL_SET_ID: nftnl_set_attr = 8; +pub const NFTNL_SET_POLICY: nftnl_set_attr = 9; +pub const NFTNL_SET_DESC_SIZE: nftnl_set_attr = 10; +pub const NFTNL_SET_TIMEOUT: nftnl_set_attr = 11; +pub const NFTNL_SET_GC_INTERVAL: nftnl_set_attr = 12; +pub const NFTNL_SET_USERDATA: nftnl_set_attr = 13; +pub const NFTNL_SET_OBJ_TYPE: nftnl_set_attr = 14; +pub const NFTNL_SET_HANDLE: nftnl_set_attr = 15; +pub const NFTNL_SET_DESC_CONCAT: nftnl_set_attr = 16; +pub const NFTNL_SET_EXPR: nftnl_set_attr = 17; +pub const NFTNL_SET_EXPRESSIONS: nftnl_set_attr = 18; +pub const __NFTNL_SET_MAX: nftnl_set_attr = 19; +pub type nftnl_set_attr = c_uint; +#[repr(C)] +pub struct nftnl_set(c_void); + +extern "C" { + pub fn nftnl_set_alloc() -> *mut nftnl_set; + + pub fn nftnl_set_free(s: *const nftnl_set); + + pub fn nftnl_set_clone(set: *const nftnl_set) -> *mut nftnl_set; + + pub fn nftnl_set_is_set(s: *const nftnl_set, attr: u16) -> bool; + + pub fn nftnl_set_unset(s: *mut nftnl_set, attr: u16); + + pub fn nftnl_set_set(s: *mut nftnl_set, attr: u16, data: *const c_void) -> c_int; + + pub fn nftnl_set_set_data( + s: *mut nftnl_set, + attr: u16, + data: *const c_void, + data_len: u32, + ) -> c_int; + + pub fn nftnl_set_set_u32(s: *mut nftnl_set, attr: u16, val: u32); + + pub fn nftnl_set_set_u64(s: *mut nftnl_set, attr: u16, val: u64); + + pub fn nftnl_set_set_str(s: *mut nftnl_set, attr: u16, str_: *const c_char) -> c_int; + + pub fn nftnl_set_get(s: *const nftnl_set, attr: u16) -> *const c_void; + + pub fn nftnl_set_get_data(s: *const nftnl_set, attr: u16, data_len: *mut u32) -> *const c_void; + + pub fn nftnl_set_get_str(s: *const nftnl_set, attr: u16) -> *const c_char; + + pub fn nftnl_set_get_u32(s: *const nftnl_set, attr: u16) -> u32; + + pub fn nftnl_set_get_u64(s: *const nftnl_set, attr: u16) -> u64; + + pub fn nftnl_set_nlmsg_build_payload(nlh: *mut nlmsghdr, s: *mut nftnl_set); + + pub fn nftnl_set_nlmsg_parse(nlh: *const nlmsghdr, s: *mut nftnl_set) -> c_int; + + pub fn nftnl_set_elems_nlmsg_parse(nlh: *const nlmsghdr, s: *mut nftnl_set) -> c_int; + + pub fn nftnl_set_snprintf( + buf: *mut c_char, + size: usize, + s: *const nftnl_set, + type_: u32, + flags: u32, + ) -> c_int; + + pub fn nftnl_set_fprintf(fp: *mut FILE, s: *const nftnl_set, type_: u32, flags: u32) -> c_int; +} +#[repr(C)] +pub struct nftnl_set_list(c_void); + +extern "C" { + pub fn nftnl_set_list_alloc() -> *mut nftnl_set_list; + + pub fn nftnl_set_list_free(list: *mut nftnl_set_list); + + pub fn nftnl_set_list_is_empty(list: *const nftnl_set_list) -> c_int; + + pub fn nftnl_set_list_add(s: *mut nftnl_set, list: *mut nftnl_set_list); + + pub fn nftnl_set_list_add_tail(s: *mut nftnl_set, list: *mut nftnl_set_list); + + pub fn nftnl_set_list_del(s: *mut nftnl_set); + + pub fn nftnl_set_list_foreach( + set_list: *mut nftnl_set_list, + cb: Option c_int>, + data: *mut c_void, + ) -> c_int; + + pub fn nftnl_set_list_lookup_byname( + set_list: *mut nftnl_set_list, + set: *const c_char, + ) -> *mut nftnl_set; + + pub fn nftnl_set_add_expr(s: *mut nftnl_set, expr: *mut nftnl_expr); + + pub fn nftnl_set_expr_foreach( + s: *const nftnl_set, + cb: Option c_int>, + data: *mut c_void, + ) -> c_int; +} +#[repr(C)] +pub struct nftnl_set_list_iter(c_void); + +extern "C" { + pub fn nftnl_set_list_iter_create(l: *const nftnl_set_list) -> *mut nftnl_set_list_iter; + + pub fn nftnl_set_list_iter_cur(iter: *const nftnl_set_list_iter) -> *mut nftnl_set; + + pub fn nftnl_set_list_iter_next(iter: *mut nftnl_set_list_iter) -> *mut nftnl_set; + + pub fn nftnl_set_list_iter_destroy(iter: *const nftnl_set_list_iter); + + pub fn nftnl_set_parse( + s: *mut nftnl_set, + type_: nftnl_parse_type, + data: *const c_char, + err: *mut nftnl_parse_err, + ) -> c_int; + + pub fn nftnl_set_parse_file( + s: *mut nftnl_set, + type_: nftnl_parse_type, + fp: *mut FILE, + err: *mut nftnl_parse_err, + ) -> c_int; +} +pub const NFTNL_SET_ELEM_FLAGS: u32 = 0; +pub const NFTNL_SET_ELEM_KEY: u32 = 1; +pub const NFTNL_SET_ELEM_VERDICT: u32 = 2; +pub const NFTNL_SET_ELEM_CHAIN: u32 = 3; +pub const NFTNL_SET_ELEM_DATA: u32 = 4; +pub const NFTNL_SET_ELEM_TIMEOUT: u32 = 5; +pub const NFTNL_SET_ELEM_EXPIRATION: u32 = 6; +pub const NFTNL_SET_ELEM_USERDATA: u32 = 7; +pub const NFTNL_SET_ELEM_EXPR: u32 = 8; +pub const NFTNL_SET_ELEM_OBJREF: u32 = 9; +pub const NFTNL_SET_ELEM_KEY_END: u32 = 10; +pub const NFTNL_SET_ELEM_EXPRESSIONS: u32 = 11; +pub const __NFTNL_SET_ELEM_MAX: u32 = 12; + +#[repr(C)] +pub struct nftnl_set_elem(c_void); + +extern "C" { + pub fn nftnl_set_elem_alloc() -> *mut nftnl_set_elem; + + pub fn nftnl_set_elem_free(s: *mut nftnl_set_elem); + + pub fn nftnl_set_elem_clone(elem: *mut nftnl_set_elem) -> *mut nftnl_set_elem; + + pub fn nftnl_set_elem_add(s: *mut nftnl_set, elem: *mut nftnl_set_elem); + + pub fn nftnl_set_elem_unset(s: *mut nftnl_set_elem, attr: u16); + + pub fn nftnl_set_elem_set( + s: *mut nftnl_set_elem, + attr: u16, + data: *const c_void, + data_len: u32, + ) -> c_int; + + pub fn nftnl_set_elem_set_u32(s: *mut nftnl_set_elem, attr: u16, val: u32); + + pub fn nftnl_set_elem_set_u64(s: *mut nftnl_set_elem, attr: u16, val: u64); + + pub fn nftnl_set_elem_set_str(s: *mut nftnl_set_elem, attr: u16, str_: *const c_char) -> c_int; + + pub fn nftnl_set_elem_get( + s: *mut nftnl_set_elem, + attr: u16, + data_len: *mut u32, + ) -> *const c_void; + + pub fn nftnl_set_elem_get_str(s: *mut nftnl_set_elem, attr: u16) -> *const c_char; + + pub fn nftnl_set_elem_get_u32(s: *mut nftnl_set_elem, attr: u16) -> u32; + + pub fn nftnl_set_elem_get_u64(s: *mut nftnl_set_elem, attr: u16) -> u64; + + pub fn nftnl_set_elem_is_set(s: *const nftnl_set_elem, attr: u16) -> bool; + + pub fn nftnl_set_elems_nlmsg_build_payload(nlh: *mut nlmsghdr, s: *mut nftnl_set); + + pub fn nftnl_set_elem_nlmsg_build_payload(nlh: *mut nlmsghdr, e: *mut nftnl_set_elem); +} +#[repr(C)] +pub struct nlattr(c_void); + +extern "C" { + pub fn nftnl_set_elem_nlmsg_build( + nlh: *mut nlmsghdr, + elem: *mut nftnl_set_elem, + i: c_int, + ) -> *mut nlattr; + + pub fn nftnl_set_elem_parse( + e: *mut nftnl_set_elem, + type_: nftnl_parse_type, + data: *const c_char, + err: *mut nftnl_parse_err, + ) -> c_int; + + pub fn nftnl_set_elem_parse_file( + e: *mut nftnl_set_elem, + type_: nftnl_parse_type, + fp: *mut FILE, + err: *mut nftnl_parse_err, + ) -> c_int; + + pub fn nftnl_set_elem_snprintf( + buf: *mut c_char, + size: usize, + s: *const nftnl_set_elem, + type_: u32, + flags: u32, + ) -> c_int; + + pub fn nftnl_set_elem_fprintf( + fp: *mut FILE, + se: *const nftnl_set_elem, + type_: u32, + flags: u32, + ) -> c_int; + + pub fn nftnl_set_elem_add_expr(e: *mut nftnl_set_elem, expr: *mut nftnl_expr); + + pub fn nftnl_set_elem_expr_foreach( + e: *mut nftnl_set_elem, + cb: Option c_int>, + data: *mut c_void, + ) -> c_int; + + pub fn nftnl_set_elem_foreach( + s: *mut nftnl_set, + cb: Option c_int>, + data: *mut c_void, + ) -> c_int; +} +#[repr(C)] +pub struct nftnl_set_elems_iter(c_void); + +extern "C" { + pub fn nftnl_set_elems_iter_create(s: *const nftnl_set) -> *mut nftnl_set_elems_iter; + + pub fn nftnl_set_elems_iter_cur(iter: *const nftnl_set_elems_iter) -> *mut nftnl_set_elem; + + pub fn nftnl_set_elems_iter_next(iter: *mut nftnl_set_elems_iter) -> *mut nftnl_set_elem; + + pub fn nftnl_set_elems_iter_destroy(iter: *mut nftnl_set_elems_iter); + + pub fn nftnl_set_elems_nlmsg_build_payload_iter( + nlh: *mut nlmsghdr, + iter: *mut nftnl_set_elems_iter, + ) -> c_int; +} +#[repr(C)] +pub struct nftnl_table(c_void); + +extern "C" { + pub fn nftnl_table_alloc() -> *mut nftnl_table; + + pub fn nftnl_table_free(arg1: *const nftnl_table); +} +pub const NFTNL_TABLE_NAME: nftnl_table_attr = 0; +pub const NFTNL_TABLE_FAMILY: nftnl_table_attr = 1; +pub const NFTNL_TABLE_FLAGS: nftnl_table_attr = 2; +pub const NFTNL_TABLE_USE: nftnl_table_attr = 3; +pub const NFTNL_TABLE_HANDLE: nftnl_table_attr = 4; +pub const NFTNL_TABLE_USERDATA: nftnl_table_attr = 5; +pub const NFTNL_TABLE_OWNER: nftnl_table_attr = 6; +pub const __NFTNL_TABLE_MAX: nftnl_table_attr = 7; +pub type nftnl_table_attr = c_uint; +extern "C" { + pub fn nftnl_table_is_set(t: *const nftnl_table, attr: u16) -> bool; + + pub fn nftnl_table_unset(t: *mut nftnl_table, attr: u16); + + pub fn nftnl_table_set(t: *mut nftnl_table, attr: u16, data: *const c_void); + + pub fn nftnl_table_set_data( + t: *mut nftnl_table, + attr: u16, + data: *const c_void, + data_len: u32, + ) -> c_int; + + pub fn nftnl_table_get(t: *const nftnl_table, attr: u16) -> *const c_void; + + pub fn nftnl_table_get_data( + t: *const nftnl_table, + attr: u16, + data_len: *mut u32, + ) -> *const c_void; + + pub fn nftnl_table_set_u8(t: *mut nftnl_table, attr: u16, data: u8); + + pub fn nftnl_table_set_u32(t: *mut nftnl_table, attr: u16, data: u32); + + pub fn nftnl_table_set_u64(t: *mut nftnl_table, attr: u16, data: u64); + + pub fn nftnl_table_set_str(t: *mut nftnl_table, attr: u16, str_: *const c_char) -> c_int; + + pub fn nftnl_table_get_u8(t: *const nftnl_table, attr: u16) -> u8; + + pub fn nftnl_table_get_u32(t: *const nftnl_table, attr: u16) -> u32; + + pub fn nftnl_table_get_u64(t: *const nftnl_table, attr: u16) -> u64; + + pub fn nftnl_table_get_str(t: *const nftnl_table, attr: u16) -> *const c_char; + + pub fn nftnl_table_nlmsg_build_payload(nlh: *mut nlmsghdr, t: *const nftnl_table); + + pub fn nftnl_table_parse( + t: *mut nftnl_table, + type_: nftnl_parse_type, + data: *const c_char, + err: *mut nftnl_parse_err, + ) -> c_int; + + pub fn nftnl_table_parse_file( + t: *mut nftnl_table, + type_: nftnl_parse_type, + fp: *mut FILE, + err: *mut nftnl_parse_err, + ) -> c_int; + + pub fn nftnl_table_snprintf( + buf: *mut c_char, + size: usize, + t: *const nftnl_table, + type_: u32, + flags: u32, + ) -> c_int; + + pub fn nftnl_table_fprintf( + fp: *mut FILE, + t: *const nftnl_table, + type_: u32, + flags: u32, + ) -> c_int; + + pub fn nftnl_table_nlmsg_parse(nlh: *const nlmsghdr, t: *mut nftnl_table) -> c_int; +} +#[repr(C)] +pub struct nftnl_table_list(c_void); + +extern "C" { + pub fn nftnl_table_list_alloc() -> *mut nftnl_table_list; + + pub fn nftnl_table_list_free(list: *mut nftnl_table_list); + + pub fn nftnl_table_list_is_empty(list: *const nftnl_table_list) -> c_int; + + pub fn nftnl_table_list_foreach( + table_list: *mut nftnl_table_list, + cb: Option c_int>, + data: *mut c_void, + ) -> c_int; + + pub fn nftnl_table_list_add(r: *mut nftnl_table, list: *mut nftnl_table_list); + + pub fn nftnl_table_list_add_tail(r: *mut nftnl_table, list: *mut nftnl_table_list); + + pub fn nftnl_table_list_del(r: *mut nftnl_table); +} +#[repr(C)] +pub struct nftnl_table_list_iter(c_void); + +extern "C" { + pub fn nftnl_table_list_iter_create(l: *const nftnl_table_list) -> *mut nftnl_table_list_iter; + + pub fn nftnl_table_list_iter_next(iter: *mut nftnl_table_list_iter) -> *mut nftnl_table; + + pub fn nftnl_table_list_iter_destroy(iter: *const nftnl_table_list_iter); +} +pub const NFTNL_TRACE_CHAIN: nftnl_trace_attr = 0; +pub const NFTNL_TRACE_FAMILY: nftnl_trace_attr = 1; +pub const NFTNL_TRACE_ID: nftnl_trace_attr = 2; +pub const NFTNL_TRACE_IIF: nftnl_trace_attr = 3; +pub const NFTNL_TRACE_IIFTYPE: nftnl_trace_attr = 4; +pub const NFTNL_TRACE_JUMP_TARGET: nftnl_trace_attr = 5; +pub const NFTNL_TRACE_OIF: nftnl_trace_attr = 6; +pub const NFTNL_TRACE_OIFTYPE: nftnl_trace_attr = 7; +pub const NFTNL_TRACE_MARK: nftnl_trace_attr = 8; +pub const NFTNL_TRACE_LL_HEADER: nftnl_trace_attr = 9; +pub const NFTNL_TRACE_NETWORK_HEADER: nftnl_trace_attr = 10; +pub const NFTNL_TRACE_TRANSPORT_HEADER: nftnl_trace_attr = 11; +pub const NFTNL_TRACE_TABLE: nftnl_trace_attr = 12; +pub const NFTNL_TRACE_TYPE: nftnl_trace_attr = 13; +pub const NFTNL_TRACE_RULE_HANDLE: nftnl_trace_attr = 14; +pub const NFTNL_TRACE_VERDICT: nftnl_trace_attr = 15; +pub const NFTNL_TRACE_NFPROTO: nftnl_trace_attr = 16; +pub const NFTNL_TRACE_POLICY: nftnl_trace_attr = 17; +pub const __NFTNL_TRACE_MAX: nftnl_trace_attr = 18; +pub type nftnl_trace_attr = c_uint; +#[repr(C)] +pub struct nftnl_trace(c_void); + +extern "C" { + pub fn nftnl_trace_alloc() -> *mut nftnl_trace; + + pub fn nftnl_trace_free(trace: *const nftnl_trace); + + pub fn nftnl_trace_is_set(trace: *const nftnl_trace, type_: u16) -> bool; + + pub fn nftnl_trace_get_data( + trace: *const nftnl_trace, + type_: u16, + data_len: *mut u32, + ) -> *const c_void; + + pub fn nftnl_trace_get_u16(trace: *const nftnl_trace, type_: u16) -> u16; + + pub fn nftnl_trace_get_u32(trace: *const nftnl_trace, type_: u16) -> u32; + + pub fn nftnl_trace_get_u64(trace: *const nftnl_trace, type_: u16) -> u64; + + pub fn nftnl_trace_get_str(trace: *const nftnl_trace, type_: u16) -> *const c_char; + + pub fn nftnl_trace_nlmsg_parse(nlh: *const nlmsghdr, t: *mut nftnl_trace) -> c_int; +} +pub const NFTNL_UDATA_TABLE_COMMENT: nftnl_udata_table_types = 0; +pub const __NFTNL_UDATA_TABLE_MAX: nftnl_udata_table_types = 1; +pub type nftnl_udata_table_types = c_uint; +pub const NFTNL_UDATA_CHAIN_COMMENT: nftnl_udata_chain_types = 0; +pub const __NFTNL_UDATA_CHAIN_MAX: nftnl_udata_chain_types = 1; +pub type nftnl_udata_chain_types = c_uint; +pub const NFTNL_UDATA_RULE_COMMENT: nftnl_udata_rule_types = 0; +pub const NFTNL_UDATA_RULE_EBTABLES_POLICY: nftnl_udata_rule_types = 1; +pub const __NFTNL_UDATA_RULE_MAX: nftnl_udata_rule_types = 2; +pub type nftnl_udata_rule_types = c_uint; +pub const NFTNL_UDATA_OBJ_COMMENT: nftnl_udata_obj_types = 0; +pub const __NFTNL_UDATA_OBJ_MAX: nftnl_udata_obj_types = 1; +pub type nftnl_udata_obj_types = c_uint; +pub const NFTNL_UDATA_SET_KEYBYTEORDER: nftnl_udata_set_types = 0; +pub const NFTNL_UDATA_SET_DATABYTEORDER: nftnl_udata_set_types = 1; +pub const NFTNL_UDATA_SET_MERGE_ELEMENTS: nftnl_udata_set_types = 2; +pub const NFTNL_UDATA_SET_KEY_TYPEOF: nftnl_udata_set_types = 3; +pub const NFTNL_UDATA_SET_DATA_TYPEOF: nftnl_udata_set_types = 4; +pub const NFTNL_UDATA_SET_EXPR: nftnl_udata_set_types = 5; +pub const NFTNL_UDATA_SET_DATA_INTERVAL: nftnl_udata_set_types = 6; +pub const NFTNL_UDATA_SET_COMMENT: nftnl_udata_set_types = 7; +pub const __NFTNL_UDATA_SET_MAX: nftnl_udata_set_types = 8; +pub type nftnl_udata_set_types = c_uint; +pub const NFTNL_UDATA_SET_TYPEOF_EXPR: u32 = 0; +pub const NFTNL_UDATA_SET_TYPEOF_DATA: u32 = 1; +pub const __NFTNL_UDATA_SET_TYPEOF_MAX: u32 = 2; + +pub const NFTNL_UDATA_SET_ELEM_COMMENT: nftnl_udata_set_elem_types = 0; +pub const NFTNL_UDATA_SET_ELEM_FLAGS: nftnl_udata_set_elem_types = 1; +pub const __NFTNL_UDATA_SET_ELEM_MAX: nftnl_udata_set_elem_types = 2; +pub type nftnl_udata_set_elem_types = c_uint; +pub const NFTNL_SET_ELEM_F_INTERVAL_OPEN: nftnl_udata_set_elem_flags = 1; +pub type nftnl_udata_set_elem_flags = c_uint; +#[repr(C)] +pub struct nftnl_udata(c_void); + +#[repr(C)] +pub struct nftnl_udata_buf(c_void); + +extern "C" { + pub fn nftnl_udata_buf_alloc(data_size: u32) -> *mut nftnl_udata_buf; + + pub fn nftnl_udata_buf_free(buf: *const nftnl_udata_buf); + + pub fn nftnl_udata_buf_len(buf: *const nftnl_udata_buf) -> u32; + + pub fn nftnl_udata_buf_data(buf: *const nftnl_udata_buf) -> *mut c_void; + + pub fn nftnl_udata_buf_put(buf: *mut nftnl_udata_buf, data: *const c_void, len: u32); + + pub fn nftnl_udata_start(buf: *const nftnl_udata_buf) -> *mut nftnl_udata; + + pub fn nftnl_udata_end(buf: *const nftnl_udata_buf) -> *mut nftnl_udata; + + pub fn nftnl_udata_put( + buf: *mut nftnl_udata_buf, + type_: u8, + len: u32, + value: *const c_void, + ) -> bool; + + pub fn nftnl_udata_put_u32(buf: *mut nftnl_udata_buf, type_: u8, data: u32) -> bool; + + pub fn nftnl_udata_put_strz(buf: *mut nftnl_udata_buf, type_: u8, strz: *const c_char) -> bool; + + pub fn nftnl_udata_nest_start(buf: *mut nftnl_udata_buf, type_: u8) -> *mut nftnl_udata; + + pub fn nftnl_udata_nest_end(buf: *mut nftnl_udata_buf, ud: *mut nftnl_udata); + + pub fn nftnl_udata_type(attr: *const nftnl_udata) -> u8; + + pub fn nftnl_udata_len(attr: *const nftnl_udata) -> u8; + + pub fn nftnl_udata_get(attr: *const nftnl_udata) -> *mut c_void; + + pub fn nftnl_udata_get_u32(attr: *const nftnl_udata) -> u32; + + pub fn nftnl_udata_next(attr: *const nftnl_udata) -> *mut nftnl_udata; +} +pub type nftnl_udata_cb_t = + Option c_int>; +extern "C" { + pub fn nftnl_udata_parse( + data: *const c_void, + data_len: u32, + cb: nftnl_udata_cb_t, + cb_data: *mut c_void, + ) -> c_int; +} diff --git a/nftnl-sys/src/nftnl_1_2_5.rs b/nftnl-sys/src/nftnl_1_2_5.rs new file mode 100644 index 0000000..52a8a66 --- /dev/null +++ b/nftnl-sys/src/nftnl_1_2_5.rs @@ -0,0 +1,1494 @@ +/* automatically generated by rust-bindgen 0.69.4 */ + +use core::option::Option; +use libc::{c_char, c_int, c_uint, c_void, iovec, nlmsghdr, FILE}; + +pub const NFTNL_UDATA_COMMENT_MAXLEN: u32 = 128; +#[repr(C)] +pub struct nftnl_batch(c_void); + +extern "C" { + pub fn nftnl_batch_alloc(pg_size: u32, pg_overrun_size: u32) -> *mut nftnl_batch; + + pub fn nftnl_batch_update(batch: *mut nftnl_batch) -> c_int; + + pub fn nftnl_batch_free(batch: *mut nftnl_batch); + + pub fn nftnl_batch_buffer(batch: *mut nftnl_batch) -> *mut c_void; + + pub fn nftnl_batch_buffer_len(batch: *mut nftnl_batch) -> u32; + + pub fn nftnl_batch_iovec_len(batch: *mut nftnl_batch) -> c_int; + + pub fn nftnl_batch_iovec(batch: *mut nftnl_batch, iov: *mut iovec, iovlen: u32); +} +pub const NFTNL_PARSE_EBADINPUT: u32 = 0; +pub const NFTNL_PARSE_EMISSINGNODE: u32 = 1; +pub const NFTNL_PARSE_EBADTYPE: u32 = 2; +pub const NFTNL_PARSE_EOPNOTSUPP: u32 = 3; + +pub const NFTNL_OUTPUT_DEFAULT: nftnl_output_type = 0; +pub const NFTNL_OUTPUT_XML: nftnl_output_type = 1; +pub const NFTNL_OUTPUT_JSON: nftnl_output_type = 2; +pub type nftnl_output_type = c_uint; +pub const NFTNL_OF_EVENT_NEW: nftnl_output_flags = 1; +pub const NFTNL_OF_EVENT_DEL: nftnl_output_flags = 2; +pub const NFTNL_OF_EVENT_ANY: nftnl_output_flags = 3; +pub type nftnl_output_flags = c_uint; +pub const NFTNL_CMD_UNSPEC: nftnl_cmd_type = 0; +pub const NFTNL_CMD_ADD: nftnl_cmd_type = 1; +pub const NFTNL_CMD_INSERT: nftnl_cmd_type = 2; +pub const NFTNL_CMD_DELETE: nftnl_cmd_type = 3; +pub const NFTNL_CMD_REPLACE: nftnl_cmd_type = 4; +pub const NFTNL_CMD_FLUSH: nftnl_cmd_type = 5; +pub const NFTNL_CMD_MAX: nftnl_cmd_type = 6; +pub type nftnl_cmd_type = c_uint; +pub const NFTNL_PARSE_NONE: nftnl_parse_type = 0; +pub const NFTNL_PARSE_XML: nftnl_parse_type = 1; +pub const NFTNL_PARSE_JSON: nftnl_parse_type = 2; +pub const NFTNL_PARSE_MAX: nftnl_parse_type = 3; +pub type nftnl_parse_type = c_uint; +#[repr(C)] +pub struct nftnl_parse_err(c_void); + +extern "C" { + pub fn nftnl_nlmsg_build_hdr( + buf: *mut c_char, + type_: u16, + family: u16, + flags: u16, + seq: u32, + ) -> *mut nlmsghdr; + + pub fn nftnl_parse_err_alloc() -> *mut nftnl_parse_err; + + pub fn nftnl_parse_err_free(arg1: *mut nftnl_parse_err); + + pub fn nftnl_parse_perror(str_: *const c_char, err: *mut nftnl_parse_err) -> c_int; + + pub fn nftnl_batch_is_supported() -> c_int; + + pub fn nftnl_batch_begin(buf: *mut c_char, seq: u32) -> *mut nlmsghdr; + + pub fn nftnl_batch_end(buf: *mut c_char, seq: u32) -> *mut nlmsghdr; +} +#[repr(C)] +pub struct nftnl_chain(c_void); + +#[repr(C)] +pub struct nftnl_rule(c_void); + +extern "C" { + pub fn nftnl_chain_alloc() -> *mut nftnl_chain; + + pub fn nftnl_chain_free(arg1: *const nftnl_chain); +} +pub const NFTNL_CHAIN_NAME: nftnl_chain_attr = 0; +pub const NFTNL_CHAIN_FAMILY: nftnl_chain_attr = 1; +pub const NFTNL_CHAIN_TABLE: nftnl_chain_attr = 2; +pub const NFTNL_CHAIN_HOOKNUM: nftnl_chain_attr = 3; +pub const NFTNL_CHAIN_PRIO: nftnl_chain_attr = 4; +pub const NFTNL_CHAIN_POLICY: nftnl_chain_attr = 5; +pub const NFTNL_CHAIN_USE: nftnl_chain_attr = 6; +pub const NFTNL_CHAIN_BYTES: nftnl_chain_attr = 7; +pub const NFTNL_CHAIN_PACKETS: nftnl_chain_attr = 8; +pub const NFTNL_CHAIN_HANDLE: nftnl_chain_attr = 9; +pub const NFTNL_CHAIN_TYPE: nftnl_chain_attr = 10; +pub const NFTNL_CHAIN_DEV: nftnl_chain_attr = 11; +pub const NFTNL_CHAIN_DEVICES: nftnl_chain_attr = 12; +pub const NFTNL_CHAIN_FLAGS: nftnl_chain_attr = 13; +pub const NFTNL_CHAIN_ID: nftnl_chain_attr = 14; +pub const NFTNL_CHAIN_USERDATA: nftnl_chain_attr = 15; +pub const __NFTNL_CHAIN_MAX: nftnl_chain_attr = 16; +pub type nftnl_chain_attr = c_uint; +extern "C" { + pub fn nftnl_chain_is_set(c: *const nftnl_chain, attr: u16) -> bool; + + pub fn nftnl_chain_unset(c: *mut nftnl_chain, attr: u16); + + pub fn nftnl_chain_set(t: *mut nftnl_chain, attr: u16, data: *const c_void); + + pub fn nftnl_chain_set_data( + t: *mut nftnl_chain, + attr: u16, + data: *const c_void, + data_len: u32, + ) -> c_int; + + pub fn nftnl_chain_set_u8(t: *mut nftnl_chain, attr: u16, data: u8); + + pub fn nftnl_chain_set_u32(t: *mut nftnl_chain, attr: u16, data: u32); + + pub fn nftnl_chain_set_s32(t: *mut nftnl_chain, attr: u16, data: i32); + + pub fn nftnl_chain_set_u64(t: *mut nftnl_chain, attr: u16, data: u64); + + pub fn nftnl_chain_set_str(t: *mut nftnl_chain, attr: u16, str_: *const c_char) -> c_int; + + pub fn nftnl_chain_set_array(t: *mut nftnl_chain, attr: u16, data: *mut *const c_char) + -> c_int; + + pub fn nftnl_chain_get(c: *const nftnl_chain, attr: u16) -> *const c_void; + + pub fn nftnl_chain_get_data( + c: *const nftnl_chain, + attr: u16, + data_len: *mut u32, + ) -> *const c_void; + + pub fn nftnl_chain_get_str(c: *const nftnl_chain, attr: u16) -> *const c_char; + + pub fn nftnl_chain_get_u8(c: *const nftnl_chain, attr: u16) -> u8; + + pub fn nftnl_chain_get_u32(c: *const nftnl_chain, attr: u16) -> u32; + + pub fn nftnl_chain_get_s32(c: *const nftnl_chain, attr: u16) -> i32; + + pub fn nftnl_chain_get_u64(c: *const nftnl_chain, attr: u16) -> u64; + + pub fn nftnl_chain_get_array(c: *const nftnl_chain, attr: u16) -> *const *const c_char; + + pub fn nftnl_chain_rule_add(rule: *mut nftnl_rule, c: *mut nftnl_chain); + + pub fn nftnl_chain_rule_del(rule: *mut nftnl_rule); + + pub fn nftnl_chain_rule_add_tail(rule: *mut nftnl_rule, c: *mut nftnl_chain); + + pub fn nftnl_chain_rule_insert_at(rule: *mut nftnl_rule, pos: *mut nftnl_rule); + + pub fn nftnl_chain_rule_append_at(rule: *mut nftnl_rule, pos: *mut nftnl_rule); + + pub fn nftnl_chain_nlmsg_build_payload(nlh: *mut nlmsghdr, t: *const nftnl_chain); + + pub fn nftnl_chain_parse( + c: *mut nftnl_chain, + type_: nftnl_parse_type, + data: *const c_char, + err: *mut nftnl_parse_err, + ) -> c_int; + + pub fn nftnl_chain_parse_file( + c: *mut nftnl_chain, + type_: nftnl_parse_type, + fp: *mut FILE, + err: *mut nftnl_parse_err, + ) -> c_int; + + pub fn nftnl_chain_snprintf( + buf: *mut c_char, + size: usize, + t: *const nftnl_chain, + type_: u32, + flags: u32, + ) -> c_int; + + pub fn nftnl_chain_fprintf( + fp: *mut FILE, + c: *const nftnl_chain, + type_: u32, + flags: u32, + ) -> c_int; + + pub fn nftnl_chain_nlmsg_parse(nlh: *const nlmsghdr, t: *mut nftnl_chain) -> c_int; + + pub fn nftnl_rule_foreach( + c: *mut nftnl_chain, + cb: Option c_int>, + data: *mut c_void, + ) -> c_int; + + pub fn nftnl_rule_lookup_byindex(c: *mut nftnl_chain, index: u32) -> *mut nftnl_rule; +} +#[repr(C)] +pub struct nftnl_rule_iter(c_void); + +extern "C" { + pub fn nftnl_rule_iter_create(c: *const nftnl_chain) -> *mut nftnl_rule_iter; + + pub fn nftnl_rule_iter_next(iter: *mut nftnl_rule_iter) -> *mut nftnl_rule; + + pub fn nftnl_rule_iter_destroy(iter: *mut nftnl_rule_iter); +} +#[repr(C)] +pub struct nftnl_chain_list(c_void); + +extern "C" { + pub fn nftnl_chain_list_alloc() -> *mut nftnl_chain_list; + + pub fn nftnl_chain_list_free(list: *mut nftnl_chain_list); + + pub fn nftnl_chain_list_is_empty(list: *const nftnl_chain_list) -> c_int; + + pub fn nftnl_chain_list_foreach( + chain_list: *mut nftnl_chain_list, + cb: Option c_int>, + data: *mut c_void, + ) -> c_int; + + pub fn nftnl_chain_list_lookup_byname( + chain_list: *mut nftnl_chain_list, + chain: *const c_char, + ) -> *mut nftnl_chain; + + pub fn nftnl_chain_list_add(r: *mut nftnl_chain, list: *mut nftnl_chain_list); + + pub fn nftnl_chain_list_add_tail(r: *mut nftnl_chain, list: *mut nftnl_chain_list); + + pub fn nftnl_chain_list_del(c: *mut nftnl_chain); +} +#[repr(C)] +pub struct nftnl_chain_list_iter(c_void); + +extern "C" { + pub fn nftnl_chain_list_iter_create(l: *const nftnl_chain_list) -> *mut nftnl_chain_list_iter; + + pub fn nftnl_chain_list_iter_next(iter: *mut nftnl_chain_list_iter) -> *mut nftnl_chain; + + pub fn nftnl_chain_list_iter_destroy(iter: *mut nftnl_chain_list_iter); +} +#[repr(C)] +pub struct nftnl_expr(c_void); + +pub const NFTNL_EXPR_NAME: u32 = 0; +pub const NFTNL_EXPR_BASE: u32 = 1; + +extern "C" { + pub fn nftnl_expr_alloc(name: *const c_char) -> *mut nftnl_expr; + + pub fn nftnl_expr_free(expr: *const nftnl_expr); + + pub fn nftnl_expr_is_set(expr: *const nftnl_expr, type_: u16) -> bool; + + pub fn nftnl_expr_set( + expr: *mut nftnl_expr, + type_: u16, + data: *const c_void, + data_len: u32, + ) -> c_int; + + pub fn nftnl_expr_set_u8(expr: *mut nftnl_expr, type_: u16, data: u8); + + pub fn nftnl_expr_set_u16(expr: *mut nftnl_expr, type_: u16, data: u16); + + pub fn nftnl_expr_set_u32(expr: *mut nftnl_expr, type_: u16, data: u32); + + pub fn nftnl_expr_set_u64(expr: *mut nftnl_expr, type_: u16, data: u64); + + pub fn nftnl_expr_set_str(expr: *mut nftnl_expr, type_: u16, str_: *const c_char) -> c_int; + + pub fn nftnl_expr_get(expr: *const nftnl_expr, type_: u16, data_len: *mut u32) + -> *const c_void; + + pub fn nftnl_expr_get_u8(expr: *const nftnl_expr, type_: u16) -> u8; + + pub fn nftnl_expr_get_u16(expr: *const nftnl_expr, type_: u16) -> u16; + + pub fn nftnl_expr_get_u32(expr: *const nftnl_expr, type_: u16) -> u32; + + pub fn nftnl_expr_get_u64(expr: *const nftnl_expr, type_: u16) -> u64; + + pub fn nftnl_expr_get_str(expr: *const nftnl_expr, type_: u16) -> *const c_char; + + pub fn nftnl_expr_build_payload(nlh: *mut nlmsghdr, expr: *mut nftnl_expr); + + pub fn nftnl_expr_add_expr(expr: *mut nftnl_expr, type_: u32, e: *mut nftnl_expr); + + pub fn nftnl_expr_expr_foreach( + e: *const nftnl_expr, + cb: Option c_int>, + data: *mut c_void, + ) -> c_int; + + pub fn nftnl_expr_snprintf( + buf: *mut c_char, + buflen: usize, + expr: *const nftnl_expr, + type_: u32, + flags: u32, + ) -> c_int; + + pub fn nftnl_expr_fprintf( + fp: *mut FILE, + expr: *const nftnl_expr, + type_: u32, + flags: u32, + ) -> c_int; +} +pub const NFTNL_EXPR_PAYLOAD_DREG: u32 = 1; +pub const NFTNL_EXPR_PAYLOAD_BASE: u32 = 2; +pub const NFTNL_EXPR_PAYLOAD_OFFSET: u32 = 3; +pub const NFTNL_EXPR_PAYLOAD_LEN: u32 = 4; +pub const NFTNL_EXPR_PAYLOAD_SREG: u32 = 5; +pub const NFTNL_EXPR_PAYLOAD_CSUM_TYPE: u32 = 6; +pub const NFTNL_EXPR_PAYLOAD_CSUM_OFFSET: u32 = 7; +pub const NFTNL_EXPR_PAYLOAD_FLAGS: u32 = 8; + +pub const NFTNL_EXPR_NG_DREG: u32 = 1; +pub const NFTNL_EXPR_NG_MODULUS: u32 = 2; +pub const NFTNL_EXPR_NG_TYPE: u32 = 3; +pub const NFTNL_EXPR_NG_OFFSET: u32 = 4; +pub const NFTNL_EXPR_NG_SET_NAME: u32 = 5; +pub const NFTNL_EXPR_NG_SET_ID: u32 = 6; + +pub const NFTNL_EXPR_META_KEY: u32 = 1; +pub const NFTNL_EXPR_META_DREG: u32 = 2; +pub const NFTNL_EXPR_META_SREG: u32 = 3; + +pub const NFTNL_EXPR_RT_KEY: u32 = 1; +pub const NFTNL_EXPR_RT_DREG: u32 = 2; + +pub const NFTNL_EXPR_SOCKET_KEY: u32 = 1; +pub const NFTNL_EXPR_SOCKET_DREG: u32 = 2; +pub const NFTNL_EXPR_SOCKET_LEVEL: u32 = 3; + +pub const NFTNL_EXPR_TUNNEL_KEY: u32 = 1; +pub const NFTNL_EXPR_TUNNEL_DREG: u32 = 2; + +pub const NFTNL_EXPR_CMP_SREG: u32 = 1; +pub const NFTNL_EXPR_CMP_OP: u32 = 2; +pub const NFTNL_EXPR_CMP_DATA: u32 = 3; + +pub const NFTNL_EXPR_RANGE_SREG: u32 = 1; +pub const NFTNL_EXPR_RANGE_OP: u32 = 2; +pub const NFTNL_EXPR_RANGE_FROM_DATA: u32 = 3; +pub const NFTNL_EXPR_RANGE_TO_DATA: u32 = 4; + +pub const NFTNL_EXPR_IMM_DREG: u32 = 1; +pub const NFTNL_EXPR_IMM_DATA: u32 = 2; +pub const NFTNL_EXPR_IMM_VERDICT: u32 = 3; +pub const NFTNL_EXPR_IMM_CHAIN: u32 = 4; +pub const NFTNL_EXPR_IMM_CHAIN_ID: u32 = 5; + +pub const NFTNL_EXPR_CTR_PACKETS: u32 = 1; +pub const NFTNL_EXPR_CTR_BYTES: u32 = 2; + +pub const NFTNL_EXPR_CONNLIMIT_COUNT: u32 = 1; +pub const NFTNL_EXPR_CONNLIMIT_FLAGS: u32 = 2; + +pub const NFTNL_EXPR_BITWISE_SREG: u32 = 1; +pub const NFTNL_EXPR_BITWISE_DREG: u32 = 2; +pub const NFTNL_EXPR_BITWISE_LEN: u32 = 3; +pub const NFTNL_EXPR_BITWISE_MASK: u32 = 4; +pub const NFTNL_EXPR_BITWISE_XOR: u32 = 5; +pub const NFTNL_EXPR_BITWISE_OP: u32 = 6; +pub const NFTNL_EXPR_BITWISE_DATA: u32 = 7; + +pub const NFTNL_EXPR_TG_NAME: u32 = 1; +pub const NFTNL_EXPR_TG_REV: u32 = 2; +pub const NFTNL_EXPR_TG_INFO: u32 = 3; + +pub const NFTNL_EXPR_MT_NAME: u32 = 1; +pub const NFTNL_EXPR_MT_REV: u32 = 2; +pub const NFTNL_EXPR_MT_INFO: u32 = 3; + +pub const NFTNL_EXPR_NAT_TYPE: u32 = 1; +pub const NFTNL_EXPR_NAT_FAMILY: u32 = 2; +pub const NFTNL_EXPR_NAT_REG_ADDR_MIN: u32 = 3; +pub const NFTNL_EXPR_NAT_REG_ADDR_MAX: u32 = 4; +pub const NFTNL_EXPR_NAT_REG_PROTO_MIN: u32 = 5; +pub const NFTNL_EXPR_NAT_REG_PROTO_MAX: u32 = 6; +pub const NFTNL_EXPR_NAT_FLAGS: u32 = 7; + +pub const NFTNL_EXPR_TPROXY_FAMILY: u32 = 1; +pub const NFTNL_EXPR_TPROXY_REG_ADDR: u32 = 2; +pub const NFTNL_EXPR_TPROXY_REG_PORT: u32 = 3; + +pub const NFTNL_EXPR_LOOKUP_SREG: u32 = 1; +pub const NFTNL_EXPR_LOOKUP_DREG: u32 = 2; +pub const NFTNL_EXPR_LOOKUP_SET: u32 = 3; +pub const NFTNL_EXPR_LOOKUP_SET_ID: u32 = 4; +pub const NFTNL_EXPR_LOOKUP_FLAGS: u32 = 5; + +pub const NFTNL_EXPR_DYNSET_SREG_KEY: u32 = 1; +pub const NFTNL_EXPR_DYNSET_SREG_DATA: u32 = 2; +pub const NFTNL_EXPR_DYNSET_OP: u32 = 3; +pub const NFTNL_EXPR_DYNSET_TIMEOUT: u32 = 4; +pub const NFTNL_EXPR_DYNSET_SET_NAME: u32 = 5; +pub const NFTNL_EXPR_DYNSET_SET_ID: u32 = 6; +pub const NFTNL_EXPR_DYNSET_EXPR: u32 = 7; +pub const NFTNL_EXPR_DYNSET_EXPRESSIONS: u32 = 8; +pub const NFTNL_EXPR_DYNSET_FLAGS: u32 = 9; + +pub const NFTNL_EXPR_LOG_PREFIX: u32 = 1; +pub const NFTNL_EXPR_LOG_GROUP: u32 = 2; +pub const NFTNL_EXPR_LOG_SNAPLEN: u32 = 3; +pub const NFTNL_EXPR_LOG_QTHRESHOLD: u32 = 4; +pub const NFTNL_EXPR_LOG_LEVEL: u32 = 5; +pub const NFTNL_EXPR_LOG_FLAGS: u32 = 6; + +pub const NFTNL_EXPR_EXTHDR_DREG: u32 = 1; +pub const NFTNL_EXPR_EXTHDR_TYPE: u32 = 2; +pub const NFTNL_EXPR_EXTHDR_OFFSET: u32 = 3; +pub const NFTNL_EXPR_EXTHDR_LEN: u32 = 4; +pub const NFTNL_EXPR_EXTHDR_FLAGS: u32 = 5; +pub const NFTNL_EXPR_EXTHDR_OP: u32 = 6; +pub const NFTNL_EXPR_EXTHDR_SREG: u32 = 7; + +pub const NFTNL_EXPR_CT_DREG: u32 = 1; +pub const NFTNL_EXPR_CT_KEY: u32 = 2; +pub const NFTNL_EXPR_CT_DIR: u32 = 3; +pub const NFTNL_EXPR_CT_SREG: u32 = 4; + +pub const NFTNL_EXPR_BYTEORDER_DREG: u32 = 1; +pub const NFTNL_EXPR_BYTEORDER_SREG: u32 = 2; +pub const NFTNL_EXPR_BYTEORDER_OP: u32 = 3; +pub const NFTNL_EXPR_BYTEORDER_LEN: u32 = 4; +pub const NFTNL_EXPR_BYTEORDER_SIZE: u32 = 5; + +pub const NFTNL_EXPR_LIMIT_RATE: u32 = 1; +pub const NFTNL_EXPR_LIMIT_UNIT: u32 = 2; +pub const NFTNL_EXPR_LIMIT_BURST: u32 = 3; +pub const NFTNL_EXPR_LIMIT_TYPE: u32 = 4; +pub const NFTNL_EXPR_LIMIT_FLAGS: u32 = 5; + +pub const NFTNL_EXPR_REJECT_TYPE: u32 = 1; +pub const NFTNL_EXPR_REJECT_CODE: u32 = 2; + +pub const NFTNL_EXPR_QUEUE_NUM: u32 = 1; +pub const NFTNL_EXPR_QUEUE_TOTAL: u32 = 2; +pub const NFTNL_EXPR_QUEUE_FLAGS: u32 = 3; +pub const NFTNL_EXPR_QUEUE_SREG_QNUM: u32 = 4; + +pub const NFTNL_EXPR_QUOTA_BYTES: u32 = 1; +pub const NFTNL_EXPR_QUOTA_FLAGS: u32 = 2; +pub const NFTNL_EXPR_QUOTA_CONSUMED: u32 = 3; + +pub const NFTNL_EXPR_MASQ_FLAGS: u32 = 1; +pub const NFTNL_EXPR_MASQ_REG_PROTO_MIN: u32 = 2; +pub const NFTNL_EXPR_MASQ_REG_PROTO_MAX: u32 = 3; + +pub const NFTNL_EXPR_REDIR_REG_PROTO_MIN: u32 = 1; +pub const NFTNL_EXPR_REDIR_REG_PROTO_MAX: u32 = 2; +pub const NFTNL_EXPR_REDIR_FLAGS: u32 = 3; + +pub const NFTNL_EXPR_DUP_SREG_ADDR: u32 = 1; +pub const NFTNL_EXPR_DUP_SREG_DEV: u32 = 2; + +pub const NFTNL_EXPR_FLOW_TABLE_NAME: u32 = 1; + +pub const NFTNL_EXPR_FWD_SREG_DEV: u32 = 1; +pub const NFTNL_EXPR_FWD_SREG_ADDR: u32 = 2; +pub const NFTNL_EXPR_FWD_NFPROTO: u32 = 3; + +pub const NFTNL_EXPR_HASH_SREG: u32 = 1; +pub const NFTNL_EXPR_HASH_DREG: u32 = 2; +pub const NFTNL_EXPR_HASH_LEN: u32 = 3; +pub const NFTNL_EXPR_HASH_MODULUS: u32 = 4; +pub const NFTNL_EXPR_HASH_SEED: u32 = 5; +pub const NFTNL_EXPR_HASH_OFFSET: u32 = 6; +pub const NFTNL_EXPR_HASH_TYPE: u32 = 7; +pub const NFTNL_EXPR_HASH_SET_NAME: u32 = 8; +pub const NFTNL_EXPR_HASH_SET_ID: u32 = 9; + +pub const NFTNL_EXPR_FIB_DREG: u32 = 1; +pub const NFTNL_EXPR_FIB_RESULT: u32 = 2; +pub const NFTNL_EXPR_FIB_FLAGS: u32 = 3; + +pub const NFTNL_EXPR_OBJREF_IMM_TYPE: u32 = 1; +pub const NFTNL_EXPR_OBJREF_IMM_NAME: u32 = 2; +pub const NFTNL_EXPR_OBJREF_SET_SREG: u32 = 3; +pub const NFTNL_EXPR_OBJREF_SET_NAME: u32 = 4; +pub const NFTNL_EXPR_OBJREF_SET_ID: u32 = 5; + +pub const NFTNL_EXPR_OSF_DREG: u32 = 1; +pub const NFTNL_EXPR_OSF_TTL: u32 = 2; +pub const NFTNL_EXPR_OSF_FLAGS: u32 = 3; + +pub const NFTNL_EXPR_XFRM_DREG: u32 = 1; +pub const NFTNL_EXPR_XFRM_SREG: u32 = 2; +pub const NFTNL_EXPR_XFRM_KEY: u32 = 3; +pub const NFTNL_EXPR_XFRM_DIR: u32 = 4; +pub const NFTNL_EXPR_XFRM_SPNUM: u32 = 5; + +pub const NFTNL_EXPR_SYNPROXY_MSS: u32 = 1; +pub const NFTNL_EXPR_SYNPROXY_WSCALE: u32 = 2; +pub const NFTNL_EXPR_SYNPROXY_FLAGS: u32 = 3; + +pub const NFTNL_EXPR_LAST_MSECS: u32 = 1; +pub const NFTNL_EXPR_LAST_SET: u32 = 2; + +pub const NFTNL_EXPR_INNER_TYPE: u32 = 1; +pub const NFTNL_EXPR_INNER_FLAGS: u32 = 2; +pub const NFTNL_EXPR_INNER_HDRSIZE: u32 = 3; +pub const NFTNL_EXPR_INNER_EXPR: u32 = 4; + +#[repr(C)] +pub struct nftnl_gen(c_void); + +extern "C" { + pub fn nftnl_gen_alloc() -> *mut nftnl_gen; + + pub fn nftnl_gen_free(arg1: *const nftnl_gen); +} +pub const NFTNL_GEN_ID: u32 = 0; +pub const __NFTNL_GEN_MAX: u32 = 1; + +extern "C" { + pub fn nftnl_gen_is_set(gen: *const nftnl_gen, attr: u16) -> bool; + + pub fn nftnl_gen_unset(gen: *mut nftnl_gen, attr: u16); + + pub fn nftnl_gen_set(gen: *mut nftnl_gen, attr: u16, data: *const c_void) -> c_int; + + pub fn nftnl_gen_set_data( + gen: *mut nftnl_gen, + attr: u16, + data: *const c_void, + data_len: u32, + ) -> c_int; + + pub fn nftnl_gen_get(gen: *const nftnl_gen, attr: u16) -> *const c_void; + + pub fn nftnl_gen_get_data( + gen: *const nftnl_gen, + attr: u16, + data_len: *mut u32, + ) -> *const c_void; + + pub fn nftnl_gen_set_u32(gen: *mut nftnl_gen, attr: u16, data: u32); + + pub fn nftnl_gen_get_u32(gen: *const nftnl_gen, attr: u16) -> u32; + + pub fn nftnl_gen_nlmsg_parse(nlh: *const nlmsghdr, gen: *mut nftnl_gen) -> c_int; + + pub fn nftnl_gen_snprintf( + buf: *mut c_char, + size: usize, + gen: *const nftnl_gen, + type_: u32, + flags: u32, + ) -> c_int; + + pub fn nftnl_gen_fprintf(fp: *mut FILE, gen: *const nftnl_gen, type_: u32, flags: u32) + -> c_int; +} +pub const NFTNL_OBJ_TABLE: u32 = 0; +pub const NFTNL_OBJ_NAME: u32 = 1; +pub const NFTNL_OBJ_TYPE: u32 = 2; +pub const NFTNL_OBJ_FAMILY: u32 = 3; +pub const NFTNL_OBJ_USE: u32 = 4; +pub const NFTNL_OBJ_HANDLE: u32 = 5; +pub const NFTNL_OBJ_USERDATA: u32 = 6; +pub const NFTNL_OBJ_BASE: u32 = 16; +pub const __NFTNL_OBJ_MAX: u32 = 17; + +pub const NFTNL_OBJ_CTR_PKTS: u32 = 16; +pub const NFTNL_OBJ_CTR_BYTES: u32 = 17; + +pub const NFTNL_OBJ_QUOTA_BYTES: u32 = 16; +pub const NFTNL_OBJ_QUOTA_CONSUMED: u32 = 17; +pub const NFTNL_OBJ_QUOTA_FLAGS: u32 = 18; + +pub const NFTNL_OBJ_CT_HELPER_NAME: u32 = 16; +pub const NFTNL_OBJ_CT_HELPER_L3PROTO: u32 = 17; +pub const NFTNL_OBJ_CT_HELPER_L4PROTO: u32 = 18; + +pub const NFTNL_CTTIMEOUT_TCP_SYN_SENT: nftnl_cttimeout_array_tcp = 0; +pub const NFTNL_CTTIMEOUT_TCP_SYN_RECV: nftnl_cttimeout_array_tcp = 1; +pub const NFTNL_CTTIMEOUT_TCP_ESTABLISHED: nftnl_cttimeout_array_tcp = 2; +pub const NFTNL_CTTIMEOUT_TCP_FIN_WAIT: nftnl_cttimeout_array_tcp = 3; +pub const NFTNL_CTTIMEOUT_TCP_CLOSE_WAIT: nftnl_cttimeout_array_tcp = 4; +pub const NFTNL_CTTIMEOUT_TCP_LAST_ACK: nftnl_cttimeout_array_tcp = 5; +pub const NFTNL_CTTIMEOUT_TCP_TIME_WAIT: nftnl_cttimeout_array_tcp = 6; +pub const NFTNL_CTTIMEOUT_TCP_CLOSE: nftnl_cttimeout_array_tcp = 7; +pub const NFTNL_CTTIMEOUT_TCP_SYN_SENT2: nftnl_cttimeout_array_tcp = 8; +pub const NFTNL_CTTIMEOUT_TCP_RETRANS: nftnl_cttimeout_array_tcp = 9; +pub const NFTNL_CTTIMEOUT_TCP_UNACK: nftnl_cttimeout_array_tcp = 10; +pub const NFTNL_CTTIMEOUT_TCP_MAX: nftnl_cttimeout_array_tcp = 11; +pub type nftnl_cttimeout_array_tcp = c_uint; +pub const NFTNL_CTTIMEOUT_UDP_UNREPLIED: nftnl_cttimeout_array_udp = 0; +pub const NFTNL_CTTIMEOUT_UDP_REPLIED: nftnl_cttimeout_array_udp = 1; +pub const NFTNL_CTTIMEOUT_UDP_MAX: nftnl_cttimeout_array_udp = 2; +pub type nftnl_cttimeout_array_udp = c_uint; +pub const NFTNL_OBJ_CT_TIMEOUT_L3PROTO: u32 = 16; +pub const NFTNL_OBJ_CT_TIMEOUT_L4PROTO: u32 = 17; +pub const NFTNL_OBJ_CT_TIMEOUT_ARRAY: u32 = 18; + +pub const NFTNL_OBJ_CT_EXPECT_L3PROTO: u32 = 16; +pub const NFTNL_OBJ_CT_EXPECT_L4PROTO: u32 = 17; +pub const NFTNL_OBJ_CT_EXPECT_DPORT: u32 = 18; +pub const NFTNL_OBJ_CT_EXPECT_TIMEOUT: u32 = 19; +pub const NFTNL_OBJ_CT_EXPECT_SIZE: u32 = 20; + +pub const NFTNL_OBJ_LIMIT_RATE: u32 = 16; +pub const NFTNL_OBJ_LIMIT_UNIT: u32 = 17; +pub const NFTNL_OBJ_LIMIT_BURST: u32 = 18; +pub const NFTNL_OBJ_LIMIT_TYPE: u32 = 19; +pub const NFTNL_OBJ_LIMIT_FLAGS: u32 = 20; + +pub const NFTNL_OBJ_SYNPROXY_MSS: u32 = 16; +pub const NFTNL_OBJ_SYNPROXY_WSCALE: u32 = 17; +pub const NFTNL_OBJ_SYNPROXY_FLAGS: u32 = 18; + +pub const NFTNL_OBJ_TUNNEL_ID: u32 = 16; +pub const NFTNL_OBJ_TUNNEL_IPV4_SRC: u32 = 17; +pub const NFTNL_OBJ_TUNNEL_IPV4_DST: u32 = 18; +pub const NFTNL_OBJ_TUNNEL_IPV6_SRC: u32 = 19; +pub const NFTNL_OBJ_TUNNEL_IPV6_DST: u32 = 20; +pub const NFTNL_OBJ_TUNNEL_IPV6_FLOWLABEL: u32 = 21; +pub const NFTNL_OBJ_TUNNEL_SPORT: u32 = 22; +pub const NFTNL_OBJ_TUNNEL_DPORT: u32 = 23; +pub const NFTNL_OBJ_TUNNEL_FLAGS: u32 = 24; +pub const NFTNL_OBJ_TUNNEL_TOS: u32 = 25; +pub const NFTNL_OBJ_TUNNEL_TTL: u32 = 26; +pub const NFTNL_OBJ_TUNNEL_VXLAN_GBP: u32 = 27; +pub const NFTNL_OBJ_TUNNEL_ERSPAN_VERSION: u32 = 28; +pub const NFTNL_OBJ_TUNNEL_ERSPAN_V1_INDEX: u32 = 29; +pub const NFTNL_OBJ_TUNNEL_ERSPAN_V2_HWID: u32 = 30; +pub const NFTNL_OBJ_TUNNEL_ERSPAN_V2_DIR: u32 = 31; + +pub const NFTNL_OBJ_SECMARK_CTX: u32 = 16; + +#[repr(C)] +pub struct nftnl_obj(c_void); + +extern "C" { + pub fn nftnl_obj_alloc() -> *mut nftnl_obj; + + pub fn nftnl_obj_free(ne: *const nftnl_obj); + + pub fn nftnl_obj_is_set(ne: *const nftnl_obj, attr: u16) -> bool; + + pub fn nftnl_obj_unset(ne: *mut nftnl_obj, attr: u16); + + pub fn nftnl_obj_set_data(ne: *mut nftnl_obj, attr: u16, data: *const c_void, data_len: u32); + + pub fn nftnl_obj_set(ne: *mut nftnl_obj, attr: u16, data: *const c_void); + + pub fn nftnl_obj_set_u8(ne: *mut nftnl_obj, attr: u16, val: u8); + + pub fn nftnl_obj_set_u16(ne: *mut nftnl_obj, attr: u16, val: u16); + + pub fn nftnl_obj_set_u32(ne: *mut nftnl_obj, attr: u16, val: u32); + + pub fn nftnl_obj_set_u64(obj: *mut nftnl_obj, attr: u16, val: u64); + + pub fn nftnl_obj_set_str(ne: *mut nftnl_obj, attr: u16, str_: *const c_char); + + pub fn nftnl_obj_get_data(ne: *mut nftnl_obj, attr: u16, data_len: *mut u32) -> *const c_void; + + pub fn nftnl_obj_get(ne: *mut nftnl_obj, attr: u16) -> *const c_void; + + pub fn nftnl_obj_get_u8(ne: *mut nftnl_obj, attr: u16) -> u8; + + pub fn nftnl_obj_get_u16(obj: *mut nftnl_obj, attr: u16) -> u16; + + pub fn nftnl_obj_get_u32(ne: *mut nftnl_obj, attr: u16) -> u32; + + pub fn nftnl_obj_get_u64(obj: *mut nftnl_obj, attr: u16) -> u64; + + pub fn nftnl_obj_get_str(ne: *mut nftnl_obj, attr: u16) -> *const c_char; + + pub fn nftnl_obj_nlmsg_build_payload(nlh: *mut nlmsghdr, ne: *const nftnl_obj); + + pub fn nftnl_obj_nlmsg_parse(nlh: *const nlmsghdr, ne: *mut nftnl_obj) -> c_int; + + pub fn nftnl_obj_parse( + ne: *mut nftnl_obj, + type_: nftnl_parse_type, + data: *const c_char, + err: *mut nftnl_parse_err, + ) -> c_int; + + pub fn nftnl_obj_parse_file( + ne: *mut nftnl_obj, + type_: nftnl_parse_type, + fp: *mut FILE, + err: *mut nftnl_parse_err, + ) -> c_int; + + pub fn nftnl_obj_snprintf( + buf: *mut c_char, + size: usize, + ne: *const nftnl_obj, + type_: u32, + flags: u32, + ) -> c_int; + + pub fn nftnl_obj_fprintf(fp: *mut FILE, ne: *const nftnl_obj, type_: u32, flags: u32) -> c_int; +} +#[repr(C)] +pub struct nftnl_obj_list(c_void); + +extern "C" { + pub fn nftnl_obj_list_alloc() -> *mut nftnl_obj_list; + + pub fn nftnl_obj_list_free(list: *mut nftnl_obj_list); + + pub fn nftnl_obj_list_is_empty(list: *mut nftnl_obj_list) -> c_int; + + pub fn nftnl_obj_list_add(r: *mut nftnl_obj, list: *mut nftnl_obj_list); + + pub fn nftnl_obj_list_add_tail(r: *mut nftnl_obj, list: *mut nftnl_obj_list); + + pub fn nftnl_obj_list_del(t: *mut nftnl_obj); + + pub fn nftnl_obj_list_foreach( + table_list: *mut nftnl_obj_list, + cb: Option c_int>, + data: *mut c_void, + ) -> c_int; +} +#[repr(C)] +pub struct nftnl_obj_list_iter(c_void); + +extern "C" { + pub fn nftnl_obj_list_iter_create(l: *mut nftnl_obj_list) -> *mut nftnl_obj_list_iter; + + pub fn nftnl_obj_list_iter_next(iter: *mut nftnl_obj_list_iter) -> *mut nftnl_obj; + + pub fn nftnl_obj_list_iter_destroy(iter: *mut nftnl_obj_list_iter); + + pub fn nftnl_rule_alloc() -> *mut nftnl_rule; + + pub fn nftnl_rule_free(arg1: *const nftnl_rule); +} +pub const NFTNL_RULE_FAMILY: nftnl_rule_attr = 0; +pub const NFTNL_RULE_TABLE: nftnl_rule_attr = 1; +pub const NFTNL_RULE_CHAIN: nftnl_rule_attr = 2; +pub const NFTNL_RULE_HANDLE: nftnl_rule_attr = 3; +pub const NFTNL_RULE_COMPAT_PROTO: nftnl_rule_attr = 4; +pub const NFTNL_RULE_COMPAT_FLAGS: nftnl_rule_attr = 5; +pub const NFTNL_RULE_POSITION: nftnl_rule_attr = 6; +pub const NFTNL_RULE_USERDATA: nftnl_rule_attr = 7; +pub const NFTNL_RULE_ID: nftnl_rule_attr = 8; +pub const NFTNL_RULE_POSITION_ID: nftnl_rule_attr = 9; +pub const __NFTNL_RULE_MAX: nftnl_rule_attr = 10; +pub type nftnl_rule_attr = c_uint; +extern "C" { + pub fn nftnl_rule_unset(r: *mut nftnl_rule, attr: u16); + + pub fn nftnl_rule_is_set(r: *const nftnl_rule, attr: u16) -> bool; + + pub fn nftnl_rule_set(r: *mut nftnl_rule, attr: u16, data: *const c_void) -> c_int; + + pub fn nftnl_rule_set_data( + r: *mut nftnl_rule, + attr: u16, + data: *const c_void, + data_len: u32, + ) -> c_int; + + pub fn nftnl_rule_set_u32(r: *mut nftnl_rule, attr: u16, val: u32); + + pub fn nftnl_rule_set_u64(r: *mut nftnl_rule, attr: u16, val: u64); + + pub fn nftnl_rule_set_str(r: *mut nftnl_rule, attr: u16, str_: *const c_char) -> c_int; + + pub fn nftnl_rule_get(r: *const nftnl_rule, attr: u16) -> *const c_void; + + pub fn nftnl_rule_get_data( + r: *const nftnl_rule, + attr: u16, + data_len: *mut u32, + ) -> *const c_void; + + pub fn nftnl_rule_get_str(r: *const nftnl_rule, attr: u16) -> *const c_char; + + pub fn nftnl_rule_get_u8(r: *const nftnl_rule, attr: u16) -> u8; + + pub fn nftnl_rule_get_u32(r: *const nftnl_rule, attr: u16) -> u32; + + pub fn nftnl_rule_get_u64(r: *const nftnl_rule, attr: u16) -> u64; + + pub fn nftnl_rule_add_expr(r: *mut nftnl_rule, expr: *mut nftnl_expr); + + pub fn nftnl_rule_del_expr(expr: *mut nftnl_expr); + + pub fn nftnl_rule_nlmsg_build_payload(nlh: *mut nlmsghdr, t: *mut nftnl_rule); + + pub fn nftnl_rule_parse( + r: *mut nftnl_rule, + type_: nftnl_parse_type, + data: *const c_char, + err: *mut nftnl_parse_err, + ) -> c_int; + + pub fn nftnl_rule_parse_file( + r: *mut nftnl_rule, + type_: nftnl_parse_type, + fp: *mut FILE, + err: *mut nftnl_parse_err, + ) -> c_int; + + pub fn nftnl_rule_snprintf( + buf: *mut c_char, + size: usize, + t: *const nftnl_rule, + type_: u32, + flags: u32, + ) -> c_int; + + pub fn nftnl_rule_fprintf(fp: *mut FILE, r: *const nftnl_rule, type_: u32, flags: u32) + -> c_int; + + pub fn nftnl_rule_nlmsg_parse(nlh: *const nlmsghdr, t: *mut nftnl_rule) -> c_int; + + pub fn nftnl_expr_foreach( + r: *mut nftnl_rule, + cb: Option c_int>, + data: *mut c_void, + ) -> c_int; +} +#[repr(C)] +pub struct nftnl_expr_iter(c_void); + +extern "C" { + pub fn nftnl_expr_iter_create(r: *const nftnl_rule) -> *mut nftnl_expr_iter; + + pub fn nftnl_expr_iter_next(iter: *mut nftnl_expr_iter) -> *mut nftnl_expr; + + pub fn nftnl_expr_iter_destroy(iter: *mut nftnl_expr_iter); +} +#[repr(C)] +pub struct nftnl_rule_list(c_void); + +extern "C" { + pub fn nftnl_rule_list_alloc() -> *mut nftnl_rule_list; + + pub fn nftnl_rule_list_free(list: *mut nftnl_rule_list); + + pub fn nftnl_rule_list_is_empty(list: *const nftnl_rule_list) -> c_int; + + pub fn nftnl_rule_list_add(r: *mut nftnl_rule, list: *mut nftnl_rule_list); + + pub fn nftnl_rule_list_add_tail(r: *mut nftnl_rule, list: *mut nftnl_rule_list); + + pub fn nftnl_rule_list_insert_at(r: *mut nftnl_rule, pos: *mut nftnl_rule); + + pub fn nftnl_rule_list_del(r: *mut nftnl_rule); + + pub fn nftnl_rule_list_foreach( + rule_list: *mut nftnl_rule_list, + cb: Option c_int>, + data: *mut c_void, + ) -> c_int; +} +#[repr(C)] +pub struct nftnl_rule_list_iter(c_void); + +extern "C" { + pub fn nftnl_rule_list_iter_create(l: *const nftnl_rule_list) -> *mut nftnl_rule_list_iter; + + pub fn nftnl_rule_list_iter_cur(iter: *mut nftnl_rule_list_iter) -> *mut nftnl_rule; + + pub fn nftnl_rule_list_iter_next(iter: *mut nftnl_rule_list_iter) -> *mut nftnl_rule; + + pub fn nftnl_rule_list_iter_destroy(iter: *const nftnl_rule_list_iter); +} +#[repr(C)] +pub struct nftnl_ruleset(c_void); + +extern "C" { + pub fn nftnl_ruleset_alloc() -> *mut nftnl_ruleset; + + pub fn nftnl_ruleset_free(r: *const nftnl_ruleset); +} +pub const NFTNL_RULESET_TABLELIST: u32 = 0; +pub const NFTNL_RULESET_CHAINLIST: u32 = 1; +pub const NFTNL_RULESET_SETLIST: u32 = 2; +pub const NFTNL_RULESET_RULELIST: u32 = 3; + +pub const NFTNL_RULESET_UNSPEC: nftnl_ruleset_type = 0; +pub const NFTNL_RULESET_RULESET: nftnl_ruleset_type = 1; +pub const NFTNL_RULESET_TABLE: nftnl_ruleset_type = 2; +pub const NFTNL_RULESET_CHAIN: nftnl_ruleset_type = 3; +pub const NFTNL_RULESET_RULE: nftnl_ruleset_type = 4; +pub const NFTNL_RULESET_SET: nftnl_ruleset_type = 5; +pub const NFTNL_RULESET_SET_ELEMS: nftnl_ruleset_type = 6; +pub type nftnl_ruleset_type = c_uint; +extern "C" { + pub fn nftnl_ruleset_is_set(r: *const nftnl_ruleset, attr: u16) -> bool; + + pub fn nftnl_ruleset_unset(r: *mut nftnl_ruleset, attr: u16); + + pub fn nftnl_ruleset_set(r: *mut nftnl_ruleset, attr: u16, data: *mut c_void); + + pub fn nftnl_ruleset_get(r: *const nftnl_ruleset, attr: u16) -> *mut c_void; +} +pub const NFTNL_RULESET_CTX_CMD: u32 = 0; +pub const NFTNL_RULESET_CTX_TYPE: u32 = 1; +pub const NFTNL_RULESET_CTX_TABLE: u32 = 2; +pub const NFTNL_RULESET_CTX_CHAIN: u32 = 3; +pub const NFTNL_RULESET_CTX_RULE: u32 = 4; +pub const NFTNL_RULESET_CTX_SET: u32 = 5; +pub const NFTNL_RULESET_CTX_DATA: u32 = 6; + +#[repr(C)] +pub struct nftnl_parse_ctx(c_void); + +extern "C" { + pub fn nftnl_ruleset_ctx_free(ctx: *const nftnl_parse_ctx); + + pub fn nftnl_ruleset_ctx_is_set(ctx: *const nftnl_parse_ctx, attr: u16) -> bool; + + pub fn nftnl_ruleset_ctx_get(ctx: *const nftnl_parse_ctx, attr: u16) -> *mut c_void; + + pub fn nftnl_ruleset_ctx_get_u32(ctx: *const nftnl_parse_ctx, attr: u16) -> u32; + + pub fn nftnl_ruleset_parse_file_cb( + type_: nftnl_parse_type, + fp: *mut FILE, + err: *mut nftnl_parse_err, + data: *mut c_void, + cb: Option c_int>, + ) -> c_int; + + pub fn nftnl_ruleset_parse_buffer_cb( + type_: nftnl_parse_type, + buffer: *const c_char, + err: *mut nftnl_parse_err, + data: *mut c_void, + cb: Option c_int>, + ) -> c_int; + + pub fn nftnl_ruleset_parse( + rs: *mut nftnl_ruleset, + type_: nftnl_parse_type, + data: *const c_char, + err: *mut nftnl_parse_err, + ) -> c_int; + + pub fn nftnl_ruleset_parse_file( + rs: *mut nftnl_ruleset, + type_: nftnl_parse_type, + fp: *mut FILE, + err: *mut nftnl_parse_err, + ) -> c_int; + + pub fn nftnl_ruleset_snprintf( + buf: *mut c_char, + size: usize, + rs: *const nftnl_ruleset, + type_: u32, + flags: u32, + ) -> c_int; + + pub fn nftnl_ruleset_fprintf( + fp: *mut FILE, + rs: *const nftnl_ruleset, + type_: u32, + flags: u32, + ) -> c_int; +} +pub const NFTNL_SET_TABLE: nftnl_set_attr = 0; +pub const NFTNL_SET_NAME: nftnl_set_attr = 1; +pub const NFTNL_SET_FLAGS: nftnl_set_attr = 2; +pub const NFTNL_SET_KEY_TYPE: nftnl_set_attr = 3; +pub const NFTNL_SET_KEY_LEN: nftnl_set_attr = 4; +pub const NFTNL_SET_DATA_TYPE: nftnl_set_attr = 5; +pub const NFTNL_SET_DATA_LEN: nftnl_set_attr = 6; +pub const NFTNL_SET_FAMILY: nftnl_set_attr = 7; +pub const NFTNL_SET_ID: nftnl_set_attr = 8; +pub const NFTNL_SET_POLICY: nftnl_set_attr = 9; +pub const NFTNL_SET_DESC_SIZE: nftnl_set_attr = 10; +pub const NFTNL_SET_TIMEOUT: nftnl_set_attr = 11; +pub const NFTNL_SET_GC_INTERVAL: nftnl_set_attr = 12; +pub const NFTNL_SET_USERDATA: nftnl_set_attr = 13; +pub const NFTNL_SET_OBJ_TYPE: nftnl_set_attr = 14; +pub const NFTNL_SET_HANDLE: nftnl_set_attr = 15; +pub const NFTNL_SET_DESC_CONCAT: nftnl_set_attr = 16; +pub const NFTNL_SET_EXPR: nftnl_set_attr = 17; +pub const NFTNL_SET_EXPRESSIONS: nftnl_set_attr = 18; +pub const __NFTNL_SET_MAX: nftnl_set_attr = 19; +pub type nftnl_set_attr = c_uint; +#[repr(C)] +pub struct nftnl_set(c_void); + +extern "C" { + pub fn nftnl_set_alloc() -> *mut nftnl_set; + + pub fn nftnl_set_free(s: *const nftnl_set); + + pub fn nftnl_set_clone(set: *const nftnl_set) -> *mut nftnl_set; + + pub fn nftnl_set_is_set(s: *const nftnl_set, attr: u16) -> bool; + + pub fn nftnl_set_unset(s: *mut nftnl_set, attr: u16); + + pub fn nftnl_set_set(s: *mut nftnl_set, attr: u16, data: *const c_void) -> c_int; + + pub fn nftnl_set_set_data( + s: *mut nftnl_set, + attr: u16, + data: *const c_void, + data_len: u32, + ) -> c_int; + + pub fn nftnl_set_set_u32(s: *mut nftnl_set, attr: u16, val: u32); + + pub fn nftnl_set_set_u64(s: *mut nftnl_set, attr: u16, val: u64); + + pub fn nftnl_set_set_str(s: *mut nftnl_set, attr: u16, str_: *const c_char) -> c_int; + + pub fn nftnl_set_get(s: *const nftnl_set, attr: u16) -> *const c_void; + + pub fn nftnl_set_get_data(s: *const nftnl_set, attr: u16, data_len: *mut u32) -> *const c_void; + + pub fn nftnl_set_get_str(s: *const nftnl_set, attr: u16) -> *const c_char; + + pub fn nftnl_set_get_u32(s: *const nftnl_set, attr: u16) -> u32; + + pub fn nftnl_set_get_u64(s: *const nftnl_set, attr: u16) -> u64; + + pub fn nftnl_set_nlmsg_build_payload(nlh: *mut nlmsghdr, s: *mut nftnl_set); + + pub fn nftnl_set_nlmsg_parse(nlh: *const nlmsghdr, s: *mut nftnl_set) -> c_int; + + pub fn nftnl_set_elems_nlmsg_parse(nlh: *const nlmsghdr, s: *mut nftnl_set) -> c_int; + + pub fn nftnl_set_snprintf( + buf: *mut c_char, + size: usize, + s: *const nftnl_set, + type_: u32, + flags: u32, + ) -> c_int; + + pub fn nftnl_set_fprintf(fp: *mut FILE, s: *const nftnl_set, type_: u32, flags: u32) -> c_int; +} +#[repr(C)] +pub struct nftnl_set_list(c_void); + +extern "C" { + pub fn nftnl_set_list_alloc() -> *mut nftnl_set_list; + + pub fn nftnl_set_list_free(list: *mut nftnl_set_list); + + pub fn nftnl_set_list_is_empty(list: *const nftnl_set_list) -> c_int; + + pub fn nftnl_set_list_add(s: *mut nftnl_set, list: *mut nftnl_set_list); + + pub fn nftnl_set_list_add_tail(s: *mut nftnl_set, list: *mut nftnl_set_list); + + pub fn nftnl_set_list_del(s: *mut nftnl_set); + + pub fn nftnl_set_list_foreach( + set_list: *mut nftnl_set_list, + cb: Option c_int>, + data: *mut c_void, + ) -> c_int; + + pub fn nftnl_set_list_lookup_byname( + set_list: *mut nftnl_set_list, + set: *const c_char, + ) -> *mut nftnl_set; + + pub fn nftnl_set_add_expr(s: *mut nftnl_set, expr: *mut nftnl_expr); + + pub fn nftnl_set_expr_foreach( + s: *const nftnl_set, + cb: Option c_int>, + data: *mut c_void, + ) -> c_int; +} +#[repr(C)] +pub struct nftnl_set_list_iter(c_void); + +extern "C" { + pub fn nftnl_set_list_iter_create(l: *const nftnl_set_list) -> *mut nftnl_set_list_iter; + + pub fn nftnl_set_list_iter_cur(iter: *const nftnl_set_list_iter) -> *mut nftnl_set; + + pub fn nftnl_set_list_iter_next(iter: *mut nftnl_set_list_iter) -> *mut nftnl_set; + + pub fn nftnl_set_list_iter_destroy(iter: *const nftnl_set_list_iter); + + pub fn nftnl_set_parse( + s: *mut nftnl_set, + type_: nftnl_parse_type, + data: *const c_char, + err: *mut nftnl_parse_err, + ) -> c_int; + + pub fn nftnl_set_parse_file( + s: *mut nftnl_set, + type_: nftnl_parse_type, + fp: *mut FILE, + err: *mut nftnl_parse_err, + ) -> c_int; +} +pub const NFTNL_SET_ELEM_FLAGS: u32 = 0; +pub const NFTNL_SET_ELEM_KEY: u32 = 1; +pub const NFTNL_SET_ELEM_VERDICT: u32 = 2; +pub const NFTNL_SET_ELEM_CHAIN: u32 = 3; +pub const NFTNL_SET_ELEM_DATA: u32 = 4; +pub const NFTNL_SET_ELEM_TIMEOUT: u32 = 5; +pub const NFTNL_SET_ELEM_EXPIRATION: u32 = 6; +pub const NFTNL_SET_ELEM_USERDATA: u32 = 7; +pub const NFTNL_SET_ELEM_EXPR: u32 = 8; +pub const NFTNL_SET_ELEM_OBJREF: u32 = 9; +pub const NFTNL_SET_ELEM_KEY_END: u32 = 10; +pub const NFTNL_SET_ELEM_EXPRESSIONS: u32 = 11; +pub const __NFTNL_SET_ELEM_MAX: u32 = 12; + +#[repr(C)] +pub struct nftnl_set_elem(c_void); + +extern "C" { + pub fn nftnl_set_elem_alloc() -> *mut nftnl_set_elem; + + pub fn nftnl_set_elem_free(s: *mut nftnl_set_elem); + + pub fn nftnl_set_elem_clone(elem: *mut nftnl_set_elem) -> *mut nftnl_set_elem; + + pub fn nftnl_set_elem_add(s: *mut nftnl_set, elem: *mut nftnl_set_elem); + + pub fn nftnl_set_elem_unset(s: *mut nftnl_set_elem, attr: u16); + + pub fn nftnl_set_elem_set( + s: *mut nftnl_set_elem, + attr: u16, + data: *const c_void, + data_len: u32, + ) -> c_int; + + pub fn nftnl_set_elem_set_u32(s: *mut nftnl_set_elem, attr: u16, val: u32); + + pub fn nftnl_set_elem_set_u64(s: *mut nftnl_set_elem, attr: u16, val: u64); + + pub fn nftnl_set_elem_set_str(s: *mut nftnl_set_elem, attr: u16, str_: *const c_char) -> c_int; + + pub fn nftnl_set_elem_get( + s: *mut nftnl_set_elem, + attr: u16, + data_len: *mut u32, + ) -> *const c_void; + + pub fn nftnl_set_elem_get_str(s: *mut nftnl_set_elem, attr: u16) -> *const c_char; + + pub fn nftnl_set_elem_get_u32(s: *mut nftnl_set_elem, attr: u16) -> u32; + + pub fn nftnl_set_elem_get_u64(s: *mut nftnl_set_elem, attr: u16) -> u64; + + pub fn nftnl_set_elem_is_set(s: *const nftnl_set_elem, attr: u16) -> bool; + + pub fn nftnl_set_elems_nlmsg_build_payload(nlh: *mut nlmsghdr, s: *mut nftnl_set); + + pub fn nftnl_set_elem_nlmsg_build_payload(nlh: *mut nlmsghdr, e: *mut nftnl_set_elem); +} +#[repr(C)] +pub struct nlattr(c_void); + +extern "C" { + pub fn nftnl_set_elem_nlmsg_build( + nlh: *mut nlmsghdr, + elem: *mut nftnl_set_elem, + i: c_int, + ) -> *mut nlattr; + + pub fn nftnl_set_elem_parse( + e: *mut nftnl_set_elem, + type_: nftnl_parse_type, + data: *const c_char, + err: *mut nftnl_parse_err, + ) -> c_int; + + pub fn nftnl_set_elem_parse_file( + e: *mut nftnl_set_elem, + type_: nftnl_parse_type, + fp: *mut FILE, + err: *mut nftnl_parse_err, + ) -> c_int; + + pub fn nftnl_set_elem_snprintf( + buf: *mut c_char, + size: usize, + s: *const nftnl_set_elem, + type_: u32, + flags: u32, + ) -> c_int; + + pub fn nftnl_set_elem_fprintf( + fp: *mut FILE, + se: *const nftnl_set_elem, + type_: u32, + flags: u32, + ) -> c_int; + + pub fn nftnl_set_elem_add_expr(e: *mut nftnl_set_elem, expr: *mut nftnl_expr); + + pub fn nftnl_set_elem_expr_foreach( + e: *mut nftnl_set_elem, + cb: Option c_int>, + data: *mut c_void, + ) -> c_int; + + pub fn nftnl_set_elem_foreach( + s: *mut nftnl_set, + cb: Option c_int>, + data: *mut c_void, + ) -> c_int; +} +#[repr(C)] +pub struct nftnl_set_elems_iter(c_void); + +extern "C" { + pub fn nftnl_set_elems_iter_create(s: *const nftnl_set) -> *mut nftnl_set_elems_iter; + + pub fn nftnl_set_elems_iter_cur(iter: *const nftnl_set_elems_iter) -> *mut nftnl_set_elem; + + pub fn nftnl_set_elems_iter_next(iter: *mut nftnl_set_elems_iter) -> *mut nftnl_set_elem; + + pub fn nftnl_set_elems_iter_destroy(iter: *mut nftnl_set_elems_iter); + + pub fn nftnl_set_elems_nlmsg_build_payload_iter( + nlh: *mut nlmsghdr, + iter: *mut nftnl_set_elems_iter, + ) -> c_int; +} +#[repr(C)] +pub struct nftnl_table(c_void); + +extern "C" { + pub fn nftnl_table_alloc() -> *mut nftnl_table; + + pub fn nftnl_table_free(arg1: *const nftnl_table); +} +pub const NFTNL_TABLE_NAME: nftnl_table_attr = 0; +pub const NFTNL_TABLE_FAMILY: nftnl_table_attr = 1; +pub const NFTNL_TABLE_FLAGS: nftnl_table_attr = 2; +pub const NFTNL_TABLE_USE: nftnl_table_attr = 3; +pub const NFTNL_TABLE_HANDLE: nftnl_table_attr = 4; +pub const NFTNL_TABLE_USERDATA: nftnl_table_attr = 5; +pub const NFTNL_TABLE_OWNER: nftnl_table_attr = 6; +pub const __NFTNL_TABLE_MAX: nftnl_table_attr = 7; +pub type nftnl_table_attr = c_uint; +extern "C" { + pub fn nftnl_table_is_set(t: *const nftnl_table, attr: u16) -> bool; + + pub fn nftnl_table_unset(t: *mut nftnl_table, attr: u16); + + pub fn nftnl_table_set(t: *mut nftnl_table, attr: u16, data: *const c_void); + + pub fn nftnl_table_set_data( + t: *mut nftnl_table, + attr: u16, + data: *const c_void, + data_len: u32, + ) -> c_int; + + pub fn nftnl_table_get(t: *const nftnl_table, attr: u16) -> *const c_void; + + pub fn nftnl_table_get_data( + t: *const nftnl_table, + attr: u16, + data_len: *mut u32, + ) -> *const c_void; + + pub fn nftnl_table_set_u8(t: *mut nftnl_table, attr: u16, data: u8); + + pub fn nftnl_table_set_u32(t: *mut nftnl_table, attr: u16, data: u32); + + pub fn nftnl_table_set_u64(t: *mut nftnl_table, attr: u16, data: u64); + + pub fn nftnl_table_set_str(t: *mut nftnl_table, attr: u16, str_: *const c_char) -> c_int; + + pub fn nftnl_table_get_u8(t: *const nftnl_table, attr: u16) -> u8; + + pub fn nftnl_table_get_u32(t: *const nftnl_table, attr: u16) -> u32; + + pub fn nftnl_table_get_u64(t: *const nftnl_table, attr: u16) -> u64; + + pub fn nftnl_table_get_str(t: *const nftnl_table, attr: u16) -> *const c_char; + + pub fn nftnl_table_nlmsg_build_payload(nlh: *mut nlmsghdr, t: *const nftnl_table); + + pub fn nftnl_table_parse( + t: *mut nftnl_table, + type_: nftnl_parse_type, + data: *const c_char, + err: *mut nftnl_parse_err, + ) -> c_int; + + pub fn nftnl_table_parse_file( + t: *mut nftnl_table, + type_: nftnl_parse_type, + fp: *mut FILE, + err: *mut nftnl_parse_err, + ) -> c_int; + + pub fn nftnl_table_snprintf( + buf: *mut c_char, + size: usize, + t: *const nftnl_table, + type_: u32, + flags: u32, + ) -> c_int; + + pub fn nftnl_table_fprintf( + fp: *mut FILE, + t: *const nftnl_table, + type_: u32, + flags: u32, + ) -> c_int; + + pub fn nftnl_table_nlmsg_parse(nlh: *const nlmsghdr, t: *mut nftnl_table) -> c_int; +} +#[repr(C)] +pub struct nftnl_table_list(c_void); + +extern "C" { + pub fn nftnl_table_list_alloc() -> *mut nftnl_table_list; + + pub fn nftnl_table_list_free(list: *mut nftnl_table_list); + + pub fn nftnl_table_list_is_empty(list: *const nftnl_table_list) -> c_int; + + pub fn nftnl_table_list_foreach( + table_list: *mut nftnl_table_list, + cb: Option c_int>, + data: *mut c_void, + ) -> c_int; + + pub fn nftnl_table_list_add(r: *mut nftnl_table, list: *mut nftnl_table_list); + + pub fn nftnl_table_list_add_tail(r: *mut nftnl_table, list: *mut nftnl_table_list); + + pub fn nftnl_table_list_del(r: *mut nftnl_table); +} +#[repr(C)] +pub struct nftnl_table_list_iter(c_void); + +extern "C" { + pub fn nftnl_table_list_iter_create(l: *const nftnl_table_list) -> *mut nftnl_table_list_iter; + + pub fn nftnl_table_list_iter_next(iter: *mut nftnl_table_list_iter) -> *mut nftnl_table; + + pub fn nftnl_table_list_iter_destroy(iter: *const nftnl_table_list_iter); +} +pub const NFTNL_TRACE_CHAIN: nftnl_trace_attr = 0; +pub const NFTNL_TRACE_FAMILY: nftnl_trace_attr = 1; +pub const NFTNL_TRACE_ID: nftnl_trace_attr = 2; +pub const NFTNL_TRACE_IIF: nftnl_trace_attr = 3; +pub const NFTNL_TRACE_IIFTYPE: nftnl_trace_attr = 4; +pub const NFTNL_TRACE_JUMP_TARGET: nftnl_trace_attr = 5; +pub const NFTNL_TRACE_OIF: nftnl_trace_attr = 6; +pub const NFTNL_TRACE_OIFTYPE: nftnl_trace_attr = 7; +pub const NFTNL_TRACE_MARK: nftnl_trace_attr = 8; +pub const NFTNL_TRACE_LL_HEADER: nftnl_trace_attr = 9; +pub const NFTNL_TRACE_NETWORK_HEADER: nftnl_trace_attr = 10; +pub const NFTNL_TRACE_TRANSPORT_HEADER: nftnl_trace_attr = 11; +pub const NFTNL_TRACE_TABLE: nftnl_trace_attr = 12; +pub const NFTNL_TRACE_TYPE: nftnl_trace_attr = 13; +pub const NFTNL_TRACE_RULE_HANDLE: nftnl_trace_attr = 14; +pub const NFTNL_TRACE_VERDICT: nftnl_trace_attr = 15; +pub const NFTNL_TRACE_NFPROTO: nftnl_trace_attr = 16; +pub const NFTNL_TRACE_POLICY: nftnl_trace_attr = 17; +pub const __NFTNL_TRACE_MAX: nftnl_trace_attr = 18; +pub type nftnl_trace_attr = c_uint; +#[repr(C)] +pub struct nftnl_trace(c_void); + +extern "C" { + pub fn nftnl_trace_alloc() -> *mut nftnl_trace; + + pub fn nftnl_trace_free(trace: *const nftnl_trace); + + pub fn nftnl_trace_is_set(trace: *const nftnl_trace, type_: u16) -> bool; + + pub fn nftnl_trace_get_data( + trace: *const nftnl_trace, + type_: u16, + data_len: *mut u32, + ) -> *const c_void; + + pub fn nftnl_trace_get_u16(trace: *const nftnl_trace, type_: u16) -> u16; + + pub fn nftnl_trace_get_u32(trace: *const nftnl_trace, type_: u16) -> u32; + + pub fn nftnl_trace_get_u64(trace: *const nftnl_trace, type_: u16) -> u64; + + pub fn nftnl_trace_get_str(trace: *const nftnl_trace, type_: u16) -> *const c_char; + + pub fn nftnl_trace_nlmsg_parse(nlh: *const nlmsghdr, t: *mut nftnl_trace) -> c_int; +} +pub const NFTNL_UDATA_TABLE_COMMENT: nftnl_udata_table_types = 0; +pub const __NFTNL_UDATA_TABLE_MAX: nftnl_udata_table_types = 1; +pub type nftnl_udata_table_types = c_uint; +pub const NFTNL_UDATA_CHAIN_COMMENT: nftnl_udata_chain_types = 0; +pub const __NFTNL_UDATA_CHAIN_MAX: nftnl_udata_chain_types = 1; +pub type nftnl_udata_chain_types = c_uint; +pub const NFTNL_UDATA_RULE_COMMENT: nftnl_udata_rule_types = 0; +pub const NFTNL_UDATA_RULE_EBTABLES_POLICY: nftnl_udata_rule_types = 1; +pub const __NFTNL_UDATA_RULE_MAX: nftnl_udata_rule_types = 2; +pub type nftnl_udata_rule_types = c_uint; +pub const NFTNL_UDATA_OBJ_COMMENT: nftnl_udata_obj_types = 0; +pub const __NFTNL_UDATA_OBJ_MAX: nftnl_udata_obj_types = 1; +pub type nftnl_udata_obj_types = c_uint; +pub const NFTNL_UDATA_SET_KEYBYTEORDER: nftnl_udata_set_types = 0; +pub const NFTNL_UDATA_SET_DATABYTEORDER: nftnl_udata_set_types = 1; +pub const NFTNL_UDATA_SET_MERGE_ELEMENTS: nftnl_udata_set_types = 2; +pub const NFTNL_UDATA_SET_KEY_TYPEOF: nftnl_udata_set_types = 3; +pub const NFTNL_UDATA_SET_DATA_TYPEOF: nftnl_udata_set_types = 4; +pub const NFTNL_UDATA_SET_EXPR: nftnl_udata_set_types = 5; +pub const NFTNL_UDATA_SET_DATA_INTERVAL: nftnl_udata_set_types = 6; +pub const NFTNL_UDATA_SET_COMMENT: nftnl_udata_set_types = 7; +pub const __NFTNL_UDATA_SET_MAX: nftnl_udata_set_types = 8; +pub type nftnl_udata_set_types = c_uint; +pub const NFTNL_UDATA_SET_TYPEOF_EXPR: u32 = 0; +pub const NFTNL_UDATA_SET_TYPEOF_DATA: u32 = 1; +pub const __NFTNL_UDATA_SET_TYPEOF_MAX: u32 = 2; + +pub const NFTNL_UDATA_SET_ELEM_COMMENT: nftnl_udata_set_elem_types = 0; +pub const NFTNL_UDATA_SET_ELEM_FLAGS: nftnl_udata_set_elem_types = 1; +pub const __NFTNL_UDATA_SET_ELEM_MAX: nftnl_udata_set_elem_types = 2; +pub type nftnl_udata_set_elem_types = c_uint; +pub const NFTNL_SET_ELEM_F_INTERVAL_OPEN: nftnl_udata_set_elem_flags = 1; +pub type nftnl_udata_set_elem_flags = c_uint; +#[repr(C)] +pub struct nftnl_udata(c_void); + +#[repr(C)] +pub struct nftnl_udata_buf(c_void); + +extern "C" { + pub fn nftnl_udata_buf_alloc(data_size: u32) -> *mut nftnl_udata_buf; + + pub fn nftnl_udata_buf_free(buf: *const nftnl_udata_buf); + + pub fn nftnl_udata_buf_len(buf: *const nftnl_udata_buf) -> u32; + + pub fn nftnl_udata_buf_data(buf: *const nftnl_udata_buf) -> *mut c_void; + + pub fn nftnl_udata_buf_put(buf: *mut nftnl_udata_buf, data: *const c_void, len: u32); + + pub fn nftnl_udata_start(buf: *const nftnl_udata_buf) -> *mut nftnl_udata; + + pub fn nftnl_udata_end(buf: *const nftnl_udata_buf) -> *mut nftnl_udata; + + pub fn nftnl_udata_put( + buf: *mut nftnl_udata_buf, + type_: u8, + len: u32, + value: *const c_void, + ) -> bool; + + pub fn nftnl_udata_put_u32(buf: *mut nftnl_udata_buf, type_: u8, data: u32) -> bool; + + pub fn nftnl_udata_put_strz(buf: *mut nftnl_udata_buf, type_: u8, strz: *const c_char) -> bool; + + pub fn nftnl_udata_nest_start(buf: *mut nftnl_udata_buf, type_: u8) -> *mut nftnl_udata; + + pub fn nftnl_udata_nest_end(buf: *mut nftnl_udata_buf, ud: *mut nftnl_udata); + + pub fn nftnl_udata_type(attr: *const nftnl_udata) -> u8; + + pub fn nftnl_udata_len(attr: *const nftnl_udata) -> u8; + + pub fn nftnl_udata_get(attr: *const nftnl_udata) -> *mut c_void; + + pub fn nftnl_udata_get_u32(attr: *const nftnl_udata) -> u32; + + pub fn nftnl_udata_next(attr: *const nftnl_udata) -> *mut nftnl_udata; +} +pub type nftnl_udata_cb_t = + Option c_int>; +extern "C" { + pub fn nftnl_udata_parse( + data: *const c_void, + data_len: u32, + cb: nftnl_udata_cb_t, + cb_data: *mut c_void, + ) -> c_int; +} diff --git a/nftnl-sys/src/nftnl_1_2_6.rs b/nftnl-sys/src/nftnl_1_2_6.rs new file mode 100644 index 0000000..52a8a66 --- /dev/null +++ b/nftnl-sys/src/nftnl_1_2_6.rs @@ -0,0 +1,1494 @@ +/* automatically generated by rust-bindgen 0.69.4 */ + +use core::option::Option; +use libc::{c_char, c_int, c_uint, c_void, iovec, nlmsghdr, FILE}; + +pub const NFTNL_UDATA_COMMENT_MAXLEN: u32 = 128; +#[repr(C)] +pub struct nftnl_batch(c_void); + +extern "C" { + pub fn nftnl_batch_alloc(pg_size: u32, pg_overrun_size: u32) -> *mut nftnl_batch; + + pub fn nftnl_batch_update(batch: *mut nftnl_batch) -> c_int; + + pub fn nftnl_batch_free(batch: *mut nftnl_batch); + + pub fn nftnl_batch_buffer(batch: *mut nftnl_batch) -> *mut c_void; + + pub fn nftnl_batch_buffer_len(batch: *mut nftnl_batch) -> u32; + + pub fn nftnl_batch_iovec_len(batch: *mut nftnl_batch) -> c_int; + + pub fn nftnl_batch_iovec(batch: *mut nftnl_batch, iov: *mut iovec, iovlen: u32); +} +pub const NFTNL_PARSE_EBADINPUT: u32 = 0; +pub const NFTNL_PARSE_EMISSINGNODE: u32 = 1; +pub const NFTNL_PARSE_EBADTYPE: u32 = 2; +pub const NFTNL_PARSE_EOPNOTSUPP: u32 = 3; + +pub const NFTNL_OUTPUT_DEFAULT: nftnl_output_type = 0; +pub const NFTNL_OUTPUT_XML: nftnl_output_type = 1; +pub const NFTNL_OUTPUT_JSON: nftnl_output_type = 2; +pub type nftnl_output_type = c_uint; +pub const NFTNL_OF_EVENT_NEW: nftnl_output_flags = 1; +pub const NFTNL_OF_EVENT_DEL: nftnl_output_flags = 2; +pub const NFTNL_OF_EVENT_ANY: nftnl_output_flags = 3; +pub type nftnl_output_flags = c_uint; +pub const NFTNL_CMD_UNSPEC: nftnl_cmd_type = 0; +pub const NFTNL_CMD_ADD: nftnl_cmd_type = 1; +pub const NFTNL_CMD_INSERT: nftnl_cmd_type = 2; +pub const NFTNL_CMD_DELETE: nftnl_cmd_type = 3; +pub const NFTNL_CMD_REPLACE: nftnl_cmd_type = 4; +pub const NFTNL_CMD_FLUSH: nftnl_cmd_type = 5; +pub const NFTNL_CMD_MAX: nftnl_cmd_type = 6; +pub type nftnl_cmd_type = c_uint; +pub const NFTNL_PARSE_NONE: nftnl_parse_type = 0; +pub const NFTNL_PARSE_XML: nftnl_parse_type = 1; +pub const NFTNL_PARSE_JSON: nftnl_parse_type = 2; +pub const NFTNL_PARSE_MAX: nftnl_parse_type = 3; +pub type nftnl_parse_type = c_uint; +#[repr(C)] +pub struct nftnl_parse_err(c_void); + +extern "C" { + pub fn nftnl_nlmsg_build_hdr( + buf: *mut c_char, + type_: u16, + family: u16, + flags: u16, + seq: u32, + ) -> *mut nlmsghdr; + + pub fn nftnl_parse_err_alloc() -> *mut nftnl_parse_err; + + pub fn nftnl_parse_err_free(arg1: *mut nftnl_parse_err); + + pub fn nftnl_parse_perror(str_: *const c_char, err: *mut nftnl_parse_err) -> c_int; + + pub fn nftnl_batch_is_supported() -> c_int; + + pub fn nftnl_batch_begin(buf: *mut c_char, seq: u32) -> *mut nlmsghdr; + + pub fn nftnl_batch_end(buf: *mut c_char, seq: u32) -> *mut nlmsghdr; +} +#[repr(C)] +pub struct nftnl_chain(c_void); + +#[repr(C)] +pub struct nftnl_rule(c_void); + +extern "C" { + pub fn nftnl_chain_alloc() -> *mut nftnl_chain; + + pub fn nftnl_chain_free(arg1: *const nftnl_chain); +} +pub const NFTNL_CHAIN_NAME: nftnl_chain_attr = 0; +pub const NFTNL_CHAIN_FAMILY: nftnl_chain_attr = 1; +pub const NFTNL_CHAIN_TABLE: nftnl_chain_attr = 2; +pub const NFTNL_CHAIN_HOOKNUM: nftnl_chain_attr = 3; +pub const NFTNL_CHAIN_PRIO: nftnl_chain_attr = 4; +pub const NFTNL_CHAIN_POLICY: nftnl_chain_attr = 5; +pub const NFTNL_CHAIN_USE: nftnl_chain_attr = 6; +pub const NFTNL_CHAIN_BYTES: nftnl_chain_attr = 7; +pub const NFTNL_CHAIN_PACKETS: nftnl_chain_attr = 8; +pub const NFTNL_CHAIN_HANDLE: nftnl_chain_attr = 9; +pub const NFTNL_CHAIN_TYPE: nftnl_chain_attr = 10; +pub const NFTNL_CHAIN_DEV: nftnl_chain_attr = 11; +pub const NFTNL_CHAIN_DEVICES: nftnl_chain_attr = 12; +pub const NFTNL_CHAIN_FLAGS: nftnl_chain_attr = 13; +pub const NFTNL_CHAIN_ID: nftnl_chain_attr = 14; +pub const NFTNL_CHAIN_USERDATA: nftnl_chain_attr = 15; +pub const __NFTNL_CHAIN_MAX: nftnl_chain_attr = 16; +pub type nftnl_chain_attr = c_uint; +extern "C" { + pub fn nftnl_chain_is_set(c: *const nftnl_chain, attr: u16) -> bool; + + pub fn nftnl_chain_unset(c: *mut nftnl_chain, attr: u16); + + pub fn nftnl_chain_set(t: *mut nftnl_chain, attr: u16, data: *const c_void); + + pub fn nftnl_chain_set_data( + t: *mut nftnl_chain, + attr: u16, + data: *const c_void, + data_len: u32, + ) -> c_int; + + pub fn nftnl_chain_set_u8(t: *mut nftnl_chain, attr: u16, data: u8); + + pub fn nftnl_chain_set_u32(t: *mut nftnl_chain, attr: u16, data: u32); + + pub fn nftnl_chain_set_s32(t: *mut nftnl_chain, attr: u16, data: i32); + + pub fn nftnl_chain_set_u64(t: *mut nftnl_chain, attr: u16, data: u64); + + pub fn nftnl_chain_set_str(t: *mut nftnl_chain, attr: u16, str_: *const c_char) -> c_int; + + pub fn nftnl_chain_set_array(t: *mut nftnl_chain, attr: u16, data: *mut *const c_char) + -> c_int; + + pub fn nftnl_chain_get(c: *const nftnl_chain, attr: u16) -> *const c_void; + + pub fn nftnl_chain_get_data( + c: *const nftnl_chain, + attr: u16, + data_len: *mut u32, + ) -> *const c_void; + + pub fn nftnl_chain_get_str(c: *const nftnl_chain, attr: u16) -> *const c_char; + + pub fn nftnl_chain_get_u8(c: *const nftnl_chain, attr: u16) -> u8; + + pub fn nftnl_chain_get_u32(c: *const nftnl_chain, attr: u16) -> u32; + + pub fn nftnl_chain_get_s32(c: *const nftnl_chain, attr: u16) -> i32; + + pub fn nftnl_chain_get_u64(c: *const nftnl_chain, attr: u16) -> u64; + + pub fn nftnl_chain_get_array(c: *const nftnl_chain, attr: u16) -> *const *const c_char; + + pub fn nftnl_chain_rule_add(rule: *mut nftnl_rule, c: *mut nftnl_chain); + + pub fn nftnl_chain_rule_del(rule: *mut nftnl_rule); + + pub fn nftnl_chain_rule_add_tail(rule: *mut nftnl_rule, c: *mut nftnl_chain); + + pub fn nftnl_chain_rule_insert_at(rule: *mut nftnl_rule, pos: *mut nftnl_rule); + + pub fn nftnl_chain_rule_append_at(rule: *mut nftnl_rule, pos: *mut nftnl_rule); + + pub fn nftnl_chain_nlmsg_build_payload(nlh: *mut nlmsghdr, t: *const nftnl_chain); + + pub fn nftnl_chain_parse( + c: *mut nftnl_chain, + type_: nftnl_parse_type, + data: *const c_char, + err: *mut nftnl_parse_err, + ) -> c_int; + + pub fn nftnl_chain_parse_file( + c: *mut nftnl_chain, + type_: nftnl_parse_type, + fp: *mut FILE, + err: *mut nftnl_parse_err, + ) -> c_int; + + pub fn nftnl_chain_snprintf( + buf: *mut c_char, + size: usize, + t: *const nftnl_chain, + type_: u32, + flags: u32, + ) -> c_int; + + pub fn nftnl_chain_fprintf( + fp: *mut FILE, + c: *const nftnl_chain, + type_: u32, + flags: u32, + ) -> c_int; + + pub fn nftnl_chain_nlmsg_parse(nlh: *const nlmsghdr, t: *mut nftnl_chain) -> c_int; + + pub fn nftnl_rule_foreach( + c: *mut nftnl_chain, + cb: Option c_int>, + data: *mut c_void, + ) -> c_int; + + pub fn nftnl_rule_lookup_byindex(c: *mut nftnl_chain, index: u32) -> *mut nftnl_rule; +} +#[repr(C)] +pub struct nftnl_rule_iter(c_void); + +extern "C" { + pub fn nftnl_rule_iter_create(c: *const nftnl_chain) -> *mut nftnl_rule_iter; + + pub fn nftnl_rule_iter_next(iter: *mut nftnl_rule_iter) -> *mut nftnl_rule; + + pub fn nftnl_rule_iter_destroy(iter: *mut nftnl_rule_iter); +} +#[repr(C)] +pub struct nftnl_chain_list(c_void); + +extern "C" { + pub fn nftnl_chain_list_alloc() -> *mut nftnl_chain_list; + + pub fn nftnl_chain_list_free(list: *mut nftnl_chain_list); + + pub fn nftnl_chain_list_is_empty(list: *const nftnl_chain_list) -> c_int; + + pub fn nftnl_chain_list_foreach( + chain_list: *mut nftnl_chain_list, + cb: Option c_int>, + data: *mut c_void, + ) -> c_int; + + pub fn nftnl_chain_list_lookup_byname( + chain_list: *mut nftnl_chain_list, + chain: *const c_char, + ) -> *mut nftnl_chain; + + pub fn nftnl_chain_list_add(r: *mut nftnl_chain, list: *mut nftnl_chain_list); + + pub fn nftnl_chain_list_add_tail(r: *mut nftnl_chain, list: *mut nftnl_chain_list); + + pub fn nftnl_chain_list_del(c: *mut nftnl_chain); +} +#[repr(C)] +pub struct nftnl_chain_list_iter(c_void); + +extern "C" { + pub fn nftnl_chain_list_iter_create(l: *const nftnl_chain_list) -> *mut nftnl_chain_list_iter; + + pub fn nftnl_chain_list_iter_next(iter: *mut nftnl_chain_list_iter) -> *mut nftnl_chain; + + pub fn nftnl_chain_list_iter_destroy(iter: *mut nftnl_chain_list_iter); +} +#[repr(C)] +pub struct nftnl_expr(c_void); + +pub const NFTNL_EXPR_NAME: u32 = 0; +pub const NFTNL_EXPR_BASE: u32 = 1; + +extern "C" { + pub fn nftnl_expr_alloc(name: *const c_char) -> *mut nftnl_expr; + + pub fn nftnl_expr_free(expr: *const nftnl_expr); + + pub fn nftnl_expr_is_set(expr: *const nftnl_expr, type_: u16) -> bool; + + pub fn nftnl_expr_set( + expr: *mut nftnl_expr, + type_: u16, + data: *const c_void, + data_len: u32, + ) -> c_int; + + pub fn nftnl_expr_set_u8(expr: *mut nftnl_expr, type_: u16, data: u8); + + pub fn nftnl_expr_set_u16(expr: *mut nftnl_expr, type_: u16, data: u16); + + pub fn nftnl_expr_set_u32(expr: *mut nftnl_expr, type_: u16, data: u32); + + pub fn nftnl_expr_set_u64(expr: *mut nftnl_expr, type_: u16, data: u64); + + pub fn nftnl_expr_set_str(expr: *mut nftnl_expr, type_: u16, str_: *const c_char) -> c_int; + + pub fn nftnl_expr_get(expr: *const nftnl_expr, type_: u16, data_len: *mut u32) + -> *const c_void; + + pub fn nftnl_expr_get_u8(expr: *const nftnl_expr, type_: u16) -> u8; + + pub fn nftnl_expr_get_u16(expr: *const nftnl_expr, type_: u16) -> u16; + + pub fn nftnl_expr_get_u32(expr: *const nftnl_expr, type_: u16) -> u32; + + pub fn nftnl_expr_get_u64(expr: *const nftnl_expr, type_: u16) -> u64; + + pub fn nftnl_expr_get_str(expr: *const nftnl_expr, type_: u16) -> *const c_char; + + pub fn nftnl_expr_build_payload(nlh: *mut nlmsghdr, expr: *mut nftnl_expr); + + pub fn nftnl_expr_add_expr(expr: *mut nftnl_expr, type_: u32, e: *mut nftnl_expr); + + pub fn nftnl_expr_expr_foreach( + e: *const nftnl_expr, + cb: Option c_int>, + data: *mut c_void, + ) -> c_int; + + pub fn nftnl_expr_snprintf( + buf: *mut c_char, + buflen: usize, + expr: *const nftnl_expr, + type_: u32, + flags: u32, + ) -> c_int; + + pub fn nftnl_expr_fprintf( + fp: *mut FILE, + expr: *const nftnl_expr, + type_: u32, + flags: u32, + ) -> c_int; +} +pub const NFTNL_EXPR_PAYLOAD_DREG: u32 = 1; +pub const NFTNL_EXPR_PAYLOAD_BASE: u32 = 2; +pub const NFTNL_EXPR_PAYLOAD_OFFSET: u32 = 3; +pub const NFTNL_EXPR_PAYLOAD_LEN: u32 = 4; +pub const NFTNL_EXPR_PAYLOAD_SREG: u32 = 5; +pub const NFTNL_EXPR_PAYLOAD_CSUM_TYPE: u32 = 6; +pub const NFTNL_EXPR_PAYLOAD_CSUM_OFFSET: u32 = 7; +pub const NFTNL_EXPR_PAYLOAD_FLAGS: u32 = 8; + +pub const NFTNL_EXPR_NG_DREG: u32 = 1; +pub const NFTNL_EXPR_NG_MODULUS: u32 = 2; +pub const NFTNL_EXPR_NG_TYPE: u32 = 3; +pub const NFTNL_EXPR_NG_OFFSET: u32 = 4; +pub const NFTNL_EXPR_NG_SET_NAME: u32 = 5; +pub const NFTNL_EXPR_NG_SET_ID: u32 = 6; + +pub const NFTNL_EXPR_META_KEY: u32 = 1; +pub const NFTNL_EXPR_META_DREG: u32 = 2; +pub const NFTNL_EXPR_META_SREG: u32 = 3; + +pub const NFTNL_EXPR_RT_KEY: u32 = 1; +pub const NFTNL_EXPR_RT_DREG: u32 = 2; + +pub const NFTNL_EXPR_SOCKET_KEY: u32 = 1; +pub const NFTNL_EXPR_SOCKET_DREG: u32 = 2; +pub const NFTNL_EXPR_SOCKET_LEVEL: u32 = 3; + +pub const NFTNL_EXPR_TUNNEL_KEY: u32 = 1; +pub const NFTNL_EXPR_TUNNEL_DREG: u32 = 2; + +pub const NFTNL_EXPR_CMP_SREG: u32 = 1; +pub const NFTNL_EXPR_CMP_OP: u32 = 2; +pub const NFTNL_EXPR_CMP_DATA: u32 = 3; + +pub const NFTNL_EXPR_RANGE_SREG: u32 = 1; +pub const NFTNL_EXPR_RANGE_OP: u32 = 2; +pub const NFTNL_EXPR_RANGE_FROM_DATA: u32 = 3; +pub const NFTNL_EXPR_RANGE_TO_DATA: u32 = 4; + +pub const NFTNL_EXPR_IMM_DREG: u32 = 1; +pub const NFTNL_EXPR_IMM_DATA: u32 = 2; +pub const NFTNL_EXPR_IMM_VERDICT: u32 = 3; +pub const NFTNL_EXPR_IMM_CHAIN: u32 = 4; +pub const NFTNL_EXPR_IMM_CHAIN_ID: u32 = 5; + +pub const NFTNL_EXPR_CTR_PACKETS: u32 = 1; +pub const NFTNL_EXPR_CTR_BYTES: u32 = 2; + +pub const NFTNL_EXPR_CONNLIMIT_COUNT: u32 = 1; +pub const NFTNL_EXPR_CONNLIMIT_FLAGS: u32 = 2; + +pub const NFTNL_EXPR_BITWISE_SREG: u32 = 1; +pub const NFTNL_EXPR_BITWISE_DREG: u32 = 2; +pub const NFTNL_EXPR_BITWISE_LEN: u32 = 3; +pub const NFTNL_EXPR_BITWISE_MASK: u32 = 4; +pub const NFTNL_EXPR_BITWISE_XOR: u32 = 5; +pub const NFTNL_EXPR_BITWISE_OP: u32 = 6; +pub const NFTNL_EXPR_BITWISE_DATA: u32 = 7; + +pub const NFTNL_EXPR_TG_NAME: u32 = 1; +pub const NFTNL_EXPR_TG_REV: u32 = 2; +pub const NFTNL_EXPR_TG_INFO: u32 = 3; + +pub const NFTNL_EXPR_MT_NAME: u32 = 1; +pub const NFTNL_EXPR_MT_REV: u32 = 2; +pub const NFTNL_EXPR_MT_INFO: u32 = 3; + +pub const NFTNL_EXPR_NAT_TYPE: u32 = 1; +pub const NFTNL_EXPR_NAT_FAMILY: u32 = 2; +pub const NFTNL_EXPR_NAT_REG_ADDR_MIN: u32 = 3; +pub const NFTNL_EXPR_NAT_REG_ADDR_MAX: u32 = 4; +pub const NFTNL_EXPR_NAT_REG_PROTO_MIN: u32 = 5; +pub const NFTNL_EXPR_NAT_REG_PROTO_MAX: u32 = 6; +pub const NFTNL_EXPR_NAT_FLAGS: u32 = 7; + +pub const NFTNL_EXPR_TPROXY_FAMILY: u32 = 1; +pub const NFTNL_EXPR_TPROXY_REG_ADDR: u32 = 2; +pub const NFTNL_EXPR_TPROXY_REG_PORT: u32 = 3; + +pub const NFTNL_EXPR_LOOKUP_SREG: u32 = 1; +pub const NFTNL_EXPR_LOOKUP_DREG: u32 = 2; +pub const NFTNL_EXPR_LOOKUP_SET: u32 = 3; +pub const NFTNL_EXPR_LOOKUP_SET_ID: u32 = 4; +pub const NFTNL_EXPR_LOOKUP_FLAGS: u32 = 5; + +pub const NFTNL_EXPR_DYNSET_SREG_KEY: u32 = 1; +pub const NFTNL_EXPR_DYNSET_SREG_DATA: u32 = 2; +pub const NFTNL_EXPR_DYNSET_OP: u32 = 3; +pub const NFTNL_EXPR_DYNSET_TIMEOUT: u32 = 4; +pub const NFTNL_EXPR_DYNSET_SET_NAME: u32 = 5; +pub const NFTNL_EXPR_DYNSET_SET_ID: u32 = 6; +pub const NFTNL_EXPR_DYNSET_EXPR: u32 = 7; +pub const NFTNL_EXPR_DYNSET_EXPRESSIONS: u32 = 8; +pub const NFTNL_EXPR_DYNSET_FLAGS: u32 = 9; + +pub const NFTNL_EXPR_LOG_PREFIX: u32 = 1; +pub const NFTNL_EXPR_LOG_GROUP: u32 = 2; +pub const NFTNL_EXPR_LOG_SNAPLEN: u32 = 3; +pub const NFTNL_EXPR_LOG_QTHRESHOLD: u32 = 4; +pub const NFTNL_EXPR_LOG_LEVEL: u32 = 5; +pub const NFTNL_EXPR_LOG_FLAGS: u32 = 6; + +pub const NFTNL_EXPR_EXTHDR_DREG: u32 = 1; +pub const NFTNL_EXPR_EXTHDR_TYPE: u32 = 2; +pub const NFTNL_EXPR_EXTHDR_OFFSET: u32 = 3; +pub const NFTNL_EXPR_EXTHDR_LEN: u32 = 4; +pub const NFTNL_EXPR_EXTHDR_FLAGS: u32 = 5; +pub const NFTNL_EXPR_EXTHDR_OP: u32 = 6; +pub const NFTNL_EXPR_EXTHDR_SREG: u32 = 7; + +pub const NFTNL_EXPR_CT_DREG: u32 = 1; +pub const NFTNL_EXPR_CT_KEY: u32 = 2; +pub const NFTNL_EXPR_CT_DIR: u32 = 3; +pub const NFTNL_EXPR_CT_SREG: u32 = 4; + +pub const NFTNL_EXPR_BYTEORDER_DREG: u32 = 1; +pub const NFTNL_EXPR_BYTEORDER_SREG: u32 = 2; +pub const NFTNL_EXPR_BYTEORDER_OP: u32 = 3; +pub const NFTNL_EXPR_BYTEORDER_LEN: u32 = 4; +pub const NFTNL_EXPR_BYTEORDER_SIZE: u32 = 5; + +pub const NFTNL_EXPR_LIMIT_RATE: u32 = 1; +pub const NFTNL_EXPR_LIMIT_UNIT: u32 = 2; +pub const NFTNL_EXPR_LIMIT_BURST: u32 = 3; +pub const NFTNL_EXPR_LIMIT_TYPE: u32 = 4; +pub const NFTNL_EXPR_LIMIT_FLAGS: u32 = 5; + +pub const NFTNL_EXPR_REJECT_TYPE: u32 = 1; +pub const NFTNL_EXPR_REJECT_CODE: u32 = 2; + +pub const NFTNL_EXPR_QUEUE_NUM: u32 = 1; +pub const NFTNL_EXPR_QUEUE_TOTAL: u32 = 2; +pub const NFTNL_EXPR_QUEUE_FLAGS: u32 = 3; +pub const NFTNL_EXPR_QUEUE_SREG_QNUM: u32 = 4; + +pub const NFTNL_EXPR_QUOTA_BYTES: u32 = 1; +pub const NFTNL_EXPR_QUOTA_FLAGS: u32 = 2; +pub const NFTNL_EXPR_QUOTA_CONSUMED: u32 = 3; + +pub const NFTNL_EXPR_MASQ_FLAGS: u32 = 1; +pub const NFTNL_EXPR_MASQ_REG_PROTO_MIN: u32 = 2; +pub const NFTNL_EXPR_MASQ_REG_PROTO_MAX: u32 = 3; + +pub const NFTNL_EXPR_REDIR_REG_PROTO_MIN: u32 = 1; +pub const NFTNL_EXPR_REDIR_REG_PROTO_MAX: u32 = 2; +pub const NFTNL_EXPR_REDIR_FLAGS: u32 = 3; + +pub const NFTNL_EXPR_DUP_SREG_ADDR: u32 = 1; +pub const NFTNL_EXPR_DUP_SREG_DEV: u32 = 2; + +pub const NFTNL_EXPR_FLOW_TABLE_NAME: u32 = 1; + +pub const NFTNL_EXPR_FWD_SREG_DEV: u32 = 1; +pub const NFTNL_EXPR_FWD_SREG_ADDR: u32 = 2; +pub const NFTNL_EXPR_FWD_NFPROTO: u32 = 3; + +pub const NFTNL_EXPR_HASH_SREG: u32 = 1; +pub const NFTNL_EXPR_HASH_DREG: u32 = 2; +pub const NFTNL_EXPR_HASH_LEN: u32 = 3; +pub const NFTNL_EXPR_HASH_MODULUS: u32 = 4; +pub const NFTNL_EXPR_HASH_SEED: u32 = 5; +pub const NFTNL_EXPR_HASH_OFFSET: u32 = 6; +pub const NFTNL_EXPR_HASH_TYPE: u32 = 7; +pub const NFTNL_EXPR_HASH_SET_NAME: u32 = 8; +pub const NFTNL_EXPR_HASH_SET_ID: u32 = 9; + +pub const NFTNL_EXPR_FIB_DREG: u32 = 1; +pub const NFTNL_EXPR_FIB_RESULT: u32 = 2; +pub const NFTNL_EXPR_FIB_FLAGS: u32 = 3; + +pub const NFTNL_EXPR_OBJREF_IMM_TYPE: u32 = 1; +pub const NFTNL_EXPR_OBJREF_IMM_NAME: u32 = 2; +pub const NFTNL_EXPR_OBJREF_SET_SREG: u32 = 3; +pub const NFTNL_EXPR_OBJREF_SET_NAME: u32 = 4; +pub const NFTNL_EXPR_OBJREF_SET_ID: u32 = 5; + +pub const NFTNL_EXPR_OSF_DREG: u32 = 1; +pub const NFTNL_EXPR_OSF_TTL: u32 = 2; +pub const NFTNL_EXPR_OSF_FLAGS: u32 = 3; + +pub const NFTNL_EXPR_XFRM_DREG: u32 = 1; +pub const NFTNL_EXPR_XFRM_SREG: u32 = 2; +pub const NFTNL_EXPR_XFRM_KEY: u32 = 3; +pub const NFTNL_EXPR_XFRM_DIR: u32 = 4; +pub const NFTNL_EXPR_XFRM_SPNUM: u32 = 5; + +pub const NFTNL_EXPR_SYNPROXY_MSS: u32 = 1; +pub const NFTNL_EXPR_SYNPROXY_WSCALE: u32 = 2; +pub const NFTNL_EXPR_SYNPROXY_FLAGS: u32 = 3; + +pub const NFTNL_EXPR_LAST_MSECS: u32 = 1; +pub const NFTNL_EXPR_LAST_SET: u32 = 2; + +pub const NFTNL_EXPR_INNER_TYPE: u32 = 1; +pub const NFTNL_EXPR_INNER_FLAGS: u32 = 2; +pub const NFTNL_EXPR_INNER_HDRSIZE: u32 = 3; +pub const NFTNL_EXPR_INNER_EXPR: u32 = 4; + +#[repr(C)] +pub struct nftnl_gen(c_void); + +extern "C" { + pub fn nftnl_gen_alloc() -> *mut nftnl_gen; + + pub fn nftnl_gen_free(arg1: *const nftnl_gen); +} +pub const NFTNL_GEN_ID: u32 = 0; +pub const __NFTNL_GEN_MAX: u32 = 1; + +extern "C" { + pub fn nftnl_gen_is_set(gen: *const nftnl_gen, attr: u16) -> bool; + + pub fn nftnl_gen_unset(gen: *mut nftnl_gen, attr: u16); + + pub fn nftnl_gen_set(gen: *mut nftnl_gen, attr: u16, data: *const c_void) -> c_int; + + pub fn nftnl_gen_set_data( + gen: *mut nftnl_gen, + attr: u16, + data: *const c_void, + data_len: u32, + ) -> c_int; + + pub fn nftnl_gen_get(gen: *const nftnl_gen, attr: u16) -> *const c_void; + + pub fn nftnl_gen_get_data( + gen: *const nftnl_gen, + attr: u16, + data_len: *mut u32, + ) -> *const c_void; + + pub fn nftnl_gen_set_u32(gen: *mut nftnl_gen, attr: u16, data: u32); + + pub fn nftnl_gen_get_u32(gen: *const nftnl_gen, attr: u16) -> u32; + + pub fn nftnl_gen_nlmsg_parse(nlh: *const nlmsghdr, gen: *mut nftnl_gen) -> c_int; + + pub fn nftnl_gen_snprintf( + buf: *mut c_char, + size: usize, + gen: *const nftnl_gen, + type_: u32, + flags: u32, + ) -> c_int; + + pub fn nftnl_gen_fprintf(fp: *mut FILE, gen: *const nftnl_gen, type_: u32, flags: u32) + -> c_int; +} +pub const NFTNL_OBJ_TABLE: u32 = 0; +pub const NFTNL_OBJ_NAME: u32 = 1; +pub const NFTNL_OBJ_TYPE: u32 = 2; +pub const NFTNL_OBJ_FAMILY: u32 = 3; +pub const NFTNL_OBJ_USE: u32 = 4; +pub const NFTNL_OBJ_HANDLE: u32 = 5; +pub const NFTNL_OBJ_USERDATA: u32 = 6; +pub const NFTNL_OBJ_BASE: u32 = 16; +pub const __NFTNL_OBJ_MAX: u32 = 17; + +pub const NFTNL_OBJ_CTR_PKTS: u32 = 16; +pub const NFTNL_OBJ_CTR_BYTES: u32 = 17; + +pub const NFTNL_OBJ_QUOTA_BYTES: u32 = 16; +pub const NFTNL_OBJ_QUOTA_CONSUMED: u32 = 17; +pub const NFTNL_OBJ_QUOTA_FLAGS: u32 = 18; + +pub const NFTNL_OBJ_CT_HELPER_NAME: u32 = 16; +pub const NFTNL_OBJ_CT_HELPER_L3PROTO: u32 = 17; +pub const NFTNL_OBJ_CT_HELPER_L4PROTO: u32 = 18; + +pub const NFTNL_CTTIMEOUT_TCP_SYN_SENT: nftnl_cttimeout_array_tcp = 0; +pub const NFTNL_CTTIMEOUT_TCP_SYN_RECV: nftnl_cttimeout_array_tcp = 1; +pub const NFTNL_CTTIMEOUT_TCP_ESTABLISHED: nftnl_cttimeout_array_tcp = 2; +pub const NFTNL_CTTIMEOUT_TCP_FIN_WAIT: nftnl_cttimeout_array_tcp = 3; +pub const NFTNL_CTTIMEOUT_TCP_CLOSE_WAIT: nftnl_cttimeout_array_tcp = 4; +pub const NFTNL_CTTIMEOUT_TCP_LAST_ACK: nftnl_cttimeout_array_tcp = 5; +pub const NFTNL_CTTIMEOUT_TCP_TIME_WAIT: nftnl_cttimeout_array_tcp = 6; +pub const NFTNL_CTTIMEOUT_TCP_CLOSE: nftnl_cttimeout_array_tcp = 7; +pub const NFTNL_CTTIMEOUT_TCP_SYN_SENT2: nftnl_cttimeout_array_tcp = 8; +pub const NFTNL_CTTIMEOUT_TCP_RETRANS: nftnl_cttimeout_array_tcp = 9; +pub const NFTNL_CTTIMEOUT_TCP_UNACK: nftnl_cttimeout_array_tcp = 10; +pub const NFTNL_CTTIMEOUT_TCP_MAX: nftnl_cttimeout_array_tcp = 11; +pub type nftnl_cttimeout_array_tcp = c_uint; +pub const NFTNL_CTTIMEOUT_UDP_UNREPLIED: nftnl_cttimeout_array_udp = 0; +pub const NFTNL_CTTIMEOUT_UDP_REPLIED: nftnl_cttimeout_array_udp = 1; +pub const NFTNL_CTTIMEOUT_UDP_MAX: nftnl_cttimeout_array_udp = 2; +pub type nftnl_cttimeout_array_udp = c_uint; +pub const NFTNL_OBJ_CT_TIMEOUT_L3PROTO: u32 = 16; +pub const NFTNL_OBJ_CT_TIMEOUT_L4PROTO: u32 = 17; +pub const NFTNL_OBJ_CT_TIMEOUT_ARRAY: u32 = 18; + +pub const NFTNL_OBJ_CT_EXPECT_L3PROTO: u32 = 16; +pub const NFTNL_OBJ_CT_EXPECT_L4PROTO: u32 = 17; +pub const NFTNL_OBJ_CT_EXPECT_DPORT: u32 = 18; +pub const NFTNL_OBJ_CT_EXPECT_TIMEOUT: u32 = 19; +pub const NFTNL_OBJ_CT_EXPECT_SIZE: u32 = 20; + +pub const NFTNL_OBJ_LIMIT_RATE: u32 = 16; +pub const NFTNL_OBJ_LIMIT_UNIT: u32 = 17; +pub const NFTNL_OBJ_LIMIT_BURST: u32 = 18; +pub const NFTNL_OBJ_LIMIT_TYPE: u32 = 19; +pub const NFTNL_OBJ_LIMIT_FLAGS: u32 = 20; + +pub const NFTNL_OBJ_SYNPROXY_MSS: u32 = 16; +pub const NFTNL_OBJ_SYNPROXY_WSCALE: u32 = 17; +pub const NFTNL_OBJ_SYNPROXY_FLAGS: u32 = 18; + +pub const NFTNL_OBJ_TUNNEL_ID: u32 = 16; +pub const NFTNL_OBJ_TUNNEL_IPV4_SRC: u32 = 17; +pub const NFTNL_OBJ_TUNNEL_IPV4_DST: u32 = 18; +pub const NFTNL_OBJ_TUNNEL_IPV6_SRC: u32 = 19; +pub const NFTNL_OBJ_TUNNEL_IPV6_DST: u32 = 20; +pub const NFTNL_OBJ_TUNNEL_IPV6_FLOWLABEL: u32 = 21; +pub const NFTNL_OBJ_TUNNEL_SPORT: u32 = 22; +pub const NFTNL_OBJ_TUNNEL_DPORT: u32 = 23; +pub const NFTNL_OBJ_TUNNEL_FLAGS: u32 = 24; +pub const NFTNL_OBJ_TUNNEL_TOS: u32 = 25; +pub const NFTNL_OBJ_TUNNEL_TTL: u32 = 26; +pub const NFTNL_OBJ_TUNNEL_VXLAN_GBP: u32 = 27; +pub const NFTNL_OBJ_TUNNEL_ERSPAN_VERSION: u32 = 28; +pub const NFTNL_OBJ_TUNNEL_ERSPAN_V1_INDEX: u32 = 29; +pub const NFTNL_OBJ_TUNNEL_ERSPAN_V2_HWID: u32 = 30; +pub const NFTNL_OBJ_TUNNEL_ERSPAN_V2_DIR: u32 = 31; + +pub const NFTNL_OBJ_SECMARK_CTX: u32 = 16; + +#[repr(C)] +pub struct nftnl_obj(c_void); + +extern "C" { + pub fn nftnl_obj_alloc() -> *mut nftnl_obj; + + pub fn nftnl_obj_free(ne: *const nftnl_obj); + + pub fn nftnl_obj_is_set(ne: *const nftnl_obj, attr: u16) -> bool; + + pub fn nftnl_obj_unset(ne: *mut nftnl_obj, attr: u16); + + pub fn nftnl_obj_set_data(ne: *mut nftnl_obj, attr: u16, data: *const c_void, data_len: u32); + + pub fn nftnl_obj_set(ne: *mut nftnl_obj, attr: u16, data: *const c_void); + + pub fn nftnl_obj_set_u8(ne: *mut nftnl_obj, attr: u16, val: u8); + + pub fn nftnl_obj_set_u16(ne: *mut nftnl_obj, attr: u16, val: u16); + + pub fn nftnl_obj_set_u32(ne: *mut nftnl_obj, attr: u16, val: u32); + + pub fn nftnl_obj_set_u64(obj: *mut nftnl_obj, attr: u16, val: u64); + + pub fn nftnl_obj_set_str(ne: *mut nftnl_obj, attr: u16, str_: *const c_char); + + pub fn nftnl_obj_get_data(ne: *mut nftnl_obj, attr: u16, data_len: *mut u32) -> *const c_void; + + pub fn nftnl_obj_get(ne: *mut nftnl_obj, attr: u16) -> *const c_void; + + pub fn nftnl_obj_get_u8(ne: *mut nftnl_obj, attr: u16) -> u8; + + pub fn nftnl_obj_get_u16(obj: *mut nftnl_obj, attr: u16) -> u16; + + pub fn nftnl_obj_get_u32(ne: *mut nftnl_obj, attr: u16) -> u32; + + pub fn nftnl_obj_get_u64(obj: *mut nftnl_obj, attr: u16) -> u64; + + pub fn nftnl_obj_get_str(ne: *mut nftnl_obj, attr: u16) -> *const c_char; + + pub fn nftnl_obj_nlmsg_build_payload(nlh: *mut nlmsghdr, ne: *const nftnl_obj); + + pub fn nftnl_obj_nlmsg_parse(nlh: *const nlmsghdr, ne: *mut nftnl_obj) -> c_int; + + pub fn nftnl_obj_parse( + ne: *mut nftnl_obj, + type_: nftnl_parse_type, + data: *const c_char, + err: *mut nftnl_parse_err, + ) -> c_int; + + pub fn nftnl_obj_parse_file( + ne: *mut nftnl_obj, + type_: nftnl_parse_type, + fp: *mut FILE, + err: *mut nftnl_parse_err, + ) -> c_int; + + pub fn nftnl_obj_snprintf( + buf: *mut c_char, + size: usize, + ne: *const nftnl_obj, + type_: u32, + flags: u32, + ) -> c_int; + + pub fn nftnl_obj_fprintf(fp: *mut FILE, ne: *const nftnl_obj, type_: u32, flags: u32) -> c_int; +} +#[repr(C)] +pub struct nftnl_obj_list(c_void); + +extern "C" { + pub fn nftnl_obj_list_alloc() -> *mut nftnl_obj_list; + + pub fn nftnl_obj_list_free(list: *mut nftnl_obj_list); + + pub fn nftnl_obj_list_is_empty(list: *mut nftnl_obj_list) -> c_int; + + pub fn nftnl_obj_list_add(r: *mut nftnl_obj, list: *mut nftnl_obj_list); + + pub fn nftnl_obj_list_add_tail(r: *mut nftnl_obj, list: *mut nftnl_obj_list); + + pub fn nftnl_obj_list_del(t: *mut nftnl_obj); + + pub fn nftnl_obj_list_foreach( + table_list: *mut nftnl_obj_list, + cb: Option c_int>, + data: *mut c_void, + ) -> c_int; +} +#[repr(C)] +pub struct nftnl_obj_list_iter(c_void); + +extern "C" { + pub fn nftnl_obj_list_iter_create(l: *mut nftnl_obj_list) -> *mut nftnl_obj_list_iter; + + pub fn nftnl_obj_list_iter_next(iter: *mut nftnl_obj_list_iter) -> *mut nftnl_obj; + + pub fn nftnl_obj_list_iter_destroy(iter: *mut nftnl_obj_list_iter); + + pub fn nftnl_rule_alloc() -> *mut nftnl_rule; + + pub fn nftnl_rule_free(arg1: *const nftnl_rule); +} +pub const NFTNL_RULE_FAMILY: nftnl_rule_attr = 0; +pub const NFTNL_RULE_TABLE: nftnl_rule_attr = 1; +pub const NFTNL_RULE_CHAIN: nftnl_rule_attr = 2; +pub const NFTNL_RULE_HANDLE: nftnl_rule_attr = 3; +pub const NFTNL_RULE_COMPAT_PROTO: nftnl_rule_attr = 4; +pub const NFTNL_RULE_COMPAT_FLAGS: nftnl_rule_attr = 5; +pub const NFTNL_RULE_POSITION: nftnl_rule_attr = 6; +pub const NFTNL_RULE_USERDATA: nftnl_rule_attr = 7; +pub const NFTNL_RULE_ID: nftnl_rule_attr = 8; +pub const NFTNL_RULE_POSITION_ID: nftnl_rule_attr = 9; +pub const __NFTNL_RULE_MAX: nftnl_rule_attr = 10; +pub type nftnl_rule_attr = c_uint; +extern "C" { + pub fn nftnl_rule_unset(r: *mut nftnl_rule, attr: u16); + + pub fn nftnl_rule_is_set(r: *const nftnl_rule, attr: u16) -> bool; + + pub fn nftnl_rule_set(r: *mut nftnl_rule, attr: u16, data: *const c_void) -> c_int; + + pub fn nftnl_rule_set_data( + r: *mut nftnl_rule, + attr: u16, + data: *const c_void, + data_len: u32, + ) -> c_int; + + pub fn nftnl_rule_set_u32(r: *mut nftnl_rule, attr: u16, val: u32); + + pub fn nftnl_rule_set_u64(r: *mut nftnl_rule, attr: u16, val: u64); + + pub fn nftnl_rule_set_str(r: *mut nftnl_rule, attr: u16, str_: *const c_char) -> c_int; + + pub fn nftnl_rule_get(r: *const nftnl_rule, attr: u16) -> *const c_void; + + pub fn nftnl_rule_get_data( + r: *const nftnl_rule, + attr: u16, + data_len: *mut u32, + ) -> *const c_void; + + pub fn nftnl_rule_get_str(r: *const nftnl_rule, attr: u16) -> *const c_char; + + pub fn nftnl_rule_get_u8(r: *const nftnl_rule, attr: u16) -> u8; + + pub fn nftnl_rule_get_u32(r: *const nftnl_rule, attr: u16) -> u32; + + pub fn nftnl_rule_get_u64(r: *const nftnl_rule, attr: u16) -> u64; + + pub fn nftnl_rule_add_expr(r: *mut nftnl_rule, expr: *mut nftnl_expr); + + pub fn nftnl_rule_del_expr(expr: *mut nftnl_expr); + + pub fn nftnl_rule_nlmsg_build_payload(nlh: *mut nlmsghdr, t: *mut nftnl_rule); + + pub fn nftnl_rule_parse( + r: *mut nftnl_rule, + type_: nftnl_parse_type, + data: *const c_char, + err: *mut nftnl_parse_err, + ) -> c_int; + + pub fn nftnl_rule_parse_file( + r: *mut nftnl_rule, + type_: nftnl_parse_type, + fp: *mut FILE, + err: *mut nftnl_parse_err, + ) -> c_int; + + pub fn nftnl_rule_snprintf( + buf: *mut c_char, + size: usize, + t: *const nftnl_rule, + type_: u32, + flags: u32, + ) -> c_int; + + pub fn nftnl_rule_fprintf(fp: *mut FILE, r: *const nftnl_rule, type_: u32, flags: u32) + -> c_int; + + pub fn nftnl_rule_nlmsg_parse(nlh: *const nlmsghdr, t: *mut nftnl_rule) -> c_int; + + pub fn nftnl_expr_foreach( + r: *mut nftnl_rule, + cb: Option c_int>, + data: *mut c_void, + ) -> c_int; +} +#[repr(C)] +pub struct nftnl_expr_iter(c_void); + +extern "C" { + pub fn nftnl_expr_iter_create(r: *const nftnl_rule) -> *mut nftnl_expr_iter; + + pub fn nftnl_expr_iter_next(iter: *mut nftnl_expr_iter) -> *mut nftnl_expr; + + pub fn nftnl_expr_iter_destroy(iter: *mut nftnl_expr_iter); +} +#[repr(C)] +pub struct nftnl_rule_list(c_void); + +extern "C" { + pub fn nftnl_rule_list_alloc() -> *mut nftnl_rule_list; + + pub fn nftnl_rule_list_free(list: *mut nftnl_rule_list); + + pub fn nftnl_rule_list_is_empty(list: *const nftnl_rule_list) -> c_int; + + pub fn nftnl_rule_list_add(r: *mut nftnl_rule, list: *mut nftnl_rule_list); + + pub fn nftnl_rule_list_add_tail(r: *mut nftnl_rule, list: *mut nftnl_rule_list); + + pub fn nftnl_rule_list_insert_at(r: *mut nftnl_rule, pos: *mut nftnl_rule); + + pub fn nftnl_rule_list_del(r: *mut nftnl_rule); + + pub fn nftnl_rule_list_foreach( + rule_list: *mut nftnl_rule_list, + cb: Option c_int>, + data: *mut c_void, + ) -> c_int; +} +#[repr(C)] +pub struct nftnl_rule_list_iter(c_void); + +extern "C" { + pub fn nftnl_rule_list_iter_create(l: *const nftnl_rule_list) -> *mut nftnl_rule_list_iter; + + pub fn nftnl_rule_list_iter_cur(iter: *mut nftnl_rule_list_iter) -> *mut nftnl_rule; + + pub fn nftnl_rule_list_iter_next(iter: *mut nftnl_rule_list_iter) -> *mut nftnl_rule; + + pub fn nftnl_rule_list_iter_destroy(iter: *const nftnl_rule_list_iter); +} +#[repr(C)] +pub struct nftnl_ruleset(c_void); + +extern "C" { + pub fn nftnl_ruleset_alloc() -> *mut nftnl_ruleset; + + pub fn nftnl_ruleset_free(r: *const nftnl_ruleset); +} +pub const NFTNL_RULESET_TABLELIST: u32 = 0; +pub const NFTNL_RULESET_CHAINLIST: u32 = 1; +pub const NFTNL_RULESET_SETLIST: u32 = 2; +pub const NFTNL_RULESET_RULELIST: u32 = 3; + +pub const NFTNL_RULESET_UNSPEC: nftnl_ruleset_type = 0; +pub const NFTNL_RULESET_RULESET: nftnl_ruleset_type = 1; +pub const NFTNL_RULESET_TABLE: nftnl_ruleset_type = 2; +pub const NFTNL_RULESET_CHAIN: nftnl_ruleset_type = 3; +pub const NFTNL_RULESET_RULE: nftnl_ruleset_type = 4; +pub const NFTNL_RULESET_SET: nftnl_ruleset_type = 5; +pub const NFTNL_RULESET_SET_ELEMS: nftnl_ruleset_type = 6; +pub type nftnl_ruleset_type = c_uint; +extern "C" { + pub fn nftnl_ruleset_is_set(r: *const nftnl_ruleset, attr: u16) -> bool; + + pub fn nftnl_ruleset_unset(r: *mut nftnl_ruleset, attr: u16); + + pub fn nftnl_ruleset_set(r: *mut nftnl_ruleset, attr: u16, data: *mut c_void); + + pub fn nftnl_ruleset_get(r: *const nftnl_ruleset, attr: u16) -> *mut c_void; +} +pub const NFTNL_RULESET_CTX_CMD: u32 = 0; +pub const NFTNL_RULESET_CTX_TYPE: u32 = 1; +pub const NFTNL_RULESET_CTX_TABLE: u32 = 2; +pub const NFTNL_RULESET_CTX_CHAIN: u32 = 3; +pub const NFTNL_RULESET_CTX_RULE: u32 = 4; +pub const NFTNL_RULESET_CTX_SET: u32 = 5; +pub const NFTNL_RULESET_CTX_DATA: u32 = 6; + +#[repr(C)] +pub struct nftnl_parse_ctx(c_void); + +extern "C" { + pub fn nftnl_ruleset_ctx_free(ctx: *const nftnl_parse_ctx); + + pub fn nftnl_ruleset_ctx_is_set(ctx: *const nftnl_parse_ctx, attr: u16) -> bool; + + pub fn nftnl_ruleset_ctx_get(ctx: *const nftnl_parse_ctx, attr: u16) -> *mut c_void; + + pub fn nftnl_ruleset_ctx_get_u32(ctx: *const nftnl_parse_ctx, attr: u16) -> u32; + + pub fn nftnl_ruleset_parse_file_cb( + type_: nftnl_parse_type, + fp: *mut FILE, + err: *mut nftnl_parse_err, + data: *mut c_void, + cb: Option c_int>, + ) -> c_int; + + pub fn nftnl_ruleset_parse_buffer_cb( + type_: nftnl_parse_type, + buffer: *const c_char, + err: *mut nftnl_parse_err, + data: *mut c_void, + cb: Option c_int>, + ) -> c_int; + + pub fn nftnl_ruleset_parse( + rs: *mut nftnl_ruleset, + type_: nftnl_parse_type, + data: *const c_char, + err: *mut nftnl_parse_err, + ) -> c_int; + + pub fn nftnl_ruleset_parse_file( + rs: *mut nftnl_ruleset, + type_: nftnl_parse_type, + fp: *mut FILE, + err: *mut nftnl_parse_err, + ) -> c_int; + + pub fn nftnl_ruleset_snprintf( + buf: *mut c_char, + size: usize, + rs: *const nftnl_ruleset, + type_: u32, + flags: u32, + ) -> c_int; + + pub fn nftnl_ruleset_fprintf( + fp: *mut FILE, + rs: *const nftnl_ruleset, + type_: u32, + flags: u32, + ) -> c_int; +} +pub const NFTNL_SET_TABLE: nftnl_set_attr = 0; +pub const NFTNL_SET_NAME: nftnl_set_attr = 1; +pub const NFTNL_SET_FLAGS: nftnl_set_attr = 2; +pub const NFTNL_SET_KEY_TYPE: nftnl_set_attr = 3; +pub const NFTNL_SET_KEY_LEN: nftnl_set_attr = 4; +pub const NFTNL_SET_DATA_TYPE: nftnl_set_attr = 5; +pub const NFTNL_SET_DATA_LEN: nftnl_set_attr = 6; +pub const NFTNL_SET_FAMILY: nftnl_set_attr = 7; +pub const NFTNL_SET_ID: nftnl_set_attr = 8; +pub const NFTNL_SET_POLICY: nftnl_set_attr = 9; +pub const NFTNL_SET_DESC_SIZE: nftnl_set_attr = 10; +pub const NFTNL_SET_TIMEOUT: nftnl_set_attr = 11; +pub const NFTNL_SET_GC_INTERVAL: nftnl_set_attr = 12; +pub const NFTNL_SET_USERDATA: nftnl_set_attr = 13; +pub const NFTNL_SET_OBJ_TYPE: nftnl_set_attr = 14; +pub const NFTNL_SET_HANDLE: nftnl_set_attr = 15; +pub const NFTNL_SET_DESC_CONCAT: nftnl_set_attr = 16; +pub const NFTNL_SET_EXPR: nftnl_set_attr = 17; +pub const NFTNL_SET_EXPRESSIONS: nftnl_set_attr = 18; +pub const __NFTNL_SET_MAX: nftnl_set_attr = 19; +pub type nftnl_set_attr = c_uint; +#[repr(C)] +pub struct nftnl_set(c_void); + +extern "C" { + pub fn nftnl_set_alloc() -> *mut nftnl_set; + + pub fn nftnl_set_free(s: *const nftnl_set); + + pub fn nftnl_set_clone(set: *const nftnl_set) -> *mut nftnl_set; + + pub fn nftnl_set_is_set(s: *const nftnl_set, attr: u16) -> bool; + + pub fn nftnl_set_unset(s: *mut nftnl_set, attr: u16); + + pub fn nftnl_set_set(s: *mut nftnl_set, attr: u16, data: *const c_void) -> c_int; + + pub fn nftnl_set_set_data( + s: *mut nftnl_set, + attr: u16, + data: *const c_void, + data_len: u32, + ) -> c_int; + + pub fn nftnl_set_set_u32(s: *mut nftnl_set, attr: u16, val: u32); + + pub fn nftnl_set_set_u64(s: *mut nftnl_set, attr: u16, val: u64); + + pub fn nftnl_set_set_str(s: *mut nftnl_set, attr: u16, str_: *const c_char) -> c_int; + + pub fn nftnl_set_get(s: *const nftnl_set, attr: u16) -> *const c_void; + + pub fn nftnl_set_get_data(s: *const nftnl_set, attr: u16, data_len: *mut u32) -> *const c_void; + + pub fn nftnl_set_get_str(s: *const nftnl_set, attr: u16) -> *const c_char; + + pub fn nftnl_set_get_u32(s: *const nftnl_set, attr: u16) -> u32; + + pub fn nftnl_set_get_u64(s: *const nftnl_set, attr: u16) -> u64; + + pub fn nftnl_set_nlmsg_build_payload(nlh: *mut nlmsghdr, s: *mut nftnl_set); + + pub fn nftnl_set_nlmsg_parse(nlh: *const nlmsghdr, s: *mut nftnl_set) -> c_int; + + pub fn nftnl_set_elems_nlmsg_parse(nlh: *const nlmsghdr, s: *mut nftnl_set) -> c_int; + + pub fn nftnl_set_snprintf( + buf: *mut c_char, + size: usize, + s: *const nftnl_set, + type_: u32, + flags: u32, + ) -> c_int; + + pub fn nftnl_set_fprintf(fp: *mut FILE, s: *const nftnl_set, type_: u32, flags: u32) -> c_int; +} +#[repr(C)] +pub struct nftnl_set_list(c_void); + +extern "C" { + pub fn nftnl_set_list_alloc() -> *mut nftnl_set_list; + + pub fn nftnl_set_list_free(list: *mut nftnl_set_list); + + pub fn nftnl_set_list_is_empty(list: *const nftnl_set_list) -> c_int; + + pub fn nftnl_set_list_add(s: *mut nftnl_set, list: *mut nftnl_set_list); + + pub fn nftnl_set_list_add_tail(s: *mut nftnl_set, list: *mut nftnl_set_list); + + pub fn nftnl_set_list_del(s: *mut nftnl_set); + + pub fn nftnl_set_list_foreach( + set_list: *mut nftnl_set_list, + cb: Option c_int>, + data: *mut c_void, + ) -> c_int; + + pub fn nftnl_set_list_lookup_byname( + set_list: *mut nftnl_set_list, + set: *const c_char, + ) -> *mut nftnl_set; + + pub fn nftnl_set_add_expr(s: *mut nftnl_set, expr: *mut nftnl_expr); + + pub fn nftnl_set_expr_foreach( + s: *const nftnl_set, + cb: Option c_int>, + data: *mut c_void, + ) -> c_int; +} +#[repr(C)] +pub struct nftnl_set_list_iter(c_void); + +extern "C" { + pub fn nftnl_set_list_iter_create(l: *const nftnl_set_list) -> *mut nftnl_set_list_iter; + + pub fn nftnl_set_list_iter_cur(iter: *const nftnl_set_list_iter) -> *mut nftnl_set; + + pub fn nftnl_set_list_iter_next(iter: *mut nftnl_set_list_iter) -> *mut nftnl_set; + + pub fn nftnl_set_list_iter_destroy(iter: *const nftnl_set_list_iter); + + pub fn nftnl_set_parse( + s: *mut nftnl_set, + type_: nftnl_parse_type, + data: *const c_char, + err: *mut nftnl_parse_err, + ) -> c_int; + + pub fn nftnl_set_parse_file( + s: *mut nftnl_set, + type_: nftnl_parse_type, + fp: *mut FILE, + err: *mut nftnl_parse_err, + ) -> c_int; +} +pub const NFTNL_SET_ELEM_FLAGS: u32 = 0; +pub const NFTNL_SET_ELEM_KEY: u32 = 1; +pub const NFTNL_SET_ELEM_VERDICT: u32 = 2; +pub const NFTNL_SET_ELEM_CHAIN: u32 = 3; +pub const NFTNL_SET_ELEM_DATA: u32 = 4; +pub const NFTNL_SET_ELEM_TIMEOUT: u32 = 5; +pub const NFTNL_SET_ELEM_EXPIRATION: u32 = 6; +pub const NFTNL_SET_ELEM_USERDATA: u32 = 7; +pub const NFTNL_SET_ELEM_EXPR: u32 = 8; +pub const NFTNL_SET_ELEM_OBJREF: u32 = 9; +pub const NFTNL_SET_ELEM_KEY_END: u32 = 10; +pub const NFTNL_SET_ELEM_EXPRESSIONS: u32 = 11; +pub const __NFTNL_SET_ELEM_MAX: u32 = 12; + +#[repr(C)] +pub struct nftnl_set_elem(c_void); + +extern "C" { + pub fn nftnl_set_elem_alloc() -> *mut nftnl_set_elem; + + pub fn nftnl_set_elem_free(s: *mut nftnl_set_elem); + + pub fn nftnl_set_elem_clone(elem: *mut nftnl_set_elem) -> *mut nftnl_set_elem; + + pub fn nftnl_set_elem_add(s: *mut nftnl_set, elem: *mut nftnl_set_elem); + + pub fn nftnl_set_elem_unset(s: *mut nftnl_set_elem, attr: u16); + + pub fn nftnl_set_elem_set( + s: *mut nftnl_set_elem, + attr: u16, + data: *const c_void, + data_len: u32, + ) -> c_int; + + pub fn nftnl_set_elem_set_u32(s: *mut nftnl_set_elem, attr: u16, val: u32); + + pub fn nftnl_set_elem_set_u64(s: *mut nftnl_set_elem, attr: u16, val: u64); + + pub fn nftnl_set_elem_set_str(s: *mut nftnl_set_elem, attr: u16, str_: *const c_char) -> c_int; + + pub fn nftnl_set_elem_get( + s: *mut nftnl_set_elem, + attr: u16, + data_len: *mut u32, + ) -> *const c_void; + + pub fn nftnl_set_elem_get_str(s: *mut nftnl_set_elem, attr: u16) -> *const c_char; + + pub fn nftnl_set_elem_get_u32(s: *mut nftnl_set_elem, attr: u16) -> u32; + + pub fn nftnl_set_elem_get_u64(s: *mut nftnl_set_elem, attr: u16) -> u64; + + pub fn nftnl_set_elem_is_set(s: *const nftnl_set_elem, attr: u16) -> bool; + + pub fn nftnl_set_elems_nlmsg_build_payload(nlh: *mut nlmsghdr, s: *mut nftnl_set); + + pub fn nftnl_set_elem_nlmsg_build_payload(nlh: *mut nlmsghdr, e: *mut nftnl_set_elem); +} +#[repr(C)] +pub struct nlattr(c_void); + +extern "C" { + pub fn nftnl_set_elem_nlmsg_build( + nlh: *mut nlmsghdr, + elem: *mut nftnl_set_elem, + i: c_int, + ) -> *mut nlattr; + + pub fn nftnl_set_elem_parse( + e: *mut nftnl_set_elem, + type_: nftnl_parse_type, + data: *const c_char, + err: *mut nftnl_parse_err, + ) -> c_int; + + pub fn nftnl_set_elem_parse_file( + e: *mut nftnl_set_elem, + type_: nftnl_parse_type, + fp: *mut FILE, + err: *mut nftnl_parse_err, + ) -> c_int; + + pub fn nftnl_set_elem_snprintf( + buf: *mut c_char, + size: usize, + s: *const nftnl_set_elem, + type_: u32, + flags: u32, + ) -> c_int; + + pub fn nftnl_set_elem_fprintf( + fp: *mut FILE, + se: *const nftnl_set_elem, + type_: u32, + flags: u32, + ) -> c_int; + + pub fn nftnl_set_elem_add_expr(e: *mut nftnl_set_elem, expr: *mut nftnl_expr); + + pub fn nftnl_set_elem_expr_foreach( + e: *mut nftnl_set_elem, + cb: Option c_int>, + data: *mut c_void, + ) -> c_int; + + pub fn nftnl_set_elem_foreach( + s: *mut nftnl_set, + cb: Option c_int>, + data: *mut c_void, + ) -> c_int; +} +#[repr(C)] +pub struct nftnl_set_elems_iter(c_void); + +extern "C" { + pub fn nftnl_set_elems_iter_create(s: *const nftnl_set) -> *mut nftnl_set_elems_iter; + + pub fn nftnl_set_elems_iter_cur(iter: *const nftnl_set_elems_iter) -> *mut nftnl_set_elem; + + pub fn nftnl_set_elems_iter_next(iter: *mut nftnl_set_elems_iter) -> *mut nftnl_set_elem; + + pub fn nftnl_set_elems_iter_destroy(iter: *mut nftnl_set_elems_iter); + + pub fn nftnl_set_elems_nlmsg_build_payload_iter( + nlh: *mut nlmsghdr, + iter: *mut nftnl_set_elems_iter, + ) -> c_int; +} +#[repr(C)] +pub struct nftnl_table(c_void); + +extern "C" { + pub fn nftnl_table_alloc() -> *mut nftnl_table; + + pub fn nftnl_table_free(arg1: *const nftnl_table); +} +pub const NFTNL_TABLE_NAME: nftnl_table_attr = 0; +pub const NFTNL_TABLE_FAMILY: nftnl_table_attr = 1; +pub const NFTNL_TABLE_FLAGS: nftnl_table_attr = 2; +pub const NFTNL_TABLE_USE: nftnl_table_attr = 3; +pub const NFTNL_TABLE_HANDLE: nftnl_table_attr = 4; +pub const NFTNL_TABLE_USERDATA: nftnl_table_attr = 5; +pub const NFTNL_TABLE_OWNER: nftnl_table_attr = 6; +pub const __NFTNL_TABLE_MAX: nftnl_table_attr = 7; +pub type nftnl_table_attr = c_uint; +extern "C" { + pub fn nftnl_table_is_set(t: *const nftnl_table, attr: u16) -> bool; + + pub fn nftnl_table_unset(t: *mut nftnl_table, attr: u16); + + pub fn nftnl_table_set(t: *mut nftnl_table, attr: u16, data: *const c_void); + + pub fn nftnl_table_set_data( + t: *mut nftnl_table, + attr: u16, + data: *const c_void, + data_len: u32, + ) -> c_int; + + pub fn nftnl_table_get(t: *const nftnl_table, attr: u16) -> *const c_void; + + pub fn nftnl_table_get_data( + t: *const nftnl_table, + attr: u16, + data_len: *mut u32, + ) -> *const c_void; + + pub fn nftnl_table_set_u8(t: *mut nftnl_table, attr: u16, data: u8); + + pub fn nftnl_table_set_u32(t: *mut nftnl_table, attr: u16, data: u32); + + pub fn nftnl_table_set_u64(t: *mut nftnl_table, attr: u16, data: u64); + + pub fn nftnl_table_set_str(t: *mut nftnl_table, attr: u16, str_: *const c_char) -> c_int; + + pub fn nftnl_table_get_u8(t: *const nftnl_table, attr: u16) -> u8; + + pub fn nftnl_table_get_u32(t: *const nftnl_table, attr: u16) -> u32; + + pub fn nftnl_table_get_u64(t: *const nftnl_table, attr: u16) -> u64; + + pub fn nftnl_table_get_str(t: *const nftnl_table, attr: u16) -> *const c_char; + + pub fn nftnl_table_nlmsg_build_payload(nlh: *mut nlmsghdr, t: *const nftnl_table); + + pub fn nftnl_table_parse( + t: *mut nftnl_table, + type_: nftnl_parse_type, + data: *const c_char, + err: *mut nftnl_parse_err, + ) -> c_int; + + pub fn nftnl_table_parse_file( + t: *mut nftnl_table, + type_: nftnl_parse_type, + fp: *mut FILE, + err: *mut nftnl_parse_err, + ) -> c_int; + + pub fn nftnl_table_snprintf( + buf: *mut c_char, + size: usize, + t: *const nftnl_table, + type_: u32, + flags: u32, + ) -> c_int; + + pub fn nftnl_table_fprintf( + fp: *mut FILE, + t: *const nftnl_table, + type_: u32, + flags: u32, + ) -> c_int; + + pub fn nftnl_table_nlmsg_parse(nlh: *const nlmsghdr, t: *mut nftnl_table) -> c_int; +} +#[repr(C)] +pub struct nftnl_table_list(c_void); + +extern "C" { + pub fn nftnl_table_list_alloc() -> *mut nftnl_table_list; + + pub fn nftnl_table_list_free(list: *mut nftnl_table_list); + + pub fn nftnl_table_list_is_empty(list: *const nftnl_table_list) -> c_int; + + pub fn nftnl_table_list_foreach( + table_list: *mut nftnl_table_list, + cb: Option c_int>, + data: *mut c_void, + ) -> c_int; + + pub fn nftnl_table_list_add(r: *mut nftnl_table, list: *mut nftnl_table_list); + + pub fn nftnl_table_list_add_tail(r: *mut nftnl_table, list: *mut nftnl_table_list); + + pub fn nftnl_table_list_del(r: *mut nftnl_table); +} +#[repr(C)] +pub struct nftnl_table_list_iter(c_void); + +extern "C" { + pub fn nftnl_table_list_iter_create(l: *const nftnl_table_list) -> *mut nftnl_table_list_iter; + + pub fn nftnl_table_list_iter_next(iter: *mut nftnl_table_list_iter) -> *mut nftnl_table; + + pub fn nftnl_table_list_iter_destroy(iter: *const nftnl_table_list_iter); +} +pub const NFTNL_TRACE_CHAIN: nftnl_trace_attr = 0; +pub const NFTNL_TRACE_FAMILY: nftnl_trace_attr = 1; +pub const NFTNL_TRACE_ID: nftnl_trace_attr = 2; +pub const NFTNL_TRACE_IIF: nftnl_trace_attr = 3; +pub const NFTNL_TRACE_IIFTYPE: nftnl_trace_attr = 4; +pub const NFTNL_TRACE_JUMP_TARGET: nftnl_trace_attr = 5; +pub const NFTNL_TRACE_OIF: nftnl_trace_attr = 6; +pub const NFTNL_TRACE_OIFTYPE: nftnl_trace_attr = 7; +pub const NFTNL_TRACE_MARK: nftnl_trace_attr = 8; +pub const NFTNL_TRACE_LL_HEADER: nftnl_trace_attr = 9; +pub const NFTNL_TRACE_NETWORK_HEADER: nftnl_trace_attr = 10; +pub const NFTNL_TRACE_TRANSPORT_HEADER: nftnl_trace_attr = 11; +pub const NFTNL_TRACE_TABLE: nftnl_trace_attr = 12; +pub const NFTNL_TRACE_TYPE: nftnl_trace_attr = 13; +pub const NFTNL_TRACE_RULE_HANDLE: nftnl_trace_attr = 14; +pub const NFTNL_TRACE_VERDICT: nftnl_trace_attr = 15; +pub const NFTNL_TRACE_NFPROTO: nftnl_trace_attr = 16; +pub const NFTNL_TRACE_POLICY: nftnl_trace_attr = 17; +pub const __NFTNL_TRACE_MAX: nftnl_trace_attr = 18; +pub type nftnl_trace_attr = c_uint; +#[repr(C)] +pub struct nftnl_trace(c_void); + +extern "C" { + pub fn nftnl_trace_alloc() -> *mut nftnl_trace; + + pub fn nftnl_trace_free(trace: *const nftnl_trace); + + pub fn nftnl_trace_is_set(trace: *const nftnl_trace, type_: u16) -> bool; + + pub fn nftnl_trace_get_data( + trace: *const nftnl_trace, + type_: u16, + data_len: *mut u32, + ) -> *const c_void; + + pub fn nftnl_trace_get_u16(trace: *const nftnl_trace, type_: u16) -> u16; + + pub fn nftnl_trace_get_u32(trace: *const nftnl_trace, type_: u16) -> u32; + + pub fn nftnl_trace_get_u64(trace: *const nftnl_trace, type_: u16) -> u64; + + pub fn nftnl_trace_get_str(trace: *const nftnl_trace, type_: u16) -> *const c_char; + + pub fn nftnl_trace_nlmsg_parse(nlh: *const nlmsghdr, t: *mut nftnl_trace) -> c_int; +} +pub const NFTNL_UDATA_TABLE_COMMENT: nftnl_udata_table_types = 0; +pub const __NFTNL_UDATA_TABLE_MAX: nftnl_udata_table_types = 1; +pub type nftnl_udata_table_types = c_uint; +pub const NFTNL_UDATA_CHAIN_COMMENT: nftnl_udata_chain_types = 0; +pub const __NFTNL_UDATA_CHAIN_MAX: nftnl_udata_chain_types = 1; +pub type nftnl_udata_chain_types = c_uint; +pub const NFTNL_UDATA_RULE_COMMENT: nftnl_udata_rule_types = 0; +pub const NFTNL_UDATA_RULE_EBTABLES_POLICY: nftnl_udata_rule_types = 1; +pub const __NFTNL_UDATA_RULE_MAX: nftnl_udata_rule_types = 2; +pub type nftnl_udata_rule_types = c_uint; +pub const NFTNL_UDATA_OBJ_COMMENT: nftnl_udata_obj_types = 0; +pub const __NFTNL_UDATA_OBJ_MAX: nftnl_udata_obj_types = 1; +pub type nftnl_udata_obj_types = c_uint; +pub const NFTNL_UDATA_SET_KEYBYTEORDER: nftnl_udata_set_types = 0; +pub const NFTNL_UDATA_SET_DATABYTEORDER: nftnl_udata_set_types = 1; +pub const NFTNL_UDATA_SET_MERGE_ELEMENTS: nftnl_udata_set_types = 2; +pub const NFTNL_UDATA_SET_KEY_TYPEOF: nftnl_udata_set_types = 3; +pub const NFTNL_UDATA_SET_DATA_TYPEOF: nftnl_udata_set_types = 4; +pub const NFTNL_UDATA_SET_EXPR: nftnl_udata_set_types = 5; +pub const NFTNL_UDATA_SET_DATA_INTERVAL: nftnl_udata_set_types = 6; +pub const NFTNL_UDATA_SET_COMMENT: nftnl_udata_set_types = 7; +pub const __NFTNL_UDATA_SET_MAX: nftnl_udata_set_types = 8; +pub type nftnl_udata_set_types = c_uint; +pub const NFTNL_UDATA_SET_TYPEOF_EXPR: u32 = 0; +pub const NFTNL_UDATA_SET_TYPEOF_DATA: u32 = 1; +pub const __NFTNL_UDATA_SET_TYPEOF_MAX: u32 = 2; + +pub const NFTNL_UDATA_SET_ELEM_COMMENT: nftnl_udata_set_elem_types = 0; +pub const NFTNL_UDATA_SET_ELEM_FLAGS: nftnl_udata_set_elem_types = 1; +pub const __NFTNL_UDATA_SET_ELEM_MAX: nftnl_udata_set_elem_types = 2; +pub type nftnl_udata_set_elem_types = c_uint; +pub const NFTNL_SET_ELEM_F_INTERVAL_OPEN: nftnl_udata_set_elem_flags = 1; +pub type nftnl_udata_set_elem_flags = c_uint; +#[repr(C)] +pub struct nftnl_udata(c_void); + +#[repr(C)] +pub struct nftnl_udata_buf(c_void); + +extern "C" { + pub fn nftnl_udata_buf_alloc(data_size: u32) -> *mut nftnl_udata_buf; + + pub fn nftnl_udata_buf_free(buf: *const nftnl_udata_buf); + + pub fn nftnl_udata_buf_len(buf: *const nftnl_udata_buf) -> u32; + + pub fn nftnl_udata_buf_data(buf: *const nftnl_udata_buf) -> *mut c_void; + + pub fn nftnl_udata_buf_put(buf: *mut nftnl_udata_buf, data: *const c_void, len: u32); + + pub fn nftnl_udata_start(buf: *const nftnl_udata_buf) -> *mut nftnl_udata; + + pub fn nftnl_udata_end(buf: *const nftnl_udata_buf) -> *mut nftnl_udata; + + pub fn nftnl_udata_put( + buf: *mut nftnl_udata_buf, + type_: u8, + len: u32, + value: *const c_void, + ) -> bool; + + pub fn nftnl_udata_put_u32(buf: *mut nftnl_udata_buf, type_: u8, data: u32) -> bool; + + pub fn nftnl_udata_put_strz(buf: *mut nftnl_udata_buf, type_: u8, strz: *const c_char) -> bool; + + pub fn nftnl_udata_nest_start(buf: *mut nftnl_udata_buf, type_: u8) -> *mut nftnl_udata; + + pub fn nftnl_udata_nest_end(buf: *mut nftnl_udata_buf, ud: *mut nftnl_udata); + + pub fn nftnl_udata_type(attr: *const nftnl_udata) -> u8; + + pub fn nftnl_udata_len(attr: *const nftnl_udata) -> u8; + + pub fn nftnl_udata_get(attr: *const nftnl_udata) -> *mut c_void; + + pub fn nftnl_udata_get_u32(attr: *const nftnl_udata) -> u32; + + pub fn nftnl_udata_next(attr: *const nftnl_udata) -> *mut nftnl_udata; +} +pub type nftnl_udata_cb_t = + Option c_int>; +extern "C" { + pub fn nftnl_udata_parse( + data: *const c_void, + data_len: u32, + cb: nftnl_udata_cb_t, + cb_data: *mut c_void, + ) -> c_int; +} diff --git a/nftnl/Cargo.toml b/nftnl/Cargo.toml index 37421c1..6aef201 100644 --- a/nftnl/Cargo.toml +++ b/nftnl/Cargo.toml @@ -17,6 +17,20 @@ nftnl-1-0-9 = ["nftnl-sys/nftnl-1-0-9"] nftnl-1-1-0 = ["nftnl-sys/nftnl-1-1-0"] nftnl-1-1-1 = ["nftnl-sys/nftnl-1-1-1"] nftnl-1-1-2 = ["nftnl-sys/nftnl-1-1-2"] +nftnl-1-1-3 = ["nftnl-sys/nftnl-1-1-3"] +nftnl-1-1-4 = ["nftnl-sys/nftnl-1-1-4"] +nftnl-1-1-5 = ["nftnl-sys/nftnl-1-1-5"] +nftnl-1-1-6 = ["nftnl-sys/nftnl-1-1-6"] +nftnl-1-1-7 = ["nftnl-sys/nftnl-1-1-7"] +nftnl-1-1-8 = ["nftnl-sys/nftnl-1-1-8"] +nftnl-1-1-9 = ["nftnl-sys/nftnl-1-1-9"] +nftnl-1-2-0 = ["nftnl-sys/nftnl-1-2-0"] +nftnl-1-2-1 = ["nftnl-sys/nftnl-1-2-1"] +nftnl-1-2-2 = ["nftnl-sys/nftnl-1-2-2"] +nftnl-1-2-3 = ["nftnl-sys/nftnl-1-2-3"] +nftnl-1-2-4 = ["nftnl-sys/nftnl-1-2-4"] +nftnl-1-2-5 = ["nftnl-sys/nftnl-1-2-5"] +nftnl-1-2-6 = ["nftnl-sys/nftnl-1-2-6"] [dependencies] bitflags = "1.0.4"