struct IP::Block::IPv4

Defined in:

ip/block/ipv4.cr

Constructors

Instance Method Summary

Instance methods inherited from struct IP::Block

<(other : IP::Block) <, <=(other : IP::Block) <=, <=>(other : IP::Block) : Int
<=>(other : IP::Address) : Int
<=>
, ==(other : IP::Block) ==, >(other : IP::Block) >, >=(other : IP::Block) >=, address address, adjacent?(other : IP::Address) : Bool
adjacent?(other : IP::Block) : Bool
adjacent?
, block block, covers?(other : IP::Address) : Bool
covers?(other : IP::Block) : Bool
covers?
, each(&block : IP::Address -> Nil) : Nil each, first : IP::Address first, hash(hasher) hash, includes?(other : IP::Address) : Bool includes?, inspect(io : IO) : Nil inspect, intersects?(other : IP::Block) : Bool
intersects?(other : IP::Address) : Bool
intersects?
, ipv4? : Bool ipv4?, ipv6? : Bool ipv6?, last : IP::Address last, mask : IP::Address mask, single_address? : Bool single_address?, size size, to_s(io : IO) : Nil to_s

Constructor methods inherited from struct IP::Block

[](string : String) : self [], []?(string : String) : self? []?, ipv4(string : String) : self ipv4, ipv4?(string : String) : self? ipv4?, ipv6(string : String) : self ipv6, ipv6?(string : String) : self? ipv6?, loopback_ipv4 : self loopback_ipv4, loopback_ipv6 : self loopback_ipv6, new(address : IP::Address, block : Int) : self?
new(string : String) : self
new
, new?(address : IP::Address, block : Int) : self?
new?(string : String) : self?
new?

Constructor Detail

def self.loopback : self #

Constructs a IP::Block:IPv4 representing the IPv4 loopback block.


[View source]
def self.new(address : IP::Address::IPv4, block : Int) : self #

Constructs a new IP::Block::IPv4 from an address and the block size, [0-32].

Raises: MalformedError when the input is malformed.


[View source]
def self.new(string : String) : self #

Constructs a new IP::Block::IPv4 by interpreting the contents of a given String.

Expects a definition in CIDR notation similar to [0-255].[0-255].[0-255].[0-255]/[0-32].

Raises: MalformedError when the input is malformed.


[View source]
def self.new?(address : IP::Address::IPv4, block : Int) : self? #

Constructs a new IP::Block::IPv4 from an address and the block size, [0-32].

Returns nil when the input is malformed.


[View source]
def self.new?(string : String) : self? #

Constructs a new IP::Block::IPv4 by interpreting the contents of a given String.

Expects a definition in CIDR notation similar to [0-255].[0-255].[0-255].[0-255]/[0-32]

Returns nil when the input is malformed.


[View source]

Instance Method Detail

def address : IP::Address::IPv4 #

Returns the address component of the block which is also the first address.


[View source]
def block : UInt8 #

Returns 'block' size in the form of 2^x, x being the 'size'.


[View source]
def ipv4? : Bool #

Informs if the block is IPv4 or not.


[View source]
def size : UInt32 #

Returns the size of the block in terms of number of addresses.


[View source]