Class: NetAddr::CIDRv4

Inherits:
CIDR
  • Object
show all
Defined in:
lib/cidr.rb

Overview

IPv4 CIDR address - Inherits all methods from NetAddr::CIDR. Addresses of this class are composed of a 32-bit address space.

Instance Attribute Summary

Attributes inherited from CIDR

#address_len, #all_f, #tag, #version

Instance Method Summary collapse

Methods inherited from CIDR

#<, #<=>, #==, #>, #[], #allocate_rfc3531, #arpa, #bits, #cmp, #contains?, create, #desc, #enumerate, #fill_in, #initialize, #ip, #is_contained?, #last, #matches?, #multicast_mac, #netmask, #network, #next_ip, #next_subnet, #nth, #range, #remainder, #resize, #resize!, #set_wildcard_mask, #size, #subnet, #succ, #to_i, #to_s, #wildcard_mask

Constructor Details

This class inherits a constructor from NetAddr::CIDR

Instance Method Details

#hostmask_extObject

Synopsis

Provide IPv4 Hostmask in extended format (y.y.y.y).

Example: cidr = NetAddr::CIDR.create(‘10.1.0.0/24’) cidr.hostmask_ext => “0.0.0.255”

Arguments:

  • none

Returns:

  • String



2074
2075
2076
# File 'lib/cidr.rb', line 2074

def hostmask_ext()
    return(NetAddr.ip_int_to_str(@hostmask, @version))
end

#netmask_extObject

Synopsis

Provide IPv4 netmask in extended format (y.y.y.y).

Example: cidr = NetAddr::CIDR.create(‘10.1.0.0/24’) cidr.netmask_ext => “255.255.255.0”

Arguments:

  • none

Returns:

  • String



2095
2096
2097
# File 'lib/cidr.rb', line 2095

def netmask_ext()
    return(NetAddr.ip_int_to_str(@netmask, 4))
end