#[non_exhaustive]pub struct RuleMessage { /* private fields */ }Expand description
Strongly-typed routing rule message with all attributes parsed.
Fields are pub(crate); consumers read via the per-field accessor
methods (see Self::priority, Self::source, etc.). The
struct is #[non_exhaustive] so the kernel can grow new attribute
fields without it being a breaking change.
Implementations§
Source§impl RuleMessage
impl RuleMessage
Sourcepub fn family_typed(&self) -> AddressFamily
pub fn family_typed(&self) -> AddressFamily
Get the address family as a typed crate::AddressFamily (Plan 227).
Prefer this over the raw Self::family in new code — the typed
form lets the caller compare against AddressFamily::v4() /
AddressFamily::v6() without remembering AF_* magic numbers,
and gracefully exposes unmodelled bytes via
crate::AddressFamily::is_known.
Sourcepub fn action(&self) -> FibRuleAction
pub fn action(&self) -> FibRuleAction
Get the rule action.
Sourcepub fn is_blackhole(&self) -> bool
pub fn is_blackhole(&self) -> bool
Check if this is a blackhole rule.
Sourcepub fn is_unreachable(&self) -> bool
pub fn is_unreachable(&self) -> bool
Check if this is an unreachable rule.
Sourcepub fn is_prohibit(&self) -> bool
pub fn is_prohibit(&self) -> bool
Check if this is a prohibit rule.
Sourcepub fn is_default(&self) -> bool
pub fn is_default(&self) -> bool
Check if this is a default rule (priority 0, 32766, or 32767).
Sourcepub fn priority(&self) -> u32
pub fn priority(&self) -> u32
Rule priority (FRA_PRIORITY). Returns 0 when the kernel
did not set the attribute.
Sourcepub fn destination(&self) -> Option<IpAddr>
pub fn destination(&self) -> Option<IpAddr>
Destination address (FRA_DST), if present.
Sourcepub fn table(&self) -> u32
pub fn table(&self) -> u32
Routing table ID. Returns the 32-bit FRA_TABLE override
when present, else the 8-bit header.table.
Sourcepub fn suppress_ifgroup(&self) -> Option<u32>
pub fn suppress_ifgroup(&self) -> Option<u32>
Suppress interface group (FRA_SUPPRESS_IFGROUP), if present.
Sourcepub fn suppress_prefixlen(&self) -> Option<u32>
pub fn suppress_prefixlen(&self) -> Option<u32>
Suppress prefix length (FRA_SUPPRESS_PREFIXLEN), if present.
Sourcepub fn uid_range(&self) -> Option<FibRuleUidRange>
pub fn uid_range(&self) -> Option<FibRuleUidRange>
UID range (FRA_UID_RANGE), if present.
Sourcepub fn sport_range(&self) -> Option<FibRulePortRange>
pub fn sport_range(&self) -> Option<FibRulePortRange>
Source port range (FRA_SPORT_RANGE), if present.
Sourcepub fn dport_range(&self) -> Option<FibRulePortRange>
pub fn dport_range(&self) -> Option<FibRulePortRange>
Destination port range (FRA_DPORT_RANGE), if present.
Trait Implementations§
Source§impl Clone for RuleMessage
impl Clone for RuleMessage
Source§fn clone(&self) -> RuleMessage
fn clone(&self) -> RuleMessage
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for RuleMessage
impl Debug for RuleMessage
Source§impl Default for RuleMessage
impl Default for RuleMessage
Source§fn default() -> RuleMessage
fn default() -> RuleMessage
Source§impl FromNetlink for RuleMessage
impl FromNetlink for RuleMessage
Source§fn write_dump_header(buf: &mut Vec<u8>)
fn write_dump_header(buf: &mut Vec<u8>)
Source§fn parse(input: &mut &[u8]) -> PResult<Self>
fn parse(input: &mut &[u8]) -> PResult<Self>
Source§fn from_bytes(data: &[u8]) -> Result<Self>
fn from_bytes(data: &[u8]) -> Result<Self>
Source§fn set_msg_type(&mut self, _msg_type: u16)
fn set_msg_type(&mut self, _msg_type: u16)
nlmsg_type this message arrived with. Read more