package Data::IPV4::Range::Parse;
Data::IPV4::Range::Parse - Perl extension parsing ipv4 ranges
use Data::IPV4::Range::Parse; ($stat_int,$end_int)=auto_parse_ipv4_range('10/24'); ($stat_int,$end_int)=auto_parse_ipv4_range('10.0.0 - 11'); ($stat_int,$end_int)=auto_parse_ipv4_range('9'); unless(($stat_int,$end_int)=auto_parse_ipv4_range('10/')) { print "failed to parse 10/\n"; }
Simple Interface for getting start and ending address of ranges as integers.
:CONSTANTS
ALL_BITS MAX_CIDR MIN_CIDR
:PARSE_IP
int_to_ip ip_to_int
:SORT
sort_quad sort_notations
:COMPUTE_FROM_INT
broadcast_int base_int size_from_mask hostmask cidr_to_int
:PARSE_RANGE
parse_ipv4_cidr parse_ipv4_range parse_ipv4_ip auto_parse_ipv4_range
This section explains the Exportable constants.
Same as 0xffffffff
Same as 32
Same as 0
This section covers the parse ipv4 address functions.
Returns a perl usable integer ipv4 representation of the ipv4 quad notation.
Returns the integer formated in the standard quad notation.
This section covers the Exportable sort functions.
Low level sort function used to sort ipv4 addresses in quad notation.
Low level sort function used to sort ipv4 ranges. This function will croak if a range cannot be parsed.
This section covers the Exportable integer computation functions
Returns an integer representing the broadcast address from 2 integers.
Returns an integer representing the base address from 2 integers.
Returns an integer representing the size of a network.
Returns an integer representing the hostmask from 2 integers.
Returns an integer representing netmask from a given cidr size.
This section covers the Exportable range parser functions. An empty set is returned when the range cannot be parsed.
Returns 2 integers representing the base and broadcast of a CIDR.
Returns 2 integers representing the start and end of a ip range.
Returns 2 integers representing the input ip as a /32 range
Attempts to figure out what type of range notation and calls the corresponding parse_ipv4_xxx function, returning an empty set on failure or 2 integers representing the start and end of the range.
Michael Shipper
As of version 1.04 the Project has been moved to SourceForge.net
Copyright (C) 2010 by Michael Shipper
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.10.0 or, at your option, any later version of Perl 5 you may have available.