Class Symbiosis::IPAddr
In: common/lib/symbiosis/ipaddr.rb
Parent: ::IPAddr
Array Utmp EventMachine::Connection ApacheLogger StandardError CrontabFormatError Enumerable IPAddr ::IPAddr Host Range Domain ConfigFile Prosody Tinydns Apache Webalizer Directory IPListDirectory TemplateDirectory Domains Alert Crontab CrontabRecord StateDB Check Runner TCPConnection Test Process BlacklistDB Template Logtail Pattern Ports Blacklist Monitor ConfigFiles Utils Firewall Symbiosis dot/f_0.png

This class is a subclass if ::IPAddr, and adds in various useful bits.

Methods

<=>   broadcast   cidr_mask   each   from_i   include?   max   min   network   prefixlen   range_to_s   to_s  

Included Modules

Enumerable

Public Class methods

Create a new IPAddress object from an integer. The family can be Socket::AF_INET or Socket::AF_INET6. If no family is set, then a guess is made, based on the size of the integer.

Public Instance methods

Compare one IP with another.

Returns the broadcast address for the IP range.

Returns the CIDR mask, e.g. 24 for 1.2.3.0/24.

Evaluate a block for each IP address in a range. Use with caution with IPv6 addresses!

Test to see if this IP range includes another.

Raises an ArgumentError unless other is a Symbiosis::IPAddr

max()

Alias for broadcast

min()

Alias for network

Returns the network address for the IP range.

prefixlen()

Alias for cidr_mask

Returns a range as address/mask_address, e.g. 1.2.3.0/255.255.255.0

Returns the address as a string, with the CIDR mask if there is more than on IP in the range.

e.g. 1.2.3.4/32 would be returned as 1.2.3.4, 2001:41c8:1:2::/64 as 2001:41c8:1:2::/64.

[Validate]