Struct netsim_embed_core::Ipv4Range [−][src]
pub struct Ipv4Range { /* fields omitted */ }
Expand description
A range of IPv4 addresses with a common prefix
Implementations
Create an IPv4 range with the given base address and netmask prefix length.
Example
Create the subnet 192.168.0.0/24 with Ipv4Range::new("192.168.0.0".parse().unwrap(), 24)
Returns the local network subnet 10.0.0.0/8
Returns a local network subnet 172.(16 | x).0.0/16 where x is a 4-bit number given by
block
Panics
If block & 0xf0 != 0
Returns the local subnet 192.168.x.0/24 where x is given by block
.
Returns a random local network subnet from one of the ranges 10.0.0.0, 172.16.0.0 or 192.168.0.0
Get the number of netmask prefix bits
Get the base address of the range, ie. the lowest IP address which is part of the range.
Get a default IP address for the range’s gateway. This is one higher than the base address of the range. eg. for 10.0.0.0/8, the default address for the gateway will be 10.0.0.1
Get the broadcast address, ie. the highest IP address which is part of the range.
Get a random IP address from the range which is not the base address or the default for the gateway address.
Generate an IP address for a device.
Check whether this range contains the given IP address
Trait Implementations
Auto Trait Implementations
impl RefUnwindSafe for Ipv4Range
impl UnwindSafe for Ipv4Range
Blanket Implementations
Mutably borrows from an owned value. Read more