NAME

ZipTie::Addressing::Subnet


SYNOPSIS

    use ZipTie::Addressing::Subnet;
    my $host = '192.168.1.50';   # doesn't need to be the network address
    my $mask = 24;
        my $subnet = ZipTie::Addressing::Subnet->new($host, $bitMask);
        if ($subnet->contains('192.168.1.33'))
        {
                print 'Yes, this would be the case';
        }


DESCRIPTION

Build a subnet definition, IPv4 or IPv6 based on any host address in the subnet, and a subnet mask in bits.

Requires Net::IP to function.


CONSTRUCTOR

new($host, $bitMask)
Builds a ZipTie::Addressing::Subnet object from a host and mask.


METHODS

to_string()
Returns the subnet in slash notation form. For example '192.168.20.0/8';

contains($host)
Returns true if the subnet contains or overlaps the provided host. The host arguments should be a string form of an IP address.


LICENSE

 The contents of this file are subject to the AlterPoint Open Technology
 License (the "License"); you may not use this file except in
 compliance with the License. You may obtain a copy of the License at
 http://inventory.alterpoint.com/license
 Software distributed under the License is distributed on an "AS IS"
 basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
 License for the specific language governing rights and limitations
 under the License.


AUTHOR

  Contributor(s): rkruse
  Date: Jul 23, 2008