blob: bf4e0de4708b72ace793584ee28fb4130ca0bcbc (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
|
use super::{Expression, Rule};
use rustables_sys as 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) -> Option<Self>
where
Self: Sized,
{
Some(Masquerade)
}
fn to_expr(&self, _rule: &Rule) -> *mut sys::nftnl_expr {
try_alloc!(unsafe { sys::nftnl_expr_alloc(Self::get_raw_name()) })
}
}
|