pub struct RouteMessageBuilder<T = IpAddr> { /* private fields */ }Implementations§
Source§impl<T> RouteMessageBuilder<T>
impl<T> RouteMessageBuilder<T>
Sourcepub fn input_interface(self, index: u32) -> Self
pub fn input_interface(self, index: u32) -> Self
Sets the input interface index.
Sourcepub fn output_interface(self, index: u32) -> Self
pub fn output_interface(self, index: u32) -> Self
Sets the output interface index.
Sourcepub fn output_mpls(self, labels: Vec<MplsLabel>) -> Self
pub fn output_mpls(self, labels: Vec<MplsLabel>) -> Self
Sets the output MPLS encapsulation labels.
Sourcepub fn multipath(self, nexthops: Vec<RouteNextHop>) -> Self
pub fn multipath(self, nexthops: Vec<RouteNextHop>) -> Self
Sets multiple nexthop entries for the route.
Sourcepub fn table_id(self, table: u32) -> Self
pub fn table_id(self, table: u32) -> Self
Sets the route table ID.
Default is main route table.
Sourcepub fn protocol(self, protocol: RouteProtocol) -> Self
pub fn protocol(self, protocol: RouteProtocol) -> Self
Sets the route protocol.
Default is static route protocol.
Sourcepub fn scope(self, scope: RouteScope) -> Self
pub fn scope(self, scope: RouteScope) -> Self
Sets the route scope.
Default is universe route scope.
Sourcepub fn onlink(self) -> Self
pub fn onlink(self) -> Self
Marks the next hop as directly reachable (on-link).
Indicates that the next hop is reachable without passing through a connected subnet.
Sourcepub fn get_mut(&mut self) -> &mut RouteMessage
pub fn get_mut(&mut self) -> &mut RouteMessage
Return a mutable reference to the request message.
pub fn build(self) -> RouteMessage
Source§impl RouteMessageBuilder<Ipv4Addr>
impl RouteMessageBuilder<Ipv4Addr>
Sourcepub fn new() -> Self
pub fn new() -> Self
Create default RouteMessage with header set to:
- route: RouteHeader::RT_TABLE_MAIN
- protocol: RouteProtocol::Static
- scope: RouteScope::Universe
- kind: RouteType::Unicast
- address_family: [AddressFamily::Inet4]
For using this message in querying routes, these settings
are ignored unless NETLINK_GET_STRICT_CHK been enabled.
Sourcepub fn source_prefix(self, addr: Ipv4Addr, prefix_length: u8) -> Self
pub fn source_prefix(self, addr: Ipv4Addr, prefix_length: u8) -> Self
Sets the source address prefix.
Sourcepub fn pref_source(self, addr: Ipv4Addr) -> Self
pub fn pref_source(self, addr: Ipv4Addr) -> Self
Sets the preferred source address.
Sourcepub fn destination_prefix(self, addr: Ipv4Addr, prefix_length: u8) -> Self
pub fn destination_prefix(self, addr: Ipv4Addr, prefix_length: u8) -> Self
Sets the destination address prefix.
Source§impl RouteMessageBuilder<Ipv6Addr>
impl RouteMessageBuilder<Ipv6Addr>
Sourcepub fn new() -> Self
pub fn new() -> Self
Create default RouteMessage with header set to:
- route: RouteHeader::RT_TABLE_MAIN
- protocol: RouteProtocol::Static
- scope: RouteScope::Universe
- kind: RouteType::Unicast
- address_family: AddressFamily::Inet6
For using this message in querying routes, these settings
are ignored unless NETLINK_GET_STRICT_CHK been enabled.
Sourcepub fn source_prefix(self, addr: Ipv6Addr, prefix_length: u8) -> Self
pub fn source_prefix(self, addr: Ipv6Addr, prefix_length: u8) -> Self
Sets the source address prefix.
Sourcepub fn pref_source(self, addr: Ipv6Addr) -> Self
pub fn pref_source(self, addr: Ipv6Addr) -> Self
Sets the preferred source address.
Sourcepub fn destination_prefix(self, addr: Ipv6Addr, prefix_length: u8) -> Self
pub fn destination_prefix(self, addr: Ipv6Addr, prefix_length: u8) -> Self
Sets the destination address prefix.
Source§impl RouteMessageBuilder<IpAddr>
impl RouteMessageBuilder<IpAddr>
pub fn new() -> Self
Sourcepub fn source_prefix(
self,
addr: IpAddr,
prefix_length: u8,
) -> Result<Self, InvalidRouteMessage>
pub fn source_prefix( self, addr: IpAddr, prefix_length: u8, ) -> Result<Self, InvalidRouteMessage>
Sets the source address prefix.
Sourcepub fn pref_source(self, addr: IpAddr) -> Result<Self, InvalidRouteMessage>
pub fn pref_source(self, addr: IpAddr) -> Result<Self, InvalidRouteMessage>
Sets the preferred source address.
Sourcepub fn destination_prefix(
self,
addr: IpAddr,
prefix_length: u8,
) -> Result<Self, InvalidRouteMessage>
pub fn destination_prefix( self, addr: IpAddr, prefix_length: u8, ) -> Result<Self, InvalidRouteMessage>
Sets the destination address prefix.
Source§impl RouteMessageBuilder<MplsLabel>
impl RouteMessageBuilder<MplsLabel>
Sourcepub fn new() -> Self
pub fn new() -> Self
Create default RouteMessage with header set to:
- route: RouteHeader::RT_TABLE_MAIN
- protocol: RouteProtocol::Static
- scope: RouteScope::Universe
- kind: RouteType::Unicast
- address_family: AddressFamily::Mpls
For using this message in querying routes, these settings
are ignored unless NETLINK_GET_STRICT_CHK been enabled.
Trait Implementations§
Source§impl<T: Clone> Clone for RouteMessageBuilder<T>
impl<T: Clone> Clone for RouteMessageBuilder<T>
Source§fn clone(&self) -> RouteMessageBuilder<T>
fn clone(&self) -> RouteMessageBuilder<T>
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more