diff options
author | Simon THOBY <git@nightmared.fr> | 2021-11-08 19:29:50 +0000 |
---|---|---|
committer | Simon THOBY <git@nightmared.fr> | 2021-11-08 19:29:50 +0000 |
commit | e3fea7960d8a962bd25ac3d905d3b67aefc1fa49 (patch) | |
tree | 9f1017f302e19bb4ac9ecff3993be932ed3efcd3 /src/expr/masquerade.rs | |
parent | c708cc2191aecef86c134174165126f93230c684 (diff) | |
parent | 0698c2f2d0b20e0e42e50c498650117b64f8e4c4 (diff) |
Merge branch 'auto-bindgen' into 'master'
auto generate sys files
See merge request rustwall/rustables!9
Diffstat (limited to 'src/expr/masquerade.rs')
-rw-r--r-- | src/expr/masquerade.rs | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/src/expr/masquerade.rs b/src/expr/masquerade.rs new file mode 100644 index 0000000..c1a06de --- /dev/null +++ b/src/expr/masquerade.rs @@ -0,0 +1,24 @@ +use super::{DeserializationError, Expression, Rule}; +use crate::sys; +use std::os::raw::c_char; + +/// Sets the source IP to that of the output interface. +#[derive(Debug, PartialEq)] +pub struct Masquerade; + +impl Expression for Masquerade { + fn get_raw_name() -> *const sys::libc::c_char { + b"masq\0" as *const _ as *const c_char + } + + fn from_expr(_expr: *const sys::nftnl_expr) -> Result<Self, DeserializationError> + where + Self: Sized, + { + Ok(Masquerade) + } + + fn to_expr(&self, _rule: &Rule) -> *mut sys::nftnl_expr { + try_alloc!(unsafe { sys::nftnl_expr_alloc(Self::get_raw_name()) }) + } +} |