Struct netsim::SubnetV4 [] [src]

pub struct SubnetV4 { /* fields omitted */ }

An Ipv4 subnet

Methods

impl SubnetV4
[src]

[src]

Create a subnet with the given base IP address and number of netmask bits.

Example

Create the subnet 192.168.0.0/24 with SubnetV4::new(ipv4!("192.168.0.0"), 24)

[src]

Return the global subnet, eg. 0.0.0.0/0

[src]

Returns the local network subnet 10.0.0.0/8

[src]

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

[src]

Returns the local subnet 192.168.x.0/24 where x is given by block.

[src]

Returns a random local network from one of the ranges 10.0.0.0, 172.16.0.0 or 192.168.0.0

[src]

Get the netmask as an IP address

[src]

Get the number of netmask bits

[src]

Get the base address of the subnet, ie. the lowest IP address which is part of the subnet.

[src]

Get a default IP address for the subnet's gateway. This is one higher than the base address of the subnet. eg. for 10.0.0.0/8, the default address for the gateway will be 10.0.0.1

[src]

Get a random IP address from the subnet which is not the base address or the default for the gateway address.

[src]

Check whether this subnet contains the given IP address

Trait Implementations

impl Debug for SubnetV4
[src]

[src]

Formats the value using the given formatter.

impl Clone for SubnetV4
[src]

[src]

Returns a copy of the value. Read more

1.0.0
[src]

Performs copy-assignment from source. Read more

impl Copy for SubnetV4
[src]

impl FromStr for SubnetV4
[src]

The associated error which can be returned from parsing.

[src]

Parses a string s to return a value of this type. Read more