RuleMessage

Struct RuleMessage 

Source
pub struct RuleMessage {
Show 20 fields pub header: FibRuleHdr, pub priority: u32, pub source: Option<IpAddr>, pub destination: Option<IpAddr>, pub iifname: Option<String>, pub oifname: Option<String>, pub fwmark: Option<u32>, pub fwmask: Option<u32>, pub table: u32, pub goto: Option<u32>, pub flow: Option<u32>, pub tun_id: Option<u64>, pub suppress_ifgroup: Option<u32>, pub suppress_prefixlen: Option<u32>, pub l3mdev: Option<u8>, pub uid_range: Option<FibRuleUidRange>, pub protocol: Option<u8>, pub ip_proto: Option<u8>, pub sport_range: Option<FibRulePortRange>, pub dport_range: Option<FibRulePortRange>,
}
Expand description

Strongly-typed routing rule message with all attributes parsed.

Fields§

§header: FibRuleHdr

Fixed-size header.

§priority: u32

Rule priority (FRA_PRIORITY).

§source: Option<IpAddr>

Source address (FRA_SRC).

§destination: Option<IpAddr>

Destination address (FRA_DST).

§iifname: Option<String>

Input interface name (FRA_IIFNAME).

§oifname: Option<String>

Output interface name (FRA_OIFNAME).

§fwmark: Option<u32>

Firewall mark (FRA_FWMARK).

§fwmask: Option<u32>

Firewall mark mask (FRA_FWMASK).

§table: u32

Routing table ID (FRA_TABLE, overrides header.table).

§goto: Option<u32>

Goto target rule priority (FRA_GOTO).

§flow: Option<u32>

Flow classification ID (FRA_FLOW).

§tun_id: Option<u64>

Tunnel ID (FRA_TUN_ID).

§suppress_ifgroup: Option<u32>

Suppress interface group (FRA_SUPPRESS_IFGROUP).

§suppress_prefixlen: Option<u32>

Suppress prefix length (FRA_SUPPRESS_PREFIXLEN).

§l3mdev: Option<u8>

L3 master device (FRA_L3MDEV).

§uid_range: Option<FibRuleUidRange>

UID range (FRA_UID_RANGE).

§protocol: Option<u8>

Rule protocol (FRA_PROTOCOL).

§ip_proto: Option<u8>

IP protocol for port matching (FRA_IP_PROTO).

§sport_range: Option<FibRulePortRange>

Source port range (FRA_SPORT_RANGE).

§dport_range: Option<FibRulePortRange>

Destination port range (FRA_DPORT_RANGE).

Implementations§

Source§

impl RuleMessage

Source

pub fn new() -> Self

Create a new empty rule message.

Source

pub fn family(&self) -> u8

Get the address family.

Source

pub fn is_ipv4(&self) -> bool

Check if this is an IPv4 rule.

Source

pub fn is_ipv6(&self) -> bool

Check if this is an IPv6 rule.

Source

pub fn src_len(&self) -> u8

Get the source prefix length.

Source

pub fn dst_len(&self) -> u8

Get the destination prefix length.

Source

pub fn action(&self) -> FibRuleAction

Get the rule action.

Source

pub fn is_lookup(&self) -> bool

Check if this is a table lookup rule.

Source

pub fn is_blackhole(&self) -> bool

Check if this is a blackhole rule.

Source

pub fn is_unreachable(&self) -> bool

Check if this is an unreachable rule.

Source

pub fn is_prohibit(&self) -> bool

Check if this is a prohibit rule.

Source

pub fn table_id(&self) -> u32

Get the routing table ID.

Source

pub fn is_default(&self) -> bool

Check if this is a default rule (priority 0, 32766, or 32767).

Trait Implementations§

Source§

impl Clone for RuleMessage

Source§

fn clone(&self) -> RuleMessage

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for RuleMessage

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for RuleMessage

Source§

fn default() -> RuleMessage

Returns the “default value” for a type. Read more
Source§

fn write_dump_header(buf: &mut Vec<u8>)

Write the header required for dump requests. This is appended to the netlink message after the nlmsghdr. Default implementation writes nothing (for messages that don’t need a header).
Source§

fn parse(input: &mut &[u8]) -> PResult<Self>

Parse from a mutable byte slice reference. The slice is advanced past the consumed bytes.
Source§

fn from_bytes(data: &[u8]) -> Result<Self>

Parse from a complete byte slice.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.